A method and system for sequentially processing multi-threaded data in frequency regulation control

By starting multi-threaded data reception in the frequency adjustment control system, and using distributed data control entities and monitoring threads, the data processing interleaving problem caused by multi-core processors is solved, and the data sequence processing and system stability are improved.

CN119025284BActive Publication Date: 2025-03-07CYG SUNRI CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411491920.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-03-07
Estimated Expiration
2044-10-24

AI Technical Summary

Technical Problem

When multi-core and multi-threaded processors process frequency adjustment control data, switch between threads in each clock cycle, resulting in the interweaving of instruction execution processes of multiple threads and the data cannot be processed in chronological order.

Method used

By starting multi-threaded data reception, defining data verification standards and exception analysis mechanisms, creating distributed data control entities, and using full check functions and independent monitoring threads to ensure data is processed in sequence.

Benefits of technology

The orderly processing of multi-threaded data is realized, the accuracy of data processing and system stability are improved, the impact of the power grid is reduced, and the flexibility and reliability of the power system are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025284B_ABST
    Figure CN119025284B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for sequentially processing multi-threaded data in frequency regulation control, which relates to the field of integrated automation technology of plant stations, including starting multiple threads to receive data from different data sources, defining data verification standards, and designing a data anomaly analysis mechanism to determine whether the data is normal data, creating a distributed data control entity, and initializing it, using a full check function to determine whether the data storage area is currently full, and inputting normal data into the data storage area, setting a monitoring thread, checking the state of a mutex, using a null check function to check the state of the data storage area, and processing the input normal data, and releasing the storage space occupied by the data unit after processing. The present invention solves the problem that a multi-threaded processor switches between threads once per clock cycle when processing a problem, so that the instruction execution processes of multiple threads are intertwined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of integrated automation of power plants and stations, and in particular to a method and system for sequentially processing multi-threaded data in frequency regulation control. Background Art

[0002] After starting, hydropower units, thermal power units, gas units and new energy stations need to be connected to the grid for operation. However, the greater the voltage difference during grid connection, the greater the impact current; the greater the frequency difference, the shorter the impact current cycle; and the impact current is not good for both the generator and the power system. Therefore, frequency adjustment processing is required before grid connection to minimize the impact on the grid during grid connection. The data for calculating the frequency needs to be processed strictly in chronological order. The traditional method is to use a single-core processor, which is responsible for both data reception and data processing, and does not need to schedule and process the data in chronological order. However, since data reception and processing are in the same core, the voltage amplitude, phase and frequency cannot be calculated in time, resulting in a certain error between the voltage amplitude, phase and frequency at the time of synchronous closing and the true value. The grid still has the risk of being subjected to a certain impact. In order to overcome the above problems and analyze the data in a timely and rapid manner, multi-core and multi-threaded processors are introduced, but multi-core and multi-threaded processors switch between threads once per clock cycle when processing problems, so that the instruction execution processes of multiple threads are intertwined. However, data needs to be processed in time sequence in frequency regulation control, so this patent proposes a method and system for sequentially processing multi-threaded data in frequency regulation control. Summary of the invention

[0003] In view of the above existing problems, the present invention provides a method and system for sequentially processing multi-threaded data in frequency regulation control, so as to solve the problem that a multi-core, multi-threaded processor switches between threads once in each clock cycle when processing a problem, so that the instruction execution processes of multiple threads are intertwined.

[0004] In order to solve the above technical problems, a method for sequentially processing multi-threaded data in frequency regulation control is proposed, including: starting multiple threads to receive data from different data sources, defining data verification standards, and designing a data anomaly analysis mechanism to determine whether the data is normal data; creating a distributed data control entity, initializing the data control entity, using a full check function to determine whether the data storage area is currently full, and inputting normal data into the data storage area; setting an independent monitoring thread, checking the state of the mutex lock, using an empty check function to monitor the state of the data storage area in the data control entity in real time, and processing the input normal data, and releasing the storage space occupied by the data unit after processing.

[0005] As a preferred solution of the method for sequentially processing multi-threaded data in the frequency regulation control described in the present invention, the data verification standard includes judging whether the received data meets the data integrity index, data type and format requirements, business logic verification standards, system performance indicators and external environment requirements.

[0006] The data integrity indicators include whether the data length and data checksum meet the standards; the data type and format requirements include whether the data meets the data types of integers, floating-point numbers and strings, and whether the data format meets the standards of date formats and JSON structures; the system performance indicators include the time required for data processing and the use of monitoring system resources; the external environment requirements include monitoring whether the network is delayed and monitoring whether the status of hardware devices is abnormal.

[0007] As a preferred solution of the method for sequentially processing multi-threaded data in the frequency regulation control of the present invention, the data anomaly analysis mechanism includes using the data anomaly analysis mechanism to determine whether the verified data is normal data, and the data anomaly probability calculation formula is expressed as:

[0008] ,

[0009] in, is the abnormal probability of data x, is the distribution function of data x at time t, is the exponential decay function of time t, where t is time, is a complex information filtering function, For data points The normalization function of is the data point, N is the number of data points, is the horizontal coordinate of the data point, is the vertical coordinate of the data point, and x is the input data.

[0010] Said The distribution function is expressed as:

[0011] ,

[0012] in, is the data standard deviation, is the data average, is the Gaussian distribution function, is an exponential function, t is time, , , are the periodicity and amplitude adjustment parameters, x is the input data, and N is the number of data points.

[0013] Said The complex information filtering function is expressed as:

[0014] ,

[0015] in, are the data point coordinates, Parameters for filtering information. For data points The relationship function between λ and the value of λ is is the exponential decay function of λ.

[0016] Said The relationship function is expressed as:

[0017] ,

[0018] in, is the data standard deviation, and For data and average value, , For data points The Gaussian distribution function of For data points Gaussian distribution function.

[0019] Among them, when When , it indicates that the input data is normal, and the normal data is input into the data storage area in the data control entity and then processed; when When , it indicates that the input data is abnormal, the abnormal data will be cleared and not entered into the data storage area in the data control entity.

[0020] As a preferred solution of the method for sequentially processing multi-threaded data in the frequency regulation control described in the present invention, wherein: the creation of a distributed data control entity includes conducting a demand analysis, determining the functions and performance requirements of the distributed data control entity, planning the overall architecture, deploying nodes on the device, configuring the network environment to ensure communication between nodes, and designing data sharding strategies and data replication strategies.

[0021] The data sharding strategy includes, in horizontal sharding, dividing the data set into subsets and storing the subsets on nodes; in vertical sharding, dividing the data into subsets according to data attributes and storing the subsets on nodes; in key-based sharding, sharding according to key-value pairs of the data and storing data with the same key on the same node.

[0022] The data replication strategies include master-slave replication, full replication and multi-master replication.

[0023] The master-slave replication includes the master node processing write operations and the slave node processing read operations; the full replication includes storing all data copies on the node and performing read and write operations simultaneously; the multi-master replication includes all nodes processing write operations.

[0024] The creation of the distributed data control entity also includes creating a head pointer, a tail pointer, an element number counter, and a pointer pointing to a data storage area.

[0025] As a preferred solution of the method for sequentially processing multi-threaded data in the frequency regulation control described in the present invention, the initialization includes defining initialization parameters, determining the pointer of the data control entity and the initial size of the queue, allocating memory space of the data storage area according to the initial size of the queue, initializing the data unit of the data storage area, and initializing the queue pointer and counter.

[0026] As a preferred solution of the method for sequentially processing multi-threaded data in the frequency regulation control described in the present invention, the determination of whether the data storage area is currently full includes calling a data storage area full check function in the data control entity. When the full check function returns False, it indicates that the data storage area is not full, addressing is performed according to the tail pointer, and the data is stored in the tail of the data storage area of ​​the data control entity. The tail pointer of the data control entity is incremented by 1, and the element number counter of the data control entity is incremented by 1. When the full check function returns True, it indicates that the data storage area is full, the data is not saved, and the full check function is exited.

[0027] As a preferred solution of the method for sequentially processing multi-threaded data in the frequency regulation control described in the present invention, wherein: the independent monitoring thread includes checking the mutex lock. When the mutex lock is locked, the monitoring thread is blocked. The thread can execute the monitoring thread only when the mutex lock becomes available. When the thread is executed, the data storage area empty check function in the data control entity is called. When the empty check function returns False, it indicates that the data storage area has data. According to the address pointed to by the head pointer, the data is read out from the data storage area of ​​the data control entity, and the mutex lock permission is released. The head pointer of the data control entity is increased by 1, and the data control entity element number counter is reduced by 1. The data processing module is called to process the read data until the data storage area empty check function in the data control entity returns True, the mutex lock permission is released and the monitoring execution thread is dormant, and the processor control right is given up; when the empty check function returns True, it indicates that the data storage area is storing data, and the mutex lock permission is directly released and the monitoring execution thread is dormant, and the processor control right is given up.

[0028] The data processing includes moving the data from the data storage area in the data control entity to the data processing area in the order of receiving time, filtering, normalizing, feature extracting and data grouping the data in the data processing area, storing the processed data in a storage medium, and releasing the storage space occupied by the processed data.

[0029] Another object of the present invention is to provide a system for processing multi-threaded data in order of receiving time. The present invention optimizes the operating efficiency of the data control entity and realizes multi-threaded data processing. The system of the present invention obtains power generation data, power consumption data and environmental data in real time, predicts frequency fluctuations and voltage fluctuations, solves the problem of power grid fluctuations caused by errors between the voltage amplitude, phase and frequency of hydropower units, thermal power units, gas units and new energy stations and the actual situation, improves the flexibility and reliability of the power system, reduces operating costs, and ensures the stability and economy of power supply.

[0030] As a preferred solution of the system for processing multi-threaded data in order of receiving time described in the present invention, it is characterized by comprising a creation module, an initialization module, a data receiving module and a data processing module.

[0031] The creation module is used to create a distributed data control entity and store received data, and to realize orderly reading of the data buffer through a head pointer, a tail pointer and an element number counter.

[0032] The initialization module is used to initialize the distributed data control entity, the head pointer of the data control entity is initialized to 0, the tail pointer is initialized to 0, the element number counter is initialized to 0, and the data storage area allocates memory space and assigns initial values.

[0033] The data receiving module is used to receive and store data in sequence, ensuring that the thread that receives data first stores the data first.

[0034] The data processing module is used to process the data in the data storage area in the data control entity in sequence, and after processing, move the pointer to be processed in the data storage area backward by one node.

[0035] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and is characterized in that when the processor executes the computer program, the steps of the method for processing multi-threaded data in the order of receiving time are implemented.

[0036] A computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method for processing multi-threaded data in a receiving time sequence are implemented.

[0037] The beneficial effects of the present invention are as follows: the present invention realizes parallel processing and efficient collection of data by starting multiple threads to receive data from different data sources, significantly improves the data processing capability and response speed of the system, and optimizes the utilization of CPU resources; defines data verification standards and designs data anomaly analysis mechanisms to ensure the accuracy and reliability of data, effectively guarantees data quality, discovers and eliminates abnormal data in advance, and thus improves the stability of the system; creates and initializes distributed data control entities, and combines full check functions to realize distributed management and storage optimization of data, avoids data loss, and reasonably allocates storage resources to improve storage efficiency; sets independent monitoring threads and uses empty check functions to ensure the synchronization of data processing, monitors the storage status in real time, and releases storage space after data processing, further improving the recycling rate and overall utilization rate of storage space. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work, among which:

[0039] Figure 1 An overall flow chart of a method for sequentially processing multi-threaded data in frequency regulation control provided by one embodiment of the present invention.

[0040] Figure 2 A schematic diagram of a mutex lock usage mechanism for a method for sequentially processing multi-threaded data in frequency regulation control provided by an embodiment of the present invention.

[0041] Figure 3 A flow chart of a system solution for sequentially processing multi-threaded data in frequency regulation control provided by one embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0043] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0044] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor is it an embodiment that is mutually exclusive with other embodiments, either individually or selectively.

[0045] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.

[0046] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0047] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0048] Example 1, reference Figure 1-Figure 2 , which is the first embodiment of the present invention, provides a method for sequentially processing multi-threaded data in frequency regulation control, comprising:

[0049] S1: Start multiple threads to receive data from different data sources, define data verification standards, and design a data anomaly analysis mechanism to determine whether the data is normal.

[0050] The data verification standards include determining whether the received data meets data integrity indicators, data type and format requirements, business logic verification standards, system performance indicators and external environment requirements.

[0051] The data integrity indicators include whether the data length and data checksum meet the standards; the data type and format requirements include whether the data meets the data types of integers, floating-point numbers and strings, and whether the data format meets the standards of date formats and JSON structures; the system performance indicators include the time required for data processing and the use of monitoring system resources; the external environment requirements include monitoring whether the network is delayed and monitoring whether the status of hardware devices is abnormal.

[0052] The data anomaly analysis mechanism includes using the data anomaly analysis mechanism to determine whether the verified data is normal data. The data anomaly probability calculation formula is expressed as:

[0053] ,

[0054] in, is the abnormal probability of data x, is the distribution function of data x at time t, is the exponential decay function of time t, where t is time, is a complex information filtering function, For data points The normalization function of is the data point, N is the number of data points, is the horizontal coordinate of the data point, is the vertical coordinate of the data point, and x is the input data.

[0055] Said The distribution function is expressed as:

[0056] ,

[0057] in, is the data standard deviation, is the data average, is the Gaussian distribution function, is an exponential function, t is time, , , are the periodicity and amplitude adjustment parameters, x is the input data, and N is the number of data points.

[0058] Said The complex information filtering function is expressed as:

[0059] ,

[0060] in, are the data point coordinates, Parameters for filtering information. For data points The relationship function between λ and the value of λ is is the exponential decay function of λ.

[0061] Said The relationship function is expressed as:

[0062] ,

[0063] in, is the data standard deviation, and For data and average value, , For data points The Gaussian distribution function of For data points Gaussian distribution function.

[0064] Among them, when When , it indicates that the input data is normal, and the normal data is input into the data storage area in the data control entity and then processed; when When , it indicates that the input data is abnormal, the abnormal data will be cleared and not entered into the data storage area in the data control entity.

[0065] S2: Create a distributed data control entity, initialize the data control entity, and use the full check function to determine whether the data storage area is currently full. When the storage area is not full, normal data is input into the data storage area.

[0066] The creation of the distributed data control entity includes conducting a demand analysis, determining the functional and performance requirements of the distributed data control entity, planning the overall architecture, deploying nodes on the device, configuring the network environment to ensure communication between nodes, and designing data sharding strategies and data replication strategies.

[0067] The data sharding strategy includes, in horizontal sharding, dividing the data set into subsets and storing the subsets on nodes; in vertical sharding, dividing the data into subsets according to data attributes and storing the subsets on nodes; in key-based sharding, sharding according to key-value pairs of the data and storing data with the same key on the same node.

[0068] The data replication strategies include master-slave replication, full replication and multi-master replication.

[0069] The master-slave replication includes the master node processing write operations and the slave node processing read operations; the full replication includes storing all data copies on the node and performing read and write operations simultaneously; the multi-master replication includes all nodes processing write operations.

[0070] The creation of the distributed data control entity also includes creating a head pointer, a tail pointer, an element number counter, and a pointer pointing to a data storage area.

[0071] The initialization includes defining initialization parameters, determining a pointer of a data control entity and an initial size of a queue, allocating memory space of a data storage area according to the initial size of the queue, initializing data units of the data storage area, and initializing a queue pointer and a counter.

[0072] The initialization parameters include a pointer to a data control entity and an initial size of a queue; initializing queue pointers and counters includes initializing a head pointer to 0, initializing a tail pointer to 0, and initializing an element number counter to 0.

[0073] The data storage area allocation formula is: pDataBuffer=malloc.

[0074] Among them, pDataBuffer is the data storage area pointer of the data control entity, and malloc is the dynamic memory allocation function.

[0075] The formula for initializing the data unit is: pDataBuffer[k]=initial value.

[0076] Wherein, k is the data unit index in the data storage area, and pDataBuffer[k] is the address of the kth data unit in the data storage area.

[0077] The method of judging whether the data storage area is currently full includes calling a data storage area full check function in the data control entity. When the full check function returns False, it indicates that the data storage area is not full. The data is addressed according to the tail pointer and the data is stored in the tail of the data storage area of ​​the data control entity. The tail pointer of the data control entity is incremented by 1, and the element number counter of the data control entity is incremented by 1. When the full check function returns True, it indicates that the data storage area is full, the data is not saved and the full check function is exited.

[0078] S3: Set up an independent monitoring thread to check the mutex lock status. When the mutex lock is available, use the empty check function to monitor the data storage area status in the data control entity in real time, and process the normal input data. After processing, release the storage space occupied by the data unit.

[0079] like Figure 2The independent monitoring thread includes checking the mutex lock. When the mutex lock is locked, the monitoring thread is blocked. The thread can execute the monitoring thread only when the mutex lock becomes available. When the thread is executed, the data storage area empty check function in the data control entity is called. When the empty check function returns False, it indicates that there is data in the data storage area. According to the address pointed to by the head pointer, the data is read out from the data control entity data storage area, and the mutex lock permission is released. The head pointer of the data control entity is increased by 1, and the number of elements in the data control entity is decreased by 1. The data processing module is called to process the read data until the data storage area empty check function in the data control entity returns True, then the mutex lock permission is released and the monitoring execution thread is dormant to give up the processor control right; when the empty check function returns True, it indicates that the data storage area is storing data, and the mutex lock permission is directly released and the monitoring execution thread is dormant to give up the processor control right.

[0080] The data processing includes moving the data from the data storage area in the data control entity to the data processing area in the order of receiving time, filtering, normalizing, feature extracting and data grouping the data in the data processing area, storing the processed data in a storage medium, and releasing the storage space occupied by the processed data.

[0081] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

[0082] Embodiment 2, the second embodiment of the present invention, is different from the previous embodiment in that:

[0083] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0084] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0085] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0086] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0087] Example 3, reference Figure 3 , which is the third embodiment of the present invention, provides a system for sequentially processing multi-threaded data in frequency regulation control, including a creation module M301, an initialization module M302, a data receiving module M303 and a data processing module M304.

[0088] The creation module M301 is used to create a distributed data control entity and store received data, and to realize orderly reading of the data buffer through a head pointer, a tail pointer and an element number counter.

[0089] The initialization module M302 is used to initialize the distributed data control entity. The head pointer of the data control entity is initialized to 0, the tail pointer is initialized to 0, the element number counter is initialized to 0, and the data storage area allocates memory space and assigns initial values.

[0090] The data receiving module M303 is used to receive and store data in sequence, ensuring that the thread that receives data first stores the data first.

[0091] The data processing module M304 is used to process the data in the data storage area in the data control entity in sequence, and after processing, move the pointer to be processed in the data storage area backward by one node.

[0092] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for sequentially processing multi-threaded data in frequency regulation control, characterized in that: include, Start multiple threads to receive data from different data sources, define data verification standards, and design a data anomaly analysis mechanism to determine whether the data is normal; Create a distributed data control entity, initialize the data control entity, use the full check function to determine whether the data storage area is currently full, and input normal data into the data storage area; Set up an independent monitoring thread, check the state of the mutex lock, use the null check function to monitor the state of the data storage area in the data control entity in real time, and process the normal input data, and release the storage space occupied by the data unit after processing; The data verification criteria include determining whether the received data meets data integrity indicators, data type and format requirements, business logic verification standards, system performance indicators and external environment requirements; The data integrity indicators include whether the data length and data checksum meet the standards; the data type and format requirements include whether the data meets the data types of integers, floating point numbers and strings, and whether the data format meets the standards of date format and JSON structure; the system performance indicators include the time required for data processing and the use of monitoring system resources; the external environment requirements include monitoring whether the network is delayed and monitoring whether the status of hardware devices is abnormal; The data anomaly analysis mechanism includes using the data anomaly analysis mechanism to determine whether the verified data is normal data. The data anomaly probability calculation formula is expressed as: Among them, E(x) is the abnormal probability of data x, f(x, t) is the distribution function of data x at time t, is an exponential decay function of time t, where t is time, g(x i ,y i ) is a complex information filtering function, h(z i ) is the data point z i The normalized function of i is the data point, N is the number of data points, x i is the horizontal coordinate of the data point, y i is the ordinate of the data point, and x is the input data; The f(x, t) distribution function is expressed as: Among them, σ is the standard deviation of the data, μ is the mean value of the data, is the Gaussian distribution function, exp is the exponential function, t is the time, a i 、b i 、c i are the periodicity and amplitude adjustment parameters, x is the input data, and N is the number of data points; The g(x i ,y i )The complex information filtering function is expressed as: Among them, (x i ,y i ) is the coordinate of the data point, λ is the parameter for filtering information, φ(x i ,y i ,λ) is the data point (x i ,y i ) and the relationship function between the λ value, is the exponential decay function of λ; The φ(x i ,y i ,λ) relationship function is expressed as: Among them, σ is the standard deviation of the data, μ x and μ y For data x i and i Average value, i=1…N, For data point x i The Gaussian distribution function of is the data point y i Gaussian distribution function of Among them, when 0≤E(x)<1, it means that the input data is normal, and the normal data is input into the data storage area in the data control entity and subsequently processed; when E(x)=1, it means that the input data is abnormal, the abnormal data is cleared, and not input into the data storage area in the data control entity.

2. A method for sequentially processing multi-threaded data in frequency regulation control according to claim 1, characterized in that: The creation of the distributed data control entity includes conducting a demand analysis, determining the functional and performance requirements of the distributed data control entity, planning the overall architecture, deploying nodes on the device, configuring the network environment to ensure communication between nodes, and designing data sharding strategies and data replication strategies; The data sharding strategy includes, on horizontal sharding, dividing the data set into subsets and storing the subsets on nodes; In vertical sharding, data is divided into subsets according to data attributes and the subsets are stored on nodes; in key-based sharding, data is sharded according to key-value pairs and data with the same key is stored on the same node; The creation of the distributed data control entity also includes creating a head pointer, a tail pointer, an element number counter, and a pointer pointing to a data storage area.

3. A method for sequentially processing multi-threaded data in frequency regulation control as claimed in claim 2, characterized in that: The initialization includes defining initialization parameters, determining a pointer of a data control entity and an initial size of a queue, allocating memory space of a data storage area according to the initial size of the queue, initializing data units of the data storage area, and initializing a queue pointer and a counter; The initialization parameters include a pointer to a data control entity and an initial size of a queue; initializing queue pointers and counters includes initializing a head pointer to 0, initializing a tail pointer to 0, and initializing an element number counter to 0.

4. A method for sequentially processing multi-threaded data in frequency regulation control as claimed in claim 3, characterized in that: The method of judging whether the data storage area is currently full includes calling a data storage area full check function in the data control entity. When the full check function returns False, it indicates that the data storage area is not full. The data is addressed according to the tail pointer and the data is stored in the tail of the data storage area of ​​the data control entity. The tail pointer of the data control entity is incremented by 1, and the element number counter of the data control entity is incremented by 1. When the full check function returns True, it indicates that the data storage area is full, the data is not saved and the full check function is exited.

5. A method for sequentially processing multi-threaded data in frequency regulation control according to claim 4, characterized in that: The independent monitoring thread includes checking the mutex lock. When the mutex lock is locked, the monitoring thread is blocked. The thread can execute the monitoring thread only when the mutex lock becomes available. When the thread is executed, the data storage area empty check function in the data control entity is called. When the empty check function returns False, it indicates that the data storage area has data. According to the address pointed to by the head pointer, the data is read out from the data control entity data storage area, and the mutex lock permission is released. The head pointer of the data control entity is increased by 1, and the data control entity element number counter is decreased by 1. The data processing module is called to process the read data until the data storage area empty check function in the data control entity returns True, then the mutex lock permission is released and the monitoring execution thread is dormant, giving up the processor control right; when the empty check function returns True, it indicates that the data storage area is storing data, and the mutex lock permission is directly released and the monitoring execution thread is dormant, giving up the processor control right; The data processing includes moving the data from the data storage area in the data control entity to the data processing area in the order of receiving time, filtering, normalizing, feature extracting and data grouping the data in the data processing area, storing the processed data in a storage medium, and releasing the storage space occupied by the processed data.

6. A system using the method for sequentially processing multi-threaded data in frequency regulation control as claimed in any one of claims 1 to 5, characterized in that: It includes a creation module, an initialization module, a data receiving module and a data processing module; The creation module is used to create a distributed data control entity and store the received data, and to realize the orderly reading of the data buffer through the head pointer, tail pointer and element number counter; The initialization module is used to initialize the distributed data control entity, the head pointer of the data control entity is initialized to 0, the tail pointer is initialized to 0, the element number counter is initialized to 0, and the data storage area allocates memory space and assigns initial values; The data receiving module is used to receive and store data in sequence, ensuring that the thread that receives data first stores the data first; The data processing module is used to process the data in the data storage area in the data control entity in sequence, and after processing, move the pointer to be processed in the data storage area backward by one node.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of a method for sequentially processing multi-threaded data in frequency adjustment control according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a method for sequentially processing multi-threaded data in frequency regulation control according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Multi-thread data processing method and device, equipment and medium

    CN117608818A

  • Multi-thread data processing method and device, equipment and storage medium

    CN118747112A