Communication method and device of underhung device, electronic device and storage medium

By acquiring and processing the protocol segments and location attributes of the connected devices, efficient communication between devices in the data center group control system is achieved, solving the problem of low communication efficiency caused by the diversity of device types and improving the system's flexibility and stability.

CN119583678BActive Publication Date: 2025-11-11NANJING HUAZHI CONSTRUCT CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411571675.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-11-11
Estimated Expiration
2044-11-06

AI Technical Summary

Technical Problem

Due to the variety of equipment types and different communication protocols in the data center group control system, it is difficult to respond in a timely manner when equipment changes, resulting in insufficient communication efficiency.

Method used

By obtaining the protocol segment corresponding to the communication point of the downstream device, determining the point attribute, generating protocol data, and obtaining the protocol data of the target device through real-time parameters after initialization, device communication is realized.

Benefits of technology

It improves the communication efficiency of devices on the communication bus, reduces program development and debugging work, and enhances the system's versatility and communication stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583678B_ABST
    Figure CN119583678B_ABST
Patent Text Reader

Abstract

This application relates to a communication method, apparatus, electronic device, and storage medium for a downstream device, belonging to the field of device communication technology. The method includes: for at least one downstream device connected in series with a communication bus, acquiring multiple protocol segments corresponding to each communication point in the downstream device; determining protocol data corresponding to each communication point based on the point attributes of each protocol segment to complete the initialization of the downstream device; after the initialization of each downstream device is completed, determining the protocol data of each communication point based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data; the target device is any downstream device; the target point attributes are real-time parameters in the point attributes. This method can improve device communication efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of device communication technology, and in particular to a communication method, apparatus, electronic device, storage medium, and computer program product for a connected device. Background Technology

[0002] A data center group control system is a comprehensive management platform used to monitor and manage multiple devices, systems, and facilities within a data center. During the development and debugging process, due to the diverse types of equipment purchased by customers and the different communication methods used by the manufacturers of these devices, there are significant differences in the communication protocols (Modbus RTU) of the devices connected to the system.

[0003] When multiple devices in a data center group control system undergo changes or maintenance, in order to ensure the stability of the data center group control system, it is necessary to redevelop the program of the data center group control system for each device. As a result, it is impossible to communicate and respond to each device in a timely manner, leading to insufficient communication efficiency among the devices in the data center group control system. Summary of the Invention

[0004] Therefore, it is necessary to provide a communication method, apparatus, electronic device, computer-readable storage medium, and computer program product for a downstream device that can improve the communication efficiency of the aforementioned technical problems.

[0005] Firstly, this application provides a communication method for a downstream device. The method includes:

[0006] For at least one downstream device connected in series under the communication bus, obtain multiple protocol segments corresponding to each communication point contained in the downstream device;

[0007] Based on the point attributes of each protocol segment corresponding to the communication point, determine the protocol data corresponding to each communication point to complete the initialization of the downstream device;

[0008] Once each of the aforementioned downstream devices has completed initialization, the protocol data for each communication point is determined based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data; the target device can be any of the aforementioned downstream devices; the target point attributes are the real-time parameters in the point attributes.

[0009] In one embodiment, obtaining the multiple protocol segments corresponding to each communication point included in the connected device includes:

[0010] Read the pre-built protocol table corresponding to the downstream device and obtain multiple protocol segments contained in the protocol table; wherein, a protocol segment contains at least one point attribute of the communication point; a protocol segment corresponds to a type of point attribute; the type of the point attribute includes point name, unit and unit multiplier, real-time parameter multiplier and real-time parameter.

[0011] In one embodiment, determining the protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point includes:

[0012] For each of the protocol segments, based on the first end marker in the protocol segment, the point attribute of the communication point corresponding to the first end marker is determined; the first end marker is the end character of each of the communication points.

[0013] Generate the output protocol point corresponding to the point attribute, and store the protocol data matching the communication point in the output protocol point.

[0014] In one embodiment, determining the location attribute of the communication point corresponding to the first end marker based on the first end marker in the protocol segment includes:

[0015] For each character in the current protocol segment, if the character is determined to be a first end marker, then the character before the first end marker is determined to be the point attribute of the communication point corresponding to the first end marker.

[0016] If the character is determined to be a non-end marker, then traverse to the next character until the traversal of the characters is completed.

[0017] In one embodiment, the method further includes:

[0018] For each character in the current protocol segment, if the current data of the protocol segment is the second end marker, then the matching relationship between each communication point corresponding to the second end marker and the protocol data is locked to obtain the protocol data after locking the matching relationship; the second end marker is the end character of each protocol segment.

[0019] In one embodiment, determining the protocol data of each communication point based on the target point attributes of each communication point in the target device includes:

[0020] Obtain the target protocol segment corresponding to each communication point contained in the target device, wherein the target protocol segment contains the target point attributes of each communication point contained in the target device;

[0021] Based on the target location attributes, determine the output protocol location corresponding to the target location attributes, and obtain the protocol data stored in the output protocol location.

[0022] In one embodiment, before determining the output protocol point corresponding to the target point attribute based on the target point attribute, the method further includes:

[0023] For each character in the target protocol segment, if the character is determined to be a first end marker, then the character before the first end marker is determined to be the target point attribute of the communication point corresponding to the first end marker.

[0024] If the character is determined to be a non-end marker, then traverse to the next character until the traversal of the characters is completed.

[0025] Secondly, this application also provides a communication device for a downstream device. The device includes:

[0026] The protocol segment acquisition module is used to acquire multiple protocol segments corresponding to each communication point contained in at least one downstream device connected in series under the communication bus.

[0027] The protocol data determination module is used to determine the protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point, so as to complete the initialization of the downstream device.

[0028] The communication module is used to determine the protocol data of each communication point based on the target point attributes of each communication point in the target device after each of the attached devices has completed initialization, so that the controller can communicate with the target device based on the protocol data; the target device is any of the attached devices; the target point attributes are the real-time parameters in the point attributes.

[0029] Thirdly, this application also provides an electronic device. The electronic device includes a memory and a processor, the memory storing a computer program that, when executed by the processor, performs the following steps:

[0030] For at least one downstream device connected in series under the communication bus, obtain multiple protocol segments corresponding to each communication point contained in the downstream device;

[0031] Based on the point attributes of each protocol segment corresponding to the communication point, determine the protocol data corresponding to each communication point to complete the initialization of the downstream device;

[0032] Once each of the aforementioned downstream devices has completed initialization, the protocol data for each communication point is determined based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data; the target device can be any of the aforementioned downstream devices; the target point attributes are the real-time parameters in the point attributes.

[0033] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0034] For at least one downstream device connected in series under the communication bus, obtain multiple protocol segments corresponding to each communication point contained in the downstream device;

[0035] Based on the point attributes of each protocol segment corresponding to the communication point, determine the protocol data corresponding to each communication point to complete the initialization of the downstream device;

[0036] Once each of the aforementioned downstream devices has completed initialization, the protocol data for each communication point is determined based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data; the target device can be any of the aforementioned downstream devices; the target point attributes are the real-time parameters in the point attributes.

[0037] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0038] For at least one downstream device connected in series under the communication bus, obtain multiple protocol segments corresponding to each communication point contained in the downstream device;

[0039] Based on the point attributes of each protocol segment corresponding to the communication point, determine the protocol data corresponding to each communication point to complete the initialization of the downstream device;

[0040] Once each of the aforementioned downstream devices has completed initialization, the protocol data for each communication point is determined based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data; the target device can be any of the aforementioned downstream devices; the target point attributes are the real-time parameters in the point attributes.

[0041] The aforementioned communication method, apparatus, electronic device, storage medium, and computer program product for downstream devices acquire multiple protocol segments contained in the downstream devices connected in series on the communication bus. Each protocol segment contains the point attributes of multiple communication points corresponding to the downstream device. Based on the point attributes, the protocol data for each communication point is determined, thereby completing the initialization of the downstream devices. If all downstream devices have completed initialization, any downstream device in the communication bus is identified as the target device, and the target point attributes of each communication point in the target device are acquired. Based on the target point attributes, the protocol data for each communication point is determined, thereby controlling the target device to communicate through the protocol data. The communication bus can connect multiple devices in series, and each device can contain multiple communication points. To determine the protocol data for each communication point, the initialization of the downstream devices enables the configuration of the protocol data for each device on the communication bus. After initialization, the protocol data for any device or device point can be acquired through real-time parameters. The communication device can directly send the protocol data to the controller, so that the controller can directly perform communication between devices or device points without executing additional program code, improving the communication efficiency of devices in the communication bus. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 This is an application environment diagram of a communication method for a downstream device in one embodiment.

[0044] Figure 2 This is a flowchart illustrating the communication method of a downstream device in one embodiment;

[0045] Figure 3 This is a flowchart illustrating the communication method of the downstream device in another embodiment;

[0046] Figure 4 This is a schematic diagram of the protocol table in one embodiment;

[0047] Figure 5 This is a flowchart illustrating the communication method of the downstream device in another embodiment;

[0048] Figure 6 This is a structural block diagram of the communication device of the downstream device in one embodiment;

[0049] Figure 7 This is a diagram of the internal structure of an electronic device in one embodiment. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0051] The communication method for the downstream device provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the adaptive communication device is connected in series with the controller and downstream devices on the same communication bus. The downstream devices can be multiple units, each containing at least one device, and each device can contain at least one communication point. The adaptive communication device includes a data acquisition and processing unit, a protocol conversion unit, a temporary storage unit, and a protocol forwarding unit. The adaptive communication device acquires the ASCII code protocol of all communication points of the downstream devices on the communication bus through the data acquisition and processing unit. The adaptive communication device converts the acquired ASCII code protocol into corresponding protocol data through the protocol conversion unit. The adaptive communication device stores the processed protocol data for each protocol segment in the temporary storage unit, and the protocol forwarding unit retrieves the protocol data from the temporary storage unit in real time, storing the protocol data according to standard protocol points for access by the controller, and establishing communication between the downstream devices through the controller.

[0052] Based on this, the adaptive communication device (communication device) can acquire multiple protocol segments corresponding to the downstream devices under the communication bus. Each protocol segment contains point attributes of multiple communication points. The communication device converts the ASCII code protocol in the point attributes to obtain the protocol data corresponding to the communication point and stores the protocol data. After completing the initialization of the downstream devices, for each downstream device, the corresponding protocol data can be obtained through the real-time parameters in the point attributes for the controller to access.

[0053] The unit can consist of multiple downstream devices and device points. These devices can be, but are not limited to, various electrical appliances, computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart vehicle systems. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, and smart glasses.

[0054] In one exemplary embodiment, such as Figure 2 As shown, a communication method for a downstream device is provided, which is applied to... Figure 1The following steps are used as an example of an adaptive communication device, including steps S202 to S206. Wherein:

[0055] Step S202: For at least one downstream device connected in series with the communication bus, obtain multiple protocol segments corresponding to each communication point contained in the downstream device.

[0056] In network communication, a protocol segment is a data unit in a specific format used for data transmission. Each protocol segment contains the point attributes of multiple communication points corresponding to the downstream device.

[0057] Specifically, the communication equipment can determine the communication points of the downstream device and the multiple protocol segments containing each communication point based on the identifier of the downstream device.

[0058] Step S204: Determine the protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point, so as to complete the initialization of the downstream device.

[0059] Among them, the point attribute is a parameter in the protocol segment, and different types of protocol segments correspond to different parameter types. Protocol data is the protocol transmission data corresponding to the parameters in each protocol segment.

[0060] Specifically, for the protocol segment corresponding to the communication frame, the communication device can parse the protocol segment to obtain the point attributes corresponding to the multiple communication points contained in the protocol segment, thus obtaining the point attributes of the communication points contained in each protocol segment. The communication device can convert the point attributes into protocol data corresponding to the point attributes using a predefined data conversion method, and store the protocol data, thereby obtaining the protocol data of the communication points contained in each downstream device. At this time, the downstream device completes initialization, and the controller can directly read the protocol data corresponding to the downstream device.

[0061] Step S206: After each downstream device has completed initialization, the protocol data of each communication point is determined based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data.

[0062] The target device is any attached device; the target location attribute is the real-time parameter in the location attribute.

[0063] Specifically, once all downstream devices have completed initialization, the controller can initiate a communication request to the communication device. The communication device identifies the target device corresponding to the communication request, reads the real-time parameters of each communication point contained in the target device, and obtains the corresponding protocol data based on the real-time parameters. After obtaining the protocol data, the controller establishes a connection with the downstream device according to the protocol data. The target device can be a single device or a group of multiple devices.

[0064] In the aforementioned communication method for downstream devices, multiple protocol segments contained in the downstream devices connected in series on the communication bus are obtained. Each protocol segment contains the point attributes of multiple communication points corresponding to the downstream device. Based on the point attributes, the protocol data of each communication point is determined, thereby completing the initialization of the downstream devices. If all downstream devices have completed initialization, any downstream device in the communication bus is identified as the target device, and the target point attributes of each communication point in the target device are obtained. Based on the target point attributes, the protocol data of each communication point is determined, thereby controlling the target device to communicate through the protocol data. The communication bus can connect multiple devices in series, and each device can contain multiple communication points. To determine the protocol data of each communication point, the protocol data of each device on the communication bus can be configured by initializing the downstream devices. After initialization, the protocol data of any device or device point can be obtained through real-time parameters. The communication device can directly send the protocol data to the controller, so that the controller can directly perform communication between the device or device point without executing additional program code, improving the communication efficiency of each device in the communication bus.

[0065] In an exemplary embodiment, the specific implementation process of the step "obtaining multiple protocol segments corresponding to each communication point included in the downstream device" includes:

[0066] Read the pre-built protocol table corresponding to the downstream device and obtain the multiple protocol segments contained in the protocol table.

[0067] A protocol segment contains at least one point attribute of a communication point; a protocol segment corresponds to a type of point attribute; the type of point attribute includes point name, unit and unit multiplier, real-time parameter multiplier, and real-time parameter.

[0068] Specifically, the communication equipment can read pre-built protocol tables corresponding to each unit or downstream device. These protocol tables include multiple protocol segments. In one example, the protocol table can be an ASCII-encoded table. The protocol table contains four protocol segments, each containing point attributes such as point name, unit and unit multiplier, real-time parameter multiplier, and real-time parameter. Combining the point attributes from multiple protocol segments yields the protocol data corresponding to the downstream device or unit.

[0069] In this embodiment, by reading the pre-built protocol table of the downstream device, multiple protocol segments corresponding to the downstream device can be obtained. Each protocol segment records the point attributes of multiple points, which can accurately obtain the point attributes of the required protocol segment and improve the accuracy of different point attributes during the initialization process.

[0070] In an exemplary embodiment, the specific implementation process of the step "determining the protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point" includes:

[0071] For each protocol segment, based on the first end marker in the protocol segment, determine the point attribute of the communication point corresponding to the first end marker; generate the output protocol point corresponding to the point attribute, and store the protocol data matching the communication point in the output protocol point.

[0072] The first end marker is the end character of each communication point.

[0073] Specifically, the protocol segment contains the point attributes of multiple communication points. Each communication point is distinguished by a first end marker. The communication device can iterate through the characters in the protocol segment. If the current character is determined to be the first end marker, the communication device can retrieve the data before the first end marker and identify it as a point attribute. After iterating through all first end markers, the communication device obtains the point attributes corresponding to all communication points in the protocol segment.

[0074] Based on this, for each point attribute, the communication device establishes the corresponding output protocol point in the protocol table. Then, according to ASCII encoding, the point attribute is converted, and the corresponding protocol data is stored in the output protocol point.

[0075] Optionally, the point attribute can be an index for determining protocol data. The communication device can determine the protocol data corresponding to the communication point in the protocol library based on the index and store the protocol data in the output protocol point.

[0076] In this embodiment, the point attributes of each communication point can be determined by the first end flag, and the output protocol point corresponding to the point attribute can be created. Finally, the protocol data corresponding to the point attribute is determined and the protocol data is stored in the output protocol point. The protocol data can be stored so that the protocol data can be directly obtained when communicating later, thereby improving communication efficiency.

[0077] In an exemplary embodiment, the specific implementation process of the step "determining the point attribute of the communication point corresponding to the first end marker based on the first end marker in the protocol segment" includes:

[0078] For each character in the current protocol segment, if the character is determined to be the first end marker, then the characters before the first end marker are determined to be the point attributes of the communication point corresponding to the first end marker; if the character is determined to be a non-end marker, then the next character is traversed until the traversal of characters is completed.

[0079] Specifically, for each protocol segment, the communication device sequentially traverses each character in the current protocol segment, determining whether the first character is the first end marker. If the character is not an end marker, it treats the character as a partial point attribute and traverses the next character, i.e., it traverses the second character to determine whether it is the first end marker. If the currently traversed character is determined to be the first end marker, the communication device can identify the characters before the first end marker, or the characters between two first end markers, as the point attribute of a certain communication point, and establish a correspondence between the communication point and the point attribute. After the communication device completes the traversal of each protocol segment, it can obtain the point attributes of each communication point in different protocol segments, as well as the correspondence between each communication point and multiple point attributes.

[0080] In this embodiment, by sequentially traversing each character, the location attributes of each communication point can be obtained using the first end marker as a separator, thus accurately obtaining the location attributes and improving the accuracy of location attribute acquisition.

[0081] In an exemplary embodiment, the method further includes: for each character in the current protocol segment, if the current data of the protocol segment is a second end marker, locking the matching relationship between each communication point corresponding to the second end marker and the protocol data, and obtaining the protocol data after locking the matching relationship.

[0082] Specifically, the second end marker is the end character of each protocol segment. When the communication device sequentially traverses each character in the current protocol segment, if it determines that the character is the second end marker, it can confirm that the protocol segment has been traversed. At this time, the correspondence between communication points and point attributes in the protocol segment is locked. Since the protocol data corresponding to the point attribute can be determined through the point attribute, the communication device can lock the matching relationship between the communication point and the protocol data, preventing subsequent initialization operations from changing the matching relationship and ensuring the security of the protocol data. After the communication device completes the identification of the second end markers of all protocol segments, it obtains the point attributes after locking the correspondence between communication points and point attributes, and the protocol data after locking the matching relationship between communication points and protocol data. At this time, the downstream device or unit completes initialization.

[0083] In this embodiment, by identifying the second end marker and locking the protocol segment containing the second end marker, it can be ensured that the communication points and corresponding protocol data in the protocol segment will not change, thereby improving the security and stability of the protocol data.

[0084] In an exemplary embodiment, the specific implementation process of the step "determining the protocol data of each communication point based on the target point attributes of each communication point in the target device" includes:

[0085] Obtain the target protocol segment corresponding to each communication point contained in the target device. The target protocol segment contains the target point attributes of each communication point contained in the target device. Based on the target point attributes, determine the output protocol point corresponding to the target point attributes and obtain the protocol data stored in the output protocol point.

[0086] Specifically, after identifying the target device, the communication device can filter through multiple protocol segments of the target device to obtain the target protocol segment. The communication device then acquires the target point attributes of each communication point within the target protocol segment. For example, the target protocol segment could be a protocol segment corresponding to real-time parameters, and the communication device can obtain the real-time parameters of each communication point within that segment. Based on the real-time parameters and the corresponding communication points, the communication device determines the output protocol point corresponding to each communication point and reads all protocol data corresponding to the real-time parameters from the output protocol point.

[0087] Because the output protocol point can store protocol data for communication points across multiple protocol segments, the real-time parameter communication device can directly obtain all the protocol data for the communication point. That is, the communication device only needs to obtain the point name, unit and unit multiplier, real-time parameter multiplier, and the corresponding protocol data for each real-time parameter. There is no need to read data from other protocol segments, significantly reducing the amount of data transmitted.

[0088] In this embodiment, complete protocol data can be obtained directly from the output protocol points corresponding to each communication point through the real-time parameters of the target device. This allows the protocol data to be obtained while reducing the amount of communication data, so that the controller can communicate with the target device directly through the protocol data, thereby improving communication efficiency.

[0089] In an exemplary embodiment, before the step "determine the output protocol point corresponding to the target point attribute based on the target point attribute", the method further includes:

[0090] For each character in the target protocol segment, if the character is determined to be the first end marker, then the characters before the first end marker are determined to be the target point attribute of the communication point corresponding to the first end marker; if the character is determined to be a non-end marker, then the next character is traversed until the traversal of characters is completed.

[0091] Specifically, the communication device can sequentially traverse each character in the target protocol segment, read the current character, and determine whether the current character is the first end marker. If the current character is the first end marker, then the characters before the first end marker can be determined to be real-time parameters, or the characters between two consecutive first end markers can be determined to be real-time parameters. If the current character is not an end marker, the device can continue to traverse the next character sequentially until all characters in the target protocol segment have been traversed. In one example, if the current character is determined to be the second end marker, then it can be determined that all characters in the target protocol segment have been traversed.

[0092] In this embodiment, by sequentially traversing each character, the target point attributes corresponding to each communication point of the target device can be obtained, thus accurately obtaining the target point attributes and improving the accuracy of target point attribute acquisition.

[0093] like Figure 3 As shown below, the specific execution process of initialization in the communication method of the aforementioned downstream device will be described in detail below with reference to a specific embodiment.

[0094] Specifically, for each downstream device, the first frame of data (i.e., the data of the first protocol segment) is read. The first character of the protocol segment is read, and it is determined whether the character is the first end marker "*". If the character is not "*", the second character of the protocol segment is read, and the determination of whether the character is the first end marker "*" continues. This process continues until the current character is determined to be the first end marker "*", at which point attribute corresponding to the first end marker can be determined, and the corresponding output protocol point is generated. The matching output protocol (protocol data) is stored in the output protocol point. At this point, the next character is traversed, and the above loop is repeated until the current character is the second end marker "#", or it is determined that the character traversal of the current frame (current protocol segment) is completed, then the traversal of the next frame of data (next protocol segment) begins. If the current character is the second end marker "#", the matching relationship between each point attribute and the protocol data is locked.

[0095] In one example, the communication device is connected in series on the communication bus between the controller and the downstream device (Modbus RTU). The communication device includes a data acquisition and processing unit, a protocol conversion unit, a temporary storage unit, and a protocol forwarding unit. The data acquisition module is responsible for acquiring all communication points of the downstream device on this bus. The protocol conversion unit is responsible for converting the acquired ASCII code protocol into corresponding parameters. The temporary storage unit is responsible for storing the processed parameters of each protocol segment. The protocol forwarding unit is responsible for retrieving data from the temporary storage unit in real time and storing it according to standard protocol points for access by the controller. If the controller / communication module has multiple communication interfaces (buses), they can be configured according to... Figure 1 The topology is extended.

[0096] Secondly, such as Figure 4 As shown, users can define the communication protocol to be segmented according to the specific attributes of the communication points, resulting in multiple protocol segments. The point attributes within each segment can be written using ASCII encoding. For example, a standard communication protocol might include the point name, unit and unit multiplier, real-time parameter multiplier, and real-time parameters. Users can standardize the units for standard parameters in the protocol, such as temperature in °C, pressure in kPa, and time in h (hours). Furthermore, each communication point can be defined with an asterisk (*) as the end character. When the end character is detected, it indicates that the point attributes for the current communication point have been read. Additionally, each point attribute can be defined with a # as the end flag. When the # flag is detected, it indicates that all point attributes for the current point attribute's protocol segment have been read.

[0097] Secondly, during the power-on initialization phase, the communication device reads data from all protocol segments. At the start of initialization, all communication frames on the communication bus are read sequentially. For each frame read, the module processes the read parameters; only after processing the data of the current frame will it continue reading the next frame. Simultaneously, the communication device matches the processed parameters to determine the corresponding protocol data. Once the point attribute processing for the current protocol segment is complete, the segment is locked to ensure that protocol data for all different point attributes correspond one-to-one. After all protocol segments have been read, the downstream device point matching synchronization is complete, and initialization ends.

[0098] Finally, after the module is successfully initialized, it will continue to process the protocol segment of the "real-time parameters" attribute and establish a communication connection through this protocol segment. Other protocol segments will no longer be read, which greatly reduces the amount of communication data.

[0099] In one instance, such as Figure 5 As shown, after the communication device completes initialization, it can read the protocol segment corresponding to the real-time parameters of a certain downstream device. It reads the first character of the protocol segment and determines if it is the first end marker "*". If the character is not "*", it reads the second character of the protocol segment and continues to determine if it is the first end marker "*". This process continues until the current character is determined to be the first end marker "*", at which point the corresponding point attribute can be determined, and the corresponding protocol data is output. Then, it iterates through the next character, repeating the above loop until the current character is the second end marker "#", or until the character traversal of the current protocol segment is complete. Then, it begins traversing the protocol segment corresponding to the real-time parameters of the next downstream device (i.e., the next protocol segment).

[0100] In this embodiment, a communication device is connected in series on the communication bus. After power-on initialization, it can automatically identify the location address of the downstream device and generate a fixed set of protocol data. Regardless of changes in the number of downstream devices or the protocol, the communication program does not need to be redeveloped; only the communication device needs to be reinitialized to output the standard communication protocol. Therefore, for the same type of downstream device, the protocol that the controller interfaces with is a standard protocol, eliminating the need to redevelop the program due to device changes. This device can significantly reduce development and testing time, improve communication efficiency, reduce project implementation costs, and increase project profits. Furthermore, based on this communication device, downstream devices on the same communication bus can be combined in various ways without requiring program redevelopment, greatly improving the program's versatility and reducing repetitive development and debugging work.

[0101] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0102] Based on the same inventive concept, this application also provides a communication device for a downstream device to implement the communication method of the downstream device described above. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the communication device for the downstream device provided below can be found in the limitations of the communication method for the downstream device above, and will not be repeated here.

[0103] In one exemplary embodiment, such as Figure 6 As shown, a communication device 600 for a downstream device is provided, comprising: a protocol segment acquisition module 601, a protocol data determination module 602, and a communication module 603, wherein:

[0104] Protocol segment acquisition module 601 is used to acquire multiple protocol segments corresponding to each communication point contained in at least one downstream device connected in series under the communication bus.

[0105] The protocol data determination module 602 is used to determine the protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point, so as to complete the initialization of the downstream device.

[0106] The communication module 603 is used to determine the protocol data of each communication point based on the target point attributes of each communication point in the target device after each downstream device has completed initialization, so that the controller can communicate with the target device based on the protocol data; the target device is any downstream device; the target point attributes are the real-time parameters in the point attributes.

[0107] Furthermore, the protocol segment acquisition module 601 is specifically used to: read the pre-built protocol table corresponding to the downstream device and acquire multiple protocol segments contained in the protocol table; wherein, a protocol segment contains at least one communication point attribute; a protocol segment corresponds to a type of point attribute; the type of point attribute includes point name, unit and unit multiplier, real-time parameter multiplier and real-time parameter.

[0108] Furthermore, the protocol data determination module 602 is specifically used for: for each protocol segment, based on the first end marker in the protocol segment, determining the point attribute of the communication point corresponding to the first end marker; the first end marker is the end character of each communication point; generating the output protocol point corresponding to the point attribute, and storing the protocol data matching the communication point in the output protocol point.

[0109] Furthermore, the protocol data determination module 603 is specifically used for: for each character in the current protocol segment, if the character is determined to be a first end marker, then the character before the first end marker is determined to be the point attribute of the communication point corresponding to the first end marker; if the character is determined to be a non-end marker, then the next character is traversed until the traversal of characters is completed.

[0110] Furthermore, the protocol data determination module 603 is specifically used to: for each character in the current protocol segment, if the current data of the protocol segment is a second end marker, then lock the matching relationship between each communication point corresponding to the second end marker and the protocol data to obtain the protocol data after locking the matching relationship; the second end marker is the end character of each protocol segment.

[0111] Furthermore, the communication module 603 is specifically used to: obtain the target protocol segment corresponding to each communication point included in the target device, wherein the target protocol segment includes the target point attribute of each communication point included in the target device; determine the output protocol point corresponding to the target point attribute based on the target point attribute, and obtain the protocol data stored in the output protocol point.

[0112] Furthermore, the communication module 603 is specifically used for: for each character in the target protocol segment, if the character is determined to be a first end marker, then the character before the first end marker is determined to be the target point attribute of the communication point corresponding to the first end marker; if the character is determined to be a non-end marker, then the next character is traversed until the traversal of characters is completed.

[0113] Each module in the communication device of the aforementioned downstream device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of the electronic device in hardware form or independent of it, or stored in the memory of the electronic device in software form, so that the processor can call and execute the corresponding operations of each module.

[0114] In one exemplary embodiment, an electronic device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, this electronic device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores protocol data for communication points, protocol tables for each downstream device, and other data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a communication method for downstream devices.

[0115] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.

[0116] In an exemplary embodiment, an electronic device is also provided, including a memory and a processor. The memory stores a computer program that, when executed by the processor, performs the following steps: for at least one downstream device connected in series with a communication bus, acquire multiple protocol segments corresponding to each communication point contained in the downstream device; determine the protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point to complete the initialization of the downstream device; and, after the downstream devices have completed initialization, determine the protocol data of each communication point based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data; the target device can be any downstream device; and the target point attributes are real-time parameters in the point attributes.

[0117] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon. When executed by a processor, the computer program performs the following steps: for at least one downstream device connected in series with a communication bus, acquiring multiple protocol segments corresponding to each communication point in the downstream device; determining protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point, so as to complete the initialization of the downstream device; and, after the downstream devices have completed initialization, determining the protocol data of each communication point based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data; the target device is any downstream device; the target point attributes are real-time parameters in the point attributes.

[0118] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps: for at least one downstream device connected in series with a communication bus, acquire multiple protocol segments corresponding to each communication point contained in the downstream device; determine the protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point, so as to complete the initialization of the downstream device; when the downstream devices have completed initialization, determine the protocol data of each communication point based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data; the target device is any downstream device; the target point attributes are real-time parameters in the point attributes.

[0119] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0120] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0121] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

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

Claims

1. A communication method for a downstream device, characterized in that, Applied to communication equipment, the method includes: For at least one downstream device connected in series under a communication bus, obtaining multiple protocol segments corresponding to each communication point contained in the downstream device includes: reading a pre-built protocol table corresponding to the downstream device, and obtaining multiple protocol segments contained in the protocol table; wherein, a protocol segment contains at least one point attribute of the communication point; a protocol segment corresponds to a type of point attribute; the type of the point attribute includes point name, unit and unit multiplier, real-time parameter multiplier, and real-time parameter; Based on the point attributes of each protocol segment corresponding to the communication point, determine the protocol data corresponding to each communication point to complete the initialization of the downstream device; Once each of the aforementioned downstream devices has completed initialization, the protocol data for each communication point is determined based on the target point attributes of each communication point in the target device, so that the controller can communicate with the target device based on the protocol data; the target device can be any of the aforementioned downstream devices; the target point attributes are the real-time parameters in the point attributes.

2. The method according to claim 1, characterized in that, The step of determining the protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point includes: For each of the protocol segments, based on the first end marker in the protocol segment, the point attribute of the communication point corresponding to the first end marker is determined; the first end marker is the end character of each of the communication points. Generate the output protocol point corresponding to the point attribute, and store the protocol data matching the communication point in the output protocol point.

3. The method according to claim 2, characterized in that, The step of determining the point attribute of the communication point corresponding to the first end marker based on the first end marker in the protocol segment includes: For each character in the current protocol segment, if the character is determined to be a first end marker, then the character before the first end marker is determined to be the point attribute of the communication point corresponding to the first end marker. If the character is determined to be a non-end marker, then traverse to the next character until the traversal of the characters is completed.

4. The method according to claim 2, characterized in that, The method further includes: For each character in the current protocol segment, if the current data of the protocol segment is the second end marker, then the matching relationship between each communication point corresponding to the second end marker and the protocol data is locked to obtain the protocol data after locking the matching relationship; the second end marker is the end character of each protocol segment.

5. The method according to claim 2, characterized in that, The determination of protocol data for each communication point based on the target point attributes of each communication point in the target device includes: Obtain the target protocol segment corresponding to each communication point contained in the target device, wherein the target protocol segment contains the target point attributes of each communication point contained in the target device; Based on the target location attributes, determine the output protocol location corresponding to the target location attributes, and obtain the protocol data stored in the output protocol location.

6. The method according to claim 5, characterized in that, Before determining the output protocol point corresponding to the target point attribute based on the target point attribute, the method further includes: For each character in the target protocol segment, if the character is determined to be a first end marker, then the character before the first end marker is determined to be the target point attribute of the communication point corresponding to the first end marker. If the character is determined to be a non-end marker, then traverse to the next character until the traversal of the characters is completed.

7. A communication device for a downstream device, characterized in that, The device includes: The protocol segment acquisition module is used to acquire multiple protocol segments corresponding to each communication point of at least one downstream device connected in series with the communication bus; specifically, it is used to read a pre-built protocol table corresponding to the downstream device and acquire multiple protocol segments contained in the protocol table; wherein, a protocol segment contains at least one point attribute of the communication point; a protocol segment corresponds to a type of point attribute; the type of the point attribute includes point name, unit and unit multiplier, real-time parameter multiplier, and real-time parameter; The protocol data determination module is used to determine the protocol data corresponding to each communication point based on the point attributes of each protocol segment corresponding to the communication point, so as to complete the initialization of the downstream device. The communication module is used to determine the protocol data of each communication point based on the target point attributes of each communication point in the target device after each of the attached devices has completed initialization, so that the controller can communicate with the target device based on the protocol data; the target device is any of the attached devices; the target point attributes are the real-time parameters in the point attributes.

8. The communication device for the lower-mounted device according to claim 7, characterized in that, The protocol data determination module is further configured to, for each protocol segment, determine the point attribute of the communication point corresponding to the first end marker based on the first end marker in the protocol segment; the first end marker is the end character of each communication point; generate the output protocol point corresponding to the point attribute, and store the protocol data matching the communication point in the output protocol point.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Universal protocol adapting method and device

    CN102480462A