Device communication method, device and fast shutdown system based on single bus communication system

By constructing a hash table based on device number and using an exponential backoff algorithm to update key values, the hash collision problem in a single-bus communication system is solved, achieving efficient and stable device communication.

CN119493753BActive Publication Date: 2025-12-26SOLAR POWER NETWORK TECHNOLOGY (ZHEJIANG) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411645275.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-12-26
Estimated Expiration
2044-11-18

AI Technical Summary

Technical Problem

In single-bus communication systems, hash collisions occur between master and slave devices, affecting data transmission accuracy and system stability.

Method used

A hash table is constructed by obtaining characteristic data fields from the device ID of the slave device, and an exponential backoff algorithm is used to make multiple target slave devices send reply data sequentially. The master device performs hash calculations to update the key value, thereby optimizing hash table management.

Benefits of technology

It effectively avoids hash collisions, improves data transmission accuracy and system stability, and expands the applicable scenarios of device communication methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119493753B_ABST
    Figure CN119493753B_ABST
Patent Text Reader

Abstract

The application relates to a device communication method and device based on a single bus communication system and a quick shutdown system, and relates to the technical field of device communication. The method embodiment comprises the following steps: obtaining device numbers of a plurality of slave devices, taking the device numbers as keys and taking feature data fields in the device numbers as key values to construct a hash table; sending a request by a master device to a plurality of target slave devices with the same key values, so that the plurality of target slave devices send reply data comprising target device numbers to the master device in turn based on an exponential backoff algorithm, the master device performs hash calculation on the target device numbers based on the received reply data to obtain updated key values, and the hash table is updated; and the master device communicates with the corresponding slave devices based on the updated hash table. The embodiment avoids the problem of hash conflict, simplifies wiring and reduces costs, and effectively guarantees the data transmission accuracy and system operation stability in the communication process of the master and slave devices.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of device communication, in particular to a device communication method, device and fast shutdown system of a single-wire bus communication system. BACKGROUND

[0002] A single-wire bus communication system refers to a communication system using a single wire for data transmission. The design purpose of the single-wire bus system is to simplify wiring, reduce costs, and improve flexibility and reliability in certain specific applications. Such a system is usually used to connect multiple devices, but only one device can transmit data at a time.

[0003] In order to realize device communication between single-wire bus communication systems, an effective mechanism is needed to manage and coordinate the sending and receiving of data. First, the master and slave devices need to be clearly defined. Second, when there are multiple slave devices, the master device needs to accurately identify the object to which the communication data packet belongs (indicating which slave device sent the data packet).

[0004] In related technologies, a hash table is introduced to effectively distinguish different slave devices, which can ensure that the master device can correctly identify each slave device, thereby establishing one-to-one communication between the master and slave devices. However, the introduction of the hash table also brings the problem of hash collision. How to effectively solve the hash collision problem in the communication between the master and slave devices in the single-wire bus communication system to ensure the accuracy of data transmission and the stability of system operation is a problem that needs to be solved at present.

[0005] In view of the above problems in related technologies, no effective solution has been proposed so far. SUMMARY

[0006] The device communication method, device and fast shutdown system based on a single-wire bus communication system provided by the embodiments of the present application at least solve the problem of hash collision caused by the introduction of a hash table in related technologies, thereby affecting the data transmission accuracy and system operation stability in the device communication process.

[0007] In order to solve the above problems, one aspect of an embodiment of the present application provides a device communication method based on a single-wire bus communication system, comprising:

[0008] Obtaining device numbers of multiple slave devices, extracting feature data fields in the device numbers, and constructing a hash table corresponding to the multiple slave devices by taking the device numbers as keys and the feature data fields in the device numbers as key values;

[0009] The master device sends a device number acquisition request to a plurality of target slave devices with the same key value via a communication bus, so that the plurality of target slave devices send reply data including target device numbers to the master device in turn based on an exponential backoff algorithm, the master device performs hash calculation on the target device numbers based on the received reply data to obtain updated key values, and updates a hash table according to the updated key values;

[0010] The master device communicates with the corresponding slave devices based on the updated hash table.

[0011] In some embodiments, the device number includes a device description field, a production time field and a serial number field, and the serial number field is taken as the characteristic data field; the method includes:

[0012] A hash table corresponding to the plurality of slave devices is constructed by taking the device number as the key and the serial number field in the device number as the key value.

[0013] In some embodiments, the step of the plurality of target slave devices sending reply data including target device numbers to the master device in turn based on an exponential backoff algorithm includes:

[0014] After receiving the device number acquisition request sent by the master device, any target slave device performs the following steps:

[0015] The current target slave device randomly generates a first waiting time within a preset waiting time interval, and checks whether the communication bus is in an idle state after the first waiting time is met;

[0016] If the communication bus is in the idle state, the current target slave device sends reply data including the target device number to the master device via the communication bus;

[0017] If the communication bus is not in the idle state, the current target slave device sends reply data including the target device number to the master device when the second waiting time is met and the communication bus is idle.

[0018] In some embodiments, the method further includes the step of calculating the second waiting time:

[0019] The ASCII code values of each character in the target device number of the current target slave device are summed to obtain a first value, the number of times of checking of the current target slave device is taken as a second value, and the time length occupied by the last time of checking whether the communication bus is in the idle state is taken as a third value;

[0020] The second waiting time is calculated according to the first value, the second value and the third value.

[0021] In some embodiments, the method further includes:

[0022] A waiting number threshold is set, and if the reply data is not successfully sent after exceeding the waiting number threshold, the serial port of the communication bus is monitored by the current target slave device, and when the monitoring result shows that the communication bus is in an idle state, the reply data is sent to the master device.

[0023] In some embodiments, the step of the master device performing hash calculation on the target device number based on the received reply data to obtain an updated key value comprises:

[0024] After the master device receives the reply data sent by the target slave device, the target device number in the reply data is registered, hash calculation is performed on the target device number to obtain an updated key value corresponding to the target slave device, and the hash table is updated based on the updated key value.

[0025] In some embodiments, the method further comprises:

[0026] The master device sends an update request including the target device number and the updated key value to the target slave device, so that the target slave device checks the target device number in the update request, and updates the local hash table according to the updated key value when the check is passed.

[0027] In some embodiments, after the master device receives the reply data sent by the slave device, the method further comprises:

[0028] The time stamp of receiving the reply data is determined, at least one of the target device number and the time stamp, the random number and the device type code is spliced, hash calculation is performed on the spliced field to obtain an updated key value, and the hash table is updated according to the updated key value.

[0029] In some embodiments, the method is applied to a quick shutdown system, and the master device is a transmitter and the slave device is a shutdown device.

[0030] To solve the above problems, an aspect of an embodiment of the application provides a device communication apparatus based on a single bus communication system, comprising:

[0031] A hash table construction module is configured to obtain device numbers of a plurality of slave devices, extract a feature data field in the device numbers, and construct a hash table corresponding to the plurality of slave devices by taking the device numbers as keys and the feature data field in the device numbers as key values.

[0032] A hash table update module is configured to send a device number acquisition request to a plurality of target slave devices having the same key value by the master device through the communication bus, so that the plurality of target slave devices send reply data including the target device number to the master device based on an exponential backoff algorithm, the master device performs hash calculation on the target device number based on the received reply data to obtain an updated key value, and the hash table is updated according to the updated key value.

[0033] The communication module is configured for the master device to communicate with the corresponding slave device based on the updated hash table.

[0034] To solve the above problems, in one aspect of an embodiment of the present application, a fast shutdown system is provided, comprising a transmitter, a shutdown device, a processor, and a memory storing a program, the transmitter being a master device, the shutdown device being a slave device, the master device and the slave device communicating based on a single bus communication system; the program comprising instructions which, when executed by the processor, cause the processor to perform any of the above-mentioned device communication methods based on a single bus communication system.

[0035] The beneficial effects of the embodiment of the present application are: by obtaining the device numbers of a plurality of slave devices, and extracting the feature data field in the device number, taking the device number as the key and the feature data field in the device number as the key value, a hash table corresponding to the plurality of slave devices is constructed; by the master device sending a device number acquisition request to a plurality of target slave devices having the same key value via the communication bus, so that the plurality of target slave devices send reply data including the target device number to the master device in turn based on the exponential backoff algorithm, the master device performs hash calculation on the target device number based on the received reply data to obtain an updated key value, and updates the hash table according to the updated key value; the master device communicates with the corresponding slave device based on the updated hash table, which overcomes the problem of hash collision caused by introducing a hash table in the related art, thereby affecting the data transmission accuracy and system running stability in the device communication process, and realizes the construction of a hash table based on the device number of a slave device and the feature data field in the device number, and then updating the key values of a plurality of slave devices with the same key value, thereby avoiding the problem of hash collision, achieving the technical effects of simplifying wiring and reducing cost, and effectively guaranteeing the data transmission accuracy and system running stability in the master and slave device communication process, and expanding the application scenarios of the device communication method based on a single bus communication system.

[0036] The details of one or more embodiments of the present application are presented in the following drawings and description to make other features, objects and advantages of the present application more apparent. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiment or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can also obtain other embodiments from these drawings without creative labor.

[0038] Figure 1A main flowchart of a device communication method based on a single bus communication system according to an embodiment of the present application.

[0039] Figure 2 A diagram for extracting a feature data field from a device number according to an embodiment of the present application.

[0040] Figure 3 A diagram for a master device sending a device number acquisition request to multiple target slave devices with the same key value according to an embodiment of the present application.

[0041] Figure 4 A flowchart for a slave device responding to a request from a master device based on an exponential backoff algorithm according to an embodiment of the present application.

[0042] Figure 5 A framework diagram of a device communication apparatus based on a single bus communication system according to an embodiment of the present application.

[0043] Figure 6 A structural diagram of an electronic device according to the present application. DETAILED DESCRIPTION

[0044] Embodiments of the present application will be described in more detail by referring to the attached drawings. Although certain embodiments of the present application are shown in the drawings, it is understood that the present application can be implemented in various forms and should not be interpreted as being limited to the embodiments set forth herein, but rather these embodiments are provided so as to more completely and thoroughly understand the present application. It is understood that the drawings and embodiments of the present application are for exemplary purposes only and are not intended to limit the scope of protection of the present application.

[0045] In the related art, by introducing a hash table, different slave devices can be effectively distinguished, and the master device can correctly identify each slave device, thereby establishing one-to-one communication between the master device and the slave device. However, the introduction of the hash table also causes a hash collision problem. How to effectively solve the hash collision problem in the communication between the master device and the slave device in the single bus communication system to ensure the accuracy of data transmission and the stability of system operation is a problem that needs to be solved at present.

[0046] On the other hand, the rapid shutdown system (RSS) is a kind of safety function design, mainly used to improve the safety of photovoltaic power generation system. When the system needs to be maintained or in an emergency, such as a fire, the transmitter in the rapid shutdown system can send a shutdown instruction to the shutdown device to achieve component-level shutdown and ensure the safe operation of other photovoltaic components and inverters. In order to simplify wiring and reduce costs, the transmitter (master device) and the shutdown device (slave device) in the rapid shutdown system often use a single bus communication system (single-wire bus communication system refers to a communication system that uses a single wire for data transmission) for communication.

[0047] If the hash collision problem between the master and slave devices in the single bus communication system can be avoided, the data transmission accuracy and system operation stability in the communication process of the master and slave devices can be effectively guaranteed while simplifying the wiring of the rapid shutdown system and reducing the deployment cost of the rapid shutdown system, and the application scenarios of the device communication method based on the single bus communication system are expanded.

[0048] In order to solve the above problems, the embodiment of the present application provides a device communication method based on a single bus communication system, as shown in the figure, which mainly includes: Figure 1 As shown in the figure, the device communication method based on the single bus communication system mainly includes:

[0049] Step S101, obtain the device number of the plurality of slave devices, and extract the feature data field in the device number, take the device number as the key and the feature data field in the device number as the key value, and construct a hash table corresponding to the plurality of slave devices.

[0050] Through the above setting, the unique identifier of the device (device number, i.e. device SN number) is taken as the key key, and the feature data field in the device number is taken as the key value value, and then a hash table is formed, which provides the master device with the ability to quickly find and identify the slave device.

[0051] Among them, the data field corresponding to the device number provided by the embodiment of the present application includes a device description field, a production time field and a serial number field.

[0052] In some embodiments, the serial number field is taken as the feature data field; the above method includes: taking the device number as the key and the serial number field in the device number as the key value, constructing a hash table corresponding to the plurality of slave devices.

[0053] According to a specific embodiment of the present invention, the naming rule for equipment numbers includes an equipment description field, a production time field, and a serial number field. The equipment description field indicates information such as the manufacturer code, product model, or series; the production time field indicates information such as the year, month, or even the specific date the equipment was manufactured, also known as the manufacturing date; and the serial number field indicates the specific serial number of the equipment, used to distinguish different equipment within the same batch or series. Figure 2 As shown, taking the device number "XX202405310001……XX202405311024" as an example, "XX" represents the device description field, "20240531" represents the production time field, and "0001…1024" represents the specific serial number field. After receiving the device numbers of multiple slave devices, the specific serial number field can be directly extracted as the hash address of the hash table, and the specific serial number field can be used as the key value. Combined with the device number as the key, the hash table corresponding to multiple slave devices can be constructed.

[0054] With the above settings, the serial number field in the device number is usually highly unique, which effectively reduces the generation of hash collisions. The hash table built according to the mapping relationship between the device number and the serial number field helps the master device to accurately identify and locate each slave device in subsequent communications.

[0055] In step S102, the master device sends a device number acquisition request to multiple target slave devices with the same key value via the communication bus, so that the multiple target slave devices sequentially send reply data including the target device number to the master device based on the exponential backoff algorithm. The master device performs a hash calculation on the target device number based on the received reply data to obtain the update key value, and updates the hash table according to the update key value.

[0056] The exponential backoff algorithm provided in this invention is a technique for resolving collisions in network communication. It reduces the probability of collisions by requiring devices to wait for an exponentially increasing time interval before attempting to retransmit, which increases with the number of bus occupancy collisions. This algorithm is used in various network communication protocols, particularly in single-bus communication systems, where it effectively avoids bus occupancy collisions caused by multiple devices simultaneously transmitting data.

[0057] With the above settings, based on the exponential backoff algorithm, multiple target slave devices will not send data simultaneously after receiving a request from the master device. That is, the target slave devices will send reply data one by one according to the exponential backoff algorithm, ensuring effective data transmission and avoiding bus occupation conflicts. At the same time, the master device updates the key value in the hash table based on the received reply data, further optimizing the management of the hash table and avoiding hash collisions.

[0058] According to a specific embodiment of the present application, in order to avoid the single bus transmission conflict caused by the multiple target slave devices responding to the request of the master device and sending reply data at the same time, in addition to the exponential backoff algorithm, a priority scheduling scheme can also be used, i.e., each target slave device is assigned a priority, and the data is sent in order according to the priority, so as to reduce the bus occupation conflict; or a time slot allocation scheme can also be used, i.e., the sending time slot of each target slave device is pre-allocated, and the reply data is sent in order according to the time slot.

[0059] In some embodiments, the step of sending the reply data including the target device number to the master device by the multiple target slave devices in order based on the exponential backoff algorithm includes the following steps performed by any target slave device after receiving the device number acquisition request sent by the master device: generating a first waiting time within a preset waiting time interval by the current target slave device, and checking whether the communication bus is idle after the first waiting time is met; if the communication bus is idle, the current target slave device sends the reply data including the target device number to the master device via the communication bus; if the communication bus is not idle, the current target slave device sends the reply data including the target device number to the master device when the second waiting time is met and the communication bus is idle.

[0060] Based on the above steps, the embodiment of the present application solves the problem of how to avoid the bus conflict caused by the multiple target slave devices sending data at the same time after receiving the request of the master device in the single bus communication system. Specifically, by introducing a random waiting time between the target slave devices, the probability of multiple target slave devices attempting to send data at the same time can be significantly reduced, thereby reducing the bus conflict; at the same time, by checking whether the bus is idle and sending data when the bus is idle, it is ensured that the data can be sent in order to avoid the confusion and loss of data packets, and based on the above reasonable delay mechanism (waiting mechanism), each target slave device has the opportunity to send data at the appropriate time, thereby improving the overall efficiency of the communication.

[0061] According to a specific embodiment of the present application, Figure 3 A schematic diagram showing that the master device sends a request to multiple target slave devices with the same key value via a single bus in a single bus communication system is shown. Figure 4A flowchart is shown to illustrate that the target slave device responds to the request of the master device based on the exponential backoff algorithm. After the master device sends a request to multiple target slave devices with the key value "000X", for the device numbered "XX20240530000X", it first randomly extends the first waiting time t after receiving the request of the master device, and then checks whether the bus is in an idle state (if the bus is not in a busy state, it means that the bus is occupied at this time, i.e., other target slave devices are sending reply data to the master device through the bus at this time). If it is not in an idle state, it is delayed for a second waiting time 2t again. At this time, the bus is idle, and the reply data can be sent to the master device through the bus.

[0062] In the embodiments of the present application, the preset waiting time interval can be 50s, and the corresponding first waiting time can be randomly generated from the time interval 【0, 50s】. It should be noted that the specific value corresponding to the preset waiting time interval is not limited to the present application, and can be adaptively adjusted according to the specific scene (the number of slave devices, the number of target slave devices, etc.).

[0063] In some embodiments, the above method further includes the step of calculating the second waiting time: summing the ASCII code values of each character in the target device number of the current target slave device to obtain a first value, taking the number of times of viewing of the current target slave device as a second value, and taking the time length occupied by the last time of viewing whether the communication bus is in an idle state as a third value; and calculating the second waiting time according to the first value, the second value and the third value.

[0064] The foregoing provides an example of generating the first waiting time (the first waiting time). The embodiments of the present application provide an example of calculating the second waiting time (i.e., the subsequent waiting time, including the second waiting time, the third waiting time,...) based on the above steps.

[0065] Specifically, by introducing multiple factors (such as the sum of ASCII code values of the device number, the number of viewings, and the time occupied by the last viewing of the bus), the second waiting duration can be calculated to more finely control the transmission timing of each target slave device, thereby further reducing the conflict probability. Among them, each target slave device calculates the second waiting duration according to its own device number (device SN) and the current number of viewings, so that the delay time of each target slave device is more personalized, avoiding all target slave devices adopting the same delay strategy; and the delay time is dynamically adjusted according to the time occupied by the last viewing of the bus whether it is idle, which can make the delay strategy more flexible and adapt to different network conditions. Through the above settings, a more refined delay strategy is provided, which can further reduce the conflict probability in the single-bus communication system and improve the reliability and efficiency of communication. This method makes the delay time of each target slave device more personalized and dynamic, thereby improving the overall performance of the system and improving the overall efficiency of communication.

[0066] According to a specific embodiment of the embodiment of the application, the ASCII code values of the characters in the device number of the target slave device are summed to obtain a first value K, the number of viewings of the current target slave device is taken as a second value J, and the time length occupied by the last viewing of the communication bus whether it is idle is taken as a third value t. Then the re-delay time (second waiting duration) T2 = K + 2(J-1)*t.

[0067] In some embodiments, the above method further comprises setting a waiting number threshold, and if the reply data is still not successfully sent after exceeding the waiting number threshold, the current target slave device listens to the serial port of the communication bus, and when the listening result shows that the communication bus is in an idle state, the reply data is sent to the master device.

[0068] In a single-bus communication system, setting a waiting number threshold and deciding whether to send data by listening to the state of the communication bus after exceeding the threshold can further improve the reliability and communication efficiency of the system. By setting a waiting number threshold, the slave device can be prevented from falling into an infinite waiting state when trying to send data. Once the threshold is exceeded, the target slave device will take more aggressive measures to send data, thereby ensuring the reliability of communication. Specifically, when the target slave device fails to send data multiple times, it can change its strategy in time and no longer blindly wait, but actively listen to the bus state, thereby reducing unnecessary waiting time and saving resources. By setting a waiting number threshold, the system can dynamically adjust the communication strategy according to the current network conditions, avoid excessive delay in high-load situations, and improve communication efficiency; it can also prevent the slave device from falling into a deadlock state due to long waiting time, ensuring that the system can operate normally.

[0069] In some embodiments, the master device hashes the target device number to obtain the updated key value based on the received reply data, including: after the master device receives the reply data sent by the target slave device, registering the target device number in the reply data, hashing the target device number to obtain the updated key value corresponding to the target slave device, and updating the hash table based on the updated key value.

[0070] Through the above setting, the hash table is updated by hashing the returned target device number of the target slave device to obtain the updated key value, thereby ensuring that the hash table always reflects the latest device state and improving the accuracy of the hash table. For multiple target slave devices with the same key value, the updated key value obtained by hashing can be more evenly distributed in the hash table, avoiding the situation of hash conflict and improving the search efficiency of the hash table. Based on the updated hash table, the master device can more accurately identify and locate each slave device, improving the reliability of communication.

[0071] In some embodiments, the method further includes: sending, by the master device, an update request including the target device number and the updated key value to the target slave device, so that the target slave device checks the target device number in the update request and updates the local hash table according to the updated key value when the check is passed.

[0072] Based on the above setting, the master device sends an update request including the target device number and the updated key value to the target slave device and requires the slave device to check, ensuring data consistency and security and improving system reliability. This method enables the system to better cope with various potential security threats and data inconsistency problems, ensuring the coordination and consistency of the entire system. At the same time, this method also provides more flexibility and dynamic adjustment capability for the system, thereby improving the overall performance of the system.

[0073] In some embodiments, after the master device receives the reply data sent by the slave device, the method further includes: determining the timestamp of receiving the reply data, splicing the target device number and at least one of the timestamp, the random number and the device type code, hashing the spliced field to obtain the updated key value, and updating the hash table according to the updated key value.

[0074] The above steps provide several specific schemes for calculating the update key value in the embodiments of the application. By determining the timestamp after the master device receives the reply data sent by the slave device, splicing the target device number with at least one of the timestamp, the random number and the device type code, and then performing hash calculation on the spliced field to obtain the update key value, and updating the hash table according to the update key value, the accuracy of hash table updating can be significantly improved, hash conflicts can be reduced, and the freshness and security of data can be enhanced. This method enables the system to better adapt to dynamically changing device states, ensuring efficient and accurate communication. At the same time, this method also provides more flexibility and dynamic adjustment capability for the system, thereby improving the overall performance of the system.

[0075] In step S103, the master device communicates with the corresponding slave device based on the updated hash table.

[0076] Through the above settings, the master and slave devices communicate based on the updated hash table, overcoming the problems of device identification difficulty, hash conflict and miscommunication in the single bus communication system, effectively ensuring accurate identification of each slave device by the master device, improving communication efficiency, reducing the possibility of miscommunication, and improving data transmission accuracy and system operation stability during device communication. At the same time, this scheme provides more flexibility and adaptability, effectively expanding the application scenarios of the scheme.

[0077] In some embodiments, the above method is applied in a rapid shutdown system, the master device is a transmitter, and the slave device is a shutdown device.

[0078] A rapid shutdown system (RSS) is a safety feature designed for photovoltaic power generation systems. In a rapid shutdown system, communication between the master device (transmitter) and the slave device (shutdown device) is crucial, especially in situations requiring fast response and high reliability. Applying the above device communication method based on the single bus communication system to the rapid shutdown system can achieve efficient, reliable and secure communication mechanism between the transmitter (master device) and the shutdown device (slave device), enabling accurate identification of the slave device (shutdown device) by the master device (transmitter). Through the dynamic updating mechanism of the hash table, communication between the transmitter and the shutdown device can be made more reliable, reducing shutdown failures caused by communication errors or data conflicts, and significantly improving the response speed and reliability of the rapid shutdown system.

[0079] It should be noted that the above device communication method based on the single bus communication system provided by the embodiments of the application can also be applied to other communication scenarios of master and slave devices with hash conflicts to avoid hash conflicts and effectively ensure data transmission accuracy and system operation stability during master and slave device communication.

[0080] The device communication method based on the single bus communication system provided in the embodiments of the present application overcomes the problem of hash collision caused by the introduction of a hash table in the related art, and thus affects the data transmission accuracy and system running stability in the device communication process, and achieves the technical effects of simplifying wiring and reducing costs while effectively guaranteeing the data transmission accuracy and system running stability in the device communication process of the master device and the slave device, and expanding the applicable scenarios of the device communication method based on the single bus communication system.

[0081] Based on the device communication method based on the single bus communication system provided in the embodiments of the present application, the embodiments of the present application further provide a device communication apparatus based on a single bus communication system, which is applied to a scenario of communication between a master device and a slave device based on a single bus communication system, as shown in the following Figure 5 The device communication apparatus 500 based on the single bus communication system includes:

[0082] The hash table construction module 501 is configured to obtain device numbers of a plurality of slave devices, extract a feature data field in the device numbers, and construct a hash table corresponding to the plurality of slave devices by taking the device numbers as keys and the feature data field in the device numbers as key values.

[0083] Through the above setting, the device numbers are taken as keys, and the feature data field in the device numbers is taken as key values, and then a hash table is formed, which preliminarily provides the master device with the ability to quickly find and identify the slave devices.

[0084] In some embodiments, the data field corresponding to the device number includes a device description field, a production time field and a serial number field, and the serial number field is taken as the feature data field. The hash table construction module 501 is further configured to construct the hash table corresponding to the plurality of slave devices by taking the device numbers as keys and the serial number field in the device numbers as key values.

[0085] By the above setting, since the serial number field in the device number generally has high uniqueness, the generation of hash collision is effectively reduced, and the hash table constructed according to the mapping relationship between the device number and the serial number field helps the master device to accurately identify and locate each slave device in subsequent communication.

[0086] The hash table updating module 502 is configured to send, by the master device, a device number acquisition request to a plurality of target slave devices with the same key value via the communication bus, so that the plurality of target slave devices send reply data including target device numbers to the master device in turn based on an exponential backoff algorithm, and the master device performs hash calculation on the target device numbers based on the received reply data to obtain updated key values, and updates the hash table according to the updated key values.

[0087] By the above setting, based on the exponential backoff algorithm, the plurality of target slave devices will not send data at the same time after receiving the request of the master device, i.e., the target slave devices will send reply data in turn according to the exponential backoff algorithm, ensuring effective transmission of data and avoiding bus occupation conflict; at the same time, the master device updates the key values in the hash table based on the received reply data, further optimizing the management of the hash table and avoiding the occurrence of hash collision.

[0088] In some embodiments, the hash table updating module 502 is further configured to, after receiving the device number acquisition request sent by the master device, control any target slave device to perform the following steps: the current target slave device randomly generates a first waiting time within a preset waiting time interval, and after the first waiting time is met, checks whether the communication bus is in an idle state; if the communication bus is in the idle state, the current target slave device sends reply data including the target device number to the master device via the communication bus; if the communication bus is not in the idle state, the current target slave device sends the reply data including the target device number to the master device when the communication bus is idle after a second waiting time is met.

[0089] By the above setting, the problem of bus conflict caused by simultaneous data transmission of the plurality of target slave devices after receiving the request of the master device in the single bus communication system is solved.

[0090] In some embodiments, the device communication apparatus 500 based on the single bus communication system further includes a second waiting time calculation module configured to: sum the code values of the ASCII codes of each character in the target device number of the current target slave device to obtain a first value, take the number of times of checking of the current target slave device as a second value, and take the time length occupied by the last checking of whether the communication bus is in an idle state as a third value; and calculate the second waiting time according to the first value, the second value, and the third value.

[0091] By introducing multiple factors (such as the sum of ASCII code values of the device number, the number of views, the time taken to view the bus last time), the second waiting time can be calculated more finely to control the sending time of each target slave device, thereby further reducing the probability of conflict.

[0092] In some embodiments, the device communication apparatus 500 based on the single bus communication system further comprises a waiting number setting module, configured to set a waiting number threshold, and if the current target slave device still fails to send the reply data successfully when the waiting number threshold is exceeded, control the current target slave device to listen to the serial port of the communication bus, and send the reply data to the master device when the listening result shows that the communication bus is in an idle state.

[0093] By setting the waiting number threshold, the slave device can be prevented from falling into an infinite waiting state when attempting to send data. Once the threshold is exceeded, the target slave device will take more active measures to send data, thereby ensuring the reliability of communication.

[0094] In some embodiments, the hash table updating module 502 is further configured to, after the master device receives the reply data sent by the target slave device, register the target device number in the reply data, perform hash calculation on the target device number to obtain an updated key value corresponding to the target slave device, and update the hash table based on the updated key value.

[0095] Through the above setting, for multiple target slave devices with the same key value, the updated key value obtained through hash calculation can be more evenly distributed in the hash table, avoiding the situation of hash conflict, improving the search efficiency of the hash table, and based on the updated hash table, the master device can more accurately identify and locate each slave device, thereby improving the reliability of communication.

[0096] In some embodiments, after the master device receives the reply data sent by the slave device, the hash table updating module 502 is further configured to determine a timestamp of receiving the reply data, splice the target device number and at least one of the timestamp, the random number and the device type code, perform hash calculation on the spliced field to obtain an updated key value, and update the hash table according to the updated key value.

[0097] The communication module 503 is configured to enable the master device to communicate with the corresponding slave device based on the updated hash table.

[0098] Specifically, the master device identifies a specific slave device that needs to be communicated based on the updated hash table, and then communicates with the specific slave device via the single bus communication system.

[0099] In some embodiments, the apparatus is arranged in a quick shutdown system, the master device is a transmitter, and the slave device is a shutdown device.

[0100] The device communication apparatus based on the single bus communication system is applied to the quick shutdown system, and efficient, reliable and safe communication mechanism between the transmitter (the master device) and the shutdown device (the slave device) can be realized, accurate identification of the slave device (the shutdown device) by the master device (the transmitter) is realized, the communication between the transmitter and the shutdown device is ensured to be more reliable through the dynamic updating mechanism of the hash table, shutdown failure caused by communication errors or data conflicts is reduced, and the response speed and reliability of the quick shutdown system are significantly improved.

[0101] The device communication apparatus based on the single bus communication system provided by the embodiment of the application comprises a hash table construction module, a hash table updating module and a communication module. The hash table construction module is used to obtain the device numbers of the plurality of slave devices, extract the feature data field in the device numbers, and construct the hash table corresponding to the plurality of slave devices by taking the device numbers as keys and the feature data field in the device numbers as key values. The hash table updating module is used to send a device number obtaining request to the plurality of target slave devices having the same key value by the master device through the communication bus, so that the plurality of target slave devices send reply data comprising target device numbers to the master device in turn based on the exponential backoff algorithm, the master device performs hash calculation on the target device numbers based on the received reply data to obtain updated key values, and updates the hash table according to the updated key values. The communication module is used for the master device to communicate with the corresponding slave devices based on the updated hash table. The problem of hash collision caused by the introduction of the hash table in the related art and affecting the data transmission accuracy and system running stability in the device communication process is overcome, the hash table is constructed based on the device numbers of the slave devices and the feature data field in the device numbers first, and then the key values of the plurality of slave devices having the same key value are updated, so that the problem of hash collision is avoided. While the wiring is simplified and the cost is reduced, the data transmission accuracy and system running stability in the master-slave device communication process are effectively ensured, and the technical effect of expanding the application scenarios of the device communication method based on the single bus communication system is achieved.

[0102] To solve the above problems, the embodiment of the application further provides a quick shutdown system, comprising a transmitter, a shutdown device, a processor and a storage memory storing a program, the transmitter is a master device, the shutdown device is a slave device, and the master device and the slave device communicate based on a single bus communication system; the program comprises instructions, and the instructions enable the processor to execute any one of the device communication methods based on the single bus communication system when executed by the processor.

[0103] By the above setting, the device communication method based on the single bus communication system is applied to the quick shutdown system, so that efficient, reliable and safe communication mechanism between the transmitter (master device) and the shutdown device (slave device) is realized, accurate identification of the master device (transmitter) to the slave device (shutdown device) is realized, and through the dynamic updating mechanism of the hash table, the communication between the transmitter and the shutdown device is more reliable, the shutdown failure caused by communication error or data conflict is reduced, and the response speed and reliability of the quick shutdown system are significantly improved.

[0104] The embodiment of the present application also provides a non-transitory machine readable medium storing a computer program, wherein the computer program is used for making the computer execute the method of the embodiment of the present application when the computer program is executed by a processor of the computer.

[0105] The embodiment of the present application also provides a computer program product comprising a computer program, wherein the computer program is used for making the computer execute the method of the embodiment of the present application when the computer program is executed by a processor of the computer. The computer program product should be understood as a software product mainly realizing the above method of the present application through the computer program.

[0106] The embodiment of the present application also provides an electronic device comprising: at least one processor; and a memory connected with the at least one processor in communication. The memory stores a computer program capable of being executed by the at least one processor, and the computer program is used for making the electronic device execute the method of the embodiment of the present application when the computer program is executed by the at least one processor.

[0107] Reference Figure 6 A block diagram of an electronic device that can be a server or a client as an embodiment of the present application will now be described, which is an example of a hardware device that can be applied to various aspects of the present application. The electronic device is intended to represent various forms of digital electronic computing devices such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computing devices. The electronic device can also represent various forms of mobile devices such as personal digital processing, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components, their connections, and relationships, and their functions, as shown in the figures and described herein, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.

[0108] As Figure 6 ​As shown, the electronic device includes a computing unit 601 that can perform various appropriate actions and processes in accordance with a computer program stored in a read only memory (ROM) 602 or a computer program loaded into a random access memory (RAM) 603 from a storage unit 608. Various programs and data required for operation of the electronic device can also be stored in the RAM 603. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0109] A plurality of components in the electronic device are connected to the I / O interface 605, including an input unit 606, an output unit 607, a storage unit 608, and a communication unit 609. The input unit 606 can be any type of device that can input information to the electronic device, and can receive inputted numerical or character information, as well as generate key signal inputs related to user settings and / or function controls of the electronic device. The output unit 607 can be any type of device that can present information, and can include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 608 can include, but is not limited to, a magnetic disk, an optical disk. The communication unit 609 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include, but is not limited to, a modem, a network card, an infrared communication device, and / or a wireless communication transceiver, such as a Bluetooth device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0110] The computing unit 601 can be various general and / or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a CPU, a graphics processing unit (GPU), various special purpose artificial intelligence (AI) computing units, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 performs various methods and processes described above. For example, in some embodiments, the method embodiments of the present application can be implemented as a computer program tangibly embodied in a machine readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device via the ROM 602 and / or the communication unit 609. In some embodiments, the computing unit 601 can be configured to perform the above-described methods by any other appropriate means, such as by means of firmware.

[0111] A computer program for implementing the method of the embodiments of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor or controller, causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package and partially on a remote machine, or entirely on a remote machine or server.

[0112] In the context of the embodiments of the present application, the machine-readable medium can be a tangible medium that can contain or store the program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable signal medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, or infrared system, apparatus, or device, or any suitable combination thereof. More specific examples of the machine-readable storage medium will include one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0113] It should be noted that the term "comprising" and its variants used in the embodiments of the present application are open-ended, i.e., "including but not limited to". The term "based on" is "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The modification of "one", "multiple" in the embodiments of the present application is illustrative and not restrictive, and those skilled in the art should understand that, unless otherwise explicitly stated in the context, it should be understood as "one or more".

[0114] The data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.

[0115] The steps described in the method embodiments provided by this invention can be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of protection of this invention is not limited in this respect.

[0116] The term "embodiment" in this specification refers to a specific feature, structure, or characteristic described in connection with an embodiment that may be included in at least one embodiment of the invention. The appearance of this phrase in various places in the specification does not necessarily imply the same embodiment, nor does it imply independence or alternativeity from other embodiments. The various embodiments in this specification are described in a related manner, with reference to each other for similar or identical parts. In particular, for apparatus, device, and system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, and relevant details are referred to in the description of the method embodiments.

[0117] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of protection. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the appended claims.

Claims

1. A method for communicating between devices based on a single bus communication system, characterized in that The method comprises the following steps: obtaining device numbers of a plurality of slave devices, extracting a feature data field in the device numbers, and constructing a hash table corresponding to the plurality of slave devices by taking the device numbers as keys and the feature data field in the device numbers as key values; sending, by a master device via a communication bus, a device number acquisition request to a plurality of target slave devices having the same key value, so that the plurality of target slave devices sequentially send reply data including target device numbers to the master device based on an exponential backoff algorithm, the master device performs hash calculation on the target device numbers based on the received reply data to obtain updated key values, and updates the hash table according to the updated key values; the master device communicates with the corresponding slave devices based on the updated hash table.

2. The method of claim 1, wherein, The device number comprises a device description field, a production time field and a serial number field, and the serial number field is taken as the feature data field; the method comprises the following steps: constructing a hash table corresponding to the plurality of slave devices by taking the device numbers as keys and the serial number field in the device numbers as key values.

3. The method of claim 1, wherein, The step that the plurality of target slave devices sequentially send reply data including target device numbers to the master device based on an exponential backoff algorithm comprises the following steps: After receiving the device number acquisition request sent by the master device, any target slave device performs the following steps: a current target slave device randomly generates a first waiting time within a preset waiting time interval, and checks whether the communication bus is in an idle state after the first waiting time is met; if the communication bus is in the idle state, the current target slave device sends reply data including the target device number to the master device via the communication bus; if the communication bus is not in the idle state, the current target slave device sends the reply data including the target device number to the master device when the communication bus is idle after a second waiting time is met.

4. The method of claim 3, wherein, The method further comprises the following steps of calculating the second waiting time: summing the ASCII code values of each character in the target device number of the current target slave device to obtain a first value, taking the number of times of checking of the current target slave device as a second value, and taking the time length occupied by the last time of checking whether the communication bus is in the idle state as a third value; calculating the second waiting time according to the first value, the second value and the third value.

5. The method of claim 3, wherein, The method further comprises the following steps: setting a waiting number threshold, if the reply data is still not successfully sent after exceeding the waiting number threshold, monitoring a serial port of the communication bus by the current target slave device, and sending the reply data to the master device when the monitoring result shows that the communication bus is in the idle state.

6. The method of claim 1, wherein, The step that the master device performs hash calculation on the target device numbers based on the received reply data to obtain updated key values comprises the following steps: After receiving the reply data sent by the target slave device, the master device registers the target device number in the reply data, performs hash calculation on the target device number to obtain the updated key value corresponding to the target slave device, and updates the hash table based on the updated key value.

7. The method of claim 6, wherein, The method further comprises the following steps: The master device sends an update request including the target device number and the update key value to the target slave device, so that the target slave device checks the target device number in the update request and updates the local hash table according to the update key value when the check is passed.

8. The method of claim 1, wherein, After the master device receives the reply data sent by the slave device, the method further comprises: determining a timestamp of receiving the reply data, splicing the target device number and at least one of the timestamp, the random number and the device type code, performing hash calculation on the spliced field to obtain an update key value, and updating the hash table according to the update key value.

9. The method of claim 1, wherein, The method is applied to a quick shutdown system, the master device is a transmitter, and the slave device is a shutdown device.

10. A device communication apparatus based on a single bus communication system, characterized by comprising: Comprise: a hash table construction module configured to obtain device numbers of a plurality of slave devices, extract feature data fields in the device numbers, and construct a hash table corresponding to the plurality of slave devices by taking the device numbers as keys and the feature data fields in the device numbers as key values; a hash table update module configured to send a device number acquisition request to a plurality of target slave devices having the same key value by the master device via a communication bus, so that the plurality of target slave devices send reply data including target device numbers to the master device in turn based on an exponential backoff algorithm, the master device performs hash calculation on the target device numbers based on the received reply data to obtain an update key value, and updates the hash table according to the update key value; a communication module configured to enable the master device to communicate with the corresponding slave devices based on the updated hash table.

11. A fast shutdown system comprising: A transmitter, a shutdown device, a processor, and a memory storing a program, characterized in that the transmitter is a master device, the shutdown device is a slave device, the master device and the slave device communicate based on a single bus communication system; the program includes instructions that, when executed by the processor, cause the processor to perform the method according to any one of claims 1-9.

Citation Information

Patent Citations

  • Automatic communication address distribution method

    CN114422480A

  • Primary key processing method and device, electronic equipment and storage medium

    CN118551083A