A communication method for mixing different serial port protocols
By setting unique identifiers and attribute values for the gateway serial port and monitoring devices, efficient data communication between multiple monitoring devices on one serial port is achieved, solving the problem of limited number of serial ports on gateway devices and reducing the complexity of communication lines and system maintenance costs.
Patent Information
- Application Number
- CN202211449741.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-18
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2042-11-18
AI Technical Summary
The serial ports of existing gateway devices are limited and can only connect to monitoring devices with the same protocols and parameters, resulting in complex on-site communication lines, high costs and low debugging efficiency.
Set unique identifiers for the serial port and monitoring device on the gateway, and adjust the serial port attribute value by reading the attribute value of the monitoring device to keep it consistent with the monitoring device, so as to achieve data communication between multiple monitoring devices under one serial port, give priority to devices with similar attribute values, and set attributes such as protocol type and baud rate for matching.
It reduces the complexity and wiring cost of laying on-site gateways and communication lines, improves on-site debugging efficiency and maintenance efficiency of communication systems, and realizes efficient data transmission of monitoring equipment with different protocols and parameters.
Smart Images

Figure CN115913825B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of gateway communication, and in particular to a communication method for mixed connection of different serial port protocols. Background Art
[0002] Gateways are crucial devices in power automation systems. As the interface between the communication network and monitoring equipment, gateways undertake a variety of communication tasks, including protocol conversion, interface matching, and data upload. Due to the complexity of field gateways and the diverse monitoring devices that require access, field protocols vary. For example, instrument-type monitoring devices have serial port protocols like Modubs, DLT645, and CJT188, while protection-type monitoring devices have serial port protocols like Modubs, IEC103, and IEC101. Field gateways may also require access to other custom protocols. Even with the same protocol, serial port parameters such as the baud rate and parity check supported by each monitoring device can vary. For example, common baud rates in the field include 2400bps, 4800bps, and 9600bps, significantly increasing the difficulty of connecting monitoring devices to the gateway.
[0003] Existing gateways have a limited number of serial ports, supporting a maximum of 16. Each serial port can only connect to monitoring devices with the same protocol and parameters. The diverse monitoring devices that typically require access to the gateway on-site often have different protocols and interfaces. This requires a large number of serial ports to be supported by the gateway, and the integration of different monitoring devices also complicates on-site communication lines, increasing costs and reducing on-site debugging efficiency. Summary of the Invention
[0004] The purpose of the present invention is to provide a communication method for mixing different serial port protocols to solve the problems in the prior art of complex communication lines laid by field gateways, high costs and low debugging efficiency.
[0005] To solve the above technical problems, the present invention provides a communication method for mixing different serial port protocols, and the specific steps are as follows:
[0006] 1) Set unique identifiers for the serial port and monitoring device on the gateway, and set attribute values for each monitoring device to communicate with the gateway. Randomly mount each monitoring device to a different serial port, and form a configuration file with the identifier and attribute value information and transmit it to the gateway;
[0007] 2) Initialize the gateway, set initialization attribute values for each serial port, and read the configuration file;
[0008] 3) Read the attribute value of one of the monitoring devices mounted under each serial port, and compare the read attribute value with the current attribute value of the serial port. If they are the same, data communication is carried out with the monitoring device whose attribute value is currently read according to the corresponding protocol; if they are different, the attribute value of the serial port is reset to the attribute value of the monitoring device read, and data communication is carried out with the monitoring device whose attribute value is currently read according to the corresponding protocol;
[0009] 4) Repeat step 3) until all monitoring devices have completed data communication.
[0010] Beneficial effects: The present invention sets unique identifiers for the serial port and monitoring device on the gateway respectively, and mounts one or more monitoring devices under each serial port. By reading the attribute value of the monitoring device and adjusting the attribute value of the corresponding serial port based on the attribute value of the currently read detection device, the attribute values of the two are kept consistent in each process, thereby realizing data communication between a serial port and multiple monitoring devices, which can effectively reduce the number of on-site gateways and laid communication lines, thereby reducing the complexity and wiring cost of laying communication lines, and can improve on-site debugging efficiency and reduce system maintenance costs.
[0011] Furthermore, the monitoring device whose attribute value is read sends a response message to the serial port after receiving the protocol data sent by the serial port. If the gateway does not receive the response message within the set response time or response times, it reports to the monitoring device that the communication is interrupted.
[0012] Beneficial effect: After successfully receiving the protocol data, the monitoring device sends a response message to the corresponding serial port, which can timely detect communication failures between the serial port and the monitoring device and reduce the maintenance cost of the communication system.
[0013] Furthermore, all monitoring devices mounted under each serial port are sorted in descending order according to the number of the same attribute values, and the attribute values of the monitoring devices are sequentially obtained by the serial port according to the sorting.
[0014] Beneficial effect: By sorting the monitoring devices mounted on the same serial port according to the similarity of their attribute values, monitoring devices with exactly the same attribute values can be prioritized together, which can reduce the preparation time of the gateway switching monitoring device communication process and thus improve communication efficiency.
[0015] Furthermore, the attributes corresponding to the attribute values of the monitoring device include protocol type, baud rate, parity, start bit, data bit, and stop bit.
[0016] Beneficial effect: By setting multiple attributes for monitoring devices and serial ports for matching, data communication can be achieved between one serial port and multiple monitoring devices of different manufacturers, different serial port protocols, different baud rates, different parity check parameters, etc., which not only helps to improve the efficiency of data transmission, but also can verify the transmitted data and detect communication failures in time.
[0017] Furthermore, each protocol type is individually set with a general call time interval, a polling time interval and a timeout time.
[0018] Beneficial effects: By setting a general call time interval, polling time interval and timeout time for each protocol, the effectiveness of data transmission can be improved, and the communication quality and efficiency of data communication can be improved.
[0019] Furthermore, the number of monitoring devices mounted on the serial port is limited according to the maximum time given by the master station to upload all device data.
[0020] Beneficial effect: By limiting the number of monitoring devices mounted on each serial port by the total data communication time given by the main battle, it is possible to avoid too many monitoring devices mounted on one serial port causing too long data communication time, thereby improving the gateway data communication efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a flow chart of the communication method for mixed connection of different serial port protocols of the present invention. DETAILED DESCRIPTION
[0022] In order to make the objectives, technical solutions and advantages of the present invention more clear, the technical principles and practical applications of the present invention are further described in detail below with reference to the accompanying drawings and embodiments.
[0023] Example of a communication method for mixing different serial port protocols:
[0024] The present invention can realize the mixed access of monitoring equipment with different manufacturers, different serial port protocols, different baud rates and different parity check parameter configurations to the gateway, which can effectively reduce the number of on-site gateways and laid communication lines, thereby reducing the complexity and wiring cost of laying communication lines, and can improve on-site debugging efficiency and reduce system maintenance costs.
[0025] The flow chart of the communication method of mixing different serial port protocols in this embodiment is as follows: Figure 1 The specific steps are as follows:
[0026] 1. Define the identities of the gateway serial port and monitoring device, and set attribute values for the monitoring device.
[0027] Set unique identifiers for the serial port on the gateway and the monitoring device respectively, and set attribute values for each monitoring device to communicate with the gateway, such as protocol type, baud rate, parity, start bit, data bit, stop bit, etc., and form a configuration file with the identifier and attribute value information and transmit it to the gateway. For example, the set monitoring device identifier and attribute value are as follows:
[0028] ID1 (modubs, 4800, no checksum, ...),
[0029] ID2 (dlt645, 2400, no checksum, ...),
[0030] ID3 (iec103, 9600, even parity, ....),
[0031] ID4 (cjt188, 4800, no verification, ....), ......
[0033] IDn (IEC101, 9600, no verification, ...);
[0034] Set a unique COM ID for each serial port on the gateway, for example, COM1, COM2, COM3, ..., COMn.
[0035] 2. Mount each monitoring device to a different serial port.
[0036] Through the gateway file configuration, any different combination of monitoring devices can be mounted to different serial ports. The number of configurations is limited by the maximum time given by the master station to upload all device data. The following corresponding relationship is set. For example, the matching relationship between the serial port and the monitoring device is as follows:
[0037] COM1 subordinate monitoring equipment:
[0038] ID1 (modubs, 4800, no checksum, ...),
[0039] ID3 (iec103, 9600, even parity, ....), ......;
[0041] COM2 subordinate monitoring devices:
[0042] ID2 (dlt645, 2400, no checksum, ...),
[0043] ID6 (dlt645, 4800, no checksum, ....), ......; ......;
[0046] COMn subordinate monitoring equipment:
[0047] ID9 (cjt188, 2400, no checksum, ...),
[0048] ID10 (IEC101, 9600, no verification, ...),
[0049] .......
[0050] 3. Initialize the gateway, set initialization property values for each serial port, and read the configuration file.
[0051] During the initialization process, the gateway obtains the type of monitoring devices mounted on each serial port and the attribute values of each monitoring device by reading the internal file configuration; the gateway software automatically processes and sorts all monitoring devices mounted on each serial port in order from most to least according to the number of the same attribute values, especially arranging monitoring devices with the same protocol and the same interface parameters together to reduce the preparation time of the gateway switching monitoring device communication process and improve communication efficiency; and initializes the attribute value setting for each serial port according to the attribute value of the first monitoring device mounted on it.
[0052] 4. Open a separate process for each serial port. For example, program process TASK1 corresponds to serial port COM1, TASK2 corresponds to serial port COM2, ..., TASKn corresponds to serial port COMn; process TASK first reads the attribute value of the first monitoring device mounted under serial port COM to ensure that the serial port protocol, parameters and other attribute values of the current serial port are consistent with those of the monitoring device; data communication is carried out between each serial port and its corresponding first monitoring device.
[0053] 5. Before each process begins, proceed in sequence according to the order in which the monitoring devices are arranged under each serial port. In each process, read the attribute value of one of the monitoring devices mounted under each serial port, and compare the read attribute value with the current attribute value of the serial port. If they are the same, data communication is carried out with the monitoring device whose attribute value is currently read according to the corresponding protocol; if they are different, the attribute value of the serial port is reset to the attribute value of the monitoring device read, and then data communication is carried out with the monitoring device whose attribute value is currently read according to the corresponding protocol.
[0054] 6. The program sets a timeout response. After the gateway serial port sends data to the monitoring device, if the gateway receives a response message within the set response time or response number, it reports that the monitoring device has successfully replied with a response message and enters the normal cycle process. If the gateway does not receive a response message within the set response time or response number, it reports that the monitoring device's communication is interrupted. The gateway sends a protocol connection command to the interrupted monitoring device at a fixed time interval within a certain period of time. If the gateway receives a protocol connection response message within the set time, it reports that the monitoring device has successfully replied with a response message and enters the normal cycle process. If the gateway does not receive a protocol connection response message within the set time, it reports that the monitoring device has a communication anomaly.
[0055] 7. Repeat steps 5 and 6 until all monitoring devices have successfully completed data communication.
[0056] As another implementation, in step 5, protocol attribute values may be set separately for each protocol, such as the general call time interval, polling time interval, timeout time, etc. The gateway will automatically adjust according to the separate protocol attribute values.
Claims
1. A communication method for mixing different serial port protocols, characterized in that: The specific steps are as follows: 1) Set unique identifiers for the serial port and monitoring device on the gateway, and set attribute values for each monitoring device to communicate with the gateway. Randomly mount each monitoring device to a different serial port, and form a configuration file with the identifier and attribute value information and transmit it to the gateway; 2) Initialize the gateway, set initialization property values for each serial port, and read the configuration file; All monitoring devices mounted on the serial ports are sorted in descending order according to the number of devices with the same attribute value, and the attribute values of the monitoring devices are obtained in sequence by the serial ports according to the sorting; 3) Read the attribute value of one of the monitoring devices mounted under each serial port, and compare the read attribute value with the current attribute value of the serial port. If they are the same, data communication is carried out with the monitoring device whose attribute value is currently read according to the corresponding protocol; if they are different, the attribute value of the serial port is reset to the attribute value of the monitoring device read, and data communication is carried out with the monitoring device whose attribute value is currently read according to the corresponding protocol; 4) Repeat step 3) until all monitoring devices have completed data communication.
2. The communication method for mixing different serial port protocols according to claim 1, characterized in that: The monitoring device whose attribute value is read sends a response message to the serial port after receiving the protocol data sent by the serial port. If the gateway does not receive the response message within the set response time or response times, it reports to the monitoring device that the communication is interrupted.
3. The communication method for mixing different serial port protocols according to claim 2, characterized in that: The attributes corresponding to the attribute values of the monitoring device include protocol type, baud rate, parity check, start bit, data bit and stop bit.
4. The communication method for mixing different serial port protocols according to claim 3, characterized in that: Each of the protocol types is individually set with a general call time interval, a polling time interval and a timeout time.
5. The communication method for mixed connection of different serial port protocols according to claim 1 or 2, characterized in that: The number of monitoring devices mounted under the serial port is limited according to the maximum time given by the master station to upload all device data.
Citation Information
Patent Citations
Communication method for serial port and multiple running agreement stipulations
CN104283887A