Clarification of the purpose of vensim_continue_simulation

Use this forum to post Vensim related questions.
Post Reply
pbreach
Member
Posts: 29
Joined: Mon Oct 26, 2015 5:23 pm
Vensim version: DSS

Clarification of the purpose of vensim_continue_simulation

Post by pbreach »

I'm trying to use a combination of vensim_start_simulation, vensim_continue_simulation, vensim_finish_simulation if a loop for which the simulation is carried out bit by bit returning control to the user after a given number of time steps.

The pseudo-code looks something like this:

Code: Select all

for i in 1:step:100
    #Here is where the user is given control before the simulation of a given time step is carried out
    vensim_start_simulation(0, 2, 1)
    vensim_continue_simulation(step)
    vensim_finish_simulation()
If I were to print the value of the current model time in my program for a value of step=10, I would expect to see the following output:

0
10
20
30
40
50
60
70
80
90

In my program it appears as though the step value is being ignored as I get the following (the .vpm is set for a time step of 1 minute):

0
1
2
3
4
5
6
7
8
9

Can anyone tell me what seems to be the problem here? The program is written in Python. In case it is relevant here is how this result was obtained:

Code: Select all

model = venpy.load("../models/coffee_cup.vpm")

model.cmd("SIMULATE>RUNNAME|Test")

model.cmd("MENU>GAME|O")

for _ in range(0, 100, 10):
    print(model['Time'])
    model.dll.vensim_start_simulation(0, 2, 1)
    model.dll.vensim_continue_simulation(10)
    model.dll.vensim_finish_simulation()
Administrator
Super Administrator
Posts: 4838
Joined: Wed Mar 05, 2003 3:10 am

Re: Clarification of the purpose of vensim_continue_simulati

Post by Administrator »

I think we'll remove the vensim_start_sim etc functions soon as they don't really work well.

Use venapp commands instead when running a game. The following should work ok (VBA code).

nResult = vensim_command("SPECIAL>LOADMODEL|coffee_cup.vpm")
nResult = vensim_command("SIMULATE>RUNNAME|Test")
result = vensim_command("MENU>GAME|O")
result = vensim_command("GAME>GAMEINTERVAL|2")

For i = 0 To 100

nResult = vensim_command("GAME>GAMEON")
nResult = vensim_get_val("time", varval)

Next i
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
pbreach
Member
Posts: 29
Joined: Mon Oct 26, 2015 5:23 pm
Vensim version: DSS

Re: Clarification of the purpose of vensim_continue_simulati

Post by pbreach »

Thank you for your prompt reply. The code is working now! One last question though. Does the value set to GAMEINTERVAL represent the number of time steps or the length of time between giving control back to the user? I am thinking of the case where the TIME STEP != 1. I've been looking through the Venapp documentation, and it only says, "Sets the interval that will be covered by each GAME>GAMEON command."
Administrator
Super Administrator
Posts: 4838
Joined: Wed Mar 05, 2003 3:10 am

Re: Clarification of the purpose of vensim_continue_simulati

Post by Administrator »

GAMEINTERVAL represents the length of time to elapse before giving control back to the user.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Post Reply