Multi-protocol data acquisition method, system and equipment of energy storage system and medium

By configuring the data acquisition mechanism, decoupling protocol adaptation and data processing, the problems of low development efficiency, poor scalability and high maintenance cost of multi-protocol data acquisition systems in energy storage systems are solved, and efficient, stable and flexible data acquisition is achieved.

CN121940464APending Publication Date: 2026-04-28SUNWODA ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SUNWODA ELECTRONICS CO LTD
Filing Date
2026-01-07
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing energy storage system data acquisition systems suffer from low development efficiency, poor scalability, and high maintenance costs when dealing with various heterogeneous devices and complex communication protocols. In particular, when connecting new devices or new protocols, a large amount of code modification is required, and the protocol parsing logic is highly coupled with the business implementation.

Method used

The configuration-driven data acquisition mechanism decouples protocol abstraction and data processing through device communication configuration files and single-device interaction configuration files. It acquires and loads the device communication configuration files and single-device interaction configuration files, parses the data acquisition configuration information, establishes device communication channels, decodes and aggregates data, and provides unified access to multiple protocols and standardized output.

Benefits of technology

It improves the development efficiency of the data acquisition system, enhances the system's stability and flexible scalability, reduces maintenance costs, and enables efficient acquisition and flexible expansion of multiple protocols.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121940464A_ABST
    Figure CN121940464A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of energy storage system data collection, and provides an energy storage system multi-protocol data collection method, system and device and a medium, and the method comprises the steps: carrying out the matching analysis of an obtained device communication configuration file and a plurality of single-device interaction configuration files, and obtaining the data collection configuration information of each target collection device; acquiring a corresponding data acquisition message based on an equipment communication channel and an equipment interaction mode established according to the communication protocol configuration item of the target acquisition equipment; decoding the data acquisition message according to a decoding configuration item of the target acquisition equipment to obtain a decoded data set; and processing the decoded data set according to the data processing configuration item of the target acquisition equipment, and uploading a data processing result to the target platform. Based on a configuration-driven data acquisition mechanism, decoupling of protocol abstraction and a data processing process is realized, the development efficiency of a data acquisition system is improved, the high efficiency, stability and flexible expansibility of system data acquisition are enhanced, and the maintenance cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data acquisition technology for energy storage systems, and in particular to a multi-protocol data acquisition method, system, device and medium for energy storage systems. Background Technology

[0002] With the widespread application of distributed energy and energy storage systems, edge gateways play a crucial role in system operation because they enable data interaction between field devices and upper-level platforms. In practical applications, field devices are diverse, employing different communication protocols, and exhibiting significant differences in message formats and data definitions. When faced with various heterogeneous devices and complex communication protocol requirements, edge gateways typically support data acquisition for specific devices by writing custom drivers or embedding protocol adaptation code at the application layer.

[0003] However, existing protocol adaptation technologies have many application drawbacks in the development and application of data acquisition systems because they require repeated implementation of protocol adaptation and parsing logic for different devices: 1) Excessive repetitive work leads to low development efficiency; 2) When connecting new devices or new protocols, a large amount of code needs to be modified or added, making it difficult to flexibly cope with changing application requirements and resulting in poor system scalability; 3) The protocol parsing logic is highly coupled with business implementation, making code maintenance difficult, and once the protocol version changes, the system upgrade and maintenance costs will increase significantly. Summary of the Invention

[0004] The purpose of this invention is to provide a multi-protocol data acquisition method for energy storage systems. Based on a configuration-driven data acquisition mechanism, it decouples protocol abstraction and data processing, providing reliable technical support for unified access of multiple protocols, efficient data acquisition, flexible expansion, and standardized output. This effectively improves the development efficiency of the data acquisition system, enhances the efficiency, stability, and flexible scalability of the system's data acquisition, and reduces maintenance costs.

[0005] To achieve the above objectives, it is necessary to provide a multi-protocol data acquisition method, system, computer equipment, and storage medium for energy storage systems.

[0006] In a first aspect, embodiments of the present invention provide a multi-protocol data acquisition method for an energy storage system, the method comprising: Retrieve and load the device communication configuration file and the corresponding multiple single-device interaction configuration files; The device communication configuration file and each of the individual device interaction configuration files are matched and parsed to obtain the data acquisition configuration information of each of the target acquisition devices; the data acquisition configuration information includes device interaction mode, communication protocol configuration items, decoding configuration items and data processing configuration items; Establish corresponding device communication channels according to the communication protocol configuration items of each target acquisition device, and obtain corresponding data acquisition messages according to the device communication channels and the corresponding device interaction modes; According to the decoding configuration items of each of the target acquisition devices, the corresponding data acquisition messages are decoded to obtain the corresponding decoded dataset; According to the data processing configuration items of each of the target acquisition devices, the corresponding decoded datasets are aggregated and the corresponding data processing results are sent to the target platform.

[0007] Furthermore, the device communication configuration file includes device communication parameter information for multiple target acquisition devices; the device communication parameter information includes communication protocol type, single device interaction configuration file name, and communication connection parameters; The single-device interaction configuration file includes device interaction configuration information corresponding to the target acquisition device; the device interaction configuration information includes interaction mode, device data packet parsing definition, and device data processing definition; the interaction mode includes listening mode; the device data packet parsing definition includes packet decoding format and decoding dataset definition; the device data processing definition includes result identifier and preset data processing rules.

[0008] Furthermore, the device interaction configuration information also includes a device data request message definition; the device data request message definition includes a message encoding format, message template parameters, message variable parameters, and message sending interval.

[0009] Furthermore, the interaction mode also includes a question-and-answer mode; the device interaction configuration information also includes a device data request message definition; the device data request message definition includes a message encoding format, message template parameters, message variable parameters, and message sending interval.

[0010] Further, the step of matching and parsing the device communication configuration file and all the single device interaction configuration files to obtain the data acquisition configuration information of each of the target acquisition devices includes: The device configuration items in the device communication configuration file are parsed sequentially to obtain the device communication parameter information of each target acquisition device, and the corresponding communication protocol configuration items are generated according to the communication protocol type and communication connection parameters in the device communication parameter information. Based on the name of the single device interaction configuration file in the device communication parameter information of each target acquisition device, the corresponding single device interaction configuration file to be parsed is obtained, and the single device interaction configuration file to be parsed is parsed to obtain the corresponding device interaction configuration information. Based on the interaction mode, device data packet parsing definition, and device data processing definition in the device interaction configuration information of each target acquisition device, corresponding device interaction mode, decoding configuration item, and data processing configuration item are generated respectively. The communication protocol configuration items, device interaction mode, decoding configuration items, and data processing configuration items of each target acquisition device are summarized to obtain the corresponding data acquisition configuration information.

[0011] Furthermore, the data acquisition configuration information also includes encoding configuration items; the encoding configuration items are generated based on the device data request message definition in the device interaction configuration information; The step of obtaining the corresponding data acquisition message based on the device communication channel and the corresponding device interaction mode includes: Based on the device interaction mode, the communication protocol configuration items, and the encoding configuration items, the message data structure is filled and the data structure is serialized in sequence to generate the corresponding data request message. The data request message is sent to the corresponding target acquisition device so that the target acquisition device reports the corresponding data acquisition message.

[0012] Furthermore, the decoded dataset definition includes serialization information for multiple data items; the serialization information includes data type, data identifier, start position in the message, and data length; The step of decoding the corresponding data acquisition message according to the decoding configuration items of each of the target acquisition devices to obtain the corresponding decoded dataset includes: According to the message decoding format configuration in the decoding configuration item, the data acquisition message is preprocessed to obtain the corresponding message to be parsed. Based on the serialization information configured in the decoding configuration item, the corresponding target data fields in the message to be parsed are deserialized and parsed to generate the decoding dataset.

[0013] Secondly, embodiments of the present invention provide a multi-protocol data acquisition system for an energy storage system, the system comprising: The configuration management module is used to obtain and load device communication configuration files and corresponding multiple single-device interaction configuration files; A configuration parsing module is used to match and parse the device communication configuration file and each of the single device interaction configuration files to obtain the data acquisition configuration information of each of the target acquisition devices; the data acquisition configuration information includes device interaction mode, communication protocol configuration items, decoding configuration items and data processing configuration items. The data acquisition module is used to establish a corresponding device communication channel according to the communication protocol configuration items of each of the target acquisition devices, and to acquire the corresponding data acquisition message according to the device communication channel and the corresponding device interaction mode; The message decoding module is used to decode the corresponding data acquisition message according to the decoding configuration items of each of the target acquisition devices to obtain the corresponding decoded dataset; The data processing module is used to aggregate the corresponding decoded datasets according to the data processing configuration items of each of the target acquisition devices, and send the corresponding data processing results to the target platform.

[0014] Thirdly, embodiments of the present invention also provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.

[0015] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described method.

[0016] This invention provides a multi-protocol data acquisition method, system, computer device, and storage medium for an energy storage system. The method acquires and loads a device communication configuration file and multiple corresponding single-device interaction configuration files; it matches and parses the device communication configuration file and each of the single-device interaction configuration files to obtain data acquisition configuration information for each target acquisition device; the data acquisition configuration information includes device interaction mode, communication protocol configuration items, decoding configuration items, and data processing configuration items; it establishes corresponding device communication channels based on the communication protocol configuration items of each target acquisition device, and acquires corresponding data acquisition messages based on the device communication channels and the corresponding device interaction modes; it decodes the corresponding data acquisition messages according to the decoding configuration items of each target acquisition device to obtain corresponding decoded datasets; it aggregates the corresponding decoded datasets according to the data processing configuration items of each target acquisition device, and sends the corresponding data processing results to the target platform. Compared with existing technologies, this multi-protocol data acquisition method for energy storage systems can achieve decoupling of protocol abstraction and data processing based on a configuration-driven data acquisition mechanism that integrates protocol adaptation, data processing, and data aggregation and reporting. This provides reliable technical support for unified access of multiple protocols, efficient data acquisition, flexible expansion, and standardized output, thereby effectively improving the development efficiency of the data acquisition system, enhancing the efficiency, stability, and flexible scalability of the system's data acquisition, and reducing maintenance costs. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the multi-protocol data acquisition method for an energy storage system in an embodiment of the present invention; Figure 2 This is another flowchart illustrating the multi-protocol data acquisition method for energy storage systems in this embodiment of the invention; Figure 3 This is a schematic diagram of the structure of the multi-protocol data acquisition system for the energy storage system in an embodiment of the present invention; Figure 4 This is an internal structural diagram of the computer device in an embodiment of the present invention; The attached figures are labeled as follows: 1. Configuration Management Module; 2. Configuration Parsing Module; 3. Data Acquisition Module; 4. Message Decoding Module; 5. Data Processing Module. Detailed Implementation

[0018] To make the objectives, technical solutions, and beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. Obviously, the embodiments described below are only part of the embodiments of this invention and are used to illustrate the invention, but are not intended to limit the scope of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0019] The multi-protocol data acquisition method for energy storage systems provided by this invention can be understood as addressing the current application situation where, when an edge gateway of an energy storage system collects data information from multiple heterogeneous devices within the system, existing customized acquisition systems require repeated implementation of protocol adaptation and parsing logic, resulting in low development efficiency, poor system scalability, and high maintenance costs. This invention proposes a data acquisition method for edge gateway energy storage systems that abstracts the data processing process, shielding the implementation details of protocol adaptation, thereby achieving configuration-driven data processing, data aggregation, and data reporting. This method can be integrated into a host computer or other application on the edge gateway for collecting operational data information from various energy storage devices within the energy storage system. The following embodiments will use data acquisition performed on a host computer as an example to describe the multi-protocol data acquisition method for energy storage systems of this invention in detail.

[0020] In one embodiment, such as Figure 1 As shown, a multi-protocol data acquisition method for an energy storage system is provided, including: S11. Obtain and load the device communication configuration file and the corresponding multiple single-device interaction configuration files. The device communication configuration file can be understood as a pre-configured overall communication parameter configuration text for all target acquisition devices (energy storage devices) in the energy storage system that need to acquire operational data. This facilitates abstract adaptation at the device communication protocol level. The single-device interaction configuration file can be understood as a configuration file set for the interaction method, message decoding or encoding / decoding method, and data processing method of a single target acquisition device. This facilitates the decoupling of data processing and data aggregation reporting from protocol parsing logic, while supporting flexible expansion and definition of interaction information for different devices.

[0021] In this embodiment, the device communication configuration file preferably includes device communication parameter information for multiple target acquisition devices. Each target acquisition device's device communication parameter information includes a communication protocol type, a single-device interaction configuration file name, and communication connection parameters. The communication protocol type of the target acquisition device can be understood as the communication protocol used by the device to communicate with other devices. Optionally, it may include network layer protocols such as TCP (Transmission Control Protocol) and UDP (User Datagram Protocol), or application layer protocols such as SNMP (Simple Network Management Protocol), MODBUS (Modicon Bus), HTTP (Hypertext Transfer Protocol), and MQTT (Message Queuing Telemetry Transport). The communication connection parameters of the target acquisition device can be understood as the basic parameters required for the device to establish a communication connection with other devices. The specific parameter content varies depending on the device type. For example, network devices may include the device's network access address and communication port number, while serial port devices may include the serial port number, baud rate, and data verification method. No specific limitations are made here. The name of the single-device interaction configuration file of the target acquisition device can be understood as the name (path) of the configuration file that includes the basic interaction configuration information required by the target acquisition device when performing data acquisition interaction, which facilitates the establishment of the association between device communication parameter information and device interaction configuration information.

[0022] The device interaction configuration information for each target acquisition device involved in the device communication configuration file is stored in a separate single-device interaction configuration file. Each single-device interaction configuration file includes the device interaction configuration information for the target acquisition device, and the device interaction configuration information includes the interaction mode, device data packet parsing definition, and device data processing definition. The interaction mode can vary depending on the specific target acquisition device, such as using a subscribe mode or a question-and-answer mode. The interaction mode adopted by the target acquisition device directly affects whether the device data request packet definition needs to be set in the corresponding single-device interaction configuration file, and whether the subsequent process of obtaining data acquisition packets through the target acquisition device needs to add the operation of actively sending data request packets to the device: when the target acquisition device's interaction mode is subscribe mode, the device data request packet definition can be selectively configured in the corresponding single-device interaction configuration file; when the target acquisition device's interaction mode is question-and-answer mode, the device data request packet definition must be configured in the corresponding single-device interaction configuration file. In practical applications, if a target acquisition device's single-device interaction configuration file defines a device data request message, then the subsequent process of obtaining data acquisition messages requires first actively sending a data request message to the device, and then waiting to receive the target acquisition device's response data acquisition message. Conversely, if no data request message is actively sent, then it is not necessary to actively send a data request message to the device; the target acquisition device can be passively received directly. In this embodiment, the interaction mode setting of the single-device interaction configuration file provides reliable support for the flexible customization of multiple interaction scenarios by the target acquisition device.

[0023] The device data request message definition in this embodiment can be understood as the definition of parameters such as the format, content, and time interval of the data request message sent to the target acquisition device. To ensure the efficiency and reliability of the data request message encoding, this embodiment preferably sets the device data request message definition to include message encoding format, message template parameters, message variable parameters, and message sending interval. The message encoding format defines the message serialization method sent to the target acquisition device, which may include encoding methods (e.g., JSON, XML, ASCII, or HEX), and may also include byte order (big-endian or little-endian). In practical applications, different target acquisition devices have different message recognition requirements, and therefore require different encoding methods. For example, some devices can recognize JSON or XML messages, while others can only recognize ASCII or HEX format messages; some can decode in big-endian order, while others decode in little-endian order. Message template parameters can be understood as predefined text parameters set based on the fixed content of the data request message sent to the target acquisition device under a specific scenario. Correspondingly, variable message parameters can be understood as the parts of the message that need to change. In practical applications, the required data request message can be generated by rendering the variable message parameters based on the message template parameters. For example, a MODBUS protocol request message generally includes the device address, function code, starting register address, read length, and checksum. When reading register data at different locations under the same function code from the same target acquisition device, the starting register address and read length need to be modified. Therefore, when using message template parameters, the device address and function code text can be directly reused, and the register address and register length can be used as variable message parameters. Message sending intervals can be understood as a frequency parameter set to resend data request messages when no response is received from the target acquisition device, taking into account situations where the target acquisition device may not receive the sent data request message due to network conditions. The specific duration can be set based on actual application requirements.

[0024] The device data packet parsing definition includes the packet decoding format and the decoding dataset definition. The packet decoding format defines the deserialization method for data acquisition packets sent by the target acquisition device, and it corresponds to the aforementioned packet encoding format; details are omitted here. The decoding dataset definition can be understood as the parameter group definition of which data needs to be obtained for parsing the data acquisition packets sent by the target acquisition device. The parsing definition (serialization information) of a single piece of data can include the data type, data identifier, data position in the packet, and length, effectively improving the efficiency and reliability of data acquisition packet decoding for various target acquisition devices.

[0025] The definition of device data processing can be understood as the definition of aggregating and processing the dataset after parsing the data acquisition messages of various target acquisition devices. It may include result identifiers and preset data processing rules. The preset data processing rules can be understood as the data aggregation and processing method set based on the processing requirements of the actual device dataset. It can be expressed in the form of calculation expressions or custom processing functions, without specific limitations here.

[0026] This embodiment manages the acquisition rules, data fields, and processing logic of each target acquisition device in the form of configuration files. This not only effectively avoids embedding a large amount of fixed logic in the data acquisition system development code, but also provides a reliable implementation foundation for protocol abstraction, decoupling of data processing processes, and flexible expansion of data acquisition. It should be noted that the device communication configuration files and individual device interaction configuration files in this embodiment can all use file formats that are easy to configure and parse, such as JSON, YAML, or XML. This embodiment preferably uses JSON format, and in practical applications, the configuration files can also be dynamically configured using a database. After the device communication configuration files and individual device interaction configuration files are generated, they are stored in a preset disk location. When the host computer starts the execution flow of the multi-protocol data acquisition method for the energy storage system provided by this invention, all configuration files in the preset disk location are directly read from the operating system.

[0027] S12. Match and parse the device communication configuration file and the individual device interaction configuration file to obtain the data acquisition configuration information of each target acquisition device; the data acquisition configuration information includes device interaction mode, communication protocol configuration items, decoding configuration items and data processing configuration items.

[0028] The matching parsing in this embodiment can be understood as being based on the mapping relationship between device communication parameter information in the device communication configuration file and single-device interaction configuration files. It involves performing association parsing on the corresponding single-device interaction configuration files based on the parsing results of the device communication parameter information to efficiently obtain all relevant configuration information for each target acquisition device, including communication protocol type, communication connection parameters, interaction mode, device data packet parsing definition, and device data processing definition. Specifically, the steps for matching and parsing the device communication configuration file and all single-device interaction configuration files to obtain the data acquisition configuration information for each target acquisition device include: The device configuration items in the device communication configuration file are parsed sequentially to obtain the device communication parameter information of each target acquisition device. Based on the communication protocol type and communication connection parameters in the device communication parameter information, the corresponding communication protocol configuration items are generated. The device communication parameter information can be obtained by parsing the configuration text format according to the specific file format of the device communication configuration file. The corresponding communication protocol configuration items can be understood as the parameter configurations necessary for establishing a communication channel with the target acquisition device. They are used to provide a unified communication interface through protocol abstraction, shielding the differences between different device protocols, significantly reducing the coupling of the system, and making it more convenient to connect new devices in the future. For details, please refer to the parameter content defined in the aforementioned communication protocol type and communication connection parameters, which will not be elaborated here.

[0029] Based on the single-device interaction configuration file name in the device communication parameter information of each target acquisition device, the corresponding single-device interaction configuration file to be parsed is obtained. This file is then parsed to obtain the corresponding device interaction configuration information. The single-device interaction configuration file to be parsed can be understood as the single-device interaction configuration file that matches the target acquisition device, obtained by traversing and matching the preset disk space of the stored device communication configuration files and multiple single-device interaction configuration files based on the single-device interaction configuration file name in the device communication parameter information. The corresponding device interaction configuration information can be obtained by parsing the configuration text format using a parser corresponding to the specific file format of the single-device interaction configuration file.

[0030] Based on the interaction mode, device data packet parsing definition, and device data processing definition in the device interaction configuration information of each target acquisition device, corresponding device interaction mode, decoding configuration item, and data processing configuration item are generated respectively. Among them, the device interaction mode is equivalent to the interaction mode in the device interaction configuration information, the parameter items in the decoding configuration item are obtained based on the packet decoding method in the device data packet parsing definition and each data definition in the dataset definition, and the parameter items in the data processing configuration item are obtained based on the result identifier and the preset data processing rule definition.

[0031] The communication protocol configuration items, device interaction modes, decoding configuration items, and data processing configuration items of each target acquisition device are summarized to obtain the corresponding data acquisition configuration information. The data acquisition configuration information of each target acquisition device can be stored using a preset data storage structure, or the configuration items in the data acquisition configuration information can be categorized and stored according to their corresponding functions.

[0032] This embodiment ensures the efficiency and comprehensiveness of acquiring various data collection configuration information by matching and parsing device communication configuration files and single-device interaction configuration files, providing reliable guidance for subsequent data collection from each target acquisition device. It should be noted that in practical applications, the specific parsing process of the aforementioned device communication configuration files and single-device interaction configuration files can be directly implemented using existing technologies. For example, if the configuration file is in JSON format, the existing Python built-in Json module can be used for parsing; if the configuration file is in YAML format, the existing PyYAML library can be used; and if the configuration file is in XML format, the existing xml.etree.ElementTree or lxml library can be used for parsing.

[0033] S13. Establish corresponding device communication channels according to the communication protocol configuration items of each target acquisition device, and obtain corresponding data acquisition messages according to the device communication channels and the corresponding device interaction modes. The device communication channel can be understood as the communication channel between the host computer and the target acquisition device, and can be obtained based on the communication protocol configuration items of the target acquisition device, referring to the communication channel creation method of the relevant protocol, which will not be detailed here. After the host computer establishes a communication channel with each target acquisition device, it can send or receive data messages through this communication channel. In practical applications, as mentioned above, if a target acquisition device is configured in a listening mode and does not need to send data request messages, the communication channel between the host computer and the target acquisition device is only used to receive data acquisition messages (running data) sent by the target acquisition device based on a preset information uploading frequency. If a target acquisition device is configured in a listening mode and needs to send data request messages or is configured in a question-and-answer mode, the communication channel between the host computer and the target acquisition device can be used both to send data request messages to the target acquisition device and to receive data acquisition messages sent by the target acquisition device in response to the received data request messages.

[0034] Considering that the target acquisition device is configured with a listening mode and needs to send data request messages, or is configured with a question-and-answer mode, the host computer needs to actively send data request messages to the target acquisition device to trigger the target acquisition device to send data acquisition messages to the host computer. To ensure the effectiveness of data acquisition message acquisition by the target acquisition device in the corresponding scenario, this embodiment preferably sets the device data request message definition in the device interaction configuration information in the single device interaction configuration file. The parsed data acquisition configuration information also includes encoding configuration items, and the corresponding encoding configuration items are generated based on the device data request message definition in the device interaction configuration information. Specifically, the configuration parameters in the encoding configuration items are obtained based on the message encoding format, message template parameters, message variable parameters, and message sending interval in the device data request message definition. The data acquisition message acquisition process in the corresponding scenario also adds the process of the host computer actively sending data request messages to the target acquisition device. Specifically, the steps to obtain the corresponding data acquisition message according to the device communication channel and the corresponding device interaction mode include: Based on the device interaction mode, communication protocol configuration items, and encoding configuration items, the message data structure is filled and serialized sequentially to generate the corresponding data request message. In practical applications, when the device interaction mode is detected to be listening mode and a request message needs to be actively sent to the target acquisition device, or when the device interaction mode is question-and-answer mode, the corresponding field information in the request message template is filled and rendered according to the communication protocol configuration items and encoding configuration items corresponding to the target acquisition device, based on the message variable parameters and encoding methods involved in the request message data structure. Then, the filled request message is converted into a byte stream that can be transmitted over the network (message data structure serialization) to obtain the corresponding data request message that the target acquisition device can recognize.

[0035] The data request message is sent to the corresponding target acquisition device so that the target acquisition device can report the corresponding data acquisition message. That is, after the host computer sends the data request message generated in the above manner to the corresponding target acquisition device through the established communication channel, the target acquisition device will parse and identify the content of the request message, encapsulate the running data it has collected into a data acquisition message and send it to the host computer. The valid data in the data acquisition message corresponds to the data content in the decoded data set stored in the decoded configuration item of the host computer. The specific message encapsulation process is not described in detail here.

[0036] The mechanism provided in this embodiment, which triggers the target acquisition device to send data acquisition messages based on actively sending request messages, can effectively ensure that devices that require trigger-based acquisition, such as those using question-and-answer mode, can quickly respond to acquisition requests and efficiently and reliably complete the corresponding data acquisition and reporting tasks.

[0037] S14. According to the decoding configuration items of each of the target acquisition devices, the corresponding data acquisition messages are decoded to obtain the corresponding decoded datasets; wherein, each configuration parameter in the decoding configuration item corresponds to the content in the device data message parsing definition mentioned above, and may include message decoding format configuration and corresponding decoded dataset configuration; the message decoding format configuration includes encoding method and byte order. When the decoded dataset definition includes serialization information of multiple data, the decoded dataset configuration also includes the same configuration parameters, and the serialization information corresponding to each data includes information that facilitates accurate location of the position and size of each valid data, which may include data type, data identifier, start position in the message, and data length, etc. Specifically, the steps of decoding the corresponding data acquisition messages according to the decoding configuration items of each target acquisition device to obtain the corresponding decoded datasets include: According to the message decoding format configuration in the decoding configuration item, the data acquisition message is preprocessed to obtain the corresponding message to be parsed; the message to be parsed can be understood as the data format that can be directly parsed and processed sequentially after converting the data acquisition message according to byte order and encoding method.

[0038] Based on the serialization information configured in the decoding dataset in the decoding configuration item, the corresponding target data fields in the message to be parsed are deserialized and parsed to generate a decoding dataset. The deserialization parsing process may include trimming, segmenting and extracting effective data from the message to be parsed, and saving it to a temporary dataset in conjunction with the configuration items.

[0039] It should be noted that the above-mentioned message preprocessing and deserialization parsing can be implemented with reference to relevant existing technologies. The message parsing and reassembly implemented by the decoding configuration item in this embodiment, whether used alone or in combination with the aforementioned encoding configuration item, decouples the data processing process from the protocol parsing logic, effectively ensuring that data from different protocols can be processed uniformly and improving the stability of data acquisition.

[0040] S15. Based on the data processing configuration items of each target acquisition device, the corresponding decoded dataset is aggregated, and the corresponding data processing results are sent to the target platform. Aggregation processing can be understood as considering that the decoded dataset obtained from decoding is still raw data for the target platform and needs to be processed before it can be displayed to the user. Based on the preset data processing rules configured in the data processing configuration items, the relevant data items in the decoded dataset are processed, and then the data processing results are sent to the target platform according to the corresponding result identifier configuration. For example, for a decoded dataset containing information such as voltage, current, and power extracted from a smart meter, it generally needs to be converted using the voltage ratio PT or current ratio CT to obtain accurate values. This requires corresponding processing based on the preset data processing rules configuration in the corresponding aggregation processing stage before being sent to the target platform. The aggregation processing provided in this embodiment can standardize, aggregate, and verify the integrity of multi-source data, ensuring the consistency and accuracy of the data collected by each target acquisition device before uploading to the target platform, thereby saving data processing resources on the target platform and effectively reducing the data processing performance load on the target platform.

[0041] To facilitate a clear understanding of the implementation process of this invention, the following example, using an application scenario involving two target acquisition devices, will be used to illustrate the above implementation process in detail. Figure 2 As shown, in this embodiment, the execution logic of the method of the present invention is entirely implemented within the host computer. The host computer interacts with device A and device B based on the configuration file, obtains the corresponding data acquisition messages, performs parsing and aggregation processing, and then sends them to the target platform for use. The specific processing flow is as follows: The system loads pre-installed device communication configuration files and multiple single-device interaction configuration files from the file system, and parses them into data acquisition configuration information that can be recognized and used in subsequent processing. The device communication configuration files define the communication protocol types, communication connection parameters, and single-device interaction configuration file names for all target acquisition devices. For example... Figure 2As shown, the device communication parameter information for two devices, device A and device B, is defined in the device communication configuration file. Each device's communication parameter information includes a protocol (communication protocol type), a library (name of the single-device interaction configuration file), and parameters fields (communication connection parameters corresponding to the communication protocol type: port number, baud rate, and host IP address). After defining the device interaction configuration information in the single-device interaction configuration file ac-power-rtu.json associated with device A, and the device interaction configuration information in the corresponding single-device interaction configuration file sensor-tcp.json associated with device B, these configuration files are loaded into the system for parsing. It should be noted that the content of the single-device interaction configuration file is as follows... Figure 2 As shown, the interactions field represents a device interaction configuration information, where mode represents the device interaction mode, encode represents the device data request message definition, decode represents the device data message parsing definition, and definitions represents the device data processing definition. When the interaction definition does not contain the encode field, it means that it is not necessary to actively send a request message to the specific device. In this scenario, the device will actively report data, so only the device data message parsing definition is needed.

[0042] By matching and parsing the device communication configuration file and the individual device interaction configuration file, the device interaction mode, communication protocol configuration items, decoding configuration items, and data processing configuration items corresponding to each target acquisition device can be obtained.

[0043] When it is necessary to actively send a data request message to a target acquisition device, the request message is encoded according to the corresponding field in the parsed encode configuration item. For example... Figure 2 As shown, the `encode` field contains parameters such as `format` and `template`. The `format` parameter represents the serialization format used for message encoding, while `template` represents a predefined message template. The `{.addr}` and `{.len}` fields in the template content represent placeholders for input parameters to be rendered, indicating the starting position and corresponding data length of the corresponding field in the message. When encoding a data request message, the system searches for parameters with the corresponding names in the `parameters` parameter of the `encode` field and uses the corresponding parameter values ​​for encoding and replacement. Additionally, since some placeholder input parameters cannot be pre-defined during configuration (e.g., the `{.crc}` placeholder represents a checksum), this parameter needs to be calculated based on the checksum algorithm after message pre-encoding. This parameter will be injected during application runtime.

[0044] The data request message content obtained after rendering and serialization is input into the communication channel between the host computer and the target acquisition device, which is established based on the instantiation of the parsed protocol configuration item (communication protocol configuration item), and then transmitted to the corresponding target acquisition device. For example, after a Modbus-RTU protocol instance or a TCP protocol instance, a communication channel is established with the specific target acquisition device through this instance. Different protocol management instances receive the corresponding type of request message and device message, and then package the message or extract the valid data in the message according to the pre-implemented protocol processing logic, and then forward it to the device or message decoding module. It should be noted here that the various protocol communication components used for protocol communication can be pre-developed for the processing logic of different protocol types, or existing related components can be directly integrated. For example, the MODBUS protocol needs to initialize the corresponding hardware for serial port communication, or the HTTP protocol needs to create a Socket and call the TCP / IP protocol suite for network communication, etc., which will not be detailed here.

[0045] After receiving the data acquisition message from a target acquisition device via the communication channel, the host computer will decode the data acquisition message obtained in the same interactive session according to the parsed decode configuration item. For example... Figure 2 As shown, the device data packet parsing definition in ac-power-rtu includes the decoding mode format and dataset definitions v1 and v2. Format represents the packet decoding format, and the hex value means that the packet is parsed in hexadecimal. Offset in v1 and v2 represents the offset of the data obtained during packet parsing (corresponding to the encoded position in the packet data), and len represents the length of the data truncated from the offset (corresponding to the data length). For example, if the obtained data acquisition packet is 0x1234, then v1 means that the data truncated is 0x12, and v2 means that the data truncated is 0x34. Note that the 0x prefix here only indicates that the data is a hexadecimal number. v1 and v2 obtained through packet parsing form a dataset, which is then used for data aggregation processing.

[0046] The dataset obtained from the aforementioned decoding process is processed and published based on the result identifiers and preset data processing rules in the definitions configuration item (data processing configuration item). For example... Figure 2As shown, the ac-power-rtu file defines two parameters, voltage and current, while sensor-tcp defines the parameter temperature. Each parameter has its own defined data type and calculation expression. The voltage parameter is obtained by dividing the v1 data by 10, and the current and temperature are calculated similarly. The float type indicates that the final output value is a floating-point number. The data processing results obtained through aggregation are encapsulated into a message format recognizable by the target platform and sent to the target platform for publication, thus completing a complete device data acquisition process.

[0047] This invention provides a technical solution that, based on a configuration-driven data acquisition mechanism that integrates protocol adaptation, data processing, and data aggregation reporting, decouples protocol abstraction and data processing processes. This provides reliable technical support for unified access across multiple protocols, efficient data acquisition, flexible expansion, and standardized output. Ultimately, it effectively improves the development efficiency of the data acquisition system, enhances the efficiency, stability, and flexible scalability of the system's data acquisition, and reduces maintenance costs. The solution involves acquiring and loading device communication configuration files and corresponding single-device interaction configuration files, matching and parsing these files to obtain data acquisition configuration information for each target acquisition device, including device interaction mode, communication protocol configuration items, decoding configuration items, and data processing configuration items. It then establishes corresponding device communication channels based on the communication protocol configuration items of each target acquisition device, acquires corresponding data acquisition messages based on the communication channels and corresponding device interaction modes, decodes the corresponding data acquisition messages according to the decoding configuration items of each target acquisition device to obtain corresponding decoded datasets, aggregates the corresponding decoded datasets according to the data processing configuration items of each target acquisition device, and finally sends the corresponding data processing results to the target platform.

[0048] It should be noted that although the steps in the flowchart above are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise explicitly stated in this document, there is no strict order requirement for the execution of these steps, and they can be executed in other orders.

[0049] In one embodiment, such as Figure 3 As shown, a multi-protocol data acquisition system for an energy storage system is provided, the system comprising: Configuration management module 1 is used to obtain and load device communication configuration files and corresponding multiple single-device interaction configuration files; Configuration parsing module 2 is used to match and parse the device communication configuration file and each of the single device interaction configuration files to obtain the data acquisition configuration information of each of the target acquisition devices; the data acquisition configuration information includes device interaction mode, communication protocol configuration items, decoding configuration items and data processing configuration items. The data acquisition module 3 is used to establish a corresponding device communication channel according to the communication protocol configuration items of each of the target acquisition devices, and to acquire the corresponding data acquisition message according to the device communication channel and the corresponding device interaction mode; The message decoding module 4 is used to decode the corresponding data acquisition message according to the decoding configuration items of each of the target acquisition devices to obtain the corresponding decoded dataset; The data processing module 5 is used to aggregate the corresponding decoded dataset according to the data processing configuration items of each of the target acquisition devices, and send the corresponding data processing results to the target platform.

[0050] Specific limitations regarding the multi-protocol data acquisition system for energy storage systems can be found in the limitations of the multi-protocol data acquisition method for energy storage systems described above; the corresponding technical effects are equivalent and will not be repeated here. Each module in the aforementioned multi-protocol data acquisition system for energy storage systems can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.

[0051] Figure 4 An internal structural diagram of a computer device is shown in one embodiment. This computer device may specifically be a terminal or a server. Figure 4 As shown, the computer device includes a processor, memory, network interface, display, camera, and input device connected via a system bus. 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 and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program can implement a multi-protocol data acquisition method for the energy storage system. The display screen can be an LCD screen or an e-ink display screen. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0052] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computing device may include more or fewer components than those shown in the figure, or combine certain components, or have the same component arrangement.

[0053] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.

[0054] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.

[0055] In summary, the multi-protocol data acquisition method, system, computer equipment, and storage medium provided by the embodiments of the present invention can achieve decoupling of protocol abstraction and data processing based on a configuration-driven data acquisition mechanism that integrates protocol adaptation, data processing, and data aggregation and reporting. This provides reliable technical support for unified access of multiple protocols, efficient data acquisition, flexible expansion, and standardized output, thereby effectively improving the development efficiency of the data acquisition system, enhancing the efficiency, stability, and flexible scalability of the system's data acquisition, and reducing maintenance costs.

[0056] The various embodiments in this specification are described in a progressive manner. For directly identical or similar parts of the embodiments, refer to each other. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. It should be noted that the technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.

[0057] The above-described embodiments are merely preferred embodiments of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various improvements and substitutions without departing from the principles of the present invention, and these improvements and substitutions should also be considered within the scope of protection of the present invention. Therefore, the scope of protection of this invention should be determined by the scope of the claims.

Claims

1. A multi-protocol data acquisition method for an energy storage system, characterized in that, The method includes: Retrieve and load the device communication configuration file and the corresponding multiple single-device interaction configuration files; The device communication configuration file and each of the individual device interaction configuration files are matched and parsed to obtain the data acquisition configuration information of each target acquisition device; the data acquisition configuration information includes device interaction mode, communication protocol configuration items, decoding configuration items and data processing configuration items; Establish corresponding device communication channels according to the communication protocol configuration items of each target acquisition device, and obtain corresponding data acquisition messages according to the device communication channels and the corresponding device interaction modes; According to the decoding configuration items of each of the target acquisition devices, the corresponding data acquisition messages are decoded to obtain the corresponding decoded dataset; According to the data processing configuration items of each of the target acquisition devices, the corresponding decoded datasets are aggregated and the corresponding data processing results are sent to the target platform.

2. The multi-protocol data acquisition method for energy storage systems as described in claim 1, characterized in that, The device communication configuration file includes device communication parameter information for multiple target acquisition devices; the device communication parameter information includes communication protocol type, single device interaction configuration file name, and communication connection parameters. The single-device interaction configuration file includes device interaction configuration information corresponding to the target acquisition device; the device interaction configuration information includes interaction mode, device data packet parsing definition, and device data processing definition; the interaction mode includes listening mode; the device data packet parsing definition includes packet decoding format and decoding dataset definition; the device data processing definition includes result identifier and preset data processing rules.

3. The multi-protocol data acquisition method for energy storage systems as described in claim 2, characterized in that, The device interaction configuration information also includes a device data request message definition; the device data request message definition includes a message encoding format, message template parameters, message variable parameters, and message sending interval.

4. The multi-protocol data acquisition method for energy storage systems as described in claim 2, characterized in that, The interaction mode also includes a question-and-answer mode; the device interaction configuration information also includes a device data request message definition; the device data request message definition includes a message encoding format, message template parameters, message variable parameters, and message sending interval.

5. The multi-protocol data acquisition method for an energy storage system as described in claim 2, 3, or 4, characterized in that, The step of matching and parsing the device communication configuration file and all the single device interaction configuration files to obtain the data acquisition configuration information of each target acquisition device includes: The device configuration items in the device communication configuration file are parsed sequentially to obtain the device communication parameter information of each target acquisition device, and the corresponding communication protocol configuration items are generated according to the communication protocol type and communication connection parameters in the device communication parameter information. Based on the name of the single device interaction configuration file in the device communication parameter information of each target acquisition device, the corresponding single device interaction configuration file to be parsed is obtained, and the single device interaction configuration file to be parsed is parsed to obtain the corresponding device interaction configuration information. Based on the interaction mode, device data packet parsing definition, and device data processing definition in the device interaction configuration information of each target acquisition device, corresponding device interaction mode, decoding configuration item, and data processing configuration item are generated respectively. The communication protocol configuration items, device interaction mode, decoding configuration items, and data processing configuration items of each target acquisition device are summarized to obtain the corresponding data acquisition configuration information.

6. The multi-protocol data acquisition method for an energy storage system as described in claim 3 or 4, characterized in that, The data acquisition configuration information also includes encoding configuration items; the encoding configuration items are generated based on the device data request message definition in the device interaction configuration information. The step of obtaining the corresponding data acquisition message based on the device communication channel and the corresponding device interaction mode includes: Based on the device interaction mode, the communication protocol configuration items, and the encoding configuration items, the message data structure is filled and the data structure is serialized in sequence to generate the corresponding data request message. The data request message is sent to the corresponding target acquisition device so that the target acquisition device reports the corresponding data acquisition message.

7. The multi-protocol data acquisition method for energy storage systems as described in claim 2, characterized in that, The decoded dataset definition includes serialization information for multiple data items; the serialization information includes data type, data identifier, start position in the message, and data length; The step of decoding the corresponding data acquisition message according to the decoding configuration items of each of the target acquisition devices to obtain the corresponding decoded dataset includes: According to the message decoding format configuration in the decoding configuration item, the data acquisition message is preprocessed to obtain the corresponding message to be parsed. Based on the serialization information configured in the decoding configuration item, the corresponding target data fields in the message to be parsed are deserialized and parsed to generate the decoding dataset.

8. A multi-protocol data acquisition system for an energy storage system, characterized in that, The system includes: The configuration management module is used to obtain and load device communication configuration files and corresponding multiple single-device interaction configuration files; A configuration parsing module is used to match and parse the device communication configuration file and each of the single device interaction configuration files to obtain the data acquisition configuration information of each of the target acquisition devices; the data acquisition configuration information includes device interaction mode, communication protocol configuration items, decoding configuration items and data processing configuration items. The data acquisition module is used to establish a corresponding device communication channel according to the communication protocol configuration items of each of the target acquisition devices, and to acquire the corresponding data acquisition message according to the device communication channel and the corresponding device interaction mode; The message decoding module is used to decode the corresponding data acquisition message according to the decoding configuration items of each of the target acquisition devices to obtain the corresponding decoded dataset; The data processing module is used to aggregate the corresponding decoded datasets according to the data processing configuration items of each of the target acquisition devices, and send the corresponding data processing results to the target platform.

9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, 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 7.

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 7.