Equipment communication method and device based on single-bus communication system and quick turn-off system
By constructing and updating the hash table and using an exponential backoff algorithm to handle hash conflicts in a single bus communication system, the problem of hash conflict affecting data transmission accuracy and system stability is solved, and efficient and reliable device communication is achieved.
Patent Information
- Application Number
- CN202411645275.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2044-11-18
AI Technical Summary
The hash conflict caused by the introduction of hash tables in a single bus communication system affects the accuracy of data transmission during device communication and the stability of system operation.
By obtaining the device numbers of multiple slave devices, extracting the feature data fields in the device number, building a hash table, and sending device number acquisition requests to multiple target slave devices with the same key value through the master device, using the exponential backoff algorithm to make The target slave device sends reply data in turn, and the master device performs hash calculations and table updates based on the received reply data.
It effectively avoids hash conflicts, improves the accuracy of data transmission during device communication and system operation stability, and simplifies wiring and reduces costs while ensuring communication reliability.
Smart Images

Figure CN119493753A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of device communication technology, and in particular to a device communication method, apparatus, and rapid shutdown system for a single bus communication system. Background Art
[0002] A single-wire bus (SHB) communication system uses a single conductor for data transmission. Single-wire bus systems are designed to simplify wiring, reduce costs, and improve flexibility and reliability in certain applications. This system is typically used to connect multiple devices, but only one device can transmit data at a time.
[0003] To enable inter-device communication across a single bus system, an effective mechanism is required to manage and coordinate the sending and receiving of data. First, the master and slave devices must be clearly identified. Second, when there are multiple slave devices, the master device must accurately identify the recipient of the communication data packet (indicating which slave device sent the data packet).
[0004] In related technologies, by introducing hash tables, different slave devices can be effectively distinguished, ensuring that the master device can correctly identify each slave device, thereby realizing one-to-one communication between the master and slave devices. However, the introduction of hash tables also brings the problem of hash conflicts. How to effectively solve the hash conflict problem in the communication between master and slave devices in a 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 urgently.
[0005] Currently, no effective solutions have been proposed to the above-mentioned problems in related technologies. Summary of the Invention
[0006] The embodiments of the present invention provide a device communication method, apparatus, and rapid shutdown system based on a single bus communication system, which at least solve the problem in the related art of hash conflicts caused by the introduction of hash tables, thereby affecting the data transmission accuracy and system operation stability during device communication.
[0007] In order to solve the above problem, one aspect of an embodiment of the present invention provides a device communication method based on a single bus communication system, comprising:
[0008] Obtain device numbers of multiple slave devices, extract characteristic data fields in the device numbers, and construct a hash table corresponding to the multiple slave devices using the device numbers as keys and the characteristic data fields in the device numbers as key values;
[0009] The master device sends a device number acquisition request to multiple target slave devices having the same key value via a communication bus, so that the multiple target slave devices sequentially send reply data including the target device number to the master device based on an exponential backoff algorithm. The master device performs a 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.
[0010] The master device communicates with the corresponding slave device 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, with the serial number field serving as the characteristic data field; and the method includes:
[0012] A hash table corresponding to multiple slave devices is constructed using the device number as a key and the serial number field in the device number as a key value.
[0013] In some embodiments, the step of sending reply data including target device numbers to the master device in sequence by multiple target slave devices 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 satisfied;
[0016] If it is in 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 it is not in the idle state, then when the second waiting time is satisfied and the communication bus is idle, the current target slave device sends reply data including the target device number to the master device.
[0018] In some embodiments, the method further comprises the step of calculating a second waiting time:
[0019] The first value is obtained by summing the ASCII code values of each character in the target device number of the current target slave device, the number of times the current target slave device is checked is used as the second value, and the duration of the last check to see whether the communication bus is in an idle state is used as the 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 comprises:
[0022] Set a waiting times threshold. If the reply data is not sent successfully after the waiting times threshold is exceeded, the serial port of the communication bus will be monitored by the current target slave device. When the monitoring result shows that the communication bus is idle, the reply data will be sent to the master device.
[0023] In some embodiments, the step of performing a hash calculation on the target device number based on the received reply data to obtain an update key value by the master device includes:
[0024] After receiving the reply data sent by the target slave device, the master device registers the target device number in the reply data, performs a hash calculation on the target device number to obtain the update key value corresponding to the target slave device, and updates the hash table based on the update 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 update key value to the target slave device, so that the target slave device verifies the target device number in the update request and updates the local hash table according to the update key value when the verification passes.
[0027] In some embodiments, after the master device receives the reply data sent by the slave device, the method further includes:
[0028] Determine the timestamp of receiving the reply data, concatenate the target device number and the timestamp, the random number, and at least one of the device type code, perform hash calculation on the concatenated field to obtain an update key value, and update the hash table according to the update key value.
[0029] In some embodiments, the method is applied to a fast shutdown system, where the master device is a transmitter and the slave device is a shutdown device.
[0030] In order to solve the above problem, one aspect of an embodiment of the present invention provides a device communication apparatus based on a single bus communication system, comprising:
[0031] A hash table construction module is used to obtain device numbers of multiple slave devices, extract characteristic data fields in the device numbers, and construct hash tables corresponding to the multiple slave devices using the device numbers as keys and the characteristic data fields in the device numbers as key values;
[0032] A hash table update module is configured to send a device number acquisition request to multiple target slave devices having the same key value via a communication bus through a master device, so that the multiple target slave devices sequentially send reply data including the target device number to the master device based on an exponential backoff algorithm. The master device performs a 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.
[0033] The communication module is used for the master device to communicate with the corresponding slave device based on the updated hash table.
[0034] In order to solve the above problems, one aspect of an embodiment of the present invention provides a fast shutdown system, including: a transmitter, a switch, a processor, and a memory for storing a program, wherein the transmitter is a master device, the switch is a slave device, and the master device and the slave device communicate based on a single bus communication system; the program includes instructions, and when the instructions are executed by the processor, the processor executes any of the above-mentioned device communication methods based on the single bus communication system.
[0035] The beneficial effects of the embodiments of the present invention are as follows: by obtaining the device numbers of multiple slave devices and extracting the characteristic data fields in the device numbers, a hash table corresponding to multiple slave devices is constructed with the device numbers as keys and the characteristic data fields in the device numbers as key values; a master device sends a device number acquisition request to multiple target slave devices with the same key value via a communication bus, so that the multiple target slave devices sequentially send reply data including the target device numbers to the master device based on an exponential backoff algorithm; the master device performs a hash calculation on the target device numbers 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 updates the hash table based on the updated key value The new technical means of communicating with the corresponding slave device through the hash table overcomes the problem of hash conflicts caused by the introduction of hash tables in related technologies, which in turn affects the data transmission accuracy and system operation stability during the device communication process. It realizes the construction of a hash table based on the device number of the slave device and the characteristic data field in the device number, and then updates the key values of multiple slave devices with the same key value, thereby avoiding the problem of hash conflicts. While simplifying wiring and reducing costs, it effectively guarantees the data transmission accuracy and system operation stability during the communication process between the master and slave devices, and expands the applicable scenarios of the device communication method based on the single bus communication system.
[0036] The details of one or more embodiments of the invention are set forth in the accompanying drawings and the description below so that other features, objects, and advantages of the invention are more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be derived from these drawings without inventive effort.
[0038] Figure 1This is a schematic diagram of the main flow of a device communication method based on a single bus communication system according to an embodiment of the present invention.
[0039] Figure 2 It is a schematic diagram of extracting characteristic data fields from a device number according to an embodiment of the present invention.
[0040] Figure 3 This is a schematic diagram of a master device sending a device number acquisition request to multiple target slave devices having the same key value according to an embodiment of the present invention.
[0041] Figure 4 This is a flowchart of a slave device responding to a request from a master device based on an exponential backoff algorithm according to an embodiment of the present invention.
[0042] Figure 5 It is a schematic diagram of a framework of a device communication apparatus based on a single bus communication system according to an embodiment of the present invention.
[0043] Figure 6 It is a schematic structural diagram of the electronic device of the present invention. DETAILED DESCRIPTION
[0044] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.
[0045] In related technologies, by introducing hash tables, different slave devices can be effectively distinguished, ensuring that the master device can correctly identify each slave device, thereby realizing one-to-one communication between the master and slave devices. However, the introduction of hash tables also brings the problem of hash conflicts. How to effectively solve the hash conflict problem in the communication between master and slave devices in a 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 urgently.
[0046] On the other hand, the Rapid Shutdown System (RSS) is a safety feature designed primarily to enhance the safety of photovoltaic power generation systems. When the system requires maintenance or in an emergency, such as a fire, the transmitter in the rapid shutdown system can send a shutdown command to the circuit breaker to achieve a component-level shutdown, ensuring the safe operation of other photovoltaic components and inverters. To simplify wiring and reduce costs, the transmitter (master device) and circuit breaker (slave device) in the rapid shutdown system often communicate using a single-wire bus communication system (a single-wire bus communication system refers to a communication system that uses a single wire for data transmission).
[0047] If the hash conflict problem between the master and slave devices in the single-bus communication system can be avoided, it is possible to simplify the wiring of the rapid shutdown system and reduce the deployment cost of the rapid shutdown system, while effectively ensuring the data transmission accuracy and system operation stability during the communication process between the master and slave devices, and expanding the applicable scenarios of the device communication method based on the single-bus communication system.
[0048] In order to solve the above problems, the embodiment of the present invention provides a device communication method based on a single bus communication system, such as Figure 1 As shown, the device communication method based on the single bus communication system mainly includes:
[0049] Step S101: Obtain device numbers of multiple slave devices, extract characteristic data fields in the device numbers, and construct a hash table corresponding to the multiple slave devices using the device numbers as keys and the characteristic data fields in the device numbers as key values.
[0050] Through the above settings, the unique identifier of the device (device number, i.e., device SN number) is used as the key, and the characteristic data field in the device number is used as the key value to form a hash table, which initially provides the master device with the ability to quickly find and identify slave devices.
[0051] The data fields corresponding to the device number provided in the embodiment of the present invention include a device description field, a production time field, and a serial number field.
[0052] In some embodiments, the serial number field is used as the characteristic data field; the above method includes: using the device number as a key and the serial number field in the device number as a key value to construct a hash table corresponding to multiple slave devices.
[0053] According to a specific implementation of an embodiment of the present invention, the naming rule of the device number includes a device description field + a production time field + a serial number field, wherein the device 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 specific date of device production, also known as the manufacturing date; and the serial number field indicates the specific serial number of the device, which is used to distinguish different devices in 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; "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 is 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] Through the above settings, the serial number field in the device number is usually highly unique, which effectively reduces the occurrence of hash conflicts. The hash table constructed based on the mapping relationship between the above device number and 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 an updated key value, and updates the hash table according to the updated key value.
[0056] The exponential backoff algorithm provided in embodiments of the present invention is a technique for resolving conflicts in network communications. It reduces the probability of conflicts by requiring devices to wait for a time interval that increases exponentially with the number of bus conflicts before attempting to retransmit. This algorithm is used in various network communication protocols, particularly in single-bus communication systems, where it can effectively avoid bus conflicts caused by multiple devices sending data simultaneously.
[0057] Through the above settings, based on the exponential backoff algorithm, multiple target slave devices will not send data at the same time 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 the effective transmission of data 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 the occurrence of hash conflicts.
[0058] According to a specific implementation of an embodiment of the present invention, in order to avoid single bus transmission conflicts caused by multiple target slave devices sending reply data at the same time in response to the request of the master device, in addition to adopting the above-mentioned exponential backoff algorithm, a priority scheduling scheme can also be adopted, that is, assigning a priority to each target slave device, and sending data in sequence according to the priority to reduce bus occupancy conflicts; or a time slot allocation scheme can be adopted, that is, pre-allocating the sending time slot for each target slave device, and sending reply data in order of the time slots.
[0059] In some embodiments, the steps of the above-mentioned multiple target slave devices sending reply data including the target device number to the master device in sequence based on the exponential backoff algorithm include: after receiving the device number acquisition request sent by the master device, any target slave device performs 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 it is in an idle state, the current target slave device sends reply data including the target device number to the master device via the communication bus; if it is not in an idle state, then when the second waiting time is met and the communication bus is idle, the current target slave device sends reply data including the target device number to the master device.
[0060] Based on the above steps, the embodiment of the present invention solves the problem of how to avoid bus conflicts caused by multiple target slave devices simultaneously sending data after receiving a request from a master device in a single-bus communication system. Specifically, by introducing a random waiting time between target slave devices, the probability of multiple target slave devices attempting to send data simultaneously can be significantly reduced, thereby reducing bus conflicts. At the same time, by checking whether the bus is idle and sending data when the bus is idle, it ensures that data can be sent in an orderly manner, avoiding confusion and loss of data packets. 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 communication.
[0061] According to a specific implementation of the embodiment of the present invention, Figure 3 A schematic diagram shows a master device sending requests to multiple target slave devices with the same key value via a single bus in a single bus communication system. Figure 4The figure shows a flow chart of the target slave device responding 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 a key value (KEY value) of "000X", for the device number "XX20240530000X", after receiving the request from the master device, it first randomly extends the first waiting time t, 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, that is, 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, the second waiting time 2t is extended again. At this time, the bus is idle, and the reply data can be sent to the master device through the bus.
[0062] Among them, the preset waiting time interval provided in the embodiment of the present invention 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 values corresponding to the preset waiting time interval are not intended to limit this application and can be adaptively adjusted according to specific scenarios (the number of slave devices, the number of target slave devices, etc.).
[0063] In some embodiments, the above method also includes the step of calculating the second waiting time: summing 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, using the number of times the current target slave device is checked as the second value, and using the time taken for the last check to see whether the communication bus is in an idle state as the third value; and calculating the second waiting time based on the first value, the second value and the third value.
[0064] The above provides an example of generating a first waiting time (first waiting time). Based on the above steps, an embodiment of the present invention provides an example of calculating a second waiting time (i.e., subsequent waiting time, including the second waiting time, the third waiting time, etc.).
[0065] Specifically, by introducing multiple factors (such as the sum of the ASCII code values of the device number, the number of checks, and the time taken to check the bus last time) to calculate the second waiting time, the sending timing of each target slave device can be controlled more precisely, thereby further reducing the probability of conflict. Among them, each target slave device calculates the second waiting time based on its own device number (device SN) and the current number of checks, making the delay time of each target slave device more personalized, avoiding all target slave devices from adopting exactly the same delay strategy; and dynamically adjusting the delay time based on the time taken to check whether the bus is idle last time, 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 probability of conflict 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 thus improving the overall efficiency of communication.
[0066] According to a specific implementation of an embodiment of the present invention, the code value of the ASCII code of each character in the device number of the target slave device is summed to obtain a first value K, the number of times the current target slave device is checked is used as the second value J, and the time taken to check whether the communication bus is in an idle state for the last time is used as the third value t, and the delay time (second waiting time) T2 = K+2(J-1)*t is repeated again.
[0067] In some embodiments, the above method also includes: setting a waiting time threshold, if the waiting time threshold is exceeded and the reply data is still not successfully sent, monitoring the serial port of the communication bus through the current target slave device, and sending reply data to the master device when the monitoring result shows that the communication bus is in an idle state.
[0068] In a single-bus communication system, setting a wait count threshold and then deciding whether to send data by monitoring the communication bus status after exceeding the threshold can further improve system reliability and communication efficiency. Setting a wait count threshold prevents slave devices from being stuck in an infinite wait state when attempting to send data. Once the threshold is exceeded, the target slave device will take more proactive measures to send data, thereby ensuring communication reliability. Specifically, after multiple failed attempts to send data, the target slave device can promptly change its strategy and actively monitor the bus status instead of blindly waiting, thus reducing unnecessary waiting time and conserving resources. Furthermore, by setting a wait count threshold, the system can dynamically adjust its communication strategy based on current network conditions, avoiding excessive delays under high load and improving communication efficiency. It can also prevent slave devices from becoming locked due to prolonged waiting, ensuring normal system operation.
[0069] In some embodiments, the step in which the master device performs a hash calculation on the target device number based on the received reply data to obtain an updated key value includes: after the master device receives the reply data sent by the target slave device, it registers the target device number in the reply data, performs a hash calculation on the target device number to obtain an updated key value corresponding to the target slave device, and updates the hash table based on the updated key value.
[0070] With the above setup, the hash table is updated by performing a hash calculation on the target device number returned by the target slave device to obtain an updated key value. This ensures that the hash table always reflects the latest device status and improves the accuracy of the hash table. 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 hash conflicts and improving hash table search efficiency. Based on the updated hash table, the master device can more accurately identify and locate each slave device, improving communication reliability.
[0071] In some embodiments, the above method also includes: sending an update request including a target device number and an update key value to the target slave device through the master device, so that the target slave device verifies the target device number in the update request, and updates the local hash table according to the update key value when the verification passes.
[0072] Based on the above setup, the master device sends an update request, including the target device ID and update key value, to the target slave device, and requires the slave device to perform verification. This ensures data consistency and security, improving system reliability. This approach enables the system to better cope with various potential security threats and data inconsistencies, ensuring coordination and consistency across the entire system. It also provides the system with greater flexibility and dynamic adjustment capabilities, thereby improving overall system performance.
[0073] In some embodiments, after the master device receives the reply data sent by the slave device, the above method further includes: determining the timestamp of receiving the reply data, splicing the target device number and the timestamp, the random number and at least one of the device type code, performing hash calculation on the spliced field to obtain an updated key value, and updating the hash table according to the updated key value.
[0074] The above steps provide several specific schemes for calculating update key values in an embodiment of the present invention. After the master device receives the reply data sent by the slave device, it determines the timestamp and concatenates the target device number with at least one of the timestamp, random number, and device type code. Then, a hash calculation is performed on the concatenated field to obtain the update key value. The hash table is updated according to the update key value. This can significantly improve the accuracy of hash table updates, reduce hash conflicts, and enhance data freshness and security. This method enables the system to better adapt to dynamically changing device states and ensure efficient and accurate communication. At the same time, this method also provides the system with more flexibility and dynamic adjustment capabilities, thereby improving the overall performance of the system.
[0075] Step S103: The master device communicates with the corresponding slave device based on the updated hash table.
[0076] This setup, which enables master-slave device communication based on an updated hash table, overcomes the challenges of device identification, hash conflicts, and miscommunication in single-bus communication systems. It effectively ensures that the master device accurately identifies each slave device, improving communication efficiency, reducing the possibility of miscommunication, and enhancing data transmission accuracy and system stability during device communication. Furthermore, this solution provides greater flexibility and adaptability, effectively expanding its applicable scenarios.
[0077] In some embodiments, the method is applied to a fast shutdown system, wherein the master device is a transmitter and the slave device is a switch.
[0078] The Rapid Shutdown System (RSS) is a safety function 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 where fast response and high reliability are required. Applying the above-mentioned device communication method based on a single bus communication system to the rapid shutdown system can achieve an efficient, reliable and secure communication mechanism between the transmitter (master device) and the switch (slave device), and realize accurate identification of the slave device (shutdown device) by the master device (transmitter). Through the dynamic update mechanism of the hash table, it can ensure that the communication between the transmitter and the switch is more reliable, reduce shutdown failures due to communication errors or data conflicts, and significantly improve the response speed and reliability of the rapid shutdown system.
[0079] It should be noted that the above-mentioned device communication method based on the single bus communication system provided in the embodiment of the present invention can also be applied to other communication scenarios of master and slave devices where hash conflicts exist, so as to avoid hash conflicts and effectively ensure the data transmission accuracy and system operation stability during the communication process between the master and slave devices.
[0080] The device communication method based on the single bus communication system provided by the embodiment of the present invention obtains the device numbers of multiple slave devices and extracts the characteristic data fields in the device numbers, uses the device numbers as keys and the characteristic data fields in the device numbers as key values to construct a hash table corresponding to the multiple slave devices; a 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 an updated key value, and updates the hash table according to the updated key value. New; the technical means for the master device to communicate with the corresponding slave device based on the updated hash table overcomes the problem of hash conflicts caused by the introduction of hash tables in related technologies, which in turn affects the data transmission accuracy and system operation stability during device communication. It realizes first building a hash table based on the device number of the slave device and the characteristic data field in the device number, and then updating the key values of multiple slave devices with the same key value, thereby avoiding the problem of hash conflicts. While simplifying wiring and reducing costs, it effectively guarantees the data transmission accuracy and system operation stability during the communication between the master and slave devices, and expands the applicable scenarios of the device communication method based on the single bus communication system.
[0081] Based on the above-mentioned device communication method based on a single bus communication system provided by an embodiment of the present invention, an embodiment of the present invention further provides a device communication device based on a single bus communication system, which is applied to a scenario in which a master and a slave device communicate based on a single bus communication system, such as Figure 5 As shown, the device communication device 500 based on the single bus communication system includes:
[0082] The hash table construction module 501 is used to obtain the device numbers of multiple slave devices, extract the characteristic data fields in the device numbers, and construct hash tables corresponding to the multiple slave devices using the device numbers as keys and the characteristic data fields in the device numbers as key values.
[0083] Through the above settings, a hash table is formed with the device number as the key and the characteristic data field in the device number as the key value, which initially provides the master device with the ability to quickly find and identify slave devices.
[0084] In some of the embodiments, the data fields corresponding to the device number include a device description field, a production time field, and a serial number field; the serial number field is used as a characteristic data field; the above-mentioned hash table construction module 501 is also used to: use the device number as a key and the serial number field in the device number as a key value to construct multiple hash tables corresponding to the slave devices.
[0085] Through the above settings, since the serial number field in the device number is usually highly unique, the occurrence of hash conflicts is effectively reduced. The hash table constructed according to the mapping relationship between the above device number and serial number field helps the master device to accurately identify and locate each slave device in subsequent communications.
[0086] The hash table update module 502 is used to send a device number acquisition request to multiple target slave devices with the same key value via the communication bus through the master device, so that the multiple target slave devices send reply data including the target device number to the master device in sequence 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 an updated key value, and updates the hash table according to the updated key value.
[0087] Through the above settings, based on the exponential backoff algorithm, multiple target slave devices will not send data at the same time 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 the effective transmission of data 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 the occurrence of hash conflicts.
[0088] In some embodiments, the hash table update module 502 is also used to: after receiving a 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 it is in an idle state, the current target slave device sends reply data including the target device number to the master device via the communication bus; if it is not in an idle state, then when the second waiting time is met and the communication bus is idle, the current target slave device sends reply data including the target device number to the master device.
[0089] Through the above arrangement, the problem of how to avoid bus conflicts caused by multiple target slave devices sending data simultaneously after receiving a request from a master device in a single bus communication system is solved.
[0090] In some embodiments, the above-mentioned device communication apparatus 500 based on a single bus communication system also includes a second waiting time calculation module, which is used 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, use the number of times the current target slave device is checked as the second value, and use the time taken for the last check to see whether the communication bus is in an idle state as the third value; and calculate the second waiting time based on the first value, the second value and the third value.
[0091] By introducing multiple factors (such as the sum of the ASCII code values of the device numbers, the number of checks, and the time taken by the last bus check) to calculate the second waiting time, the sending timing of each target slave device can be more finely controlled, thereby further reducing the probability of conflict.
[0092] In some of the embodiments, the above-mentioned device communication device 500 based on the single bus communication system also includes a waiting times setting module, which is used to: set a waiting times threshold. If the waiting times threshold is exceeded and the current target slave device still fails to successfully send reply data, the current target slave device is controlled to monitor the serial port of the communication bus through the current target slave device, and when the monitoring result shows that the communication bus is in an idle state, reply data is sent to the master device.
[0093] By setting a wait threshold, you can prevent the slave device from getting stuck in an infinite wait state when trying to send data. Once the threshold is exceeded, the target slave device will take more active measures to send data, thus ensuring the reliability of communication.
[0094] In some embodiments, the above-mentioned hash table update module 502 is also used for: after the master device receives the reply data sent by the target slave device, registering the target device number in the reply data, performing a hash calculation on the target device number to obtain the update key value corresponding to the target slave device, and updating the hash table based on the update key value.
[0095] Through the above settings, 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 hash conflicts 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, thereby improving the reliability of communication.
[0096] In some of the embodiments, after the master device receives the reply data sent by the slave device, the above-mentioned hash table update module 502 is also used to: determine the timestamp of receiving the reply data, splice the target device number and the timestamp, the random number and at least one of the device type code, perform hash calculation on the spliced field to obtain an update key value, and update the hash table according to the updated key value.
[0097] The communication module 503 is used for 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 communicate based on the updated hash table, and then communicates and interacts with the specific slave device via the single bus communication system.
[0099] In some embodiments, the apparatus is provided in a fast shutdown system, the master device is a transmitter, and the slave device is a switch.
[0100] Applying the above-mentioned device communication device based on the single bus communication system to the fast shutdown system can realize an efficient, reliable and secure communication mechanism between the transmitter (master device) and the switch (slave device), and realize the accurate identification of the slave device (switch) by the master device (transmitter). Through the dynamic update mechanism of the hash table, it can ensure that the communication between the transmitter and the switch is more reliable, reduce the shutdown failure caused by communication errors or data conflicts, and significantly improve the response speed and reliability of the fast shutdown system.
[0101] The above-mentioned device communication device based on the single bus communication system provided by the embodiment of the present invention adopts a hash table construction module to obtain the device numbers of multiple slave devices, and extracts the characteristic data fields in the device numbers, and uses the device numbers as keys and the characteristic data fields in the device numbers as key values to construct hash tables corresponding to multiple slave devices; adopts a hash table update module to send device number acquisition requests to multiple target slave devices with the same key values via the communication bus through the master device, so that the multiple target slave devices sequentially send reply data including the target device numbers to the master device based on the exponential backoff algorithm, and the master device performs a hash calculation on the target device numbers based on the received reply data to obtain an updated key value, and updates the hash table according to the updated key value; and adopts a communication module for the master device to communicate with the corresponding slave devices based on the updated hash table. The method overcomes the problem of hash conflicts caused by the introduction of hash tables in related technologies, which in turn affects the data transmission accuracy and system operation stability during device communication. It first builds a hash table based on the device number of the slave device and the characteristic data field in the device number, and then updates the key values of multiple slave devices with the same key value, thereby avoiding the problem of hash conflicts. While simplifying wiring and reducing costs, it effectively guarantees the data transmission accuracy and system operation stability during communication between master and slave devices, and expands the technical effect of the applicable scenarios of the device communication method based on the single bus communication system.
[0102] In order to solve the above problems, an embodiment of the present invention also provides a fast shutdown system, including: a transmitter, a switch, a processor, and a memory for storing a program, the transmitter is a master device, the switch is a slave device, and the master device and the slave device communicate based on a single bus communication system; the program includes instructions, and when the instructions are executed by the processor, the processor executes any of the above-mentioned device communication methods based on the single bus communication system.
[0103] Through the above-mentioned setting, the above-mentioned device communication method based on the single bus communication system is applied to the fast shutdown system, which can realize an efficient, reliable and secure communication mechanism between the transmitter (master device) and the switch (slave device), and realize the accurate identification of the slave device (switch) by the master device (transmitter). Through the dynamic update mechanism of the hash table, it can ensure that the communication between the transmitter and the switch is more reliable, reduce the shutdown failure caused by communication errors or data conflicts, and significantly improve the response speed and reliability of the fast shutdown system.
[0104] An embodiment of the present invention further provides a non-transitory machine-readable medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform the method of the embodiment of the present invention.
[0105] An embodiment of the present invention further provides a computer program product, including a computer program, wherein the computer program, when executed by a processor of a computer, is configured to cause the computer to perform the method of an embodiment of the present invention. A computer program product should be understood as a software product that primarily implements the above-described method of the present application through a computer program.
[0106] An embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, wherein the computer program, when executed by the at least one processor, causes the electronic device to perform the method of an embodiment of the present invention.
[0107] refer to Figure 6 , a block diagram of an electronic device that can serve as a server or client of an embodiment of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0108] like Figure 6As shown, the electronic device includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for the 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 via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0109] Multiple components within 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 capable of inputting information into the electronic device. The input unit 606 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 607 can be any type of device capable of presenting information and may 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 may include, but is not limited to, a magnetic disk or an optical disk. The communication unit 609 allows the electronic device to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks and may 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 processing components with 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 dedicated artificial intelligence (AI) computing units, various computing units for running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above. For example, in some embodiments, the method embodiments of the present invention may be implemented as a computer program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on an electronic device via ROM 602 and / or communication unit 609. In some embodiments, the computing unit 601 can be configured to perform the above-described method in any other appropriate manner (e.g., by means of firmware).
[0111] The computer programs for implementing the methods of the embodiments of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0112] In the context of an embodiment of the present invention, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device, or apparatus. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable signal medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, or infrared system, device, or apparatus, or any suitable combination of the foregoing. More specific examples of machine-readable storage media can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0113] It should be noted that the term "including" and its variations used in the embodiments of the present invention are open-ended, i.e., "including but not limited to." The term "based on" means "based at least in part on." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; and the term "some embodiments" means "at least some embodiments." The modifications of "one" and "a plurality of" mentioned in the embodiments of the present invention are illustrative and non-restrictive. Those skilled in the art should understand that, unless the context clearly indicates otherwise, they should be understood as "one or more."
[0114] The data involved in the embodiments of the present invention (including but not limited to data used for analysis, stored data, displayed data, etc.) are all data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0115] The various steps described in the method implementation scheme provided in the embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method implementation scheme may include additional steps and / or omit the steps shown. The scope of protection of the present invention is not limited in this respect.
[0116] The term "embodiment" in this specification refers to specific features, structures, or characteristics described in conjunction with the embodiment that can be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. The various embodiments in this specification are described in a related manner, and the same or similar parts between the various embodiments are referenced to each other. In particular, for the embodiments of the device, equipment, and system, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts are referred to the partial description of the method embodiment.
[0117] The above-described embodiments merely illustrate several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of protection. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims.
Claims
1. A device communication method based on a single bus communication system, characterized in that: include: Obtain device numbers of multiple slave devices, extract characteristic data fields in the device numbers, and construct hash tables corresponding to the multiple slave devices using the device numbers as keys and the characteristic data fields in the device numbers as key values; The master device sends a device number acquisition request to multiple target slave devices having the same key value via a communication bus, so that the multiple target slave devices sequentially send reply data including the target device number to the master device based on an exponential backoff algorithm, and the master device performs a 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.
2. The method according to claim 1, characterized in that The device number includes a device description field, a production time field and a serial number field, and the serial number field is used as a characteristic data field; the method includes: A hash table corresponding to the multiple slave devices is constructed using the device number as a key and a serial number field in the device number as a key value.
3. The method according to claim 1, characterized in that The step of the plurality of target slave devices sequentially sending reply data including the target device numbers to the master device based on an exponential backoff algorithm comprises: After receiving the device number acquisition request sent by the master device, any of the target slave devices performs the following steps: 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 satisfying the first waiting time; If in an idle state, the current target slave device sends reply data including a target device number to the master device via the communication bus; If it is not in an idle state, when the second waiting time is satisfied and the communication bus is idle, the current target slave device sends reply data including the target device number to the master device.
4. The method according to claim 3, characterized in that The method further comprises the step of calculating a second waiting time: The code value of the ASCII code of each character in the target device number of the current target slave device is summed to obtain a first value, the number of times the current target slave device is checked is used as a second value, and the duration of the last check to see whether the communication bus is in an idle state is used as a third value; The second waiting time is calculated according to the first value, the second value and the third value.
5. The method according to claim 3, characterized in that: The method further comprises: A waiting times threshold is set. If the reply data is not sent successfully after the waiting times threshold is exceeded, the serial port of the communication bus is monitored by the current target slave device. When the monitoring result shows that the communication bus is in an idle state, the reply data is sent to the master device.
6. The method according to claim 1, characterized in that The step of the master device performing a hash calculation on the target device number based on the received reply data to obtain an update key value comprises: After receiving the reply data sent by the target slave device, the master device registers the target device number in the reply data, performs a hash calculation on the target device number to obtain an update key value corresponding to the target slave device, and updates the hash table based on the update key value.
7. The method according to claim 6, characterized in that The method further comprises: An update request including the target device number and the update key value is sent to the target slave device through the master device, so that the target slave device verifies the target device number in the update request, and updates the local hash table according to the update key value when the verification passes.
8. The method according to claim 1, characterized in that: After the master device receives the reply data sent by the slave device, the method further includes: Determine the timestamp of receiving the reply data, concatenate the target device number and at least one of the timestamp, random number and device type code, perform hash calculation on the concatenated field to obtain an update key value, and update the hash table according to the update key value.
9. The method according to claim 1, characterized in that: The method is applied in a fast shutdown system, wherein the master device is a transmitter and the slave device is a switch.
10. A device communication device based on a single bus communication system, characterized in that: include: A hash table construction module is used to obtain device numbers of multiple slave devices, extract characteristic data fields in the device numbers, and construct hash tables corresponding to the multiple slave devices using the device numbers as keys and the characteristic data fields in the device numbers as key values; A hash table update module, configured to send a device number acquisition request to multiple target slave devices having the same key value through a master device via a communication bus, so that the multiple target slave devices sequentially send reply data including the target device number to the master device based on an exponential backoff algorithm, and the master device performs a hash calculation on the target device number 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 is used for the master device to communicate with the corresponding slave device based on the updated hash table.
11. A rapid shutdown system, comprising: A transmitter, a switch, a processor, and a memory for storing a program, characterized in that the transmitter is a master device, the switch is a slave device, and the master device and the slave device communicate based on a single bus communication system; the program includes instructions, and when the instructions are executed by the processor, the processor executes 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
Oral cleasing composition using fermented amino acid and minerals, and method therof
KR1020250059829A
Synchronization of load-balancing switches
US20130332555A1
Correlation-based hash tree verification
US20210243009A1