Network access method and equipment based on half-duplex network, and communication system
By calculating the maximum number of access terminals in the semi -dual -work network and generating detection requests, the problem of low network access efficiency and poor network stability of new equipment, the automatic network configuration of the device is realized, and improved the efficiency of network access and network stability.
Patent Information
- Application Number
- CN202411361569.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-24
AI Technical Summary
In the prior art, new equipment based on half-duplex networks have low network access efficiency and poor communication network stability. Especially when new slaves enter the network, they need to manually configure communication addresses, resulting in low network access efficiency and possible address conflicts to affect the network. stability.
By obtaining the number of devices allowed to respond and the redundancy multiple, calculate the maximum number of access terminals, generate a detection request and send it to the slave device through the RS485 communication protocol, generate network access configuration information based on the detection response information of the slave device, and send it to the slave device device to achieve automatic network access configuration from the device.
It improves the network access efficiency of new devices in half-duplex networks, reduces network access conflicts and interference, enhances the stability and reliability of the communication network, and optimizes user experience and network resource management.
Smart Images

Figure CN119363502A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of transformer substations, and in particular to a network access method, equipment and communication system based on a half-duplex network. Background Art
[0002] In a half-duplex network, the communication scheme uses the host to poll the slave to achieve data communication, which usually has the following technical characteristics: (1) The host in the network uses a unicast channel to poll each slave in turn according to the communication address in the pre-configured slave table to achieve data interaction with each slave; only the slave that matches the communication address can receive the data request sent by the host and respond; (2) The slaves in the network have a fixed communication address. When the slave receives the data request from the host, it can parse the request and respond if the communication address in the request matches the local machine; otherwise, the data request should be discarded directly and no data reply should be made to avoid interfering with the data interaction of other devices in the network and affecting the stability of the entire network.
[0003] Therefore, when a new slave machine joins the network, if the slave machine's information has not been configured on the host side, the slave machine will never have the opportunity to interact with data and needs to manually configure the communication address in advance to complete the network access operation. In this operation method, the network access efficiency of the new slave machine and the host is low; in addition, in the communication network, the newly connected device may store the communication address of other networks, and the address may be the same as other network devices in this network, eventually leading to address conflicts, which will seriously affect the stability of the communication network. Summary of the invention
[0004] The present invention provides a network access method, device and communication system based on a half-duplex network, so as to solve the problems in the prior art that the network access efficiency of new devices based on a half-duplex network is low and the stability of the communication network is poor.
[0005] A first aspect of the present invention provides a network access method based on a half-duplex network, which is applied to a main device in a substation, wherein the main device is a communication device under the RS485 communication protocol, and the network access method includes: obtaining the number of devices allowed to respond and a redundancy multiple; calculating the maximum number of access terminals based on the number of devices and the redundancy multiple; generating a probe request based on the maximum number of access terminals and sending it to a slave device through the RS485 communication protocol; generating network access configuration information based on the probe response information returned by the slave device based on the probe request, and sending the network access configuration information to the slave device through the RS485 communication protocol, so that the slave device performs network access configuration based on the network access configuration information.
[0006] In a feasible implementation, before obtaining the number of devices allowed to respond and the redundancy multiple, it also includes: selecting a unicast address corresponding to a specific unicast channel, and defining the unicast address as a multicast address; configuring all devices in the target network based on the multicast address so that all devices can respond through the multicast channel corresponding to the multicast address, and the target network is a half-duplex network.
[0007] In a feasible implementation manner, generating a probe request based on the maximum number of access terminals and sending it to the slave device via the RS485 communication protocol also includes: generating a probe request based on the maximum number of access terminals and sending it to the slave device via the multicast channel under the RS485 communication protocol.
[0008] In a feasible implementation, the generation of network access configuration information based on the detection response information returned by the slave device based on the detection request includes: receiving the detection response information returned by the slave device based on the detection request and parsing it to obtain a unique device identifier of the slave device; configuring a unique communication address according to the device identifier to generate the network access configuration information of the slave device.
[0009] In a feasible implementation manner, after sending the network access configuration information to the slave device through the RS485 communication protocol, it also includes: sending an association request to the slave device through a unicast channel, the association request including the unique communication address and device identification of the slave device; receiving association response information returned by the slave device based on the association request to confirm that the association with the slave device is successful.
[0010] In a feasible implementation, after receiving the association response information returned by the slave device based on the association request, it also includes: communicating data with the slave device, determining whether it is necessary to resend the communication data to the slave device, and when the number of retransmissions reaches a preset number of retransmissions, confirming that no association has been performed with the slave device.
[0011] A second aspect of the present invention provides a network access method based on a half-duplex network, which is applied to a slave device in a substation, wherein the slave device is a communication device under the RS485 communication protocol, and the network access method includes: receiving a detection request in a target network, wherein the target network is a half-duplex network, and the detection request is a request carrying a maximum number of access terminals sent by a master device in the target network through a multicast channel under the RS485 communication protocol; generating a detection response message according to the maximum number of access terminals carried in the detection request and the device information of the slave device, and returning it to the master device through the RS485 communication protocol; receiving the network access configuration information returned by the master device based on the detection response information, and performing network access configuration based on the network access configuration information.
[0012] In a feasible implementation manner, the detection response information is generated according to the maximum number of access terminals carried in the detection request and the device information of the slave device, and is returned to the master device through the RS485 communication protocol, including: generating the detection response information according to the maximum number of access terminals carried in the detection request and the device information of the slave device; calculating the interval time for sending the detection response information; randomly generating a target integer, wherein the target integer is not greater than the maximum number of access terminals; and sending the detection response information to the master device through the RS485 communication protocol according to the target integer and the interval time.
[0013] In a feasible implementation manner, the receiving of network access configuration information returned by the master device based on the detection response message, and performing network access configuration based on the network access configuration information, includes: receiving the network access configuration information returned by the master device based on the detection response message through a multicast channel; obtaining a target device identifier from the network access configuration information; and performing network access configuration based on a target communication address corresponding to the target device identifier.
[0014] The third aspect of the present invention provides a network access method based on a half-duplex network, which is applied to a communication system between devices in a substation, wherein the communication system includes a master device and at least one slave device, and the master device and the at least one slave device communicate through an RS485 communication protocol, including: the master device generates a detection request and sends the detection request to the at least one slave device through the RS485 communication protocol, and the detection request is a request carrying a maximum number of access terminals sent by the master device in the target network through a multicast channel; the at least one slave device generates a detection response information based on the detection request, and returns it to the master device through the RS485 communication protocol; the master device generates a network access configuration information based on the detection response information, and sends it to the at least one slave device through the RS485 communication protocol; the at least one slave device performs a network access configuration based on the network access configuration information.
[0015] The fourth aspect of the present invention provides a master device, including: an acquisition module, used to obtain the number of devices allowed to respond and the redundancy multiple; a calculation module, used to calculate the maximum number of access terminals based on the number of devices and the redundancy multiple; a processing module, used to generate a detection request based on the maximum number of access terminals and send it to the slave device through the RS485 communication protocol; a first configuration module, used to generate network access configuration information according to the detection response information returned by the slave device based on the detection request, and send the network access configuration information to the slave device through the RS485 communication protocol, so that the slave device performs network access configuration based on the network access configuration information.
[0016] The fifth aspect of the present invention provides a slave device, comprising: a receiving module, used to receive a detection request in a target network, wherein the target network is a half-duplex network, and the detection request is a request carrying the maximum number of access terminals sent by the master device in the target network through a multicast channel; a generating module, used to generate a detection response message according to the maximum number of access terminals carried in the detection request and the device information of the slave device, and return it to the master device through the RS485 communication protocol; a second configuration module, used to receive the network access configuration information returned by the master device based on the detection response message, and perform network access configuration based on the network access configuration information.
[0017] The sixth aspect of the present invention provides a communication system, comprising: a master device, used to generate a detection request and send the detection request to the at least one slave device through the RS485 communication protocol, generate network access configuration information according to the detection response information returned by the at least one slave device based on the detection request and send it to the at least one slave device through the RS485 communication protocol; at least one slave device, used to generate detection response information according to the detection request sent by the master device and send it to the master device through the RS485 communication protocol, receive the network access configuration information returned by the master device based on the detection response information, and perform network access configuration based on the network access configuration information.
[0018] The seventh aspect of the present invention provides an electronic device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the electronic device executes the above-mentioned network access method.
[0019] An eighth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned network access method.
[0020] In the technical solution provided by the present invention, the number of devices allowed to respond and the redundancy multiple are obtained; the maximum number of access terminals is calculated based on the number of devices and the redundancy multiple; a probe request is generated based on the maximum number of access terminals and sent to the slave device through the RS485 communication protocol; network access configuration information is generated based on the probe response information returned by the slave device based on the probe request, and the network access configuration information is sent to the slave device through the RS485 communication protocol, so that the slave device performs network access configuration based on the network access configuration information. In the embodiment of the present invention, by pre-planning network resources and dynamically generating and sending network access configuration information using an intelligent detection mechanism, network access conflicts and interferences are effectively reduced, the network access efficiency of new devices in a half-duplex network is improved, the stability and reliability of the communication network are enhanced, and the user experience and network resource management are optimized. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A schematic diagram of an embodiment of a network access method based on a half-duplex network in an embodiment of the present invention;
[0022] Figure 2 It is a schematic diagram of another embodiment of the network access method based on a half-duplex network in an embodiment of the present invention;
[0023] Figure 3 It is a schematic diagram of another embodiment of the network access method based on a half-duplex network in an embodiment of the present invention;
[0024] Figure 4 It is a schematic diagram of another embodiment of the network access method based on a half-duplex network in an embodiment of the present invention;
[0025] Figure 5 It is a schematic diagram of another embodiment of the network access method based on a half-duplex network in an embodiment of the present invention;
[0026] Figure 6 A schematic diagram of an embodiment of a master device in an embodiment of the present invention;
[0027] Figure 7 A schematic diagram of an embodiment of a slave device in an embodiment of the present invention;
[0028] Figure 8 A schematic diagram of an embodiment of a communication system in an embodiment of the present invention;
[0029] Fig. 9 FIG. 1 is a schematic diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The embodiments of the present invention provide a network access method, device and communication system based on a half-duplex network, which improve the network access efficiency of new devices in the half-duplex network and enhance the stability and reliability of the communication network.
[0031] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] It is understandable that the execution subject of the present invention may be a terminal device or a communication system, which is not specifically limited herein. The embodiment of the present invention is described by taking a server as the execution subject as an example.
[0033] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of a network access method based on a half-duplex network in an embodiment of the present invention includes:
[0034] 101. Obtain the number of devices allowed to respond and the redundancy multiple;
[0035] This embodiment is applied to a main device in a substation. The main device is a communication device under the RS485 communication protocol. The main device is a main control system or a gateway.
[0036] The master device obtains the number of devices allowed to respond and the redundancy multiple, wherein the number of devices allowed to respond can be a constant or determined according to the number of devices accessing the target network. The number of devices allowed to respond decreases as the number of devices accessing increases. For example, when the upper limit of the number of devices allowed to access the target network is 30 and 20 devices are currently connected, the number of devices allowed to respond is X, then X=30-20=10, so the number of devices allowed to respond is 10. The redundancy multiple represents the margin designed to accommodate more devices accessing at the same time. The redundancy multiple can be dynamically adjusted according to the actual operation of the network and the access requirements of the devices. For example, when the network load is low, the value of the redundancy multiple can be appropriately increased to improve the access speed and the fault tolerance of the system; and when the network load is high, the value of the redundancy multiple can be reduced to reduce the network load and the possibility of conflict.
[0037] 102. Calculate the maximum number of access terminals based on the number of devices and the redundancy multiple;
[0038] The calculation formula for the maximum number of access terminals is: maximum number of access terminals = number of devices × redundancy multiple.
[0039] 103. Generate a probe request based on the maximum number of access terminals and send it to the slave device through the RS485 communication protocol;
[0040] The probe request is encoded in the format specified by the network protocol to ensure that it can be correctly parsed by the slave device. Characteristic data packet structures, field definitions and encoding methods can be used, such as binary, hexadecimal and ASCII codes. At the same time, in order to improve transmission efficiency and reduce conflicts, the probe request may also contain some control fields, such as serial numbers, timestamps or random numbers, which are used to identify different access attempts and avoid repeated processing. After the master device generates a probe request, it sends the probe request to all slave devices in the target network through the multicast channel under the RS485 communication protocol. The slave devices are communication devices in the substation, and the slave devices are sensors, controllers, etc.
[0041] 104. Generate network access configuration information according to the detection response information returned by the slave device based on the detection request, and send the network access configuration information to the slave device through the RS485 communication protocol, so that the slave device performs network access configuration based on the network access configuration information.
[0042] After the master device sends a probe request, there is a listening time, which is the time to wait for all devices to return the probe response information. The master device obtains the interval time and calculates the listening time based on the interval time, the number of devices and the redundancy multiple. The calculation formula is: Listening time = interval time × number of devices × redundancy multiple. For example, when the interval time is 7ms, the number of devices is 30, and the redundancy multiple is 4, the listening time is 7×30×4=840ms.
[0043] The master device receives and parses the probe response information returned by the slave device. The probe response information is used to identify the corresponding device, and usually includes the slave device's identity (such as device ID), signal strength, response time, etc., as well as the slave device's confirmation of the probe request and possible additional requests.
[0044] The determined network parameters and configuration information are encapsulated into a specific data packet format. This data packet needs to contain enough information so that the slave device can parse and apply these configurations, and send the data packet to the slave device through the RS485 communication protocol.
[0045] After sending the data packet, the master device waits for confirmation feedback from the slave device. After receiving the network access configuration information, the slave device will parse and try to apply the configuration in the network access configuration information. If the configuration is successful, the slave device will send a configuration success message to the master device; if the configuration fails, it will send an error report or request to resend the configuration information. When the master device receives the configuration success message sent by the slave device, it confirms that the slave device has completed the network access operation.
[0046] In an embodiment of the present invention, by obtaining the number of devices allowed to respond and the redundancy multiple; calculating the maximum number of access terminals based on the number of devices and the redundancy multiple; generating a probe request based on the maximum number of access terminals and sending it to a slave device; generating network access configuration information based on the probe response information returned by the slave device based on the probe request, and sending the network access configuration information to the slave device, so that the slave device performs network access configuration based on the network access configuration information, the network access efficiency of the slave device in a half-duplex network is improved, the stability and reliability of the communication network are enhanced, and the user experience and network resource management are optimized.
[0047] See also Figure 2 Another embodiment of the network access method based on a half-duplex network in the embodiment of the present invention includes:
[0048] 201. Select a unicast address corresponding to a specific unicast channel, and define the unicast address as a multicast address;
[0049] The master device uses a network scanning tool or queries the network management database to identify the unicast address corresponding to the unused unicast channel in the target network, obtains the configuration file responsible for network configuration, searches for information related to IP address allocation from the configuration file, deletes the selected unicast address from the information related to IP address allocation, and adds the information corresponding to the unicast address in the multicast address configuration part, thereby defining the unicast address as a multicast address. For example, when there is a communication address with a length of 1 byte and a value of 0x00 to 0xFF, it can be agreed that the unicast address 0xFF is a multicast address, the channel corresponding to the multicast address is a multicast channel, and other unicast channels are not changed.
[0050] 202. Configure all devices in the target network based on the multicast address so that all devices can respond through the multicast channel corresponding to the multicast address, and the target network is a half-duplex network;
[0051] The master device sends a specific multicast group membership management message through the multicast channel to invite the slave device to join the multicast group and listen to the multicast address. The slave device configures the network interface based on the received multicast group membership management message and enables the multicast receiving mode to receive the data packet sent by the master device to the multicast address. After completing the configuration, the master device sends a test data packet to the slave device to detect whether all devices in the target network can correctly receive and parse the test data packet. In addition, the selection of the multicast address, the configuration process and the test results are recorded in the document for network maintenance.
[0052] 203. Obtain the number of devices allowed to respond and the redundancy multiple;
[0053] 204. Calculate the maximum number of access terminals according to the number of devices and the redundancy multiple;
[0054] 205. Generate a probe request based on the maximum number of access terminals and send it to the slave device through a multicast channel under the RS485 communication protocol;
[0055] According to the requirements of the multicast protocol, a probe request packet containing a probe request is constructed. The probe request packet may also include a multicast address, a source address, a probe type, and a timestamp, etc. The probe request packet is encapsulated into a format that can be transmitted in the target network, and is prepared to be sent through a multicast channel under the RS485 communication protocol. The multicast address to be sent is selected, and the encapsulated probe request packet is sent to the multicast channel corresponding to the multicast address. After the sending is completed, all slave devices that have joined the multicast group can receive the probe request packet.
[0056] 206. Generate network access configuration information according to the detection response information returned by the slave device based on the detection request, and send the network access configuration information to the slave device through the RS485 communication protocol, so that the slave device performs network access configuration based on the network access configuration information;
[0057] Receive and parse the detection response information returned by the slave device based on the detection request to obtain a unique device identification of the slave device; configure a unique communication address according to the device identification to generate network access configuration information of the slave device.
[0058] The master device can query the preset address database, which contains the assigned communication addresses. Each communication address corresponds to a unique device identifier. Therefore, after obtaining the device identifier of the slave device, it can be queried in the communication address database whether there is a corresponding device identifier. If there is a corresponding device identifier, the corresponding detection response information will be deleted. If there is no corresponding device identifier, the corresponding communication address is generated based on the device identifier, and the network access configuration information is generated. The communication address and the corresponding device identifier are stored in the address database. The communication address assigned to the device identifier is unique.
[0059] The network access configuration information is encapsulated into a network access configuration information data packet, and the encapsulated network access configuration information data packet is sent to the slave device through the multicast channel under the RS485 communication protocol. After receiving the network access configuration information data packet, the slave device parses it and obtains the network access configuration information, and identifies and applies the configuration information related to itself according to its own device identification.
[0060] 207. Send an association request to the slave device through a unicast channel, where the association request includes a unique communication address and device identifier of the slave device;
[0061] The master device monitors the connection status of the slave device, sends status update information to the slave device, and receives status response information returned by the slave device based on the status update information. The status response information includes the current connection status of the slave device and the master device. When the connection status of the slave device is determined to be configured and not associated based on the status response information, an association request containing the unique communication address and device identification of the slave device is sent to the slave device through the unicast channel via the RS485 communication protocol.
[0062] 208. Receive association response information returned by the slave device based on the association request to confirm that the association with the slave device is successful;
[0063] After sending the association request, the master device enters a waiting state until it receives the association response information sent by the slave device. The association response information includes at least a status code, which is used to indicate the result of the association operation. When the status code indicates that the association is successful, the master device records the information of the successful association to confirm that the association has been established with the slave device. When the status code indicates that the association has failed, the master device can take corresponding processing measures according to the error code in the association response information.
[0064] 209. Communicate data with the slave device, determine whether it is necessary to resend the communication data to the slave device, and when the number of retransmissions reaches a preset number of retransmissions, confirm that there is no association with the slave device.
[0065] Send communication data to the slave device and determine whether the slave device responds within a preset time; if the slave device does not respond within the preset time, send the communication data to the slave device again; when the number of retransmissions reaches the preset number of retransmissions, confirm that there is no association with the slave device.
[0066] During data communication with the slave device, the master device will closely monitor the response of the slave device. If the slave device fails to respond to the communication data within a reasonable time, the master device will evaluate whether the data needs to be resent to ensure the reliability of information transmission. The retransmission mechanism will be executed according to the preset strategy. When the number of retransmissions reaches the preset upper limit of the number of retransmissions, the master device will determine that there is a problem with the current communication link with the slave device, thereby confirming that the association between the two has not been effectively maintained or established.
[0067] In the embodiment of the present invention, the configuration times are reduced by multicast address configuration, the detection request and response mechanism is used to accelerate the network access process, and the association process is simplified to improve the network access efficiency of the slave device in the half-duplex network. At the same time, the redundancy design, retransmission mechanism, unique identification and centralized management methods are used to effectively enhance the stability and reliability of the communication network.
[0068] See also Figure 3 Another embodiment of the network access method based on a half-duplex network in the embodiment of the present invention includes:
[0069] 301. Receive a detection request in a target network, wherein the target network is a half-duplex network, and the detection request is a request carrying a maximum number of access terminals sent by a master device in the target network through a multicast channel;
[0070] This embodiment is applied to a slave device in a substation. The slave device is a communication device under the RS485 communication protocol. The slave device is a sensor, a controller, and the like.
[0071] 302. Generate a detection response message according to the maximum number of access terminals carried in the detection request and the device information of the slave device, and return it to the master device through the RS485 communication protocol;
[0072] The slave device evaluates whether the target network still has sufficient capacity to accommodate new devices based on the maximum number of access terminals. When the maximum number of access terminals is a constant, the slave device obtains statistical information regularly sent by the master device through the multicast channel under the RS485 communication protocol. The statistical information includes the number of devices in the target network. The maximum number of access terminals is compared with the number of devices in the target network. If the maximum number of access terminals is greater than the number of devices in the target network, it is determined that the target network has sufficient capacity to accommodate new devices. If the maximum number of access terminals is not greater than the number of devices in the target network, it is determined that the capacity of the target network cannot accommodate new devices. When the maximum number of access terminals is determined based on the number of devices accessing the target network, when the maximum number of access terminals is greater than zero, it is determined that the target network has sufficient capacity to accommodate new devices. When the maximum number of access terminals is zero, the capacity of the target network cannot accommodate new devices.
[0073] When the target network has sufficient capacity to accommodate a new device, the slave device generates a probe response message based on the device information, where the device information includes a device ID, a serial number, etc., and is used to indicate a unique device.
[0074] 303. Receive network access configuration information returned by the master device based on the detection response information, and perform network access configuration based on the network access configuration information.
[0075] The slave device verifies the integrity and authenticity of the received network configuration information. The slave device can check whether the received message conforms to the predetermined format specification, including checking the length of the message, the presence of fields, and the order of fields, etc. It can also check whether the message format is correct. When the message format is incorrect, it refuses to process the message or returns an error signal to the master device so that the master device resends the network configuration information. In addition, the timestamp can also be detected. The slave device will check the timestamp to ensure that the message has not expired and is sent within a reasonable time range. If the timestamp indicates that the time when the message was sent is too different from the current time, the slave device determines that the authenticity of the message is low.
[0076] When it is detected that there is no problem with the integrity and authenticity of the network access configuration information, the slave device performs network access configuration based on the network access configuration information, and performs network connection detection after completing the configuration to ensure successful communication with the master device.
[0077] In the embodiment of the present invention, through a reasonable detection request and response mechanism, and a network access configuration process based on response information, the network access efficiency is effectively improved, the network resource allocation is optimized, and the network security and reliability are enhanced.
[0078] See also Figure 4 Another embodiment of the network access method based on a half-duplex network in the embodiment of the present invention includes:
[0079] 401. Receive a detection request in a target network, wherein the target network is a half-duplex network, and the detection request is a request carrying a maximum number of access terminals sent by a master device in the target network through a multicast channel under an RS485 communication protocol;
[0080] 402. Generate a probe response message according to the maximum number of access terminals carried in the probe request and the device information of the slave device;
[0081] 403. Calculate the interval time for sending the probe response information, and randomly generate a target integer, where the target integer is not greater than the maximum number of access terminals;
[0082] The start bit length, data bit length, stop bit length, total length and baud rate of the response frame message are obtained from the device; based on the start bit length, data bit length, stop bit length, total length and baud rate, the interval time for sending the detection response information is calculated.
[0083] The calculation formula of interval time is: interval time = (start bit length + data bit length + stop bit length) × (response frame length) ÷ baud rate. For example, if the baud rate is 19200 bit / s, the values of start bit length, data bit length, and stop bit length are 1 bit, 8 bits, and 1 bit respectively, and the response frame length is 13, the calculated interval time is 6.77ms.
[0084] 404. Send the detection response information to the main device through the RS485 communication protocol according to the target integer and the interval time;
[0085] If the target integer is a, the slave device will return the probe response information to the master device after a interval time to reduce the risk of sending data at the same time as other devices, thereby reducing the occurrence of conflicts and ensuring smooth network communication.
[0086] 405. Receive network access configuration information returned by the master device based on the detection response information, and perform network access configuration based on the network access configuration information.
[0087] The slave device receives the network access configuration information returned by the master device based on the detection response message through the multicast channel; obtains the target device identifier from the network access configuration information; and performs network access configuration based on the target communication address corresponding to the target device identifier.
[0088] The slave device monitors the data on the multicast channel. When it detects the network access configuration information sent by the master device, it receives and parses the network access configuration information. During the parsing process, the slave device pays special attention to the fields related to itself, especially the target device identification. The target device identification can be the device's MAC address, serial number, pre-assigned ID or any other unique identifier, which is used to uniquely identify the slave device in the network. In addition to the target device identification, the network access configuration information also includes the target communication address corresponding to the target device identification. The slave device obtains the target communication address to configure its own communication parameters.
[0089] In the embodiment of the present invention, by introducing the interval time for sending the probe response information and the randomly generated target integer, the efficiency, security and reliability of network access are further improved.
[0090] See also Figure 5 Another embodiment of the network access method based on a half-duplex network in the embodiment of the present invention includes:
[0091] 501. The master device generates a detection request and sends the detection request to at least one slave device through the RS485 communication protocol. The detection request is a request carrying the maximum number of access terminals sent by the master device in the target network through a multicast channel;
[0092] This embodiment is applied to a communication system between devices in a substation. The communication system includes a master device and at least one slave device. The master device and at least one slave device communicate through the RS485 communication protocol. The master device is a main control system or a gateway, and the slave device is a sensor, a controller, etc.
[0093] The master device is initialized after being powered on. The initialization process is to detect the device and continuously detect the preset number of detections. The number of detections is set according to the actual situation. For example, the number of detections is set to 5 times. No data is transmitted during the detection process. When the number of detections is reached, it is determined that the initialization process is completed.
[0094] The master device obtains the status information of at least one slave device, and based on the status information, sends the interactive data to the configured and associated slave devices in sequence through the RS485 communication protocol through a unicast channel, and determines whether the detection cycle is reached. When the preset detection cycle is not reached, the data interaction process is looped. When the detection cycle is reached, the master device uses a multicast channel to send a detection request to at least one slave device.
[0095] 502. At least one slave device generates a detection response message based on the detection request, and returns it to the master device through the RS485 communication protocol;
[0096] At least one slave device receives the detection request, and each slave device obtains corresponding status information. When the status information of the slave device is configured and not associated or configured and associated, the slave device does not change its status, confirms that it is in the target network, and does not respond to the detection request. When the status information of the slave device is not configured, a detection response message is generated and sent to the master device through the RS485 communication protocol.
[0097] 503. The master device generates network access configuration information based on the detection response information, and sends it to at least one slave device through the RS485 communication protocol;
[0098] The network access configuration information at least includes a device identification and a communication address of a slave device whose status information is unconfigured. The master device sends the network access configuration information to at least one slave device through the RS485 communication protocol using a multicast channel.
[0099] 504. At least one slave device performs network access configuration based on the network access configuration information.
[0100] After receiving the network access configuration information, each slave device obtains corresponding configuration information from the network access configuration information according to its own device identification, performs network access configuration according to the corresponding configuration information, and changes its own state information to configured and unassociated.
[0101] Based on the communication addresses of all slave devices, the host uses a unicast channel to send association requests to the slave devices whose status information is configured and unassociated in sequence, and waits for association responses. The association request includes the unique communication address and device identification of the slave device. After receiving the association request, the slave device determines whether to make an association response. The slave device identifies the communication address and device identification in the association request and matches them with its own communication address and device identification. If the communication address does not match, it does not respond to the association request and does not change its own status information; if the communication address matches and the device identification does not match, it changes its own status information to unconfigured and unassociated, and does not respond to the association request; if the communication address matches and the device identification also matches, an association response message is generated and returned to the master device, and the status information is changed to configured and associated; after receiving the association response message, the master device records the configured and associated status of the slave device and confirms that the association with the slave device is successful; if the master device does not receive the association response message from the slave device, the unconfigured and unassociated status of the slave device is recorded.
[0102] In this embodiment, the slave device saves the communication address in a non-volatile memory. When the device is powered on again, it can directly enter the configured and unassociated state because it already has the communication address. In addition, if the slave device in the configured and unassociated state and the configured and associated state does not receive the target information of the master device on the unicast channel within the preset slave device survival time, it confirms that it has entered the unconfigured and unassociated state. The slave device survival time is related to the time taken by the host to poll all slave devices, which is generally 3 to 5 times the time taken to poll all slave devices. A default value can be set, for example, the default value is set to 5 minutes.
[0103] In the embodiment of the present invention, the efficiency of new device access to the network is improved, the allocation of network resources is optimized, and the security and reliability of the network are enhanced through the process of the master device sending a detection request through a multicast channel, the slave device responding, the master device allocating network access configuration information, and the slave device network access configuration.
[0104] The above describes the network access method based on the half-duplex network in the embodiment of the present invention. The following describes the device end in the embodiment of the present invention. Figure 6 In one embodiment of the present invention, a master device includes:
[0105] An acquisition module 601 is used to acquire the number of devices allowed to respond and the redundancy multiple;
[0106] A calculation module 602 is used to calculate the maximum number of access terminals according to the number of devices and the redundancy multiple;
[0107] Processing module 603, used to generate a detection request based on the maximum number of access terminals and send it to the slave device through the RS485 communication protocol;
[0108] The first configuration module 604 is used to generate network access configuration information according to the detection response information returned by the slave device based on the detection request, and send the network access configuration information to the slave device through the RS485 communication protocol, so that the slave device performs network access configuration based on the network access configuration information.
[0109] In an embodiment of the present invention, by obtaining the number of devices allowed to respond and the redundancy multiple; calculating the maximum number of access terminals based on the number of devices and the redundancy multiple; generating a probe request based on the maximum number of access terminals and sending it to a slave device; generating network access configuration information based on the probe response information returned by the slave device based on the probe request, and sending the network access configuration information to the slave device, so that the slave device performs network access configuration based on the network access configuration information, the network access efficiency of the slave device in a half-duplex network is improved, the stability and reliability of the communication network are enhanced, and the user experience and network resource management are optimized.
[0110] See also Figure 7 , an embodiment of a slave device in an embodiment of the present invention includes:
[0111] The receiving module 701 is used to receive a detection request in a target network, wherein the target network is a half-duplex network, and the detection request is a request carrying a maximum number of access terminals sent by a master device in the target network through a multicast channel;
[0112] A generating module 702 is used to generate a detection response message according to the maximum number of access terminals carried in the detection request and the device information of the slave device, and return it to the master device through the RS485 communication protocol;
[0113] The second configuration module 703 is used to receive the network access configuration information returned by the master device based on the detection response message, and perform network access configuration based on the network access configuration information.
[0114] In the embodiment of the present invention, through a reasonable detection request and response mechanism, and a network access configuration process based on response information, the network access efficiency is effectively improved, the network resource allocation is optimized, and the network security and reliability are enhanced.
[0115] See also Figure 8 , an embodiment of the communication system in the embodiment of the present invention includes:
[0116] The master device 801 is used to generate a detection request and send the detection request to at least one slave device through the RS485 communication protocol, generate network access configuration information according to the detection response information returned by at least one slave device based on the detection request and send it to at least one slave device through the RS485 communication protocol;
[0117] At least one slave device 802 is used to generate a detection response message according to the detection request sent by the master device and send it to the master device through the RS485 communication protocol, receive the network access configuration information returned by the master device based on the detection response message, and perform network access configuration based on the network access configuration information.
[0118] In the embodiment of the present invention, the efficiency of new device access to the network is improved, the allocation of network resources is optimized, and the security and reliability of the network are enhanced through the process of the master device sending a detection request based on a multicast channel, the slave device responding, the master device allocating network access configuration information, and the slave device network access configuration.
[0119] above Figures 6 to 8 The device or system in the embodiment of the present invention is described in detail. The electronic device in the embodiment of the present invention is described in detail from the perspective of hardware processing.
[0120] See also Fig. 9 As shown, the electronic device includes a processor 900 and a memory 901 , wherein the memory 901 stores machine executable instructions that can be executed by the processor 900 , and the processor 900 executes the machine executable instructions to implement the above-mentioned network access method based on a half-duplex network.
[0121] Further, Fig. 9 The electronic device shown further includes a bus 902 and a communication interface 903 , and the processor 900 , the communication interface 903 and the memory 901 are connected via the bus 902 .
[0122] Among them, the memory 901 may include a high-speed random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (non-volatile memory), for example, at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 903 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 902 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0123] The processor 900 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 900. The above processor 900 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 901 , and the processor 900 reads the information in the memory 901 and completes the method steps of the above-mentioned embodiment in combination with its hardware.
[0124] The present invention also provides an electronic device, wherein the computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the steps of the network access method based on a half-duplex network in the above-mentioned embodiments.
[0125] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the network access method based on a half-duplex network.
[0126] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0127] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0128] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A network access method based on a half-duplex network, applied to a main device in a substation, wherein the main device is a communication device under the RS485 communication protocol, characterized in that: The network access method includes: Get the number of devices allowed to respond and the redundancy multiple; Calculate the maximum number of access terminals according to the number of devices and the redundancy multiple; Generate a probe request based on the maximum number of access terminals and send it to the slave device via the RS485 communication protocol; Generate network access configuration information according to the detection response information returned by the slave device based on the detection request, and send the network access configuration information to the slave device through the RS485 communication protocol, so that the slave device performs network access configuration based on the network access configuration information.
2. The network access method according to claim 1, characterized in that: Before obtaining the number of devices allowed to respond and the redundancy multiple, it also includes: Selecting a unicast address corresponding to a specific unicast channel, and defining the unicast address as a multicast address; All devices in the target network are configured based on the multicast address so that all devices can respond through the multicast channel corresponding to the multicast address, and the target network is a half-duplex network.
3. The network access method according to claim 2, characterized in that: The generating of the detection request based on the maximum number of access terminals and sending it to the slave device through the RS485 communication protocol also includes: A probe request is generated based on the maximum number of access terminals and sent to the slave device through the multicast channel under the RS485 communication protocol.
4. The network access method according to claim 1, characterized in that: The generating network access configuration information according to the detection response information returned by the slave device based on the detection request includes: Receiving and parsing the detection response information returned by the slave device based on the detection request to obtain a unique device identifier of the slave device; A unique communication address is configured according to the device identification to generate network access configuration information for the slave device.
5. The network access method according to claim 1, characterized in that: After sending the network access configuration information to the slave device through the RS485 communication protocol, the method further includes: Sending an association request to the slave device through a unicast channel, the association request including a unique communication address and a device identifier of the slave device; Receive association response information returned by the slave device based on the association request to confirm that the association with the slave device is successful.
6. The network access method according to claim 5, characterized in that: After receiving the association response information returned by the slave device based on the association request, the method further includes: Data communication is performed with the slave device, and it is determined whether communication data needs to be resent to the slave device, and when the number of retransmissions reaches a preset number of retransmissions, it is confirmed that no association is performed with the slave device.
7. A network access method based on a half-duplex network, applied to a slave device in a substation, wherein the slave device is a communication device under the RS485 communication protocol, characterized in that: The network access method includes: Receiving a probe request in a target network, wherein the target network is a half-duplex network, and the probe request is a request carrying a maximum number of access terminals and sent by a master device in the target network through a multicast channel under the RS485 communication protocol; Generate a detection response message according to the maximum number of access terminals carried in the detection request and the device information of the slave device, and return it to the master device through the RS485 communication protocol; Receive network access configuration information returned by the master device based on the detection response information, and perform network access configuration based on the network access configuration information.
8. The network access method according to claim 7, characterized in that: The generating of the detection response information according to the maximum number of access terminals carried in the detection request and the device information of the slave device, and returning the detection response information to the master device through the RS485 communication protocol, comprises: Generate a probe response message according to the maximum number of access terminals carried in the probe request and the device information of the slave device; Calculate the interval time of sending the probe response information, and randomly generate a target integer, wherein the target integer is not greater than the maximum number of access terminals; The detection response information is sent to the main device through the RS485 communication protocol according to the target integer and the interval time.
9. The network access method according to claim 8, characterized in that: The receiving the network access configuration information returned by the master device based on the detection response message, and performing network access configuration based on the network access configuration information, includes: Receiving, through a multicast channel, network access configuration information returned by the master device based on the detection response message; Obtaining a target device identifier from the network access configuration information; And perform network access configuration based on the target communication address corresponding to the target device identifier.
10. A network access method based on a half-duplex network, applied to a communication system between devices in a substation, wherein the communication system comprises a master device and at least one slave device, wherein the master device and the at least one slave device communicate via an RS485 communication protocol, and the network access method comprises: The master device generates a probe request and sends the probe request to the at least one slave device through the RS485 communication protocol, wherein the probe request is a request carrying the maximum number of access terminals sent by the master device in the target network through a multicast channel; The at least one slave device generates a detection response message based on the detection request, and returns it to the master device through the RS485 communication protocol; The master device generates network access configuration information based on the detection response information, and sends it to the at least one slave device through the RS485 communication protocol; The at least one slave device performs network access configuration based on the network access configuration information.
11. A master device, characterized in that: The main device comprises: An acquisition module is used to obtain the number of devices allowed to respond and the redundancy multiple; A calculation module, used for calculating the maximum number of access terminals according to the number of devices and the redundancy multiple; A processing module, configured to generate a detection request based on the maximum number of access terminals and send the detection request to the slave device via an RS485 communication protocol; The configuration module is used to generate network access configuration information according to the detection response information returned by the slave device based on the detection request, and send the network access configuration information to the slave device through the RS485 communication protocol, so that the slave device performs network access configuration based on the network access configuration information.
12. A slave device, characterized in that: The slave device comprises: A receiving module, configured to receive a detection request in a target network, wherein the target network is a half-duplex network, and the detection request is a request carrying a maximum number of access terminals sent by a master device in the target network through a multicast channel; A generating module, configured to generate a detection response message according to the maximum number of access terminals carried in the detection request and the device information of the slave device, and return the message to the master device through the RS485 communication protocol; The second configuration module is used to receive the network access configuration information returned by the master device based on the detection response message, and perform network access configuration based on the network access configuration information.
13. A communication system between devices, characterized in that: The communication system comprises: A master device, configured to generate a probe request and send the probe request to the at least one slave device through an RS485 communication protocol, generate network access configuration information according to the probe response information returned by the at least one slave device based on the probe request, and send the network access configuration information to the at least one slave device through the RS485 communication protocol; At least one slave device is used to generate a detection response message according to the detection request sent by the master device and send it to the master device through the RS485 communication protocol, receive the network access configuration information returned by the master device based on the detection response message, and perform network access configuration based on the network access configuration information.
14. An electronic device, characterized in that: The electronic device comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory so that the electronic device executes the network access method as described in any one of claims 1-10.
15. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the network access method according to any one of claims 1 to 10 is implemented.