A multi-master multi-slave IEC104 remote control instruction issuing method
By employing multiplexing and thread pool technology in the multi-domain collaborative cluster control system of the heating network, high-priority heating network regulation commands are processed first, solving the problem of high latency in regulation commands and achieving fast communication and improved stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUANENG LIAOCHENG THERMAL POWER CO LTD
- Filing Date
- 2026-03-27
- Publication Date
- 2026-07-10
AI Technical Summary
In the multi-domain collaborative cluster control system of heating networks, the existing technology suffers from high latency in heating network regulation commands, which leads to a decrease in communication efficiency and stability.
By employing multiplexing, thread pools, and preemption techniques, multiple virtual master stations are created on the remote data acquisition and control module of the heat exchange station. Network communication threads and message processing thread pools are used to prioritize the processing of high-priority heat network regulation commands, thereby achieving rapid preemption and distribution.
It reduces control latency, improves system communication efficiency and stability, and enhances the communication capabilities of the multi-domain collaborative cluster control system for heating networks.
Smart Images

Figure CN122359797A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automatic control technology for urban centralized heating, and specifically to an IEC104 remote control command issuance method for a multi-master and multi-slave control system for a multi-domain collaborative cluster control system of a heating network. Background Technology
[0002] The multi-domain collaborative cluster control system for heating networks is a new type of control equipment that utilizes computer technology to centrally monitor, operate, manage, and distribute the urban centralized heating process. The heating network cluster controller, acting as the brain of the multi-domain collaborative cluster control system, controls the various parts distributed throughout the heating network area, executes control algorithms and configurations for various heat exchange station equipment, and handles network communication with the engineering PC.
[0003] The heating network cluster controller connects to a heat exchange station's remote data acquisition and control module via a remote I / O port to support the IEC104 communication protocol. The heating network cluster controller sends IEC104 remote control commands to the acquisition and control module. In the scenario of the heating network multi-domain collaborative cluster control system to which this invention is applied, the "remote control command" specifically refers to the "heating network regulation command" used to adjust the operating parameters of the heating network. The "remote control command" mentioned below refers to this high-priority "heating network regulation command."
[0004] The acquisition and control module needs to forward received instructions to the corresponding heating field execution and sensing devices (i.e., IEC104 slave stations), and after waiting for the devices to reply, it processes the response messages and sends them back to the heating network cluster controller. In the heating network multi-domain collaborative cluster control system, a single acquisition and control module can simultaneously run up to 10 IEC104 master stations, called virtual master stations, which are independent of each other. Each virtual master station can also establish connections and communicate with up to 10 heating field execution and sensing devices. Using the above single-threaded scheme on the acquisition and control module results in high latency for remote control instructions (i.e., heating network regulation instructions). If a thread is created for each connection, thread contention and context switching will significantly reduce the communication capability of the acquisition and control module, also increasing instruction latency. To solve these problems, this invention proposes a low-latency method for issuing IEC104 remote control instructions based on multiplexing, reducing the communication latency between the acquisition and control module and the heating field execution and sensing devices, and improving the communication efficiency and stability of the heating network multi-domain collaborative cluster control system. Summary of the Invention
[0005] To address this issue, this invention provides a method for issuing IEC104 remote control commands to multiple master and slave stations in a multi-domain collaborative cluster control system for heating networks, thereby resolving the problem of high latency in heating network regulation commands in existing multi-domain collaborative cluster control systems for heating networks.
[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions: According to a first aspect of the present invention, an embodiment of the present invention provides a method for issuing IEC104 remote control commands for a multi-master station and multi-slave station in a multi-domain collaborative cluster control system for a heating network. Multiple virtual master stations run simultaneously on a remote data acquisition and control module of a heat exchange station. Each virtual master station can establish connections and communicate with multiple on-site heating execution and sensing devices. The method includes: Create a network communication thread and a message processing thread pool; Create two first-in-first-out (FIFO) message queues, PQ0 and PQ1, where PQ0 is defined as the heating network regulation command queue and PQ1 is defined as the heating network monitoring message queue. The virtual master station establishes a connection with the heating network cluster controller, and the virtual master station establishes a connection with the on-site execution and sensing equipment for heating. The network communication thread is started. After receiving a message, the network communication thread first puts the received message into the message queue to be processed, and then wakes up the message processing thread pool to process the message. Among them, the heat network regulation instruction message sent by the heat network cluster controller will be sent to PQ0 by the network communication thread, and the heat network monitoring message sent by the heating site execution and sensing device will be sent to PQ1 by the network communication thread.
[0007] Furthermore, the method also includes: Pre-allocate static memory for the virtual master station and the heating field execution and sensing devices, including: allocating multiple fixed-size master station memory regions corresponding to multiple virtual master stations; each master station memory region includes multiple fixed-size connection memory regions, and each connection memory region corresponds to a connection between a virtual master station and the heating field execution and sensing devices.
[0008] Furthermore, a message processing thread pool is created, specifically including: The message processing thread pool contains multiple worker threads. When the network communication thread wakes up the message processing thread pool, the message processing thread pool will continuously allocate messages in the message queue to the currently idle worker threads until the message queue is empty.
[0009] Furthermore, a message processing thread pool is created, specifically including: The message processing thread pool supports preemptive scheduling. When allocating messages in the message queue to worker threads, heat network regulation instruction messages will be processed first. If PQ0 is not empty and there are no idle worker threads, preemption will be triggered, forcing a busy worker thread that is processing non-heat network regulation instruction messages to discard its current work and switch to processing heat network regulation instruction messages in PQ0. If there are still unprocessed messages in PQ0, preemption will continue to be triggered.
[0010] Furthermore, a message processing thread pool is created, specifically including: The worker thread calls the message processing function to process the message. The message processing function first reads the message header to obtain the message type, and then looks up the corresponding message type's processing function entry point by looking up a table, thereby processing the message accordingly. If the corresponding message requires the virtual master station to return a response message, the worker thread will generate a response message and call the network communication thread to send the response message back to the message sender. When a message processing error occurs, the process will jump to the error handling function. When message processing is finished, the worker thread will enter an idle state, waiting to be woken up again.
[0011] Furthermore, the execution steps of the network communication thread include: a. Monitor all network connections using the EPOLL function of the Linux system's I / O multiplexing. If a timeout occurs, it means that no packets were received during this period, and proceed to step e; otherwise, proceed to step b. b. Determine if the heat network cluster controller has sent a new message. If so, put it into PQ0 and wake up the message processing thread pool. c. Determine if the heating site execution and sensing equipment has sent a new message. If so, put it into PQ1 and wake up the message processing thread pool. d. Check if there are any messages to be sent in the send buffer. If so, send them to the designated peer. e. The current loop ends, proceed to step a.
[0012] Furthermore, the thread scheduling steps of the message processing thread pool include: a. Receive and wake up the network communication thread upon receiving its wake-up signal; b. Check if there are any pending messages in queue PQ0. If there are, proceed to step c; otherwise, proceed to step f. c. Check if there are any idle worker threads. If so, proceed to step e; otherwise, proceed to step d. d. Check if any busy worker threads are processing non-heating network regulation command messages. If so, stop the current work of the corresponding worker thread, change its status to idle, and proceed to step c; if not, proceed to step i. e. Assign the first message in PQ0 to the corresponding worker thread, change the status of the corresponding worker thread to busy, and proceed to step b. f. Check if there are any pending messages in queue PQ1. If so, proceed to step g; otherwise, proceed to step i. g. Check if there are any idle worker threads. If so, proceed to step h; otherwise, proceed to step i. h. Assign the first message of PQ1 to the corresponding worker thread, change the status of the corresponding worker thread to busy state, and proceed to step f; i. End this scheduling.
[0013] Furthermore, the execution steps of a worker thread include: a. Check the message header to obtain the message type, and transfer the data to the specific message processing function based on the message type; b. Check the message structure and content. If there are no errors, proceed to step d; otherwise, proceed to step c. c. Call the error message handling function to record the error message, and then proceed to step h; d. Determine if the message is a heating network regulation command message. If yes, proceed to step e; otherwise, proceed to step f. e. Generate the corresponding IEC104 message based on the message content, and proceed to step g; f. If the corresponding message requires a response message, generate the response message and proceed to step g; otherwise, proceed to step h. g. Send the message to the send buffer of the network communication thread; h. The thread enters an idle state.
[0014] According to a second aspect of the present invention, an IEC104 remote control command issuance system with multiple master stations and multiple slave stations is provided. Multiple virtual master stations run simultaneously on a remote data acquisition and control module of a heat exchange station. Each virtual master station can establish connections and communicate with multiple on-site heating execution and sensing devices. The system includes: The power-on module is used to create network communication threads and message processing thread pools; it also creates two first-in-first-out message queues, PQ0 and PQ1, where PQ0 is defined as the heat network regulation instruction queue and PQ1 is defined as the heat network monitoring message queue. The connection module is used to establish connections between the virtual master station and the heating network cluster controller, and to establish connections between the virtual master station and the heating field execution and sensing devices; The working module is used to start the network communication thread. After receiving a message, the network communication thread first puts the received message into the message queue to be processed, and then wakes up the message processing thread pool to process the message. Among them, the heat network regulation instruction message sent by the heat network cluster controller will be sent to PQ0 by the network communication thread, and the heat network monitoring message sent by the heating site execution and sensing device will be sent to PQ1 by the network communication thread.
[0015] Furthermore, the system also includes: The memory allocation module is used to pre-allocate static memory for the virtual master station and the heating field execution and sensing devices, including: allocating multiple fixed-size master station memory regions corresponding to multiple virtual master stations; each master station memory region includes multiple fixed-size connection memory regions, and each connection memory region corresponds to a connection between a virtual master station and a heating field execution and sensing device.
[0016] Compared with existing technologies, this invention provides a method for issuing IEC104 remote control commands for a multi-master, multi-slave system in a multi-domain collaborative cluster control system for heating networks. By employing techniques such as static memory allocation, multiplexing, thread pools, and preemption, this invention enables a rapid preemption method for issuing heating network regulation commands to the remote data acquisition and control module of a heat exchange station that connects multiple virtual master stations and multiple heating field execution and sensing devices. This invention reduces the control latency of the multi-domain collaborative cluster control system for heating networks and improves the stability of the system. Attached Figure Description
[0017] The accompanying drawings, which form part of this specification, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings: Figure 1 A schematic diagram of the overall workflow of an IEC104 remote control command issuance method with multiple master stations and multiple slave stations provided in an embodiment of the present invention; Figure 2 This invention provides an embodiment of the architecture diagram of the remote data acquisition and control module of the heat exchange station in the IEC104 remote control command issuance method for a multi-master station and multi-slave station heating network. Figure 3 This is a schematic diagram illustrating the connection between the virtual master station and the on-site execution and sensing equipment in a multi-master, multi-slave IEC104 remote control command issuance method provided in an embodiment of the present invention. Figure 4 This invention provides a flowchart of the network communication thread execution steps in a multi-master, multi-slave IEC104 remote control command issuance method according to an embodiment of the invention. Figure 5The flowchart illustrates the thread scheduling process in a multi-master, multi-slave IEC104 remote control command issuance method provided in this embodiment of the invention. Detailed Implementation
[0018] The present invention will now be described in detail with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0019] The following detailed description is exemplary and intended to provide further detailed explanation of the invention. Unless otherwise specified, all technical terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this invention is for describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention.
[0020] The first embodiment of the present invention provides a method for issuing IEC104 remote control commands for a multi-master, multi-slave control system applied to a multi-domain collaborative cluster control system for heating networks, such as... Figure 2 As shown, multiple virtual master stations run simultaneously on the remote data acquisition and control module (hereinafter referred to as the acquisition and control module) of the heat exchange station. Each virtual master station can establish connections and communicate with multiple heating field execution and sensing devices. This method includes a network communication thread based on multiplexing, two first-in-first-out message queues (used to process high-priority heating network regulation commands and ordinary-priority heating network monitoring messages, respectively), and a thread pool supporting preemptive scheduling, which contains multiple worker threads based on the producer-consumer pattern. The following is combined with... Figure 1 Please provide a detailed explanation.
[0021] like Figure 1 As shown, in step S100, static memory allocation is performed in advance for the virtual master station and the heating site execution and sensing devices.
[0022] In this embodiment, a statically pre-allocated memory model is used to improve communication efficiency to meet the high real-time requirements of the heating network system. Specifically, the static memory allocation includes 10 fixed-size master station memory areas, corresponding to 10 virtual master stations. Each master station memory area includes master station communication parameters, status, and other information. It also includes 10 fixed-size connection memory areas, each corresponding to a connection between a virtual master station and the heating field execution and sensing devices. This connection memory area includes field device communication parameters, connection status, and other information. The connection between the virtual master station and the heating field execution and sensing devices is as follows: Figure 3 As shown.
[0023] like Figure 1 As shown, in step S200, a network communication thread and a message processing thread pool are created.
[0024] In this embodiment, the Network Communication Thread (NWCT) is responsible for processing network communication messages. In the multi-domain collaborative cluster control system of the heating network, the heating network cluster controller and the remote data acquisition and control module of the heat exchange station communicate through a proprietary protocol based on the TCP / IP protocol suite. Since the IEC104 protocol is also based on the TCP / IP network protocol suite, the NWCT is responsible for managing the TCP connections between the acquisition and control module and the heating network cluster controller, as well as the TCP connections with numerous on-site heating execution and sensing devices. This invention uses the EPOLL function of the Linux system's I / O multiplexing to manage all network connections. To prevent the processing logic of a single message from taking too long and blocking the reception of remaining messages, the NWCT does not process the received message directly but instead places it in the message queue to be processed, and then wakes up the message processing thread pool (WKTP).
[0025] In WKTP, worker threads (hereinafter referred to as WKTs) perform further processing on the messages. There are multiple WKTs in WKTP, the specific number depending on the available hardware resources; in this example, there are 4 WKTs.
[0026] In this embodiment, WKT calls the message processing function to process the message. The message processing function first reads the message header to obtain the message type, then looks up the entry point of the processing function for that message type in a table, and then processes it accordingly. If the message requires the virtual master station to return a response message, the worker thread will generate the response message and call the NWCT thread to send the response message back to the sender of the message. When a message processing error occurs, the process will jump to the error handling function. When message processing is finished, the worker thread will enter the idle state, waiting to be woken up again.
[0027] like Figure 1 As shown, in step S300, two first-in-first-out (FIFO) message queues, PQ0 and PQ1, are created.
[0028] In this embodiment, the message queues to be processed are divided into PQ0 (Packet Queue 0) and PQ1 (Packet Queue 1). Heat network regulation command messages are located in PQ0, and heat network monitoring messages (i.e., non-heat network regulation command messages) are located in PQ1.
[0029] When the NWCT wakes up the WKTP, the message processing thread pool continuously allocates messages in the message queue to the currently idle (IDLE) WKTs until the message queue is empty. During this process, heat network regulation command messages are processed first. If PQ0 is not empty and there is no WKT currently in the IDLE state, preemption is triggered, forcing a WKT that is processing non-heat network regulation command messages (BUSY state) to discard its current work and switch to processing heat network regulation command messages in PQ0. If there are still unprocessed messages in PQ0, preemption will continue to be triggered.
[0030] like Figure 1 As shown, in step S400, the virtual master station establishes a connection with the heating network cluster controller and establishes a connection with the heating site execution and sensing equipment.
[0031] like Figure 1 As shown, in step S500, the network communication thread is started. After receiving a message, the network communication thread first puts the received message into the message queue to be processed, and then wakes up the message processing thread pool to process the message. Among them, the heat network regulation instruction message sent by the heat network cluster controller will be sent to PQ0 by the network communication thread, and the heat network monitoring message sent by the heating site execution and sensing device will be sent to PQ1 by the network communication thread.
[0032] The specific execution steps are as follows: 1. Power-on steps for the remote data acquisition and control module of the heat exchange station: (1) Static memory allocation, including 10 fixed-size master station memory areas, corresponding to 10 virtual master stations. Each master station memory area includes master station communication parameters, status and other information; and 10 fixed-size connection memory areas, each connection memory area corresponding to the connection between a virtual master station and the heating field execution and sensing device. This area includes field device communication parameters, connection status and other information.
[0033] (2) Create NWCT and WKTP. There are 4 WKT in WKTP.
[0034] (3) Create two pending message queues, PQ0 and PQ1. If the message sent by the heating network cluster controller contains heating network regulation instructions, it will be sent to PQ0 by the NWCT; heating network monitoring messages such as periodic data and regulation instruction responses sent by the heating site execution and sensing equipment will be sent to PQ1.
[0035] (4) Establish connection with the heating network cluster controller and establish connection with the heating site execution and sensing equipment. NWCT and WKTP start working.
[0036] 2. The execution steps of the network communication thread NWCT are as follows: Figure 4 As shown: (1) Monitor all network connections using the EPOLL function based on multiplexing. If a timeout occurs, it means that no messages were received during this period, and proceed to (5); otherwise, proceed to (2).
[0037] (2) Determine whether the heat network cluster controller has sent a new message. If so, put it into PQ0 and wake up WKTP.
[0038] (3) Determine whether the heating field execution and sensing equipment has sent a new message. If so, put it into PQ1 and wake up WKTP.
[0039] (4) Check if there are any messages to be sent in the send buffer. If so, send them to the specified peer.
[0040] (5) The current cycle ends, and proceed to (1).
[0041] 3. Thread pool WKTP thread scheduling steps, such as... Figure 5 As shown: (1) Received NWCT wake-up signal.
[0042] (2) Check if there are any pending messages in queue PQ0 (heat network regulation command queue). If there are, proceed to (3); if not, proceed to (6).
[0043] (3) Check if there is an IDLE state WKT. If there is, proceed to (5); if not, proceed to (4).
[0044] (4) Check if there is a WKT in BUSY state processing non-heating network regulation command messages (i.e., heating network monitoring messages). If so, stop the current operation of the WKT, switch it to IDLE state, and go to (3); if not, go to (9).
[0045] (5) Assign the first message of PQ0 (heat network regulation command) to the WKT and change the WKT status to BUSY. Proceed to (2).
[0046] (6) Check if there are any pending messages in queue PQ1 (heat network monitoring message queue). If there are, proceed to (7); if not, proceed to (9).
[0047] (7) Check if there is an IDLE state WKT. If there is, proceed to (8); if not, proceed to (9).
[0048] (8) Assign the first message of PQ1 to the WKT and change the WKT state to BUSY. Proceed to (6).
[0049] (9) End this scheduling.
[0050] 4. WKT execution steps for worker threads: (1) Check the message header to obtain the message type, and transfer to the specific message processing function according to the message type.
[0051] (2) Check the message structure and content. If there are no errors, proceed to (3); otherwise, proceed to (2).
[0052] (3) Call the error message handling function to record the error message. Go to (8).
[0053] (4) Determine whether the message is a heating network regulation command message. If so, proceed to (5); otherwise, proceed to (6).
[0054] (5) Generate the corresponding IEC104 message based on the message content. Proceed to (7).
[0055] (6) If the message needs to return a response message, generate a response message and proceed to (7); otherwise proceed to (8).
[0056] (7) Send the message to the NWCT's send buffer.
[0057] (8) The thread enters the IDLE state.
[0058] Corresponding to the IEC104 remote control command issuance method for a multi-domain collaborative cluster control system of a heating network disclosed in the above embodiments, this invention also discloses an IEC104 remote control command issuance system for a multi-domain collaborative cluster control system of a heating network. Multiple virtual master stations run simultaneously on the remote data acquisition and control module of the heat exchange station. Each virtual master station can establish connections and communicate with multiple heating field execution and sensing devices. The system specifically includes: The power-on module is used to create network communication threads and message processing thread pools; it also creates two first-in-first-out message queues, PQ0 and PQ1, where PQ0 is defined as the heat network regulation instruction queue and PQ1 is defined as the heat network monitoring message queue. The connection module is used to establish connections between the virtual master station and the heating network cluster controller, and to establish connections between the virtual master station and the heating field execution and sensing devices; The working module is used to start the network communication thread. After receiving a message, the network communication thread first puts the received message into the message queue to be processed, and then wakes up the message processing thread pool to process the message. Among them, the heat network regulation instruction message sent by the heat network cluster controller will be sent to PQ0 by the network communication thread, and the heat network monitoring message sent by the heating site execution and sensing device will be sent to PQ1 by the network communication thread.
[0059] Furthermore, the system also includes: The memory allocation module is used to pre-allocate static memory for the virtual master station and the heating field execution and sensing devices, including: allocating multiple fixed-size master station memory regions corresponding to multiple virtual master stations; each master station memory region includes multiple fixed-size connection memory regions, and each connection memory region corresponds to a connection between a virtual master station and a heating field execution and sensing device.
[0060] It should be noted that for a detailed description of the IEC104 remote control command issuance system for a multi-domain collaborative cluster control system for a heating network provided in this embodiment of the invention, please refer to the relevant description of the IEC104 remote control command issuance method for a multi-domain collaborative cluster control system for a heating network provided in this embodiment of the invention, which will not be repeated here.
[0061] As is known from common technical knowledge, this invention can be implemented through other embodiments that do not depart from its spirit or essential characteristics. Therefore, the disclosed embodiments described above are merely illustrative in all respects and are not the only ones. All modifications within the scope of this invention or its equivalents are included in this invention.
[0062] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, etc.) containing computer-usable program code.
[0063] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0064] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0065] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0066] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for issuing IEC104 remote control commands to multiple master and slave stations, characterized in that, Multiple virtual master stations run simultaneously on the remote data acquisition and control module of the heat exchange station. Each virtual master station can establish connections and communicate with multiple on-site heating execution and sensing devices. The method includes: Create a network communication thread and a message processing thread pool; Create two first-in-first-out (FIFO) message queues, PQ0 and PQ1; The virtual master station establishes a connection with the heating network cluster controller, and the virtual master station establishes a connection with the on-site execution and sensing equipment for heating. The network communication thread is started. After receiving a message, the network communication thread first puts the received message into the message queue to be processed, and then wakes up the message processing thread pool to process the message. Among them, the heat network regulation instruction message sent by the heat network cluster controller will be sent to PQ0 by the network communication thread, and the heat network monitoring message sent by the heating site execution and sensing device will be sent to PQ1 by the network communication thread.
2. The method for issuing IEC104 remote control commands with multiple master stations and multiple slave stations according to claim 1, characterized in that, The method further includes: Static memory allocation is performed in advance for the virtual master station and the heating field execution and sensing devices, including: allocating multiple fixed-size master station memory regions corresponding to multiple virtual master stations; each master station memory region includes multiple fixed-size connection memory regions, and each connection memory region corresponds to a connection between a virtual master station and the heating field execution and sensing devices.
3. The method for issuing IEC104 remote control commands with multiple master stations and multiple slave stations according to claim 1, characterized in that, Create a message processing thread pool, specifically including: The message processing thread pool contains multiple worker threads. When the network communication thread wakes up the message processing thread pool, the message processing thread pool will continuously allocate messages in the message queue to the currently idle worker threads until the message queue is empty.
4. The method for issuing IEC104 remote control commands with multiple master stations and multiple slave stations according to claim 3, characterized in that, Create a message processing thread pool, specifically including: The message processing thread pool supports preemptive scheduling. When allocating messages in the message queue to worker threads, heating network regulation instruction messages will be processed first. If PQ0 is not empty and there are no idle worker threads, preemption is triggered, forcing a busy worker thread that is processing non-heating network regulation instruction messages to discard its current work and switch to processing heating network regulation instruction messages in PQ0. If there are still unprocessed messages in PQ0, preemption will continue to be triggered.
5. The method for issuing IEC104 remote control commands with multiple master stations and multiple slave stations according to claim 3, characterized in that, Create a message processing thread pool, specifically including: The worker thread calls the message processing function to process the message. The message processing function first reads the message header to obtain the message type, and then looks up the corresponding message type's processing function entry point by looking up a table, thereby processing the message accordingly. If the corresponding message requires the virtual master station to return a response message, the worker thread generates the response message and calls the network communication thread to send the response message back to the message sender. When a message processing error occurs, the error handling function is invoked. When message processing is finished, the worker thread enters an idle state, waiting to be woken up again.
6. The method for issuing IEC104 remote control commands with multiple master stations and multiple slave stations according to claim 1, characterized in that, The execution steps of a network communication thread include: a. Monitor all network connections using the EPOLL function of the Linux system's I / O multiplexing. If a timeout occurs, it means that no packets were received during this period, and proceed to step e; otherwise, proceed to step b. b. Determine if the heat network cluster controller has sent a new message. If so, put it into PQ0 and wake up the message processing thread pool. c. Determine if the heating site execution and sensing equipment has sent a new message. If so, put it into PQ1 and wake up the message processing thread pool. d. Check if there are any messages to be sent in the send buffer. If so, send them to the designated peer. e. The current loop ends, and proceed to step a.
7. The method for issuing IEC104 remote control commands with multiple master stations and multiple slave stations according to claim 4, characterized in that, The thread scheduling steps of the message processing thread pool include: a. Receive and wake up the network communication thread upon receiving its wake-up signal; b. Check if there are any pending messages in queue PQ0. If there are, proceed to step c; otherwise, proceed to step f. c. Check if there are any idle worker threads. If so, proceed to step e; otherwise, proceed to step d. d. Check if any busy worker threads are processing non-heating network regulation command messages. If so, stop the current work of the corresponding worker thread, change its status to idle, and proceed to step c; if not, proceed to step i. e. Assign the first message in PQ0 to the corresponding worker thread, change the status of the corresponding worker thread to busy, and proceed to step b. f. Check if there are any pending messages in queue PQ1. If so, proceed to step g; otherwise, proceed to step i. g. Check if there are any idle worker threads. If so, proceed to step h; otherwise, proceed to step i. h. Assign the first message of PQ1 to the corresponding worker thread, change the status of the corresponding worker thread to busy state, and proceed to step f; i. End this scheduling.
8. The method for issuing IEC104 remote control commands with multiple master stations and multiple slave stations according to claim 3, characterized in that, The execution steps of a worker thread include: a. Check the message header to obtain the message type, and transfer the data to the specific message processing function based on the message type; b. Check the message structure and content. If there are no errors, proceed to step d; otherwise, proceed to step c. c. Call the error message handling function to record the error message, and then proceed to step h; d. Determine if the message is a heating network regulation command message. If yes, proceed to step e; otherwise, proceed to step f. e. Generate the corresponding IEC104 message based on the message content, and proceed to step g; f. If the corresponding message requires a response message, generate the response message and proceed to step g; otherwise, proceed to step h. g. Send the message to the send buffer of the network communication thread; h. The thread enters an idle state.
9. A multi-master, multi-slave IEC104 remote control command issuance system, characterized in that, Multiple virtual master stations run simultaneously on the remote data acquisition and control module of the heat exchange station. Each virtual master station can establish connections and communicate with multiple on-site heating execution and sensing devices. The system includes: The power-on module is used to create network communication threads and message processing thread pools; it also creates two first-in-first-out message queues, PQ0 and PQ1, where PQ0 is defined as the heat network regulation instruction queue and PQ1 is defined as the heat network monitoring message queue. The connection module is used to establish connections between the virtual master station and the heating network cluster controller, and to establish connections between the virtual master station and the heating field execution and sensing devices; The working module is used to start the network communication thread. After receiving a message, the network communication thread first puts the received message into the message queue to be processed, and then wakes up the message processing thread pool to process the message. Among them, the heat network regulation instruction message sent by the heat network cluster controller will be sent to PQ0 by the network communication thread, and the heat network monitoring message sent by the heating site execution and sensing device will be sent to PQ1 by the network communication thread.
10. A multi-master, multi-slave IEC104 remote control command issuance system according to claim 9, characterized in that, The system also includes: The memory allocation module is used to pre-allocate static memory for the virtual master station and the heating field execution and sensing devices, including: allocating multiple fixed-size master station memory regions corresponding to multiple virtual master stations; each master station memory region includes multiple fixed-size connection memory regions, and each connection memory region corresponds to a connection between a virtual master station and a heating field execution and sensing device.