Communication system, communication method, and storage medium based on iec104 protocol
By pre-loading I-frame messages and timer monitoring of the IEC104 protocol, the problems of false alarms, timeouts, and failures of remote adjustment and telemetry commands in the IEC104 protocol were solved, and effective testing of slave station response time was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-13
- Publication Date
- 2026-03-20
AI Technical Summary
When the amount of sudden data is large, the IEC104 protocol causes false alarms and timeouts in remote adjustment and telemetry commands, and fails to effectively test the slave station response times T1, T2, and T3.
The system employs a timed control approach. It preloads the master station's I-frame message through the IEC function module, uses the service processing module to determine the duration for the slave station to receive the S-frame acknowledgment instruction, and sends data before the timeout. Combined with timer monitoring of communication status, it prioritizes determining whether the S-frame data segment has timed out, thus avoiding false timeout reports.
It enables data to be sent to the slave station without timeout, avoids false timeout reports for commands, automatically calculates response time, solves the problem of remote adjustment and telemetry command failure, and can test T1, T2, and T3 times.
Smart Images

Figure CN115623096B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication, in particular to a communication system based on IEC104 protocol, a communication method and a storage medium. BACKGROUND
[0002] IEC104 protocol is formulated by International Electrotechnical Commission, and is a standard for transmitting application service data of IEC101 through TCP / IP. The standard provides a basis for communication protocol of network transmission of remote information, and can well guarantee standardization of the protocol and reliability of communication.
[0003] In actual application of IEC104 protocol, the existing communication debugging tool sends total calling instruction, time, remote control and remote adjustment in master station mode (client), and when the data quantity of slave station (server) suddenly changes, the response time of the message of the slave station to the instruction sent by the master station becomes long, frame jamming is likely to occur, the response time of the remote control and remote adjustment command is long, and the problems of misreporting timeout of the sent remote adjustment and remote measurement instruction, failure of sending instruction and the like are likely to occur. When testing the device with IEC104 protocol, the test of time T1 from sending U frame test instruction by the master station to test confirmation, the test of time T2 from sudden burst or response of total calling of the slave station to receiving confirmation S frame, and the test of interval time T3 of starting U frame when the slave station does not receive any data cannot be realized.
[0004] At present, no effective solution has been proposed for the above problems. SUMMARY
[0005] The embodiments of the present application provide a communication system based on IEC104 protocol, a communication method and a storage medium, so as to at least solve the technical problems of misreporting timeout of the sent remote adjustment and remote measurement instruction, failure of sending instruction and the like caused by sudden change of large data quantity in the related art.
[0006] According to an aspect of the embodiments of the present application, a communication system based on IEC104 protocol is provided, comprising: an IEC function module, configured to pre-load I frame messages of different functions of a master station to obtain pre-loaded data; and a service processing module, configured to receive the pre-loaded data, and determine a first time length required for a slave station to receive an S frame confirmation instruction, and in a case that the first time length is less than a first preset time length, send the pre-loaded data to the slave station, wherein the first preset time length is an effective timing time length of a first timer, a starting timing moment of the first timer is the same as a moment when the slave station sends an S frame message to the master station, and the S frame confirmation instruction is an instruction generated by the master station in response to the S frame message sent by the slave station.
[0007] Optionally, the service processing module resets the first timer after sending the preloaded data to the slave station, so as to reset the first timer to zero.
[0008] Optionally, the service processing module is further configured to send a new S-frame message to the master station to obtain a new S-frame confirmation instruction from the master station for the slave station in a case where the first time length is greater than the first preset time length.
[0009] Optionally, the service processing module is further configured to start a second timer, and detect whether there is data communication between the master station and the slave station within a second preset time length of the second timer, wherein the second preset time length is an effective counting time length of the second timer.
[0010] Optionally, the service processing module is further configured to, in a case where it is determined that there is no data communication between the master station and the slave station within the second preset time length of the second timer, control the master station to send a U-frame test message to the slave station, and simultaneously start a third timer, determine a second time length between the sending of the U-frame test message by the master station to the slave station and a U-frame test confirmation instruction returned by the slave station, and in a case where the second time length is greater than a third preset time length, close a TCP / IP connection currently used for communication between the master station and the slave station, wherein the third preset time length is an effective counting time length of the third timer.
[0011] Optionally, the service processing module is further configured to, in a case where it is determined that there is no data communication between the master station and the slave station within the second preset time length of the second timer, control the slave station to send a U-frame test message to the master station, and simultaneously start a third timer, determine a second time length between the sending of the U-frame test message by the slave station to the master station and a U-frame test confirmation instruction returned by the master station, and in a case where the second time length is greater than a third preset time length, close a TCP / IP connection currently used for communication between the master station and the slave station, wherein the third preset time length is an effective counting time length of the third timer.
[0012] Optionally, the service processing module is further configured to, in a case where it is determined that there is data communication between the master station and the slave station within the second preset time length of the second timer, start the first timer and the second timer, and in a case where the master station receives an I-frame message and the first timer does not time out, send an S-frame confirmation instruction to the slave station, and reset the first timer and the second timer.
[0013] Optionally, the service processing module is further configured to start a counter, count the I-frame messages sent by the slave station to the master station after the slave station receives the call from the master station, and in a case where the number of the I-frame messages is equal to a preset threshold, reset the first timer and the counter, and send an S-frame confirmation instruction to the slave station.
[0014] According to another aspect of the embodiments of the present application, a communication method based on IEC104 protocol is also provided, comprising: preloading I-frame messages of various functions of a master station to obtain preloaded data; determining a first time length for a slave station to receive an S-frame confirmation instruction; and in a case where the first time length is less than a first preset time length, sending the preloaded data to the slave station, wherein the first preset time length is an effective timing length of a first timer, a starting timing moment of the first timer is the same as a moment when the slave station sends an S-frame message to the master station, and the S-frame confirmation instruction is an instruction generated by the master station in response to the S-frame message sent by the slave station.
[0015] According to another aspect of the embodiments of the present application, a nonvolatile storage medium is also provided, which comprises a stored program, wherein the program, when executed, controls a device in which the storage medium is located to perform any one of the communication methods based on IEC104 protocol.
[0016] According to another aspect of the embodiments of the present application, an electronic device is also provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement any one of the communication methods based on IEC104 protocol.
[0017] In the embodiments of the present application, a timing control method is adopted to pre-load I-frame messages of various functions of a master station through an IEC function module to obtain preloaded data; a service processing module is used to receive the preloaded data and determine a first time length required for a slave station to receive an S-frame confirmation instruction, and in a case where the first time length is less than a first preset time length, the preloaded data is sent to the slave station, wherein the first preset time length is an effective timing length of a first timer, a starting timing moment of the first timer is the same as a moment when the slave station sends an S-frame message to the master station, and the S-frame confirmation instruction is an instruction generated by the master station in response to the S-frame message sent by the slave station, thus achieving the purpose of simultaneously triggering S-frame and I-frame commands for strategy control, and realizing the technical effects of preferentially determining whether an S-frame data segment is timed out, and sending data to the slave station in a case where the S-frame data segment is not timed out, thereby avoiding false timeout of the instruction and automatically calculating the response time of the activation confirmation, and further solving the technical problems of false timeout of issued remote control and remote measurement instructions, failure of issued instructions and the like caused by large sudden data in the related art. BRIEF DESCRIPTION OF DRAWINGS
[0018] The accompanying drawings, which are included to provide a further understanding of the present application and are incorporated in and constitute a part of this application, illustrate embodiments of the present application and serve to explain the present application, and do not limit the present application in any manner. In the drawings:
[0019] Figure 1 is a structural schematic diagram of a communication system based on IEC104 protocol according to the embodiments of the present application;
[0020] Figure 2 is an optional system module schematic diagram of the present application;
[0021] Figure 3 is a system control flow schematic diagram in an embodiment of the present application;
[0022] Figure 4 is a flow schematic diagram of a communication method based on IEC104 protocol according to an embodiment of the present application;
[0023] Figure 5 shows a schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present application. DETAILED DESCRIPTION
[0024] In order to make the personnel in the art better understand the present application scheme, the technical scheme in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by the person skilled in the art without creative labor should belong to the scope of protection of the present application.
[0025] It should be noted that the terms "first", "second" and the like in the description and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units need not be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0026] In order to facilitate the person skilled in the art to better understand the related embodiments of the present application, the technical terms or part of the nouns that the present application may involve are explained as follows:
[0027] LabVIEW (Laboratory Virtual Instrument Engineering Workbench) is a graphical programming language development environment widely accepted by industry, academia, and research laboratories, and considered a standard data acquisition and instrument control software. The graphical programming language is also known as the "G" language. LabVIEW is an end-user-oriented tool. It provides a convenient way to implement instrument programming and data acquisition systems. Using it for principle research, design, testing, and instrument system implementation can greatly improve work efficiency; its main advantage is that with a single hardware, different instrument functions can be achieved by changing the software, which is very convenient—essentially, software is hardware.
[0028] According to an embodiment of this application, an embodiment of a communication system based on the IEC104 protocol is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0029] Figure 1 This is a communication system based on the IEC104 protocol according to an embodiment of this application, such as... Figure 1 As shown, the communication system includes:
[0030] IEC function module 10 is used to preload I-frame messages of different functions of the master station to obtain preloaded data;
[0031] The service processing module 20 is used to receive preloaded data and determine the first duration required for the slave station to receive the S-frame acknowledgment instruction. If the first duration is less than the first preset duration, the preloaded data is sent to the slave station. The first preset duration is the effective timing duration of the first timer. The start timing of the first timer is the same as the time when the slave station sends the S-frame message to the master station. The S-frame acknowledgment instruction is the instruction generated by the master station in response to the S-frame message sent by the slave station.
[0032] It should be noted that the S-frame acknowledgment instruction is a return instruction from the master station to the slave station after the slave station sends an S-frame data packet to the master station. It can be understood that the start time of the first timer is the same as the time when the slave station sends the S-frame packet to the master station. This means that the first timer is started simultaneously with the slave station sending the S-frame packet. In some embodiments of this application, the first preset duration corresponding to this first timer can be represented by T2, and is generally set to 5 seconds. Optionally, this communication system based on the IEC104 protocol is a system developed using the LabVIEW language.
[0033] The communication system comprises the IEC function module 10, which is configured to pre-load I frame messages of different functions of the master station to obtain pre-loaded data; and the service processing module 20, which is configured to receive the pre-loaded data, determine a first time length required for the slave station to receive an S frame confirmation instruction, and send the pre-loaded data to the slave station in a case where the first time length is less than a first preset time length, wherein the first preset time length is an effective timing time length of a first timer, a starting timing moment of the first timer is the same as a moment when the slave station sends an S frame message to the master station, and the S frame confirmation instruction is an instruction generated by the master station in response to the S frame message sent by the slave station. The purpose of simultaneously triggering the S frame and the I frame instructions to perform strategy control is achieved, so that the priority of determining whether the S frame data segment is timed out is realized, the data can be sent to the slave station in a case where the S frame data segment is not timed out, the false timeout of the instruction is avoided, the technical effect of automatically calculating the response time of the activation confirmation is achieved, and the technical problems of false timeout of the issued remote control and remote measurement instructions, failure of the issued instructions and the like caused by a large amount of sudden data in the related art are solved.
[0034] It should be noted that the service processing module resets the first timer after sending the pre-loaded data to the slave station, so as to reset the first timer to zero. It can be understood that after the pre-loaded data is sent to the slave station, the current communication is equivalent to being completed, and therefore, the first timer needs to be reset to zero. In this way, in a new round of communication process, the judgment can be continued, that is, when the master station sends new data to the slave station, the timeout of the S frame data can be determined first, and the new data is sent to the slave station in a case where the S frame data is not timed out. In a case where the S frame data is timed out, the slave station needs to send S frame data to the master station again. In addition, the service processing module is also configured to send a new S frame message to the master station in a case where the first time length is greater than the first preset time length, so as to obtain a new S frame confirmation instruction from the master station.
[0035] In some embodiments of the present application, the communication between the master station and the slave station can also be monitored in real time by using the timer. In a case where no data interaction between the slave station and the master station is detected within a certain time length, a corresponding operation is performed. Specifically, the service processing module is also configured to start a second timer and detect whether there is data communication between the master station and the slave station within a second preset time length of the second timer, wherein the second preset time length is an effective timing time length of the second timer.
[0036] Optionally, the business processing module is further configured to, in a case where it is determined that there is no data communication between the master station and the slave station within the second preset time length of the second timer, control the master station to send a U-frame test message to the slave station, and simultaneously start a third timer, determine a second time length between the sending of the U-frame test message by the master station to the slave station and the reply of a U-frame test confirmation command by the slave station, and in a case where the second time length is greater than a third preset time length, close the TCP / IP connection currently used for communication between the master station and the slave station, wherein the third preset time length is an effective timing time length of the third timer. It should be noted that in some embodiments of the present application, the third preset time length corresponding to the third timer can be represented by T1, and can be set to 10S.
[0037] As another optional embodiment, the business processing module is further configured to, in a case where it is determined that there is no data communication between the master station and the slave station within the second preset time length of the second timer, control the slave station to send a U-frame test message to the master station, and simultaneously start a third timer, determine a second time length between the sending of the U-frame test message by the slave station to the master station and the reply of a U-frame test confirmation command by the master station, and in a case where the second time length is greater than a third preset time length, close the TCP / IP connection currently used for communication between the master station and the slave station, wherein the third preset time length is an effective timing time length of the third timer. That is, whether the master station or the slave station, after sending a U-frame, a T1 needs to be started, and when T1 is exceeded, the TCP / IP connection currently used for communication between the master station and the slave station is closed.
[0038] It can be understood that through the above technical solutions, not only can the TCP / IP connection between the master station and the slave station be closed in a case where there is no data communication between the master station and the slave station within a certain time length, but also the test of the time T1 (greater than T1 to close the communication connection) from the sending of a U-frame test instruction by the master station to the test confirmation, the test of the time T2 from the burst or response of the slave station to the reception of the confirmation S-frame, and the test of the interval time T3 of the U-frame started by the slave station when no data is received can be implemented.
[0039] In an optional embodiment of the present application, in a case where there is data communication between the master station and the slave station, the corresponding timers can still be started to monitor the time lengths used in each process. Specifically, the business processing module is further configured to, in a case where it is determined that there is data communication between the master station and the slave station within the second preset time length of the second timer, start the first timer T2 and the second timer T3, and in a case where an I-frame message is received by the master station and the first timer T2 has not timed out, send an S-frame confirmation instruction to the slave station, and reset the first timer T2 and the second timer T3.
[0040] In some embodiments of the present application, the service processing module is further configured to start a counter, count the I-frame messages sent by the slave station to the master station after receiving the call from the master station, and reset the first timer and the counter when the number of I-frame messages is equal to a preset threshold, and send an S-frame confirmation instruction to the slave station. In some embodiments of the present application, the number of I-frame messages can be represented by K. Meanwhile, the first timer T2 can be determined according to the following formula: T2≤(K*2) / 3.
[0041] Figure 2 is an optional system module schematic diagram of the present application, as shown in Figure 2 The system includes an IEC function module and a service processing module, and the service processing module includes a data loading module, a data sending module, a communication interface connection module, a data receiving module, and a data analysis module.
[0042] Specifically, the IEC function module can realize the automatic import function of the device protocol file, and import the remote signaling, remote measurement, remote control, and remote adjustment addresses into the corresponding function table, respectively, realize the remote control, remote adjustment, total call, and time function data pre-loading function, send the data to the data loading module in the service processing module through the queue, and receive the address and corresponding data information provided by the data analysis module in the service processing module in real time. It is easy to note that the above system can realize the automatic import function of the protocol file, and import the remote signaling, remote measurement, remote control, and remote adjustment addresses into the corresponding function table, respectively, avoid repeated query of the protocol file and manual address information input, and improve the communication test efficiency and reduce the test time.
[0043] The sending state, receiving state, and response state counters in the service processing module should be cleared after establishing the TCP connection. When receiving the I-frame data sent by the slave station, the receiving sequence number should be increased by 1 after receiving an I-frame message with the same receiving sequence number. If the sending sequence number of the I-frame message is greater than the receiving sequence number, it indicates that some messages sent by the sender are lost. If the sending sequence number of the I-frame message is less than the receiving sequence number, it means that the sender has repeated transmission. In addition, the receiving sequence numbers of the I-frame and S-frame messages indicate the confirmation of the received I-frame message by the party sending the message. If a certain I-frame message sent by the sender cannot be confirmed in the receiving sequence number of the other party for a long time, it means that the message is lost. When the above message loss and out-of-order situations occur, it is determined that the TCP connection has a problem, the communication interface connection module disconnects the TCP / IP connection and restarts the session process on a new TCP connection.
[0044] The data loading module in the service processing module realizes modification of the data loading control field of the remote control, remote adjustment, general call, and time setting functions, so that when the S frame is less than the timeout time T2, the data is sent through the data sending module, and the timer T2 is reset; if the condition is not met, the control field is repeatedly modified to realize data sending. It can be understood that the received preloaded data is processed by the data loading module in the service processing module, so that the S frame can be preferentially replied when the timeout time T2 is equal to the S frame, and then the preloaded data of the IEC function module interface is loaded and sent. Through this method, the timeout and error phenomenon of sending data can be avoided.
[0045] The data receiving module in the service processing module starts the U frame test interval T3 timer when there is no data communication, and when the T3 timer is timed out, the U frame test command is started, and the data is transmitted to the data loading module through the queue mode; when the time from sending the U frame test instruction to receiving the test confirmation instruction is greater than T1, the communication interface connection module disconnects the TCP / IP connection and restarts the session process on the new TCP connection. When there is data communication, the received data is transmitted to the data parsing module.
[0046] The data parsing module in the service processing module reads the object data of the single-point number and floating-point data through the type identifier of the received I frame format, and transmits the data to the IEC function interface module, and realizes automatic data updating; the sending state, receiving state, and response state counter are updated, and are sent to the data loading module together with the data to be replied through the queue.
[0047] The data parsing module, the success judgment of the data issued by the IEC function module interface, and the response time calculation module realize the judgment of whether the activated frame is successfully issued by the IEC function module interface, calculate the time consumed by the activation after the activation command is confirmed, and output the result to the IEC function module interface, and clear the corresponding activation command in the data loading module. It is easy to note that through the data loading module, the success judgment of the data issued, and the response time calculation module, the data loading module can realize strategy control when the S frame and the I frame command are triggered at the same time, solve the problems of timeout, failure to issue remote adjustment and remote measurement instructions, and automatically calculate the response time of the activation confirmation.
[0048] Figure 3 is a system control flow diagram in the embodiment of the application, as shown in Figure 3 , the control flow includes:
[0049] (1) the client and the server establish a connection, and send a start frame at the same time;
[0050] (2) after receiving the start frame, the server sends a start confirmation frame to the client;
[0051] (3) The client receives the start confirmation frame and sends a total calling data request frame;
[0052] (4) The server receives the total calling data request and sends a total calling data response frame, receives the message counter, and then continues to send the total calling data. The client clears the received message counter K and starts the no-data message timeout T2;
[0053] (5) The client receives the calling data, and the timer K counts the I frame;
[0054] (6) It is judged whether K is equal to the preset value. If K is equal to the preset value, the timer T2 is cleared (i.e., T2 is set to zero), and an S format frame confirmation is sent;
[0055] (7) After the S format frame confirmation is sent, it is judged whether the calling activation is terminated. If the calling activation is terminated, the client sends a time request frame;
[0056] (8) After the calling activation is terminated, the client sends a time request frame, and the server receives the time request and sends a time response frame;
[0057] (9) Then, the no-data message timeout T2 is started, the long-term idle timer T3 is started, and it is judged whether T2 is timed out after receiving the I format message;
[0058] (10) If yes, the timers T2 and T3 are cleared, and an S format frame confirmation is sent. If no, remote adjustment, remote control command, and time instruction are sent, and then it is judged whether T3 is timed out;
[0059] (11) If T3 is timed out, a test U frame is actively sent, the timers T2 and T3 are closed, and the timer T1 is started. If T3 is not timed out, the no-data message timeout T2 is restarted, the long-term idle timer T3 is started, and it is judged whether T2 is timed out after receiving the I format message;
[0060] (12) Then, it is judged whether T1 is timed out when the U confirmation frame is received;
[0061] (13) If T1 is timed out, the timer T1 is closed. If T1 is not timed out, the no-data message timeout T2 is restarted, the long-term idle timer T3 is started, and it is judged whether T2 is timed out after receiving the I format message.
[0062] Figure 4 The communication method based on the IEC104 protocol according to the embodiment of the application, as shown in FIG. 1, comprises the following steps: Figure 4
[0063] In step S402, the I frame messages of various functions of the master station are preloaded to obtain preloaded data;
[0064] In step S404, a first time length for the slave station to receive the S-frame confirmation instruction is determined.
[0065] In step S406, in a case where the first time length is less than a first preset time length, the preloaded data is sent to the slave station, where the first preset time length is an effective timing time length of a first timer, a starting timing time of the first timer is the same as a time when the slave station sends the S-frame message to the master station, and the S-frame confirmation instruction is an instruction generated by the master station in response to the S-frame message sent by the slave station.
[0066] In the communication method based on the IEC104 protocol, the I-frame messages of various functions of the master station are preloaded to obtain preloaded data, the first time length for the slave station to receive the S-frame confirmation instruction is determined, and then in a case where the first time length is less than the first preset time length, the preloaded data is sent to the slave station, where the first preset time length is an effective timing time length of a first timer, a starting timing time of the first timer is the same as a time when the slave station sends the S-frame message to the master station, and the S-frame confirmation instruction is an instruction generated by the master station in response to the S-frame message sent by the slave station. The purpose of simultaneously triggering the S-frame and the I-frame command for policy control is achieved, so that the technical effects of preferentially determining whether the S-frame data segment is timed out and sending data to the slave station in a case where the S-frame data segment is not timed out are achieved, the false timeout of the instruction is avoided, and the response time of the activation confirmation can be automatically calculated, thereby solving the technical problems of false timeout of the issued remote control and remote measurement instructions, failure of the issued instructions and the like caused by large sudden data in the related art.
[0067] According to another aspect of the embodiments of the present application, a nonvolatile storage medium is also provided, and the storage medium includes a stored program. When the program is executed, the device in which the storage medium is located performs any one of the communication methods based on the IEC104 protocol.
[0068] Specifically, the storage medium is used to store program instructions of the following functions to achieve the following functions:
[0069] The I-frame messages of various functions of the master station are preloaded to obtain preloaded data, the first time length for the slave station to receive the S-frame confirmation instruction is determined, and in a case where the first time length is less than the first preset time length, the preloaded data is sent to the slave station, where the first preset time length is an effective timing time length of a first timer, a starting timing time of the first timer is the same as a time when the slave station sends the S-frame message to the master station, and the S-frame confirmation instruction is an instruction generated by the master station in response to the S-frame message sent by the slave station.
[0070] Optionally, in the present embodiment, the storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the storage medium would include one or more lines of electrical connection, portable computer diskette, hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
[0071] In an example embodiment of the present application, a computer program product is also provided, comprising a computer program which, when executed by a processor, implements any of the above IEC104 protocol based communication methods.
[0072] Optionally, the computer program, when executed by the processor, can implement the following steps:
[0073] The I-frame messages of various functions of the master station are preloaded to obtain preloaded data; a first time length for the slave station to receive an S-frame confirmation instruction is determined; in a case where the first time length is less than a first preset time length, the preloaded data is sent to the slave station, wherein the first preset time length is an effective timing time length of a first timer, a starting timing moment of the first timer is a same moment as a moment when the slave station sends an S-frame message to the master station, and the S-frame confirmation instruction is an instruction generated by the master station in response to the S-frame message sent by the slave station.
[0074] According to an embodiment of the present application, an electronic device is provided, which includes at least one processor, and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform any of the above IEC104 protocol based communication methods.
[0075] Optionally, the electronic device can further include a transmission device and an input / output device, wherein the transmission device is connected with the processor, and the input / output device is connected with the processor.
[0076] Figure 5A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.
[0077] As shown, Figure 5 The device 500 includes a computing unit 501 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 502 or a computer program loaded into a random access memory (RAM) 503 from a storage unit 508. Various programs and data required for the operation of the device 500 can also be stored in the RAM 503. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0078] Various components in the device 500 are connected to the I / O interface 505, including an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; the storage unit 508, such as magnetic disks, optical disks, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0079] The computing unit 501 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 501 performs various methods and processes described above, such as the IEC 104 protocol based communication method. For example, in some embodiments, the IEC 104 protocol based communication method can be implemented as a computer software program tangibly embodied in a machine readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded onto the RAM 503 and executed by the computing unit 501, one or more steps of the IEC 104 protocol based communication method described above can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform the IEC 104 protocol based communication method by any other appropriate means, such as by means of firmware.
[0080] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0081] Program code for carrying out methods of the present application can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / acts specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0082] In the context of this application, a machine-readable medium can be a tangible medium that can contain or store program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable storage medium can include but are not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0083] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0084] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0085] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server can arise by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0086] The above-mentioned sequence numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
[0087] In the above-mentioned embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0088] In the several embodiments provided by the present application, it should be understood that the disclosed technology can be implemented in other ways. Of course, the unit embodiment described above is only illustrative, and for example, the division of units can be a logical function division, and there can be another division manner in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, unit or module, and can be electrical or other forms.
[0089] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0090] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0091] The integrated unit, if realized in the form of software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part of the prior art that makes a contribution or the whole or part of the technical solutions can be embodied in the form of software product, which is stored in a storage medium and includes a plurality of instructions for making a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and various program code storage media.
[0092] The above merely describes the preferred embodiments of the present application, and it should be pointed out that, for those skilled in the art, some improvements and refinements can be made without departing from the principles of the present application, and these improvements and refinements should also be considered as the protection scope of the present application.
Claims
1. A communication system based on the IEC 104 protocol, characterized in that, include: The IEC function module is used to preload I-frame messages of different functions of the master station to obtain preloaded data; The service processing module is used to receive the preloaded data and determine the first duration required for the slave station to receive the S-frame acknowledgment instruction. If the first duration is less than the first preset duration, the master station determines that the S-frame data segment has not timed out and sends the preloaded data to the slave station. The first preset duration is the effective timing duration of the first timer. The start timing of the first timer is the same as the time when the slave station sends the S-frame message to the master station. The S-frame acknowledgment instruction is an instruction generated by the master station in response to the S-frame message sent by the slave station.
2. The communication system according to claim 1, characterized in that, After sending the preloaded data to the slave station, the service processing module resets the first timer to set it to zero.
3. The communication system according to claim 1, characterized in that, The service processing module is further configured to send a new S-frame message to the master station when the first duration is longer than the first preset duration, so that the slave station can obtain a new S-frame confirmation instruction from the master station.
4. The communication system according to claim 1, characterized in that, The business processing module is also used to start a second timer and detect whether there is data communication between the master station and the slave station within a second preset duration of the second timer, wherein the second preset duration is the effective timing duration of the second timer.
5. The communication system according to claim 4, characterized in that, The service processing module is further configured to, when it is determined that there is no data communication between the master station and the slave station within the second preset duration of the second timer, control the master station to send a U-frame test message to the slave station, and simultaneously start a third timer to determine the second duration between the master station sending the U-frame test message to the slave station and the slave station replying with a U-frame test confirmation command. If the second duration is greater than the third preset duration, close the TCP / IP connection currently used for communication between the master station and the slave station, wherein the third preset duration is the effective timing duration of the third timer.
6. The communication system according to claim 4, characterized in that, The service processing module is further configured to, when it is determined that there is no data communication between the master station and the slave station within the second preset duration of the second timer, control the slave station to send a U-frame test message to the master station, and simultaneously start a third timer to determine the second duration between the slave station sending the U-frame test message to the master station and the master station replying with a U-frame test confirmation command. If the second duration is greater than the third preset duration, close the TCP / IP connection currently used for communication between the master station and the slave station, wherein the third preset duration is the effective timing duration of the third timer.
7. The communication system according to claim 4, characterized in that, The service processing module is further configured to, when it is determined that there is data communication between the master station and the slave station within the second preset duration of the second timer, start the first timer and the second timer, and when the master station receives an I-frame message and the first timer has not expired, send an S-frame confirmation instruction to the slave station and reset the first timer and the second timer.
8. The communication system according to claim 1, characterized in that, The service processing module is also used to start a counter to count the I-frame messages sent by the slave station to the master station after receiving the master station's call. When the number of I-frame messages is equal to a preset threshold, the first timer and the counter are reset, and an S-frame confirmation instruction is sent to the slave station.
9. A communication method based on the IEC 104 protocol, characterized in that, include: Preload I-frame messages of various functions from the main station to obtain preloaded data; Determine the first duration for which the slave station receives the S-frame acknowledgment command; If the first duration is less than the first preset duration, the master station determines that the S-frame data segment has not timed out and sends the preloaded data to the slave station. The first preset duration is the effective timing duration of the first timer. The start timing of the first timer is the same as the time when the slave station sends the S-frame message to the master station. The S-frame acknowledgment instruction is an instruction generated by the master station in response to the S-frame message sent by the slave station.
10. A non-volatile storage medium, characterized in that, The storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the storage medium to perform the communication method based on the IEC104 protocol as described in claim 9.
11. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the communication method based on the IEC104 protocol as described in claim 9.