CN112925656B - Multi-protocol automation equipment monitoring system based on message queue and control method thereof - Google Patents
Multi-protocol automation equipment monitoring system based on message queue and control method thereof Download PDFInfo
- Publication number
- CN112925656B CN112925656B CN202110028975.5A CN202110028975A CN112925656B CN 112925656 B CN112925656 B CN 112925656B CN 202110028975 A CN202110028975 A CN 202110028975A CN 112925656 B CN112925656 B CN 112925656B
- Authority
- CN
- China
- Prior art keywords
- serial port
- queue
- protocol
- data
- task
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000012544 monitoring process Methods 0.000 title claims abstract description 97
- 238000000034 method Methods 0.000 title claims abstract description 19
- 230000006870 function Effects 0.000 claims description 27
- 230000001360 synchronised effect Effects 0.000 claims description 15
- 230000005540 biological transmission Effects 0.000 claims description 11
- 230000002159 abnormal effect Effects 0.000 claims description 3
- 230000008569 process Effects 0.000 claims description 3
- 238000004806 packaging method and process Methods 0.000 claims description 2
- 238000004891 communication Methods 0.000 abstract description 10
- 230000009191 jumping Effects 0.000 description 7
- 230000007246 mechanism Effects 0.000 description 6
- 230000001960 triggered effect Effects 0.000 description 6
- 230000008901 benefit Effects 0.000 description 4
- 238000000926 separation method Methods 0.000 description 3
- 238000013461 design Methods 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/3041—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is an input/output interface
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/547—Messaging middleware
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Quality & Reliability (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a multi-protocol automation equipment monitoring system based on a message queue and a control method thereof. The system comprises a task function module, a data center module and a control module, wherein a message queue is adopted as a middleware for information communication between systems, so that the function of monitoring the bottom-layer automatic equipment is realized, the control module monitors the automatic equipment, acquires the state of the bottom-layer automatic equipment in real time, stores the real-time state of the bottom-layer automatic equipment into the data center, is convenient for a user to inquire, and detects the state of the system at any time to alarm; meanwhile, the control system is used for controlling the bottom-layer automation equipment, so that the control requirement of a user on the automation equipment is met. The invention transmits information through the message queue, so that the monitoring mode of the monitoring system gets rid of the physical connection limit; the bottom automation equipment is controlled preferentially through the control operation of high priority, so that the preferential control of the specific scene is realized; can be compatible with various protocols and solves the communication problem of various bottom automation devices.
Description
Technical Field
The invention relates to the technical field of automatic equipment monitoring, in particular to a multi-protocol automatic equipment monitoring system based on a message queue and a control method thereof.
Background
At present, a monitoring system of an automation device has a wide application scene. For example, exhaust fan monitoring systems for temperature regulation and air circulation in high-rise buildings; in greenhouse agriculture, monitoring systems designed to maintain a constant temperature and illumination intensity, and the like.
With the development of the times, the traditional monitoring system cannot meet the requirements of the times. Although the communication of the bottom layer equipment is not greatly changed by the current monitoring system, the communication is based on the serial communication standard of the RS485 standard. But the current society demands increasingly more monitoring systems. The prior monitoring system stores the setting data and the real-time data of the automation equipment in the form of a client by using a file system, and sends serial data through a serial port, so that all the automation equipment in the system is monitored. The automatic equipment monitored by the monitoring mode has the advantages of small data quantity and small monitoring scene, and can not meet the current requirements.
The number of the devices in the existing monitoring system is large, and the existing system only needs to monitor about 10 ten thousand of automation devices, which can reach millions or even tens of millions; the traditional monitoring system only needs to monitor the automation equipment in one place, and currently monitors the automation equipment in different places at the same time; the types of automation equipment are multiple, the previous factory monitoring is single automation equipment, the monitoring system needs to monitor a plurality of different automation equipment, and the system needs to support a plurality of serial protocols simultaneously; the prior monitoring system has poor support for the priority control function of the automation equipment and needs to be further optimized.
Disclosure of Invention
In order to overcome the defects and shortcomings in the prior art, the invention provides a multi-protocol automatic equipment monitoring system based on a message queue and a control method thereof, and the message queue is used for transmitting information in the system, so that the effective separation of a data center and a control module is realized, the assemblability and the expandability of the system are improved, the system is used for monitoring not only one type of automatic equipment, but also one type of automatic equipment under a serial server, and the monitoring system is separated from the dependence of physical connection.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
the invention provides a multi-protocol automation equipment monitoring system based on a message queue, which comprises: the system comprises a task function module, a data center module and a control module;
the task function module is used for managing system functions and system tasks of the bottom-layer automation equipment and pushing the system tasks into a task queue;
the data center module comprises a Redis memory database and MySQL;
the Redis memory database is used for storing real-time state, real-time setting information and alarm information of the automation equipment, and the MySQL is used for storing user information, region information and automation equipment setting information;
the control module comprises a task queue processor and a plurality of serial controllers;
the task queue processor is used for acquiring system tasks in the task queue, converting the system tasks into control commands and pushing the control commands into the corresponding serial port queues;
the serial port controller comprises a serial port queue processor and a serial port protocol analyzer, wherein the serial port queue processor is used for acquiring control commands in a serial port queue, and the serial port protocol analyzer is used for assembling the control commands into serial port control commands;
the serial port controller sends a serial port control command to the bottom layer automation equipment to control the bottom layer automation equipment, monitors the return information of the bottom layer automation equipment, analyzes the return information and pushes the return information into a synchronous information queue;
and the data center module updates the automation equipment data obtained by scanning by the control module into an automation equipment state cache table in the Redis memory database in real time through the synchronous information queue, and synchronously updates the automation equipment setting in the MySQL.
As a preferable technical scheme, the system task is provided with priority, a priority queue is used as a task queue, the task with high priority is preferentially executed, and a task queue processor of the control module obtains task content with high priority by detecting an automatic device setting cache table in the data center module, and then the task content with high priority is assembled into a corresponding high-priority control command.
As the preferable technical scheme, the bottom layer automation equipment comprises a serial port, a repeater and automation equipment, wherein the serial port controller is connected with the serial port, the serial port is connected with the repeater, the repeater is connected with the automation equipment, the control module inquires the information of the automation equipment in the repeater through the serial port and correspondingly controls the repeater, and the repeater is used for acquiring the state of the automation equipment in real time and converting a control command into the control command of the automation equipment so as to complete the control of the automation equipment.
As an optimal technical scheme, the serial port controllers are respectively connected with bottom automation equipment, and each serial port queue processor processes one serial port queue and one serial port.
The invention also provides a control method of the multi-protocol automatic equipment monitoring system based on the message queue, which comprises the following steps:
initializing a serial port controller;
the task function module pushes the system task into a task queue;
a task queue processor in the control module acquires system tasks in a task queue;
the task queue processor acquires an automation device ID in a system task, and acquires real-time task information of the automation device in the automation device setting cache table through the data center module;
the task queue processor assembles the ID of the automation equipment and the real-time setting information of the automation equipment into a control command of the system;
the task queue processor acquires a serial port queue which is required to be sent to the system by the automatic equipment through a serial port ID in the control command, and pushes the control command into the corresponding serial port queue;
the serial port queue processor monitors control commands in the serial port queue, acquires the control commands in the serial port queue if data exist in the serial port queue, and continues monitoring if the data do not exist;
the serial port protocol analyzer assembles the control command into a serial port control command;
judging whether the serial port protocol analyzer can convert the control command into a serial port control command, if so, acquiring the serial port control command, directly transmitting data into a serial port by a serial port queue processor, and if not, discarding the control command;
judging whether returned data in the serial port are legal or not, if not, indicating that the transmission fails, retransmitting the serial port control command by the serial port queue processor, and if the transmission failure times exceed a threshold value, indicating that the serial port control command fails to be transmitted, and returning to monitor the control command in the serial port queue again;
acquiring data received by a serial port, detecting the validity of the data received by the serial port by a serial port protocol analyzer by a serial port queue processor, analyzing the information of the automatic equipment returned by the serial port protocol analyzer if the data is legal, packaging the information into the returned information of the automatic equipment, retransmitting the serial port control command if the information is illegal, indicating that the serial port control command fails to be transmitted if the transmission failure times exceed a threshold value, and returning the control command in a monitoring serial port queue again;
the serial port queue processor pushes the return information of the automatic equipment into a synchronous information queue;
the data center module reads the data in the synchronous information queue and synchronizes the state cache table of the automatic equipment in real time.
As a preferred technical solution, the serial port controller initializing specific steps include:
the serial port controller firstly reads an internal configuration file of the serial port controller;
setting a serial port controller ID and connecting a monitoring system;
judging whether the connection monitoring system is successful, if so, reading a serial port protocol rule file, otherwise, stopping the operation of the serial port controller;
detecting the legitimacy of the serial port protocol rule file, if the serial port protocol rule file is illegal, stopping the operation of the serial port controller, and if the serial port protocol rule file is legal, analyzing the serial port rule file to generate a corresponding serial port protocol analyzer;
accessing a monitoring system to obtain a serial port to be controlled by a current serial port controller;
the serial port controller opens a serial port to be controlled;
detecting whether the serial port is successfully opened, if so, deleting a serial port queue in a monitoring system corresponding to the serial port, and generating a serial port queue processor;
and detecting whether a next serial port to be opened exists, if so, opening the serial port to be controlled by the serial port controller, and detecting whether the serial port is successfully opened again, otherwise, completing the initialization of the serial port controller.
As a preferable technical scheme, the content of the internal configuration file of the serial port controller is established in an XML form, and the content comprises the IP address of the monitoring system of the automatic equipment and the serial number ID of the controller.
As an optimal technical scheme, the serial port protocol in the serial port protocol rule file adopts a serial port rule protocol based on UART or a serial port rule protocol written based on MODBUS RTU.
As a preferable technical scheme, the validity of the serial port protocol rule file is detected, the serial port protocol adopts a serial port rule protocol based on UART, and the detection steps of illegal returned data are as follows:
the returned data length is 0, which means that serial port data is not received;
the return data length is less than 70, representing that complete serial port return data is not received;
the returned serial port data does not find the protocol head and the protocol tail, representing the returned serial port data error;
the returned serial port data fails the CRC check;
and the returned serial port data is found to be unmatched with the transmitted repeater after analysis.
As a preferable technical scheme, the legitimacy of the serial port protocol rule file is detected, the serial port protocol adopts a MODBUS RTU protocol, and the detection steps of illegal returned data are as follows:
the return data length is 0, representing no return data;
after the data is sent, the repeater returns abnormal error data of the MODBUS RTU, which represents that the protocol transmission fails.
Compared with the prior art, the invention has the following advantages and beneficial effects:
(1) The invention realizes the effective separation of the data center and the control module by transmitting the information in the system through the message queue, thereby improving the assemblability and expandability of the system, leading the system to not only monitor one type of automation equipment, but also monitor the automation equipment under one serial server, and leading the monitoring system to be separated from the dependence of physical connection.
(2) The invention controls the automation equipment through the priority message queue, and the high-priority control operation can control the bottom automation equipment preferentially, thereby realizing the preferential control of some specific scenes.
(3) The invention can be compatible with various protocols and solves the communication problem of various bottom automation devices and systems.
Drawings
FIG. 1 is a schematic diagram of a message queue-based multi-protocol automated equipment monitoring system according to the present invention;
FIG. 2 is a flow chart of initialization in the serial port controller of the present invention;
FIG. 3 is a flow chart of a supervisory automation device according to the present invention;
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Examples
As shown in fig. 1, the present embodiment provides a multi-protocol automation equipment monitoring system based on a message queue, which is used for monitoring automation equipment in a large-scale scene, and can manage the large-scale scene, monitor the state of the automation equipment in the scene in real time, control the rotation speed of the automation equipment in real time, control the emergency state of the automation equipment, set the speed of the automation equipment, and formulate timing tasks, fire-fighting tasks and the like. In an embodiment, the automation equipment monitoring system interacts with the automation equipment at the bottom layer in a serial port communication manner. The method specifically comprises the following steps: the system comprises a task function module, a data center module and a control module;
task function module: the system tasks are mainly managed, and a plurality of tasks aiming at the bottom-layer automation equipment exist in the system, such as a polling task for a monitoring system to scan the bottom-layer automation equipment in real time and acquire the real-time state of the automation equipment. The system tasks in the monitoring system are respectively as follows: polling tasks, setup tasks, timing tasks, panel tasks, fire tasks, emergency tasks, and self-checking tasks. When part of system tasks are started, the system tasks are automatically triggered, such as polling tasks; the fire-fighting task is triggered by special conditions, such as a timing task, the timing task can be triggered only when a time point is needed, and the fire-fighting task can be triggered only after the fire-fighting alarm is detected in the fire-fighting task needs system; and part of system tasks, such as setting tasks, panel tasks and emergency tasks, are triggered by a user, and the user generates corresponding system tasks by setting the speed of the automation equipment.
These system tasks have their own priorities, and the automatic motor IDs of the tasks to be executed are required, and the priorities of the above system tasks are gradually increased from left to right. In addition, the task function module is also a collection of other function modules in the system, such as a user management function, login management, system log management and other function management collection.
And a data center module: the data center module is mainly used for integrating data in the system and comprises a Redis memory database and MySQL. The Redis stores real-time status, real-time setting information and alarm information of the automation equipment. Stored in MySQL are some information that needs to be stored persistently, such as user information, area information, automation device setting information, etc. in the system.
The data center module updates the automation equipment state cache table in the Redis in real time by the automation equipment data obtained by scanning by the control module through the synchronous information queue, and even synchronously updates the automation equipment setting in the MySQL. When the user updates the setting of the automation equipment through the task function module, the data center module updates the automation equipment setting cache table of Redis. The task function module update information, such as user information, log information, etc., is updated in MySQL.
And the control module is used for: the main function of the control module is to inquire the information of the bottom layer automation equipment and control the bottom layer automation equipment. The control module consists of 2 parts, a task queue processor and a plurality of serial controllers. The task queue processor mainly acquires tasks in the task queue, converts task data into control commands after processing, and pushes the control commands into corresponding serial port queues. Each serial controller has serial controller serial number ID, and each serial controller controls a plurality of serial ports. Each serial port is ID coded, and the serial port ID consists of serial port controller ID+serial port number. The serial port controller comprises a serial port queue processor and a serial port protocol analyzer. The serial port queue processor mainly acquires control commands in the serial port queue, and puts the control commands into the serial port protocol analyzer to assemble the serial port control commands. The serial port controller directly controls the serial port, acquires the information of the automation equipment in the monitoring system by monitoring the serial port data, sends a serial port control command to the corresponding repeater, and controls the automation equipment at the bottom layer through the repeater.
The control module acquires system tasks to be executed by the system through a task queue, assembles the system tasks into a plurality of control commands through a task queue processor, and sends the control commands to the bottom-layer automation equipment through a serial port controller so as to realize the function of controlling the bottom-layer automation equipment. Meanwhile, the serial port controller monitors the return information of the bottom automation equipment, and pushes the automation equipment data into the synchronous information queue after analysis.
The monitoring system of the invention separates the control module from other modules of the system through the message queue. Specifically, the functions of the monitoring automation equipment and the data collection function are separated, and different types of relays are supported through the serial port protocol rule file. The monitoring system is divided into two parts, wherein one part is an upper module directly interacting with the bottom automation equipment, a task function module and a data center module; the other part is a control module which interacts with the bottom layer automation equipment through a serial port.
A plurality of serial controllers exist in a control module in the monitoring system. Each serial port controller operates on a computer connected with the bottom automation equipment to control part of serial ports in the computer. Each serial port controller obtains a control command of the system from the serial port queue, converts the control command into a serial port control command and then sends the serial port control command to a corresponding serial port to realize the control function of the automation equipment; in addition, after the serial port controller detects that the controlled serial port has data returned by the bottom automation equipment, the returned data is taken out for analysis, and then the data of the system is synchronized with the data center module of the monitoring system through the synchronous information queue. The design breaks away from the communication connection between the monitoring system and the bottom automation equipment, and realizes the separation of the data center and the control module, thereby breaking away from the condition that one monitoring system can only monitor the automation equipment at one place, and improving the expandability of the system.
The monitoring system may have multiple commands for control at the same time, and the system may only execute the highest priority command. And the first realization mechanism is that the monitoring system adopts a priority queue as a task queue, and the task with high priority can be executed first, so that the priority execution of the command is ensured. And the second realization mechanism is used for acquiring task content with high priority by detecting an automatic equipment setting cache table in the data center module when the task queue processor of the control module assembles a control command with a system task in the task queue, and then assembling the control command with the corresponding high priority. The monitoring system uses both mechanisms to jointly ensure the preferential execution of the task.
The control module needs to control all automation devices in a certain period. The serial port controller of the control module designs a module of the serial port queue processor aiming at the serial port monopolization. When the serial port controllers of the control module in the monitoring system are started, the serial port protocol rule files are read, and are initialized to generate different controllers, so that the serial port controllers can be adapted to different types of automation equipment. In this way the multi-protocol requirements in the monitoring system are fulfilled.
Each serial port queue processor processes a serial port queue and a serial port, and the sending and receiving among the serial port queue processors are not affected and can be executed in parallel. Based on this characteristic, serial queue processors in the serial controller are independent threads and can execute in parallel. The advantage of this mechanism is:
1) The monitoring system updates the real-time state of the automatic equipment through the polling task, and adopts the mechanism, the period of all the automatic equipment of the scanning system is limited by the number of the automatic equipment in the system, but the number of the automatic equipment under the serial port.
2) Different system tasks among the serial ports are not affected, for example, the serial port 1 executes a timing task, the serial port 2 sends a fire-fighting task command, and the system tasks among the two can be executed in parallel.
There are multiple types of automation devices in the monitoring system, and the monitoring system can identify and control different types of automation devices. Based on the requirement, the monitoring system sets a serial port protocol rule file and analyzes a serial port protocol formed based on UART serial port communication protocol rules or MODBUS RTU serial port communication protocol rules. When the controller in the control module is started, the controller firstly reads the serial port protocol rule file of the controller and then initializes the serial port protocol rule file, so that serial port controllers adapting to different automation devices are generated, and different bottom automation devices are controlled.
The bottom automation equipment comprises a serial port, a repeater and automation equipment. The computer devices running the serial controllers are all called serial servers. The serial port server is connected with the equipment at the bottom layer through serial ports, the serial port controller is used for controlling the automation equipment at the bottom layer, N serial ports are arranged in one serial port server, 30 relays can be connected to one serial port in the monitoring system, and at most 30 automation equipment can be connected to one relay. The monitoring system inquires the information of the automation equipment in the repeater through the serial port and correspondingly controls the repeater. The relay mainly acquires the state of the automation equipment in real time, and converts the control command in the relay into the control command of the automation equipment to realize the control of the bottom automation equipment, so that the serial port controller in the control module in the embodiment needs to run on a serial port server connected with the automation equipment, and the state of the bottom automation equipment and the control equipment are checked through the serial port under the serial port server.
The embodiment also provides a control method of the multi-protocol automatic equipment monitoring system based on the message queue, which comprises the following specific steps:
as shown in fig. 2, the serial port controller is initialized:
step 101: the serial port controller firstly reads an internal configuration file of the serial port controller;
the content of the internal configuration file of the serial port controller is established in an XML form, and the internal content is the IP address of the monitoring system of the automatic equipment and the serial number ID of the controller;
step 102: setting a serial port controller ID and connecting a monitoring system;
step 103: judging whether the connection monitoring system is successful, if so, entering a step 105, otherwise, entering a step 104;
step 104: the serial port controller stops running;
step 105: reading a serial port protocol rule file;
the serial port rule file is mainly in the form of a file, and generates serial port protocols suitable for different automation devices. The serial port protocol has two forms, namely a serial port rule protocol based on UART or a serial port rule protocol written based on MODBUS RTU protocol;
step 106: detecting the legitimacy of the serial port protocol rule file, if the rule is not legal, jumping to step 104, and if the rule is legal, jumping to step 107;
step 107: analyzing the serial port rule file to generate a corresponding serial port protocol analyzer;
step 108: accessing a monitoring system to obtain a serial port to be controlled by the serial port controller;
the serial port controller accesses a serial port number which needs to be opened by the serial port controller of the monitoring system, and the monitoring system transmits serial port information to the serial port controller through JSON;
step 109: the serial port controller opens a serial port to be controlled;
because the serial port has monopolizing property, after the serial port controller opens the serial port, other programs cannot use the serial port, which means that the serial port is controlled by the serial port controller;
step 110: detecting whether the serial port is successfully opened, if so, jumping to the step 111, and if so, jumping to the step 112;
step 111: opening fails, deleting a serial port queue in a monitoring system corresponding to the serial port, and then jumping to a step 113;
step 112: the serial port is successfully opened, a serial port queue processor is generated, and the step 113 is skipped;
step 113: and detecting whether a next serial port to be opened exists, if so, jumping to step 109, otherwise, completing the initialization of the serial port controller.
After the serial port controller is successfully initialized, the monitoring system can monitor the automation equipment of the bottom layer. The monitoring system controls the automation equipment through the task function module, the data center module and the control module. The task function module generates a system task which needs to control the bottom-layer automation equipment, the control module analyzes the system task, converts the system task into a serial port control command and controls the automation equipment, and meanwhile, the state information of the automation equipment returned by the automation equipment is used for updating the data in the data center module through the synchronous information queue.
As shown in fig. 3, the specific steps for controlling the underlying automation device in the monitoring system include:
step 201: the task function module pushes the system task into a task queue;
the system tasks generated in the task function module are a polling task, a setting task, a timing task, a panel task, a fire-fighting task, an emergency task and a self-checking task. Two pieces of information exist in the system task, and the ID number of the automation equipment and the priority of the system task are given;
step 202: a task queue processor in the control module acquires system tasks in a task queue;
step 203: the task queue processor acquires an automation device ID in a system task, and acquires real-time task information of the automation device in an automation device setting cache table through the data center module, wherein if the automation device is simultaneously in a plurality of tasks, the task setting with the highest priority is acquired;
step 204: the task queue processor assembles the ID of the automation equipment and the real-time setting information of the automation equipment into a control command of the system;
since the command of the monitoring system is sent for the relays, each relay theoretically controls 30 automation devices. The control command thus constructed is to construct a control command for the repeater and also to control commands for 30 automation devices. If some of the 30 automation devices do not exist in the system, constructing a default control command; determining a serial port ID to which a control command needs to be sent through a repeater ID to be sent, and putting the serial port ID into the control command;
step 205: the task queue processor acquires a serial port queue which is required to be sent to the system by the automatic equipment through a serial port ID in the control command, and pushes the control command into the corresponding serial port queue;
step 206: a serial port queue processor in a controller in the control module monitors a control command in a serial port queue, if the serial port queue has data, the step 207 is skipped, otherwise, the step 206 is repeated;
step 207: acquiring a control command in a serial port queue;
step 208: the serial port protocol analyzer assembles the control command into a serial port control command;
step 209: the serial port protocol parser will jump to step 211 if it can convert the control command into a serial port control command, otherwise jump to step 210;
for example, the control command sets the automation equipment A to rotate anticlockwise, but the serial port protocol analyzer does not set the command for the automation equipment to rotate anticlockwise, so that the serial port protocol analyzer cannot convert the control command into the serial port control command;
step 210: step 209, discarding the control command;
step 211: step 209 of uploading, after obtaining the serial port control command, the serial port queue processor directly sends the data to the serial port;
according to step 213, if the returned data in the serial port is illegal, indicating that the transmission fails, the serial port queue processor resends the serial port control command, if the transmission fails for 3 times, indicating that the serial port control command fails to be transmitted, and jumping to step 206;
step 212: after waiting for a period of time, acquiring data received by a serial port;
the serial port protocol is generally triggered, the monitoring system sends a command to the repeater, and the repeater returns data to the monitoring system, so that after the serial port control command is sent, a period of time is needed to wait for the serial port to receive the data returned by the repeater;
step 213: the serial port queue processor detects the validity of the data received by the serial port through the serial port protocol analyzer, if the data is legal, the step is skipped to step 214, if the data is illegal, the serial port control command is resent, and the step is skipped to step 211;
the data received by the serial port are firstly put into a serial port protocol analyzer for analysis, wherein the returned data based on the UART protocol is illegal as follows:
1) The returned data length is 0, which means that serial port data is not received;
2) The return data length is less than 70, representing that complete serial port return data is not received;
3) The returned serial port data does not find the protocol head and the protocol tail, representing the returned serial port data error;
4) The returned serial port data fails the CRC check;
5) The returned serial data is analyzed and found to be not matched with the transmitted repeater, and the serial control command is transmitted to the repeater A originally, but the returned data is returned by the repeater B;
serial port return data illegal condition based on MODBUS RTU protocol:
1) The return data length is 0, representing no return data;
2) After the data is sent, the repeater returns abnormal error data of the MODBUS RTU, which represents that the protocol transmission fails;
step 214: the serial port protocol analyzer analyzes the information of the automatic equipment returned by the serial port and encapsulates the information into the return information of the automatic equipment;
step 215: the serial port queue processor pushes the return information of the automatic equipment into a synchronous information queue;
step 216: the data center module reads the data in the synchronous information queue and synchronizes the state cache table of the automatic equipment in real time.
The invention is a multi-protocol automatic equipment monitoring system based on message queue, the optimized point is that after the message queue is adopted, the control part of the automatic equipment is separated from the data part of the monitoring system, so that the monitoring system gets rid of the limitation of physical connection, and more automatic equipment is controlled by transversely adding a serial controller in a control module; the parallel control of the serial ports is realized through a plurality of serial port queue processors in the controller, so that the control efficiency is greatly improved; the invention uses the automatic equipment in the priority message queue and the data center module to set the buffer memory table, thereby realizing the priority execution of the high priority command; the invention analyzes the relays of different types by using the serial port protocol rule file, thereby improving the expandability of the monitoring system. Through these mechanisms, the present invention provides a novel large-scale automated equipment monitoring system.
The above examples are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above examples, and any other changes, modifications, substitutions, combinations, and simplifications that do not depart from the spirit and principle of the present invention should be made in the equivalent manner, and the embodiments are included in the protection scope of the present invention.
Claims (9)
1. A message queue-based multi-protocol automation device monitoring system, comprising: the system comprises a task function module, a data center module and a control module;
the task function module is used for managing system functions and system tasks of the bottom-layer automation equipment and pushing the system tasks into a task queue;
the data center module comprises a Redis memory database and MySQL;
the Redis memory database is used for storing real-time state, real-time setting information and alarm information of the automation equipment, and the MySQL is used for storing user information, region information and automation equipment setting information;
the control module comprises a task queue processor and a plurality of serial controllers;
the task queue processor is used for acquiring system tasks in the task queue, converting the system tasks into control commands and pushing the control commands into the corresponding serial port queues;
the serial port controller comprises a serial port queue processor and a serial port protocol analyzer, wherein the serial port queue processor is used for acquiring control commands in a serial port queue, and the serial port protocol analyzer is used for assembling the control commands into serial port control commands;
the serial port controller sends a serial port control command to the bottom layer automation equipment to control the bottom layer automation equipment, monitors the return information of the bottom layer automation equipment, analyzes the return information and pushes the return information into a synchronous information queue;
the task queue processor acquires an automation device ID in a system task, and acquires real-time task information of the automation device in the automation device setting cache table through the data center module;
the task queue processor assembles the ID of the automation equipment and the real-time setting information of the automation equipment into a control command of the system;
the task queue processor acquires a serial port queue which is required to be sent to the system by the automatic equipment through a serial port ID in the control command, and pushes the control command into the corresponding serial port queue;
the serial port protocol analyzer assembles the control command into a serial port control command;
each serial port controller reads a serial port protocol rule file when starting, and generates different controllers by initializing the serial port protocol rule file;
the serial port ID consists of serial port controller ID+serial port number, the serial port controllers are respectively connected with the bottom-layer automation equipment, and each serial port queue processor processes one serial port queue and one serial port; and the data center module updates the automation equipment data obtained by scanning by the control module into an automation equipment state cache table in the Redis memory database in real time through the synchronous information queue, and synchronously updates the automation equipment setting in the MySQL.
2. The message queue-based multiprotocol automation equipment monitoring system of claim 1, wherein the system tasks are provided with priorities, the priority queues are used as task queues, tasks with high priorities are executed preferentially, and the task queue processor of the control module obtains task contents with high priorities by detecting an automation equipment set cache table in the data center module, and then assembles corresponding high priority control commands.
3. The message queue-based multi-protocol automation device monitoring system of claim 1, wherein the underlying automation device comprises a serial port, a repeater and an automation device, the serial port controller is connected with the serial port, the serial port is connected with the repeater, the repeater is connected with the automation device, the control module queries automation device information in the repeater through the serial port, and performs corresponding control on the repeater, and the repeater is used for acquiring the state of the automation device in real time and converting a control command into a control command of the automation device to complete the control of the automation device.
4. A method for controlling a message queue based multi-protocol automation device monitoring system, based on the message queue based multi-protocol automation device monitoring system according to any one of claims 1-3, comprising the steps of:
initializing a serial port controller;
the task function module pushes the system task into a task queue;
a task queue processor in the control module acquires system tasks in a task queue;
the task queue processor acquires an automation device ID in a system task, and acquires real-time task information of the automation device in the automation device setting cache table through the data center module;
the task queue processor assembles the ID of the automation equipment and the real-time setting information of the automation equipment into a control command of the system;
the task queue processor acquires a serial port queue which is required to be sent to the system by the automatic equipment through a serial port ID in the control command, and pushes the control command into the corresponding serial port queue;
the serial port queue processor monitors control commands in the serial port queue, acquires the control commands in the serial port queue if data exist in the serial port queue, and continues monitoring if the data do not exist;
the serial port protocol analyzer assembles the control command into a serial port control command;
judging whether the serial port protocol analyzer can convert the control command into a serial port control command, if so, acquiring the serial port control command, directly transmitting data into a serial port by a serial port queue processor, and if not, discarding the control command;
judging whether returned data in the serial port are legal or not, if not, indicating that the transmission fails, retransmitting the serial port control command by the serial port queue processor, and if the transmission failure times exceed a threshold value, indicating that the serial port control command fails to be transmitted, and returning to monitor the control command in the serial port queue again;
acquiring data received by a serial port, detecting the validity of the data received by the serial port by a serial port protocol analyzer by a serial port queue processor, analyzing the information of the automatic equipment returned by the serial port protocol analyzer if the data is legal, packaging the information into the returned information of the automatic equipment, retransmitting the serial port control command if the information is illegal, indicating that the serial port control command fails to be transmitted if the transmission failure times exceed a threshold value, and returning the control command in a monitoring serial port queue again;
the serial port queue processor pushes the return information of the automatic equipment into a synchronous information queue;
the data center module reads the data in the synchronous information queue and synchronizes the state cache table of the automatic equipment in real time.
5. The method for controlling a message queue-based multiprotocol automation equipment monitoring system of claim 4, wherein the serial port controller initializing comprises the specific steps of:
the serial port controller firstly reads an internal configuration file of the serial port controller;
setting a serial port controller ID and connecting a monitoring system;
judging whether the connection monitoring system is successful, if so, reading a serial port protocol rule file, otherwise, stopping the operation of the serial port controller;
detecting the legitimacy of the serial port protocol rule file, if the serial port protocol rule file is illegal, stopping the operation of the serial port controller, and if the serial port protocol rule file is legal, analyzing the serial port rule file to generate a corresponding serial port protocol analyzer;
accessing a monitoring system to obtain a serial port to be controlled by a current serial port controller;
the serial port controller opens a serial port to be controlled;
detecting whether the serial port is successfully opened, if so, deleting a serial port queue in a monitoring system corresponding to the serial port, and generating a serial port queue processor;
and detecting whether a next serial port to be opened exists, if so, opening the serial port to be controlled by the serial port controller, and detecting whether the serial port is successfully opened again, otherwise, completing the initialization of the serial port controller.
6. The method for controlling a message queue-based multi-protocol automation device monitoring system according to claim 4 or 5, wherein the content of the internal configuration file of the serial port controller is established in XML form, and the content includes an IP address of the automation device monitoring system and a serial number ID of the controller.
7. The method for controlling a multi-protocol automation equipment monitoring system based on a message queue according to claim 4 or 5, wherein the serial port protocol in the serial port protocol rule file adopts a serial port rule protocol based on UART or a serial port rule protocol written based on MODBUS RTU.
8. The method for controlling a monitoring system of a multiprotocol automation equipment based on a message queue according to claim 4 or 5, wherein the method for detecting validity of a serial port protocol rule file, wherein the serial port protocol adopts a serial port rule protocol based on UART, and the step of detecting illegality of returned data is as follows:
the returned data length is 0, which means that serial port data is not received;
the return data length is less than 70, representing that complete serial port return data is not received;
the returned serial port data does not find the protocol head and the protocol tail, representing the returned serial port data error;
the returned serial port data fails the CRC check;
and the returned serial port data is found to be unmatched with the transmitted repeater after analysis.
9. The method for controlling a monitoring system of a multiprotocol automation equipment based on a message queue according to claim 4 or 5, wherein the method for detecting the validity of a serial port protocol rule file, wherein the serial port protocol is based on a MODBUS RTU protocol, and the step of detecting that returned data is illegal is as follows:
the return data length is 0, representing no return data;
after the data is sent, the repeater returns abnormal error data of the MODBUS RTU, which represents that the protocol transmission fails.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110028975.5A CN112925656B (en) | 2021-01-11 | 2021-01-11 | Multi-protocol automation equipment monitoring system based on message queue and control method thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110028975.5A CN112925656B (en) | 2021-01-11 | 2021-01-11 | Multi-protocol automation equipment monitoring system based on message queue and control method thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112925656A CN112925656A (en) | 2021-06-08 |
CN112925656B true CN112925656B (en) | 2024-01-09 |
Family
ID=76162784
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110028975.5A Active CN112925656B (en) | 2021-01-11 | 2021-01-11 | Multi-protocol automation equipment monitoring system based on message queue and control method thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112925656B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113434600B (en) * | 2021-06-30 | 2023-06-09 | 青岛海尔科技有限公司 | Data synchronization method and device |
CN114003407A (en) * | 2021-10-26 | 2022-02-01 | 南京元贝信息技术有限公司 | Message queue task processing method, device and equipment based on middleware |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102647294A (en) * | 2012-03-31 | 2012-08-22 | 航天恒星科技有限公司 | Far-end serial port monitoring system |
CN104618163A (en) * | 2015-02-03 | 2015-05-13 | 江苏辰云信息科技有限公司 | Message queue based distributed machine room monitoring system and method |
CN108429789A (en) * | 2018-02-02 | 2018-08-21 | 广州云印信息科技有限公司 | A kind of mobile wireless network communication system and method based on automatic vending machine |
CN110955626A (en) * | 2019-11-26 | 2020-04-03 | 山东有人信息技术有限公司 | Method and system for realizing Modbus communication on serial link |
CN112099948A (en) * | 2020-09-10 | 2020-12-18 | 西安交通大学 | Method for standardizing digital twin manufacturing unit protocol and integrating industrial big data in real time |
-
2021
- 2021-01-11 CN CN202110028975.5A patent/CN112925656B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102647294A (en) * | 2012-03-31 | 2012-08-22 | 航天恒星科技有限公司 | Far-end serial port monitoring system |
CN104618163A (en) * | 2015-02-03 | 2015-05-13 | 江苏辰云信息科技有限公司 | Message queue based distributed machine room monitoring system and method |
CN108429789A (en) * | 2018-02-02 | 2018-08-21 | 广州云印信息科技有限公司 | A kind of mobile wireless network communication system and method based on automatic vending machine |
CN110955626A (en) * | 2019-11-26 | 2020-04-03 | 山东有人信息技术有限公司 | Method and system for realizing Modbus communication on serial link |
CN112099948A (en) * | 2020-09-10 | 2020-12-18 | 西安交通大学 | Method for standardizing digital twin manufacturing unit protocol and integrating industrial big data in real time |
Non-Patent Citations (1)
Title |
---|
LabVIEW上位机双串口同步方法与数据采集;董俊辰 等;《电子世界》;第23-24页 * |
Also Published As
Publication number | Publication date |
---|---|
CN112925656A (en) | 2021-06-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112925656B (en) | Multi-protocol automation equipment monitoring system based on message queue and control method thereof | |
US20230174341A1 (en) | Methods of taking elevator by unmanned device, elevator controlling methods, elevator scheduling methods, unmanned devices, elevator controlling devices, elevator scheduling cloud platforms and systems for taking elevator by unmanned device | |
CN113630372A (en) | Cloud edge coordination system for edge computing | |
US7388518B2 (en) | Vehicle tracking system | |
US20170366620A1 (en) | Long connection method between a plurality of smart devices and a server, and smart device thereof | |
CN112637318A (en) | Intelligent gateway system and device for storage integrity and control method thereof | |
CN108933716B (en) | Cloud interaction gateway based on OpenWrt, communication method and smart home system | |
US9003081B2 (en) | Computer system and control method thereof | |
JPH07146844A (en) | Integrated automation development system and method for controlling and adjusting manufacturing device | |
CN110688280B (en) | Management system, method, equipment and storage medium for alarm event | |
CN113609048B (en) | Cloud edge service collaborative interaction method for electric power Internet of things | |
US10489179B1 (en) | Virtual machine instance data aggregation based on work definition metadata | |
KR102120548B1 (en) | CLOUD BASED IoT NETWORK VIRTUALIZATION SYSTEM AND NETWORKING METHOD THEREOF | |
CN115567895A (en) | OTA software update data transmission method and system | |
JP2019212271A (en) | Method and device for transferring instruction, solar system, and central controller | |
CN109450757B (en) | Method for starting CANopen master station and overall management device thereof | |
CN116760872A (en) | Device control system, method, apparatus, computer device, and storage medium | |
CN114860480A (en) | Web service proxy method, device and storage medium based on Serverless | |
CN116760741B (en) | Data state monitoring method, device, equipment and medium | |
US20240333799A1 (en) | Method and System for Providing Time-Critical Services via a Flow Control Environment | |
CN114048017B (en) | Internet of things equipment cooperative linkage method and device | |
CN118656854B (en) | Process authorization and access control method and system for integrated monitoring system of rail transit | |
EP2016781B1 (en) | A vehicle tracking system | |
CN118368196A (en) | Traffic execution management method, device, electronic equipment and storage medium | |
CN113794762A (en) | System architecture of self-service equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |