Message correction method and system for preventing sessions from being blocked by an operation and maintenance audit system
By setting the directional 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 serial number misalignment problem caused by message loss in the 104 standard communication session in the power system is solved, and the stability and adaptability of the communication session are improved.
Patent Information
- Application Number
- CN202510352463.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-03-25
AI Technical Summary
When the operation and maintenance audit system is deployed in the power system, it causes packet loss and serial number misalignment of the 104-standard communication session between the factory station and the main station, affecting the stability of the communication session.
In the proxy layer of the operation and maintenance audit system, the sending sequence number and/or receiving sequence number in the APDU message data frame are corrected by setting the directional sequence number to ensure that when the message is lost, the received sequence number remains continuous with the sending sequence number of the most recently sent I-frame APDU.
It effectively prevents the session from being blocked by the operation and maintenance audit system, ensures the continuity and stability of the 104-standard communication session, and improves the adaptability of the operation and maintenance audit system and the power system.
Smart Images

Figure CN119865467B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of operation and maintenance auditing, and specifically, to a method and system for message correction to prevent sessions from being blocked by an operation and maintenance auditing system. Background Art
[0002] For the communication between a substation and a dispatching master station in a power system, the IEC 60870-5-104 telecontrol protocol (hereinafter referred to as the 104 protocol) is usually used. The 104 protocol is an extension of the IEC 60870-5-101 protocol used on the TCP / IP protocol.
[0003] The message of the 104 protocol is called an APDU (Application Protocol Data Unit), which is the application layer data packet format used in the TCP / IP transmission process of the 104 telecontrol protocol. It consists of two parts: APCI (Application Protocol Control Information) and ASDU (Application Service Data Unit). Among them, the APCI application protocol control information includes a start character (68H), an APDU length field, and four control fields, a total of six octets. The ASDU application service data unit is used to transmit telemetry, tele-signaling, remote control and other data during the communication process of the 104 telecontrol protocol.
[0004] The control fields of the APCI application protocol control information define the control information for protecting messages from being lost and repeatedly transmitted, the start / stop of message transmission, and the monitoring of the transmission connection, etc. 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 in different formats and is respectively 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 auditing system, the 104 protocol communication data between the substation and the master station needs to be forwarded through the proxy layer of the operation and maintenance auditing system. At this time, if the proxy layer blocks and discards some 104 protocol messages according to the instruction policy of the operation and maintenance auditing system, then the APDU sequence number sent by the sending station and the APDU sequence number confirmed by the receiving station as received will be misaligned, thereby triggering the abnormal termination of the communication session by the sending station.
[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 substation software system and the master station software system already deployed in the power system. Therefore, in the prior art, reasonable parameter configuration is adopted in the main substation to avoid such failures. There is a lack of a method for adapting the 104 protocol in the proxy layer of the operation and maintenance audit system to prevent message loss and repeated transmission, and there is a technical problem of poor adaptability 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 sessions from being blocked by the operation and maintenance audit system. When the 104 protocol communication data between the substation and the master station passes through the proxy module of the operation and maintenance audit system for forwarding, if some APDU messages are blocked and discarded by the proxy layer due to the operation and maintenance audit system policy, the proxy layer corrects the APDU message sequence number, thus realizing the adaptation of the 104 protocol to prevent message loss and the acceptance confirmation mechanism, ensuring the continuity of the communication session, and solving the technical problem of poor adaptability between the operation and maintenance audit system and the 104 protocol of the power system.
[0009] The present invention is realized through the following technical solutions:
[0010] In the first aspect, the present application discloses a message correction method for preventing sessions from being blocked by the operation and maintenance audit system, which is applied to the proxy layer of the operation and maintenance audit system. The substation of the power system establishes a TCP / IP connection with the master station of the power system through the proxy layer and starts a 104 protocol communication session:
[0011] For the APDU message data frame whose message type in the 104 protocol communication flow is I-frame APDU, set a direction sequence number representing the sending direction and the cumulative number of I-frame APDUs.
[0012] When the APDU message data frame needs to be forwarded, first correct the sending sequence number and / or the receiving sequence number in the APDU message data frame using the corresponding direction sequence number, and then forward it. According to the message type of the APDU message data frame, adjust the direction sequence number so that when an APDU message data frame is discarded in the 104 protocol communication session, the receiving sequence number of the acknowledgment frame received by the sending station is continuous with the sending sequence number of the last I-frame APDU sent by itself.
[0013] To better implement the present invention, further, the method of correcting the sending sequence number and / or the receiving sequence number in the APDU message data frame using the direction sequence number according to the sending direction and the message type includes:
[0014] If the message type of the APDU message data frame is I-frame APDU, correct both the sending sequence number and the receiving sequence number.
[0015] If the message type of the APDU message data frame is an S-frame APDU, only the receive sequence number is corrected.
[0016] To better implement the present invention, further, the sending directions include the direction from the substation to the proxy layer, the direction from the proxy layer to the master station, the direction from the master station to the proxy layer, and the direction from the proxy layer to the substation. The corresponding direction sequence numbers for each sending direction are the direction sequence number NR[0] from the substation to the proxy layer, the direction sequence number NS[0] from the proxy layer to the master station, the direction sequence number NR[1] from the master station to the proxy layer, and the direction sequence number NS[1] from the proxy layer to the substation.
[0017] To better implement the present invention, further, a method for correcting the sending sequence number and / or the receive sequence number in the APDU message data frame using the direction sequence number according to the sending direction and the message type includes:
[0018] Correct the sending sequence number of the I-frame APDU forwarded to the master station to NS[0], and correct the receive sequence number to NR[1];
[0019] Correct the sending sequence number of the I-frame APDU forwarded to the substation to NS[1], and correct the receive sequence number to NR[0].
[0020] To better implement the present invention, further, a method for correcting the sending sequence number and / or the receive sequence number in the APDU message data frame using the direction sequence number according to the sending direction and the message type includes:
[0021] Correct the receive sequence number of the S-frame APDU forwarded to the master station to NR[1];
[0022] Correct the receive sequence number of the S-frame APDU forwarded to the substation to NR[0].
[0023] To better implement the present invention, further, use a counter to count the accumulated number of I-frame APDUs in each sending direction to obtain a counting result, and set the direction sequence number for the I-frame APDUs in each sending direction according to the counting results of each sending direction.
[0024] To better implement the present invention, further, before establishing the TCP / IP connection between the master station and the substation, it further includes:
[0025] When starting to listen on the 104 protocol proxy port, define a corresponding number of counters according to the number of sending directions, so as to assign the direction sequence numbers of each direction to each I-frame APDU through the counting of the counters.
[0026] To better implement the present invention, further, a method for determining whether each APDU message data frame needs to be forwarded or discarded includes:
[0027] First, according to the reception order, each APDU message data frame is placed in the same queue for synchronization, and then the APDU message data frames are taken out from the queue one by one in sequence for judgment.
[0028] 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, including:
[0029] A sequence number setting module, which is used to set a direction sequence number for the APDU message data frame of the I-frame APDU in the 104 protocol communication flow according to the sending direction and the cumulative number of I-frame APDUs;
[0030] A forwarding module, which is used to, when an APDU message data frame needs to be forwarded, first correct the sending sequence number and / or the receiving sequence number in the APDU message data frame using the corresponding direction sequence number, and then forward it and adjust the direction sequence number according to the message type of the APDU message data frame, so that when there is a situation of discarding APDU message data frames in the 104 protocol communication session, the receiving sequence number of the acknowledgment frame received by the sending site is continuous with the sending sequence number of its own most recent sent I-frame APDU.
[0031] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0032] By setting the direction sequence number, it is possible to maintain the progress of the 104 protocol communication session in the case of partial data blocking of the 104 protocol communication session, making it easier to deploy the operation and maintenance audit system into the power system, and improving the applicability of the operation and maintenance audit system and the stability of the 104 protocol communication session. Description of the Drawings
[0033] The present invention will be further described in conjunction with the following drawings and embodiments. All creative concepts of the present invention should be regarded as the disclosed content and the protection scope of the present invention.
[0034] Figure 1 It is a schematic flowchart of an implementation manner of Embodiment 1 of a message correction method for preventing a session from being blocked by an operation and maintenance audit system in the present application.
[0035] Figure 2 It is a schematic flowchart of an implementation manner of Embodiment 3 of a message correction method for preventing a session from being blocked by an operation and maintenance audit system in the present application.
[0036] Figure 3 It is a schematic diagram of forwarding an I-frame APDU to the master station in Embodiment 3 of a message correction method for preventing a session from being blocked by an operation and maintenance audit system in the present application.
[0037] Figure 4Schematic diagram of forwarding I-frame APDU to the substation in Embodiment 3 of a method for correcting messages to prevent sessions from being blocked by an operation and maintenance auditing system in this application.
[0038] Figure 5 Schematic diagram of forwarding S-frame APDU in Embodiment 3 of a method for correcting messages to prevent sessions from being blocked by an operation and maintenance auditing system in this application.
[0039] Figure 6 Schematic diagram of an embodiment of a message correction system for preventing sessions from being blocked by an operation and maintenance auditing system in this application. Detailed implementation manners
[0040] Embodiment 1
[0041] A method for correcting messages to prevent sessions from being blocked by an operation and maintenance auditing system, which is applied to the proxy layer of the operation and maintenance auditing system. The substation of the power system establishes a TCP / IP connection with the master station of the power system through the proxy layer and starts a 104 protocol communication session:
[0042] For the APDU message data frame with the message type of I-frame APDU in the 104 protocol communication flow, set the direction sequence number representing the sending direction and the cumulative number of I-frame APDUs.
[0043] When it is necessary to forward the APDU message data frame, first correct the sending sequence number and / or the receiving sequence number in the APDU message data frame using the corresponding direction sequence number, and then forward it. According to the message type of the APDU message data frame, adjust the direction sequence number so that when there is a situation of discarding the APDU message data frame in the 104 protocol communication session, the receiving sequence number of the acknowledgment frame received by the sending site is continuous with the sending sequence number of its own most recent sent I-frame APDU.
[0044] See Figure 1 In an optional implementation manner, the method for correcting messages to prevent sessions from being blocked by an operation and maintenance auditing system includes the following steps:
[0045] Step S101: Define a direction sequence number template representing the sending direction and the cumulative number of I-frame APDUs;
[0046] Step S102: Establish a TCP / IP connection from the substation to the master station and start a 104 protocol communication session;
[0047] Step S103: Parse out the APDU message data frame from the 104 protocol communication flow according to the APDU message structure definition;
[0048] Step S104: Fill the cumulative number of I-frame APDUs from different directions into the corresponding direction sequence number template to obtain the corresponding direction sequence number;
[0049] Step S105: Determine whether to block the I-frame APDU according to the policy settings of the operation and maintenance audit system. If it is necessary to block, execute Step S106; if it is not necessary to block, execute Step S107;
[0050] Step S106: Discard the I-frame APDU and return to execute Step S103;
[0051] Step S107: Process the APDU message data frame before forwarding, and correct the sending sequence number and / or the receiving sequence number using the corresponding direction sequence number;
[0052] Step S108: Forward the APDU message data frame to the target site and determine whether the APDU message data frame is an I-frame APDU. If it is, execute Step S109; if not, execute Step S110;
[0053] Step S109: According to the sending direction, fill the accumulated quantity of the I-frame APDU into the direction sequence number template and adjust the direction sequence number;
[0054] Step S110: Return to execute Step S103 until the 104 protocol communication session ends.
[0055] By adopting this embodiment, 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 entire 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, improving the session stability and enabling the operation and maintenance audit system to better adapt to the 104 protocol of the power system;
[0056] Only relevant settings need to be made to the proxy layer of the operation and maintenance audit system, without modifying the parameters of the power system substation and the master station, which has the beneficial effects of high application efficiency, low application cost, and strong applicability.
[0057] Embodiment 2
[0058] On the basis of the above Embodiment 1, this embodiment is further optimized. In this embodiment, the method for correcting the sending sequence number and / or the receiving sequence number in the APDU message data frame using the direction sequence number according to the sending direction and the message type includes:
[0059] If the message type of the APDU message data frame is an I-frame APDU, both the sending sequence number and the receiving sequence number are corrected;
[0060] If the message type of the APDU message data frame is an S-frame APDU, only the receiving sequence number is corrected.
[0061] Further, the sending directions include the direction from the substation to the proxy layer, the direction from the proxy layer to the master station, the direction from the master station to the proxy layer, and the direction from the proxy layer to the substation. The corresponding direction sequence numbers for each sending direction are the direction sequence number NR[0] from the substation to the proxy layer, the direction sequence number NS[0] from the proxy layer to the master station, the direction sequence number NR[1] from the master station to the proxy layer, and the direction sequence number NS[1] from the proxy layer to the substation.
[0062] Furthermore, 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 according to the sending direction and the message type includes:
[0063] 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];
[0064] Correct the sending sequence number of the I-frame APDU forwarded to the substation to NS[1], and correct the receiving sequence number to NR[0];
[0065] Correct the receiving sequence number of the S-frame APDU forwarded to the master station to NR[1];
[0066] Correct the receiving sequence number of the S-frame APDU forwarded to the substation to NR[0].
[0067] Adopting this embodiment can effectively ensure the stability of the 104 protocol communication session in the scenario of "master station - operation and maintenance audit system - substation". When the master station needs to establish connections with multiple substations, only need to separately set the direction sequence numbers in four directions of NR[0], NS[0], NR[1], and NS[1] for each session, then the stability of the session can be improved;
[0068] Since there are sending sequence numbers and receiving sequence numbers in the I-frame APDU, only receiving sequence numbers in the S-frame APDU, and neither sending sequence numbers nor receiving sequence numbers in the U-frame APDU, therefore, different sequence number correction methods are adopted. Before forwarding the U-frame APDU, there is no need to process the U-frame APDU anymore.
[0069] Example 3:
[0070] This embodiment further optimizes on the basis of the above Example 2. In this embodiment, before establishing the TCP / IP connection between the master station and the substation, it further includes:
[0071] Use a counter to count the cumulative number of I-frame APDUs in each sending direction to obtain a counting result, and set the direction sequence number for the I-frame APDUs in each sending direction according to the counting results of each sending direction.
[0072] Furthermore, the method for determining whether each APDU message data frame needs to be forwarded or discarded includes:
[0073] First, place each APDU message data frame into the same queue in the receiving order for synchronization, and then sequentially take out each APDU message data frame from the queue for judgment.
[0074] In an alternative implementation of this embodiment, refer to Figure 2 , the message correction method for preventing the session from being blocked by the operation and maintenance audit system includes the following steps:
[0075] Step S201: Start listening on the 104 protocol proxy port and define 4 counters, and establish 4 direction sequence number templates for the NR[0] direction from the substation to the proxy layer, the NS[0] direction from the proxy layer to the master station, the NR[1] direction from the master station to the proxy layer, and the NS[1] direction from the proxy layer to the substation;
[0076] Step S202: Establish a TCP / IP connection from the substation to the master station and start a 104 protocol communication session;
[0077] Step S203: Parse the APDU message data frame from the 104 protocol communication flow according to the APDU message structure definition;
[0078] Step S204: Fill the accumulated quantity of I-frame APDUs from different directions into the NR[0] direction sequence number template from the substation to the proxy layer and the NR[1] direction sequence number template from the master station to the proxy layer to obtain the corresponding direction sequence numbers;
[0079] Step S205: According to the policy settings 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;
[0080] Step S206: Discard the I-frame APDU and return to execute Step S203;
[0081] Step S207: Perform processing on the APDU message data frame before forwarding, and correct the sending sequence number and / or receiving sequence number according to the different message types using the direction sequence numbers NR[0] and NR[1]; specifically as follows:
[0082] Refer to Figure 3 , for the I-frame APDU, if it is forwarded to the master station, correct its sending sequence number to NS[0] and its receiving sequence number to NR[1]; refer to Figure 4 , if it is forwarded to the substation, correct its sending sequence number to NS[1] and its receiving sequence number to NR[0];
[0083] Refer to Figure 5For the S-frame APDU, if it is forwarded to the master station, its received sequence number is corrected to NR[1]; if it is forwarded to the substation, its received sequence number is corrected to NR[0].
[0084] Step S208: Forward the APDU message data frame to the target site and determine whether the APDU message data frame is an I-frame APDU. If so, execute Step S209; if not, execute Step S210.
[0085] Step S209: According to the sending direction, fill the accumulated quantity of the I-frame APDU into the sequence number templates in the directions of NS[0] from the proxy layer to the master station and NS[1] from the proxy layer to the substation, and adjust the direction sequence numbers.
[0086] Step S210: Return to execute Step S203 until the 104 protocol communication session ends.
[0087] By adopting this embodiment, by setting a counter when starting to listen on the 104 protocol proxy port, the preparation work for maintaining the stability of the session is completed before the connection between the master station and the substation is established, so as to ensure the stability of the entire process of the 104 protocol communication session.
[0088] Embodiment 4
[0089] See Figure 6 , a message correction system for preventing a session from being blocked by an operation and maintenance auditing system, including:
[0090] A sequence number setting module, which is used to set the direction sequence number for the APDU message data frame with the message type of I-frame APDU in the 104 protocol communication flow according to the sending direction and the accumulated quantity of the I-frame APDU.
[0091] A forwarding module, which is used to, when an APDU message data frame needs to be forwarded, first correct the sending sequence number and / or received sequence number in the APDU message data frame with the corresponding direction sequence number, and then forward it and adjust the direction sequence number according to the message type of the APDU message data frame, so that when there is a situation of discarding the APDU message data frame in the 104 protocol communication session, the received sequence number of the acknowledgment frame received by the sending site is continuous with the sending sequence number of its own most recent sent I-frame APDU.
[0092] The above is only a preferred embodiment of the present invention, and does not impose any form of limitation on the present invention. Any simple modification and equivalent change made to the above embodiments 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 proxy layer discards the APDU message data frame according to the policy setting of the operation and maintenance audit system 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; 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; 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.
2. 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: 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: The sending sequence number of the I frame APDU forwarded to the master station is corrected to NS[0], and the receiving sequence number is corrected 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].
3. 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: 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: The receiving sequence number of the S-frame APDU forwarded to the master station is corrected to NR[1]; the receiving sequence number of the S-frame APDU forwarded to the plant station is corrected to NR[0].
4. 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: 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.
5. The message correction method for preventing a session from being blocked by an operation and maintenance audit system according to claim 4 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.
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: 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.
7. 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 by 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 proxy layer discards the APDU message data frame according to the policy setting of the operation and maintenance audit system in the 104 protocol communication session, the receiving sequence number of the confirmation frame received by the sending station is kept continuous with the sending sequence number of the most recently sent I frame APDU by itself; 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; 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.
Citation Information
Patent Citations
Method and system for realizing data exchange in IEC104 (international electrotechnical commission 104) communication protocol forwarding
CN102325084A