A stateful measurement load balancing parallel processing and debugging method and power SCADA system
By constructing a feature library and a global receiving circular queue, combined with dynamic balancing optimization logic and a three-level thread architecture, the problems of poor computational consistency, load skew, and low debugging efficiency in the SCADA system were solved, achieving high throughput, reliability, and adaptability to multiple scenarios, thereby improving the stability and ease of operation and maintenance of the power dispatching system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NARI TECH CO LTD
- Filing Date
- 2026-03-23
- Publication Date
- 2026-06-26
Smart Images

Figure CN122285271A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a solution for data processing in power SCADA systems, and more particularly to a method for parallel processing and debugging of stateful measurement load balancing and a power SCADA system. Background Technology
[0002] The power SCADA (Supervisory Control And Data Acquisition) system is a core component of power dispatch automation. It is mainly responsible for the real-time acquisition, processing, storage and monitoring of measurement data such as remote signaling, telemetry, remote control and remote adjustment in the power system, providing reliable data support for power dispatch decisions. Existing SCADA systems suffer from the following core technical pain points in the processing of stateful measurement data: First, poor consistency in stateful calculations. Stateful measurements require joint calculations based on historical and current data. In existing technologies, when processing data in parallel using multiple threads, data from the same measurement point is easily assigned to different threads, leading to the failure of historical data association and deviations in calculation results. Second, thread load skew. Massive measurement data is randomly distributed to processing threads, which can easily result in some threads accumulating data while others are idle, reducing the overall processing throughput. Third, low debugging efficiency. When the system malfunctions, the log output is large and untargeted, requiring maintenance personnel to manually sift through massive amounts of logs to locate abnormal measurement points, resulting in long troubleshooting cycles and a heavy workload. Fourth, insufficient scenario adaptability. Existing systems are mostly designed for centralized deployment architectures, making it difficult to adapt to new power dispatching scenarios where centralized and distributed systems coexist, and resulting in high latency in cross-node data transmission. Fifth, insufficient data acquisition reliability and throughput. Single acquisition channels are prone to failure, leading to data loss. At the same time, the acquisition logic is not optimized, making it difficult to adapt to the high-speed acquisition requirements of massive measurement data.
[0003] The aforementioned problems severely restrict the operational reliability and ease of maintenance of SCADA systems in core scenarios such as power dispatching, equipment monitoring, and fault early warning. They also fail to fully adapt to the technical requirements of the new generation of distributed control architecture. There is an urgent need for an integrated data processing solution that takes into account multi-scenario adaptability, high throughput, state consistency, convenient debugging, load balancing, and intelligent debugging. Summary of the Invention
[0004] Purpose of the invention: To address the above problems, this invention relates to a parallel processing and debugging method for stateful measurement load balancing and a power SCADA system, which can ensure consistency of state calculation, solve thread load imbalance, realize intelligent debugging of anomalies, and provide a stateful measurement data processing and debugging solution that balances high throughput and high reliability.
[0005] Technical Solution: To achieve the above objectives, the technical solution adopted by this invention is a stateful measurement load balancing parallel processing method, comprising:
[0006] Classify stateful quantity measurement types; construct feature libraries for each type of stateful quantity measurement based on time constraints and data association rules.
[0007] Receive serialized measurement data; determine whether the serialized measurement data is a stateful measurement based on the stateful measurement feature library; identify the type of stateful measurement data in the serialized measurement data based on the classification type of stateful measurement; push the stateful measurement data to the global receiving circular queue; the global receiving circular queue is a circular queue used globally.
[0008] Based on the type of stateful measurement data, the appropriate dynamic equilibrium optimization logic is selected, and the stateful measurement data in the global receiving circular queue is scheduled to different processing threads for processing. The processing includes: maintaining an independent time window for each stateful measurement in shared memory; reading the unique identifier code ID of the stateful measurement, and checking whether there is historical data with the same ID in the time window; if there is and it is within the valid time window, combining the historical stateful measurement value with the current stateful measurement value to complete the joint calculation, and deleting the historical data after the calculation is completed; if there is but it is outside the valid time window, the historical data is directly deleted; if not, the current stateful measurement value is stored in the time window, waiting for subsequent joint calculation.
[0009] The step of selecting the appropriate dynamic equilibrium optimization logic based on the type of stateful measurement data includes:
[0010] For stateful measurement types with multiple frequency of the same switch, maintain a thread allocation hash table. If the difference between the current timestamp and the last allocation time does not exceed the delay time, it is determined to be assigned to the original thread. If it exceeds the delay time, the load balancing algorithm is triggered to perform the allocation.
[0011] For protection-switch joint calculation with state measurement type, the protection action signal is broadcast to all processing threads. The main processing thread is preset to perform protection signal table write operation. After the main thread updates the process-level cache, each thread achieves synchronization through atomic operations.
[0012] The load balancing algorithm includes: calculating thread load values based on the number of queues, queue capacity, and CPU utilization; filtering idle threads based on each thread load value, prioritizing the thread with the lowest load to process stateful measurement data; if there are no idle threads, selecting low-load threads, where the low-load thread is the thread whose remaining cache queue capacity is not lower than a set value; and performing load calibration and updating the mapping table within a set time.
[0013] The state measurement types include state measurement types with multiple frequencies of the same switch and state measurement types calculated jointly by protection and switch. The state measurement types calculated jointly by multiple frequencies of the same switch include two-position switches and three-phase switches. The state measurement types calculated jointly by protection and switch include protection switches calculated jointly by protection actions and switch signals.
[0014] The global receiving circular queue is processed based on a three-level thread architecture. The three-level thread architecture includes a single-threaded asynchronous measurement receiving thread, a measurement distribution thread, and multiple configurable measurement processing threads. Each measurement processing thread is bound to an independent cache queue. The measurement distribution thread adopts a distributed architecture or a centralized architecture, including: in a distributed architecture, the measurement data is distributed to the corresponding sharding process processing thread according to the plant ID or region ID based on sharding rules; in a centralized architecture, the processing capacity is improved by optimizing thread cache allocation.
[0015] The stateful measurement feature library uses a structured hash table, including two types:
[0016] Hash table for multi-frequency stateful measurement features of the same switch: the key is the unique identifier ID of the switch, and the value is a tuple of switch features, including the switch type and delay time;
[0017] The protection-switch joint calculation uses a state measurement feature database hash table: a bidirectional mapping dual hash table is used, including a protection dimension hash table and a switch dimension hash table; the key of the protection dimension hash table is the unique identifier ID of the protection device, and the value is the set of protection-related features; the key of the switch dimension hash table is the unique identifier ID of the switch, and the value is the set of switch-assigned features.
[0018] After identifying the type of stateful measurement data, a dedicated identifier field is injected into the stateful measurement. The dedicated identifier field includes a stateful identifier bit, a stateful type code, and an associated feature extension field.
[0019] This invention provides a stateful measurement and debugging method, comprising:
[0020] Classify stateful quantity measurement types; construct feature libraries for each type of stateful quantity measurement based on time constraints and data association rules.
[0021] Receive serialized measurement data; determine whether the serialized measurement data is a stateful measurement based on the stateful measurement feature library; identify the type of stateful measurement data in the serialized measurement data based on the classification type of stateful measurement; push the stateful measurement data to the global receiving circular queue; the global receiving circular queue is a circular queue used globally.
[0022] Based on the type of stateful measurement data, select the appropriate dynamic equilibrium optimization logic to schedule the stateful measurement data in the global receiving circular queue to different processing threads for processing.
[0023] Hook programs are embedded in each stage of the stateful measurement data processing flow. When an error occurs in the stateful measurement data processing, the hook program automatically updates the error count of the corresponding stage in the hook tracking register. When the error count of each business stage reaches the preset threshold, the corresponding business log output is automatically triggered.
[0024] A three-layer register model is adopted for log management, which includes a log master switch register, a bit-by-bit control switch register, and a measurement point set register.
[0025] The present invention also provides a power SCADA system, the system comprising:
[0026] The module for classifying and defining the types of stateful measurements is used to: classify the types of stateful measurements; and construct a feature library for each type of stateful measurement based on the time constraints and data association rules of each type of stateful measurement.
[0027] The multimodal measurement acquisition module is used for: receiving serialized measurement data; determining whether the serialized measurement data is a stateful measurement based on the stateful measurement feature library; identifying the type of stateful measurement data in the serialized measurement data based on the classification type of stateful measurement; and pushing the stateful measurement data to a global receiving circular queue; wherein the global receiving circular queue is a circular queue used globally.
[0028] The multi-threaded measurement balancing and scheduling module is used to: select the appropriate dynamic balancing optimization logic according to the type of stateful measurement data, and schedule the stateful measurement data in the global receiving circular queue to different processing threads;
[0029] The measurement data processing module is used to process and store stateful measurement data;
[0030] The indicator acquisition and alarm processing module is used to: collect abnormal indicators of the system and measurement in real time and trigger hierarchical alarms;
[0031] The intelligent debugging module for measurement point clustering is used to: embed hook programs into each stage of the stateful measurement data processing flow; when an error occurs in the stateful measurement data processing, the hook program automatically updates the error count of the corresponding stage in the hook embedding register; when the error count of each business stage reaches the preset threshold, the corresponding business log output is automatically triggered.
[0032] The system also includes an architecture identification module, which is used to: obtain the deployment mode and sharding parameters by calling the system management-level task scheduling process API interface or reading the deployment configuration information written to shared memory, push adaptation instructions to the multi-threaded measurement balance scheduling module and the measurement data processing module, and execute the corresponding adaptation operations.
[0033] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:
[0034] 1. Enhanced State Consistency and Load Balancing: Through a global thread mapping and binding algorithm and a dynamic load balancing scheduling algorithm, the system ensures consistent processing within the state measurement time window, avoids state calculation disorder, and dynamically adjusts thread load to keep load deviation within 20%, thereby improving the efficiency of parallel processing of massive data and solving the pain points of load skew and state inconsistency in traditional scheduling.
[0035] 2. Significantly improved debugging and maintenance efficiency: Based on the shared memory three-layer register model and hook tracking mechanism, it realizes adaptive capture of abnormal logs and full-link targeted tracing of test points, replacing manual log screening and shortening the fault location cycle from hours to minutes. At the same time, through visual management and control, it reduces the operation difficulty for maintenance personnel and solves the problem of difficult fault debugging in distributed architecture.
[0036] 3. Strong adaptability to multiple scenarios: It is compatible with traditional centralized and new-generation distributed SCADA architectures. Through dynamic distribution strategies and adaptive optimization of the architecture (optional), it can flexibly adapt to different power dispatching scenarios, especially the high throughput requirements of centralized architecture in international business, and solve the problem of poor scenario adaptability of existing solutions.
[0037] 4. Improved data processing reliability and security: Through mechanisms such as active-active master-slave setup, breakpoint resume, dual-database linked storage, and distributed cache fault tolerance (optional), measurement data is ensured to be unlost and stored reliably; combined with log anonymization and access control (optional), the security of sensitive data is strengthened, and hierarchical alarms enable rapid response to system anomalies.
[0038] 5. Resource utilization optimization: The system adopts O(1) time complexity hash table operation and atomic operation synchronization technology to reduce data processing delay; through back pressure logic and cache cleanup mechanism, the system resources are reasonably managed to avoid resource waste, and high throughput and low resource consumption are taken into account to meet the performance requirements of power system nodes.
[0039] This invention enables real-time acquisition, scheduling, processing, and intelligent operation and maintenance debugging of massive amounts of power measurement data, improving the real-time performance and reliability of power dispatching systems. This invention breaks through the supporting technology of a new type of flexible business processing architecture for control systems, achieving efficient acquisition, balanced scheduling, accurate processing, and intelligent debugging of stateful measurement data. It promotes the development of SCADA systems towards higher efficiency, intelligence, and ease of operation and maintenance, providing reliable support for the stable operation of power dispatching systems. This invention is applicable to various power control data processing architectures, including next-generation centralized and distributed data processing scenarios, and can be widely adapted to various power dispatching application scenarios, from traditional master / standby systems to next-generation distributed control architectures. Attached Figure Description
[0040] Figure 1 This is a schematic diagram of the overall architecture of the present invention;
[0041] Figure 2 This is a schematic diagram of the stateful measurement and debugging process described in this invention;
[0042] Figure 3 This is a visual schematic diagram of the state measurement and debugging of the power SCADA system of the present invention. Detailed Implementation
[0043] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0044] Example 1:
[0045] The parallel processing method for load balancing of stateful measurements described in this invention classifies stateful measurement types; and constructs a feature library for each type of stateful measurement based on the time constraints and data association rules of each type of stateful measurement.
[0046] Receive serialized measurement data; determine whether the serialized measurement data is a stateful measurement based on the stateful measurement feature library; identify the type of stateful measurement data in the serialized measurement data based on the classification type of stateful measurement; push the stateful measurement data to the global receiving circular queue; the global receiving circular queue is a circular queue used globally.
[0047] Based on the type of stateful measurement data, the appropriate dynamic equilibrium optimization logic is selected, and the stateful measurement data in the global receiving circular queue is scheduled to different processing threads for processing. The processing includes: maintaining an independent time window for each stateful measurement in shared memory; reading the unique identifier code ID of the stateful measurement, and checking whether there is historical data with the same ID in the time window; if there is and it is within the valid time window, combining the historical stateful measurement value with the current stateful measurement value to complete the joint calculation, and deleting the historical data after the calculation is completed; if there is but it is outside the valid time window, the historical data is directly deleted; if not, the current value is stored in the time window, waiting for subsequent joint calculation.
[0048] The specific execution steps are as follows:
[0049] S1, Classification and Constraint Definition of Stateful Measurement Types: Responsible for classifying stateful measurement types, defining feature constraints and configuring rules, providing a unified basis for judgment for subsequent acquisition, scheduling and processing modules.
[0050] This step precisely categorizes stateful measurement calculation scenarios in power systems, clarifying the time constraints and data association rules for each scenario, thus providing a foundation for architecture design. This includes joint calculation of multi-frequency measurement data from the same switch and joint calculation of protection actions and switch signals, among which:
[0051] The first category involves joint calculation of multiple measurement data from the same switch. The core constraint is "processing data from the same switch from the same source within a time window." Joint calculation requires collecting measurement data from the same switch two or more times within a preset effective time period. Typical application scenarios and constraints are as follows:
[0052] (1) Remote signaling calculation of two-position switch (including positive and negative position signals and delay time): The default value of the "two-position delay time" configured in the binding device table is 3s (can be customized). It is necessary to receive the change signals of the main and auxiliary contacts within this time window to trigger normal or abnormal change alarm.
[0053] (2) Three-phase switch (three-phase switch A / B / C phase signals, delay time) displacement calculation: The default three-phase delay time is 3s (can be customized). Within this time window, the received three single-phase signals need to be fitted and processed to update the calculated three-phase switch status or corresponding measurement value.
[0054] The second type is the joint calculation of protection action and switch signal. The core constraint is that "the protection signal is reachable in all threads and the protection signal is uniquely written to the database in a single thread". Since the same protection can be associated with multiple switches, and different switches may be assigned to different threads for processing, it is required that the protection signal is reachable in all threads. The switch signal must associate the protection action signal with the corresponding switch signal within the protection delay time to trigger the protection type alarm.
[0055] Furthermore, specifically for the second category, to ensure the accuracy of the calculations relating protection and switches, a separate protection signal table is constructed, with its core attributes and types shown in Table 1:
[0056] Table 1 Protection Signal Table
[0057]
[0058] S2, Multimodal Measurement Acquisition: Receives serialized measurement data forwarded by the front-end subsystem, completes deserialization and exchanges entity identifier injection, and achieves accurate classification of stateful / stateless measurements.
[0059] This step involves embedding stateful measurement feature rules into the SCADA acquisition module, collecting and identifying measurement data, and assigning unique tags to stateful measurements. The tagging information is then appended to the data packet and pushed to the scheduling module (data receiving thread queue) along with the raw data. This includes: constructing a stateful measurement feature library, measurement acquisition parsing and type identification, and stateful measurement type verification and tagging. Specifically, it includes the following:
[0060] S2.1 Stateful measurement feature library.
[0061] The stateful measurement feature library is constructed based on the constraint definition obtained from S1. It uses a structured hash table to achieve read and write operations with O(1) time complexity. It is divided into two categories: the same switch type measurement feature library and the protection associated switch type feature library. The specific definitions are as follows:
[0062] (1) Hash table of the same switch type measurement feature library:
[0063] Key: A unique identifier for the switch (identified by the measurement ID in the forwarding message);
[0064] Value: A switch-type feature tuple containing: a. Switch type: an enumerated value (two-position switch, three-phase switch), providing a type basis for identifier injection; b. Delay time: an integer (unit: seconds), providing a core parameter for stateful calculations in the scheduling module.
[0065] (2) Hash table for protection of associated switch type feature library: A bidirectional mapping double hash table design is adopted, defined as follows:
[0066] a. Protected dimension hash table:
[0067] Key: A unique identifier (ID) for the protection device;
[0068] Value: Protection associated feature set (list type). Each element in the set contains: associated switch ID, incident delay time (seconds), status change timestamp, measurement value, and data quality code.
[0069] b. Switch dimension hash table:
[0070] Key: A unique identifier for the switch;
[0071] Value: A set of switch attribution characteristics (list type). Each element in the set contains: measurement value, data quality code, and the ID of the protection device to which it belongs.
[0072] The initialization of the stateful measurement feature library is scheduled by the main thread of the program. The update is specified by an asynchronous thread that subscribes to the rule update. After the update, it is synchronized to the measurement data receiving thread (in the measurement acquisition module cache) by a C++ Move action (O(1) time complexity).
[0073] S2.2 Measurement Acquisition Analysis and Type Identification.
[0074] Measurement acquisition, parsing, and type identification include: measurement receiving thread definition, remote signaling / telemetry data packet parsing, and structured data unpacking and parsing.
[0075] The measurement receiving thread is a unique and fixed measurement receiving thread initialized and created by the main program during the program startup phase. This thread runs with the life cycle of the main program to avoid multi-threaded acquisition competition and data reception disorder, and to ensure the orderliness of message reception.
[0076] The data packet parsing process is as follows: First, the packet header is checked. The receiving thread collects the serialized measurement packets forwarded by the front-end subsystem through the dedicated channel. First, the byte length attribute of the measurement packet header is checked. If the byte length attribute of the packet header is less than or equal to the predefined number of packet header bytes, or if the packet header byte length identifier is incorrect, it is determined to be an invalid data packet. Then, the type is parsed. According to the data type of the packet header, 1 indicates that the current packet is remote signaling, and 2 indicates that the current packet is telemetry.
[0077] The structured data packet unpacking and parsing process is as follows: The receiving thread has built-in remote signaling and telemetry differentiated parsing logic. For serialized packets forwarded by the front-end subsystem, a pre-compiled deserializer is called to convert the binary packets into standardized remote signaling and telemetry data structures. If the number of data entries in the packet header does not match the actual number of data entries parsed, it is determined to be an abnormal data packet and discarded.
[0078] The main attributes of the remote signaling standard data structure are: remote signaling unique identifier, remote signaling value, and timestamp;
[0079] Key attributes of standard telemetry data structure: unique telemetry identifier, telemetry value, and timestamp;
[0080] After parsing, the remote signaling and telemetry data are uniformly encapsulated into a standardized SCADA raw data structure, realizing the format normalization of different types of measurement data.
[0081] S2.3 Measurement, acquisition, identification, analysis, and labeling.
[0082] Measurement acquisition, identification, parsing, and labeling involves determining the stateful measurement type based on high-speed hash matching from a feature database, then labeling the identified stateful measurements, and finally inserting the labeled measurement data into a global receiving circular queue. This includes:
[0083] S2.3.1 Determination of stateful measurement type: Remote signaling data is preferentially matched with the same switch type feature library. If the match is successful, it is determined to be a switch type stateful measurement; if the match fails, it is matched with the protection-related switch type double hash table (protection / switch dimension) and determined to be a protection-related switch type measurement; telemetry data or remote signaling data that fails to match is determined to be a stateless measurement.
[0084] S2.3.2 Dedicated Identifier Injection Marker: Inject three types of dedicated identifier fields into the judgment result (only effective within SCADA): a. Status Identifier Bit (bool type, distinguishing between present / no status); b. Status Type Code (int type, distinguishing between two-position switch / three-phase switch / protection associated switch type); c. Associated Feature Extended Field (long integer type, storing delay time or associated feature index).
[0085] S2.3.4 will insert the marked measurement data units into the global receive circular queue (with a fixed capacity, such as millions of data units) through the atomic enqueue interface; when the queue is full, the back pressure logic will be triggered to suspend the reception of message data from the front-end subsystem until the queue capacity is released, ensuring that the system data processing load is controllable.
[0086] S3, Multi-threaded Measurement Balancing Scheduling: Based on the identifier field injected by the acquisition module, a stateful load balancing algorithm is used to distribute stateful measurement data to dedicated processing threads, avoiding cross-thread state disorder and realizing parallel scheduling of massive data.
[0087] This step takes over the global receiving circular queue of S2 measurement acquisition. On the basis of the three-level thread architecture of "receiving, distributing and processing", it achieves the coordinated guarantee of "state consistency and load balancing" of stateful measurement through hierarchical scheduling algorithm and dynamic load balancing optimization, which is suitable for the parallel processing requirements of massive measurement data of power SCADA.
[0088] S3.1 is a multi-threaded measurement processing system based on a three-level thread architecture.
[0089] The power SCADA multi-threaded measurement processing infrastructure provides underlying support for the scheduling module. As the core foundation for multi-threaded scheduling, it constructs a three-level thread architecture of "receiving, distributing, and processing," adapting to the characteristics of power scenario measurement data processing. It performs flow and scheduling based on stateful / stateless measurement data after S2 measurement acquisition and marking.
[0090] Measurement receiving thread: Single-threaded asynchronous operation, using a blocking receiving mechanism optimized for power scenarios, subscribing to measurement data from the message queue; the receiving thread is bound to the S2 measurement acquisition global receiving circular queue, which has a fixed capacity (when the queue is full, back pressure logic is triggered to pause data reception), ensuring the orderly reception of data.
[0091] Measurement distribution thread: Runs asynchronously in a single thread. It subscribes to data from the global receiving loop queue of S2 measurement acquisition, completes the identification and marking of stateful measurements, and distributes the measurement data to the independent cache queues bound to each data processing thread according to the algorithm rules by supporting power scenario-specific distribution algorithms. It is the core distribution entry point of the scheduling module.
[0092] Measurement processing threads: N configurable processing threads are preset (N=4-32, adapted to the performance of power system nodes, set at startup). Each thread is bound to an independent cache queue (capacity of thousands of entries). The thread integrates power system measurement calculation logic (ordinary measurement, two-position switch change judgment, three-phase switch signal verification, protection-switch joint matching, etc.) and continuously polls its own bound cache queue to execute the specific processing logic of the measurement data.
[0093] S3.2 Basic Distribution Algorithm.
[0094] The measurement distribution thread has two built-in basic distribution algorithms. Based on the stateful measurement type code, measurement ID and other identification fields injected by S2 measurement acquisition, the distribution logic is executed to adapt to different power business scenarios:
[0095] (1) Calculate and distribute the thread ID based on the measurement ID hash value. The protection action signal is distributed to all processing threads using a broadcast mechanism to meet the scenario requirement of "one protection associated with multiple switching devices".
[0096] (2) Distribution algorithm based on plant ID hash: The protection action signal and the associated switch measurement signal are assigned to the same processing thread by default, which is suitable for the closed-loop processing business scenario of plant-level measurement data.
[0097] S3.3 Innovative optimization of parallel scheduling with stateful measurement balance.
[0098] The innovative optimization of balanced parallel scheduling for stateful measurements is based on the distribution algorithm of the basic architecture. For the two core types of stateful measurements (switch type and protection-related switch type) acquired and judged by S2 measurement, dynamic balanced scheduling and distribution logic is designed to solve the thread load deviation problem caused by fixed algorithms in extreme scenarios. It provides refined optimization for two types of stateful measurement scenarios:
[0099] The first category is the scheduling logic for stateful measurements of multiple switches with the same frequency. It is used for stateful measurement data of switch types with S2 measurement acquisition type code 1 / 2 to ensure the consistency of the switch state within the measurement time window, while also achieving thread load balancing.
[0100] 1) Construct a thread allocation hash table: Maintain the thread allocation mapping relationship of the measurement in memory. The key is the switch measurement ID and the value is a four-tuple (last allocated thread PID (INT type), last allocated time (millisecond-level timestamp), delay time (INT type, ms), current thread load (INT type, 0-100)).
[0101] 2) Dynamic thread allocation determination:
[0102] After the data distribution thread obtains the switch measurement data, it queries the mapping table to extract the last allocated time.
[0103] If the current timestamp - last allocation time ≤ delay time, distribute to the original thread and update the load value to ensure state consistency within the time window;
[0104] If the current timestamp - last allocation time > delay time, trigger the load balancing algorithm:
[0105] 1) Calculate thread load (Formula: Load = (Number of queues / Capacity) × 60 + (CPU utilization) × 40, adapted to the characteristics of power thread resource consumption).
[0106] 2) Filter idle threads with a load of <60, prioritizing the thread with the lowest load; if there are no idle threads, select low-load threads with a remaining cache queue capacity of ≥20%;
[0107] 3) Distribute data and update the mapping table, perform load calibration every 100ms, and keep the thread load deviation within 20%.
[0108] The second category is the protection-switch joint calculation with state measurement scheduling logic, which is used for protection-associated switch type state measurement data with S2 measurement acquisition type code 3 to ensure the data consistency and real-time performance of protection-switch association calculation.
[0109] 1) Protection signal distribution rules: The protection action signal is broadcast to all processing threads, and a two-level buffering mechanism is used to ensure that each thread obtains the complete protection signal;
[0110] 2) Write conflict avoidance: The main processing thread (thread ID=0) is preset, and only this thread is allowed to perform write operations to the protection signal table. Other threads send updated data to the main thread message queue, and the main thread will uniformly enter the data into the database.
[0111] 3) Cache synchronization and coordination: After the main thread updates the process-level cache, each thread synchronizes incremental data through the encapsulated atomic operation std::move, with a synchronization delay of ≤2ms, ensuring the timeliness of joint computation.
[0112] Measurement data distribution involves distributing the measurement data to the cache queue bound to the data processing thread, where the data processing thread executes the specific measurement processing logic.
[0113] S3.4 architecture adaptation and scheduling optimization.
[0114] The system receives adaptation instructions pushed by the architecture identification module and combines them with deployment configurations issued by the task scheduling process to perform differentiated scheduling optimizations: In a distributed architecture, measurement data is distributed to the processing threads of the corresponding sharding process based on the plant ID or region ID according to the sharding rules, and optimized into a regional distribution algorithm to reduce cross-node data transmission latency; In a centralized architecture, the thread cache allocation strategy is optimized to improve the high throughput processing capability of a single node and form a synergy with the storage mode after architecture adaptation.
[0115] S4, Measurement Data Processing: Integrates four major functions: reasonable number verification, routine measurement processing, stateful measurement processing, and dual-database linked storage, to complete the entire process of measurement data verification, calculation, and storage.
[0116] This step follows the processing chain of S3 multi-threaded stateful load balancing scheduling. It sequentially performs reasonable number verification, routine measurement processing, stateful measurement processing, and dual-database linked storage on the measurement data that is scheduled and distributed to the cache queues of each processing thread.
[0117] S4.1 Measurement Reasonableness Verification: Establish a measurement information table to provide a basis for data verification, perform upper and lower limit validity checks on uploaded measurement data, and trigger alarms for out-of-range data. Specific implementation:
[0118] (1) Construct a measurement information table and configure reasonable upper and lower limit verification parameters for each measurement ID;
[0119] (2) Match the parameters in the information table according to the measurement ID to determine whether the uploaded measurement data is within a reasonable upper and lower limit range;
[0120] (3) If the data is out of range, a measurement over-limit alarm will be triggered; if the reasonable upper and lower limits are both 0, skip this step of verification and enter the data quality verification step.
[0121] S4.2 Data Quality Verification: Obtain the data quality code of the measurement in the real-time database, and perform data verification in combination with the collected measurement data quality code. Measurements that fail the quality code verification are discarded or alarmed according to the business level.
[0122] S4.3 Stateful Measurement Processing: Based on the stateful measurement flag injected into the measurement data structure in S2.3, it determines whether the current measurement is stateful or stateless. Stateless measurements directly proceed to the data quality calculation stage, while stateful measurements are processed according to the following procedure.
[0123] (1) Maintain an independent time window for each stateful measurement in shared memory to store associated historical measurement information.
[0124] (2) Read the status flag bit of the data packet to determine whether the current measurement data is stateful measurement data;
[0125] (3) For stateful measurement data, check whether there is historical measurement data with the same ID in the corresponding time window, and determine whether the historical data time and the current time are in the same valid time window.
[0126] If historical data with the same ID exists and is within a valid time window, the association between the historical measurement value and the current value is determined to provide a data basis for subsequent calculations. After the determination is completed, the corresponding measurement data or associated data within the time window is deleted.
[0127] If there is historical data with the same ID but it is outside the valid time window, delete the associated historical measurement data directly.
[0128] For measurements without historical data for the same ID, the current measurement value is recorded in the corresponding stateful measurement time window, awaiting joint calculation of subsequent measurements.
[0129] (4) When each batch of threads processes data, a unified cleanup is performed on all stateful measurement time windows in the shared memory.
[0130] S4.4 Data quality calculation is based on the results of previous verification and processing, and completes the final validity calculation of measurement data to determine the valid measurement values that can be stored.
[0131] For non-state measurement data, based on the original data and quality verification results, complete basic calculations such as data quality coefficient and validity label to determine the final valid measurement value;
[0132] For stateful measurement data, combined with the previous correlation judgment results, the historical measurement values and the current value are jointly calculated to complete operations such as change judgment, signal verification, protection-switch joint matching, etc., and to determine the final valid measurement value.
[0133] All measurement data are labeled with corresponding data quality attributes according to the calculation results, serving as the sole data source for dual-database linked storage.
[0134] S4.5 dual-database linked storage adopts a dual-database architecture of real-time database + relational database, implements differentiated storage strategies for remote signaling and telemetry data, and completes data storage based on the effective measurement values calculated in the preceding sequence.
[0135] Remote signaling data is synchronously written to the real-time database and relational database to meet the real-time monitoring and rapid query requirements of the SCADA system, while also enabling long-term archiving to support subsequent fault tracing and analysis.
[0136] Telemetry data is written only to the real-time database, and the latest valid measurement values are stored using an overwrite update method to ensure data processing and read / write efficiency and meet the real-time application requirements of the system.
[0137] The entire data writing process follows the SCADA system storage specifications to ensure data integrity and consistency, and to ensure that the writing results are traceable and verifiable.
[0138] Example 2:
[0139] The flowchart of the stateful measurement and debugging method described in this invention is as follows: Figure 2 As shown, based on Example 1, the key innovations added are in intelligent debugging of measurement point clustering and log management, including:
[0140] Classify stateful quantity measurement types; construct feature libraries for each type of stateful quantity measurement based on time constraints and data association rules.
[0141] Receive serialized measurement data; determine whether the serialized measurement data is a stateful measurement based on the stateful measurement feature library; identify the type of stateful measurement data in the serialized measurement data based on the classification type of stateful measurement; push the stateful measurement data to the global receiving circular queue; the global receiving circular queue is a circular queue used globally.
[0142] Based on the type of stateful measurement data, select the appropriate dynamic equilibrium optimization logic to schedule the stateful measurement data in the global receiving circular queue to different processing threads for processing.
[0143] Hook programs are embedded in each stage of the stateful measurement data processing flow. When an error occurs in the stateful measurement data processing, the hook program automatically updates the error count of the corresponding stage in the hook tracking register. When the error count of each business stage reaches the preset threshold, the corresponding business log output is automatically triggered.
[0144] The specific steps S1 to S4 are the same as in Example 1. The specific steps of S5 and S6 are as follows:
[0145] S5, indicator collection and alarm processing.
[0146] The metric acquisition mode requires collecting the usage and backlog of message queues in the measurement receiving thread queue and the usage and backlog of message queues in each measurement processing thread. When the queues continue to accumulate and gradually increase to a certain level, an alarm will be sent to the alarm processing module message queue. At the same time, the number of received measurements will be collected, and the number of measurements processed will be accumulated in the data processing thread to ensure that measurement data is not lost.
[0147] The alarm processing thread is dedicated to handling alarms in the alarm module's message queue. Based on the alarm type and alarm status, it assembles alarm entities and sends them to the message bus, where they are stored in the relational database.
[0148] S6 Measurement Point Clustering Intelligent Debugging
[0149] A visual diagram illustrating the state measurement and commissioning of a power SCADA system is shown below. Figure 3 As shown. S6 test point clustering intelligent debugging is based on shared memory and features "multi-dimensional precise log control + anomaly adaptive triggering + secure storage optimization". The core architecture adopts a dual control approach of "horizontal allocation of switch positions according to business type" and "vertical clustering of logs according to test points". Through multi-unit collaborative linkage, it achieves refined, efficient and secure log debugging, specifically including the following technical units:
[0150] S6.1 multi-dimensional log management register modeling, based on shared memory to build a three-layer register model, to achieve hierarchical and precise control of log output:
[0151] Log master switch register: It adopts a BOOL type variable as the master control switch for all business logs. When the value is 1, the output of all logs is enabled, and when the value is 0, the output of all business logs is disabled, so as to realize the global start and stop control of logs.
[0152] Bit-by-bit control switch register: Using INT type variables, a one-to-one mapping relationship is constructed between bits and business scenario logs. Each bit independently controls the output of a type of business scenario log (when the value is 1, the corresponding business log is enabled; when the value is 0, it is disabled). Different business scenario logs are identified and distinguished by exclusive keywords.
[0153] Measurement point set register: Uses a string set type variable to store the target measurement point ID set. Combined with the log master switch register, it realizes the composite control of "global start / stop + ID-oriented filtering". After triggering, it automatically clusters and outputs the associated logs of the target measurement point ID in the entire process of collection, distribution and processing and all business links, realizing the targeted traceability of single measurement point full-link logs.
[0154] The S6.2 log anomaly adaptive triggering mechanism, based on shared memory hook tracking technology, constructs an automated triggering chain of "fault tracking - threshold judgment - switch linkage," achieving accurate capture of anomaly logs without manual intervention.
[0155] Hook tracking register creation: Hook tracking registers are built based on shared memory, dividing the distribution network telemetry data processing flow into N key business stages. The registers record the number of measurement data errors during the operation of each stage.
[0156] Runtime hook placement: Hook programs are embedded in the SCADA system data processing flow. When errors occur in measurement data processing or system failures occur, the hook programs automatically update the hook placement register values of the corresponding business stage to achieve real-time recording of fault information.
[0157] Register association initialization: Preset the mapping association between multi-dimensional log control registers and hook tracking registers, and clarify the linkage rules between faults and corresponding bit logs at different business stages;
[0158] Threshold-linked control: The SCADA system hook program reads the hook point register value in real time. When the number of errors in a certain stage reaches the preset threshold, it automatically triggers the bit-by-bit control switch register of the corresponding business type and enables the output of the target business log. At the same time, through the keyword filtering mechanism, the abnormal log is directed to the analysis log file to achieve accurate extraction of fault logs.
[0159] Log storage optimization: Configure an intelligent log cleanup mechanism to automatically delete compressed log files and release system storage resources when debugging tasks are completed or when the log storage time exceeds the preset threshold (7 days by default, configurable on demand).
[0160] The S6.3 Visual Debugging and Control Unit features a lightweight debugging and control view that intuitively displays the status (on / off) of each bit in the bit-by-bit control switch register and the log output frequency at each hook stage. It supports operations and maintenance personnel to manually trigger / forcefully disable target bit switches, configure abnormal trigger thresholds, and other operations, enabling flexible switching between manual intervention and automatic control.
[0161] S6.4, building upon log management and output, introduces a dual mechanism of log anonymization and access control to enhance data security during debugging. In the log anonymization phase, sensitive measurement data (such as core equipment measurement thresholds and equipment parameters) and confidential information related to protection actions (such as protection policies and action thresholds) are encrypted using an anonymization algorithm to hide key sensitive fields, retaining only non-sensitive debugging information. In the access control phase, log access permissions are tiered, divided into administrator permissions, maintenance permissions, and browsing permissions. Different permissions correspond to different log viewing and operation scopes. Administrators can configure permission allocations, and maintenance personnel can only view logs within their assigned area, prohibiting unauthorized access, thus balancing debugging convenience with data security.
[0162] Example 3:
[0163] The power SCADA system described in this invention is based on six core modules and works collaboratively along a chain of "type definition - data acquisition - balanced scheduling - data processing - indicator alarm - intelligent debugging". The system includes:
[0164] The module for classifying and defining the types of stateful measurements is used for type definition: classifying stateful measurement types; and constructing a feature library for each type of stateful measurement based on the time constraints and data association rules of each type of stateful measurement.
[0165] The multimodal measurement acquisition module is used for data acquisition: receiving serialized measurement data; determining whether the serialized measurement data is a stateful measurement based on the stateful measurement feature library; identifying the type of stateful measurement data in the serialized measurement data based on the classification type of stateful measurement; and pushing the stateful measurement data to the global receiving circular queue; the global receiving circular queue is a circular queue used globally.
[0166] The multi-threaded measurement balancing and scheduling module is used for balancing scheduling: it selects the appropriate dynamic balancing optimization logic according to the type of stateful measurement data and schedules the stateful measurement data in the global receiving circular queue to different processing threads.
[0167] The measurement data processing module is used for data processing, processing and storing stateful measurement data;
[0168] The indicator acquisition and alarm processing module is used for indicator alarms: real-time acquisition of abnormal indicators in the system and measurement, triggering hierarchical alarms;
[0169] The measurement point clustering intelligent debugging module is used for intelligent debugging: hook programs are embedded in each stage of the stateful measurement data processing flow. When an error occurs in the stateful measurement data processing, the hook program automatically updates the error count of the corresponding stage in the hook embedding register; when the error count of each business stage reaches the preset threshold, the corresponding business log output is automatically triggered.
[0170] The system also includes an architecture identification module, which is used to: obtain the deployment mode and sharding parameters by calling the system management-level task scheduling process API interface or reading the deployment configuration information written to shared memory, push adaptation instructions to the multi-threaded measurement balance scheduling module and the measurement data processing module, and execute the corresponding adaptation operations.
[0171] The specific implementation details of each module are as follows:
[0172] 1. A module for classifying stateful measurement types and defining constraints.
[0173] This module is the system's foundational layer. Its core function is to classify stateful measurements, configure constraint rules, and build and update the feature library. This provides a unified basis for subsequent acquisition, scheduling, and processing modules. Specific implementation steps are as follows:
[0174] (1) Classification of types: Two core state measurement types are defined. The first type is the joint calculation of multiple frequency measurement data of the same switch, which includes two sub-types: two-position switch and three-phase switch. The second type is the joint calculation of protection action and switch signal. The two types correspond to type codes 1 (two-position switch), 2 (three-phase switch), and 3 (protection associated switch type) in the subsequent identification injection.
[0175] (2) Constraint configuration: The system configuration file presets the time constraints of various stateful measurements. The default delay time for two-position switches and three-phase switches is 3s, and it can be customized within the range of 1-10s through the system configuration interface. The default fault delay time for protection-switch joint calculation is 5s. Thread ID=0 is designated as the main processing thread, which is specifically responsible for writing the protection signal table to the database.
[0176] (3) Feature library construction: The feature library is constructed using a structured hash table to achieve read and write operations with O(1) time complexity; the key of the same type of switch measurement feature library is a 64-bit long integer switch unique identifier ID, and the value is a tuple of switch type (enumerated value) and delay time (integer); the protection-related switch type feature library adopts a bidirectional mapping double hash table. The key of the protection dimension hash table is the protection device ID, and the value is the associated switch ID, accident delay time and other feature set. The key of the switch dimension hash table is the switch ID, and the value is the protection device ID and other feature set.
[0177] (4) Feature library update: The feature library is initialized by the main thread of the program, an independent asynchronous update thread is started, and the system configuration update message is subscribed. When the constraint rules or feature information are adjusted, the updated content is synchronized to the cache of the measurement and acquisition module through the C++ Move action to avoid the update process affecting the data acquisition efficiency.
[0178] 2. Multimodal measurement and acquisition module.
[0179] The connection relationship between the multimodal measurement acquisition module and the global receiving circular queue is as follows: Figure 1 As shown, the core of this module is used to receive, parse, identify, and inject identifiers for measurement data, ensuring the reliability of data transmission. Specific implementation steps are as follows:
[0180] (1) Thread initialization: When the program starts, the main program creates a unique measurement receiving thread, adopts a single-threaded asynchronous running mode, binds a dedicated receiving channel, and runs synchronously with the life cycle of the main program to avoid data disorder caused by multi-threaded acquisition competition.
[0181] (2) Data packet parsing: When receiving serialized measurement packets forwarded by the front-end subsystem, the packet header is first checked. The default packet header length is 8 bytes. If the length of the received packet header is less than 8 bytes or the first 2 bytes of the packet header are incorrect, it is directly judged as an invalid data packet and discarded. Then, according to the type identifier of the 3rd byte of the packet header (1 for remote signaling, 2 for telemetry), the differential deserializer is called to convert the binary message into a standardized data structure (remote signaling includes remote signaling ID, remote signaling value, and millisecond-level timestamp; telemetry includes telemetry ID, telemetry value, and timestamp). At the same time, the number of data entries in the packet header is checked against the actual number of data entries parsed. If they are inconsistent, the abnormal data packet is discarded.
[0182] (3) Type identification and identifier injection: The feature library built by module 1 is called. Remote signaling data is preferentially matched with the same switch type feature library. If the match is successful, it is determined to be a stateful measurement of the switch type. If the match fails, it is matched with the protection-related switch type double hash table and determined to be a protection-related switch type measurement. Telemetry data and remote signaling data that fail to match are both determined to be stateless measurement. Three types of exclusive identifier fields are injected into stateful measurements (only effective within the system), namely, stateful identifier bit (bool type), stateful type code (int type), and related feature extension field (storage delay time or related feature index).
[0183] (4) Data push and fault tolerance: The marked measurement data is put into a global receiving circular queue with a capacity of millions of rows through the atomic enqueue interface. The data flow is realized by the FIFO circular queue mechanism. When the queue utilization rate reaches 100%, the back pressure logic is triggered to suspend the reception of front-end subsystem messages until the queue utilization rate drops below 80% and the reception is resumed. This ensures that no data is lost.
[0184] 3. Multi-threaded measurement balancing scheduling module and architecture identification module.
[0185] This module is primarily used to achieve balanced scheduling with stateful metrics based on a three-level thread architecture, through distribution algorithms and dynamic load balancing optimization. It works in conjunction with the architecture identification module to complete scenario adaptation. Specific implementation steps are as follows:
[0186] (1) Three-level thread architecture deployment: Deploy 1 measurement receiving thread, 1 measurement distribution thread, and 8 measurement processing threads (N=8, adapted to the current server performance, can be adjusted in the range of 4-32 through the configuration file). Each measurement processing thread is bound to an independent cache queue with a capacity of thousands.
[0187] (2) Implementation of basic distribution algorithm: The measurement distribution thread subscribes to data from the global receiving circular queue and executes the corresponding distribution algorithm according to the measurement type; the thread ID is calculated by taking the measurement ID and substituting it into the distribution algorithm; the protection action signal is distributed to all processing threads by broadcasting mechanism; the plant ID hash distribution algorithm is used to allocate the protection action signal and the associated switch measurement signal to the same processing thread by calculating the plant ID hash, which is suitable for plant-level closed-loop processing scenarios.
[0188] (3) Implementation of dynamic equilibrium optimization:
[0189] Stateful measurement scheduling with multiple on / off cycles: A thread allocation hash table is maintained in memory. The key is the on / off measurement ID, and the value is a quadruple of the last allocated thread PID, last allocation time, delay time, and current thread load. After the distribution thread obtains the on / off measurement data, it calculates the difference between the current timestamp and the last allocation time. If the difference is ≤3s, the data is distributed to the original thread and the load value is updated. If the difference is >3s, the load balancing algorithm is triggered (load = (number of queues / queue capacity) × 60 + (CPU utilization) × 40). Idle threads with load <60 are selected (those with the lowest load are given priority) to distribute data and update the mapping table. Load calibration is performed every 100ms to control the thread load deviation to ≤20%.
[0190] Protection-switch joint calculation with stateful measurement scheduling: protection action signals are broadcast to all processing threads. Only the main processing thread with thread ID=0 performs the protection signal table write operation. Other threads send updated data to the main thread message queue, which is then uniformly entered into the database by the main thread. After the main thread updates the process-level cache, each thread synchronizes incremental data through the std::move atomic operation, with a synchronization delay of ≤2ms.
[0191] (4) Architecture adaptation optimization: The architecture identification module 4 reads the deployment configuration information by calling the API interface of the system management-level task scheduling process; when it is identified as a distributed architecture, it distributes the measurement data to the processing thread of the corresponding shard process based on the plant ID sharding rule, reducing cross-node transmission latency; when it is identified as a centralized architecture, it significantly increases the cache queue capacity of each processing thread, improving the high throughput processing capability of a single node.
[0192] 4. Measurement data processing module.
[0193] The connection relationships between the measurement data processing module and the real-time database and relational database are as follows: Figure 1 As shown, the core of this module is used to complete the verification, processing, and dual-database storage of measurement data. Specific implementation steps are as follows:
[0194] (1) Reasonable number verification: Construct a measurement information table in the relational database and configure reasonable upper and lower limit parameters for each measurement ID (e.g., reasonable upper limit of 40kV and lower limit of 30kV for 35kV line voltage remote measurement); match parameters according to measurement ID to determine whether the uploaded data is within the reasonable range. If it exceeds the range, trigger a measurement over-limit alarm; if both reasonable upper and lower limits are 0, skip this step of verification.
[0195] (2) Data quality verification: Read the data quality code of the measured data in the real-time database (0 is normal, non-zero is abnormal) and perform verification in combination with the quality code of the collected data; when the quality code is abnormal, the core equipment measurement data (such as the main transformer voltage) will trigger an alarm, and the non-core equipment measurement data will be directly discarded.
[0196] (3) Stateful measurement processing: Each stateful measurement is maintained in the shared memory with an independent time window (length equal to the corresponding delay time); the stateful flag bit of the measurement is read, and after determining that it is a stateful measurement, it is checked whether there is historical data with the same ID in the time window: if there is and it is in the valid time window, the historical stateful measurement value and the current stateful measurement value are combined to complete the joint calculation (such as the change of position of a two-position switch), and the historical data is deleted after the calculation is completed; if there is but it exceeds the valid time window, the historical data is deleted directly; if there is no data, the current value is stored in the time window and waits for subsequent joint calculation; after each batch of data is processed, all expired data in the shared memory time windows are cleaned up in a unified manner.
[0197] (4) Data quality calculation and dual-database storage: Based on the verification results of stateless measurements, the data quality coefficient and validity identifier are calculated to determine the valid measurement value; based on the joint calculation results of stateful measurements, operations such as displacement judgment and protection-switch joint matching are completed to determine the valid measurement value; valid remote signaling data are synchronously written to the real-time database (InfluxDB) and the relational database (PostgreSQL), while valid telemetry data are only written to the real-time database, and overwrite updates are adopted to ensure data read and write efficiency.
[0198] 5. Metrics acquisition and alarm processing module.
[0199] This module is primarily used for real-time collection of system operating indicators and measurement anomaly indicators, triggering tiered alarms to ensure stable system operation. Specific implementation steps are as follows:
[0200] (1) Metrics collection: Start an independent metrics collection thread to collect the usage and data accumulation of the global receiving circular queue and the buffer queue of each processing thread in real time. At the same time, collect and measure the number of received data and the number of processed data, and accumulate and count the processing throughput. Set the queue accumulation threshold to 90% of the queue capacity. When the queue accumulation reaches the threshold for 5 seconds, trigger the queue accumulation alarm.
[0201] (2) Alarm handling: Create an alarm handling thread to handle alarm information in the alarm message queue; divide alarms into 3 levels (Level 1: severe, such as main receiving channel failure; Level 2: general, such as queue backlog; Level 3: warning, such as measurement exceeding limit), assemble alarm entities according to level (including alarm type, alarm time, alarm details, alarm level), send them to the system message bus and store them in the relational database for easy subsequent fault tracing; operation and maintenance personnel can view, confirm and handle alarm information through the system alarm interface.
[0202] 6. Intelligent debugging module for measurement point clustering.
[0203] This module is primarily used to achieve intelligent debugging and log management based on shared memory and hook tracking technology, thereby improving troubleshooting efficiency. Specific implementation steps are as follows:
[0204] (1) Construction of a three-layer register model: A three-layer register model is constructed in shared memory, namely the log master switch register (BOOL type, which controls the start and stop of the full log), the bit-by-bit control switch register (INT type 32-bit, each bit corresponds to a type of business scenario log, which controls the start and stop of a single type of log), and the measurement point set register (string set, which stores the target measurement point ID and realizes the measurement point-oriented log filtering); the bit-by-bit control switch register is shown in the table below.
[0205] Table 2. Bit-by-bit control switch register
[0206]
[0207] (2) Log anomaly adaptive triggering: A hook point register is built in shared memory, and the data processing flow is divided into 6 key business stages: collection and parsing, type identification, scheduling and distribution, reasonable number verification, stateful processing and storage. A hook program is embedded in each stage. When the measurement data processing fails, the hook program automatically updates the error count of the corresponding stage in the hook point register. The preset error count threshold for each stage is 10 times / minute. When the threshold is reached, the corresponding bit of the bit-by-bit control switch register is automatically triggered to start the output of the target business log. At the same time, the abnormal log is directed to the analysis log file through keyword filtering.
[0208] (3) Visualized debugging and control: Develop a lightweight Web debugging and control view to display the status of each bit of the bit-by-bit control switch register and the log output frequency of each hook embedding stage; support maintenance personnel to manually trigger / turn off the target bit switch, configure the abnormal trigger threshold in the range of 1-50 times / minute, and realize flexible switching between manual intervention and automatic control.
[0209] (4) Data security assurance: The log desensitization adopts the hash desensitization algorithm to encrypt sensitive fields such as core equipment measurement thresholds and protection action strategies; the access control is set with three levels of permissions: administrator, operation and maintenance, and browsing. The administrator can configure permission allocation, and the operation and maintenance personnel can only view the logs of their own area and are prohibited from unauthorized access.
[0210] The above description is only a preferred embodiment of the present invention. It should be noted that the above embodiments are only used to illustrate the technical solution of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific embodiments of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the claims of the present invention.
Claims
1. A parallel processing method for stateful measurement load balancing, characterized in that, include: Classify stateful quantity measurement types; construct feature libraries for each type of stateful quantity measurement based on time constraints and data association rules. Receive serialized measurement data; determine whether the serialized measurement data is a stateful measurement based on the stateful measurement feature library; identify the type of stateful measurement data in the serialized measurement data based on the classification type of stateful measurement; push the stateful measurement data to the global receiving circular queue; the global receiving circular queue is a circular queue used globally. Select the appropriate dynamic equilibrium optimization logic according to the type of stateful measurement data, and schedule the stateful measurement data in the global receiving circular queue to different processing threads for processing. The processing includes: maintaining an independent time window for each stateful measurement in shared memory. Read the unique identifier (ID) of the stateful measurement and check if there is historical data with the same ID within the time window: if there is and it is within the valid time window, perform joint calculation by combining the historical stateful measurement value and the current stateful measurement value, and delete the historical data after the calculation is completed; if there is but it is outside the valid time window, delete the historical data directly; otherwise, store the current stateful measurement value in the time window and wait for subsequent joint calculation.
2. The parallel processing method for stateful measurement load balancing according to claim 1, characterized in that: The step of selecting the appropriate dynamic equilibrium optimization logic based on the type of stateful measurement data includes: For stateful measurement types with multiple frequency of the same switch, maintain a thread allocation hash table. If the difference between the current timestamp and the last allocation time does not exceed the delay time, it is determined to be assigned to the original thread. If it exceeds the delay time, the load balancing algorithm is triggered to perform the allocation. For protection-switch joint calculation with state measurement type, the protection action signal is broadcast to all processing threads. The main processing thread is preset to perform protection signal table write operation. After the main thread updates the process-level cache, each thread achieves synchronization through atomic operations.
3. The parallel processing method for stateful measurement load balancing according to claim 2, characterized in that: The load balancing algorithm includes: calculating thread load values based on the number of queues, queue capacity, and CPU utilization; filtering idle threads based on each thread load value, prioritizing the thread with the lowest load to process stateful measurement data; if there are no idle threads, selecting low-load threads, where the low-load thread is the thread whose remaining cache queue capacity is not lower than a set value; and performing load calibration and updating the mapping table within a set time.
4. The parallel processing method for stateful measurement load balancing according to claim 1, characterized in that: The state measurement types include state measurement types with multiple frequencies of the same switch and state measurement types calculated jointly by protection and switch. The state measurement types calculated jointly by multiple frequencies of the same switch include two-position switches and three-phase switches. The state measurement types calculated jointly by protection and switch include protection switches calculated jointly by protection actions and switch signals.
5. The parallel processing method for stateful measurement load balancing according to claim 1, characterized in that: The global receiving circular queue is processed based on a three-level thread architecture. The three-level thread architecture includes a single-threaded asynchronous measurement receiving thread, a measurement distribution thread, and multiple configurable measurement processing threads. Each measurement processing thread is bound to an independent cache queue. The measurement distribution thread adopts a distributed architecture or a centralized architecture, including: in a distributed architecture, the measurement data is distributed to the corresponding sharding process processing thread according to the plant ID or region ID based on sharding rules; in a centralized architecture, the processing capacity is improved by optimizing thread cache allocation.
6. The parallel processing method for stateful measurement load balancing according to claim 1, characterized in that, The stateful measurement feature library uses a structured hash table, including two types: Hash table for multi-frequency stateful measurement features of the same switch: the key is the unique identifier ID of the switch, and the value is a tuple of switch features, including the switch type and delay time; The protection-switch joint calculation uses a state measurement feature database hash table: a bidirectional mapping dual hash table is used, including a protection dimension hash table and a switch dimension hash table; the key of the protection dimension hash table is the unique identifier ID of the protection device, and the value is the set of protection-related features; the key of the switch dimension hash table is the unique identifier ID of the switch, and the value is the set of switch-assigned features.
7. The parallel processing method for stateful measurement load balancing according to claim 1, characterized in that: After identifying the type of stateful measurement data, a dedicated identifier field is injected into the stateful measurement. The dedicated identifier field includes a stateful identifier bit, a stateful type code, and an associated feature extension field.
8. A stateful measurement and debugging method, characterized in that, include: Classify stateful quantity measurement types; construct feature libraries for each type of stateful quantity measurement based on time constraints and data association rules. Receive serialized measurement data; determine whether the serialized measurement data is a stateful measurement based on the stateful measurement feature library; identify the type of stateful measurement data in the serialized measurement data based on the classification type of stateful measurement; push the stateful measurement data to the global receiving circular queue; the global receiving circular queue is a circular queue used globally. Based on the type of stateful measurement data, select the appropriate dynamic equilibrium optimization logic to schedule the stateful measurement data in the global receiving circular queue to different processing threads for processing. Hook programs are embedded in each stage of the stateful measurement data processing flow. When an error occurs in the stateful measurement data processing, the hook program automatically updates the error count of the corresponding stage in the hook tracking register. When the error count of each business stage reaches the preset threshold, the corresponding business log output is automatically triggered.
9. The stateful measurement and debugging method according to claim 1, characterized in that: A three-layer register model is adopted for log management, which includes a log master switch register, a bit-by-bit control switch register, and a measurement point set register.
10. A power SCADA system, characterized in that, The system includes: The module for classifying and defining the types of stateful measurements is used to: classify the types of stateful measurements; and construct a feature library for each type of stateful measurement based on the time constraints and data association rules of each type of stateful measurement. The multimodal measurement acquisition module is used for: receiving serialized measurement data; determining whether the serialized measurement data is a stateful measurement based on the stateful measurement feature library; identifying the type of stateful measurement data in the serialized measurement data based on the classification type of stateful measurement; and pushing the stateful measurement data to a global receiving circular queue; wherein the global receiving circular queue is a circular queue used globally. The multi-threaded measurement balancing and scheduling module is used to: select the appropriate dynamic balancing optimization logic according to the type of stateful measurement data, and schedule the stateful measurement data in the global receiving circular queue to different processing threads; The measurement data processing module is used to process and store stateful measurement data; The indicator acquisition and alarm processing module is used to: collect abnormal indicators of the system and measurement in real time and trigger hierarchical alarms; The intelligent debugging module for measurement point clustering is used to: embed hook programs into each stage of the stateful measurement data processing flow; when an error occurs in the stateful measurement data processing, the hook program automatically updates the error count of the corresponding stage in the hook embedding register; when the error count of each business stage reaches the preset threshold, the corresponding business log output is automatically triggered. The system also includes an architecture identification module, which is used to: obtain the deployment mode and sharding parameters by calling the system management-level task scheduling process API interface or reading the deployment configuration information written to shared memory, push adaptation instructions to the multi-threaded measurement balance scheduling module and the measurement data processing module, and execute the corresponding adaptation operations.