A power data acquisition method and device

By using parallel access and passive monitoring, combined with frame recognition, verification, and thread pool scheduling, the problems of resource consumption and bus conflicts in traditional power data acquisition methods are solved, achieving efficient and reliable meter data acquisition, adapting to various meter environments, and improving the real-time performance and stability of data acquisition.

CN122248075APending Publication Date: 2026-06-19XIAMEN RUIGU COMM EQUIP CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAMEN RUIGU COMM EQUIP CO LTD
Filing Date
2026-03-24
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Traditional power data acquisition methods suffer from problems such as limited serial port resources, frequent bus conflicts, insufficient device and protocol compatibility, and low data acquisition efficiency, making it difficult to achieve efficient and reliable meter data acquisition without affecting the operation of existing equipment.

Method used

The serial communication bus of the power meter is accessed in parallel. The interactive data stream is monitored in passive listening mode. Valid data frames are filtered out through frame identification, frame verification, address matching and integrity verification. Real-time parsing is performed using a thread pool scheduling mechanism. Combined with a layered architecture and multi-protocol driver adaptation, non-exclusive access and efficient data processing are achieved.

Benefits of technology

It enables efficient and reliable collection of electricity meter data without affecting the operation of existing equipment, improves system compatibility, flexibility and data accuracy, adapts to various types of electricity meter environments, reduces data processing overhead and bus conflict risks, and ensures data real-time performance and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122248075A_ABST
    Figure CN122248075A_ABST
Patent Text Reader

Abstract

A power data acquisition method and apparatus include: accessing the serial communication bus where the power meter is located in parallel to achieve non-exclusive monitoring access; activating passive monitoring mode to continuously monitor the interactive data stream between the host and the power meter on the serial communication bus; performing frame identification, frame verification, address matching, and integrity verification on the monitored interactive data stream based on the frame structure of a preset power meter communication protocol, identifying and filtering data frames and abnormal frames that are not the target meter address, filtering out valid data frames, and then performing data parsing processing on the valid data frames; using a thread pool scheduling mechanism to schedule and execute the parsing task of the valid data frames in real time, and transmitting the meter data obtained after data parsing to the upper-layer application to reduce data processing overhead. This invention can achieve efficient and reliable acquisition of meter data without monopolizing the communication interface or affecting the operation of existing equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power data acquisition, and in particular to a power data acquisition method and apparatus. Background Technology

[0002] In industrial power metering scenarios, DL / T645 protocol meters are widely used for power data acquisition and monitoring. Traditional acquisition solutions typically use an industrial gateway as the acquisition terminal, establishing a connection with the meter via an RS-485 serial bus and employing an active polling mechanism to obtain meter data.

[0003] In actual deployment and operation, this traditional method has several limitations: First, the traditional data acquisition method requires exclusive use of the meter's RS-485 communication interface, but in industrial sites, this interface is often already occupied by existing equipment such as PLCs and SCADA hosts, making it impossible for new data acquisition devices to be directly connected. To complete the deployment, the field wiring needs to be re-wired or the existing system needs to be powered off, which not only increases deployment costs but may also affect the continuous operation and stability of the existing production system.

[0004] Secondly, traditional data acquisition systems are usually customized for specific models of electricity meters or specific versions of the DL / T645 protocol, which limits their adaptability to different brands and models of electricity meters. They are difficult to flexibly adapt to field environments where multiple types of electricity meters coexist, resulting in poor compatibility.

[0005] Furthermore, the data parsing algorithms of some acquisition systems are not optimized for the DL / T645 protocol frame structure. When faced with multiple meters and high-concurrency data streams, the data extraction and conversion efficiency is low, making it difficult to meet the real-time requirements of industrial sites.

[0006] Finally, traditional gateways employ an active polling mechanism, requiring them to act as the master station and send request frames to the meter. If the existing PLC / SCADA system is still running, the two master station commands will collide on the same RS-485 bus, leading to frame conflicts, increased bit error rate, and even loss of meter response frames and frequent CRC check errors. To mitigate these issues, the polling frequency is typically reduced or the frame interval is extended, resulting in a decrease in the real-time performance of data acquisition. Summary of the Invention

[0007] The main objective of this invention is to overcome the shortcomings of existing technologies, such as limited serial port resource usage, frequent bus conflicts, insufficient device and protocol compatibility, and low data acquisition efficiency. This invention proposes a power data acquisition method and device that can achieve efficient and reliable acquisition of electricity meter data without monopolizing the communication interface or affecting the operation of existing equipment.

[0008] The present invention adopts the following technical solution:

[0009] A method for acquiring power data, comprising:

[0010] The power meter is connected to the serial communication bus in parallel to achieve non-exclusive monitoring access.

[0011] Activate passive listening mode to continuously monitor the interactive data stream between the host and the power meter on the serial communication bus;

[0012] Based on the frame structure of the preset power meter communication protocol, the intercepted interactive data stream is processed by frame identification, frame verification, address matching and integrity verification. Data frames that are not the target meter address and abnormal frames are identified and filtered. After the valid data frames are selected, data parsing processing is performed on the valid data frames.

[0013] A thread pool scheduling mechanism is used to schedule and execute the parsing task of the valid data frame in real time, and the meter data obtained after data parsing is transmitted to the upper layer application to reduce data processing overhead.

[0014] The frame identification is used to locate the start symbol specified by the protocol in the continuous interactive data stream. The frame verification is used to verify the format of the address field and the start symbol according to the protocol frame structure after the start symbol is identified. After the verification is passed, it is determined to be an initial valid data frame and enters the receiving state.

[0015] The address matching process involves combining the received power meter addresses into a unified format according to protocol rules and comparing the values ​​with the preset target meter addresses. If the addresses do not match, the current data frames to be filtered are filtered out.

[0016] The data parsing process extracts data content segments from valid data frames selected from the intercepted interactive data stream, performs decryption processing and byte order adjustment on the data content segments as agreed in the protocol, and then reassembles the original data into the meter data according to the preset data format table.

[0017] The integrity check is performed on the data frames to be screened after frame identification, frame verification and address matching. The check is calculated using a global summation method. If the check does not match, the frame is judged as an abnormal frame and discarded. If the check matches, the frame is included in the valid data frames.

[0018] The thread pool scheduling mechanism dynamically allocates parsing tasks for valid data frames based on multiple sets of parallel monitored interactive data streams and filtered valid data frames using a preset number of worker threads; when the parsing load of valid data frames in a single data stream exceeds a threshold, the thread pool resources are automatically expanded.

[0019] A power data acquisition device, comprising:

[0020] The protocol driver layer is used to connect to the serial communication bus where the power meter is located in parallel to realize non-exclusive listening access; it starts the passive listening mode to continuously listen to the interactive data stream between the host and the power meter on the serial communication bus and transmits the interactive data stream to the main service layer.

[0021] The main service layer, which communicates with the protocol driver layer, is used to perform frame identification, frame verification, address matching, and integrity verification on the monitored interactive data stream based on the frame structure of the preset power meter communication protocol. It identifies and filters data frames that are not the target meter address and abnormal frames, and after filtering out the valid data frames, it performs data parsing processing on the valid data frames. At the same time, a thread pool scheduling mechanism is used to schedule and execute the parsing task of the valid data frames in real time to generate meter data.

[0022] The forwarding application layer communicates with the main service layer to transmit the meter data generated by the main service layer to the upper-layer application, thereby reducing data processing overhead.

[0023] The main service layer includes:

[0024] The daemon module is used to monitor the running status of the protocol driver layer and the main service layer. When the acquisition driver exits abnormally, it automatically completes resource reclamation and restarts the driver. When the serial port listening is abnormal, it automatically performs port reopening and listening recovery operations to ensure continuous listening of interactive data streams.

[0025] The configuration management module is used to store the operational configuration that supports interactive data stream listening, valid data frame filtering, and data parsing using a database. When the configuration changes, it actively notifies each module to reload the configuration and restart the initialization process. After loading the configuration, it performs a validity range check on the instrument address and serial communication parameters. If the check fails, the initialization is terminated.

[0026] The message routing module is used to forward and distribute messages between modules through the DBUS message bus, thereby decoupling the modules.

[0027] The data engine module is used to cache, aggregate, store in time series, and perform preliminary analysis on the collected data, providing a unified data view for upper-layer applications.

[0028] The data engine module includes a frame filtering unit, a data parsing unit, and a thread pool scheduling unit: the frame filtering unit performs frame identification, frame verification, address matching, and integrity verification to filter out valid data frames; the data parsing unit extracts data content segments from valid data frames, performs decryption, byte order adjustment, and format reorganization to generate meter data; the thread pool scheduling unit dynamically allocates parsing tasks using a preset number of worker threads, and automatically expands the thread pool resources when the parsing load exceeds a threshold.

[0029] The protocol driver layer includes DLT645, IEC101, and IEC104 drivers, used to adapt to different power meter communication protocols and data sources, realize communication connections with industrial equipment, obtain equipment operation data, and transmit it to the main service layer; the forwarding application layer includes MQTT forwarding unit, HTTP forwarding unit, and TCP forwarding unit, used to encapsulate the meter data according to different communication protocols and send it to external systems, and receive external system instructions and forward them to the protocol driver layer.

[0030] As can be seen from the above description of the present invention, compared with the prior art, the present invention has the following beneficial effects:

[0031] 1. This invention adopts a parallel non-exclusive access and passive monitoring mode, which can realize the bypass acquisition of power meter data without affecting the normal operation of existing equipment and without the need for on-site wiring modifications; through a multi-step verification and filtering and thread pool scheduling mechanism, it can achieve accurate filtering and efficient parsing of effective data frames, reduce data processing overhead, and ensure the reliability and real-time performance of data acquisition.

[0032] 2. This invention supports configurable adaptation of data identifier, data format, data length, and data starting address, and can flexibly adapt parsing rules according to different brands of electricity meters; through frame header recognition, format verification, address matching, and integrity verification, abnormal frames are filtered in layers, and the electricity meter values ​​are accurately parsed and reconstructed, improving system compatibility, flexibility, and data accuracy.

[0033] 3. This invention uses a thread pool to dynamically schedule and manage parsing tasks, adapting to multi-path parallel data streams and high-concurrency scenarios, ensuring timely and efficient protocol frame identification and parsing; at the same time, it introduces a zero-copy data transfer mechanism to reduce memory relocation and repeated parsing overhead, further improving end-to-end data acquisition and forwarding efficiency.

[0034] 4. This invention passively listens to bus interactions and does not actively send out query requests. It relies on a state machine to identify and filter non-target address frames, avoiding bus conflicts and data disorder caused by multiple master station polling. Combined with a layered architecture, multi-protocol driver adaptation, anomaly protection self-healing and multi-channel forwarding, it improves long-term operational stability, anti-interference ability and field adaptability. Attached Figure Description

[0035] Figure 1 This is the main flowchart of the method of the present invention;

[0036] Figure 2 This is a block diagram of the device of the present invention;

[0037] Figure 3 This is a diagram showing the composition of the data engine module of the present invention.

[0038] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Detailed Implementation

[0039] The present invention will be further described below through specific embodiments.

[0040] See Figure 1 An embodiment of the present invention proposes a power data acquisition method, comprising:

[0041] S1 connects to the serial communication bus where the power meter is located in parallel, realizing non-exclusive monitoring access.

[0042] In this step, a data acquisition device is connected to the serial communication bus where the power meter is located to achieve non-exclusive monitoring access. There is no need to disconnect the existing communication link between the host (such as PLC, SCADA) and the power meter; it is directly coupled to the existing serial communication bus (RS-485 bus) through parallel connection. This access method physically does not occupy or preempt the original communication interface of the meter, and electrically possesses high-impedance monitoring characteristics. It does not inject differential drive signals into the bus, therefore it will not interfere with the data interaction between the original host and the meter, achieving rapid bypass deployment without affecting the normal operation of existing equipment, without power outage modifications, and without rewiring.

[0043] Taking the DLT645 protocol-based electricity meter as an example, the data acquisition device achieves communication adaptation with the electricity meter by adapting the DLT645 driver.

[0044] S2 initiates passive listening mode, continuously monitoring the data stream exchanged between the host and the power meter on the serial communication bus.

[0045] After successful connection, the acquisition device switches to a purely passive listening state, no longer actively issuing query commands as a communication master station, but only capturing and buffering the raw bit stream data transmitted bidirectionally on the bus in real time. By continuously bypassing and listening to the query frames issued by the master station and the return frames of the power meter's response, the bus interaction timing and original message details are fully preserved. This avoids the problems of multi-master station command collisions, bus data disorder, and packet loss and bit error problems caused by traditional active polling, and provides the original data source for subsequent analysis.

[0046] In this embodiment, taking the monitored data stream as mainly consisting of DLT645 protocol frames as an example, the DLT645 frame format is 68H A5A4 A3 A2 A1 A0 68H CL DATA CS 16H, where 68H is the start symbol, A5-A0 are the meter addresses, 68H is the start symbol, C is the control code, L is the DATA segment length, DATA is the data segment, CS is the checksum, and 16H is the end symbol.

[0047] Based on the frame structure of the preset power meter communication protocol, S3 performs frame recognition, frame verification, address matching and integrity verification on the intercepted interactive data stream. It identifies and filters data frames that are not the target meter address and abnormal frames. After filtering out the valid data frames, it performs data parsing processing on the valid data frames.

[0048] Specifically, the intercepted interactive data stream is a continuous raw bitstream containing various communication data transmitted between the host and each power meter. This stream contains invalid frames, interference frames, and communication frames from non-target meters, requiring multi-step filtering and verification to ensure the accuracy and effectiveness of subsequent data parsing. This series of processing steps is based on a pre-defined power meter communication protocol frame structure specification, adapting to the communication protocols of various types of power meters. It eliminates the need for customized development for specific meter models, effectively improving the compatibility of the acquisition scheme. By using a filtering-then-parsing logical sequence, invalid data can be filtered out in advance, reducing the computational power consumption of subsequent parsing stages and improving overall data processing efficiency.

[0049] Frame identification is used to locate the protocol-defined start symbol in a continuous interactive data stream. Since the monitored interactive data stream has no explicit separator, the frame identification process uses preset protocol start symbol features to scan and match the continuous bit stream byte by byte to locate the start position of each data frame and distinguish the boundaries between adjacent data frames.

[0050] Taking the DLT645 protocol frame as an example, the frame identification process requires capturing the first 68H start character in the continuous bit stream received from the serial port. After receiving 6 consecutive address fields (A5-A0), if the 68H start character is detected again, it can be determined as a valid DLT645 protocol frame header. After confirming the valid frame header, the control code (C) and the data segment length field (L) are received sequentially according to the protocol specification. Based on the data segment length L, the number of data bytes to be received is determined to be L+2 (including the data segment DATA and the checksum CS). This completes the initial capture of a single complete DLT645 data frame and ensures the accuracy of frame boundary division.

[0051] Frame verification is used to verify the format of the address field and the start character according to the protocol frame structure after the start character is identified. Only after the verification is passed is it determined to be an initial valid data frame and enters the receiving state. After locating the start character, the format of the address field following the start character and the connection logic between the start character and the address field are verified according to the preset protocol frame structure to check for problems such as misidentification of the start character and abnormal address field format. Only when the format verification fully conforms to the protocol specification is the frame determined to be an initial valid data frame and enter the subsequent receiving and processing process, effectively filtering invalid frames caused by signal interference.

[0052] Address matching involves combining received power meter addresses into a unified format according to protocol rules and comparing the values ​​with preset target meter addresses. If the addresses do not match, the current data frame to be filtered is filtered. Industrial sites typically deploy multiple power meters, and the monitored data stream contains communication data from all meters. The address matching process first reassembles the meter addresses in each initial valid data frame into a unified format according to the protocol's encoding rules, eliminating differences in encoding formats between different meter addresses. Then, it compares the values ​​with a preset list of target meter addresses. Frames with mismatched addresses are directly filtered, retaining only data frames from the target meters. This avoids non-target meter data occupying parsing resources, ensuring that subsequent parsed data is all from the actual target meters, improving the targeting and effectiveness of data acquisition.

[0053] For DLT645 protocol meters, the configuration interface can configure the target meter address to be monitored. The target meter address A64 is calculated as A5<<48|A4<<32|A3<<24|A2<<16|A1<<8|A0. After the above data frame is successfully verified, the A64 received by the serial port is calculated. If the two values ​​are inconsistent, the entire frame is discarded.

[0054] Integrity verification targets data frames that have undergone frame identification, frame verification, and address matching. It uses a global summation verification method to perform verification calculations. If the verification does not match, the frame is judged as an abnormal frame and discarded. If the verification matches, the frame is included in the valid data frames.

[0055] Even after the three previous processing steps, the frames to be filtered may still have issues such as missing data or data errors. The integrity verification step performs a full-domain summation calculation on all fields of the data frame to be filtered and compares the calculation result with the frame's built-in check value. If the verification result does not match, it indicates that the frame has abnormal data, and it is judged as an abnormal frame and discarded directly to prevent abnormal data from entering the subsequent parsing process and causing errors. If the verification result matches, it indicates that the frame data is complete and error-free, and it is officially included in the valid data frame to ensure the accuracy and reliability of subsequent data parsing and further improve the quality of meter data collection.

[0056] For DLT645 protocol frames, the integrity check specifically involves accumulating and checking the header, trailer, meter address, and last byte of the data field of the entire complete data frame, and comparing it with the checksum CS. If they do not match, the entire frame is discarded. The logic for receiving DLT645 request frames and response frames is consistent.

[0057] In this embodiment, data parsing extracts data content segments from valid data frames selected from the intercepted interactive data stream, performs decryption processing and byte order adjustment on the data content segments as agreed in the protocol, and then reassembles the original data into meter data according to the preset data format table.

[0058] The valid data frame contains multiple parts, including an address field, a control field, a data content segment, and a check field. The data parsing process first extracts the data content segment, which contains the original encoding of core data such as meter operating status and energy metering. For data content segments that require encrypted transmission according to the protocol, decryption processing is performed according to the decryption algorithm specified in the protocol to restore the original data. Simultaneously, the byte order of the data content segment is adjusted according to the byte order requirements of the power meter communication protocol to ensure data format uniformity. Finally, based on a preset data format table, the adjusted original data is reassembled into meter data that meets the needs of upper-layer applications, realizing the conversion of original communication data into usable business data and providing accurate and standardized meter operation data support for upper-layer applications.

[0059] For DLT645 protocol frames, the data segment DATA needs to be decrypted by subtracting 33H, then the bytes need to be reversed to extract DI0-DI3. Based on the 4 bytes of DI, the built-in data format table is matched (the data format table is made according to the protocol document, such as voltage format is XXX.X, current format is XXX.XXX), and then split and reassembled into the corresponding decimal numbers.

[0060] S4 employs a thread pool scheduling mechanism to schedule and execute the parsing tasks of valid data frames in real time, and transmits the meter data obtained after data parsing to the upper-layer application to reduce data processing overhead.

[0061] Specifically, the valid data frames obtained after the S3 step need to be converted into usable meter data through the data parsing stage. However, in industrial sites, multiple power meters working in parallel will generate a large number of valid data frames. If a single-threaded serial processing method is used, it is easy to encounter problems such as parsing task accumulation and excessive processing latency, which cannot meet the real-time data acquisition requirements of industrial sites.

[0062] Therefore, this step adopts a thread pool scheduling mechanism to coordinate and efficiently execute the parsing tasks of valid data frames. This not only improves data parsing efficiency but also rationally allocates system computing resources, avoids wasting computing power, thereby reducing overall data processing overhead and ensuring that the parsed meter data can be transmitted to the upper-layer application in a timely manner, thus guaranteeing the upper-layer application's real-time access to meter data.

[0063] The thread pool scheduling mechanism dynamically allocates parsing tasks for valid data frames from multiple sets of parallel monitored interactive data streams and filtered valid data frames using a preset number of worker threads. The thread pool pre-initializes a preset number of core worker threads, which can be flexibly configured based on the number of deployed power meters, data transmission frequency, and other actual scenario requirements to ensure that the initial computing power can meet the needs of routine data parsing. When the system processes multiple sets of parallel monitored interactive data streams simultaneously, and each data stream filters out valid data frames, the thread pool dynamically distributes these parsing tasks to various idle core worker threads according to a balanced allocation principle. This achieves multi-task parallel parsing, avoids the bottleneck of single-threaded processing, and improves overall data parsing efficiency.

[0064] When the parsing load of valid data frames in a single data stream exceeds the threshold, the thread pool resources are automatically expanded. The thread pool monitors the task load of each worker thread in real time, as well as the number of valid data frame parsing tasks corresponding to a single data stream, and presets a reasonable load threshold to determine whether the current computing power is sufficient. When the number of valid data frames in a certain data stream surges, causing the corresponding parsing task load to exceed the preset threshold, and all core worker threads are busy, the thread pool will automatically start a temporary thread expansion mechanism, adding a certain number of temporary worker threads to participate in the parsing task processing until the task load drops below the threshold. Subsequently, temporary threads can be recycled according to the load situation to avoid resource idleness.

[0065] This dynamic scaling mechanism not only solves the problems of task backlog and high latency in high-concurrency scenarios, but also avoids the waste of computing power caused by a fixed number of threads, realizing dynamic adaptation of computing resources and further ensuring the real-time and efficient parsing of electricity meter data.

[0066] Furthermore, zero-copy technology is introduced during the transmission of parsed meter data to the upper-layer application. This directly transmits the parsed meter data to the upper-layer application module, avoiding the problems of multiple copies and repeated parsing of data at the memory level, as is common in traditional data acquisition systems. Simultaneously, data distribution is achieved through a message routing module: the message routing module forwards DBUS messages sent by the DLT645 to the configured forwarding module (MQTT / HTTP / TCP) according to preset forwarding rules. The DBUS message format for DLT645 data is JSON, consisting of the time the data was detected and the parsed numerical values ​​(such as voltage, current, and electricity consumption).

[0067] The data reporting strategy supports flexible configuration, specifically divided into timed reporting and change reporting. Both strategies can be set through the configuration interface. Timed reporting forwards the parsed data at a certain period, while change reporting forwards the parsed data when the meter data value changes.

[0068] Based on this, see Figure 2 and Figure 3 This embodiment also proposes a power data acquisition device for executing the power data acquisition method described above, including a protocol driver layer, a main service layer, and a forwarding application layer.

[0069] The protocol driver layer is used to connect to the serial communication bus where the power meter is located in parallel, realizing non-exclusive listening access; it starts the passive listening mode, continuously listens to the interactive data stream between the host and the power meter on the serial communication bus, and transmits the interactive data stream to the main service layer.

[0070] In this embodiment, the protocol driver layer includes DLT645, IEC101, and IEC104 drivers, used to adapt to different power meter communication protocols and data sources, realize communication connections with industrial equipment, acquire equipment operation data, and transmit it to the main service layer. The forwarding application layer includes MQTT forwarding units, HTTP forwarding units, and TCP forwarding units, used to receive meter data output from the main service layer, encapsulate it according to a preset communication protocol, send it to the external system, and receive external system instructions and forward them to the protocol driver layer for response interaction.

[0071] The main service layer communicates with the protocol driver layer and is used to perform frame recognition, frame verification, address matching, and integrity verification on the monitored interactive data stream based on the frame structure of the preset power meter communication protocol. It identifies and filters data frames that are not the target meter address and abnormal frames. After filtering out the valid data frames, it performs data parsing processing on the valid data frames. At the same time, a thread pool scheduling mechanism is used to schedule and execute the parsing tasks of valid data frames in real time to generate meter data.

[0072] The forwarding application layer communicates with the main service layer to transmit meter data generated by the main service layer to upper-layer applications, thereby reducing data processing overhead. On one hand, it receives meter data generated by the main service layer after processing by the data engine in real time, and directly pushes the parsing results to upper-layer business applications based on the built-in zero-copy data transmission mechanism. On the other hand, it uniformly receives control configuration commands issued by upper-layer external systems (such as cloud platforms, MES, SCADA), parses and transparently transmits them to the main service layer and protocol driver layer according to preset routing rules for response interaction.

[0073] The device in this embodiment, through a layered collaborative design of protocol driver layer, main service layer, and forwarding application layer, corresponds to each step of the above-mentioned power data acquisition method. It realizes the integrated functions of non-exclusive bus access, passive listening acquisition, efficient data processing, and accurate forwarding. It effectively solves the problems of serial port resource monopoly, bus conflict, low data processing efficiency, and insufficient compatibility of traditional acquisition devices. It does not require power outage modification or rewiring of existing equipment in the field, making it convenient to deploy and not interfering with the normal operation of the existing system. At the same time, it improves the real-time performance, accuracy, and reliability of meter data acquisition, and is suitable for the needs of multi-instrument and high-concurrency acquisition scenarios in industrial fields.

[0074] The main service layer includes: a daemon process module, a configuration management module, a message routing module, and a data engine module. The following describes each module.

[0075] The daemon module is used to monitor the running status of each module in the protocol driver layer and the main service layer. When the acquisition driver exits abnormally, it automatically completes resource reclamation and restarts the driver. When the serial port listening is abnormal, it automatically performs port reopening and listening recovery operations to ensure continuous listening of interactive data streams.

[0076] On the one hand, during the entire process of passively listening to the interactive data stream and subsequent frame processing and data parsing, the daemon process monitors and safeguards the running status of the acquisition driver that implements serial bus listening in real time; when the acquisition driver exits abnormally, it automatically reclaims resources and restarts the driver instance; when the serial port listening link is abnormally interrupted, it automatically performs port reopening and listening recovery to ensure that the interactive data stream is not lost.

[0077] On the other hand, regarding the fault tolerance management of the DLT645 driver: the daemon process maintains the PID list (process number) of the DLT645 driver. When the DLT645 driver terminates abnormally, the kernel sends an exit signal to the daemon process. After the daemon process captures the signal, it first safely reclaims the occupied resources and then automatically restarts the DLT645 driver to resume the listening task. If a serial port I / O failure occurs, the DLT645 driver itself receives the serial port failure message and performs self-maintenance reconnection, while the daemon process is responsible for determining and ensuring the survival and abnormal restart of the DLT645 driver process.

[0078] The configuration management module is used to uniformly manage the system's operating parameters: it uses persistent database storage to support interactive data stream listening, valid data frame filtering, and data parsing for the operation configuration; when the configuration changes, it actively notifies each module to reload the configuration and restart the initialization process; and after loading the configuration, it performs a validity range check on the instrument address and serial communication parameters, and terminates the initialization if the check fails.

[0079] In this embodiment, an SQLITE database can be used for storage, and a corresponding web configuration interface is available. After the DLT645 driver starts, it requests configuration from the configuration module. The configuration module retrieves the corresponding DLT645 driver configuration from the SQLITE database and returns it to the DLT645 driver. When the web configuration interface modifies the DLT645 driver configuration, the configuration module notifies the DLT645 driver that the configuration has changed, and then the DLT645 driver restarts to re-acquire the configuration and complete the initialization. The configuration validity check involves performing a range check on the configuration parameters such as the meter address, serial port baud rate, and data bits after obtaining the configuration. If the parameters are outside the range, the configuration is considered invalid, and the initialization fails.

[0080] The message routing module serves as the internal communication hub of the main service layer. It is used to forward and distribute messages between modules through the DBUS message bus, thereby decoupling between modules. At the same time, it routes the parsed structured data messages to the designated forwarding exit according to the preset forwarding rules, ensuring that the data flow is orderly and controllable.

[0081] As the core data processing unit, the data engine module connects to the protocol driver layer to listen to the raw data stream. It is used to perform frame-level filtering, protocol parsing, concurrent scheduling, cache management, periodic aggregation and time-series storage on the collected data, providing a unified data view for upper-layer applications.

[0082] The data engine module further includes a frame filtering unit, a data parsing unit, and a thread pool scheduling unit. The frame filtering unit performs frame identification, frame verification, address matching, and integrity verification according to the preset meter communication protocol frame structure to filter out valid data frames. The data parsing unit extracts data content segments from the valid data frames and performs decryption, byte order adjustment, and format reorganization according to the protocol to generate meter data. The thread pool scheduling unit dynamically allocates parsing tasks using a preset number of worker threads, automatically expanding the thread pool resources when the parsing load exceeds a threshold. Each unit of the data engine module performs the relevant operations in step S3 above—frame filtering, data parsing, and task scheduling—to achieve the filtering of valid data frames and the generation of meter data.

[0083] Furthermore, in this embodiment, the data engine's caching strategy for DLT645 data is based on a preset cache capacity. When the detection module in the data engine finds that the amount of data exceeds a preset threshold (e.g., 90%) of the cache capacity, it deletes old data until the amount of data is below the threshold. The aggregation rule for the cumulative energy value of DLT645 over a 5-minute period is to align the 5-minute window boundary and calculate the difference between the first and last values ​​of the cumulative value to obtain the periodic energy consumption. The time-series storage of DLT645 data uses the data tags of DLT645 points as the sequence, and the content is the time and value monitored by the point.

[0084] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0085] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this disclosure.

[0086] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein.

[0087] The above are merely specific embodiments of the present invention, but the design concept of the present invention is not limited thereto. Any non-substantial modifications made to the present invention using this concept shall be considered as infringing upon the protection scope of the present invention.

Claims

1. A method for acquiring power data, characterized in that, include: The power meter is connected to the serial communication bus in parallel to achieve non-exclusive monitoring access. Activate passive listening mode to continuously monitor the interactive data stream between the host and the power meter on the serial communication bus; Based on the frame structure of the preset power meter communication protocol, the intercepted interactive data stream is processed by frame identification, frame verification, address matching and integrity verification. Data frames that are not the target meter address and abnormal frames are identified and filtered. After the valid data frames are selected, data parsing processing is performed on the valid data frames. A thread pool scheduling mechanism is used to schedule and execute the parsing task of the valid data frame in real time, and the meter data obtained after data parsing is transmitted to the upper layer application to reduce data processing overhead.

2. The power data acquisition method as described in claim 1, characterized in that, The frame identification is used to locate the start symbol specified by the protocol in the continuous interactive data stream. The frame verification is used to verify the format of the address field and the start symbol according to the protocol frame structure after the start symbol is identified. After the verification is passed, it is determined to be an initial valid data frame and enters the receiving state.

3. The power data acquisition method as described in claim 1, characterized in that, The address matching process involves combining the received power meter addresses into a unified format according to protocol rules and comparing the values ​​with the preset target meter addresses. If the addresses do not match, the current data frames to be filtered are filtered out.

4. The power data acquisition method as described in claim 1, characterized in that, The data parsing process extracts data content segments from valid data frames selected from the intercepted interactive data stream, performs decryption processing and byte order adjustment on the data content segments as agreed in the protocol, and then reassembles the original data into the meter data according to the preset data format table.

5. The power data acquisition method as described in claim 1, characterized in that, The integrity check is performed on the data frames to be screened after frame identification, frame verification and address matching. The check is calculated using a global summation method. If the check does not match, the frame is judged as an abnormal frame and discarded. If the check matches, the frame is included in the valid data frames.

6. The power data acquisition method according to claim 1, characterized in that, The thread pool scheduling mechanism dynamically allocates parsing tasks for valid data frames based on multiple sets of parallel monitored interactive data streams and filtered valid data frames using a preset number of worker threads; when the parsing load of valid data frames in a single data stream exceeds a threshold, the thread pool resources are automatically expanded.

7. A power data acquisition device, characterized in that, include: The protocol driver layer is used to connect to the serial communication bus where the power meter is located in parallel, so as to realize non-exclusive listening access. The passive listening mode is activated to continuously listen to the interactive data stream between the host and the power meter on the serial communication bus, and the interactive data stream is transmitted to the main service layer. The main service layer, which communicates with the protocol driver layer, is used to perform frame identification, frame verification, address matching, and integrity verification on the monitored interactive data stream based on the frame structure of the preset power meter communication protocol. It identifies and filters data frames that are not the target meter address and abnormal frames, and after filtering out the valid data frames, it performs data parsing processing on the valid data frames. At the same time, a thread pool scheduling mechanism is used to schedule and execute the parsing task of the valid data frames in real time to generate meter data. The forwarding application layer communicates with the main service layer to transmit the meter data generated by the main service layer to the upper-layer application, thereby reducing data processing overhead.

8. The power data acquisition device as described in claim 7, characterized in that, include: The main service layer includes: The daemon module is used to monitor the running status of the protocol driver layer and the main service layer. When the acquisition driver exits abnormally, it automatically completes resource reclamation and restarts the driver. When the serial port listening is abnormal, it automatically performs port reopening and listening recovery operations to ensure continuous listening of interactive data streams. The configuration management module is used to store the operational configuration that supports interactive data stream listening, valid data frame filtering, and data parsing using a database. When the configuration changes, it actively notifies each module to reload the configuration and restart the initialization process. After loading the configuration, it performs a validity range check on the instrument address and serial communication parameters. If the check fails, the initialization is terminated. The message routing module is used to forward and distribute messages between modules through the DBUS message bus, thereby decoupling the modules. The data engine module is used to cache, aggregate, store in time series, and perform preliminary analysis on the collected data, providing a unified data view for upper-layer applications.

9. A power data acquisition device as described in claim 8, characterized in that, The data engine module includes a frame filtering unit, a data parsing unit, and a thread pool scheduling unit: the frame filtering unit performs frame identification, frame verification, address matching, and integrity verification to filter out valid data frames; the data parsing unit extracts data content segments from the valid data frames, performs decryption, byte order adjustment, and format reorganization to generate meter data. The thread pool scheduling unit dynamically allocates parsing tasks using a preset number of worker threads, and automatically expands the thread pool resources when the parsing load exceeds the threshold.

10. The power data acquisition device as described in claim 7, characterized in that, The protocol driver layer includes DLT645 driver, IEC101 driver and IEC104 driver, which are used to adapt to different power meter communication protocols and data sources, realize communication connection with industrial equipment, obtain equipment operation data and transmit it to the main service layer; the forwarding application layer includes MQTT forwarding unit, HTTP forwarding unit and TCP forwarding unit, which are used to encapsulate the meter data according to different communication protocols and send it to the external system, and receive external system instructions and forward them to the protocol driver layer.