Multi-slave address adaptive control method and system and readable storage medium

By using constant current and equivalent resistance in a multi-machine parallel system to determine the slave position and generate the address code, the problem of unstable slave address configuration and node failure in the prior art is solved, and automatic slave address confirmation and product efficiency improvement are achieved.

CN119814492APending Publication Date: 2025-04-11SUZHOU JK ENERGY LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411936678.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The existing multi-machine parallel system has problems such as garbled code in the slave address configuration, inflexible user scenarios, and node failure, resulting in all subsequent failures.

Method used

The host outputs a constant current to the series bus, and the target slave determines the voltage value based on the constant current and its own equivalent resistance, and then determines its own position relative to the host, generates an address code and sends it to the host, and the host polls the slave based on the address code.

Benefits of technology

It realizes automatic address confirmation of slave machines, avoids the cross-chaotic address code caused by job errors, reduces manual configuration, improves the product's full life efficiency, and avoids all subsequent failures caused by intermediate side failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119814492A_ABST
    Figure CN119814492A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of master-slave communication, and discloses a multi-slave address adaptive control method and system and a readable storage medium, all slaves are connected in series by taking a host as a head through a series bus, the host outputs a constant current to the series bus, and a target slave performs address adaptive control on the target slave based on the constant current and an equivalent resistance corresponding to the target slave. The corresponding voltage value is determined, the position of the target slave relative to the host is determined, an address code is generated and sent to the host through the communication bus, and the equivalent resistance corresponding to the target slave is the sum of the resistance value corresponding to the slave passed by the constant current output by the host in the process of flowing to the target slave and the resistance value corresponding to the target slave; according to the invention, the slave computer automatically realizes address confirmation based on the signal output by the host computer, avoids the situation that single-computer address codes are crossed and disordered due to operation errors, reduces single-computer manual configuration, improves the full-life efficiency of products, and solves the problems that the middle side is invalid and all the rear stages are invalid possibly in a multi-stage transmission mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of master-slave communication, and in particular to a method and system for adaptively controlling addresses of multiple slave machines and a readable storage medium. Background Art

[0002] A multi-machine parallel system is a device in which a core master coordinates the operation of each part through a communication bus, such as multiple battery systems / modules in parallel for capacity / power expansion, multiple power conversion systems (PCS) and multiple programmable logic controllers (PLC). The current common solution to achieve coordinated operation of each part is to configure single-machine address codes for multiple slaves in advance (software ID distinction, single-board configuration distinction), hardware dip switches or hand-in-hand signal transmission wake-up, but there may be problems such as cross-code garbled characters in the address codes corresponding to multiple slaves configured in advance, inflexible user scenarios, and failure of a certain node, resulting in failure of all subsequent stages. Summary of the invention

[0003] In view of this, the present invention provides a multi-slave address adaptive control method, system and readable storage medium to solve the problem that the address codes corresponding to multiple slaves configured in advance may subsequently appear cross-garbled, the user scenario is inflexible, and a certain node fails, resulting in the failure of all subsequent stages.

[0004] In a first aspect, the present invention provides a multi-slave address adaptive control method, which is applied to a host in a multi-slave address adaptive control system, wherein the multi-slave address adaptive control system also includes multiple slaves, wherein the host and the slaves are connected in parallel via a communication bus, and all the slaves are connected in series with the host as the first through a series bus, and the method includes: outputting a constant current to the series bus so that the target slave determines a corresponding voltage value based on the constant current output by the host and its own equivalent resistance, determines its own position relative to the host based on the corresponding voltage value, generates an address code and sends it to the host via the communication bus, wherein the target slave is any one of all the slaves, and the equivalent resistance corresponding to the target slave is the sum of the resistance value corresponding to the slave through which the constant current output by the host passes in the process of flowing to the target slave and the resistance value corresponding to the target slave, wherein the resistance value corresponding to each slave is the same; receiving the address codes replied by all the slaves respectively through the communication bus, and polling the slaves based on the address code.

[0005] In an optional embodiment, before outputting a constant current to a series bus, the method further includes: outputting a current constant current and obtaining a voltage value output based on the current constant current; determining whether the output voltage value is within a preset voltage standard range; if the output voltage value is within the preset voltage standard range, locking the current constant current as a constant current output to the series bus, and executing the step of outputting the constant current to the series bus.

[0006] Before outputting the constant current to the series bus, the present invention can determine in advance whether the constant current output to the series bus meets the current condition for ensuring the operation of the system. Only when the condition is met, the constant current is output to the series bus to ensure the normal operation of the system.

[0007] In an optional embodiment, if the output voltage value is not within the preset voltage standard range, the method further includes: adjusting the output constant current based on the current constant current, the output voltage value and the preset voltage standard range, until the voltage value based on the constant current output is within the preset voltage threshold range; locking the adjusted constant current as the constant current output to the series bus, and executing the step of outputting the constant current to the series bus.

[0008] If the present invention determines that the output voltage value is not within the voltage standard range, the output constant current is adjusted until the output voltage value is within the voltage standard range, ensuring that the constant current flowing through the series bus meets the current condition of system operation.

[0009] In an optional embodiment, the preset voltage standard range includes a preset voltage threshold and two standard weights, and the output constant current is adjusted based on the current constant current, the output voltage value and the preset voltage threshold range, including: calculating the product of the preset voltage threshold and a preset first weight to obtain a first product, and the preset first weight is between the two standard weights; dividing the first product by the output voltage value to obtain a first ratio; multiplying the first ratio by the current constant current value to obtain an adjusted constant current.

[0010] The present invention adjusts the current source output in proportion based on the standard weight, the preset voltage threshold, the current constant current and the output voltage, and can accurately and quickly adjust the constant current output to the series bus, thereby improving the self-test efficiency.

[0011] In an optional embodiment, the following steps are used to determine whether all slaves have generated address codes: determine whether the number of slaves that reply with address codes via the communication bus reaches a pre-detected total number of online slaves, the pre-detected total number of online slaves being the pre-output of a constant current to the series bus, obtaining a total voltage after the constant current flows through all slaves on the series bus, and determining the total number of online slaves based on the total voltage; if the number of slaves that reply with address codes via the communication bus reaches a pre-detected total number of slaves, it is determined that all slaves have generated address codes.

[0012] The host of the present invention determines the total number of online slaves based on the output constant current and the total voltage obtained based on the constant current in advance, and can accurately judge whether all slaves have completed addressing based on the total number of online slaves.

[0013] In an optional embodiment, if the number of slaves that reply to the address code through the communication bus does not reach the total number of slaves detected in advance, the method further includes: determining the position of the slaves that do not reply to the address code relative to the host based on all slaves that reply to the address code and the total number of online slaves detected in advance; and displaying the position of the slaves that do not reply to the address code relative to the host to the user.

[0014] Based on the predetermined total number of slaves and the slaves that reply to the address code via the communication bus, the present invention can directly and quickly determine the position of the slaves that do not reply to the address code relative to the host, and then display the abnormal slave position on the user interface.

[0015] In an optional embodiment, when the multi-slave address adaptive control system is in a sleep state, in response to a system wake-up command submitted by a user, the total number of online slaves is detected; a wake-up command is sent to the communication bus to wake up all slaves, and the step of outputting a constant current to the series bus is executed.

[0016] In a second aspect, the present invention provides a multi-slave address adaptive control method, which is applied to a target slave in a multi-slave address adaptive control system, wherein the target slave is any one of all slaves, and the multi-slave address adaptive control system also includes a host, wherein the host and the slaves are connected in parallel via a communication bus, and all slaves are connected in series with the host as the first through a series bus, and the method includes: determining a corresponding voltage value based on a constant current output by the host and an equivalent resistance corresponding to itself, wherein the constant current is output by the host to the series bus, and the equivalent resistance corresponding to the target slave is the sum of the resistance values ​​corresponding to the slaves through which the constant current output by the host passes in the process of flowing to the target slave and the resistance value corresponding to the target slave, wherein the resistance value corresponding to each slave is the same; determining its own position relative to the host based on the corresponding voltage value, generating an address code and sending it to the host via the communication bus, so that the host receives the address codes replied by all slaves respectively through the communication bus, and polls the slaves based on the address code.

[0017] In a third aspect, the present invention provides a multi-slave address adaptive control system, the system comprising a host and multiple slaves, the host and slaves being connected in parallel via a communication bus, and all slaves being connected in series with the host as the first via a series bus, wherein the host outputs a constant current to the series bus; the target slave determines a corresponding voltage value based on the constant current output by the host and its own equivalent resistance, the target slave being any one of all the slaves, the equivalent resistance corresponding to the target slave being the sum of the resistance value corresponding to the slave through which the constant current output by the host passes in the process of flowing to the target slave and the resistance value corresponding to the target slave, wherein the resistance value corresponding to each slave is the same; the target slave determines its own position relative to the host based on the corresponding voltage value, generates an address code and sends it to the host via the communication bus; the host receives the address codes replied by all the slaves respectively via the communication bus, and polls the slaves based on the address code.

[0018] The present invention provides a multi-slave address adaptive control system, in which a host and slaves are connected in parallel via a communication bus, and all slaves are connected in series with the host as the first through a series bus, the host outputs a constant current to the series bus, the target slave determines a corresponding voltage value based on the constant current and its own corresponding equivalent resistance, and then determines its own position relative to the host, generates an address code and sends it to the host via the communication bus, and the host polls the slave based on the address code, wherein the equivalent resistance corresponding to the target slave is the sum of the resistance value corresponding to the slave passed by the constant current output by the host in the process of flowing to the target slave and the resistance value corresponding to the target slave, thereby realizing automatic address confirmation of the slave based on the signal output by the host, avoiding the situation where operation errors lead to cross confusion of the address code of a single machine, reducing the manual configuration of a single machine, improving the full life efficiency of the product, and solving the problem that the multi-stage transmission type may have failures on the middle side and all failures of the back stage.

[0019] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the multi-slave address adaptive control method of the above-mentioned first aspect or any corresponding embodiment thereof, or to execute the multi-slave address adaptive control method of the above-mentioned second aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 is a schematic diagram of the structure of a multi-slave address adaptive control system according to an embodiment of the present invention;

[0022] Figure 2 is a structural example diagram of a one-master-multiple-slave system according to an embodiment of the present invention;

[0023] Figure 3 is a structural example diagram of a host according to an embodiment of the present invention;

[0024] Figure 4 is a diagram showing an example structure of a slave according to an embodiment of the present invention;

[0025] Figure 5 is an example diagram of a process flow of a host output constant current self-test according to an embodiment of the present invention;

[0026] Figure 6 is an example diagram of a process flow of multi-slave address adaptive control according to an embodiment of the present invention;

[0027] Figure 7 is a schematic diagram of interaction between a host and a target slave according to an embodiment of the present invention;

[0028] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0030] The embodiment of the present invention provides a multi-slave address adaptive control system, such as Figure 1 As shown, the system includes a host 1 and multiple slaves, the host 1 and the slaves are connected in parallel through a communication bus, and all the slaves are connected in series with the host 1 as the first through a series bus, wherein the host 1 outputs a constant current to the series bus; the target slave 2 determines the corresponding voltage value based on the constant current output by the host 1 and its own equivalent resistance, the target slave 2 is any one of all the slaves, and the equivalent resistance corresponding to the target slave 2 is the sum of the resistance value corresponding to the slave through which the constant current output by the host 1 passes in the process of flowing to the target slave 2 and the resistance value corresponding to the target slave 2, wherein the resistance value corresponding to each slave is the same; the target slave 2 determines its own position relative to the host 1 based on the corresponding voltage value, generates an address code and sends it to the host 1 through the communication bus; the host 1 receives the address codes replied by all the slaves through the communication bus respectively, and polls the slaves based on the address code.

[0031] The embodiment of the present invention is applied to a multi-machine parallel system, that is, a core master coordinates the operation of each part through a communication bus, such as Figure 2 As shown, the application scenario is an electrical scenario (multiple PCS devices), and the multi-slave address adaptive control system includes a host 1 (Energy Management System (EMS)) and multiple slaves (Battery Management Unit (BMU X) where X represents multiple slaves), wherein the host 1 and the slaves are connected in parallel via a communication bus (double solid lines are the communication bus) for transmission of data signals, and all the slaves are connected in series with the host 1 as the first through a series bus (single solid line is the series bus) for detecting and identifying the location address of the slave; Figure 3 As shown, the host 1 of the embodiment of the present invention is used for signal output, which may include but is not limited to a communication module, a microcontroller unit (MCU), MCU peripherals, addressing control output detection and addressing signal output and feedback, etc.; Figure 4As shown, the slave is used for signal reception and operational amplifier signal conditioning (OPA), including but not limited to MCU, communication module, OPA signal conditioning and signal detection, etc., wherein the dotted line in the figure represents the power line and the solid line represents the signal line, which is only for example.

[0032] The constant current source of the host 1 of the embodiment of the present invention outputs a constant current to the series bus, and the constant current flows through all slaves through the series bus. The target slave 2 can determine the corresponding voltage value based on the constant current flowing through and the equivalent resistance corresponding to itself, wherein the target slave 2 is any one of all the slaves, because, in the series circuit, the current has only one path to go, and each resistor will have an obstructive effect on the current, that is, the series connection of resistors is equal to the increase of the length of the resistor. Therefore, the equivalent resistance corresponding to the target slave 2 can be the sum of the resistance values ​​corresponding to all slaves passed by the current output by the host 1 in the process of flowing to the target slave 2 and the resistance value corresponding to the target slave, and the resistance value corresponding to each slave is the same. For example, the target slave 2 is at the fifth slave position relative to the host 1, and the resistance value of each slave is 1K, then the equivalent resistance value corresponding to the target slave 2 is 1K*4+1K=5K, just as an example, then the target slave 2 can determine the corresponding voltage value based on the constant current and the equivalent current corresponding to itself, for example, the constant current is 1mA, and its corresponding voltage value is 5V, just as an example.

[0033] The target slave 2 of the embodiment of the present invention can determine its position relative to the host 1 based on the corresponding voltage value when knowing the resistance and the output constant current, and generate an address code. For example, if the target slave 2 determines that it is at the fifth position relative to the host 1, it can generate an address code of 05 and send it to the host 1 through the communication bus. After the host 1 receives the address codes sent by all slaves, it can know the positions of all slaves and can poll all slaves based on the address codes. This is just an example.

[0034] The present invention provides a multi-slave address adaptive control system, in which a host and slaves are connected in parallel via a communication bus, and all slaves are connected in series with the host as the first through a series bus, the host outputs a constant current to the series bus, the target slave determines a corresponding voltage value based on the constant current and its own corresponding equivalent resistance, and then determines its own position relative to the host, generates an address code and sends it to the host via the communication bus, and the host polls the slave based on the address code, wherein the equivalent resistance corresponding to the target slave is the sum of the resistance value corresponding to the slave passed by the constant current output by the host in the process of flowing to the target slave and the resistance value corresponding to the target slave, thereby realizing automatic address confirmation of the slave based on the signal output by the host, avoiding the situation where operation errors lead to cross confusion of the address code of a single machine, reducing the manual configuration of a single machine, improving the full life efficiency of the product, and solving the problem that the multi-stage transmission type may have failures on the middle side and all failures of the back stage.

[0035] In an optional embodiment, before the host 1 outputs a constant current to the series bus, the host 1 outputs the current constant current and obtains a voltage value based on the current constant current output; determines whether the output voltage value is within a preset voltage standard range; if the output voltage value is within the preset voltage standard range, locks the current constant current as a constant current output to the series bus, and executes the step of outputting the constant current to the series bus.

[0036] like Figure 5 As shown, the MCU of the host 1 outputs a self-test signal, the address signal pin outputs a signal, the constant current source outputs the current constant current, and obtains the voltage value output by the host 1 based on the current constant current, and determines whether the output voltage value is within the preset voltage standard range, wherein the setting of the preset voltage standard range is not limited, and it can be set according to the standard voltage range required by the actual application scenario, and the voltage standard range may include a preset voltage threshold and two standard weights, such as the preset voltage threshold is 3.3V, and the two standard weights are 70% and 90%, just as an example; if it is determined that the output voltage value is within the preset voltage standard range, the current constant current is locked as the constant current output to the series bus, the self-test of the host 1 is completed, and the constant current is output to the series bus.

[0037] Before outputting the constant current to the series bus, the present invention can determine in advance whether the constant current output to the series bus meets the current condition for ensuring the operation of the system. Only when the condition is met, the constant current is output to the series bus to ensure the normal operation of the system.

[0038] In an optional embodiment, if the output voltage value is not within the preset voltage standard range, the host 1 adjusts the output constant current based on the current constant current, the output voltage value and the preset voltage standard range until the voltage value based on the constant current output is within the preset voltage threshold range; the adjusted constant current is locked as the constant current output to the series bus, and the step of outputting the constant current to the series bus is executed.

[0039] like Figure 5 As shown, in the embodiment of the present invention, if it is determined that the output voltage value is not within the preset voltage standard range, the output constant current can be adjusted based on the current constant current, the output voltage value and the preset voltage standard range. For example, if the output voltage value exceeds the voltage standard range, the output constant current can be appropriately reduced. This is only an example and is not limited to this. After adjusting the constant current, it can be determined whether the voltage value output based on the adjusted constant current meets the preset voltage standard range. If it does not meet the requirements, the adjustment is continued until the voltage value output based on the constant current is within the preset voltage threshold range. The adjusted constant current that meets the requirements is locked as the constant current output to the series bus, indicating that the host 1 self-check is completed and the constant current is output to the series bus.

[0040] If the present invention determines that the output voltage value is not within the voltage standard range, the output constant current is adjusted until the output voltage value is within the voltage standard range, ensuring that the constant current flowing through the series bus meets the current condition of system operation.

[0041] Specifically, the preset voltage standard range includes a preset voltage threshold and two standard weights. The host 1 adjusts the output constant current based on the current constant current, the output voltage value and the preset voltage threshold range, including: calculating the product of the preset voltage threshold and the preset first weight to obtain the first product, and the preset first weight is between the two standard weights; dividing the first product and the output voltage value to obtain a first ratio; multiplying the first ratio by the current constant current value to obtain the adjusted constant current.

[0042] After the embodiment of the present invention determines that the output voltage value is not within the preset voltage standard range, the product of the preset voltage threshold and the preset first weight can be calculated to obtain the first product, wherein the first weight is between the two standard weights, for example, the two standard weights are 70% and 90% respectively, then the corresponding first weight can be set to 80%, just as an example, and then the first product and the output voltage value can be divided to obtain the first ratio, and finally the first ratio is multiplied by the current constant current value to obtain the adjusted constant current, specifically referring to the following formula:

[0043]

[0044] Among them, T' setRepresents the adjusted constant current; T set Indicates the current constant current of the output; VCC indicates the preset voltage threshold; V set Indicates the voltage value based on the current constant current output.

[0045] The present invention adjusts the current source output in proportion based on the standard weight, the preset voltage threshold, the current constant current and the output voltage, and can accurately and quickly adjust the constant current output to the series bus, thereby improving the self-test efficiency.

[0046] In an optional embodiment, the host 1 determines that all slaves have generated address codes through the following steps: determine whether the number of slaves that reply to the address code through the communication bus reaches the total number of online slaves detected in advance, the total number of online slaves detected in advance is to output a constant current to the series bus in advance, obtain the total voltage obtained after the constant current flows through all slaves on the series bus, and determine the total number of online slaves based on the total voltage; if the number of slaves that reply to the address code through the communication bus reaches the total number of slaves detected in advance, it is determined that all slaves have generated address codes.

[0047] The host 1 of the embodiment of the present invention can obtain the total number of online slaves in advance, where online means that the slave is installed in the product, that is, the host 1 outputs a constant current to the series bus in advance, and obtains the total voltage obtained after the constant current flows through all slaves on the series bus, and then determines the total number of online slaves based on the total voltage. For example, the resistance of each slave is 1K, the constant current value is 1mA, and the total voltage obtained is 10v, then it can be determined that the total number of online slaves is 10, just as an example. After receiving the slave that replies to the address code through the communication bus, the host 1 determines whether the number of slaves that have received the address code has reached the total number of online slaves. If the number of slaves that reply to the address code through the communication bus reaches the total number of slaves, it can be determined that all slaves have generated address codes, and the online slaves can be polled based on the address code.

[0048] The host of the present invention determines the total number of online slaves based on the output constant current and the total voltage obtained based on the constant current in advance, and can accurately judge whether all slaves have completed addressing based on the total number of online slaves.

[0049] In an optional embodiment, if the number of slaves that reply to the address code through the communication bus does not reach the total number of slaves detected in advance, the host 1 determines the position of the slaves that do not reply to the address code relative to the host 1 based on all slaves that reply to the address code and the total number of online slaves detected in advance; and displays the position of the slaves that do not reply to the address code relative to the host 1 to the user.

[0050] If the host 1 of the embodiment of the present invention determines that the number of slaves that reply to the address code through the communication bus does not reach the total number of slaves detected in advance, then the position of the slaves that did not reply to the address code relative to the host 1 can be determined based on the slaves that replied to the address code and the total number of online slaves detected in advance. For example, the host 1 detects that the number of online slaves is 5, and the corresponding address codes should be 01, 02, 03, 04 and 05, but only the address codes of 01, 02, 03 and 05 are received. Therefore, it can be determined that the slave corresponding to the address code of 04 is abnormal. As an example only, the position of the slave that did not reply to the address code relative to the host 1 can be displayed to the user.

[0051] Based on the predetermined total number of slaves and the slaves that reply to the address code via the communication bus, the present invention can directly and quickly determine the position of the slaves that do not reply to the address code relative to the host, and then display the abnormal slave position on the user interface.

[0052] In an optional embodiment, when the multi-slave address adaptive control system is in a sleep state, the host 1 responds to a system wake-up command submitted by the user, detects the total number of online slaves, sends a wake-up command to the communication bus to wake up all slaves, and executes the step of outputting a constant current to the series bus.

[0053] like Figure 6 As shown, when the multi-slave address adaptive control system of the embodiment of the present invention is in a dormant state, the host 1 responds to the system wake-up instruction of the user's physical examination. After being awakened, it can output a constant current, and obtain the total voltage obtained after the constant current flows through all slaves on the series bus, and determine the total number of online slaves based on the total voltage, and can send a wake-up instruction to the communication bus to wake up all slaves. The host 1 outputs a constant current to the series bus, so that the slave determines the corresponding voltage value based on the constant current and the equivalent resistance corresponding to itself, and then determines its position relative to the host 1 based on the corresponding voltage value, generates an address code, and replies the address code to the host 1 through the communication bus. The host 1 determines whether all slaves have completed addressing based on the number of slaves. If all slaves have completed addressing, the host 1 polls the online slaves based on the address code. If the address code fed back by a slave is not received, the position of the slave that has not replied to the address code relative to the host 1 is determined based on all slaves that replied to the address code and the total number of online slaves detected in advance, and the position of the slave that has not replied to the address code relative to the host 1 is displayed to the user. For detailed description, please refer to the above embodiment, which will not be repeated here.

[0054] The embodiment of the present invention also provides a method for adaptively controlling multiple slave addresses, which is applied to Figure 1 The host 1 and the target slave 2 are shown, wherein the host and the slave are connected in parallel via a communication bus, and all the slaves are connected in series via a serial bus with the host as the first, as shown in FIG. Figure 7As shown, the host 1 is used to execute steps S101 to S102, and the target slave 2 is used to execute steps S201 to S202.

[0055] Step S101, outputting a constant current to the series bus.

[0056] Step S102, receiving the address codes replied by all slaves through the communication bus, and polling the slaves based on the address codes.

[0057] Step S201, based on the constant current output by the host and its own corresponding equivalent resistance, determine the corresponding voltage value, wherein the target slave is any one of all the slaves, and the equivalent resistance corresponding to the target slave is the sum of the resistance value corresponding to the slave through which the constant current output by the host passes in the process of flowing to the target slave and the resistance value corresponding to the target slave, and the resistance value corresponding to each slave is the same

[0058] Step S202, determining its position relative to the host based on the corresponding voltage value, generating an address code and sending it to the host via the communication bus.

[0059] Please refer to the above embodiments for detailed description, which will not be repeated here.

[0060] The present invention provides a multi-slave address adaptive control method, in which a host and slaves are connected in parallel via a communication bus, and all slaves are connected in series with the host as the first through a series bus, the host outputs a constant current to the series bus, the target slave determines a corresponding voltage value based on the constant current and its own corresponding equivalent resistance, and then determines its own position relative to the host, generates an address code and sends it to the host via the communication bus, the host polls the slave based on the address code, wherein the equivalent resistance corresponding to the target slave is the sum of the resistance value corresponding to the slave passed by the constant current output by the host in the process of flowing to the target slave and the resistance value corresponding to the target slave, so that the slave automatically realizes address confirmation based on the signal output by the host, avoids the situation where the operation error leads to the cross confusion of the address code of a single machine, reduces the manual configuration of the single machine, improves the full life efficiency of the product, and solves the problem that the multi-stage transmission type may have a failure on the middle side and all failures of the back stage.

[0061] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.

[0062] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0063] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0064] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0065] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0066] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.

[0067] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0068] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0069] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0070] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for adaptively controlling multiple slave addresses, characterized in that: A host applied to a multi-slave address adaptive control system, wherein the multi-slave address adaptive control system further comprises a plurality of slaves, wherein the host and the slaves are connected in parallel via a communication bus, and all the slaves are connected in series with the host as the first via a series bus, and the method comprises: Output a constant current to the series bus, so that the target slave determines a corresponding voltage value based on the constant current output by the host and its own equivalent resistance, determines its own position relative to the host based on the corresponding voltage value, generates an address code and sends it to the host through the communication bus, the target slave is any one of all the slaves, the equivalent resistance corresponding to the target slave is the sum of the resistance value corresponding to the slave through which the constant current output by the host passes in the process of flowing to the target slave and the resistance value corresponding to the target slave, wherein the resistance value corresponding to each slave is the same; Receive the address codes replied by all slaves through the communication bus respectively, and poll the slaves based on the address codes.

2. The method according to claim 1, characterized in that Before outputting the constant current to the series bus, the method further includes: Outputting a current constant current, and obtaining a voltage value based on the current constant current output; Determining whether the output voltage value is within a preset voltage standard range; If the output voltage value is within the preset voltage standard range, the current constant current is locked as the constant current output to the series bus, and the step of outputting the constant current to the series bus is performed.

3. The method according to claim 2, characterized in that If the output voltage value is not within the preset voltage standard range, the method further includes: Based on the current constant current, the output voltage value and the preset voltage standard range, the output constant current is adjusted until the voltage value output based on the constant current is within the preset voltage threshold range; The adjusted constant current is locked as the constant current output to the series bus, and the step of outputting the constant current to the series bus is performed.

4. The method according to claim 3, characterized in that The preset voltage standard range includes a preset voltage threshold and two standard weights, and the output constant current is adjusted based on the current constant current, the output voltage value and the preset voltage threshold range, including: Calculating a product of a preset voltage threshold and a preset first weight to obtain a first product, wherein the preset first weight is between the two standard weights; Performing a division operation on the first product and the output voltage value to obtain a first ratio; The first ratio is multiplied by the current constant current value to obtain an adjusted constant current.

5. The method according to claim 1, characterized in that Use the following steps to ensure that all slaves generate address codes: Determine whether the number of slaves replying the address code through the communication bus reaches the total number of online slaves detected in advance, the total number of online slaves detected in advance is to output a constant current to the series bus in advance, obtain the total voltage obtained after the constant current flows through all slaves on the series bus, and determine the total number of online slaves based on the total voltage; If the number of slaves replying the address code via the communication bus reaches the total number of slaves detected in advance, it is determined that all slaves have generated the address code.

6. The method according to claim 5, characterized in that If the number of slaves replying the address code via the communication bus does not reach the total number of slaves detected in advance, the method further includes: Based on all slaves that reply to the address code and the total number of online slaves detected in advance, determine the position of the slave that does not reply to the address code relative to the host; The position of the slave that has not responded to the address code relative to the master is displayed to the user.

7. The method according to claim 5, characterized in that When the multi-slave address adaptive control system is in a dormant state, in response to a system wake-up instruction submitted by a user, a total value of the number of online slaves is detected; Sending a wake-up command to the communication bus so that all slaves are awakened, and executing the step of outputting a constant current to the series bus.

8. A method for adaptively controlling multiple slave addresses, characterized in that: The method is applied to a target slave in a multi-slave address adaptive control system, wherein the target slave is any one of all slaves, and the multi-slave address adaptive control system further comprises a host, wherein the host and the slaves are connected in parallel via a communication bus, and all the slaves are connected in series with the host as the first via a series bus, and the method comprises: Determine the corresponding voltage value based on the constant current output by the host and the equivalent resistance corresponding to the host, wherein the constant current is output by the host to the series bus, and the equivalent resistance corresponding to the target slave is the sum of the resistance value corresponding to the slave through which the constant current output by the host passes in the process of flowing to the target slave and the resistance value corresponding to the target slave, wherein the resistance value corresponding to each slave is the same; The position of the slave device relative to the host is determined based on the corresponding voltage value, an address code is generated and sent to the host device through the communication bus, so that the host device receives the address codes replied by all slave devices through the communication bus respectively, and polls the slave devices based on the address code.

9. A multi-slave address adaptive control system, characterized in that: The system includes a host and multiple slaves, wherein the host and the slaves are connected in parallel via a communication bus, and all the slaves are connected in series with the host as the first through a series bus, wherein: The host outputs a constant current to the series bus; The target slave determines a corresponding voltage value based on the constant current output by the host and its own equivalent resistance, wherein the target slave is any one of all the slaves, and the equivalent resistance corresponding to the target slave is the sum of the resistance values ​​corresponding to the slaves through which the constant current output by the host passes in the process of flowing to the target slave and the resistance value corresponding to the target slave, wherein the resistance value corresponding to each slave is the same; The target slave determines its position relative to the host based on the corresponding voltage value, generates an address code and sends it to the host via the communication bus; The host receives the address codes replied by all the slaves through the communication bus, and polls the slaves based on the address codes.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the multi-slave address adaptive control method described in any one of claims 1 to 7, or to execute the multi-slave address adaptive control method described in claim 8.