Page 1 of 1

Time series data into Vensim

Posted: Fri Oct 30, 2020 4:09 pm
by SionC
Hi,

I would like to read time series data into Vensim. The model is subscripted and the text file I have does not contain all the variables. What is the best approach for getting the data in?

As a simple example I have this data in a text file:

Time 0 1 2 3 4 5
Variable [AAA] 1 3 5 2 5
Variable [CCC] 3 5 2 5 6

(ie Variable [BBB] is missing)

I tried converting this data into a VDF file and then using the GET VDF DATA, but Vensim wants Variable [BBB] to be present. Similarly, the GET DIRECT DATA function wants all the variables to be there as you only specify the first row with the data in it. The other complication is that I do not know what order the variables will be in and what will be missing. This is why I has hoping the GET VDF DATA function would work as Vensim queries the .vdf file.

Any help very appreciated!

Re: Time series data into Vensim

Posted: Fri Oct 30, 2020 4:12 pm
by tomfid
When there are missing elements, the best option is to use the Model>Import Data options to create a vdf from your text file.

Re: Time series data into Vensim

Posted: Fri Oct 30, 2020 4:13 pm
by Administrator
SionC wrote: Fri Oct 30, 2020 4:09 pmI tried converting this data into a VDF file and then using the GET VDF DATA, but Vensim wants Variable [BBB] to be present.
Really? It should import without issues and then just say data missing if you try and run.

Re: Time series data into Vensim

Posted: Fri Oct 30, 2020 4:32 pm
by SionC
Hi,

Thanks for the super quick responses! :)

I have attached my test model. I get the following errors when I run it:

ERROR: The variable Variable[aaa] not found in file TestDataImportForum.vdfx.
ERROR: Unable to get data values for Data Variable[aaa].
ERROR: Failed to make live links to data - aborting simulation.
ERROR: Unable to correctly load in exogenous values - aborting.

I am prepared to be told that there is something really simple that I am getting wrong!

Re: Time series data into Vensim

Posted: Fri Oct 30, 2020 5:44 pm
by tomfid
Short answer is, don't use GET VDF. Make the variable an ordinary data variable (not a data equation) and specify the data file on the Advanced tab of the simulation control dialog.

https://www.vensim.com/documentation/usr16.htm
https://www.vensim.com/documentation/ref_data.htm

Re: Time series data into Vensim

Posted: Fri Oct 30, 2020 5:48 pm
by tomfid
TestModel2.zip
(4.05 KiB) Downloaded 591 times

Re: Time series data into Vensim

Posted: Fri Oct 30, 2020 6:56 pm
by SionC
Wonderful - Thanks!