Please enable JavaScript to view this site.

Vensim Help

C/C++int VEFCC vensim_start_simulation(int loadfirst,int game,int overwrite) ; 

int VEFCC VensimCStartSimulation(int context,int loadfirst,int game,int overwrite) ;

Javapublic static native int start_simulation(int loadFirst, int game, int overwrite );

public static native int CStartSimulation(int context, int loadFirst, int game, int overwrite );

VBPrivate Declare Function vensim_start_simulation Lib "vendll32.dll" (ByVal loadfirst As Long, ByVal game As Long, ByVal overwrite As Integer) As Long
Pascalfunction vensim_start_simulation(loadfirst: Integer;game: Integer; overwrite: Integer) : Integer ; stdcall ; external 'vendll32.dll' ;

Start a simulation that will be performed a bit at a time.

Arguments

loadfirst        Use 1 to indicate that the run resulting from the simulation should be loaded first in the list of runs (as in MENU>RUN1).

game        Use 0 to indicate that this is a regular (not gaming) simulation.  Use 1 to start a new game and use 2 to continue with an existing game.  Note that using a game value of 1 during a game will restart the gaming session not continue it.

overwrite        Use 1 to suppress any query about overwriting an existing file when the simulation starts.  (same as the |O option on the MENU>RUN command).

Returns

1 if the simulation is successfully started and 0 otherwise.  If this is called with a game value of 2 and there is not an active game the command will return 0.

Notes

This, along with vensim_continue_simulation and vensim_finish_simulation allow you to provide the user feedback on the progress of a simulation.  In C notation the process looks like:

if(vensim_start_simulation(0,0,1)) 

float time ;

 do {

 if(vensim_get_val("Time",&time)) /* get current value for time */

 put_up_progress_indicators(time) ; /* another function that shows progress */

 } while(vensim_continue_simulation(5) == 1) ;

 vensim_finish_simulation() ;

 }

Once you have called vensim_start_simulation only the SIMULATE>SETVAL command will work.  You can use this to set the value of a gaming variable within the gaming simulation.  It is faster to do this than run the game a one interval at a time because the data only need to be stored at the end of the simulation.

See Also

vensim_continue_simulation,vensim_finish_simulation,vensim_get_val