Relay protection algorithm development method based on virtual platform, medium and system
By constructing a relay protection algorithm development system on a virtual platform, the problems of high cost and low efficiency in traditional methods are solved, achieving efficient and reliable algorithm development and debugging, and ensuring a high degree of consistency between simulation results and real devices.
Patent Information
- Application Number
- CN202511507010.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-21
- Publication Date
- 2026-01-16
AI Technical Summary
Traditional relay protection algorithm development and testing rely on expensive hardware-in-the-loop simulation systems and cumbersome hardware debugging processes, resulting in high costs and low efficiency. Furthermore, there is a semantic gap between simulation results and real devices, making it impossible to guarantee credibility.
A relay protection algorithm development system based on a virtual platform is constructed, including a virtual signal generator module, a protection algorithm module, and a virtual screen. Through virtualization technology, simulation stimulus generation, source code modification, and data interaction are realized, and iterative development and debugging can be carried out directly in the virtual environment, eliminating hardware dependence and semantic gap.
It enables low-cost and high-efficiency algorithm development and debugging, ensuring consistency between simulation results and real devices, and improving the credibility of the development process and product reliability.
Smart Images

Figure CN121348801A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application mainly relates to the technical field of power system, and particularly relates to a relay protection algorithm development method, medium and system based on a virtual platform. BACKGROUND
[0002] As a key safety device of the power system, the correctness and reliability of the algorithm of the relay protection device are crucial. The development and testing of the traditional relay protection algorithm seriously depend on the semi-physical simulation system (such as RTDS) or the special simulation device with a physical interface. Although this kind of scheme can simulate the real power grid working condition to a certain extent, it also has significant limitations: 1. Research and development cost and cycle problem: the traditional semi-physical simulation system (such as RTDS) or the virtual simulation system requiring a physical interface has huge equipment investment, and the debugging opportunity is limited, which leads to high research and development cost and cycle extension.
[0003] 2. Development and debugging efficiency problem: some simulation platforms only support function testing and cannot directly modify the source code for algorithm development; and the hardware-based debugging needs to go through the cumbersome process of "coding-cross-compiling-burning-restarting", which greatly reduces the iteration efficiency. 3. Simulation credibility and completeness problem. The graphical modeling simulation represented by MATLAB / Simulink has a "semantic gap" between the model and the final C / C++ engineering code, which cannot guarantee the complete credibility of the test results. SUMMARY
[0004] In view of the technical problems existing in the prior art, the present application provides a relay protection algorithm development method, medium and system based on a virtual platform, which greatly improves the research and development efficiency of the relay protection algorithm.
[0005] To solve the above technical problems, the technical scheme provided by the present application is as follows: A relay protection algorithm development method based on a virtual platform, comprising the following steps: S1. Establishing a system including a virtual signal generator module, a protection algorithm module and a virtual screen based on virtualization technology; S2. Generating multiple analog electrical quantity and switching quantity signals through the virtual signal generator module, and defining multiple system working conditions and their switching logic; sending the generated digitized voltage and current sampling sequence to the protection algorithm module in real time as the input excitation of the protection algorithm; S3, receiving the simulation excitation signal generated in S2 by the protection algorithm module, executing the same source code as the real embedded device; observing the algorithm running state in real time through the virtual screen, and pausing the simulation when necessary, directly modifying the source code of the protection algorithm in the virtualized operating system environment; after the modification, generating a new executable algorithm program in the virtualized operating system environment, and re-running to continue the simulation test, forming a quick closed-loop iteration of "coding- compiling- running- observing"; S4, realizing interactive observation and control through a virtualized data channel, virtualizing multiple physical communication interfaces of the protection algorithm module, and forwarding data streams to the virtual screen in real time through the virtualized data channel; the virtual screen presents data through different controls, receives user operations and converts them into instruction messages, and sends the instruction messages to the protection algorithm module in reverse through the virtualized data channel, realizing real-time intervention and closed-loop control of the algorithm program.
[0006] Preferably, in step S1, the protection algorithm module runs in a virtualized operating system environment, and the virtual signal generator module and the virtual screen run in a host operating system environment.
[0007] Preferably, in step S1, a data path is established between the virtualized operating system environment and the host operating system environment through a virtualized data channel, realizing complete decoupling of the physical hardware.
[0008] Preferably, in step S2, the simulated electrical quantities include one or more of the fundamental wave amplitude, phase, frequency, and harmonic and DC components of the voltage and current signals of each phase.
[0009] Preferably, in step S2, the switch quantity signal is used to simulate the circuit breaker position and external blocking signal.
[0010] Preferably, in step S2, the system operating conditions include normal operation state, A-phase ground fault state, and system oscillation state; the switching logic includes automatic switching according to preset time, manual triggering of switching through the virtual screen, or linkage switching according to the output quantity state fed back by the protection algorithm module.
[0011] Preferably, in step S3, a local compiler is called in the virtualized operating system environment to quickly compile the modified code.
[0012] Preferably, in step S4, the physical communication interfaces include an interface for communicating with a background master station in compliance with the IEC 60870-5-103 standard protocol, an interface for outputting debugging log information to a printer, and an interface for driving a liquid crystal display screen to update the screen.
[0013] Preferably, in step S4, the virtual screen presents data through different controls, including: designing a virtual display control specifically to receive data from the "display" interface and perform pixel-level rendering according to the received underlying drawing instructions, thereby accurately reproducing the display interface of the real device; designing a log window to display text information from the "print" interface in real time; and designing a protocol analyzer to parse and display messages from the "protocol" interface.
[0014] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, the computer program performing the steps of the method described above when run by a processor.
[0015] The present invention further discloses a relay protection algorithm development system based on a virtual platform, including a memory and a processor connected to each other. The memory stores a computer program, which executes the steps of the method described above when run by the processor.
[0016] Compared with the prior art, the advantages of the present invention are as follows: This invention integrates the entire process of protection algorithm development, testing, and debugging into a single general-purpose computer by constructing a pure software virtualized simulation and debugging environment. This achieves three core benefits: First, it completely eliminates reliance on expensive physical devices such as RTDS and dedicated interface hardware, minimizing development costs and freeing debugging opportunities from hardware resource limitations. Second, it allows direct execution of C / C++ source code identical to the real device through virtual machines or containers, supporting real-time modification, compilation, and restart testing within an IDE. This eliminates the lengthy traditional "coding-cross-compilation-burning-restart" process, significantly improving algorithm iteration efficiency. Finally, it fundamentally eliminates the "semantic gap" between graphical modeling and engineering code, ensuring a high degree of consistency between simulation test results and the actual device's behavior, greatly enhancing the credibility of the development process and the reliability of the final product. Attached Figure Description
[0017] Figure 1 This is a system architecture diagram constructed in the relay protection algorithm development method of the present invention.
[0018] Figure 2 This is a diagram illustrating an embodiment of the relay protection algorithm development method of the present invention in a specific application. Detailed Implementation
[0019] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0020] like Figure 2 As shown in the figure, the relay protection algorithm development method based on a virtual platform provided in this embodiment of the invention includes the following steps: S1. Construct a pure software simulation and debugging environment.
[0021] The method of this invention is based on a system consisting of three core software modules, specifically including: a virtual signal generator module, a protection algorithm module, and a virtual screen, such as... Figure 1 As shown.
[0022] The protection algorithm module runs in an independent virtualized operating system environment (such as a virtual machine, container, or operating system subsystem), while the virtual signal generator module and virtual screen run in the host operating system environment. Through virtualized data channel technologies (such as virtual serial port mapping and virtual network adapters), a stable and efficient data path is established between the two heterogeneous operating system environments, providing a foundation for subsequent closed-loop simulation and debugging.
[0023] This step achieves complete decoupling from the physical hardware, allowing all debugging work to be done on a single general-purpose computer.
[0024] S2. Configure and generate simulation excitation signals.
[0025] This step provides controllable input stimulation to the protection algorithm module through a virtual signal generator module.
[0026] S201. In the graphical interface of the virtual signal generator module, multiple simulated electrical quantities can be configured in detail, including but not limited to the fundamental amplitude, phase, and frequency of each phase voltage and current signal, as well as parameters such as harmonics and DC components, thereby accurately simulating various complex power grid signals. At the same time, the status of multiple switching quantities (DI) can be configured to simulate circuit breaker positions, external blocking signals, etc.
[0027] S202. To simulate the dynamic development of faults, this module supports defining multiple independent system operating conditions (states), such as normal operation, phase A ground fault, and system oscillation. The switching logic between these states can be flexibly configured, including automatic switching at preset times, manual switching triggered via a virtual screen, or linkage switching based on the output (DO) status fed back by the protection algorithm module.
[0028] S203. After the signal generation function is activated, this module will calculate and generate a digital voltage and current sampling sequence in real time according to the current operating condition configuration. This sequence is continuously sent to the protection algorithm module through a virtualized data channel as the data source for its protection calculations.
[0029] S3. Execute, debug, and iteratively develop the protection algorithm.
[0030] This step is the core of the method of this invention, realizing a closed loop of source code-level development and debugging of the algorithm.
[0031] S301, the protection algorithm module receives the simulation excitation signal from the virtual signal generator module and executes the internal relay protection logic.
[0032] To ensure the high reliability of the debugging results, this module directly loads and runs the exact same C / C++ project source code that is ultimately deployed in a real embedded device, eliminating the differences between the model and the code.
[0033] S302. Developers can observe the algorithm's running status and preliminary calculation results in real time through a virtual screen. If the algorithm's behavior does not meet expectations, or if functional optimization or logic additions are required, the simulation can be paused at any time, and the C / C++ source code of the protected algorithm can be modified directly in the virtualized operating system environment using an integrated development environment (IDE) or a text editor.
[0034] S303. After the source code is modified, developers do not need to go through the cumbersome cross-compilation and hardware flashing process. They can directly call the local compiler (such as GCC) in the virtualized operating system environment to quickly compile the modified code and generate a new executable algorithm program that can run in the environment.
[0035] S304. Immediately rerun the newly generated algorithm program, seamlessly connecting steps S2 and S4, to continue simulation testing. This rapid closed-loop iterative process of "encoding-compiling-running-observation" greatly shortens the algorithm development and debugging cycle.
[0036] S4. Interactive observation and control are achieved through virtualized data channels.
[0037] This step provides developers with comprehensive and intuitive observation tools and flexible control capabilities.
[0038] S401, the protection algorithm module virtualizes the functions of its internal physical communication interfaces (such as serial ports) used for data exchange with external devices. These interfaces perform different functions in the actual device, such as an interface for communicating with the back-end master station in accordance with standard protocols such as IEC60870-5-103, an interface for outputting debugging log information to the printer, and an interface for driving the LCD screen to update the screen.
[0039] S402. Using virtualization data channel technology, the data streams of all the above virtualization interfaces are forwarded to the virtual screen in the host operating system environment in real time and transparently. Each virtualization interface corresponds to an independent data channel.
[0040] S403. Virtual screens receive and present data from different virtualization interfaces through various functional controls. For example, design a virtual display control specifically to receive data from the "Display" interface and perform pixel-level rendering based on the received underlying drawing instructions, thereby accurately reproducing the display interface of the real device; design a log window to display text information from the "Print" interface in real time; and design a protocol analyzer to parse and display messages from the "Protocol" interface.
[0041] S404. All user operations on the virtual screen, such as menu navigation via simulated buttons, modification of protection settings, and issuance of reset or time synchronization control commands, are converted into corresponding instruction messages by this module. These messages are then sent back to the virtualization interface corresponding to the protection algorithm module via the virtualization data channel, thereby enabling real-time intervention, parameter tuning, and closed-loop control of the algorithm program.
[0042] This invention integrates the entire process of protection algorithm development, testing, and debugging into a single general-purpose computer by constructing a pure software virtualized simulation and debugging environment. This achieves three core benefits: First, it completely eliminates reliance on expensive physical devices such as RTDS and dedicated interface hardware, minimizing development costs and freeing debugging opportunities from hardware resource limitations. Second, it allows direct execution of C / C++ source code identical to the real device through virtual machines or containers, supporting real-time modification, compilation, and restart testing within an IDE. This eliminates the lengthy traditional "coding-cross-compilation-burning-restart" process, significantly improving algorithm iteration efficiency. Finally, it fundamentally eliminates the "semantic gap" between graphical modeling and engineering code, ensuring a high degree of consistency between simulation test results and the actual device's behavior, greatly enhancing the credibility of the development process and the reliability of the final product.
[0043] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, the computer program performing the steps of the method described above when run by a processor.
[0044] The present invention further discloses a relay protection algorithm development system based on a virtual platform, including a memory and a processor connected to each other. The memory stores a computer program, which executes the steps of the method described above when run by the processor.
[0045] The medium and system of the present invention, corresponding to the methods described above, also have the advantages described above.
[0046] The present invention can implement all or part of the processes in the methods of the above embodiments, or it can be implemented by hardware related to computer program instructions. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable storage medium includes: any entity or device capable of carrying computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. The memory is used to store computer programs and / or modules. The processor implements various functions by running or executing the computer programs and / or modules stored in the memory, and by calling data stored in the memory. The memory may include high-speed random access memory, as well as non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart media cards (SMC), secure digital (SD) cards, flash cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.
[0047] The above are merely preferred embodiments of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should be considered within the scope of protection of the present invention.
Claims
1. A method for developing a relay protection algorithm based on a virtual platform, characterized in that, The method comprises the following steps: S1, establishing a system comprising a virtual signal generator module, a protection algorithm module and a virtual screen based on virtualization technology; S2, generating multiple analog electrical quantity and switching quantity signals through the virtual signal generator module, and defining multiple system operating conditions and switching logic thereof; sending the generated digitized voltage and current sampling sequences to the protection algorithm module in real time as input excitation of the protection algorithm; S3, receiving the simulation excitation signals generated in S2 through the protection algorithm module, executing the same source code as the real embedded device; observing the algorithm running state through the virtual screen in real time, and pausing the simulation when necessary, directly modifying the source code of the protection algorithm in the virtualization operating system environment; after the modification, generating a new executable algorithm program in the virtualization operating system environment, and re-running to continue the simulation test, forming a quick closed-loop iteration of "coding- compiling- running- observation"; S4, realizing interactive observation and control through a virtualization data channel, virtualizing multiple physical communication interfaces of the protection algorithm module, and forwarding the data stream to the virtual screen in real time through the virtualization data channel; the virtual screen presents the data through different controls, receives user operations and converts them into instruction messages, and sends the instruction messages to the protection algorithm module in reverse through the virtualization data channel, realizing real-time intervention and closed-loop control on the algorithm program.
2. The virtual platform based relay protection algorithm development method according to claim 1, characterized in that, In step S1, the protection algorithm module runs in a virtualization operating system environment, and the virtual signal generator module and the virtual screen run in a host operating system environment.
3. The virtual platform based relay protection algorithm development method according to claim 2, characterized in that, In step S1, a data path is established between the virtualization operating system environment and the host operating system environment through a virtualization data channel, realizing complete decoupling from physical hardware.
4. The virtual platform based relay protection algorithm development method according to claim 1 or 2 or 3, characterized in that, In step S2, the analog electrical quantity comprises one or more of the fundamental wave amplitude, phase, frequency, and harmonic and DC component of each phase voltage and current signal; and the switching quantity signal is used to simulate the circuit breaker position and external blocking signal.
5. The virtual platform based relay protection algorithm development method according to claim 1 or 2 or 3, characterized in that, In step S2, the system operating conditions comprise a normal operating state, an A-phase ground fault state, and a system oscillation state; and the switching logic comprises automatic switching according to a preset time, manual triggering of switching through the virtual screen, or linkage switching according to the output state of the protection algorithm module.
6. The virtual platform based relay protection algorithm development method according to claim 1 or 2 or 3, characterized in that, In step S3, the modified code is quickly compiled by calling a local compiler in the virtualization operating system environment.
7. The virtual platform based relay protection algorithm development method according to claim 1 or 2 or 3, characterized in that, In step S4, the physical communication interfaces comprise an interface for communicating with a background master station in compliance with the IEC 60870-5-103 standard protocol, an interface for outputting debugging log information to a printer, and an interface for driving a liquid crystal display screen to update a picture.
8. The virtual platform based relay protection algorithm development method according to claim 1 or 2 or 3, characterized in that, In step S4, the virtual screen presents data through different controls, which comprises: designing a virtual display control to specially receive data from a "display" interface, and performing pixel-level rendering according to the received underlying drawing instructions, so as to accurately reproduce the display interface of the real device; designing a log window to display text information from a "print" interface in real time; and designing a protocol analyzer to analyze and display messages from a "protocol" interface.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, which when executed by a processor, performs the steps of the method as claimed in any one of claims 1-8.
10. A virtual platform based relay protection algorithm development system comprising a memory and a processor connected to each other, wherein the memory has stored thereon a computer program, characterized in that, The computer program, which when executed by a processor, performs the steps of the method as claimed in any one of claims 1-8.
Citation Information
Patent Citations
Method for simulating multi-CUP synchronous operation of relay protection device through PC
CN104063266A
Microcomputer relay protection device simulator system
CN106227065A
Application compiling method and device, computing equipment and storage medium
CN115185531A
Relay protection simulation training method and system, electronic equipment and storage medium
CN119400019A
Embedded software simulation scheduling system and method for relay protection device
CN119960943A