Message correction method and system for preventing session from being blocked by operation and maintenance auditing system
By setting the direction serial number in the proxy layer of the operation and maintenance audit system and correcting the serial number in the APDU message data frame, the problem of 104 regulating communication sessions in the power system being terminated due to message loss is solved, and the stability of the communication session and the applicability of the operation and maintenance audit system are improved.
Patent Information
- Application Number
- CN202510352463.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2045-03-25
AI Technical Summary
When the operation and maintenance audit system is deployed in the power system, it causes the message to be lost and the serial number is misaligned in the 104-standard communication session between the factory station and the main station, which triggers the problem of abnormal termination of the communication session.
In the proxy layer of the operation and maintenance audit system, by setting the directional sequence number, the sending sequence number and/or receiving sequence number in the APDU message data frame are corrected to ensure that the serial number continuity is maintained in the case of packet loss or blockage, thereby preventing the session from being blocked.
It effectively prevents the 104-standard communication session from being terminated due to packet loss, improves the stability of the communication session and the applicability of the operation and maintenance audit system, and reduces failures caused by parameter configuration.
Smart Images

Figure CN119865467A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of operation and maintenance auditing, and in particular to a message correction method and system for preventing a session from being blocked by an operation and maintenance auditing system. Background Art
[0002] The communication between the power plant and the dispatching master station in the power system usually uses the IEC 60870-5-104 telecontrol protocol (hereinafter referred to as the 104 protocol). The 104 protocol is an extension of the IEC 60870-5-101 protocol used on the TCP / IP protocol.
[0003] The message of 104 protocol is called APDU application protocol data unit (Application Protocol Data Unit), which is the application layer data packet format used by 104 telecontrol protocol in TCP / IP transmission process. It consists of two parts: APCI application protocol control information and ASDU application service data unit; among them, APCI application protocol control information includes a start character (68H), APDU length field, and 4 control fields, a total of six octets. ASDU application service data unit is used to transmit telemetry, telesignaling, remote control and other data during 104 telecontrol protocol communication.
[0004] The control field of the APCI application protocol control information defines control information such as protecting messages from loss and duplication, message transmission start / stop, and transmission connection monitoring. The counter mechanism of the control field is defined according to 2.3.2.2.1 to 2.3.2.2.5 recommended in the ITU-T X.25 standard.
[0005] The APCI control field is formatted in different ways, used for numbered information transmission (I format), numbered monitoring function (S format) and unnumbered control function (U format). The corresponding APDU data frames are I-frame APDU, S-frame APDU and U-frame APDU. The I-frame APDU has a sending sequence number and a receiving sequence number, the S-frame APDU only has a receiving sequence number, and the U-frame APDU has neither a sending sequence number nor a receiving sequence number.
[0006] When the power system is connected to the operation and maintenance audit system, the 104 protocol communication data between the plant station and the main station needs to be forwarded through the proxy layer of the operation and maintenance audit system. At this time, if the proxy layer blocks and discards some 104 protocol messages according to the instruction strategy of the operation and maintenance audit system, the APDU sequence number sent by the sending station and the APDU sequence number confirmed by the receiving station will be misaligned, thereby triggering the sending station to abnormally terminate the communication session.
[0007] In addition, when the operation and maintenance audit system is introduced and deployed in the power system, the supplier of the operation and maintenance audit system cannot interfere with the plant and station software systems and the main station software systems that have been deployed in the power system. Therefore, in the prior art, reasonable parameter configuration is adopted in the main plant and station to avoid such failures. There is a lack of methods for adapting the 104 protocol at the proxy layer of the operation and maintenance audit system to prevent message loss and repeated transmission. There is a technical problem of poor compatibility between the operation and maintenance audit system and the 104 protocol of the power system. Summary of the invention
[0008] The purpose of the present invention is to provide a message correction method and system for preventing a session from being blocked by an operation and maintenance audit system. The method implements an adaptation of the 104 protocol to prevent message loss and acceptance confirmation mechanisms, ensures the continuity of the communication session, and solves the technical problem of poor compatibility between the operation and maintenance audit system and the 104 protocol of the power system by correcting the APDU message sequence number by the proxy layer when the 104 protocol communication data between the plant station and the main station is forwarded through the operation and maintenance audit system proxy module.
[0009] The present invention is achieved through the following technical solutions: In the first aspect, the present application discloses a message correction method to prevent a session from being blocked by an operation and maintenance audit system, which is applied to the proxy layer of the operation and maintenance audit system. The power plant of the power system establishes a TCP / IP connection with the master station of the power system through the proxy layer and opens a 104 protocol communication session: For an APDU message data frame whose message type is an I-frame APDU in a 104 protocol communication flow, a direction sequence number representing a sending direction and an accumulated number of I-frame APDUs is set; When it is necessary to forward an APDU message data frame, first use the corresponding direction sequence number to correct the sending sequence number and / or receiving sequence number in the APDU message data frame, then forward it and adjust the direction sequence number according to the message type of the APDU message data frame, so that when the APDU message data frame is discarded in the 104 protocol communication session, the receiving sequence number of the confirmation frame received by the sending station remains continuous with the sending sequence number of the most recently sent I frame APDU.
[0010] In order to better implement the present invention, further, according to the sending direction and the message type, a method for correcting the sending sequence number and / or the receiving sequence number in the APDU message data frame using the direction sequence number includes: If the message type of the APDU message data frame is I-frame APDU, both the sending sequence number and the receiving sequence number are corrected; If the message type of the APDU message data frame is S-frame APDU, only the receiving sequence number is corrected.
[0011] In order to better implement the present invention, further, the sending directions include the direction from the plant station to the agent layer, the direction from the agent layer to the master station, the direction from the master station to the agent layer and the direction from the agent layer to the plant station, and the direction sequence numbers corresponding to the respective sending directions are the direction sequence number NR[0] from the plant station to the agent layer, the direction sequence number NS[0] from the agent layer to the master station, the direction sequence number NR[1] from the master station to the agent layer and the direction sequence number NS[1] from the agent layer to the plant station.
[0012] In order to better implement the present invention, further, according to the sending direction and the message type, a method for correcting the sending sequence number and / or the receiving sequence number in the APDU message data frame using the direction sequence number includes: Correct the sending sequence number of the I frame APDU forwarded to the master station to NS[0], and correct the receiving sequence number to NR[1]; The sending sequence number of the I frame APDU forwarded to the plant station is corrected to NS[1], and the receiving sequence number is corrected to NR[0].
[0013] In order to better implement the present invention, further, according to the sending direction and the message type, a method for correcting the sending sequence number and / or the receiving sequence number in the APDU message data frame using the direction sequence number includes: Correct the receive sequence number of the S-frame APDU forwarded to the master station to NR[1]; Correct the receiving sequence number of the S-frame APDU forwarded to the plant station to NR[0].
[0014] In order to better implement the present invention, further, a counter is used to count the cumulative number of I frame APDUs in each sending direction to obtain a counting result, and a direction sequence number is set for the I frame APDU in each sending direction according to the counting result of each sending direction.
[0015] In order to better implement the present invention, further, before establishing the TCP / IP connection between the master station and the plant station, it also includes: When the 104 protocol proxy port monitoring is started, a corresponding number of counters are defined according to the number of sending directions, so as to assign a direction sequence number of each direction to each I frame APDU through the count of the counter.
[0016] In order to better implement the present invention, further, the method for judging whether each APDU message data frame needs to be forwarded or discarded includes: First, according to the receiving order, each APDU message data frame is put into the same queue for synchronization, and then the APDU message data frames are taken out one by one from the queue for judgment.
[0017] In a second aspect, the present application discloses a message correction system for preventing a session from being blocked by an operation and maintenance audit system, comprising: A sequence number setting module, wherein the sequence number setting module is used to set a direction sequence number for an APDU message data frame whose message type is an I-frame APDU in a 104 protocol communication flow according to a sending direction and an accumulated number of I-frame APDUs; A forwarding module, wherein the forwarding module is used to correct the sending sequence number and / or receiving sequence number in the APDU message data frame using the corresponding direction sequence number when it is necessary to forward the APDU message data frame, and then forward the frame and adjust the direction sequence number according to the message type of the APDU message data frame, so that when the APDU message data frame is discarded in the 104 protocol communication session, the receiving sequence number of the confirmation frame received by the sending station is continuous with the sending sequence number of the most recently sent I frame APDU.
[0018] Compared with the prior art, the present invention has the following advantages and beneficial effects: By setting the direction sequence number, it is possible to maintain the 104 protocol communication session when part of the data of the 104 protocol communication session is blocked, making it easier to deploy the operation and maintenance audit system into the power system, improving the applicability of the operation and maintenance audit system and the stability of the 104 protocol communication session. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The present invention is further described in conjunction with the following drawings and embodiments, and all the concepts and innovations of the present invention should be regarded as the disclosed contents and the protection scope of the present invention.
[0020] Figure 1 The present invention is a flowchart of an implementation method of Example 1 of a message correction method for preventing a session from being blocked by an operation and maintenance audit system in the present application.
[0021] Figure 2 This is a flow chart of an implementation method of Example 3 of a message correction method for preventing a session from being blocked by an operation and maintenance audit system in the present application.
[0022] Figure 3 This is a schematic diagram of forwarding the I frame APDU to the master station in Example 3 of a message correction method for preventing a session from being blocked by an operation and maintenance audit system in the present application.
[0023] Figure 4 This is a schematic diagram of forwarding the I frame APDU to the plant station in Example 3 of a message correction method for preventing a session from being blocked by an operation and maintenance audit system in the present application.
[0024] Figure 5 This is a schematic diagram of forwarding S-frame APDU in Example 3 of a message correction method for preventing a session from being blocked by an operation and maintenance audit system in the present application.
[0025] Figure 6A schematic diagram of an embodiment of a message correction system for preventing a session from being blocked by an operation and maintenance audit system in the present application. DETAILED DESCRIPTION
[0026] Example 1 A message correction method for preventing a session from being blocked by an operation and maintenance audit system is applied to the proxy layer of the operation and maintenance audit system. The power plant of the power system establishes a TCP / IP connection with the main station of the power system through the proxy layer and starts a 104 protocol communication session: For an APDU message data frame whose message type is an I-frame APDU in a 104 protocol communication flow, a direction sequence number representing a sending direction and an accumulated number of I-frame APDUs is set; When it is necessary to forward an APDU message data frame, first use the corresponding direction sequence number to correct the sending sequence number and / or receiving sequence number in the APDU message data frame, then forward it and adjust the direction sequence number according to the message type of the APDU message data frame, so that when the APDU message data frame is discarded in the 104 protocol communication session, the receiving sequence number of the confirmation frame received by the sending station remains continuous with the sending sequence number of the most recently sent I frame APDU.
[0027] See also Figure 1 In an optional implementation, a message modification method for preventing a session from being blocked by an operation and maintenance audit system comprises the following steps: Step S101, defining a direction sequence number template representing the sending direction and the accumulated number of I frame APDUs; Step S102, establish a TCP / IP connection from the plant station to the master station, and start a 104 protocol communication session; Step S103, according to the APDU message structure definition, parse out the APDU message data frame from the 104 protocol communication flow; Step S104, fill the accumulated number of I frame APDUs from different directions into the corresponding direction sequence number template to obtain the corresponding direction sequence number; Step S105: According to the policy setting of the operation and maintenance audit system, determine whether it is necessary to block the I frame APDU. If it is necessary to block, execute step S106; if it is not necessary to block, execute step S107; Step S106, discard the I frame APDU and return to step S103; Step S107, processing the APDU message data frame before forwarding, and using the corresponding direction sequence number to correct the sending sequence number and / or the receiving sequence number; Step S108, forwarding the APDU message data frame to the target site and determining whether the APDU message data frame is an I frame APDU, if so, executing step S109, if not, executing step S110; Step S109: fill the accumulated number of I frame APDUs into the direction sequence number template according to the sending direction, and adjust the direction sequence number; Step S110, return to execute step S103 until the protocol communication session 104 ends.
[0028] By adopting this implementation mode, by setting the direction sequence number and using the direction sequence number to correct the original sequence number of the APDU message data frame to maintain the continuity of the sequence number, it can be ensured that during the whole process of the 104 protocol communication session, even if the operation and maintenance audit system blocks some APDU message data frames, it will not affect the 104 protocol communication session, thereby improving the session stability and enabling the operation and maintenance audit system to better adapt to the 104 protocol of the power system; It is only necessary to make relevant settings on the proxy layer of the operation and maintenance audit system without modifying the parameters of the power system plant and main station. It has the beneficial effects of high application efficiency, low application cost and strong applicability.
[0029] Example 2 This embodiment is further optimized on the basis of the above-mentioned embodiment 1. In this embodiment, according to the sending direction and the message type, the method of using the direction sequence number to correct the sending sequence number and / or the receiving sequence number in the APDU message data frame includes: If the message type of the APDU message data frame is I-frame APDU, both the sending sequence number and the receiving sequence number are corrected; If the message type of the APDU message data frame is S-frame APDU, only the receiving sequence number is corrected.
[0030] Furthermore, the sending directions include the direction from the plant station to the agent layer, the direction from the agent layer to the master station, the direction from the master station to the agent layer, and the direction from the agent layer to the plant station. The direction sequence numbers corresponding to the respective sending directions are the direction sequence number from the plant station to the agent layer NR[0], the direction sequence number from the agent layer to the master station NS[0], the direction sequence number from the master station to the agent layer NR[1], and the direction sequence number from the agent layer to the plant station NS[1].
[0031] Further, according to the sending direction and the message type, the method of using the direction sequence number to correct the sending sequence number and / or the receiving sequence number in the APDU message data frame includes: Correct the sending sequence number of the I frame APDU forwarded to the master station to NS[0], and correct the receiving sequence number to NR[1]; Correct the sending sequence number of the I frame APDU forwarded to the plant station to NS[1] and the receiving sequence number to NR[0]; Correct the receive sequence number of the S-frame APDU forwarded to the master station to NR[1]; Correct the receiving sequence number of the S-frame APDU forwarded to the plant station to NR[0].
[0032] By adopting this implementation mode, the stability of the 104 protocol communication session in the scenario of "master station - operation and maintenance audit system - plant station" can be effectively handled and guaranteed. When the master station needs to establish connections with multiple plant stations, it only needs to set the direction sequence numbers of the four directions NR[0], NS[0], NR[1] and NS[1] separately for each session, so as to improve the stability of the session. Since the I frame APDU contains a sending sequence number and a receiving sequence number, the S frame APDU only has a receiving sequence number, and the U frame APDU has neither a sending sequence number nor a receiving sequence number, different sequence number correction methods are used. Before forwarding the U frame APDU, there is no need to process the U frame APDU again.
[0033] Embodiment 3: This embodiment is further optimized on the basis of the above-mentioned embodiment 2. In this embodiment, before establishing the TCP / IP connection between the master station and the plant station, it also includes: A counter is used to count the cumulative number of I frame APDUs in each sending direction to obtain a counting result, and a direction sequence number is set for the I frame APDU in each sending direction according to the counting result of each sending direction.
[0034] Further, the method for determining whether each APDU message data frame needs to be forwarded or discarded includes: First, according to the receiving order, each APDU message data frame is put into the same queue for synchronization, and then the APDU message data frames are taken out one by one from the queue for judgment.
[0035] In an optional implementation of this embodiment, see Figure 2 , the message correction method to prevent the session from being blocked by the operation and maintenance audit system includes the following steps: Step S201, start 104 protocol proxy port monitoring and define 4 counters, establish 4 direction sequence number templates: plant station to proxy layer direction NR[0], proxy layer to master station direction NS[0], master station to proxy layer direction NR[1] and proxy layer to plant station direction NS[1]; Step S202, establish a TCP / IP connection from the plant station to the master station, and start a 104 protocol communication session; Step S203, according to the APDU message structure definition, parse out the APDU message data frame from the 104 protocol communication flow; Step S204, fill the accumulated number of I frame APDUs from different directions into the direction sequence number templates of the plant station to the proxy layer direction NR[0] and the master station to the proxy layer direction NR[1] to obtain the corresponding direction sequence numbers; Step S205: According to the policy setting of the operation and maintenance audit system, determine whether it is necessary to block the I frame APDU. If it is necessary to block, execute step S206; if it is not necessary to block, execute step S207; Step S206, discard the I frame APDU and return to step S203; Step S207: Process the APDU message data frame before forwarding, and use the direction sequence numbers NR[0] and NR[1] to correct the sending sequence number and / or receiving sequence number according to the message type; specifically, as follows: See also Figure 3 For I-frame APDU, if it is forwarded to the master station, its sending sequence number is corrected to NS[0] and its receiving sequence number is corrected to NR[1]; see Figure 4 , if it is forwarded to the plant station, its sending sequence number is corrected to NS[1] and its receiving sequence number is corrected to NR[0]; See also Figure 5 , for S-frame APDU, if it is forwarded to the master station, its receiving sequence number is corrected to NR[1]; if it is forwarded to the plant station, its receiving sequence number is corrected to NR[0]; Step S208, forwarding the APDU message data frame to the target site and determining whether the APDU message data frame is an I frame APDU, if so, executing step S209, if not, executing step S210; Step S209, according to the sending direction, fill the accumulated number of I frame APDUs into the direction sequence number templates of the proxy layer to the master station direction NS[0] and the proxy layer to the plant station direction NS[1], and adjust the direction sequence number; Step S210, return to execute step S203 until the protocol communication session 104 ends.
[0036] By adopting this implementation, by setting a counter when starting the 104 protocol proxy port listening, it is achieved that before the main station and the plant station establish a connection, the preparation work for maintaining the stability of the session is completed to ensure the stability of the entire process of the 104 protocol communication session.
[0037] Example 4 See also Figure 6 , a message correction system for preventing a session from being blocked by an operation and maintenance audit system, comprising: A sequence number setting module, wherein the sequence number setting module is used to set a direction sequence number for an APDU message data frame whose message type is an I-frame APDU in a 104 protocol communication flow according to a sending direction and an accumulated number of I-frame APDUs; A forwarding module, wherein the forwarding module is used to correct the sending sequence number and / or receiving sequence number in the APDU message data frame using the corresponding direction sequence number when it is necessary to forward the APDU message data frame, and then forward the frame and adjust the direction sequence number according to the message type of the APDU message data frame, so that when the APDU message data frame is discarded in the 104 protocol communication session, the receiving sequence number of the confirmation frame received by the sending station is continuous with the sending sequence number of the most recently sent I frame APDU.
[0038] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Any simple modification or equivalent change made to the above embodiment based on the technical essence of the present invention shall fall within the protection scope of the present invention.
Claims
1. A message correction method for preventing a session from being blocked by an operation and maintenance audit system, applied to the proxy layer of the operation and maintenance audit system, wherein the power plant of the power system establishes a TCP / IP connection with the master station of the power system through the proxy layer and opens a 104 protocol communication session, characterized in that: For an APDU message data frame whose message type is an I-frame APDU in a 104 protocol communication flow, a direction sequence number representing a sending direction and an accumulated number of I-frame APDUs is set; When it is necessary to forward an APDU message data frame, first use the corresponding direction sequence number to correct the sending sequence number and / or receiving sequence number in the APDU message data frame, then forward it and adjust the direction sequence number according to the message type of the APDU message data frame, so that when the APDU message data frame is discarded in the 104 protocol communication session, the receiving sequence number of the confirmation frame received by the sending station remains continuous with the sending sequence number of the most recently sent I frame APDU.
2. The message correction method for preventing a session from being blocked by an operation and maintenance audit system according to claim 1 is characterized in that: The method for correcting a sending sequence number and / or a receiving sequence number in an APDU message data frame using a direction sequence number according to a sending direction and a message type includes: If the message type of the APDU message data frame is I-frame APDU, both the sending sequence number and the receiving sequence number are corrected; If the message type of the APDU message data frame is S-frame APDU, only the receiving sequence number is corrected.
3. The message correction method for preventing a session from being blocked by an operation and maintenance audit system according to claim 2 is characterized in that: The sending directions include the direction from plant station to agent layer, the direction from agent layer to master station, the direction from master station to agent layer, and the direction from agent layer to plant station. The direction sequence numbers corresponding to each sending direction are the direction sequence number NR[0] from plant station to agent layer, the direction sequence number NS[0] from agent layer to master station, the direction sequence number NR[1] from master station to agent layer, and the direction sequence number NS[1] from agent layer to plant station.
4. The message correction method for preventing a session from being blocked by an operation and maintenance audit system according to claim 3 is characterized in that: The method for correcting a sending sequence number and / or a receiving sequence number in an APDU message data frame using a direction sequence number according to a sending direction and a message type includes: Correct the sending sequence number of the I frame APDU forwarded to the master station to NS[0], and correct the receiving sequence number to NR[1]; The sending sequence number of the I frame APDU forwarded to the plant station is corrected to NS[1], and the receiving sequence number is corrected to NR[0].
5. The message correction method for preventing a session from being blocked by an operation and maintenance audit system according to claim 3 is characterized in that: The method for correcting a sending sequence number and / or a receiving sequence number in an APDU message data frame using a direction sequence number according to a sending direction and a message type includes: Correct the receive sequence number of the S-frame APDU forwarded to the master station to NR[1]; Correct the receiving sequence number of the S-frame APDU forwarded to the plant station to NR[0].
6. The message correction method for preventing a session from being blocked by an operation and maintenance audit system according to claim 1, characterized in that: A counter is used to count the cumulative number of I frame APDUs in each sending direction to obtain a counting result, and a direction sequence number is set for the I frame APDU in each sending direction according to the counting result of each sending direction.
7. The message correction method for preventing a session from being blocked by an operation and maintenance audit system according to claim 6 is characterized in that: Before establishing the TCP / IP connection between the master station and the plant station, it also includes: When the 104 protocol proxy port monitoring is started, a corresponding number of counters are defined according to the number of sending directions, so as to assign a direction sequence number of each direction to each I frame APDU through the count of the counter.
8. The message correction method for preventing a session from being blocked by an operation and maintenance audit system according to claim 1, characterized in that: Methods for determining whether each APDU message data frame needs to be forwarded or discarded include: First, according to the receiving order, each APDU message data frame is put into the same queue for synchronization, and then the APDU message data frames are taken out one by one from the queue for judgment.
9. A message correction system for preventing a session from being blocked by an operation and maintenance audit system, characterized in that: include: A sequence number setting module, wherein the sequence number setting module is used to set a direction sequence number for an APDU message data frame whose message type is an I-frame APDU in a 104 protocol communication flow according to a sending direction and an accumulated number of I-frame APDUs; A forwarding module, wherein the forwarding module is used to correct the sending sequence number and / or receiving sequence number in the APDU message data frame using the corresponding direction sequence number when it is necessary to forward the APDU message data frame, and then forward the frame and adjust the direction sequence number according to the message type of the APDU message data frame, so that when the APDU message data frame is discarded in the 104 protocol communication session, the receiving sequence number of the confirmation frame received by the sending station is continuous with the sending sequence number of the most recently sent I frame APDU.
Citation Information
Patent Citations
Method and system for realizing data exchange in IEC104 (international electrotechnical commission 104) communication protocol forwarding
CN102325084A
Outgoing information auditing method and device
CN102932202A
Protocol conversion gateway
CN109379280A
Relay protection remote operation and maintenance intrusion prevention and detection method and system
CN115694931A
Data processing method, electronic equipment and readable storage medium
CN117879687A