当前位置:网站首页>QT compile IOT management platform 39 alarm linkage
QT compile IOT management platform 39 alarm linkage
2022-07-07 21:37:00 【feiyangqingyun】
One 、 Preface
This system supports alarm linkage , It's after a detector gives an alarm , And then issue orders , Notify the following relay alarm , Generally, it is sent through serial port , Because the existing serial port lines will be used on site, such as 485 Bus , So this system needs special treatment , It's public 485 Communication bus , In the alarm linkage table , If the added serial port number exists in the port information table , You don't need to new A serial port , Directly send the command to be processed to the port communication class , When polling, the port communication class finds whether there are commands that need to be executed first , In some cases, priority is given to these commands , Only after all these commands are processed , Then send the polling command .
A sub device alarms , Multiple relays can be linked , One to many relationship , Multiple devices can also be linked to the same relay , many-to-one , Taken together, this becomes a many to many relationship , In the relay linkage information table , You can customize which sub equipment tag number alarms , Corresponding to which serial port and which address set are linked . At present, the system supports alarm linkage in hardware , In the later stage, soft linkage processing can be customized according to user needs , For example, pop up the corresponding monitoring alarm image .
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 AlarmLink::checkAlarm(const QString &positionID, bool alarm)
{
for (int i = 0; i < DbData::AlarmLink_Count; ++i) {
if (positionID == DbData::AlarmLink_PositionID.at(i)) {
QString comName = DbData::AlarmLink_ComName.at(i);
quint8 modelAddr = DbData::AlarmLink_ModelAddr.at(i);
QString linkAddr = DbData::AlarmLink_LinkAddr.at(i);
// Generate data to be linked
QByteArray body;
body.append(0x06);
body.append(data_zero);
body.append(data_zero);
// Send all alarm relay linkage at one time , For example, it's set linkAddr by 1,2,3
// Specifically, it is calculated in bits , Fill the corresponding placeholder , Two bytes in total
// Take the original one from the corresponding module address, replace it and update it
QString strBin = "0000000000000000";
QString temp = QString("%1|%2").arg(comName).arg(modelAddr);
int index = -1;
for (int i = 0; i < alarmIDs.count(); ++i) {
if (alarmIDs.at(i).startsWith(temp)) {
index = i;
break;
}
}
// Update the alarm bit again , And keep the previous alarm bit
if (index >= 0) {
strBin = alarmIDs.at(index).split("|").last();
QStringList linkAddrs = linkAddr.split("|");
foreach (QString addr, linkAddrs) {
if (!addr.isEmpty()) {
strBin[16 - addr.toInt()] = alarm ? '1' : '0';
}
}
alarmIDs[index] = QString("%1|%2|%3").arg(comName).arg(modelAddr).arg(strBin);
}
quint16 addr = QUIHelper::strBinToDecimal(strBin);
body.append(QUIHelper::ushortToByte(addr));
QString type = QString(" A serial port [%1] %2 Alarm linkage %3").arg(comName).arg(alarm ? " start-up " : " stop it ").arg(linkAddr);
writeData(comName, type, modelAddr, body);
}
}
}
void AlarmLink::append(const QString &positionID)
{
// Limit the maximum alarm queue , Those that already exist do not need to continue to join
if (alarmPositionIDs.count() > 50 || alarmPositionIDs.contains(positionID)) {
return;
}
QMutexLocker lock(&mutex);
alarmPositionIDs << positionID;
}
void AlarmLink::remove(const QString &positionID)
{
// Need to remember the previous alarm , Replace the new
// This remains to be discussed , Whether to mute the module completely or individually , Single problem , When both are sent to an alarm bit, they will be inconsistent
//2019-3-25 Change to no need to reset the alarm relay , The user triggers the reset of all relays by clicking the mute button
//checkAlarm(positionID, false);
}
void AlarmLink::reset()
{
// Send reset data to the serial port corresponding to all tag numbers
QByteArray body;
body.append(0x06);
body.append(data_zero);
body.append(data_zero);
body.append(data_zero);
body.append(data_zero);
QStringList comNames;
for (int i = 0; i < DbData::AlarmLink_Count; ++i) {
QString comName = DbData::AlarmLink_ComName.at(i);
// Filter those that have sent reset , Otherwise, a large number of repeated transmissions
if (!comNames.contains(comName)) {
quint8 modelAddr = DbData::AlarmLink_ModelAddr.at(i);
QString type = QString(" A serial port [%1] %2 Alarm linkage %3").arg(comName).arg(" Reset ").arg(0);
writeData(comName, type, modelAddr, body);
comNames << comName;
break;
}
}
// Build an empty queue of alarmed bits
alarmIDs.clear();
alarmPositionIDs.clear();
for (int i = 0; i < DbData::AlarmLink_Count; ++i) {
QString comName = DbData::AlarmLink_ComName.at(i);
quint8 modelAddr = DbData::AlarmLink_ModelAddr.at(i);
QString alarmID = QString("%1|%2|0000000000000000").arg(comName).arg(modelAddr);
// If the serial port number already exists, the module does not need to continue
bool exist = false;
QString temp = QString("%1|%2").arg(comName).arg(modelAddr);
for (int i = 0; i < alarmIDs.count(); ++i) {
if (alarmIDs.at(i).startsWith(temp)) {
exist = true;
break;
}
}
if (!exist) {
alarmIDs << alarmID;
}
}
}
void AlarmLink::writeData(int index, const QString &type, quint8 addr, const QByteArray &body)
{
// First judge whether the serial port is working normally
QByteArray data;
data.append(addr);
data.append(body);
data.append(QUIHelper::getCrcCode(data));
// You need to judge the quantity, or it will cross the boundary
if (coms.count() > index) {
coms.at(index)->write(data);
}
QString portName = " Alarm linkage ";
emit sendData(portName, addr, data);
emit receiveInfo(portName, addr, type);
}
void AlarmLink::writeData(const QString &comName, const QString &type, quint8 modelAddr, const QByteArray &body)
{
// If the serial port is not an independent serial port, send data from the serial port used by the controller
int index = comNames.indexOf(comName);
if (index >= 0) {
writeData(index, type, modelAddr, body);
} else {
index = DbData::PortInfo_ComName.indexOf(comName);
if (index >= 0) {
QString portName = DbData::PortInfo_PortName.at(index);
DeviceServer::Instance()->writeData(portName, type, modelAddr, body);
}
}
}
边栏推荐
- Use br to recover backup data on azure blob storage
- Virtual machine network configuration in VMWare
- Is it safe to open an account of BOC shares in kainiu in 2022?
- Implement secondary index with Gaussian redis
- Intelligent transportation is full of vitality. What will happen in the future? [easy to understand]
- Is it safe to open an account online now? I want to know where I can open an account in Nanning now?
- The latest version of codesonar has improved functional security and supports Misra, c++ parsing and visualization
- The cyberspace office announced the measures for data exit security assessment, which will come into force on September 1
- 浅解ARC中的 __bridge、__bridge_retained和__bridge_transfer
- Codeforces round 275 (Div. 2) C – diverse permutation (construction) [easy to understand]
猜你喜欢
Wechat official account oauth2.0 authorizes login and displays user information
Ubuntu安装mysql8遇到的问题以及详细安装过程
ISO 26262 - considerations other than requirements based testing
How to meet the dual needs of security and confidentiality of medical devices?
Usage of MySQL subquery keywords (exists)
Focusing on safety in 1995, Volvo will focus on safety in the field of intelligent driving and electrification in the future
MySQL约束之默认约束default与零填充约束zerofill
解决使用uni-app MediaError MediaError ErrorCode -5
恶魔奶爸 B3 少量泛读,完成两万词汇量+
NVR硬盘录像机通过国标GB28181协议接入EasyCVR,设备通道信息不显示是什么原因?
随机推荐
Hdu4876zcc love cards (multi check questions)
The difference between NPM uninstall and RM direct deletion
[C language] advanced pointer --- do you really understand pointer?
A brief understanding of the in arc__ bridge、__ bridge_ Retained and__ bridge_ transfer
Default constraint and zero fill constraint of MySQL constraint
现在网上开户安全么?想知道我现在在南宁,到哪里开户比较好?
华泰证券可以做到万一佣金吗,万一开户安全嘛
Cocos2d-x game archive [easy to understand]
Solve the problem of using uni app mediaerror mediaerror errorcode -5
2022 how to evaluate and select low code development platforms?
Feature generation
Focusing on safety in 1995, Volvo will focus on safety in the field of intelligent driving and electrification in the future
Details of C language integer and floating-point data storage in memory (including details of original code, inverse code, complement, size end storage, etc.)
[uvalive 6663 count the regions] (DFS + discretization) [easy to understand]
EasyUI date control emptying value
Description of the difference between character varying and character in PostgreSQL database
Helix QAC 2020.2 new static test tool maximizes the coverage of standard compliance
Virtual machine network configuration in VMWare
Mahout-Pearson correlation的实现
恶魔奶爸 C