Load CIN and external data

Use this forum to post Vensim related questions.
Post Reply
apix
Senior Member
Posts: 64
Joined: Wed Mar 16, 2011 3:31 pm

Load CIN and external data

Post by apix »

Hi,

my Venapp interface let the user load a cin file to restore a previuos scenario.
When the cin file has been loaded, switchvars take the right values (super!) but external data doesn't get loaded (d'oh!)

What do you suggest me ? Should I write a note reminding to re-load external data after having loaded a cin file ?
Or there is an automatic way ?

Many thanks
tomfid
Administrator
Posts: 3998
Joined: Wed May 24, 2006 4:54 am

Re: Load CIN and external data

Post by tomfid »

What is the symptom of data not getting loaded? Model won't run? Or ... ?

Can you post the code you're using?
apix
Senior Member
Posts: 64
Joined: Wed Mar 16, 2011 3:31 pm

Re: Load CIN and external data

Post by apix »

After having loaded the cin file and run the simulation, the outputs show that external data were'nt loaded.
Some variables have default values. Some policies let the user change such values by loading an external vdf file.
The outputs correspond to the default values, not to the data relative to the cin file.
Administrator
Super Administrator
Posts: 4841
Joined: Wed Mar 05, 2003 3:10 am

Re: Load CIN and external data

Post by Administrator »

Can you try running

Code: Select all

SIMULATE>DATA|
and then loading your data files? It sounds like the default files are already loaded, so Vensim is getting data from those. This command will clear the list so you can use your own.

Tony.
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
apix
Senior Member
Posts: 64
Joined: Wed Mar 16, 2011 3:31 pm

Re: Load CIN and external data

Post by apix »

That means, I have to reset the data list, before loading the cin file?
With a void list of data, the cin file will load its own list, including the external data of the policy?
Administrator
Super Administrator
Posts: 4841
Joined: Wed Mar 05, 2003 3:10 am

Re: Load CIN and external data

Post by Administrator »

Reset the data list before you read the CIN, and then use SIMULATE>DATA|datafile1.vdf to load the data you need to run the simulation.
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
tomfid
Administrator
Posts: 3998
Joined: Wed May 24, 2006 4:54 am

Re: Load CIN and external data

Post by tomfid »

Can you post the code you're using? .cin and data statements shouldn't normally interact.
apix
Senior Member
Posts: 64
Joined: Wed Mar 16, 2011 3:31 pm

Re: Load CIN and external data

Post by apix »

I load data with

Code: Select all

SIMULATE>ADDDATA|?&SPECIAL>CLEARRUNS
(the clearruns command is necessary to not see the loaded data as a loaded run)
In fact, they don't interact, as I was afraid of.
When I load the cin file with

Code: Select all

SIMULATE>READCIN|?Changes file
, only Constants take the right values, while the external data are not restored.

My purpose was to let the user save the settings of a new scenario in order to complete the set up later. But the cin file is not the right way, if not all settings are restored.

Is there another way, supposed that the entire simulation requires too long?
tomfid
Administrator
Posts: 3998
Joined: Wed May 24, 2006 4:54 am

Re: Load CIN and external data

Post by tomfid »

When you say "data" here, do you actually mean the history of decisions made in a previous simulation, rather than external data?
Administrator
Super Administrator
Posts: 4841
Joined: Wed Mar 05, 2003 3:10 am

Re: Load CIN and external data

Post by Administrator »

Try

Code: Select all

SIMULATE>DATA|&SIMULATE>ADDDATA|?&SPECIAL>CLEARRUNS
Your call to "SIMULATE>ADDDATA|?" will add data files to an existing list. What you need to do is clear the list being used first, "SIMULATE>DATA|" will do that.
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