A quick meter searching and address automatic allocation method and system based on optical bus
Patent Information
- Application Number
- CN202610870861.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-16
- Publication Date
- 2026-11-03
AI Technical Summary
In existing industrial automation systems, the table search and address allocation process based on RS485 bus is time-consuming, prone to conflicts, has poor anti-interference capability in complex electromagnetic environments, and involves complex wiring, which affects system efficiency and reliability.
A serial cascaded structure based on an optical bus is adopted. The master node controls the enable state of the optical transmission module of the slave node to build a unidirectional conduction link, realize fast table search and automatic address allocation, and avoid bus contention and electrical signal interference.
It significantly shortens system initialization time, improves table search and address allocation efficiency, reduces hardware costs, enhances electromagnetic interference resistance, and improves system reliability and scalability.
Smart Images

Figure CN123035390A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial automation technology, specifically to a fast table search and automatic address allocation method and system based on optical bus. Background Technology
[0002] In multi-node instrument systems such as industrial automation and smart meter reading, reliable and efficient bus communication is fundamental for centralized data acquisition and device management. Currently, such systems widely adopt an electrical bus communication scheme based on the RS485 standard. In this scheme, all instruments (slave nodes) are connected in parallel to the same twisted pair, and the master node (such as a gateway or concentrator) communicates via broadcast or polling. However, this traditional bus architecture has gradually revealed several inherent defects in actual deployment and operation. First, when devices come online or the network is reconfigured, the master node needs to search and assign addresses to all slave nodes on the bus. Since the RS485 bus is a shared medium, when the number of slave nodes is large, whether using sequential polling or a contention mechanism relying on random delay responses from slave nodes, the search process is time-consuming and inefficient. Furthermore, conflicts are prone to occur during address allocation, leading to allocation failures or requiring complex retry algorithms, further affecting the system initialization speed. Second, this scheme relies on electrical signal transmission, which is susceptible to interference in complex electromagnetic environments, affecting communication stability. Furthermore, each instrument requires a dedicated communication cable, which not only increases wiring complexity and cost but also poses challenges to the sealing design of the instrument housing, making it unsuitable for use in harsh environments or applications where aesthetics are important. Therefore, there is an urgent need for a communication solution that can avoid bus contention, improve table search and address allocation efficiency, simplify wiring, and enhance anti-interference capabilities. Summary of the Invention
[0003] To avoid bus contention, improve the efficiency of table search and address allocation, simplify wiring, and enhance anti-interference capabilities, this invention proposes a fast table search and automatic address allocation method based on an optical bus. The optical bus consists of a serially cascaded master node and multiple slave nodes. Each slave node is equipped with a left-side optical receiving module and a right-side optical transmitting module, and the enable state of the right-side optical transmitting module is controllable. The method includes the following steps:
[0004] S1: The master node is based on the serial cascade structure of the optical bus. By enabling only the right optical transmission modules of the currently queried slave node and all its upstream slave nodes in the order of physical connection, the optical bus logic is constructed into a unidirectional conduction link extending from the master node to the currently queried slave node during the table search phase.
[0005] S2: In a unidirectional connection link, the master node queries each slave node one by one in the order of physical connection and receives the identification information returned by each slave node;
[0006] S3: The master node generates a unique communication address for each slave node based on the physical connection order and the identification information of each slave node;
[0007] S4: The master node, in the order of physical connection, enables only the right optical transmission modules of the slave node to be assigned the address and all its upstream slave nodes in turn. During the address allocation phase, the unidirectional conduction link is reconstructed, and the communication address is sent to the corresponding slave node one by one along the link in sequence.
[0008] Furthermore, in step S2, the step-by-step query specifically refers to:
[0009] The master node sends an inquiry command carrying the target location information to the currently constructed unidirectional guiding link;
[0010] The currently queried node responds by comparing the target location information with its own position in the physical connection order.
[0011] Furthermore, in step S3, generating a unique communication address for each slave node specifically involves:
[0012] The master node assigns addresses to each slave node sequentially according to the physical connection order of the slave nodes confirmed during the table search phase, following preset rules. These preset rules include assigning a starting address to the first slave node that is queried, with the addresses of subsequent slave nodes increasing sequentially.
[0013] Furthermore, during the execution of step S2 or S4, if the master node does not receive a response from the target slave node within a preset time, it determines and records that the slave node has a communication anomaly.
[0014] If the slave node's enable state is normal, skip reading the slave node's identification information / the currently allocated incrementing address, and continue to execute the corresponding process for the next slave node;
[0015] If the slave node's enable state control fails, terminate the task.
[0016] Furthermore, following step S4, the following steps are also included:
[0017] S5: After address allocation is completed, the master node enables the right-side optical transmission modules of all slave nodes, so that the optical bus forms a complete communication link from the master node to the last slave node, which is used for subsequent batch data reading or broadcast communication.
[0018] It also includes a fast table lookup and automatic address allocation system based on an optical bus, comprising:
[0019] One master node and several slave nodes, wherein the master node and all slave nodes are serially cascaded via an optical bus;
[0020] The master node includes a first optical transmitting module, a first optical receiving module, and a main control unit. The main control unit is used to execute the fast table search and automatic address allocation method and generate control commands.
[0021] The slave node includes a left optical receiving module, a right optical transmitting module, and a microcontroller unit. The microcontroller unit is electrically connected to the left optical receiving module and the right optical transmitting module, and is used to receive control commands from the master node and control the enable state of its right optical transmitting module.
[0022] Furthermore, the master node is a 4G communication gateway, the slave node is an instrument, and the master node and the slave node are installed side by side through a standard card slot to align the optical path of the optical bus.
[0023] Furthermore, the microcontroller unit is used for:
[0024] When it is the currently queried slave node or the currently waiting address slave node, it controls the right optical emission module of its own to be enabled.
[0025] When the enable command is received from the master node, the optical transmitter module on its right side is enabled.
[0026] When a de-enable command is received from the master node, or when the target node is not currently being targeted and no enable command has been received, the right-side optical emission module is controlled to be in a de-enable state.
[0027] Compared with the prior art, the present invention has at least the following beneficial effects:
[0028] This invention proposes a fast table search and automatic address allocation method and system based on an optical bus. Utilizing the inherent physical connection order of serial cascading, the master node controls the enabling state of the optical transmission modules of downstream slave nodes at specific stages, temporarily reconstructing the bus into a unidirectional link directly from the master node to the current target slave node. This sequential access and physically isolated communication method avoids the message collisions and contention inherent in traditional parallel buses. This eliminates the need for complex collision detection and retry mechanisms during the table search process, and address allocation does not require random preemption or arbitration, thus significantly shortening system initialization time. The efficiency advantage is particularly pronounced when there are many nodes or a large address space.
[0029] Meanwhile, replacing electrical signals with optical signals for data transmission not only eliminates the need for traditional signal isolation and complex wiring, reducing hardware costs and structural design complexity, but also significantly enhances the communication process's resistance to electromagnetic interference, improving the system's reliability in complex industrial environments. Attached Figure Description
[0030] Figure 1This is a step diagram of a fast table search and automatic address allocation method based on an optical bus. Detailed Implementation
[0031] The following are specific embodiments of the present invention, which are described in conjunction with the accompanying drawings to further illustrate the technical solutions of the present invention. However, the present invention is not limited to these embodiments.
[0032] In fields such as instrument data acquisition, industrial control, and the Internet of Things (IoT), the discovery (table search) and address allocation of multi-node devices are fundamental and critical aspects of system initialization and maintenance. For a long time, communication schemes based on the RS485 electrical bus have dominated these applications. This scheme typically employs a parallel topology, connecting all slave nodes to the same pair of differential signal lines and relying on polling or broadcast commands from the master node for management. However, this traditional scheme has gradually revealed several inherent flaws in practice. First, regarding table search efficiency, whether using sequential polling or relying on delay or contention mechanisms after broadcasting, the time consumed increases significantly with the number of nodes, especially when the address space is large (e.g., using 12-bit BCD addresses), where the complete table search process can be exceptionally lengthy. Second, regarding automatic address allocation, because nodes on a parallel bus lack natural timing differentiation when responding to broadcast commands, complex contention decision algorithms (such as bit contention) are often introduced. When the number of nodes is large, the probability of address conflicts increases sharply, requiring multiple retries in the allocation process, reducing system reliability and efficiency. Furthermore, from a hardware implementation perspective, RS485 communication relies on electrical signal transmission. This not only requires drawing A and B signal lines for each device, affecting the overall airtightness of the equipment, but also often necessitates additional power isolation circuitry to suppress common-mode interference, increasing hardware costs and structural design complexity. In addition, electrical signals have weak anti-interference capabilities in harsh electromagnetic environments, posing a challenge to long-term stable operation. These shortcomings limit the system's scalability, ease of deployment, and long-term reliability.
[0033] To address the problems of low table search efficiency, high address allocation conflict rate, complex wiring, and poor anti-interference capability in the existing technologies, this invention proposes an innovative method and system for fast table search and automatic address allocation based on an optical bus, such as... Figure 1 As shown, the method includes the following steps:
[0034] S1: The master node is based on the serial cascade structure of the optical bus. By enabling only the right optical transmission modules of the currently queried slave node and all its upstream slave nodes in the order of physical connection, the optical bus logic is constructed into a unidirectional conduction link extending from the master node to the currently queried slave node during the table search phase.
[0035] S2: In a unidirectional connection link, the master node queries each slave node one by one in the order of physical connection and receives the identification information returned by each slave node;
[0036] S3: The master node generates a unique communication address for each slave node based on the physical connection order and the identification information of each slave node;
[0037] S4: The master node, in the order of physical connection, enables only the right optical transmission modules of the slave node to be assigned the address and all its upstream slave nodes in turn. During the address allocation phase, the unidirectional conduction link is reconstructed, and the communication address is sent to the corresponding slave node one by one along the link in sequence.
[0038] S5: After address allocation is completed, the master node enables the right-side optical transmission modules of all slave nodes, so that the optical bus forms a complete communication link from the master node to the last slave node, which is used for subsequent batch data reading or broadcast communication.
[0039] The core of this solution lies in utilizing infrared light as the communication medium to construct a serially cascaded network topology. Through the synergy of software algorithms and hardware enable control, it achieves efficient and conflict-free node discovery and address configuration. The entire rapid table search and automatic address allocation system typically consists of a master node (such as a 4G communication gateway) and multiple slave nodes (such as smart meters). All devices are installed side-by-side using standardized mechanical structures (such as 35mm caliper rails) to ensure precise alignment of the infrared light transmission and reception windows between adjacent devices, forming a stable physical optical communication link. The master node, as the system's control center, is responsible for initiating and managing the table search and address allocation process. Each slave node possesses independent optical signal reception, processing, and forwarding capabilities. Its key feature is that the enable state of the right-side optical transmission module can be dynamically controlled by the microcontroller inside the node, which is the foundation for link logic reconfiguration.
[0040] After the system powers on and initializes, it first enters the table search phase. During this phase, the master node's core task is to discover and identify all slave nodes connected in series on the physical link and determine their immutable physical connection order. To achieve this, the master node executes a sophisticated link control and query protocol. Essentially, this protocol temporarily reconstructs the physical optical bus—which might have all slave nodes' right-side optical transmitter modules enabled and extends to the very end—into a "one-way link" extending only from the master node to the currently identified slave node.
[0041] The specific reconstruction method is as follows: The master node sends a control command via the optical bus, which contains the location information of the target slave node. The command is transmitted downstream along the optical bus. Each slave node on the link, upon receiving the command, is parsed by the microcontroller. If a slave node discovers that it is the target node specified by the current command, it will enable its right-side optical transmitter module, preparing to receive and respond to any subsequent detailed queries. Simultaneously, all upstream slave nodes (i.e., nodes closer to the master node) will also enable their right-side optical transmitter modules according to the semantics of the command or preset rules during the transmission of this control command. Meanwhile, all downstream slave nodes will have their right-side optical transmitter modules disabled (not enabled). Through this mechanism, the optical signal, after being emitted from the master node, can only be transmitted up to the current target slave node and cannot continue to propagate downstream, thus defining a communication path with a clearly defined endpoint on the physical bus.
[0042] After successfully establishing a unidirectional connection to a specific target node, the master node sends an inquiry command to that target node via this link. The inquiry command may carry specific addressing information or a sequence number to clearly identify the target. Since the link is unidirectional, this inquiry command must and can only be received by the target node. After confirming the validity of the inquiry, the target node's microcontroller extracts its unique identification information (such as device serial number, factory code, etc.), generates a reply message, and sends the reply optical signal out through its enabled right-side optical transmitter module. This reply optical signal is transmitted in reverse along the original path, first to its upstream neighbor, where it is received and then forwarded further upstream through its own enabled right-side optical transmitter module, and so on, until the reply signal is successfully received by the master node. The master node records the target node's identification information and its corresponding physical location sequence number in the current inquiry round. After completing the inquiry and identification of the first slave node, the master node updates the target location information and initiates the inquiry process for the next slave node (i.e., the second node in the physical connection sequence). At this point, the master node will send control commands again, this time aimed at reconstructing a one-way conduction link extending to the second slave node.
[0043] During the new link construction process, the right-side optical transmission modules of the first and second slave nodes are enabled, while the transmission modules of all downstream nodes of the second node are disabled. The master node then queries the second node and receives its response. This process repeats cyclically, with the master node performing the "link construction - query - receive response" operation sequentially according to an assumed physical order (e.g., from the 1st to the Nth node). If, when querying a preset location, the master node does not receive any valid response within a preset timeout period (e.g., 100 milliseconds), it can be determined that there is no slave node at that physical location or that the node is faulty. The master node will record this anomaly and continue trying the next location until multiple preset locations fail to respond. At this point, it is considered that all online nodes have been discovered or the current slave node's enable control state is abnormal, and the table search phase ends. If only the current slave node is faulty, but subsequent slave nodes can still perform the table search, it indicates that only the current slave node is faulty, while the enable control state is normal. Through this sequential query mechanism, the master node can not only obtain a list of identifiers for all online slave nodes, but more importantly, it can determine the order of their physical connections, which is the basis for subsequent automatic address allocation.
[0044] After the table search phase, the system enters the automatic address allocation phase. Based on the physical connection order of the slave nodes confirmed during the table search phase, the master node generates a unique communication address for each slave node using a deterministic, conflict-free rule. A typical and efficient allocation rule is sequential incrementing: the master node assigns a starting address (e.g., address 1 in the MODBUS protocol, or other starting values set according to system planning) to the first discovered slave node, assigns the starting address plus one (e.g., address 2) to the second discovered slave node, and so on. This allocation method completely avoids the conflict problems caused by random preemption in traditional bus contention mechanisms, and also eliminates the need for complex conflict detection and retry algorithms, making the allocation logic extremely simple and efficient.
[0045] Address allocation information needs to be securely and accurately transmitted to each corresponding slave node. To this end, the master node again utilizes link logic reconfiguration technology. The allocation process is also strictly performed according to the physical connection sequence. The master node first generates a dedicated communication address for the first slave node. Then, it performs a link construction operation similar to the table search phase, enabling all right-side optical transmission modules between the master node and the first slave node, while disabling all right-side optical transmission modules downstream of the first slave node, thus forming a unidirectional conductive link to the first slave node. Next, the master node sends an address setting command to the first slave node through this dedicated link, containing the assigned communication address. Upon receiving the command, the first slave node writes the address parameters into its non-volatile memory and returns an acknowledgment. Upon receiving the acknowledgment, the master node completes the address allocation for the first node. Subsequently, the master node begins allocating addresses for the second slave node. It sends a new control command, reconfiguring a unidirectional conductive link extending to the second slave node. At this point, the right-side transmission modules of both the first and second slave nodes are enabled, while those of the second node are disabled. The address of the second node is then sent and acknowledged through this new link. This process continues until all discovered slave nodes have obtained their unique communication addresses. Of course, if a faulty slave node is encountered during address allocation, and the enable state control is normal, the address to be allocated to the current slave node is skipped, and address allocation continues for the next slave node. For example, if the previous slave node successfully allocated address N, then address N+1 to be allocated to the current slave node is skipped, and address N+2 is allocated to the next slave node. If the enable state control of the current slave node is abnormal, the address allocation task ends.
[0046] After successfully completing the table search and address allocation for all slave nodes, the system initialization configuration phase concludes. At this point, to enable subsequent normal batch data reading, group operations, or broadcast command issuance, the optical bus needs to be restored to a fully connected state. The master node sends a global enable command to all slave nodes, or sends commands sequentially according to address order, controlling the right-side optical transmitter modules of all slave nodes to enter the enabled state. Thus, the optical bus forms a complete communication link starting from the master node, with signals passing unimpeded through each slave node, ultimately reaching the last slave node. On this link, the master node can use the allocated addresses and standard communication protocols (such as MODBUS, DL / T645, etc.) to perform name-based communication with specific slave nodes, or send broadcast commands for all slave nodes to receive simultaneously.
[0047] In summary, the fast table search and automatic address allocation method and system based on optical bus proposed in this invention, by adopting a physical architecture of optical bus serial cascading and innovatively introducing a dynamic link construction mechanism based on controllable enable state, fundamentally improves the efficiency and reliability of table search and address allocation in the instrument system.
[0048] Its core effect lies in utilizing the inherent physical connection sequence of serial cascading. By controlling the enabling state of the optical transmission modules of downstream slave nodes at specific stages, the master node temporarily reconstructs the bus into a unidirectional link directly from the master node to the current target slave node. This sequential access and physically isolated communication method completely avoids the message collisions and contention inherent in traditional parallel buses. This eliminates the need for complex collision detection and retry mechanisms during the table search process, and address allocation no longer requires random preemption and arbitration, thus significantly shortening system initialization time. The efficiency advantage is even more pronounced when there are many nodes or a large address space. Simultaneously, this scheme uses optical signals instead of electrical signals for data transmission, not only eliminating traditional signal isolation and complex wiring, reducing hardware costs and structural design difficulty, but also significantly enhancing the communication process's resistance to electromagnetic interference and improving system reliability in complex industrial environments.
[0049] It should be noted that all directional indications (such as up, down, left, right, front, back, etc.) in the embodiments of the present invention are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indication will also change accordingly.
[0050] Furthermore, in this invention, descriptions involving terms such as "first," "second," and "a" are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0051] In this invention, unless otherwise explicitly specified and limited, the terms "connection," "fixed," etc., should be interpreted broadly. For example, "fixed" can mean a fixed connection, a detachable connection, or an integral part; it can mean a mechanical connection or an electrical connection; it can mean a direct connection or an indirect connection through an intermediate medium; it can mean the internal communication of two components or the interaction between two components, unless otherwise explicitly limited. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0052] Furthermore, the technical solutions of the various embodiments of the present invention can be combined with each other, but only if they are feasible for those skilled in the art. If the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.
Claims
1. A fast table search and automatic address allocation method based on an optical bus, characterized in that, The optical bus consists of a serially cascaded master node and multiple slave nodes. Each slave node is equipped with a left-side optical receiving module and a right-side optical transmitting module, and the enable state of the right-side optical transmitting module is controllable. The method includes the following steps: S1: The master node is based on the serial cascade structure of the optical bus. By enabling only the right optical transmission modules of the currently queried slave node and all its upstream slave nodes in the order of physical connection, the optical bus logic is constructed into a unidirectional conduction link extending from the master node to the currently queried slave node during the table search phase. S2: In a unidirectional connection link, the master node queries each slave node one by one in the order of physical connection and receives the identification information returned by each slave node; S3: The master node generates a unique communication address for each slave node based on the physical connection order and the identification information of each slave node; S4: The master node, in the order of physical connection, enables only the right optical transmission modules of the slave node to be assigned the address and all its upstream slave nodes in turn. During the address allocation phase, the unidirectional conduction link is reconstructed, and the communication address is sent to the corresponding slave node one by one along the link in sequence.
2. The fast table search and automatic address allocation method based on optical bus as described in claim 1, characterized in that, In step S2, the step-by-step query specifically refers to: The master node sends an inquiry command carrying the target location information to the currently constructed unidirectional guiding link; The currently queried node responds by comparing the target location information with its own position in the physical connection order.
3. The fast table search and automatic address allocation method based on optical bus as described in claim 2, characterized in that, In step S3, generating a unique communication address for each slave node specifically involves: The master node assigns addresses to each slave node sequentially according to the physical connection order of the slave nodes confirmed during the table search phase, following preset rules. These preset rules include assigning a starting address to the first slave node that is queried, with the addresses of subsequent slave nodes increasing sequentially.
4. The fast table search and automatic address allocation method based on optical bus as described in claim 3, characterized in that, During the execution of step S2 or S4, if the master node does not receive a response from the target slave node within a preset time, it will determine and record that the slave node has a communication error. If the slave node's enable state is normal, skip reading the slave node's identification information / the currently allocated incrementing address, and continue to execute the corresponding process for the next slave node; If the slave node's enable state control fails, terminate the task.
5. The fast table search and automatic address allocation method based on optical bus as described in claim 1, characterized in that, Following step S4, the following steps are also included: S5: After address allocation is completed, the master node enables the right-side optical transmission modules of all slave nodes, so that the optical bus forms a complete communication link from the master node to the last slave node, which is used for subsequent batch data reading or broadcast communication.
6. A fast table search and automatic address allocation system based on an optical bus, used to implement the method according to any one of claims 1 to 5, characterized in that, include: One master node and several slave nodes, wherein the master node and all slave nodes are serially cascaded via an optical bus; The master node includes a first optical transmitting module, a first optical receiving module, and a main control unit. The main control unit is used to execute the fast table search and automatic address allocation method and generate control commands. The slave node includes a left optical receiving module, a right optical transmitting module, and a microcontroller unit. The microcontroller unit is electrically connected to the left optical receiving module and the right optical transmitting module, and is used to receive control commands from the master node and control the enable state of its right optical transmitting module.
7. The fast table search and automatic address allocation system based on optical bus as described in claim 6, characterized in that, The master node is a 4G communication gateway, and the slave node is an instrument. The master node and the slave node are installed side by side through a standard card slot to align the optical path of the optical bus.
8. The fast table search and automatic address allocation system based on optical bus as described in claim 6, characterized in that, The microcontroller unit is used for: When it is the currently queried slave node or the currently waiting address slave node, it controls the right optical emission module of its own to be enabled. When the enable command is received from the master node, the optical transmitter module on its right side is enabled. When a de-enable command is received from the master node, or when the target node is not currently being targeted and no enable command has been received, the right-side optical emission module is controlled to be in a de-enable state.
