A method and system for real-time saving and loading of simulation working conditions

By saving and loading operating conditions in real time during AC/DC simulation, and automatically adjusting the operating conditions using structures and callback functions, the problem of time-consuming operating condition switching is solved, achieving fast and accurate operating condition state switching and improving simulation efficiency.

CN115906478BActive Publication Date: 2026-03-27STATE GRID NINGXIA ELECTRIC POWER CO +2
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-18
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

In AC/DC simulation, the adjustment of operating condition switching parameters is cumbersome, unstable, and time-consuming. Existing technologies require manual adjustment, which is also time-consuming.

Method used

A method and system for real-time saving and loading of simulation conditions are adopted. By monitoring external commands in each clock cycle, the operating conditions are automatically loaded or saved. Functional objects are defined and nested using structures, and callback functions are triggered to achieve rapid switching of operating conditions.

Benefits of technology

It enables rapid and accurate switching of operating conditions, saves simulation time, improves work efficiency, and is suitable for simulation debugging and experimental teaching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115906478B_ABST
    Figure CN115906478B_ABST
Patent Text Reader

Abstract

A method and system for saving and loading real-time working conditions in simulation: the method comprises the following steps: step 1, compiling and starting a simulation program, designing a function object data structure of the simulation program as a structure, and ensuring that the memory of the function object is continuous; step 2, monitoring external instructions at the beginning of each clock cycle of the simulation running, and judging whether to load the working condition; if yes, the working condition is loaded; otherwise, the running is continued; step 3, monitoring external instructions before the end of each clock cycle of the simulation running, and judging whether to save the working condition; if yes, the working condition is saved; otherwise, the running is continued; step 4, triggering a callback function to load the working condition according to the condition of an internal variable when a task is executed in each clock cycle of the simulation running; and step 5, triggering a callback function to save the working condition according to the condition of an internal variable when a task is executed in each clock cycle of the simulation running. The saving and loading of the working condition can realize quick switching of the simulation state, greatly save simulation test time, and improve work efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of AC / DC simulation, and particularly relates to a method and system for simulating working condition real-time saving and loading. BACKGROUND

[0002] In the process of AC / DC simulation, due to the complex electrical structure, large amount of electrical quantity data, and changing simulation section, the simulation program is in the initial state after starting. In order to reach a certain working condition, a series of complex operations need to be performed, and a long time may need to be waited. This wastes valuable time in the simulation test process. A method is needed to quickly switch to the desired working condition, at least without waiting for the working condition switching time each time in repeated tests. Therefore, the present application is generated, which realizes quick working condition switching, saves simulation time, and improves work efficiency by quickly saving and loading the working condition.

[0003] Prior art 1 (CN108363846A) discloses an "electromagnetic DC model automatic adjustment method and system based on hybrid simulation", which comprises: obtaining initial running condition information from electromagnetic side power flow data, assigning initial values to the initialization information elements of the pre-established electromagnetic DC model; adjusting the current running state of the electromagnetic DC model based on the control process parameters of each information element in the initial running condition information; when the adjusted current running state data and the electromagnetic side power flow data are consistent, the clamping power on the converter bus is cut off, so that the electromagnetic DC model and the electromechanical side power grid form a closed loop through the hybrid simulation interface, and the hybrid simulation is started. The deficiency of the prior art document 1 is that the parameters need to be manually adjusted to be consistent with the electromagnetic side power flow data, which often requires professional technology and experience, and has a certain time process. The present application directly reaches the desired working condition in one step by loading the saved working condition file, and the state values are accurate and accurate, without manual adjustment and almost no time consumption. SUMMARY

[0004] To solve the problems in the prior art, the present application provides a method and system for simulating working condition real-time saving and loading, which solves the problems of troublesome, unstable parameter adjustment process, and long waiting time in the process of AC / DC simulation test; and can automatically load the working condition according to the running state without human intervention

[0005] The present application adopts the following technical solutions.

[0006] A method for simulating working condition real-time saving and loading, comprising the following steps:

[0007] Step 1, compiling and starting the simulation program, designing the function object data structure of the simulation program as a structure to ensure the memory continuity of the function object;

[0008] Step 2, at the beginning of each clock cycle of the simulation running, monitor the external instruction, determine whether to load the working condition, yes, load the working condition, no, continue running;

[0009] Step 3, before the end of each clock cycle of the simulation running, monitor the external instruction, determine whether to save the working condition, yes, save the working condition, no, continue running;

[0010] Step 4, when executing tasks in each clock cycle of the simulation running, trigger the callback function to load the working condition according to the internal variable condition;

[0011] Step 5, when executing tasks in each clock cycle of the simulation running, trigger the callback function to save the working condition according to the internal variable condition.

[0012] Preferably, in step 1, the function object is defined by a structure, and the function object is allowed to be nested.

[0013] Preferably, in step 2, at the beginning of each clock cycle, monitor the external instruction to determine whether to load the working condition; yes, load the specified working condition, and copy the working condition data read to the function object memory space.

[0014] Preferably, in step 3, before the end of each clock cycle, monitor the external instruction to determine whether to save the working condition; yes, save the function object memory data of the current clock cycle as the specified working condition.

[0015] Preferably, in step 4, when the callback function is triggered by the load working condition condition, the specified working condition can be loaded at a certain step of the task execution in the current clock cycle, and the working condition data is read and copied to the function object memory space and the task is continued.

[0016] Preferably, in step 5, when the callback function is triggered by the save working condition condition, the specified working condition can be saved at a certain step of the task execution in the current clock cycle, and the data at this moment is saved as the specified working condition and the task is continued.

[0017] Preferably, the external instruction monitoring triggers the load working condition at the beginning of each clock cycle, and the external instruction monitoring triggers the save working condition before the end of each clock cycle.

[0018] The internal variable condition triggers the load or save working condition can occur at any time within the clock cycle, without waiting for the beginning or end of the clock cycle.

[0019] A simulation working condition real-time saving and loading system, comprising: an initialization module, a load determination module, a save determination module, and an in-cycle callback module, wherein:

[0020] The initialization module is used to compile and start the simulation program, and the function object data structure of the simulation program is designed as a structure to ensure the continuity of the function object memory.

[0021] The loading judging module is used for monitoring external instructions at the beginning of each clock cycle of the simulation running, judging whether to load the working condition, and if yes, loading the working condition, and if no, continuing the running;

[0022] The saving judging module is used for monitoring external instructions before the end of each clock cycle of the simulation running, judging whether to save the working condition, and if yes, saving the working condition, and if no, continuing the running;

[0023] The periodical callback module is used for triggering a callback function to load the working condition according to an internal variable condition when executing a task in each clock cycle of the simulation running, and triggering a callback function to save the working condition according to an internal variable condition.

[0024] A terminal comprises a processor and a storage medium; wherein:

[0025] The storage medium is used for storing instructions;

[0026] The processor is used for operating according to the instructions to execute steps of a method for saving and loading a simulation working condition in real time.

[0027] A computer readable storage medium, which stores a computer program, wherein the program is executed by a processor to implement steps of a method for saving and loading a simulation working condition in real time.

[0028] The present application has the advantages that, compared with the prior art,

[0029] After the simulation running reaches a working condition state, the current working condition state simulation system memory data can be saved and output to a file, at any stage of the simulation running, the saved working condition file can be loaded to directly enter the saved working condition state, since it is memory data restoration, all parameter and variable values in the simulation system at the saved working condition state can be accurately restored, that is, completely consistent with the saved working condition; the process of manually adjusting and restoring the working condition state is faster and more accurate; the simulation system can be triggered to save the working condition at any time during the running stage after initialization by manual triggering or according to condition judgment; moreover, multiple working condition files can be saved, and there is theoretically no upper limit; and switching to any saved working condition only needs to load the corresponding working condition file; the loaded working condition can be loaded at the initialization of the simulation system, or manually triggered to load or automatically loaded according to condition judgment at any time during the running process, the flexible saving and loading working condition method and system effectively solve the problems of slow simulation running working condition switching speed, repeated switching time consumption, inaccurate working condition switching, etc., save simulation test time, improve work efficiency, and are very beneficial to simulation debugging and experimental teaching activities. BRIEF DESCRIPTION OF DRAWINGS

[0030] Figure 1 is a functional object structure in the present application.

[0031] Figure 2 is the working condition data saving in the present application;

[0032] Figure 3 is the working condition data loading in the present application;

[0033] Figure 4 is the data communication between the simulation program and the user operation process in the present application;

[0034] Figure 5 is the method flow chart of the simulation working condition real-time saving and loading in the present application; DETAILED DESCRIPTION

[0035] In order to make the purpose, technical scheme and advantages of the present application more clear, the technical scheme of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. The embodiments described in the present application are only a part of the embodiments of the present application, but not all the embodiments. Based on the spirit of the present application, other embodiments obtained by those skilled in the art without making creative efforts fall within the protection scope of the present application.

[0036] Embodiment 1.

[0037] A method for saving and loading simulation working condition in real time. As shown in Figure 5 , the method comprises the following steps:

[0038] Step 1, compiling and starting the simulation program, designing the function object data structure of the simulation program as a structure body, and ensuring the memory of the function object to be continuous;

[0039] In the embodiment, the function object is preferably defined by a structure body, and the function object is allowed to be nested.

[0040] Step 2, at the beginning of each clock cycle of the simulation running, monitoring the external instruction, judging whether to load the working condition, if yes, loading the working condition, and if no, continuing to run;

[0041] At the beginning of each clock cycle, the external instruction is monitored, and it is judged whether to load the working condition; if yes, the specified working condition is loaded, and the working condition data is read and copied to the memory space of the function object.

[0042] Step 3, before the end of each clock cycle of the simulation running, monitoring the external instruction, judging whether to save the working condition, if yes, saving the working condition, and if no, continuing to run;

[0043] Before the end of each clock cycle, the external instruction is monitored, and it is judged whether to save the working condition; if yes, the memory data of the function object in the current clock cycle is saved as the specified working condition.

[0044] Step 4, when the simulation runs each clock cycle, the callback function is triggered according to the internal variable condition to load the working condition;

[0045] The embodiment preferably, when the working condition condition meets the trigger callback function, the specified working condition can be loaded when the task is executed to a certain step in the current clock cycle, the working condition data is copied to the memory space of the function object, and the task is continued to be executed.

[0046] Step 5, when the simulation runs each clock cycle, the callback function is triggered according to the internal variable condition to save the working condition.

[0047] The embodiment preferably, when the working condition condition meets the trigger callback function, the specified working condition can be loaded when the task is executed to a certain step in the current clock cycle, the working condition data is copied to the memory space of the function object, and the task is continued to be executed.

[0048] The external instruction monitoring trigger loads the working condition at the beginning of each clock cycle, and the external instruction monitoring trigger saves the working condition before the end of each clock cycle;

[0049] The internal variable condition trigger loads or saves the working condition can occur at any time within the clock cycle, and does not need to wait until the beginning or end of the clock cycle.

[0050] According to the need, on the basis of the internal variable condition, the saving of the working condition can be triggered after a delay of one or more clock cycles, and the loading of the working condition can be triggered after a delay of one or more clock cycles.

[0051] Embodiment 2.

[0052] An example of a method for simulating real-time saving and loading of working conditions, as shown in Figure 5 , includes the following steps:

[0053] Step 1, as shown in the accompanying Figure 1 , the simulation program is compiled and started; wherein the function objects of the simulation program are organized according to the structure, the simulation program contains a top-level function object, which is nested inside the sub-function object, and the function object stores data.

[0054] Step 2, remote adjustment parameter, after the simulation program runs to the specified working condition, the simulation background operation saves the working condition, and the specified working condition name is specified; the working condition refers to the running state of the simulation program; wherein the simulation background refers to the power system monitoring background, which is used to display and control the running state of the equipment in the substation, which is used to display and control the running state of the simulation running program; the control includes remote control and remote adjustment.

[0055] Step 3, the simulation program monitors and receives the simulation background save working condition instruction, as shown in Figure 4 ; according to the instruction, the current cross-section function object memory data is saved to the specified working condition file before the end of the current clock cycle, and the running is continued; as shown in the accompanyingFigure 2 ;

[0056] Wherein, the clock cycle refers to the task cycle of the simulation program, the simulation program is run in cycles, and the running cycle is a multiple of the clock cycle. There are multiple tasks in a simulation program, and the running cycle of each task can be set as needed;

[0057] The current section refers to the memory data state of the simulation program running in the current clock cycle.

[0058] Step 4, in order to verify the correctness of the working condition saving and the correctness of the working condition loading, restart the simulation program, after initialization is completed, the simulation background operation loads the working condition and loads the working condition file saved in the last step, as shown in the attached Figure 3 ;

[0059] Step 5, the simulation program monitors and receives the simulation background loading working condition instruction, as shown in Figure 4 Load the working condition file specified by the simulation background at the beginning of the current clock cycle or the beginning of the next clock cycle, and map the working condition memory data to the simulation program function object, and continue to run;

[0060] Step 6, the simulation background operation stops the simulation, checks the invalid monitoring data of the simulation background, and checks the simulation process exit; stopping the simulation includes manual triggering and automatic triggering according to conditions; manual triggering refers to triggering through monitoring background or other software remote control; automatic triggering according to conditions refers to triggering when the simulation program runs to the specified condition; invalid monitoring data refers to that the monitoring background cannot receive the state data sent by the simulation program within a certain time.

[0061] Preferably, in the embodiment, the simulation program is automatically triggered to save the working condition after running for 10 minutes, the simulation program is started, and after waiting for 10 minutes of simulation time, the working condition saving file is checked, and is named according to the date and time;

[0062] Preferably, in the embodiment, the simulation program is automatically triggered to load the working condition after running for 1 minute, the simulation program is restarted, and after waiting for 1 minute of simulation time, the background monitoring checks whether it is switched to the state after running for 10 minutes;

[0063] Preferably, in the embodiment, the simulation program variable a rising edge triggers the saving of the working condition, the simulation program is started, the background monitoring is remotely controlled to execute the rising edge of the a variable changing from 0 to 1, the working condition saving file is checked to confirm that the working condition saving is triggered, and is named according to the date and time;

[0064] Preferably, in the embodiment, the simulation program variable b rising edge triggers the loading of the working condition, the simulation program is started, the background monitoring is remotely controlled to execute the rising edge of the b variable changing from 0 to 1, and the monitoring background data is checked to confirm that the working condition loading is triggered successfully;

[0065] Embodiment 3.

[0066] An emulation working condition real-time saving and loading system, comprising: an initialization module, a loading judgment module, a saving judgment module, and a period callback module, wherein:

[0067] The initialization module is used for compiling and starting an emulation program, and the function object data structure of the emulation program is designed as a structure body to ensure the memory continuity of the function object.

[0068] The loading judgment module is used for monitoring external instructions at the beginning of each clock cycle of the emulation running, judging whether to load the working condition, and if yes, loading the working condition, and if no, continuing to run.

[0069] The saving judgment module is used for monitoring external instructions before the end of each clock cycle of the emulation running, judging whether to save the working condition, and if yes, saving the working condition, and if no, continuing to run.

[0070] The period callback module is used for triggering a callback function to load the working condition according to the internal variable condition when executing a task in each clock cycle of the emulation running, and triggering a callback function to save the working condition according to the internal variable condition.

[0071] Embodiment 4.

[0072] The embodiment 4 of the present application provides a computer readable storage medium.

[0073] A computer readable storage medium, which stores a program, and the program is executed by a processor to realize the steps in the method for saving and loading the emulation working condition in real time according to the embodiment 1 of the present application.

[0074] The detailed steps are the same as the method for saving and loading the emulation working condition in real time provided in the embodiment 1, and will not be repeated here.

[0075] Embodiment 5.

[0076] The embodiment 5 of the present application provides an electronic device.

[0077] An electronic device, comprising a memory, a processor, and a program stored in the memory and executable on the processor, and the processor executes the program to realize the steps in the method for saving and loading the emulation working condition in real time according to the embodiment 1 of the present application.

[0078] The detailed steps are the same as the method for saving and loading the emulation working condition in real time provided in the embodiment 1, and will not be repeated here.

[0079] The beneficial effects of the present application are that, compared with the prior art, the present application can save the current working condition state simulation system memory data and output to a file after simulating running to a certain working condition state, and at any stage of simulation running, by loading the saved working condition file, the saved working condition state can be directly entered, and since it is memory data restoration, all parameter and variable values in the simulation system at the saved working condition state can be accurately restored, that is, completely consistent with the saved working condition; it is faster and more accurate than the manual adjustment of the restored working condition state process; the simulation system can save the working condition at any time after the initialization running stage by manual triggering or according to the condition judgment; moreover, multiple working condition files can be saved, and there is no upper limit in theory; and switching to any saved working condition only needs to load the corresponding working condition file; the working condition loading can be loaded at the initialization of the simulation system, or manually triggered to load or automatically loaded according to the condition judgment at any time during the running process, the flexible saving and loading working condition method and system effectively solve the problems of slow simulation running working condition switching speed, repeated switching time consumption, inaccurate working condition switching and the like, save the simulation test time, improve the work efficiency; it is very beneficial to simulation debugging and experimental teaching activities. The present disclosure can be a system, a method and / or a computer program product. The computer program product can include a computer readable storage medium having computer readable program instructions loaded thereon for causing a processor to implement various aspects of the present disclosure.

[0080] The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium can be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanism that encodes instructions on a medium, such as a punch card or a hole in a groove, and any suitable combination of the foregoing. The computer readable storage medium used here is not to be interpreted as a transitory signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated through a waveguide or other transmission medium (for example, an optical pulse through an optical fiber cable), or an electrical signal transmitted through a wire.

[0081] Computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network can comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.

[0082] Computer readable program instructions for carrying out operations of the present disclosure can be assembly instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions can execute entirely on the user's computing device, partly on the user's computing device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computing device, for example, through the Internet using an Internet Service Provider. In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present disclosure.

[0083] Finally, it should be noted that the above-mentioned embodiments are merely intended for describing and illustrating, but not limiting the technical solutions of the present application. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that the specific embodiments of the present application can be modified or replaced by equivalents without departing from the spirit and scope of the present application, and any modification or equivalent replacement without departing from the spirit and scope of the present application should be covered within the protection scope of the claims of the present application.

Claims

1. A method for simulating working condition real-time saving and loading, characterized in that, The method comprises the following steps: Step 1, compiling and starting the simulation program, designing the function object data structure of the simulation program as a structure, ensuring the memory continuity of the function object, in step 1, the function object is defined by using the structure, and the function object is allowed to be nested; Step 2, at the beginning of each clock cycle of the simulation running, monitoring the external instruction, judging whether the working condition is loaded, yes, loading the working condition, no, continuing to run, in step 2, at the beginning of each clock cycle, the external instruction is monitored, and it is judged whether the working condition is loaded; yes, the specified working condition is loaded, and the working condition data is read and copied to the memory space of the function object; Step 3, before the end of each clock cycle of the simulation running, monitoring the external instruction, judging whether the working condition is saved, yes, saving the working condition, no, continuing to run; Step 4, when executing the task in each clock cycle of the simulation running, triggering the callback function to load the working condition according to the internal variable condition; Step 5, when executing the task in each clock cycle of the simulation running, triggering the callback function to save the working condition according to the internal variable condition.

2. The method of claim 1, wherein, in step 3, the external instruction is monitored before the end of each clock cycle, and it is judged whether the working condition is saved; yes, the memory data of the function object in the current clock cycle is saved as the specified working condition.

3. The method of claim 1, wherein, in step 4, when the callback function is triggered by the loading working condition condition, the specified working condition can be loaded when the task in the current clock cycle is executed to a certain step, the working condition data is read and copied to the memory space of the function object, and the task is continued to be executed.

4. The method of claim 1, wherein, in step 5, when the callback function is triggered by the saving working condition condition, the working condition can be saved when the task in the current clock cycle is executed to a certain step, the data at this moment is saved as the specified working condition, and the task is continued to be executed.

5. The method of claim 1, wherein, the external instruction monitoring triggers the loading working condition at the beginning of each clock cycle, and the external instruction monitoring triggers the saving working condition before the end of each clock cycle; The internal variable condition triggers the loading or saving working condition, which can occur at any time within the clock cycle, and does not need to wait until the beginning or end of the clock cycle. The initialization module, the loading judgment module, the saving judgment module, and the period callback module, wherein: The initialization module is used for compiling and starting the simulation program, and designing the function object data structure of the simulation program as a structure, so as to ensure the memory continuity of the function object; The loading judgment module is used for monitoring the external instruction at the beginning of each clock cycle of the simulation running, judging whether the working condition is loaded, yes, loading the working condition, no, continuing to run; The saving judgment module is used for monitoring the external instruction before the end of each clock cycle of the simulation running, judging whether the working condition is saved, yes, saving the working condition, no, continuing to run; 6. A system for real-time saving and loading of a simulation scenario using the method of any one of claims 1-5, comprising: The period callback module is used for triggering the callback function to load the working condition according to the internal variable condition when executing the task in each clock cycle of the simulation running. ​ ​ ​ The period callback module is used to trigger the callback function loading working condition according to the internal variable condition when the simulation runs the task in each clock cycle; and trigger the callback function saving working condition according to the internal variable condition. 7.A terminal, comprising a processor and a storage medium; characterized in that: The storage medium is used to store instructions; The processor is used to operate according to the instructions to perform the steps of the method for saving and loading working condition in real time according to any one of claims 1-5.

8. A computer readable storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to realize the steps of the method for saving and loading working condition in real time according to any one of claims 1-5.

Citation Information

Patent Citations

  • Hybrid simulation-based electromagnetic direct-current model automatic adjustment method and system

    CN108363846A