Data access method and system adaptive to message bus
By initializing the object space structure in the protocol module and the message adaptation module, the problem of code-level adjustment in the prior art changes in the message bus standard requires code-level adjustment, and efficient data access adaptation and reusability are achieved.
Patent Information
- Application Number
- CN202411753993.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-02
AI Technical Summary
When the message bus standards change, code-level adjustments are required in the prior art, resulting in poor reusability of the data access module and affecting the use efficiency.
By presetting configuration files and protocol device model files in the protocol module and message adaptation module, initializing the object space structure, generating object spaces for protocol indexes and device indexes, and the object space for data reference, the adaptation of the message bus is achieved and code-level modification is avoided.
It can adapt to data access of different message bus protocols without code-level modification, improving the reusability and development efficiency of modules.
Smart Images

Figure CN119728330A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of bus data communication, and in particular relates to a data access method and system for an adapted message bus. Background Art
[0002] With the development of new power systems, the structure and characteristics of power grids will change from being planned and centralized to being open, shared, and intelligently interactive, which poses new challenges to power grid operation control and management, power market operations, and places higher demands on the platform openness, system capacity, access capabilities, and intelligence of power grid operation technology systems. Therefore, in the context of new power systems, the access of massive new grid-connected entities to the grid dispatching operation requires the transformation and upgrading of the existing control system to adapt to the modeling, access, monitoring, prediction, control, and analysis of massive new grid-connected entities.
[0003] The development and implementation of existing devices usually couples the protocol implementation part with the message bus implementation part, and does not have the conditions for rapid interchange between different message buses; that is, when sending data, the existing technology for communicating with the message bus usually directly sends the corresponding message according to the message bus requirements, and the specific message format and message content are related to the message bus. Therefore, when the message bus standard of the connection needs to be changed and adjusted, the module that implements data access needs to be adjusted at the code level, and the message format and message content need to be packaged and sent according to the new message bus, which leads to a key constraint on the reusability of the module that implements data access, affecting the efficiency of the module that implements data access to adapt to the message bus. Summary of the invention
[0004] The purpose of the present invention is to provide a data access method and system adapted to a message bus, so as to solve the problem that in the prior art, when the standard of the connected message bus needs to be changed and adjusted, the module for implementing data access needs to be adjusted at the code level, resulting in poor reusability of the data access module.
[0005] In order to achieve the above-mentioned purpose, the present invention provides a data access method for adapting a message bus. According to the message bus communication protocol to be applied, the value of the protocol index in the device supporting the protocol and its corresponding protocol device model file in the configuration file preset by the protocol module is determined, the communication protocol and the message bus data model file format preset in the message adaptation module are selected, and initialized; the configuration file contains the values of device parameters corresponding to each device, the device parameters include the device index and its corresponding model attributes, and the value of the model attribute of the device is used to find the protocol device model file of the device preset in the protocol module; The initialization includes: the protocol module generates protocol indexes and device indexes corresponding to each device supporting the protocol according to the configuration file; the message adaptation module determines the data references of each device measurement point in the message bus data model file according to the value of the protocol index corresponding to each device, generates the message side object space corresponding to the data reference of each device, and generates the message side object space corresponding to the protocol index and device index of each device according to the object space generated by the protocol module; the protocol module generates the protocol side object space corresponding to the data reference of each device according to the message bus data model file determined by the value of the protocol index corresponding to each device; After initialization, when it is necessary to obtain the measurement point data of a device on the message bus, the message adaptation module obtains the message containing the message bus data model file, device index and protocol index corresponding information on the message bus through the selected communication protocol, obtains the data reference, device index and protocol index values in the message side object space corresponding to the device according to the message, and sends these values to the protocol module according to the data structure of the message side object space; the protocol module finds the protocol side object space corresponding to the device according to the value of the device index and protocol index, and then updates the value of the data reference to the protocol side object space, so as to obtain the measurement point data of the device on the message bus through the value of the data reference in the protocol side object space.
[0006] Furthermore, when it is necessary to change the measurement point data of a device on the message bus, the protocol module obtains the values of the data reference, device index and protocol index in the protocol side object space corresponding to the device according to the message sent by the device containing the message bus data model file, device index and protocol index corresponding information; the protocol side object space corresponding to the device is found according to the values of the device index and protocol index, the obtained value of the data reference in the protocol side object space corresponding to the device is updated to the protocol side object space of the data reference corresponding to the device, and these values are sent to the message adaptation module according to the data structure of the protocol side object space; the message adaptation module finds the message side object space corresponding to the device according to the values of the device index and protocol index, and then updates the value of the data reference to the message side object space, so as to change the measurement point data of the device on the message bus through the value of the data reference in the message side object space.
[0007] Furthermore, the protocol device model file also includes a data index value; the protocol module and the message adaptation module also preset a mapping relationship between the data index value in the protocol device model file and the data reference in the message bus data model file; The initialization also includes: the protocol module also generates a protocol side object space of the data index corresponding to each device according to the value of the data index in the protocol device model file; the message adaptation module generates a message side object space of the data index corresponding to each device according to the protocol side object space of the data index, or according to the message bus data model file preset in the selected message adaptation module and the mapping relationship between the value of the data index in the protocol device model file and the data reference in the message bus data model file.
[0008] Furthermore, the method of obtaining the measurement point data of the device on the message bus through the value of the data reference in the protocol side object space includes: According to the known value of the data index corresponding to the device and the mapping relationship between the value of the data index in the protocol device model file and the data reference in the message bus data model file, the data reference corresponding to the device is found, and the value of the data reference in the protocol side object space of the data reference corresponding to the device is obtained as the measurement point data of the device on the acquired message bus; or, according to the known data reference corresponding to the device, the value of the data reference in the protocol side object space of the data reference corresponding to the device is obtained as the measurement point data of the device on the acquired message bus.
[0009] Furthermore, the method of changing the measurement point data of the device on the message bus through the value of the data reference in the message side object space includes: According to the known value of the data index corresponding to the device and the mapping relationship between the value of the data index in the protocol device model file and the data reference in the message bus data model file, the data reference corresponding to the device is found, and the value of the data reference in the message side object space of the data reference corresponding to the device is obtained, which is used as the measurement point data of the device on the message bus to be changed, and is sent to the bus by the message adapter module through the selected communication protocol in the format of a message containing the message bus data model file, the device index and the corresponding information of the protocol index; or, according to the known data reference corresponding to the device, the value of the data reference in the message side object space of the data reference corresponding to the device is obtained, which is used as the measurement point data of the device on the message bus to be changed, and is sent to the bus by the message adapter module through the selected communication protocol in the format of a message containing the message bus data model file, the device index and the corresponding information of the protocol index.
[0010] Furthermore, the method in which the protocol module generates a protocol side object space corresponding to each device in itself using the message bus data model file determined by the value of the protocol index corresponding to each device includes: the protocol module generates a message side object space corresponding to each device by using the data reference of each measuring point in the message bus data model file determined by the message adaptation module according to the value of the protocol index corresponding to each device, and maps the protocol side object space corresponding to each device in itself.
[0011] Furthermore, the protocol module generates a protocol side object space for data reference corresponding to each device in itself by using the message bus data model file determined by the value of the protocol index corresponding to each device, including: the protocol module directly generates a protocol side object space for data reference in itself by using the message bus data model file determined by the value of the protocol index corresponding to each device.
[0012] Furthermore, the mapping relationship between the data index value in the protocol device model file and the data reference in the message bus data model file is established in the following manner: Determine the corresponding model attribute according to the device index in the configuration file, then find the protocol device model file of the device preset in the protocol module, determine the data reference in the message bus data model file according to the message bus data model file corresponding to the value of the protocol index in the protocol device model file, and then establish a mapping relationship between the data index value in the protocol device model file and the data reference in the message bus data model file according to the value of the data index in the protocol device model file and the data reference in the message bus data model file.
[0013] Furthermore, the configuration file is in .cfg format; and the protocol device model file is in .xml format.
[0014] The above technical solution of the present invention provides a new data access method for adapting the message bus, and its beneficial effects include: decoupling the message adaptation module used to communicate with the message bus to obtain messages and the protocol module used to parse the messages on the acquired message bus to obtain the data of each measuring point of the corresponding device, generating an object space structure of the protocol index and the device index that can locate the specific device and an object space structure of the data reference of the corresponding measuring point of the positioning device through an initialization operation, which is equivalent to setting a set of standard data parsing rules that are basically not affected by the message bus protocol. When it is necessary to obtain the measuring point data of the device, it can be read according to the generated object space structure; whenever the message bus communication protocol to be applied is changed, For the protocol module, it is only necessary to reselect the device that supports the protocol in the preset configuration file and the value of the protocol index in the corresponding protocol device model file to reinitialize the object space structure. For the message adaptation module, it is only necessary to reselect the preset communication protocol and message bus data model file to realize the message communication that adapts to the protocol change, and then initialize accordingly to regenerate the object space structure of each measurement point data of the corresponding device applicable to the new message bus, and then continue to read according to the object space structure. It can be seen that the data access method does not require code-level modification, only the configuration selection needs to be modified, so it has strong reusability and high development efficiency when adapting to message buses of different protocol types.
[0015] The present invention also provides a data access system for adapting a message bus, comprising a processor, wherein the processor is used to execute computer program instructions to implement the data access method for adapting a message bus as described above.
[0016] The technical solution of the data access system for adapting the message bus of the present invention can achieve the same beneficial effects as the data access method for adapting the message bus. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A flowchart of a method for accessing data on a message bus adapted in an embodiment of the method for accessing data on a message bus adapted in the present invention; Figure 2 A schematic diagram of the relationship between preset files in the protocol module used by the data access method for adapting a message bus in the embodiment of the data access method for adapting a message bus of the present invention; Figure 3 An example diagram of the contents of a configuration file in an embodiment of a data access method for adapting a message bus of the present invention; Figure 4 An example diagram of the content of a message bus data model file in an embodiment of a method for accessing data adapted to a message bus of the present invention; Figure 5 An example diagram of the contents of a protocol device model file in an embodiment of a method for accessing data adapted to a message bus of the present invention; Figure 6 This is a schematic diagram of the principle of generating object space by the protocol module and the message adaptation module during the initialization process in the data access method embodiment of the adapted message bus of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.
[0019] Data access method embodiment of adapted message bus This embodiment provides a technical solution for a data access method adapted to a message bus. The method decouples a protocol module from a message bus to implement a message bus adaptation architecture. The architecture uses preset files and initialization operations based on the preset files and the actual message bus protocol. Each time the message bus protocol is changed, a dedicated data object space for parsing and reconstructing its own identity information (the protocol index corresponding to the device and the protocol side and message side object space of the device index) and the corresponding data object space of its own data information (the protocol side and message side object space of the data reference corresponding to the device) are configured for each device supporting the current message bus protocol. The message data on the message bus that needs to be obtained is updated to the corresponding data object space, and data access that is not constrained by the message bus protocol can be achieved by reading the data in the object space. Therefore, the rapid development of multiple different message buses can be supported, providing technical support for the rapid application of products.
[0020] Reference Figure 1 The method specifically includes: according to the message bus communication protocol to be applied, determining the value of the protocol index in the device supporting the protocol and the corresponding protocol device model file in the configuration file preset in the protocol module, selecting the communication protocol and the message bus data model file format preset in the message adaptation module, and initializing; the configuration file contains the values of device parameters corresponding to each device, the device parameters include the device index and its corresponding model attribute, and the value of the device model attribute is used to find the protocol device model file of the device preset in the protocol module; The above initialization includes: the protocol module generates protocol index and device index protocol side object space corresponding to each device supporting the protocol according to the configuration file; the message adaptation module determines the data reference of each device measurement point in the message bus data model file according to the value of the protocol index corresponding to each device, generates the message side object space of the data reference corresponding to each device, and generates the message side object space of the protocol index and device index corresponding to each device according to the object space generated by the protocol module; the protocol module generates the protocol side object space of the data reference corresponding to each device in the message bus data model file determined by the value of the protocol index corresponding to each device; After initialization, when it is necessary to obtain the measurement point data of a device on the message bus, the message adaptation module obtains the message containing the message bus data model file, device index and protocol index corresponding information on the message bus through the selected communication protocol, obtains the data reference, device index and protocol index values in the message side object space corresponding to the device according to the message, and sends these values to the protocol module according to the data structure of the message side object space; the protocol module finds the protocol side object space corresponding to the device according to the value of the device index and protocol index, and then updates the value of the data reference to the protocol side object space, so as to obtain the measurement point data of the device on the message bus through the value of the data reference in the protocol side object space.
[0021] The method can decouple a message adapter module used for communicating with a message bus to obtain messages and a protocol module used for parsing the messages on the obtained message bus to obtain the data of each measuring point of the corresponding device. The method generates an object space structure capable of locating the protocol index and device index of a specific device and an object space structure for locating the data reference of the corresponding measuring point of the device through an initialization operation, which is equivalent to setting a set of standard data parsing rules that are basically not affected by the message bus protocol. When the measuring point data of the device needs to be obtained, it can be read according to the generated object space structure. Whenever the applicable message bus communication protocol is changed, for the protocol module, it is only necessary to reselect the device supporting the protocol in the preset configuration file and the value of the protocol index in the corresponding protocol device model file to reinitialize the object space structure. For the message adapter module, it is only necessary to reselect the preset communication protocol and the message bus data model file to realize the message communication adapted to the protocol change. Then, the object space structure of the data of each measuring point of the corresponding device applicable to the new message bus can be regenerated by initialization, and then the data can be read according to the object space structure. It can be seen that the data access method does not require code-level modification, and only needs to modify the configuration selection, so it has strong reusability and high development efficiency when adapting to message buses of different protocol types.
[0022] On this basis, when it is necessary to change the measurement point data of a device on the message bus, the protocol module obtains the values of the data reference, device index and protocol index in the protocol side object space corresponding to the device according to the message sent by the device containing the message bus data model file, device index and protocol index corresponding information; finds the protocol side object space corresponding to the device according to the value of the device index and protocol index, updates the obtained value of the data reference in the protocol side object space corresponding to the device to the protocol side object space of the data reference corresponding to the device, and sends these values to the message adaptation module according to the data structure of the protocol side object space; the message adaptation module finds the message side object space corresponding to the device according to the value of the device index and protocol index, and then updates the value of the data reference to the message side object space, so as to change the measurement point data of the device on the message bus through the value of the data reference in the message side object space.
[0023] In addition, in this embodiment, in order to facilitate more efficient and diversified positioning of data references, the protocol device model file also includes a data index value; the protocol module and the message adaptation module also preset a mapping relationship between the data index value in the protocol device model file and the data reference in the message bus data model file; The above initialization also includes: the protocol module also generates a protocol side object space of the data index corresponding to each device according to the value of the data index in the protocol device model file; the message adaptation module generates a message side object space of the data index corresponding to each device according to the protocol side object space of the data index, or according to the message bus data model file preset in the selected message adaptation module and the mapping relationship between the value of the data index in the protocol device model file and the data reference in the message bus data model file.
[0024] Therefore, on the basis of setting the data index, the method of obtaining the measurement point data of the device on the message bus through the value of the data reference in the object space on the protocol side includes: According to the known data index value corresponding to the device and the mapping relationship between the data index value in the protocol device model file and the data reference in the message bus data model file, the data reference corresponding to the device is found, and the value of the data reference in the protocol side object space of the data reference corresponding to the device is obtained as the measurement point data of the device on the acquired message bus; or, according to the known data reference corresponding to the device, the value of the data reference in the protocol side object space of the data reference corresponding to the device is obtained as the measurement point data of the device on the acquired message bus. That is, in this embodiment, when obtaining the measurement point data of the device on the message bus, the specific measurement point data can be located not only through the data reference itself, but also through the data index and the relationship between the value of the data index and the data reference.
[0025] Similarly, on the basis of setting the data index, the methods of changing the measurement point data of the device on the message bus through the value of the data reference in the object space on the message side include: According to the known data index value corresponding to the device and the mapping relationship between the data index value in the protocol device model file and the data reference in the message bus data model file, the data reference corresponding to the device is found, and the value of the data reference in the message side object space of the data reference corresponding to the device is obtained as the measurement point data of the device on the message bus to be changed, and the message adapter module sends it to the bus through the selected communication protocol in the format of a message containing the message bus data model file, the device index and the corresponding information of the protocol index; or, according to the known data reference corresponding to the device, the value of the data reference in the message side object space of the data reference corresponding to the device is obtained as the measurement point data of the device on the message bus to be changed, and the message adapter module sends it to the bus through the selected communication protocol in the format of a message containing the message bus data model file, the device index and the corresponding information of the protocol index. That is, in this embodiment, when changing the measurement point data of the device on the message bus, the specific measurement point data can be located not only through the data reference itself, but also through the data index and the relationship between the value of the data index and the data reference.
[0026] In this embodiment, the configuration file is in .cfg format, the protocol device model file is in .xml format, the new message bus protocol is MQTT, and the corresponding message bus data model file is in .json format as an example to specifically describe the implementation process of the above data access method: Reference Figure 2 Before initialization, three types of files are preset in the protocol module, namely, the configuration file (AppName.cfg), the protocol device model file (*.xml) and the message bus data model file (*.json); the message adaptation module is preset with various groups of communication parameters used to realize message interaction with message buses of various protocol types, as well as message bus data model files corresponding to message buses of various protocol types.
[0027] Among them, refer to Figure 3, AppName.cfg contains 4 parts, namely bus parameters, communication port parameters, channel protocol parameters and device list parameters; bus parameters are the basic configuration information for communication of the external bus that obtains the measurement point data of a device on the message bus by obtaining the value of the data reference in the protocol side object space from the protocol module, such as bus address, port, etc., which can be configured accordingly according to the actual external bus to be connected; communication parameters are the basic parameter information required by the protocol module, such as the 104 protocol module needs to configure the port it uses (such as 2404 port), etc. Different protocol modules are configured differently; channel protocol parameters are the property information of each protocol module, such as whether the 104 protocol module supports time synchronization, time synchronization mode, etc. Different protocol modules have different property information and should be configured according to the actual situation; device list parameters are the device parameters corresponding to each device, and the device list parameters include the device index (deviceid) and its corresponding model attribute (devmodel). Each device has only one corresponding device index, and the value of the model attribute is used to find the protocol device model file of the device preset in the protocol module; for example Figure 3 In the figure, the value of deviceid is "XJDQPV", and the value of its corresponding model attribute is "XJDQ_PV.xml". According to the value of the model attribute, the protocol device model file of the device preset in the protocol module can be found, and its name is "XJDQ_PV.xml". Different protocol modules can be used to communicate with external buses of different communication protocols. The same protocol module can contain more than two device indexes. However, the devices corresponding to the device indexes in the same protocol module are consistent with the communication protocol of the protocol module.
[0028] Reference Figure 4 , the message bus data model file, that is, the *.json file contains the specification name (schema), protocol (profile) and service (services), which is used to describe the data model in a hierarchical manner. The services (services) include parameters (parameter), telemetry (analog), telesignaling (discrete), control (control), accumulator and other specific data references (Data_Refer: LDName.LnType.LnInst.DoName) of each measuring point to describe the device structure information; it should be noted that the specific file format of the message bus data model file needs to be determined according to the applicable message bus communication protocol. Before the applicable message bus communication protocol is determined, the file format of the message bus data model file cannot be determined, and before it is initialized and starts to interact with the message bus, whether it is a protocol module or a message adapter module, the data reference values in the preset message bus data model file are all set initial values or empty values.
[0029] Reference Figure 5 , the protocol device model file, that is, the *.xml file contains the protocol index (dev), device type (type) and data set; different protocol index values correspond to different communication protocols, and different communication protocols correspond to different message bus data model files, for example Figure 5 If the value of the protocol index in the *.xml file is "XJDQ_PV_J_V1.00", the corresponding communication protocol is MQTT, and the format of the corresponding message bus data model file is *.json, so the corresponding message bus data model file can be found according to the protocol index; it should be noted that the protocol index in the *.xml file needs to be determined according to the applicable message bus communication protocol, that is, before the applicable message bus communication protocol is determined and initialized, the value of the protocol index in the *.xml file is the set initial value or null value. In addition, in the *.xml file, each measurement point also contains a specific data index (devref). The mapping relationship between the value of the data index devref in the protocol device model file and the data reference Data_Refer in the message bus data model file belongs to the preset and known information in the protocol module and the message adaptation module, and its establishment method can be: Determine the corresponding model attribute devmodel according to the device index deviceid in the configuration file, then find the protocol device model file .xml of the device preset in the protocol module, and determine the data reference Data_Refer in the message bus data model file *.json according to the value of the protocol index dev in the .xml file, and then establish a mapping relationship between the data index value in the protocol device model file and the data reference in the message bus data model file according to the value of the data index devref in the .xml file and the data reference Data_Refer in the message bus data model file.
[0030] Reference Figure 6 , based on the above preset content, after determining the applicable message bus communication protocol, the initialization process example is as follows: First, according to the message bus communication protocol MQTT to be applied, manually configure the devices that support the protocol in the configuration file of the protocol module and the value of the protocol index in the corresponding protocol device model file, and select the preset communication protocol in the message adaptation module (that is, select a set of communication parameters for realizing message interaction with the MQTT message bus) and the message bus data model file (that is, select the format of the message bus data model file as *.json).
[0031] Afterwards, the protocol module generates protocol-side object spaces of protocol index and device index corresponding to each device supporting the protocol according to AppName.cfg; the message adaptation module determines the data references of each measuring point of the device in the message bus data model file according to the value of the protocol index corresponding to each device, generates the message-side object space of the data reference corresponding to each device, and generates the message-side object space of the protocol index and device index corresponding to each device according to the object space generated by the protocol module; the protocol module generates the protocol-side object space of the data reference corresponding to each device in itself according to the message bus data model file determined by the value of the protocol index corresponding to each device; in this embodiment, in order to save the protocol module The operation of reading the message bus data model file, the protocol module uses the message bus data model file determined by the value of the protocol index corresponding to each device to generate the protocol side object space corresponding to each device in itself, including: the protocol module uses the message adaptation module to determine the data reference of each measuring point in the message bus data model file according to the value of the protocol index corresponding to each device to generate the message side object space corresponding to each device, and maps it to generate the protocol side object space corresponding to each device; that is, the protocol module indirectly generates the protocol side object space of data reference in its own memory space by mapping the message side object space of data reference that has been generated in the memory space of the message adaptation module. Figure 6 As shown, the object spaces marked with dashed boxes are all generated through mapping.
[0032] In other embodiments, since the protocol module can also read the message bus data model file, the protocol module can use the message bus data model file determined by the value of the protocol index corresponding to each device to generate the protocol side object space for data reference corresponding to each device in itself. The method can also be: the protocol module directly generates the protocol side object space for data reference in itself according to the message bus data model file determined by the value of the protocol index corresponding to each device; that is, the protocol module directly generates the protocol side object space for data reference in its own memory space indirectly by reading its own message bus data model file.
[0033] In this embodiment, when the message adaptation module receives a message on the message bus, it will distinguish whether the message is a message corresponding to a command message or a message corresponding to its own business message; if it is a message corresponding to a command message, it will obtain the values of the data reference, device index and protocol index in the message side object space corresponding to the device according to the message, and send these values to the protocol module according to the data structure of the message side object space; the protocol module will process it accordingly.
[0034] When the protocol module exits due to business needs, the message adapter module is notified to release local resources and stop message-related services through the standard interface between the protocol module and the message adapter module. After the message adapter module completes the release, the protocol module is notified through the standard interface between the protocol module and the message adapter module, and the message adapter module completes the exit operation.
[0035] Data access system embodiment adapted to message bus This embodiment provides a technical solution for a data access system for adapting a message bus, including a processor for executing computer program instructions to implement a data access method for adapting a message bus as described in the above-mentioned data access method embodiment for adapting a message bus.
[0036] Since the specific working principle and working process examples of the data access system for adapting the message bus in this embodiment have been described in detail in the above-mentioned data access method embodiment for adapting the message bus, they will not be repeated here.
[0037] It should be understood that the above specific embodiments of the present invention are only used to illustrate or explain the principles of the present invention, but do not constitute a limitation to the present invention.
Claims
1. A data access method adapted to a message bus, characterized in that: According to the message bus communication protocol to be applied, determine the device supporting the protocol in the configuration file preset by the protocol module and the value of the protocol index in the corresponding protocol device model file, select the communication protocol and message bus data model file format preset in the message adaptation module, and initialize; the configuration file contains the values of device parameters corresponding to each device, the device parameters include the device index and its corresponding model attributes, and the value of the model attribute of the device is used to find the protocol device model file of the device preset in the protocol module; The initialization includes: the protocol module generates protocol indexes and device indexes corresponding to each device supporting the protocol according to the configuration file; the message adaptation module determines the data references of each device measurement point in the message bus data model file according to the value of the protocol index corresponding to each device, generates the message side object space corresponding to the data reference of each device, and generates the message side object space corresponding to the protocol index and device index of each device according to the object space generated by the protocol module; the protocol module generates the protocol side object space corresponding to the data reference of each device according to the message bus data model file determined by the value of the protocol index corresponding to each device; After initialization, when it is necessary to obtain the measurement point data of a device on the message bus, the message adaptation module obtains the message containing the message bus data model file, device index and protocol index corresponding information on the message bus through the selected communication protocol, obtains the data reference, device index and protocol index values in the message side object space corresponding to the device according to the message, and sends these values to the protocol module according to the data structure of the message side object space; the protocol module finds the protocol side object space corresponding to the device according to the value of the device index and protocol index, and then updates the value of the data reference to the protocol side object space, so as to obtain the measurement point data of the device on the message bus through the value of the data reference in the protocol side object space.
2. The data access method of the adapted message bus according to claim 1, characterized in that: When the measurement point data of a device on the message bus needs to be changed, the protocol module obtains the values of the data reference, device index and protocol index in the protocol side object space corresponding to the device according to the message sent by the device containing the message bus data model file, device index and protocol index corresponding information; Find the protocol side object space corresponding to the device according to the values of the device index and the protocol index, update the acquired data reference value in the protocol side object space corresponding to the device to the protocol side object space of the data reference corresponding to the device, and send these values to the message adaptation module according to the data structure of the protocol side object space; The message adaptation module finds the message side object space corresponding to the device according to the values of the device index and the protocol index, and then updates the value of the data reference to the message side object space to change the measurement point data of the device on the message bus through the value of the data reference in the message side object space.
3. The data access method of the adapted message bus according to claim 2, characterized in that: The protocol device model file also includes the value of the data index; the protocol module and the message adaptation module also preset the mapping relationship between the value of the data index in the protocol device model file and the data reference in the message bus data model file; The initialization also includes: the protocol module also generates a protocol side object space of the data index corresponding to each device according to the value of the data index in the protocol device model file; the message adaptation module generates a message side object space of the data index corresponding to each device according to the protocol side object space of the data index, or according to the message bus data model file preset in the selected message adaptation module and the mapping relationship between the value of the data index in the protocol device model file and the data reference in the message bus data model file.
4. The data access method of the adapted message bus according to claim 3, characterized in that: The methods for obtaining the measurement point data of the device on the message bus through the data reference value in the protocol side object space include: According to the known value of the data index corresponding to the device and the mapping relationship between the value of the data index in the protocol device model file and the data reference in the message bus data model file, the data reference corresponding to the device is found, and the value of the data reference in the protocol side object space of the data reference corresponding to the device is obtained as the measurement point data of the device on the acquired message bus; or, according to the known data reference corresponding to the device, the value of the data reference in the protocol side object space of the data reference corresponding to the device is obtained as the measurement point data of the device on the acquired message bus.
5. The data access method for adapting the message bus according to claim 3 or 4, characterized in that: The methods for changing the measurement point data of the device on the message bus through the value of the data reference in the object space on the message side include: According to the known value of the data index corresponding to the device and the mapping relationship between the value of the data index in the protocol device model file and the data reference in the message bus data model file, the data reference corresponding to the device is found, and the value of the data reference in the message side object space of the data reference corresponding to the device is obtained, which is used as the measurement point data of the device on the message bus to be changed, and is sent to the bus by the message adapter module through the selected communication protocol in the format of a message containing the message bus data model file, the device index and the corresponding information of the protocol index; or, according to the known data reference corresponding to the device, the value of the data reference in the message side object space of the data reference corresponding to the device is obtained, which is used as the measurement point data of the device on the message bus to be changed, and is sent to the bus by the message adapter module through the selected communication protocol in the format of a message containing the message bus data model file, the device index and the corresponding information of the protocol index.
6. The data access method for adapting the message bus according to any one of claims 1 to 4, characterized in that: The method in which the protocol module generates a protocol side object space corresponding to each device in itself using the message bus data model file determined by the value of the protocol index corresponding to each device includes: the protocol module generates a message side object space corresponding to each device by using the data reference of each measuring point in the message bus data model file determined by the message adaptation module according to the value of the protocol index corresponding to each device, and maps the generated protocol side object space corresponding to each device in itself.
7. The data access method for adapting the message bus according to any one of claims 1 to 4, characterized in that: The method in which the protocol module generates a protocol side object space for data reference corresponding to each device by using the message bus data model file determined by the value of the protocol index corresponding to each device includes: the protocol module directly generates a protocol side object space for data reference in itself according to the message bus data model file determined by the value of the protocol index corresponding to each device.
8. The data access method for adapting the message bus according to any one of claims 1 to 4, characterized in that: The mapping relationship between the data index value in the protocol device model file and the data reference in the message bus data model file is established in the following manner: Determine the corresponding model attribute according to the device index in the configuration file, then find the protocol device model file of the device preset in the protocol module, determine the data reference in the message bus data model file according to the message bus data model file corresponding to the value of the protocol index in the protocol device model file, and then establish a mapping relationship between the data index value in the protocol device model file and the data reference in the message bus data model file according to the value of the data index in the protocol device model file and the data reference in the message bus data model file.
9. The data access method for adapting the message bus according to any one of claims 1 to 4, characterized in that: The configuration file is in .cfg format; the protocol device model file is in .xml format.
10. A data access system adapted to a message bus, comprising a processor, characterized in that: The processor is used to execute computer program instructions to implement the data access method of the adapted message bus according to any one of claims 1-9.
Citation Information
Patent Citations
Device specific content indexing for optimized device operation
CN101632063A
Multi-bus protocol testing and simulation method based on ICD database and platform
CN106980560A
Protocol stack communication method and device based on CAN bus and storage medium
CN113079074A
Internet of Things equipment message protocol configuration management method
CN117376447A
Message conversion method and device based on communication protocol
CN118283130A