Power equipment control method, device and medium based on reactive programming
By using asynchronous event streaming technology in reactive programming, power equipment control is abstracted into event streams, generating flexible control logic. This addresses the shortcomings of traditional power system control methods and enables efficient, reliable, and flexible power equipment management.
Patent Information
- Application Number
- CN202311782327.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-22
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-12-22
AI Technical Summary
Traditional power system control methods lack flexibility and adaptability, making it difficult to cope with real-time changes in power demand and supply. Furthermore, centralized control is prone to human error, affecting management efficiency.
By employing the asynchronous event stream feature of reactive programming, power equipment control is abstracted into a set of event streams. By combining and filtering these basic event streams, various control logics are generated to achieve event-driven power scheduling and optimization.
It improves the management efficiency and control logic reliability of the power system, reduces the possibility of human error, and achieves highly responsive and flexible power equipment control.
Smart Images

Figure CN117872859B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a power equipment control method, and more particularly to a power equipment control method, device, and medium based on responsive programming. Background Technology
[0002] With the development of technology and the widespread use of large-scale electrical equipment, the operation and management of power systems face increasingly greater challenges. As electricity demand continues to grow and technology advances, the scale and complexity of power systems are also constantly increasing. Traditional power system control methods are mostly based on preset rules and fixed dispatch strategies, which cannot adapt to real-time changes in electricity demand and supply. Furthermore, traditional power control systems typically employ centralized control and open-loop control, which lack flexibility and adaptability, making them ill-suited to handle unexpected situations and uncertainties that may arise in the power system.
[0003] A search revealed Chinese Patent Publication No. CN112165066A, which discloses a modular programmable intelligent protection system. Specifically, the system comprises: a digital input acquisition and processing module for acquiring and debouncing external digital inputs; an analog input acquisition, filtering, and calculation module for acquiring and filtering analog inputs; a fixed logic processing module for performing fixed logic processing on the information sent by the digital input acquisition and processing module and the analog input acquisition, filtering, and calculation module; a logic storage module for storing commonly used logic operation rules in power systems; a custom logic processing module for performing logic processing on the information sent by the digital input acquisition and processing module and the analog input acquisition, filtering, and calculation module based on logic operation rules selected from the logic storage module; and a relay output module for driving the relay to open and close based on the logic operation results of the fixed logic processing module and the custom logic processing module.
[0004] However, the existing patent mainly provides a programmable interface for relay protection equipment, enabling the protection equipment to adapt to different operating environments. It is an adaptive control within the electrical equipment, without involving manual power equipment control. Therefore, how to automate power dispatching and optimization, thereby reducing the possibility of human error and improving the management efficiency of the power system, has become a technical problem that needs to be solved. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the prior art by providing a power equipment control method, device, and medium based on responsive programming.
[0006] The objective of this invention can be achieved through the following technical solutions:
[0007] According to a first aspect of the present invention, a power equipment control method based on reactive programming is provided. This method utilizes the asynchronous event flow characteristics of reactive programming to abstract the control of power equipment into a set of event flows. By combining and filtering these basic event flows, control logic for various power equipment controls is generated.
[0008] As a preferred technical solution, the method specifically includes the following steps:
[0009] Step S1: Define a set of device control data streams, which include three sets of data streams: device status data stream, user control event data stream, and interval event stream;
[0010] Step S2, define the subscribers to the data stream;
[0011] Step S3: Combine the three sets of data streams from step S1 and return them to the subscribers through a filter;
[0012] Step S4: Once the subscriber is running, the entire device control process can begin, and the subscriber receives the device control start event;
[0013] Step S5: After the entire device control process begins, the producer obtains the last data value of each data stream, combines them together, and sends them to the subscriber.
[0014] Step S6: After receiving the data group, the subscriber selects the next device operation action or continues to wait for a new data group based on the device status, the latest user operation, and operation interval information.
[0015] Step S7: If an error or timeout is encountered, the equipment control process is terminated and the equipment is reset.
[0016] Step S8: If all data streams have been sent, then the control process is complete and the device control process is terminated.
[0017] As a preferred technical solution, in step S5, the producer creates an observable event stream and provides subscriptions to consumers, who then subscribe to this data stream to obtain the power control event stream.
[0018] As a preferred technical solution, if a producer has a new event stream, it should immediately send the data to all consumers who have subscribed to that event stream.
[0019] As a preferred technical solution, the consumer can stop receiving events by unsubscribing.
[0020] As a preferred technical solution, the asynchronous event stream is pushed to subscribers, thereby achieving event-driven operation.
[0021] As a preferred technical solution, the device status data stream specifically comprises:
[0022] The state transition sequence of power equipment includes initialization, waiting for preset, preset successful and waiting for control, in control, control successful or failed, and end.
[0023] As a preferred technical solution, the user control event data stream includes preset, control, or cancellation.
[0024] As a preferred technical solution, the interval data stream is specifically an interval that needs to be waited for after an operation.
[0025] As a preferred technical solution, the combination of the three data streams in step S3 is specifically as follows:
[0026] First, define three sets of data streams separately, and then combine them according to the actual order in which each data item appears during runtime.
[0027] As a preferred technical solution, when a subscriber begins consuming data, the producer reads the current values of the three data streams respectively, combines them, and sends them to the consumer.
[0028] As a preferred technical solution, the asynchronous event stream collects data within a coroutine context.
[0029] According to a second aspect of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method described thereon.
[0030] According to a third aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described thereon.
[0031] Compared with the prior art, the present invention has the following advantages:
[0032] 1) This invention utilizes the asynchronous event stream characteristics of reactive programming to abstract the control of power equipment into a set of event streams. By combining and filtering these basic event streams, control logic for various power equipment can be generated, accelerating the development of equipment control software and improving the reliability and security of the control logic.
[0033] 2) This invention realizes event-driven power control. Through preset rules and algorithms, it can automatically perform power dispatching and optimization, reduce the possibility of human error, and improve the management efficiency of the power system.
[0034] 3) This invention achieves scalability in power control. Due to the diversity of equipment types, the control methods for each product differ. If functional programming is used, new control logic needs to be continuously developed. However, reactive programming can provide flexible and diverse control logic. Business developers only need to define the state transitions of the equipment and the types of user operations, and then they can quickly define new control logic. Adding, deleting, or adjusting new control logic can be implemented quickly and flexibly, enabling the rapid and flexible implementation of control services.
[0035] 4) This invention improves the reliability of power control. Through the algorithm of preset state data stream and operation data stream, it can automatically perform power dispatch and optimization, reduce the possibility of human error, and improve the management efficiency of the power system.
[0036] 5) This invention achieves high responsiveness in power control. Responsive programming is executed asynchronously, which can fully utilize the performance of multi-core CPUs, and the underlying execution model can automatically propagate changes through data flow, enabling more real-time responses. Attached Figure Description
[0037] Figure 1 This is a schematic diagram of the multi-asynchronous data stream combination of the present invention;
[0038] Figure 2 This is a schematic diagram illustrating the implementation of the method of the present invention;
[0039] Figure 3 This is a flowchart illustrating the specific process of the method of the present invention; Detailed Implementation
[0040] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0041] This invention discloses a power equipment control method based on reactive programming. Leveraging the asynchronous event stream characteristics of reactive programming, it provides a data stream-driven and change-proactive propagation mode to achieve asynchronous control of power equipment and reduce system load. Reactive programming focuses on how to create data streams that depend on changes and respond to them, improving the abstraction level of the code. The development of power equipment control functions primarily concerns data streams and the execution of related business operations. This invention includes a publisher of event streams in power equipment control, a set of corresponding processors, and a consumer of the final event stream. The producer creates an observable event stream and provides a subscription method to consumers, who can subscribe to this data stream to obtain power control event streams. Once the producer has a new event stream, it sends the data to all consumers who have subscribed to that event stream. Consumers can unsubscribe to stop receiving events. This interaction decouples the producer and consumer, while also allowing consumers to obtain data on demand, thereby achieving efficient asynchronous power control.
[0042] This invention, through preset rules and algorithms, can automatically perform power dispatching and optimization, reducing the possibility of human error and improving the management efficiency of the power system. Traditional programming is sequential: if one task is not completed, it must wait until the next task is executed. Whether improving machine performance or code performance, it essentially depends on the completion of the previous task. If rapid response is required, synchronous execution must be replaced with asynchronous execution, transforming method execution into message sending. This becomes asynchronous programming, a key characteristic of reactive programming. This approach leverages the capabilities of multi-core CPUs, improves efficiency, and reduces latency and blocking.
[0043] like Figure 1-3 As shown, the method of the present invention includes the following steps:
[0044] Step 1: Define a set of data streams for device control. Generally, these can be divided into three sets of data streams: device status data stream, user control event data stream, and interval event stream.
[0045] Step 2: Define the subscribers to the data stream, which are the actual control function modules of the power equipment;
[0046] Step 3: Combine the three data streams from Step 1. The events are grouped together according to their actual occurrence. This step essentially constructs the response logic to data changes, aggregating power control logic and equipment status. The data returned from each data stream will be combined into a single data group and then filtered before being returned to subscribers.
[0047] Step 4: Once the subscriber is running, the entire device control process can begin. The subscriber will first receive the device control start event.
[0048] Step 5: Once the device control process can begin, subscribers start consuming data, and producers obtain the last data value of each array stream, combine them together, and send them to subscribers.
[0049] Step 6: After receiving the data set, the subscriber will choose the next device operation action or continue to wait for a new data set based on the device status and the latest user operation and operation interval information.
[0050] Step 7: If an error is encountered, the equipment control process is terminated and the equipment is reset.
[0051] Step 8: If a timeout occurs, the equipment control process is terminated and the equipment is reset.
[0052] Step 9: If all data streams have been sent, then the control flow is complete and the device control flow is terminated.
[0053] The asynchronous data stream specifically means that device control does not block the main process; all asynchronous streams are pushed to subscribers, enabling event-driven operation and improving the system's concurrency capabilities.
[0054] The asynchronous event stream collects data within a coroutine context, which specifically includes:
[0055] Asynchronous stream element collection is generally performed in a coroutine context, so as not to block the main process and to achieve safe and stable software functionality. For example, the collect function is called in a coroutine to collect elements.
[0056] The coroutine context when collecting elements is passed to the stream builder of the emitting elements, serving as the stream builder's context.
[0057] Asynchronous streams only invoke the code in the stream builder when collecting elements, and the stream builder also runs in the same coroutine.
[0058] The concept of flow involves splitting and aggregating information. Specifically, in reactive programming, the emphasis is no longer on "relationships," but rather on aggregating data and changes together, and aggregating processing methods together.
[0059] Cold data streams are defined as follows: once an asynchronous stream is created, it will not produce data if it is not consumed, and it will produce data multiple times if it is consumed multiple times. Production and consumption are always corresponding.
[0060] The device status data stream is specifically as follows: the state transition sequence of the power equipment: generally initialization, waiting for preset, preset successful and waiting for control, in control, control successful or failed, end;
[0061] The user control event data stream specifically refers to: power user control event data stream, which is generally preset, controlled, or canceled;
[0062] The aforementioned interval data stream specifically refers to the interval after which an operation is typically performed, such as a preset time after which an operation decision must be made within 30 seconds.
[0063] The combination of the data streams is specifically as follows:
[0064] The three data streams are defined separately and combined according to the actual order in which the data appears during runtime. When a subscriber starts consuming data, the producer reads the current values of the three data streams respectively, combines them, and sends them to the consumer.
[0065] The above is an introduction to the method embodiments. The following embodiments using electronic devices and storage media will further illustrate the solution of the present invention.
[0066] This invention also provides an electronic device including a central processing unit (CPU), which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) or loaded from a storage unit into a random access memory (RAM). The RAM may also store various programs and data required for device operation. The CPU, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0067] Multiple components in the device are connected to the I / O interface, including: input units such as keyboards and mice; output units such as various types of displays and speakers; storage units such as disks and optical discs; and communication units such as network interface cards (NICs), modems, and wireless transceivers. The communication unit allows the device to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0068] The processing unit performs the various methods and processes described above, such as the methods of the present invention. For example, in some embodiments, the methods of the present invention may be implemented as computer software programs tangibly contained in a machine-readable medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on the device via ROM and / or a communication unit. When the computer program is loaded into RAM and executed by the CPU, one or more steps of the methods of the present invention described above may be performed. Alternatively, in other embodiments, the CPU may be configured to execute the methods of the present invention by any other suitable means (e.g., by means of firmware).
[0069] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0070] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0071] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0072] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A power equipment control method based on reactive programming, characterized in that, This method leverages the asynchronous event stream feature of reactive programming to abstract the control of power equipment into a set of event streams. By combining and filtering these basic event streams, control logic for various power equipment controls can be generated. The method specifically includes the following steps: Step S1: Define a set of device control data streams, which include three sets of data streams: device status data stream, user control event data stream, and interval event stream; Step S2, define the subscribers to the data stream; Step S3: Combine the three sets of data streams from step S1 and return them to the subscribers through a filter; Step S4: Once the subscriber is running, the entire device control process can begin, and the subscriber receives the device control start event; Step S5: After the entire device control process begins, the producer obtains the last data value of each data stream, combines them together, and sends them to the subscriber. Step S6: After receiving the data group, the subscriber selects the next device operation action or continues to wait for a new data group based on the device status, the latest user operation, and operation interval information. Step S7: If an error or timeout is encountered, the equipment control process is terminated and the equipment is reset. Step S8: If all data streams have been sent, then the control process is complete and the device control process is terminated.
2. The power equipment control method based on responsive programming according to claim 1, characterized in that, In step S5, the producer creates an observable event stream and offers subscriptions to consumers, who then subscribe to this data stream to obtain the power control event stream.
3. The power equipment control method based on responsive programming according to claim 2, characterized in that, If a producer has a new event stream, it immediately sends the data to all consumers who have subscribed to that event stream.
4. The power equipment control method based on responsive programming according to claim 2, characterized in that, Consumers can stop receiving events by unsubscribing.
5. The power equipment control method based on responsive programming according to claim 1, characterized in that, The asynchronous event stream is pushed to subscribers, thus enabling event-driven operation.
6. The power equipment control method based on reactive programming according to claim 1, characterized in that, The device status data stream is specifically as follows: The state transition sequence of power equipment includes initialization, waiting for preset, preset successful and waiting for control, in control, control successful or failed, and end.
7. The power equipment control method based on responsive programming according to claim 1, characterized in that, The user control event data stream includes preset, control, or cancellation.
8. The power equipment control method based on reactive programming according to claim 1, characterized in that, The interval data stream is specifically the interval after an operation that needs to be waited for.
9. A power equipment control method based on reactive programming according to claim 1, characterized in that, The combination of the three data streams in step S3 is specifically as follows: First, define three sets of data streams separately, and then combine them according to the actual order in which each data item appears during runtime.
10. A power equipment control method based on responsive programming according to claim 9, characterized in that, When a subscriber starts consuming data, the producer reads the current values of the three data streams separately, combines them, and sends them to the consumer.
11. A power equipment control method based on reactive programming according to claim 1, characterized in that, The asynchronous event stream collects data within a coroutine context.
12. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 11.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Intelligent protection system with programmable module
CN112165066A
A linkage control system and a control method
CN109144593A
Systems and methods for reactive flattening mapping for use with microservices or other computing environments
CN115885262A
