Coding method, device and electronic device of a slave machine

By obtaining and verifying the actual voltage related to the slave, the slave encoding is automatically determined, which solves the problems of complex and limited encoding in the prior art, and realizes automatic identification and efficient encoding of slave addresses.

CN113887947BActive Publication Date: 2025-06-17SVOLT ENERGY TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111162325.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-06-17
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

The product encoding process of the existing master-slave mechanism is complicated and cumbersome and is not conducive to product maintenance. In particular, the encoding of the dial switch method is limited to the number of slaves and is prone to repeated encoding.

Method used

By obtaining multiple actual voltages related to the slave in a preset time period, it is determined whether these actual voltages are valid. When valid, the encoding of the slave is determined based on these actual voltages, and the automatic identification of the slave address is realized.

Benefits of technology

It realizes automatic identification of slave address, reduces installation and maintenance work, improves efficiency, avoids duplication and missing coding problems caused by human coding operation errors, and improves coding efficiency during product installation and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113887947B_ABST
    Figure CN113887947B_ABST
Patent Text Reader

Abstract

The present invention discloses a coding method, device and electronic device for a slave device, including: obtaining a plurality of actual voltages related to the slave device within a preset time period; determining whether the plurality of actual voltages are valid; when the actual voltages are valid, determining the coding of the slave device according to the plurality of actual voltages. By automatically identifying the slave device address, the present invention enables the slave device to identify the slave device address without manual coding during installation and maintenance, reduces installation and maintenance work, improves efficiency, avoids the troubles of duplicate and missing coding caused by human coding operation errors, and improves the coding efficiency during the installation and maintenance of the product.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of device coding, and in particular, to a coding method, device and electronic device for a slave device. Background Art

[0002] Currently, in products with a master-slave mechanism (multiple slave devices), the coding of slave devices usually adopts preset coding, or DIP switch coding, or both preset coding and DIP switch coding are used simultaneously. Preset coding is to set the coding (number) of the slave device by writing through software according to the installation position during product installation. DIP switch coding is also to let the slave device software recognize the position of the DIP switch through the DIP switch before product installation, so as to recognize the slave device address.

[0003] Among them, both preset coding and DIP switch coding are prone to duplicate coding, and when replacing, swapping, or deleting slave devices, it is necessary to reset the slave device number or select by DIP switch, which is not conducive to product maintenance. In particular, the coding of the DIP switch method has great limitations on the number of slave devices. For example, 4 DIP switches can only code 2 4 ^4 = 16 slave devices. Summary of the Invention

[0004] Therefore, the technical problem to be solved by the present invention is to overcome the defects that the product coding process of the existing master-slave mechanism is complex and cumbersome and not conducive to product maintenance, so as to provide a coding method, device and electronic device for a slave device.

[0005] According to a first aspect, an embodiment of the present invention discloses a coding method for a slave device, including: obtaining a plurality of actual voltages related to the slave device within a preset time period; determining whether the plurality of actual voltages are valid; when the actual voltages are valid, determining the coding of the slave device according to the plurality of actual voltages.

[0006] Optionally, in the case of no host interference, the obtaining a plurality of actual voltages related to the slave device within a preset time period includes: obtaining a plurality of front-end actual voltages at the front end of the slave device and a plurality of back-end actual voltages at the back end of the slave device within a preset time period; in the case of host interference, the obtaining a plurality of actual voltages related to the slave device within a preset time period includes: obtaining the addressing voltages of a plurality of slave devices within a preset time period.

[0007] Optionally, in the absence of host interference, determining whether the plurality of actual voltages are valid includes: calculating the maximum value, average value, and minimum value of the plurality of front-end actual voltages respectively according to the plurality of front-end actual voltages to obtain a front-end maximum value, a front-end average value, and a front-end minimum value; calculating the maximum value, average value, and minimum value of the plurality of back-end actual voltages respectively according to the plurality of back-end actual voltages to obtain a back-end maximum value, a back-end average value, and a back-end minimum value; when the difference between the front-end maximum value and the front-end average value, the difference between the front-end average value and the front-end minimum value, the difference between the back-end maximum value and the back-end average value, and the difference between the back-end average value and the back-end minimum value are all less than a preset first threshold, determining that the plurality of actual voltages are valid.

[0008] Optionally, in the absence of host interference, determining the code of the slave according to the plurality of actual voltages includes:

[0009]

[0010] , where the V 1(avg) represents the front-end average value of the slave, and the V 2(avg) represents the back-end average value of the slave, and n represents a calculation coefficient.

[0011] Optionally, when the power supply voltage VCC is not a stable power supply, before determining the code of the slave according to the plurality of actual voltages, it further includes: obtaining a plurality of VCC voltages; determining whether the power supply is stable according to the plurality of VCC voltages; when the power supply is stable, determining the code of the slave according to the plurality of actual voltages.

[0012] Optionally, in the presence of host interference, determining whether the plurality of actual voltages are valid includes: sorting the plurality of actual voltages, and the sorted voltages are Vs(0)-Vs(n), where Vmin = Vs(0) and Vmax = Vs(n); when -σ2*VCC < VCC - Vmax < σ2*VCC and Vmin*(1 - σ2) < Vs(i + 1) - Vs(i) < Vmin*(1 + σ2), determining that the plurality of actual voltages are valid, where VCC represents the power supply voltage and σ2 represents the voltage sampling judgment error, determined according to the resistance of the slave.

[0013] Optionally, in the presence of host interference, determining the code of the slave according to the plurality of actual voltages includes: obtaining the sequence number of each slave according to the sorted average voltage; obtaining the code of each slave according to the sequence number of each slave.

[0014] According to a second aspect, an encoding device of a slave machine according to an embodiment of the present invention includes: a voltage information acquisition module, configured to acquire a plurality of actual voltages related to the slave machine within a preset time period; a validity determination module, configured to determine whether the plurality of actual voltages are valid; an encoding acquisition module, when the actual voltages are valid, determine the encoding of the slave machine according to the plurality of actual voltages.

[0015] According to a third aspect, an electronic device according to an embodiment of the present invention includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the steps of the encoding method of the slave machine as described in the first aspect or any optional implementation manner of the first aspect.

[0016] According to a fourth aspect, an embodiment of the present invention also discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the encoding method of the slave machine as described in the first aspect or any optional implementation manner of the first aspect are implemented.

[0017] The technical solution of the embodiment of the present invention has the following advantages:

[0018] In the embodiment of the present invention, by acquiring a plurality of actual voltages related to the slave machine within a preset time period, determining whether the plurality of actual voltages are valid, and when the plurality of actual voltages are valid, determining the encoding of the slave machine according to the plurality of actual voltages, automatic identification of the slave machine address is realized, so that the slave machine can identify the slave machine address without manual encoding during installation and maintenance, reducing installation and maintenance work and improving efficiency while avoiding the troubles of duplicate and missing encoding caused by human encoding operation errors, and improving the encoding efficiency during the installation and maintenance process of the product. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0020] Figure 1 It is a flowchart of a specific example of the automatic encoding method of the slave machine in the embodiment of the present invention;

[0021] Figure 2 It is a connection mode of the slave machine in the automatic encoding method of the slave machine in the embodiment of the present invention;

[0022] Figure 3 An automatic coding flowchart of the slave device's automatic coding method in an embodiment of the present invention;

[0023] Figure 4 Another connection method of the slave device in the automatic coding method of the slave device in an embodiment of the present invention;

[0024] Figure 5 Another automatic coding flowchart of the slave device's automatic coding method in an embodiment of the present invention;

[0025] Figure 6 A structural schematic diagram of an automatic coding device of the slave device in an embodiment of the present invention;

[0026] Figure 7 A specific example diagram of the device in an embodiment of the present invention. Detailed implementation manners

[0027] Next, the technical solutions of the present invention will be clearly and completely described in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0028] In the description of the present invention, it should be noted that the term "and / or" used in the specification and appended claims of this application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0029] In addition, the technical features involved in different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0030] An embodiment of the present invention discloses an automatic coding method for a slave device. As Figure 1 shown, the method includes the following steps:

[0031] Step 101, obtain a plurality of actual voltages related to the slave device within a preset time period.

[0032] Exemplarily, as an optional implementation manner of an embodiment of the present invention, in the case of no host interference, the obtaining of a plurality of actual voltages related to the slave device within a preset time period includes: obtaining a plurality of front-end actual voltages at the front end of the slave device and a plurality of back-end actual voltages at the back end of the slave device within the preset time period.

[0033] As another optional implementation manner of an embodiment of the present invention, in the case of host interference, the obtaining of a plurality of actual voltages related to the slave device within a preset time period includes: obtaining a plurality of addressing voltages of a plurality of slave devices within the preset time period.

[0034] Exemplarily, as an alternative embodiment of the present invention, as Figure 2 shown in a circuit connection schematic diagram without host interference, the slave devices are connected in series with each other through a built-in resistor. One end of the two farthest ends of the slave devices is grounded (GND), and the other end is connected to the positive power supply terminal (VCC). The resistances of all the resistors R are equal.

[0035] Exemplarily, as an alternative embodiment of the present invention, as Figure 3 shown in a circuit connection schematic diagram with host interference, the slave devices are connected in series with each other through a built-in resistor. One end of the two farthest ends of the slave devices is grounded (GND), and the other end is connected to the positive power supply terminal (VCC). The resistances of all the resistors R are equal. At the input end of each resistor, actual voltage data is collected through communication connection with the host.

[0036] Step 102, determine whether the multiple actual voltages are valid.

[0037] As an alternative embodiment of the embodiment of the present invention, in the case of no host interference, determining whether the multiple actual voltages are valid may adopt the following method: respectively calculate the maximum value, average value, and minimum value of the multiple front-end actual voltages based on the multiple front-end actual voltages to obtain the front-end maximum value, front-end average value, and front-end minimum value; respectively calculate the maximum value, average value, and minimum value of the multiple back-end actual voltages based on the multiple back-end actual voltages to obtain the back-end maximum value, back-end average value, and back-end minimum value; when the differences between the front-end maximum value and the front-end average value, the front-end average value and the front-end minimum value, the back-end maximum value and the back-end average value, and the back-end average value and the back-end minimum value are all less than a preset first threshold, it is determined that the multiple actual voltages are valid.

[0038] Specifically, the first threshold σ1 ∈ (0, 1 / (4*n)), where n represents the number of slave devices.

[0039] As another alternative embodiment of the embodiment of the present invention, in the case of host interference, determining whether the multiple actual voltages are valid may adopt the following method: obtain the VCC voltage; respectively calculate the average value of the multiple addressing voltages belonging to each slave device to obtain the average voltage of each slave device; sort the average voltages of the multiple slave devices to obtain the sorted average voltages Vs(0)-Vs(n), where Vmin = Vs(0) and Vmax = Vs(n);

[0040] When -σ2*VCC < VCC - Vmax < σ2*VCC and Vmin*(1 - σ2) < Vs(i + 1) - Vs(i) < Vmin*(1 + σ2), it is determined that the multiple actual voltages are valid, where σ2 represents the voltage sampling judgment error.

[0041] Step 103, when the actual voltage is valid, determine the encoding of the slave device according to the multiple actual voltages. As an optional implementation manner of an embodiment of the present invention, in the case of no host interference, determining the encoding of the slave device according to the multiple actual voltages includes:

[0042] Slave device encoding = [V 1(avg) / (V 2(avg) - V 1(avg) ) + n]

[0043] wherein, the V_1(avg) represents the front-end average value of the slave device, the V_2(avg) represents the back-end average value of the slave device, and n represents a calculation coefficient.

[0044] For example, n can take 0.5, that is, slave device encoding = [V 1(avg) / (V 2(avg) - V 1(avg) ) + 0.5].

[0045] Further, when VCC is not a stable power supply, before determining the encoding of the slave device according to the multiple actual voltages, it further includes: obtaining multiple VCC voltages, and then determining whether the power supply is stable according to the multiple VCC voltages. When the power supply is stable, determine the encoding of the slave device according to the multiple actual voltages, and then determine the address according to the encoding; when VCC is not a stable power supply, VCC can be directly set to a preset voltage, and then directly proceed to the subsequent step of determining the encoding of the slave device.

[0046] Furthermore, in order to verify the correctness of the slave device encoding. The slave device can also verify the slave device encoding. Specifically, because the resistance values of the R of each slave device are the same and the current is the same in series, since the voltage attenuation degree caused by the current passing through the resistors with the same resistance value is the same, the V2(avg) - V1(avg) values of each slave device should be kept consistent (due to external reasons, it can be regarded as within the σ error range). Therefore, in order to prevent abnormal address number encoding, this characteristic can be utilized to perform the above-mentioned consistency check on the V2(avg) - V1(avg) values of each slave device after numbering the slave devices. When the V2(avg) - V1(avg) < σ, it is proved that this group of address data is valid.

[0047] As another alternative implementation, in the presence of host interference, determining the encoding of the slave according to the plurality of actual voltages includes: obtaining the sequence number of each slave according to the sorted average voltage; obtaining the encoding of each slave according to the sequence number of each slave. For example, when the voltage magnitude of slave 0 ranks 0th and the voltage magnitude of slave 1 ranks 3rd, the address number of slave 0 can be assigned 0000 and the address number of slave 1 can be assigned 0011 at this time.

[0048] To more specifically illustrate the slave encoding method of the embodiments of the present invention, more specific Examples 1 and 2 are given.

[0049] Specifically, Example 1 includes the following steps: As Figure 2 and Figure 3 shown, the slaves are connected in series with each other through a built-in resistor, one end of the two farthest ends of the slaves is grounded (GND), and the other end is connected to the positive power supply (VCC). The resistance values of all the resistors R are equal. VCC and GND are also a set of power supply voltages input to each slave. When VCC is a stable voltage source, VCC can be set to a preset voltage. Otherwise, VCC also needs to be input to the slave for sampling.

[0050] During the automatic encoding process, when the slave receives a start addressing instruction or the address is empty, the slave continuously samples the voltages at both ends of the resistor (when VCC is not a stable power supply, the VCC voltage needs to be sampled simultaneously). When sampling the voltage, after continuously sampling a certain number of times in multiple cycles (example: continuously sampling 100 times, sampling once every 10 ms), the sampling stops, and then the voltage validity is judged. The judgment process is as follows: Calculate the maximum value (V 1(max) , V 2(max) ), average value (V 1(avg) , V 2(avg) ), and minimum value (V 1(min) , V 2(min) ) of the voltages at the input end (ADC sampling 2) and output end (ADC sampling 1) of the resistor respectively. If the VCC voltage is sampled, the VCC voltage also needs to be calculated in the same way (Vcc (avg) , Vcc (max) , Vcc (min) ).

[0051] Assume that the allowable error of the sampling voltage at the same sampling point is σ ∈ (0, 1 / (4*n)) at this time. The verification method is as follows:

[0052] Collecting the VCC voltage information includes the voltage maximum value, minimum value, and average value. The number of samplings can be continuously sampled a certain number of times in multiple cycles (example: continuously sampling 100 times, sampling once every 10 ms). When the VCC voltage information Vcc (max) –Vcc(avg) <σ; V cc(avg) –Vcc (min) When <σ, execute the next step, continue to collect the voltage across the resistor, and make a judgment:

[0053] V 1(max) –V 1(avg) <σ; V 1(avg) –V 1(min) <σ; V 2(max) –V 2(avg) <σ; V 2(avg) –V 2(min) <σ; …V n(max) -V n(avg) <σ; V n(avg) –V n(min) When <σ and all the above conditions are met, it proves that the data is valid, and calculate the slave address (assuming the address numbering starts from 0):

[0054] Address number = [V 1(avg) / (V 2(avg) -V 1(avg) ) + 0.5],

[0055] Example: For slave 0, V 1(avg) = 1.49V, V 2(avg) = 2.02V, address number = [2.81 + 0.5] = 3.

[0056] Among them, the voltage sampling judgment error σ is determined according to the number of slaves (σ can be 1 / (4*n)).

[0057] Since the R values of each slave are the same and the current is the same in series, the V2(avg)–V1(avg) values of each slave should be consistent (within the σ error range). To prevent abnormal address number encoding, this characteristic can be used to perform consistency verification on the V2(avg)–V1(avg) values of each slave.

[0058] After the slave number is determined, the master will issue the address according to the number and then determine the address of the slave.

[0059] Specifically, Example 2 includes the following steps: As Figure 4 and Figure 5 shown, the slaves are connected in series with each other through a built-in resistor. One end of the two farthest ends of the slave is grounded (GND), and the other end is connected to the positive power supply (VCC). There is an external master that communicates with each slave. The master mainly receives the address number and issues the address.

[0060] The specific process of the voltage validity verification method is as Figure 5As shown, the host sends an addressing start instruction, and the slave starts to collect voltage information. The voltage information is the input voltage value of the slave, and then the effectiveness is judged according to the voltage sampling judgment error.

[0061] Specifically, assuming that the voltage sampling determination error σ2 = 0.5% at this time (this error is mainly determined by the resistance value of the resistor. For example, when the resistance value of the slave resistor is one-thousandth, in order to reduce the judgment error, the corresponding voltage sampling determination error can be the aforementioned 0.5%), for the feedback voltage, those within this error range are all judged as the same slave control node.

[0062] Furthermore, collect the voltage information of the slave resistor, sort the resistor voltages from smallest to largest, and define them as: V s(i) , i ∈ [0, n], that is, the sorted voltage values are: V s(0) -V s(n) , V min = MIN(V i , i ∈ [0, n]), V i = V0 - V n , the average voltage within each slave control error range, n is the number of received feedback slave control information; V max = MAX(V i , i ∈ [0, n]). That is to say, V max = V s(n) , V min = V s(0) .

[0063] Furthermore, the following two verification methods can be used. For example, verification 1: V vcc -V max ∈ [Vcc * (0 – σ2), Vcc * σ], this verification is mainly by comparing with the power supply voltage; verification 2: V s(i+1) -V s(i) ∈ [V min * (1 - σ2), V min * (1 + σ2)], i ∈ [0, n - 1], this process is mainly by comparing the voltage differences between adjacent slaves. Because the resistance values of the slaves are the same, the voltage attenuation degrees are also different after the current passes, and it can basically be an arithmetic progression. When -σ2 * VCC < VCC - Vmax < σ2 * VCC and Vmin * (1 - σ2) < Vs(i + 1) - Vs(i) < Vmin * (1 + σ2), upload the voltage information to the host. The host distributes addresses through the voltage information and, in a broadcast manner, distributes according to the uploaded slaves. For example, the address uploaded by slave 0 in the figure is V s(2) , and the host will distribute according to this V s(2)Determine the address and allocate it to slave 0. After receiving the address, the slave will perform a check. When the error range between the received V s(i) value and its own sampled value is within the range of ±2*σ, it can be considered to match itself, and the corresponding slave address is updated and used as the slave address.

[0064] The present invention designs an automatic slave address recognition code by using equal-value encoded resistors in series and the proportional relationship between the voltage at one or both ends of the sampling resistor and the product supply voltage (VCC). It can effectively prevent misoperations in manual coding and improve the coding efficiency during product installation and maintenance.

[0065] The embodiment of the present invention also discloses an automatic coding device for a slave, as Figure 6 shown. The device includes:

[0066] A voltage information acquisition module 61, configured to acquire a plurality of actual voltages related to the slave within a preset time period. For detailed content, refer to step 101;

[0067] A validity determination module 62, configured to determine whether the plurality of actual voltages are valid. For detailed content, refer to step 102;

[0068] A coding acquisition module 63, configured to determine the coding of the slave according to the plurality of actual voltages when the actual voltages are valid. For detailed content, refer to step 103.

[0069] The embodiment of the present invention also provides a host, as Figure 7 shown. The host includes a processor 701 and a memory 702, where the processor 701 and the memory 702 can be connected through a bus or other means. Figure 7 Taking the connection through the bus as an example.

[0070] The processor 701 can be a central processing unit (CPU). The processor 701 can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. chips, or a combination of the above types of chips.

[0071] The memory 702, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the slave's automatic coding method in the embodiments of the present invention. The processor 701 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions, and modules stored in the memory 702, that is, implements the slave's automatic coding method in the above method embodiments.

[0072] The memory 702 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created by the processor 701, etc. In addition, the memory 702 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory 702 may optionally include a memory remotely disposed relative to the processor 701, and these remote memories can be connected to the processor 701 through a network. Examples of the above networks include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.

[0073] The one or more modules are stored in the memory 702 and, when executed by the processor 701, execute the Figure 1 automatic coding method of the slave in the embodiments shown.

[0074] Specific details of the above host can be correspondingly referred to Figure 1 the corresponding relevant descriptions and effects in the shown embodiments for understanding, and will not be elaborated here.

[0075] Those skilled in the art can understand that to implement all or part of the processes in the above method embodiments, it can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. Among them, the storage medium can be a magnetic disk, an optical disc, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (abbreviation: HDD), or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memories.

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

Claims

1. A coding method for a slave device, characterized in that, Including: Obtain a plurality of actual voltages related to the slave machine within a preset time period; Determine whether the plurality of actual voltages are valid; In the case of no host interference, determining whether the plurality of actual voltages are valid includes: respectively calculating the maximum value, average value and minimum value of the plurality of front-end actual voltages among the plurality of front-end actual voltages at the front end of the slave machine to obtain the front-end maximum value, front-end average value and front-end minimum value; respectively calculating the maximum value, average value and minimum value of the plurality of back-end actual voltages among the plurality of back-end actual voltages at the back end of the slave machine to obtain the back-end maximum value, back-end average value and back-end minimum value; when the difference between the front-end maximum value and the front-end average value, the difference between the front-end average value and the front-end minimum value, the difference between the back-end maximum value and the back-end average value, and the difference between the back-end average value and the back-end minimum value are all less than a preset first threshold, it is determined that the plurality of actual voltages are valid; In the case of host interference, determining whether the plurality of actual voltages are valid includes: respectively calculating the average value of the plurality of addressing voltages belonging to each slave machine to obtain the average voltage of each slave machine; sorting the average voltages of the plurality of slave machines to obtain the sorted average voltages Vs(0)~Vs(n), where Vmin = Vs(0) and Vmax = Vs(n); when -σ2*VCC < VCC - Vmax < σ2*VCC and Vmin * (1 - σ2) < Vs(i + 1) - Vs(i) < Vmin * (1 + σ2), it is determined that the plurality of actual voltages are valid, where VCC represents the power supply voltage and σ2 represents the voltage sampling judgment error, which is determined according to the resistance of the slave machine; When the plurality of actual voltages are valid, determine the encoding of the slave machine according to the plurality of actual voltages.

2. The method according to claim 1, characterized in that: In the case of no host interference, obtaining a plurality of actual voltages related to the slave machine within a preset time period includes: obtaining a plurality of front-end actual voltages at the front end of the slave machine and a plurality of back-end actual voltages at the back end of the slave machine within a preset time period; In the case of host interference, obtaining a plurality of actual voltages related to the slave machine within a preset time period includes: obtaining a plurality of addressing voltages of a plurality of slave machines within a preset time period.

3. The method according to claim 2, characterized in that, In the case of no host interference, determining the encoding of the slave machine according to the plurality of actual voltages includes: Among them, the represents the front-end average value of the slave device, and the represents the back-end average value of the slave device, and n represents a calculation coefficient.

4. The method according to claim 2, characterized in that, When the power supply voltage VCC is not a stable power supply, before determining the encoding of the slave machine according to the plurality of actual voltages, it further includes: Obtain a plurality of VCC voltages; Judge whether the power supply is stable according to the plurality of VCC voltages; When the power supply is stable, execute the step of determining the encoding of the slave machine according to the plurality of actual voltages.

5. The method according to claim 2, characterized in that, In the case of host interference, determining the encoding of the slave machine according to the plurality of actual voltages includes: Obtain the sequence number of each slave machine according to the sorted average voltage; Obtain the encoding of each slave machine according to the sequence number of each slave machine.

6. A coding device for a slave device, characterized in that, Including: A voltage information acquisition module for acquiring a plurality of actual voltages related to the slave machine within a preset time period; A validity determination module for determining whether the plurality of actual voltages are valid; In the case of no host interference, determining whether the multiple actual voltages are valid includes: calculating the maximum value, average value, and minimum value of the multiple front-end actual voltages respectively according to the multiple front-end actual voltages at the front end of the slave, to obtain the front-end maximum value, front-end average value, and front-end minimum value; calculating the maximum value, average value, and minimum value of the multiple back-end actual voltages respectively according to the multiple back-end actual voltages at the back end of the slave, to obtain the back-end maximum value, back-end average value, and back-end minimum value; when the difference between the front-end maximum value and the front-end average value, the difference between the front-end average value and the front-end minimum value, the difference between the back-end maximum value and the back-end average value, and the difference between the back-end average value and the back-end minimum value are all less than a preset first threshold, it is determined that the multiple actual voltages are valid; In the case of host interference, determining whether the multiple actual voltages are valid includes: calculating the average value of the multiple addressed voltages belonging to each slave respectively, to obtain the average voltage of each slave; sorting the average voltages of the multiple slaves to obtain the sorted average voltages Vs(0)~Vs(n), where Vmin = Vs(0) and Vmax = Vs(n); when -σ2*VCC < VCC - Vmax < σ2*VCC and Vmin * (1 - σ2) < Vs(i + 1) - Vs(i) < Vmin * (1 + σ2), it is determined that the multiple actual voltages are valid, where VCC represents the power supply voltage and σ2 represents the voltage sampling judgment error, which is determined according to the resistance of the slave; The encoding acquisition module, when the actual voltage is valid, determines the encoding of the slave according to the multiple actual voltages.

7. An electronic device, characterized in that, Comprising: At least one processor; And a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the steps of the encoding method of the slave as described in any one of claims 1-5.

8. A computer-readable storage medium, on which a computer program is stored, characterized in that, When the computer program is executed by the processor, it implements the steps of the encoding method of the slave as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Automatic coding method for battery thermal runaway detection system

    CN107478995A

  • Automatic encoding method for battery thermal runaway detection system

    CN110531272A