CN104331526A - Method of achieving snapshot function through digital simulation program - Google Patents

Method of achieving snapshot function through digital simulation program Download PDF

Info

Publication number
CN104331526A
CN104331526A CN201310308672.4A CN201310308672A CN104331526A CN 104331526 A CN104331526 A CN 104331526A CN 201310308672 A CN201310308672 A CN 201310308672A CN 104331526 A CN104331526 A CN 104331526A
Authority
CN
China
Prior art keywords
variable
buffer memory
address offset
nstorx
memory array
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201310308672.4A
Other languages
Chinese (zh)
Inventor
张翔
田杰
陈宏君
程璐璐
黄志岭
刘克金
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NR Electric Co Ltd
NR Engineering Co Ltd
Original Assignee
NR Electric Co Ltd
NR Engineering Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NR Electric Co Ltd, NR Engineering Co Ltd filed Critical NR Electric Co Ltd
Priority to CN201310308672.4A priority Critical patent/CN104331526A/en
Publication of CN104331526A publication Critical patent/CN104331526A/en
Pending legal-status Critical Current

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method of achieving a snapshot function through a digital simulation program. The method comprises the following steps of carrying out a variable declaration stage of additionally declaring a specific address offset variable for each variable which needs to be cached; carrying out a normal initialization stage of respectively initializing each variable which needs to be cached and storing an address offset of the current storage space by utilizing the specific address offset variable thereof; carrying out a simulating calculation stage of updating a newest variable value in the storage space after each variable which needs to be cached completes logical operation; carrying out the initialization stage from a snapshot file, and initializing the address offset of the specific address offset variable, which is stored in the current space, by a content in the storage space when each variable is initialized. According to the method, all variables which need to be cached can be precisely accessed in a cache array for the complicated digital simulation program provided with a time scheduling mechanism, so that disorder of corresponding relation cannot occur, and the seamless snapshot function is truly achieved.

Description

A kind of numerical simulation program realizes the method for snapshot functions
Technical field
The invention belongs to digital simulation technique field, particularly a kind of numerical simulation program realizes the method for snapshot functions.
Background technology
EMTDC(Electro-Magnetic Transient in DC system) be an electromagnetic transient in power system simulation analysis software, it has accurate and abundant power system component model, easily data entry mode and powerful data analysis function, be the powerful carrying out Power System Analysis and engineering research, have a wide range of applications in worldwide.
EMTDC simulation software has snapshot (snapshot) function, snapshot functions be in simulation calculation sometime to the abbreviation of breakpoint data image save and restore feature.EMTDC simulation software allow realistic model in operational process, carry out snapshot operation, preserve certain emulation the moment breakpoint mirror image data, and under the model a simulation run time from this breakpoint mirror image data initial proceed emulation.
For offline digital simulation software, snapshot functions is a kind of very useful function.It can avoid, emulating early stage at every turn, carrying out unnecessary double counting, can improving the work efficiency of Multi simulation running computing widely.
The basic implementation method of snapshot functions is: in simulated program, define a buffer memory array STORX(as shown in Figure 1), be specifically designed to all variate-values needing mirror image to preserve when being stored in snapshot.In each time step of simulation calculation, simulated program all can go the content upgrading buffer memory array with the last look calculated.When carrying out snapshot operation in simulation process, the content in buffer memory array can automatically all be saved in the snapshot document (snapshot file) on computing machine local disk by simulation software, i.e. " saving scene ".When upper once continuation emulation initial from snapshot document, the content of snapshot document can automatically be read in buffer memory array STORX again by simulation software successively, i.e. " restoring scene ", then all variablees needing mirror image to preserve poke group of all postponing carries out initialization, instead of carries out initialization from the initial value program.After completing poke group initialization of postponing, then proceed simulation calculation and just can reach effect from the initial emulation of breakpoint mirror image data.
The simulation process of digital simulation software is in fact the implementation of emulated program code.If the interrelated logic of each variable is performed one time in each time step of simulation calculation, the execution sequence so between each variable remains constant.According to this feature, the concrete methods of realizing of numerical simulation program snapshot functions is as follows:
In the variable declarations stage, for snapshot functions states an address offset quantitative change amount NSTORX, for recording the position of current variable in buffer memory array (as shown in Figure 1).
At normal initial phase (as shown in Figure 2), eachly initial value respective in the variable program of buffer memory is needed to carry out initialization respectively: var1=init_var1, var2=init_var2 ..., varn=init_varn.
In the simulation calculation stage (as shown in Figure 3), variable 1 completes oneself logical operation (var1=f1(x)) after, by the up-to-date value obtained stored in (STORX [NSTORX]=var1) in the storage space in buffer memory array pointed by address offset amount NSTORX, then address offset amount NSTORX is added 1(NSTORX=NSTORX+1), point to next storage space; Then, variable 2 is at completion logic computing (var2=f2(x)) after, by the up-to-date value obtained stored in (STORX [NSTORX]=var2) in the storage space in buffer memory array pointed by NSTORX, then address offset amount NSTORX is added 1(NSTORX=NSTORX+1 again), point to next storage space again, the rest may be inferred, until all programs all execute in this time step.Then, simulation time label t enters the simulation calculation process of next round again after adding simulation time step-length △ t.In each simulation time step-length, when the corresponding logical operation of performance variable 1, all the value of NSTORX is made zero (NSTORX=0).
Initial phase (as shown in Figure 4) is being carried out from snapshot document, during variable 1 initialization, first address offset amount is initialized as 0(NSTORX=0), then the content in the storage space in buffer memory array pointed by NSTORX is read, to variable 1 initialize (var1=STORX [NSTORX]), then address offset amount NSTORX is added 1(NSTORX=NSTORX+1), point to next storage space; Then, the content in the storage space in buffer memory array pointed by NSTORX is read, to variable 2 initialize (var2=STORX [NSTORX]), then address offset amount NSTORX is added 1(NSTORX=NSTORX+1), point to next storage space; The rest may be inferred, until all variablees all complete initialization.
As can be seen from above-mentioned snapshot implementing method, the position that each variable stores in buffer memory array is one " relative position ", namely relative to the next position of previous variable.Ensure that the effective prerequisite of this method is in each time step in simulation calculation stage and carries out initial phase from snapshot document, the code execution sequence of each variable remains unchanged.
But, the deep utilization of digital simulation software thereupon, simulated program possibility more complicated, with time scheduling mechanism in some simulated program, namely in some time step, these simulated programs are performed, and these simulated programs are not performed in other time steps.According to the implementation method of above-mentioned snapshot functions, cause confusion when variate-value will be caused to access in buffer memory array, thus cannot snapshot functions be realized.
Summary of the invention
Object of the present invention, be to provide a kind of numerical simulation program to realize the method for snapshot functions, it is for the complex digital simulated program with time scheduling mechanism, all variablees of buffer memory are needed can accurately to be accessed in buffer memory array, there will not be the confusion of corresponding relation, the real snapshot functions realizing " seamless ".
In order to reach above-mentioned purpose, solution of the present invention is:
Numerical simulation program realizes a method for snapshot functions, comprises the steps:
(1) in the variable declarations stage, be variable needing buffer memory each in snapshot functions, all separate statement specific address offset variable, in order to record the deposit position of this cached variable in buffer memory array;
(2) at normal initial phase, eachly need initial value respective in the variable program of buffer memory to carry out initialization respectively, when each initialization of variable, all store the address offset amount of current memory space with its specific address offset variable;
(3) in the simulation calculation stage, each need the variable of buffer memory to complete the logical operation of oneself after, being updated to by the up-to-date variate-value obtained immediately in buffer memory array at initial phase is in its storage space determined, the position of each variable in buffer memory array is determined at initial phase, and remains unchanged;
(4) initial phase is being carried out from snapshot document, during each initialization of variable, by each address offset amount needing the variable of buffer memory current memory space in buffer memory array of special address offset amount variable storage, and the content in the buffer memory array storage space pointed by its corresponding address offset amount of the variable of buffer memory is needed to carry out initialization to each.
Above-mentioned steps (4) also comprises following content: under carrying out initialized situation from snapshot document, address offset amount NSTORX=NSTORX+1 is used again to obtain the absolute location information of each variable in buffer memory array, wherein, NSTORX represents the address offset amount of each element in buffer memory array.
After adopting such scheme, the present invention is for the complex digital simulated program with time scheduling mechanism, also can realize needing all variablees of buffer memory can accurately be accessed in buffer memory array, there will not be the confusion of corresponding relation, the snapshot functions of real realization " seamless ", and the execution time of simulated program also can decrease, research and development and test efficiency therefore greatly can be improved.
Accompanying drawing explanation
Fig. 1 is the schematic diagram of buffer memory array;
Fig. 2 is existing simulated program normal initialization process flow diagram;
Fig. 3 is existing simulation calculation process flow diagram flow chart;
Fig. 4 is that existing simulated program carries out initialized process flow diagram from snapshot document;
Fig. 5 is simulated program normal initialization process flow diagram in the present invention;
Fig. 6 is simulation calculation process flow diagram flow chart in the present invention;
Fig. 7 is that in the present invention, simulated program carries out initialized process flow diagram from snapshot document;
Wherein, NSTORX is the address offset amount of each element in buffer memory array, and wherein the address offset amount of the 1st element S TORX [0] is 0; Var1, var2 ..., varn be respectively in simulated program need buffer memory variable 1, variable 2 ..., variable n; Init_var1, init_var2 ..., init_varn be need in simulated program buffer memory variable 1, variable 2 ..., initial value that variable n is respectively corresponding; f 1(x), f 2(x) ..., f n(x) in simulated program with need buffer memory variable 1, variable 2 ..., logical operation process that variable n is respectively corresponding; NSTORX_var1, NSTORX_var2 ..., NSTORX_varn be in simulated program with need buffer memory variable 1, variable 2 ..., address offset amount that variable n is respectively corresponding; T is the time tag that simulated program carries out simulation run; △ t is the time step that simulated program carries out simulation run.
Embodiment
Below with reference to drawings and the specific embodiments, technical scheme of the present invention is described in detail.
The invention provides a kind of method that numerical simulation program realizes snapshot functions, comprise the steps:
(1) in the variable declarations stage, be each variable needing buffer memory, the variable that all separate statement one is new, is specifically designed to and records the deposit position of this cached variable in buffer memory array.For variable 1(var1) state corresponding address offset amount record variable NSTORX_var1, for variable 2(var2) state corresponding address offset amount record variable NSTORX_var2, the rest may be inferred, for variable n(varn) state corresponding address offset amount record variable NSTORX_varn.
(2) at normal initial phase (as shown in Figure 5), with the initial value in program, initialization (var1=init_var1) is carried out to variable 1, then address offset amount is initialized as 0(NSTORX=0), and the value of address offset amount is assigned to the specific address offset variable (NSTORX_var1=NSTORX) of variable 1, then address offset amount NSTORX is added 1(NSTORX=NSTORX+1), point to next storage space; With the initial value in program, initialization (var2=init_var2) is carried out to variable 2, the value of address offset amount is assigned to the specific address offset variable (NSTORX_var2=NSTORX) of variable 2, then address offset amount NSTORX is added 1(NSTORX=NSTORX+1), point to next storage space; The rest may be inferred, with the initial value in program, initialization (varn=init_varn) is carried out to variable n, the value of address offset amount is assigned to the specific address offset variable (NSTORX_varn=NSTORX) of variable n, then address offset amount NSTORX is added 1(NSTORX=NSTORX+1), point to next storage space; Until by all variablees all initialization complete, and each variable is obtained for oneself absolute location information in buffer memory array: specific address offset value.
(3) in the simulation calculation stage (as shown in Figure 6), variable 1 completes oneself logical operation (var1=f1(x)) after, by the up-to-date value obtained stored in (STORX [NSTORX_var1]=var1) in the storage space pointed by the side-play amount NSTORX_var1 of its specific address; Then, variable 2 completion logic computing (var2=f2(x)) after, by the up-to-date value obtained stored in (STORX [NSTORX_var2]=var2) in the storage space pointed by the side-play amount NSTORX_var2 of its specific address; The rest may be inferred, until all programs all execute in this time step; Then, simulation time label t enters the simulation calculation process of next round again after adding simulation time step-length △ t.It should be noted that in the present invention, in the calculating of each simulation time step-length, do not need the operation each variable being performed to NSTORX=NSTORX+1, thus program execution time can be saved than former method.
(4) initial phase (as shown in Figure 7) is being carried out from snapshot document, during variable 1 initialization, first address offset amount is initialized as 0(NSTORX=0), and the value of address offset amount is assigned to the specific address offset variable (NSTORX_var1=NSTORX) of variable 1, then the content in the storage space in buffer memory array pointed by NSTORX_var1 is read, to variable 1 initialize (var1=STORX [NSTORX_var1]), then address offset amount NSTORX is added 1(NSTORX=NSTORX+1), point to next storage space; Initialization is carried out to variable 2: the specific address offset variable (NSTORX_var2=NSTORX) first the value of address offset amount being assigned to variable 2, then the content in the storage space in buffer memory array pointed by NSTORX_var2 is read, to variable 2 initialize (var2=STORX [NSTORX_var2]), then address offset amount NSTORX is added 1(NSTORX=NSTORX+1), point to next storage space; The like, initialization is carried out to variable n: the specific address offset variable (NSTORX_varn=NSTORX) first the value of address offset amount being assigned to variable n, then the content in the storage space in buffer memory array pointed by NSTORX_varn is read, to variable n initialize (varn=STORX [NSTORX_varn]), then address offset amount NSTORX is added 1(NSTORX=NSTORX+1), point to next storage space; Until by all variablees all initialization complete, and each variable is obtained for oneself absolute location information in buffer memory array: specific address offset value.It should be noted that, no matter simulated program normal initialization, or carry out initialization from snapshot document, all variablees in simulated program all can participate in, their execution sequence can remain unchanged, and namely under two kinds of circumstance of initializations, the position of each variable in buffer memory array can remain unchanged.
Compared with the conventional method, the topmost feature of the method for the invention is, each variable is not in simulation calculation process, obtain oneself relative position in buffer memory array, but obtains oneself absolute position in buffer memory array when initialization.During due to initialization, all variablees all can occur, therefore once variable achieves oneself absolute position, no matter some variable occurs or does not occur in some time step during simulation calculation, absolute position all for oneself when it accesses in buffer memory array operates, and no longer there will be mess.Because the respective code of all initial phases all only can perform one time (and can perform in each time step unlike the respective code of simulation calculation), therefore at initial phase, the shifting function of address offset amount and the program execution time shared by assignment operation all can be considerably less, substantially negligible.
In above-described specific implementation, under carrying out initialized situation from snapshot document, also need to use the way of address offset amount NSTORX=NSTORX+1 again to obtain the absolute location information of each variable in buffer memory array.
The present invention is to realize the snapshot functions of power system digital simulation software EMTDC for background, concrete methods of realizing has been described in detail, but the method for the invention itself is not limited to power system digital simulation field, it is all blanket to all Digital Simulation fields comprising power system digital simulation.
Above embodiment is only and technological thought of the present invention is described, can not limit protection scope of the present invention with this, and every technological thought proposed according to the present invention, any change that technical scheme basis is done, all falls within scope.

Claims (2)

1. numerical simulation program realizes a method for snapshot functions, it is characterized in that comprising the steps:
(1) in the variable declarations stage, be variable needing buffer memory each in snapshot functions, all separate statement specific address offset variable, in order to record the deposit position of this cached variable in buffer memory array;
(2) at normal initial phase, eachly need initial value respective in the variable program of buffer memory to carry out initialization respectively, when each initialization of variable, all store the address offset amount of current memory space with its specific address offset variable;
(3) in the simulation calculation stage, each need the variable of buffer memory to complete the logical operation of oneself after, being updated to by the up-to-date variate-value obtained immediately in buffer memory array at initial phase is in its storage space determined; The position of each variable in buffer memory array is determined at initial phase, and remains unchanged;
(4) initial phase is being carried out from snapshot document, during each initialization of variable, by each address offset amount needing the variable of buffer memory current memory space in buffer memory array of special address offset amount variable storage, and the content in the buffer memory array storage space pointed by its corresponding address offset amount of the variable of buffer memory is needed to carry out initialization to each.
2. a kind of numerical simulation program as claimed in claim 1 realizes the method for snapshot functions, it is characterized in that described step (4) also comprises following content: under carrying out initialized situation from snapshot document, address offset amount NSTORX=NSTORX+1 is used again to obtain the absolute location information of each variable in buffer memory array, wherein, NSTORX represents the address offset amount of each element in buffer memory array.
CN201310308672.4A 2013-07-22 2013-07-22 Method of achieving snapshot function through digital simulation program Pending CN104331526A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310308672.4A CN104331526A (en) 2013-07-22 2013-07-22 Method of achieving snapshot function through digital simulation program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310308672.4A CN104331526A (en) 2013-07-22 2013-07-22 Method of achieving snapshot function through digital simulation program

Publications (1)

Publication Number Publication Date
CN104331526A true CN104331526A (en) 2015-02-04

Family

ID=52406253

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310308672.4A Pending CN104331526A (en) 2013-07-22 2013-07-22 Method of achieving snapshot function through digital simulation program

Country Status (1)

Country Link
CN (1) CN104331526A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106980271A (en) * 2016-01-19 2017-07-25 南京南瑞继保电气有限公司 Signal communication delay analogy method based on PSCAD/EMTDC

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102063368A (en) * 2010-12-16 2011-05-18 国网电力科学研究院 On-line real-time debugging method for panoramic data on basis of denomination variation
CN103136107A (en) * 2011-12-03 2013-06-05 南京南瑞继保电气有限公司 Variable debugging method of embedded program dynamic storage allocation
CN103136407A (en) * 2011-12-03 2013-06-05 南京南瑞继保电气有限公司 Method of achieving snapshot with electro-magnetic transient in DC system (EMTDC) simulation model based on data integrated access technique
CN103150445A (en) * 2013-03-21 2013-06-12 北京经纬恒润科技有限公司 Parsing method and device of MATLAB model variable

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102063368A (en) * 2010-12-16 2011-05-18 国网电力科学研究院 On-line real-time debugging method for panoramic data on basis of denomination variation
CN103136107A (en) * 2011-12-03 2013-06-05 南京南瑞继保电气有限公司 Variable debugging method of embedded program dynamic storage allocation
CN103136407A (en) * 2011-12-03 2013-06-05 南京南瑞继保电气有限公司 Method of achieving snapshot with electro-magnetic transient in DC system (EMTDC) simulation model based on data integrated access technique
CN103150445A (en) * 2013-03-21 2013-06-12 北京经纬恒润科技有限公司 Parsing method and device of MATLAB model variable

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106980271A (en) * 2016-01-19 2017-07-25 南京南瑞继保电气有限公司 Signal communication delay analogy method based on PSCAD/EMTDC

Similar Documents

Publication Publication Date Title
Sahni et al. A hybrid approach to live migration of virtual machines
CN102789416B (en) Memory fault injection method and simulator thereof for software built-in test (BIT)
CN114490292A (en) Computer system, method, hardware storage device for recording playable traces
CN107807839B (en) Method and device for modifying memory data of virtual machine and electronic equipment
EP3662372B1 (en) Tentative execution of code in a debugger
EP1810154A2 (en) Flash file system management
CN104123171A (en) Virtual machine migrating method and system based on NUMA architecture
EP4014119A1 (en) Data race analysis based on altering function internal loads during time-travel debugging
CN108885579A (en) For tracking the method and apparatus for carrying out data mining according to core
CN111727425A (en) Trace logging by logging the inflow to an upper level shared cache and cache coherence protocol translation between lower level caches
CN113632067A (en) Emulating non-trace code with recorded execution of trace code
CN105701854A (en) 3D rendering method and device and engine
CN103729166A (en) Method, device and system for determining thread relation of program
CN104331526A (en) Method of achieving snapshot function through digital simulation program
US20200327051A1 (en) Hybrid garbage collection
CN116483643A (en) GPU debugging method, device, equipment and storage medium
CN115858092A (en) Time sequence simulation method, device and system
CN107766120B (en) Method for recording object information in virtual machine and related equipment
EP4318211A1 (en) Method for inspecting code under weak memory order architecture, and corresponding device
CN113805848B (en) Target machine control software integration method and system
US11960406B2 (en) Omitting processor-based logging of separately obtainable memory values during program tracing
CN108604205B (en) Test point creating method, device and system
CN116578413B (en) Signal-level simulation model clouding method based on cloud+end architecture
US11875057B2 (en) Shared structure for a logic analyzer and programmable state machine
CN111158796B (en) Data processing method of hydraulic control software

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20150204

WD01 Invention patent application deemed withdrawn after publication