当前位置:网站首页>QT compilation of IOT management platform 48 characteristic function design
QT compilation of IOT management platform 48 characteristic function design
2022-07-29 02:46:00 【feiyangqingyun】
One 、 Preface
In the actual field application of the Internet of things management platform , I have encountered dozens of improvement needs, large and small , These requirements are put forward by actual users , On the one hand, in order to facilitate user use and improve user experience , On the one hand, in order to improve the integrity of the whole system , There are even some requirements that are not pleasant to say, that is, counterfeiting , For example, the accuracy of hardware equipment is not enough , It will float around some values for a short time , But after the client collects the data , If the value just floats around the alarm value , It can't be said to be an alarm , Because it may also be fluttering caused by interference , In a strict sense, it is not an alarm , Only when the alarm value is continuously exceeded , Is the real alarm , So we need to design an alarm delay parameter , If it is still in alarm after the delay time, it is considered as an alarm .
The storage cycle is well understood , How often is the recorded value of this device stored , Some equipment is important , You can set this storage cycle smaller , such as 5s Just store a value , Some are not important , You can set a large value , In this way, measures can be taken according to local conditions , Save a lot of storage space . Alarm type is also a good parameter rule , The common rule for us is that greater than the upper limit is an overstatement , Lower than the lower limit is a low alarm , For example, temperature belongs to this situation . And some gases are higher than the minimum value, which is a low alarm , Higher than the maximum value belongs to high alarm , It is normal to be lower than the minimum , Toxic gases generally belong to this type . Some specific environments require the gas concentration to exceed the maximum value, such as oxygen , It is normal to require that the maximum value be exceeded , Between the maximum value and the minimum value is a low alarm , Less than the minimum value is a high alarm , Because there is too little oxygen, it is the most urgent event .
Field description
- Ed Number : Node number , from 1 Start .
- position Number : The position number of the detector , Used to uniquely identify a detector .
- control system device : The name of the corresponding mounted main device .
- explore measuring device : The name of the detector , Convenient memory , You can fill in the geographical location .
- The earth site : The detector corresponds to the number index of the controller .
- type Number : Model of detector , Select... From the drop-down box .
- Gas type : The detector corresponds to the type of gas collected .
- Gas model : The detector corresponds to the model of the collected gas .
- On limit value : Upper limit of alarm .
- Next limit value : Lower limit of alarm
- most Big value : Maximum warning value , If it exceeds this value, it will be displayed as this value .
- eliminate zero : Minimum warning value , Less than this value shows 0, Greater than the displayed true value .
- The amount cheng : Assume range 0.25 be Actual number = Analog quantity /4000x range Analog quantity is the collected value .
- shape state : Enabled by default , When a detector is not connected, you can choose to disable .
- The sound The sound : The corresponding sound file after the alarm .
- The earth chart : Map file where the probe is located .
- save Store : The detector records the storage cycle , Units of minutes . That is, how often to store records locally .
- Small Count spot : Calculate the number of decimal places corresponding to the data bits of the analytical data .
- Alarm delay : After the alarm , How long to delay processing , In order to filter false positives caused by data jitter deviation . Default 0.
- Alarm type :HH LL HL.
- X sit mark : The detector is located on the map X coordinate .
- Y sit mark : The detector is located on the map Y coordinate .
Two 、 Functional characteristics
2.1 Software modules
- Equipment monitoring module , Including data monitoring ( Show... In tabular form )、 Device panel ( Display in panel form )、 Map monitoring ( Display in map form )、 Curve monitoring ( Show in curve form ).
- Data query module , Including alarm records 、 Operation record 、 Operation record .
- System setup module , Including basic settings 、 Port Management 、 Controller management 、 Detector Management 、 Alarm linkage 、 Type setting, etc .
- Other setting modules , Including user management 、 Map Management 、 Position adjustment 、 Configuration design 、 Equipment commissioning, etc .
2.2 Basic function
- Device data acquisition , Support serial port 、 The Internet , Serial port can set serial port number 、 Baud rate , The network can be set IP Address 、 Communication port .
- Each port supports acquisition cycle time , Default 1 One device per second .
- Support to set communication timeout times , Default 3 Time .
- Support maximum reconnection time , For rereading offline devices .
- Controller information , Can add controller name , Select the controller address 、 Controller model , Set the number of detectors under the controller .
- Detector information , Can add tag number 、 Detector model 、 Gas type 、 Gas symbol 、 High reported value 、 Under reported value 、 Buffer value 、 Zero value 、 Is it enabled? 、 Alarm sound 、 Background map 、 Storage cycle 、 The number of decimal places for numerical conversion 、 Alarm delay time 、 Type of alarm (HH,LL,HL) etc. .
- Type management configurable controller model 、 Detector model 、 Gas type 、 Gas symbols, etc .
- Map supports importing and deleting , The positions of all detectors on the map can be dragged and saved freely .
- Port information 、 Controller information 、 Detector information 、 Type information 、 User information, etc , Both support import 、 export 、 Export to excel、 Print .
- Operation record 、 Alarm records 、 Operation record , Both support multi condition combined query , For example, time period 、 controller 、 Detector, etc , All records support export to excel/pdf And print .
- Operation record 、 Alarm records 、 All operation records can delete data within a specified time range .
- The system can select the maximum number of records saved in the corresponding table , Automatically clean up early data , Leave enough space for important data .
- Alarm SMS forwarding , Support multiple receiving mobile numbers , The sending interval can be set , Like instant delivery or 6 Send all alarm messages once an hour , The message is too long , Automatically split multiple messages .
- Alarm mail forwarding , Support multiple receiving mailboxes , The sending interval can be set , Like instant delivery or 6 Send all alarm messages once an hour , Support attachment sending .
- Set the Chinese title of the software 、 English title 、logo route 、 All rights reserved .
- The switch is set for startup and operation 、 Alarm sound 、 automatic logon 、 Remember the password, etc .
- Alarm sound can be set to play times , Interface style provides 18 Set skin file selection .
- User management , Including user permission configuration , Different users can have different module permissions .
- User login and user logout , Can remember password and auto login , More than three error prompts and close the program .
- Four monitoring modes , Equipment panel monitoring 、 Map monitoring 、 Form data monitoring 、 Curve data monitoring , Free to switch , The collected data is displayed in real time in all four modes , Alarm flashing, etc .
- Alarm relay linkage , A tag number can link multiple modules and relay numbers across serial ports , Support many to many .
2.3 Special function
- Communication protocol supports modbus_com、modbus_tcp_rtu, Later expansion mqtt Such agreement .
- The data source is in addition to the real hardware device collection , Optional database acquisition , In this way, users can arrange other programmers, such as java The programmer puts the data collected by the front end into the database , The system can collect data directly from the database . Database collection mode can be used as a general system , More suitable for multi person and multi system cooperation .
- Smart skip timeout device , Speed up the acquisition of online devices , Especially useful when there are a large number of devices .
- For smart skip timeout devices , Automatically collect once at the set reconnection time , In order to detect whether the equipment is online again .
- Each detector can be controlled whether it is enabled , If it is not enabled, it will not collect , It will not be displayed on the interface , It is equivalent to temporary shutdown in the operation phase .
- The detector can set the buffer value and alarm delay time , An alarm generated by fluctuations near this value , Not included in the alarm , Only when it is continuously at the alarm value and exceeds the alarm delay time can it be considered as a real alarm , This can avoid many false positives caused by fluctuations .
- The detector can set the storage cycle , Store an operation record according to the set time , The storage cycle can be shorter for those with high importance according to the degree of importance , The unimportant setting is bigger , This can save a lot of storage space , It also ensures the timely storage of important data .
- The detector can set the zero clearing value , When some high-precision and sensitive equipment may leave the factory, the default value may not be 0, The reset value needs to be set to represent the initial value .
- The detector can set the decimal point , It is used to control the display of decimal places for the calculated real data , Equivalent to divided by 10、 Divide 100、 Divide 1000, In this way, most of the detector data directly control the real converted value through the decimal point setting , If special conversion is required, it can be agreed in the communication protocol .
- The type of detector alarm supports multiple types , Some devices are higher than a certain value and report high , Under reporting below a certain value , And some equipment is in the range of minimum and maximum value, which is high alarm , Under reporting below the minimum value , Above maximum normal . In this way, it can be handled according to the situation , Covers various alarm types .
- Original data import 、 export 、 Printer system , Cross platform does not rely on any components , Export data instantaneously .
- Export to excel The records support all excel、wps Wait for the form file version , Do not rely on excel Such as software .
- High color 、 Low color 、 Normal color 、 Default values: color, etc , Can be set freely .
- Support cloud data synchronization , Synchronize the data collected locally to the cloud in real time .
- Support network forwarding and network receiving , When network reception is turned on , Software from udp Receive data for parsing . Network forwarding supports multiple targets IP, In this way, the local acquisition software is realized , Free to transfer data to client , Check the collected data at any time .
- Automatically remember the last user interface and other configuration information , Automatic application after restart .
- The alarm automatically switches to the corresponding map , The detector button flashes , The table data is displayed in the corresponding color .
- Double click the probe Icon , Pop up the corresponding detector details , The back control operation can be customized as required .
- The database supports a variety of , Include sqlite、mysql、sqlserver、postgresql、oracle、 People's Congress, Jincang, etc .
- The data collected by the local device is uploaded to the cloud in real time , So that cell phones APP perhaps web And so on .
- Built in device simulation tools , Support data simulation of multiple devices of different models , At the same time, it also has database data simulation , In order to test the data when there is no equipment .
- standard modbus agreement , Various controller types 、 Detector type 、 species 、 All custom symbols, etc , Very flexible and powerful , The communication protocol sample data is very complete , General various modbus Protocol system , It is applicable to various application scenarios .
- At the same time, it integrates serial communication 、 Network communication 、 Database communication 、 Data import / export printing 、 Communication protocol analysis 、 Interface UI、 Many components and knowledge points such as global skin change , Very suitable for beginners and advanced .
- Support xp、win7、win10、、win11、linux、mac、 All kinds of domestic systems (UOS、 Winning Qilin 、 Galaxy unicorn, etc )、 The embedded linux Such as system .
- Note complete , The project structure is clear , Super detailed complete use of the development manual , Accurate to the function description of each code file , Keep iterating over versions .
3、 ... and 、 Experience address
- Domestic site :https://gitee.com/feiyangqingyun
- International sites :https://github.com/feiyangqingyun
- Personal home page :https://blog.csdn.net/feiyangqingyun
- Zhihu Homepage :https://www.zhihu.com/people/feiyangqingyun
- The product page :https://blog.csdn.net/feiyangqingyun/article/details/97565652
- Online document :https://feiyangqingyun.gitee.io/qwidgetdemo/iotsystem/
- Experience address :https://pan.baidu.com/s/1ZxG-oyUKe286LPMPxOrO2A Extraction code :o05q file name :bin_iotsystem.zip.
- Article navigation :https://qtchina.blog.csdn.net/article/details/121330922
Four 、 design sketch




5、 ... and 、 Related codes
void DeviceServer::doReceiveValue(const QString &portName, quint8 addr, const QList<quint16> &values)
{
// Find the device name
QString deviceName = DbQuery::getDeviceName(portName, addr);
// Find the minimum register address of the detector corresponding to the device address of the current index location
// If the starting register address read is 5 The first data bit returned is the register address 5 The data of , The back is continuous
quint16 nodeMinAddr = DbQuery::getNodeMinAddr(portName, addr);
// According to the decimal point corresponding to different detectors , Conversion value
QList<float> datas;
foreach (quint16 value, values) {
datas << value;
}
for (int i = 0; i < DbData::NodeInfo_Count; ++i) {
if (DbData::NodeInfo_DeviceName.at(i) == deviceName) {
// Sometimes it may appear that a total of 8 A detector but actually read 4 The situation of a detector
int startIndex = DbData::NodeInfo_NodeAddr.at(i) - nodeMinAddr - 1;
if (startIndex >= datas.count()) {
continue;
}
QString positionID = DbData::NodeInfo_PositionID.at(i);
float nodeMax = DbData::NodeInfo_NodeMax.at(i);
float nodeMin = DbData::NodeInfo_NodeMin.at(i);
float nodeRange = DbData::NodeInfo_NodeRange.at(i);
int dotCount = DbData::NodeInfo_DotCount.at(i);
// At present, the received value needs several layers of filtering calculation to be the real value
// The first level is the decimal point ( Default 0), For example, the value received is 1000, If the decimal point is set 1 The truth is 100
// The second layer is the range ( Default 0), For example, receive 998, If the set range 0.25 Then after the operation 998/4000*0.25=0.062375
// The third layer is the maximum ( Default 1000), Assume the maximum value set 1000, If the value received >1000 Then take 1000, Because some equipment is damaged or false alarm, the collected value is a large inaccurate value
// The fourth layer is zero clearing ( Default 0), Suppose that 50, Less than 50 All considered to be 0, Because some equipment is damaged or false alarm, the collected value is a small inaccurate value
// Recalculate the true value according to the set decimal point
float nodeValue = (float)values.at(startIndex);
if (dotCount > 0) {
nodeValue = nodeValue / qPow(10, dotCount);
}
//4218 Calculate the value according to the new rule Actual number = Analog quantity /4000* range Analog quantity is the collected value
if (nodeRange > 0) {
nodeValue = (float)values.at(startIndex) / 4000 * nodeRange;
}
// If the received value is greater than the maximum value, take the maximum value as the current value
nodeValue = nodeValue > nodeMax ? nodeMax : nodeValue;
// If the zero elimination threshold is set , When the zero elimination threshold is not reached, the display is zero , The true value is displayed only when the zero elimination threshold is exceeded
if (nodeRange == 0) {
nodeValue = nodeValue < nodeMin ? 0 : nodeValue;
}
// Precision filtering , Avoid excessive accuracy and long display
nodeValue = QString::number(nodeValue, 'f', AppConfig::Precision).toFloat();
// Find the current detector and handle the detector alarm
// If the current value is less than the minimum value and is not currently in the lower limit alarm, the alarm will be triggered
// If the current value is greater than the maximum value and is not currently in the upper limit alarm, the alarm will be triggered
//0- Underreported 1- Low report recovery 2- High news 3- High report recovery
quint8 nodeStatus = 100;
// Handle according to different alarm types set , Assume the upper limit 100, Lower limit 25
//HH Means more than 25 It's underreporting , exceed 100 It's a tall report
//HL Indicates lower than 25 It's underreporting , exceed 100 It's a tall report
//LL Indicates lower than 25 It's a tall report , lower than 100 It's underreporting
QString alarmType = DbData::NodeInfo_AlarmType.at(i);
if (alarmType == "HH") {
doAlarmHH(nodeStatus, positionID, nodeValue, i);
} else if (alarmType == "HL") {
doAlarmHL(nodeStatus, positionID, nodeValue, i);
} else if (alarmType == "LL") {
doAlarmLL(nodeStatus, positionID, nodeValue, i);
}
// Handle alarms
//qDebug() << TIMEMS << positionID << nodeStatus << nodeValue;
doAlarm(nodeStatus, positionID, nodeValue, i);
// Data without change does not need to be processed , Otherwise, refreshing so much data on the interface at once may lead to high CPU, The same data is not necessary
if (DbData::NodeInfo_NodeValue.at(i) != nodeValue) {
QString nodeSign = DbData::NodeInfo_NodeSign.at(i);
DeviceHelper::deviceValue(positionID, nodeValue, nodeSign);
DbData::NodeInfo_NodeValue[i] = nodeValue;
}
// Cloud data synchronization
if (AppConfig::UseNetDb) {
QString sql = QString("update NodeData set NodeValue='%1',SaveTime='%2' where PositionID='%3'").arg(nodeValue).arg(DATETIME).arg(positionID);
DbData::DbNet->append(sql);
}
datas[startIndex] = nodeValue;
}
}
emit receiveValue(portName, addr, datas);
}
边栏推荐
- Why is redis fast? Message queue, single thread
- CatchAdmin实战教程(四)Table组件相关功能实现
- Servlet三种实现方式
- ES6 detailed quick start!
- laravel框架中实现封装公共方法全局调用
- I want to talk about high concurrency.
- Shell 脚本 快速入门 -01
- 白马过隙的时光
- Understand the evolution of redis architecture in one article
- Multimodal Unsupervised Image-to-Image Translation多通道无监督图像翻译
猜你喜欢

where、having、group by、order by,is null,not in,子查询,delete,日期函数

VR safety training of mine mining virtual reality improves employees' vigilance and protection awareness

第八天笔记

Mqtt routine

6-21 vulnerability exploitation MySQL weak password cracking

6-21漏洞利用-mysql弱口令破解

Understanding service governance in distributed development

第五天实验

ES6 detailed quick start!

全新UI四方聚合支付系统源码/新增USDT提现/最新更新安全升级修复XSS漏洞补单漏洞
随机推荐
2022/07/28 learning notes (day18) common APIs
0728~面试题梳理
Cuda-npp image and video processing
Introduction to network foundation
CUDA details GPU architecture
QT qstringlist usage
Code implementation - the greatest common factor of polynomials (linear algebra)
Kbxxxxx is not necessarily a patch, but also a description of a solution to a problem
K210——声源定位、声音识别
2022/07/28 学习笔记 (day18) 常用API
Explanation of engineering economics terms
【无标题】
HTTP缓存
用于校园流浪猫信息记录和分享的小程序源码/微信云开发中大猫谱小程序源码
XSS靶场(二)xss.haozi
Mqtt routine
PHP幸运抽奖系统带后台源码
区区区间---线段树lazy标记板子题
This blogger has a comprehensive classification of QT. If you are free, go to study and summarize it and record it.
Some records during the development of ros2/ros1