Automatic addressing method and system, and computer-readable medium

The automatic addressing method for sensors addresses the inefficiencies of manual addressing by enabling automated configuration, conflict resolution, and address updates, thereby enhancing efficiency and reducing errors in sensor addressing.

WO2025119312A1PCT designated stage expired Publication Date: 2025-06-12METTLER TOLEDO (CHANGZHOU) PRECISION INSTR CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/137309
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-06
Filing Date
2024-12-06
Publication Date
2025-06-12

AI Technical Summary

Technical Problem

The existing manual addressing method for sensors, such as load cells, in large material tank scales and vehicle scales is inefficient, inflexible, and prone to errors due to complex installation environments and the need for frequent updates.

Method used

An automatic addressing method and system that allows a master device to query configuration information from slave devices, screen for address conflicts, update communication addresses as needed, and confirm new addressing records, thereby streamlining the addressing process.

Benefits of technology

The automatic addressing method significantly improves sensor addressing efficiency, simplifies installation and maintenance, reduces the need for manual cable mark updates, and minimizes economic losses associated with addressing errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024137309_12062025_PF_FP_ABST
    Figure CN2024137309_12062025_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to an automatic addressing method and system, and a computer-readable medium. The method includes: a configuration information querying step: each slave sends its own configuration information to a master based on a delayed reply time parameter and a current communication address, where the configuration information includes a slave serial number and an addressing record number; an addressing screening step: the master determines whether there is a conflict between the respective current communication addresses of the slaves, obtains a slave whose communication address needs to be updated through screening based on a preset addressing algorithm and the addressing record numbers if it is determined that there is a conflict, and generates an addressing slave list; a new address setting step: the master sends a new address setting command to the corresponding slave based on the addressing slave list; and the slave updates the current communication address; and an addressing confirming step: the master sends an addressing record number of this batch to each slave; and each slave uses the addressing record number of this batch as a latest addressing record number. The present invention can improve the addressing efficiency of sensors. (Fig. 1)
Need to check novelty before this filing date? Find Prior Art

Description

AUTOMATIC ADDRESSING METHOD AND SYSTEM, AND COMPUTER-READABLE MEDIUMBACKGROUND OF THE INVENTIONTechnical Field

[0001] The present invention mainly relates to the field of sensor addressing technologies, and in particular, to an automatic addressing method and system, and a computer-readable medium.Background Art

[0002] In application scenarios such as large material tank scales and vehicle scales, load cells may be used to perform corresponding weighing operations. A multi-point measurement method is usually employed for weighing measurement, that is, a plurality of load cells are used to measure one object. Each load cell is connected as a slave to a master through a field bus, where the master may be a programmable logic controller (PLC) or a weighing instrument. The PLC or the weighing instrument that is used as the master may acquire data such as weights of the plurality of load cells that are used as the slaves, and the data will be used in corresponding process control or displayed to a user through a terminal interface.

[0003] A half-duplex communication interface based on a serial bus is a common communication manner. In a typical half-duplex communication mode, there are usually one master and a plurality of slaves on a bus, and a strict master-slave communication mode is used over the communication protocol, that is, the master performs polling, and the polled slave responds (polling and responding) . The master needs to know a communication address of each slave in advance, and then obtains data of each slave in a polling manner. The half-duplex communication mode is used between the PLC or the weighing instrument and the load cells.

[0004] Currently, the addressing of sensors (for example, the load cells) mostly relies on manual addressing. A technician configures communication addresses of the load cells by using hardware or software in a fixed addressing manner, and after the addressing, the load cells are powered on stage by stage in a hardware cascading manner and remain in a powered-on state. The fixed addressing manner is hardware-dependent, low in flexibility, and low in fault tolerance. Due to a complex environment of a weighing site, there are often cases such as concealed installation of load cells, communication cables mixed with other cables, concealed wiring for connection, unclear cable marks, cable relaying, duplicate or incorrect communication addresses of slaves, and addition or replacement of sensors. The use of a manual addressing manner requires significant effort and time from field technicians, and the existing sensor addressing manner has a problem of low addressing efficiency.SUMMARY

[0005] A technical problem to be solved by the present application is to provide an automatic addressing method and system, and a computer-readable medium, which can improve the addressing efficiency of sensors.

[0006] In order to solve the above technical problem, a technical solution used in the present application is an automatic addressing method. The method includes: a configuration information querying step: a master sends a configuration information querying command to each slave; and each slave sends its own configuration information to the master based on a delayed reply time parameter and a current communication address in response to the configuration information querying command, where the configuration information includes a slave serial number and an addressing record number, and the addressing record number is a mark for representing a batch of addressing; an addressing screening step: the master determines whether there is a conflict between the respective current communication addresses of the slaves, and obtains a slave whose communication address needs to be updated through screening based on a preset addressing algorithm and the addressing record numbers if it is determined that there is a conflict; and the master generates an addressing slave list based on the slave whose communication address needs to be updated, where the addressing slave list includes a slave serial number and a communication address corresponding to the slave serial number; a new address setting step: the master sends a new address setting command to the corresponding slave based on the addressing slave list; and the slave updates the current communication address based on a communication address in the new address setting command in response to the new address setting command; and an addressing confirming step: the master sends an addressing record number of this batch and an addressing confirming command to each slave; and each slave uses the addressing record number of this batch as a latest addressing record number in response to the addressing confirming command.

[0007] In an embodiment of the present application, before the configuration information querying step, the method further includes: an addressing mode entering step: the master broadcasts an automatic addressing starting command and a delayed reply time parameter to each slave; and each slave enters an automatic addressing mode and does not reply to the master by default in response to the automatic addressing starting command, where the delayed reply time parameter includes a minimum time for the slave to delay a reply to the master and a maximum time for the slave to delay a reply to the master, and the delayed reply time parameter is used to control the slave to reply to the master at a specific time.

[0008] In an embodiment of the present application, in the configuration information querying step, the step that each slave sends its own configuration information to the master based on a delayed reply time parameter and a current communication address includes: each slave generates its own corresponding random number seed n, where the random number seed n of each slave is different, and the random number seed n is less than or equal to a preset multiple of the number of the slaves; each slave generates a corresponding delayed reply time Td using the following formula:

[0009] Td=n*Tmin

[0010] where Tmin represents the minimum time for the slave to delay a reply to the master, and the delayed reply time Td is less than or equal to the maximum time Nmax for the slave to delay a reply to the master; and each slave sends its own slave serial number and a current addressing record number to the master based on the current communication address after waiting for the corresponding delayed reply time Td.

[0011] In an embodiment of the present application, after the step that each slave sends its own configuration information to the master based on a delayed reply time parameter and a current communication address, the configuration information querying step further includes: the master collects a combination of a valid slave serial number, addressing record number, and communication address; the master broadcasts a silence command to the corresponding slave based on the collected slave serial number; the slave stops replying to the configuration information querying command in response to the silence command; and repeating the configuration information querying step until no slave replies to the configuration information querying command.

[0012] In an embodiment of the present application, in the addressing screening step, the step that the master obtains a slave whose communication address needs to be updated through screening based on a preset addressing algorithm and the addressing record number includes: the master adds slaves with a communication address conflict to a first slave group, and adds slaves without a communication address conflict to a second slave group; and the master obtains the slave whose communication address needs to be updated in the first slave group through screening based on the addressing record number of each slave in the first slave group and the addressing record number of each slave in the second slave group.

[0013] In an embodiment of the present application, in the addressing screening step, the steps that the master obtains the slave whose communication address needs to be updated in the first slave group through screening based on the addressing record number of each slave in the first slave group and the addressing record number of each slave in the second slave group, and the master generates an addressing slave list based on the slave whose communication address needs to be updated include: Step a: the master selects two slaves with the same communication address from the first slave group as a slave A and a slave B respectively, where current communication addresses of the slave A and the slave B are both address01; Step b: the master determines whether there is an addressing record number that is the same as an addressing record number of the slave A in the second slave group, and the master determines whether there is an addressing record number that is the same as an addressing record number of the slave B in the second slave group; Step c: the master assigns the communication address address01 to the slave A and assigns an unused new communication address with a low value to the slave B if it is determined that there is the addressing record number that is the same as the addressing record number of the slave A, and there is no addressing record number that is the same as the addressing record number of the slave B; and Step d: the master generates the addressing slave list SlaveList based on the slave B.

[0014] In an embodiment of the present application, in the addressing screening step, if there are a plurality of slaves with the same communication address in the first slave group, steps a to d are repeated until there are no slaves with the same communication address in the first slave group.

[0015] In an embodiment of the present application, in the new address setting step, the step that the slave updates the current communication address based on a communication address in the new address setting command includes: the slave determines whether a slave serial number in the new address setting command is the same as its own slave serial number; the slave uses the communication address in the new address setting command as the current communication address, and replies to the master with a successful addressing command if it is determined that the slave serial numbers are the same; or the slave does not reply to the master if it is determined that the slave serial numbers are not the same.

[0016] In an embodiment of the present application, after the addressing confirming step, the method further includes: an addressing mode exiting step: the master broadcasts an addressing mode exiting command to each slave; the slave determines whether the addressing confirming command is received in response to the addressing mode exiting command; the slave exits the addressing mode if it is determined that the addressing confirming command is received; or the slave discards an addressing result of this batch if it is determined that the addressing confirming command is not received.

[0017] In an embodiment of the present application, after the addressing mode exiting step, the method further includes: an addressing result rechecking step: the master sends a slave serial number querying command to the corresponding slave based on the communication address in the addressing slave list; the slave sends its own slave serial number to the master in response to the slave serial number querying command; and the master determines whether the received slave serial number matches the slave serial number in the addressing slave list, and the master gives an alarm to prompt that the addressing is unsuccessful if it is determined that the slave serial numbers do not match.

[0018] In order to solve the above technical problem, the present application further provides an automatic addressing system. The system includes: a memory configured to store instructions executable by a processor; and the processor configured to execute the instructions to implement the above automatic addressing method.

[0019] In order to solve the above technical problem, the present application further provides a computer-readable medium storing computer program code, where the computer program code, when executed by a processor, implements the above automatic addressing method.

[0020] In the technical solution of the present application, sensors may be used as the slaves to communicate with the master, and the master can obtain corresponding information of the slaves through the configuration information querying step; the master can automatically determine which slaves need to be readdressed through the addressing screening step; the slave whose communication address needs to be updated is addressed through the new address setting step; and all the slaves in this batch of addressing operations can have the same addressing record number through the addressing confirming step, to facilitate recording of addressing. In the technical solution of the present application, a communication process between the slaves and the master is designed, and the automatic addressing method is used to replace a conventional manual fixed addressing method, which improves the addressing efficiency, simplifies an installation and maintenance process of the sensors, reduces the use of sensor cable marks, and reduces economic losses resulting from failure to update the cable marks in a timely manner.

[0021] To make the above objectives, features, and advantages of the present application more comprehensible, specific implementations of the present application are further described below in detail with reference to the accompanying drawings, where FIG. 1 is an exemplary flowchart of an automatic addressing method according to an  embodiment of the present application. FIG. 2 is a swimlane flowchart of a communication process between a master and slaves  according to an embodiment of the present application. FIG. 3 is a system block diagram of an automatic addressing system according to an  embodiment of the present application.BRIEF DESCRIPTION OF THE DRAWINGS

[0022] To make the above objectives, features, and advantages of the present application more comprehensible, specific implementations of the present application are further described below in detail with reference to the accompanying drawings.

[0023] In the following descriptions, many specific details are described to make the present application fully comprehensible. However, the present application may be implemented in other manners different from those described herein. Therefore, the present application is not limited to specific embodiments disclosed below.

[0024] As shown in the present application and the claims, unless the context expressly indicates otherwise, the words "a" , "an" , "a" , and / or "the" do not specifically refer to the singular, but may also include the plural. Generally, the terms "include" and "contain" only suggest that the expressly identified steps and elements are included, but these steps and elements do not constitute an exclusive list, and the method or device may further include other steps or elements.

[0025] In the present application, a flowchart is used to illustrate the operations performed by a system according to the embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed exactly in order. Instead, the various steps may be processed in reverse order or simultaneously. In addition, other operations are added to these processes, or operations of a certain step or several steps are removed from these processes.

[0026] The present application provides an automatic addressing method, which may be applied to components such as a load cell and an instrument. The sensor may be connected as a slave to a master. Scenarios to which the present application is applicable include: A correspondence between the sensor and a cable changes due to an adjustment in field wiring; a communication address of the sensor changes by accident due to, for example, resetting to factory settings, or mis-operation by an operator; and there is a need to replace, add, or remove the sensor. In an actual weighing scenario, according to the automatic addressing method of the present application, a field technician only needs to record a serial number and an actual installation position (for example, a bearing leg of a material tank) of each load cell, and enter the information into an upper-level system.

[0027] The automatic addressing method of the present application may run in a weighing scale, for example, in a controller of the weighing scale, or in a cloud platform. When the automatic addressing method runs in the cloud platform, data of the weighing scale and data of the cloud platform are exchanged through a wireless network. For example, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an interconnected cloud, a multi-cloud, and the like or any combination thereof. A running environment of the automatic addressing method is not limited in the present application.

[0028] FIG. 1 is an exemplary flowchart of an automatic addressing method according to an embodiment of the present application. With reference to FIG. 1, the automatic addressing method in this embodiment includes the following steps.

[0029] Step S110, a configuration information querying step: a master sends a configuration information querying command to each slave; and each slave sends its own configuration information to the master based on a delayed reply time parameter and a current communication address in response to the configuration information querying command, where the configuration information includes a slave serial number and an addressing record number, and the addressing record number is a mark for representing a batch of addressing.

[0030] Step S120, an addressing screening step: the master determines whether there is a conflict between the respective current communication addresses of the slaves, and obtains a slave whose communication address needs to be updated through screening based on a preset addressing algorithm and the addressing record numbers if it is determined that there is a conflict; and the master generates an addressing slave list based on the slave whose communication address needs to be updated, where the addressing slave list includes a slave serial number and a communication address corresponding to the slave serial number.

[0031] Step S130, a new address setting step: the master sends a new address setting command to the corresponding slave based on the addressing slave list; and the slave updates the current communication address based on a communication address in the new address setting command in response to the new address setting command.

[0032] Step S140, an addressing confirming step: the master sends an addressing record number of this batch and an addressing confirming command to each slave; and each slave uses the addressing record number of this batch as a latest addressing record number in response to the addressing confirming command.

[0033] The above steps S110 to S140 are described below in detail.

[0034] In some embodiments, before step S110, namely the configuration information querying step, the method further includes the following step.

[0035] Step S100, an addressing mode entering step: the master broadcasts an automatic addressing starting command and a delayed reply time parameter to each slave; and each slave enters an automatic addressing mode and does not reply to the master by default in response to the automatic addressing starting command, where the delayed reply time parameter includes a minimum time for the slave to delay a reply to the master and a maximum time for the slave to delay a reply to the master, and the delayed reply time parameter is used to control the slave to reply to the master at a specific time.

[0036] For example, the minimum time Tmin for the slave to delay a reply to the master may be set to 10 milliseconds (ms) , a delay time for the slave to actually reply to the master should be an integer multiple of Tmin, and the delayed reply time parameter of the present application may control the slave to reply to the master within a specific time period. The maximum time Nmax for the slave to delay a reply to the master is equal to a preset threshold, and the delay time for the slave to actually reply to the master should not exceed Nmax. In the present application, the delayed reply time parameter is set, so that each slave can communicate with the master within a specific time period. This can ensure that a bus is not occupied, and there is no conflict in the communication process.

[0037] In step S110, namely the configuration information querying step, the master sends the configuration information querying command to each slave; and each slave sends its own configuration information to the master based on the delayed reply time parameter and the current communication address in response to the configuration information querying command, where the configuration information includes the slave serial number and the addressing record number, and the addressing record number is the mark for representing a batch of addressing. For example, if the automatic addressing method of the present application is completely performed once during a batch of addressing, each slave will have the same addressing record number.

[0038] In some embodiments, in the configuration information querying step, the step that each slave sends its own configuration information to the master based on a delayed reply time parameter and a current communication address includes the following steps.

[0039] Step S1101: each slave generates its own corresponding random number seed n, where the random number seed n of each slave is different, and the random number seed n is less than or equal to a preset multiple of the number of the slaves;

[0040] Step S1102: each slave generates a corresponding delayed reply time Td using the following formula (1) :

[0041] Td=n*Tmin    (1)

[0042] where Tmin represents the minimum time for the slave to delay a reply to the master, and the delayed reply time Td is less than or equal to the maximum time Nmax for the slave to delay a reply to the master.

[0043] Step S1103: each slave sends its own slave serial number and a current addressing record number (i.e., an addressing record number from the previous batch of successful addressing) to the master based on the current communication address after waiting for the corresponding delayed reply time Td.

[0044] For example, in the foregoing step S1101, the random number seed n indicates that the slave replies to the master within an nth time period, and the random number seed n may be set to be less than or equal to twice the number of the slaves. In the foregoing step S1103, the slave can return its own information to the master through a communication frame in which the communication address currently being used by the slave is used, and the addressing record number may be set to a 32-bit binary format, which is not limited in the present application.

[0045] In some embodiments, after the step that each slave sends its own configuration information to the master based on a delayed reply time parameter and a current communication address, the configuration information querying step further includes the following steps.

[0046] Step S111: the master collects a combination of a valid slave serial number, addressing record number, and communication address.

[0047] Step S112: the master broadcasts a silence command to the corresponding slave based on the collected slave serial number;

[0048] Step S113: the slave stops replying to the configuration information querying command in response to the silence command.

[0049] Step S114: the configuration information querying step is repeated until no slave replies to the configuration information querying command. For example, it may be set to repeat the steps S110 to S113 described above until no slave replies to the master with the configuration information querying command for three consecutive times, and then perform step S120.

[0050] For example, in the foregoing step S113, if the slave finds its own slave serial number present in a "Silence" command, the slave enters a silence mode, unless the slave is restarted or receives a "Start automatic addressing" command or an "Exit an addressing mode" command. The foregoing step S114 is for the master to confirm that information about all the slaves has been collected and that all the slaves have been controlled to enter the silence mode.

[0051] In step S120, namely the addressing screening step, the master determines whether there is a conflict between the respective current communication addresses of the slaves, and obtains a slave whose communication address needs to be updated through screening based on a preset addressing algorithm and the addressing record numbers if it is determined that there is a conflict; and the master generates an addressing slave list based on the slave whose communication address needs to be updated, where the addressing slave list includes a slave serial number and a communication address corresponding to the slave serial number.

[0052] In some embodiments, in the addressing screening step, the step that the master obtains a slave whose communication address needs to be updated through screening based on a preset addressing algorithm and the addressing record number includes: the master adds slaves with a communication address conflict to a first slave group, and adds slaves without a communication address conflict to a second slave group; and the master obtains the slave whose communication address needs to be updated in the first slave group through screening based on the addressing record number of each slave in the first slave group and the addressing record number of each slave in the second slave group. For example, in the present application, corresponding slaves are added to the first slave group and the second slave group based on a communication address conflict situation, so that the slave whose communication address needs to be updated can be found subsequently.

[0053] In some embodiments, in the addressing screening step, the steps that the master obtains the slave whose communication address needs to be updated in the first slave group through screening based on the addressing record number of each slave in the first slave group and the addressing record number of each slave in the second slave group, and the master generates an addressing slave list based on the slave whose communication address needs to be updated include:

[0054] Step a: the master selects two slaves with the same communication address from the first slave group as a slave A and a slave B respectively, where current communication addresses of the slave A and the slave B are both address01;

[0055] Step b: the master determines whether there is an addressing record number that is the same as an addressing record number of the slave A in the second slave group, and the master determines whether there is an addressing record number that is the same as an addressing record number of the slave B in the second slave group;

[0056] Step c: the master assigns the communication address address01 to the slave A and assigns an unused new communication address with a low value to the slave B if it is determined that there is the addressing record number that is the same as the addressing record number of the slave A, and there is no addressing record number that is the same as the addressing record number of the slave B; and

[0057] Step d: the master generates the addressing slave list SlaveList based on the slave B.

[0058] In some embodiments, in the addressing screening step, if there are a plurality of slaves with the same communication address in the first slave group, for example, there are more than three slaves with the same communication address in the first slave group, steps a to d are repeated until there are no slaves with the same communication address in the first slave group.

[0059] For example, during a process of solving the communication address conflict of the slaves in the foregoing steps a to d of the present application, if the current communication addresses of the slave A and the slave B (for example, the slave B is newly added) in the first slave group are both address01 (for example, the address01 is equal to 3) , the addressing record number of the slave A is the same as the addressing record numbers of five slaves in the second slave group, and the addressing record number of the slave B is unique to the slave B, the master will preferentially assign a communication address 3 (address01) to the slave A. If the master queries that there are unused communication addresses available for assignment such as address02, address03, and address04, the master preferentially assigns the unused new communication address address02 with a low value to the slave B. In step d, the master may add related information such as a slave serial number of the slave B and the newly assigned communication address to the addressing slave list SlaveList.

[0060] A communication address assignment principle of the present application may not affect a previous communication address assignment result after a sensor is added or replaced, and keeps the original communication address of each slave unchanged as much as possible during a process of assigning the communication address, to reduce operations of upper computer software after automatic addressing. The communication address with a low value is preferentially assigned, so that the continuity of communication addresses can be maximized, and the utilization of the communication addresses can be improved.

[0061] In step S130, namely the new address setting step, the master sends a new address setting command to the corresponding slave based on the addressing slave list; and the slave updates the current communication address based on a communication address in the new address setting command in response to the new address setting command. For example, the master may sequentially read data in the addressing slave list SlaveList and broadcast a "Set a new address" command to slaves in the SlaveList until communication addresses of all the slaves in the SlaveList are assigned.

[0062] In some embodiments, in the new address setting step, the step that the slave updates the current communication address based on a communication address in the new address setting command includes the following steps.

[0063] Step S1301: the slave determines whether a slave serial number in the new address setting command is the same as its own slave serial number.

[0064] Step S1302: the slave uses the communication address in the new address setting command as the current communication address, and replies to the master with a successful addressing command if it is determined that the slave serial numbers are the same; or the slave does not reply to the master if it is determined that the slave serial numbers are not the same.

[0065] For example, in the foregoing step S1302, the slave not replying to the master indicates unsuccessful addressing, and subsequently, the master may alert a user that the slave with a specific slave serial number is abnormal, and setting of the communication address of the slave is unsuccessful.

[0066] In step S140, namely the addressing confirming step, the master sends a randomly generated addressing record number of this batch and an addressing confirming command to each slave; and each slave uses the addressing record number of this batch as a latest addressing record number in response to the addressing confirming command. For example, in response to the addressing confirming command, each slave further writes the addressing record number of this batch and the communication address into its own non-volatile memory.

[0067] In some embodiments, after the addressing confirming step, the method further includes the following steps.

[0068] Step S150, an addressing mode exiting step: the master broadcasts an addressing mode exiting command to each slave; the slave determines whether the addressing confirming command is received in response to the addressing mode exiting command; the slave exits the addressing mode, and then performs normal service communication if it is determined that the addressing confirming command is received; or the slave discards an addressing result of this batch if it is determined that the addressing confirming command is not received. For example, the addressing result of this batch includes information such as the communication address received by the slave, and the addressing record number of this batch.

[0069] In some embodiments, after the addressing mode exiting step, the method further includes the following step.

[0070] Step S160, namely an addressing result rechecking step: the master sends a slave serial number querying command to the corresponding slave based on the communication address in the addressing slave list; the slave sends its own slave serial number to the master in response to the slave serial number querying command; and the master determines whether the received slave serial number matches the slave serial number in the addressing slave list, and the master gives an alarm to prompt that the addressing is unsuccessful if it is determined that the slave serial numbers do not match. For example, through this step S160, the master can check whether the communication address in the SlaveList is assigned to the slave with the specific slave serial number, and provide alarm information when an abnormality occurs. This setting may increase the reliability of the automatic addressing method.

[0071] Here, an embodiment is used to describe the automatic addressing method of the present application. In this embodiment, there are a total of N slaves. FIG. 2 is a swimlane flowchart of a communication process between a master and the slaves according to an embodiment of the present application. With reference to FIG. 2, in step S200, namely an addressing mode entering step, the master broadcasts an automatic addressing starting command; and the slaves enter an automatic addressing mode. In step S210, namely a configuration information querying step, the master broadcasts a configuration information querying command; a slave A replies, a slave B replies, and so on until a slave N replies; the master collects a slave serial number, an addressing record number, and a communication address; the master broadcasts a silence command; and the slave A enters a silence mode, the slave B enters the silence mode, and so on until the slave N enters the silence mode. In step S220, namely an addressing screening step, the master runs an addressing algorithm.

[0072] Still with reference to FIG. 2, in step S230, namely a new address setting step, the master broadcasts a new address setting command based on an addressing slave list, to set a new communication address of the slave A; if the slave A checks that the slave serial numbers are the same, the slave A replies that the addressing is successful; the master sets a new communication address of the slave B; if the slave B checks that the slave serial numbers are the same, the slave B replies that the addressing is successful; and the master confirms that communication addresses of all the slaves have been set. In step S240, namely an addressing confirming step, the master updates an addressing record number of this batch, and sends an addressing confirming command; and the slave writes a latest addressing record number and a latest communication address into a non-volatile memory. In step S250, namely an addressing mode exiting step, the master broadcasts an addressing mode exiting command; and the slave exits the addressing mode, and performs normal service communication. In step S260, namely an addressing result rechecking step, the master sends a slave serial number querying command based on a communication address in the addressing slave list; the slave replies; and the master gives an alarm to prompt that the addressing is unsuccessful if information rechecking performed by the master fails.

[0073] In the technical solution of the present application, load cells are used as the slaves to communicate with the master, and the master can obtain corresponding information of the slaves through the configuration information querying step; the master can automatically determine which slaves need to be readdressed through the addressing screening step; the slave whose communication address needs to be updated is addressed through the new address setting step; and all the slaves in this batch of addressing operations can have the same addressing record number through the addressing confirming step, to facilitate recording of addressing. In the technical solution of the present application, the communication process between the slaves and the master is designed based on a half-duplex communication technology, and the automatic addressing method is used to replace a conventional manual fixed addressing method, which improves the addressing efficiency, simplifies an installation and maintenance process of the sensor, reduces the use of sensor cable marks, and reduces economic losses resulting from failure to update the cable marks in a timely manner.

[0074] The present application further includes an automatic addressing system, including a memory and a processor. The memory is configured to store instructions executable by the processor. The processor is configured to execute the instructions, to implement the automatic addressing method described above.

[0075] FIG. 3 is a system block diagram of an automatic addressing system according to an embodiment of the present application. With reference to FIG. 3, the automatic addressing system 300 may include an internal communication bus 301, a processor 302, a read-only memory (ROM) 303, a random access memory (RAM) 304, and a communication port 305. The automatic addressing system 300 may further include a hard disk 306. The internal communication bus 301 may implement data communication between components of the automatic addressing system 300. The processor 302 can perform determination and give a prompt. In some embodiments, the processor 302 may include one or more processors. The communication port 305 may implement data communication between the automatic addressing system 300 and the outside. In some embodiments, the automatic addressing system 300 can receive and send information and data from / to a network through the communication port 305. The automatic addressing system 300 may further include different forms of program storage units and data storage units, such as the hard disk 306, the read-only memory (ROM) 303, and the random access memory (RAM) 304, which can store various data files used for computer processing and / or communication, and possible program instructions executed by the processor 302. The processor executes these instructions to implement the main part of the method. A processing result from the processor is transmitted to user equipment through the communication port and displayed in a user interface.

[0076] The above automatic addressing method may be implemented as a computer program, which may be stored in the hard disk 306, and loaded into the processor 302 for execution, so as to implement the automatic addressing method of the present application.

[0077] The present application further includes a computer-readable medium storing computer program code. The computer program code, when executed by a processor, causes the automatic addressing method described above to be implemented.

[0078] The automatic addressing method may also be stored, as an article of manufacture, in the computer-readable storage medium when implemented as the computer program. For example, the computer-readable storage medium may include, but is not limited to, a magnetic storage device (e.g., a hard disk, a floppy disk, and a magnetic stripe) , an optical disc (e.g., a compact disc (CD) , and a digital versatile disc (DVD) ) , a smart card, and a flash memory device (e.g., an electrically erasable programmable read-only memory (EPROM) , a card, a stick, and a key driver) . In addition, various storage media described herein can represent one or more devices and / or other machine-readable media for storing information. The term "machine-readable medium" may include, but is not limited to, wireless channels and various other media (and / or storage media) capable of storing, containing, and / or carrying code and / or instructions and / or data.

[0079] It should be understood that the embodiments described above are merely illustrative. The embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or any combination thereof. For hardware implementation, the processor may be implemented in one or more application-specific integrated circuits (ASIC) , digital signal processors (DSP) , digital signal processing devices (DSPD) , programmable logic devices (PLD) , field programmable gate arrays (FPGA) , processors, controllers, microcontrollers, microprocessors, and / or other electronic units designed to perform the functions described herein, or a combination thereof.

[0080] Some aspects of the present application may be completely executed by hardware, or may be completely executed by software (including firmware, resident software, microcode, etc. ) , or may be executed by a combination of hardware and software. The hardware or software described above may all be referred to as "data block" , "module" , "engine" , "unit" , "component" , or "system" . The processor may be one or more application-specific integrated circuits (ASIC) , digital signal processors (DSP) , digital signal processing devices (DAPD) , programmable logic devices (PLD) , field-programmable gate arrays (FPGA) , processors, controllers, microcontrollers, microprocessors, or a combination thereof. In addition, various aspects of the present application may be embodied as a computer product in one or more computer-readable media, and the product includes computer-readable program code. For example, the computer-readable medium may include, but is not limited to, a magnetic storage device (e.g., a hard disk, a floppy disk, a tape... ) , an optical disc (e.g., a compact disc (CD) , a digital versatile disc (DVD) ... ) , a smart card, and a flash memory device (e.g., a card, a stick, a key drive... ) .

[0081] The computer-readable medium may include a propagation data signal containing computer program code, for example, on a baseband or as a part of a carrier. The propagation signal may take various forms, including an electromagnetic form, an optical form, etc., or a suitable combination form. The computer-readable medium may be any computer-readable medium other than a computer-readable storage medium. The medium may be connected to an instruction execution system, apparatus, or device to implement communication, propagation, or transmission of a program for use. The program code located on the computer-readable medium can be propagated through any suitable medium, including radio, a cable, a fiber-optic cable, a radio frequency signal, or a similar medium, or any combination of the foregoing media.

[0082] The basic concepts have been described above. Obviously, for those skilled in the art, the above disclosure of the present application is merely used as an example and does not constitute a limitation on the present application. Those skilled in the art may make various modifications, improvements, and amendments to the present application, although it is not explicitly stated here. Such modifications, improvements, and amendments are suggested in the present application, and therefore, such modifications, improvements, and amendments still fall within the spirit and scope of exemplary embodiments of the present application.

[0083] Also, the present application uses specific words to describe the embodiments of the present application. For example, "one embodiment" , "an embodiment" , and / or "some embodiments" mean a feature, structure, or characteristic associated with at least one embodiment of the present application. Therefore, it should be emphasized and noted that two or more references to "an embodiment" , "one embodiment" , or "an alternative embodiment" in various places in this specification do not necessarily indicate the same embodiment. In addition, some features, structures, or characteristics in one or more embodiments of the present application may be combined appropriately.

[0084] In some embodiments, numbers for describing the number of compositions and attributes are used. It should be understood that such numbers used in the description of the embodiments are modified by the modifier "about" , "approximately" , or "substantially" in some examples. Unless otherwise stated, "about" , "approximately" , or "substantially" indicates that the number is allowed to vary by ±20%. Correspondingly, in some embodiments, the numerical parameters used in the specification and claims are approximate values, and the approximate values can be changed according to the required characteristics of individual embodiments. In some embodiments, for the numerical parameters, the specified significant digits should be taken into consideration, and a general digit reservation method should be used. Although the numerical ranges and parameters used to confirm the breadth of the ranges of the numerical parameters in some embodiments of the present application are approximate values, such numerical values need to be set as precisely as possible within a feasible range in specific embodiments.

Claims

1.An automatic addressing method, characterized by comprising:a configuration information querying step: sending, by a master, a configuration information querying command to each slave; and sending, by each slave, its own configuration information to the master based on a delayed reply time parameter and a current communication address in response to the configuration information querying command, wherein the configuration information comprises a slave serial number and an addressing record number, and the addressing record number is a mark for representing a batch of addressing;an addressing screening step: determining, by the master, whether there is a conflict between the respective current communication addresses of the slaves, and obtaining a slave whose communication address needs to be updated through screening based on a preset addressing algorithm and the addressing record numbers if it is determined that there is a conflict; and generating, by the master, an addressing slave list based on the slave whose communication address needs to be updated, wherein the addressing slave list comprises a slave serial number and a communication address corresponding to the slave serial number;a new address setting step: sending, by the master, a new address setting command to the corresponding slave based on the addressing slave list; and updating, by the slave, the current communication address based on a communication address in the new address setting command in response to the new address setting command; andan addressing confirming step: sending, by the master, an addressing record number of this batch and an addressing confirming command to each slave; and using, by each slave, the addressing record number of this batch as a latest addressing record number in response to the addressing confirming command.2.The automatic addressing method according to claim 1, characterized in that before the configuration information querying step, the method further comprises:an addressing mode entering step: broadcasting, by the master, an automatic addressing starting command and a delayed reply time parameter to each slave; and entering, by each slave, an automatic addressing mode and skipping replying to the master by default in response to the automatic addressing starting command, wherein the delayed reply time parameter comprises a minimum time for the slave to delay a reply to the master and a maximum time for the slave to delay a reply to the master, and the delayed reply time parameter is used to control the slave to reply to the master at a specific time.3.The automatic addressing method according to claim 2, characterized in that in the configuration information querying step, the step of sending, by each slave, its own configuration information to the master based on a delayed reply time parameter and a current communication address comprises:generating, by each slave, its own corresponding random number seed n, wherein the random number seed n of each slave is different, and the random number seed n is less than or equal to a preset multiple of a number of the slaves;generating, by each slave, a corresponding delayed reply time Td using the following formula:Td=n*Tminwherein Tmin represents the minimum time for the slave to delay a reply to the master, and the delayed reply time Td is less than or equal to the maximum time Nmax for the slave to delay a reply to the master; andsending, by each slave, its own slave serial number and a current addressing record number to the master based on the current communication address after waiting for the corresponding delayed reply time Td.4.The automatic addressing method according to claim 1, characterized in that after the step of sending, by each slave, its own configuration information to the master based on a delayed reply time parameter and a current communication address, the configuration information querying step further comprises:collecting, by the master, a combination of a valid slave serial number, addressing record number, and communication address;broadcasting, by the master, a silence command to the corresponding slave based on the collected slave serial number;stopping, by the slave, replying to the configuration information querying command in response to the silence command; andrepeating the configuration information querying step until no slave replies to the configuration information querying command.5.The automatic addressing method according to claim 1, characterized in that in the addressing screening step, the step of obtaining a slave whose communication address needs to be updated through screening based on a preset addressing algorithm and the addressing record number comprises: adding, by the master, slaves with a communication address conflict to a first slave group, and adding slaves without a communication address conflict to a second slave group; and obtaining, by the master, the slave whose communication address needs to be updated in the first slave group through screening based on the addressing record number of each slave in the first slave group and the addressing record number of each slave in the second slave group.6.The automatic addressing method according to claim 5, characterized in that in the addressing screening step, the steps of obtaining, by the master, the slave whose communication address needs to be updated in the first slave group through screening based on the addressing record number of each slave in the first slave group and the addressing record number of each slave in the second slave group, and generating, by the master, an addressing slave list based on the slave whose communication address needs to be updated comprise:Step a: selecting, by the master, two slaves with the same communication address from the first slave group as a slave A and a slave B respectively, wherein current communication addresses of the slave A and the slave B are both address01;Step b: determining, by the master, whether there is an addressing record number that is the same as an addressing record number of the slave A in the second slave group, and determining, by the master, whether there is an addressing record number that is the same as an addressing record number of the slave B in the second slave group;Step c: assigning, by the master, the communication address address01 to the slave A and assigning an unused new communication address with a low value to the slave B if it is determined that there is the addressing record number that is the same as the addressing record number of the slave A, and there is no addressing record number that is the same as the addressing record number of the slave B; andStep d: generating, by the master, the addressing slave list SlaveList based on the slave B.7.The automatic addressing method according to claim 6, characterized in that in the addressing screening step, if there are a plurality of slaves with the same communication address in the first slave group, the steps a to d are repeated until there are no slaves with the same communication address in the first slave group.8.The automatic addressing method according to claim 1, characterized in that in the new address setting step, the step of updating, by the slave, the current communication address based on a communication address in the new address setting command comprises:determining, by the slave, whether a slave serial number in the new address setting command is the same as its own slave serial number;using, by the slave, the communication address in the new address setting command as the current communication address, and replying to the master with a successful addressing command if it is determined that the slave serial numbers are the same; or skipping, by the slave, replying to the master if it is determined that the slave serial numbers are not the same.9.The automatic addressing method according to any one of claims 1 to 8, characterized in that after the addressing confirming step, the method further comprises:an addressing mode exiting step: broadcasting, by the master, an addressing mode exiting command to each slave; determining, by the slave, whether the addressing confirming command is received in response to the addressing mode exiting command; exiting, by the slave, the addressing mode if it is determined that the addressing confirming command is received; or discarding, by the slave, an addressing result of this batch if it is determined that the addressing confirming command is not received.10.The automatic addressing method according to claim 9, characterized in that after the addressing mode exiting step, the method further comprises:an addressing result rechecking step: sending, by the master, a slave serial number querying command to the corresponding slave based on the communication address in the addressing slave list; sending, by the slave, its own slave serial number to the master in response to the slave serial number querying command; and determining, by the master, whether the received slave serial number matches the slave serial number in the addressing slave list, and giving, by the master, an alarm to prompt that the addressing is unsuccessful if it is determined that the slave serial numbers do not match.11.An automatic addressing system, characterized by comprising:a memory configured to store instructions executable by a processor; andthe processor configured to execute the instructions to implement the automatic addressing method according to any one of claims 1 to 10.12.A computer-readable medium storing computer program code, characterized in that the computer program code, when executed by a processor, implements the automatic addressing method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Method for setting addresses of slave devices in communication network

    US20140173013A1

  • Method for resolving an address conflict for modbus RTU standard protocol

    US20200125515A1