problem with function get vdf data

Use this forum to post Vensim related questions.
Post Reply
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

problem with function get vdf data

Post by LAUJJL »

Hi everybody

In the get vdf data function documentation it is written:
'However, if ‘filename’ is empty then a data value of slope will be returned at time start. This is a useful construct if you want to compare model results with a base run and have not yet made the base run.'

The get vdf data being X = get vdf data(('file','varname',start,slope). I join a simplistic example where there is data variable whose equation is:
data variable := GET VDF DATA( 'file.vdf' , 'data variable' , 0,1) and there is no file.vdf. There is no ctrl-t error, but when run the following messages are generated:

ERROR: Unable to open the file file.vdf.
ERROR: Unable to open file.vdf to get data.
ERROR: Unable to get data values for data variable.
ERROR: Failed to make live links to data - aborting simulation.
ERROR: Unable to correctly load in exogenous values - aborting.

The model is joined and it is very simple to run it and experiment. What is happening. Is it a bug or I do not have understood something?

Practically I am obliged to generate a fake file, by modifying the equation for data variable, changing it to a constant for instance and giving it a value to generate the fake file. This is cumbersome if one is comparing variables to a base run, especially in reality check equations using the compare function and one wants to run the reality check using different parameter values. One is obliged to use a .cin file for both runs, and to modify the model to generate the base run, changing the get vdf data function as explained above.
Best regards.
JJ
Attachments
get_vdf_data.mdl
(1.4 KiB) Downloaded 191 times
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: problem with function get vdf data

Post by Administrator »

This looks like a bug to me.

I've tried it all the ways I can think of and it does not seem to give the slope value.
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: 3811
Joined: Wed May 24, 2006 4:54 am

Re: problem with function get vdf data

Post by tomfid »

Actually this is by design.

When the help says, "However, if ‘filename’ is empty then a data value of slope will be returned at time start. This is a useful construct if you want to compare model results with a base run and have not yet made the base run." it means this:

GET VDF DATA( '' , 'data variable' , 0,1)

not that the file itself does not exist. Unfortunately the constant setting dialog won't actually let you enter a null value when you're setting up a run, but it's probably possible to do so via a .cin or .cmd file. You could make that part of the pre-simulation specified in the simulation control dialog, so that the base run would automatically get created.

It would be nice if there were another syntax that permitted entry of an explicit missingVal to return when the file did not exist, without halting simulation.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Re: problem with function get vdf data

Post by LAUJJL »

Hi Tom

Thank you for the precision. But the result does not correspond exactcly to the documentation, as it does not return the value of the slope but :NA:.
Another remark, the message is
WARNING: No data found for -data variable- in spreadsheet.

There is no spreadsheet concerned.

Best regards.

JJ
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: problem with function get vdf data

Post by tomfid »

Good point. In this case, I think it may be the documentation that is wrong - slope is not really a sensible return value for missing data, because it has implicit units of (modeltime/datatime). :NA: makes more sense to me, though it would be nicer to have an explicit missingValue parameter.
Post Reply