Using Reference Modes to model step function inputs

Use this forum to post Vensim related questions.
Post Reply
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Using Reference Modes to model step function inputs

Post by gwr »

Hi everyone,

I wanted to use reference modes to create exogenous data driving the model. For some purposes I need a step function input (e.g. :HOLD BACKWARD: or :LOOK FORWARD:). Instead of reading in data from a spreadsheet file I tried to use GET DATA BETWEEN TIMES(data var,time,-1) to keep the values of the data variable created with the reference mode tool until new values are given.

As you can seed from the model enclosed this solution is sensitive to the time step and will give the wrong values, e.g. if there is a new value at say time = 2 the new value is only given one DT later. Surprisingly (mis-)using a lookup with time as the x-value to model the exogenous data and then using LOOKUP BACKWARD(lookup,time) gives the correct solution, the new value is returned the time=2. Is there a way around this or is this a bug?

Kind regards,

Guido
Attachments
ReferenceMode.vdf
(2.74 KiB) Downloaded 298 times
Data_ReferenceMode_Step.mdl
(2.53 KiB) Downloaded 285 times
Administrator
Super Administrator
Posts: 4626
Joined: Wed Mar 05, 2003 3:10 am

Re: Using Reference Modes to model step function inputs

Post by Administrator »

You can use the following.

DRIVING data held backward :HOLD BACKWARD: := DRIVING data var as reference mode

This works in the same way as the lookup.

I can only assume that the "-1" is causing problems. I'll ask our programmer to take a closer look.

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
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: Using Reference Modes to model step function inputs

Post by gwr »

Thank you, Tony. Sometimes it is the "easy solutions" that fail to be noted.

Guido
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: Using Reference Modes to model step function inputs

Post by gwr »

Tony,

I just came upon another question with regard to the use of reference modes and lookups: I wanted to send a packaged model and while testing this I noticed that I cannot change any data variables in the Model Reader. But that means a serious handicap as I wanted to give a customer a way of creating scenarios and chaning model input.

I noted though that using lookups this can well be achieved. Is this all supposed to be like that or am I missing something important here?
Will Sable - which I have just orded - help out in this regard?

Thanks for helping out in advance.

Guido
tomfid
Administrator
Posts: 3816
Joined: Wed May 24, 2006 4:54 am

Re: Using Reference Modes to model step function inputs

Post by tomfid »

In addition to lookups, another option would be to put the data in Excel and use the GET XLS or GET DIRECT functions.
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: Using Reference Modes to model step function inputs

Post by gwr »

Thank you, Tom - although I was aware of those possibilities. In the case of many possibilities to achieve one thing or the other one wonders if it all is just a question of personal style. Or are there "reasonable" considerations guiding the way:

1. For one thing I am still at a loss with regardt to the usage of reference modes in packaged models. You guys sure have thought of something when putting reference modes into Vensim, haven't you? - The ease of creating scenarios etc. (naming and saving them with the reference modes...) Shouldn't this be available to an end user?

2. While Excel has great advantages for collecting and organizing tabular information there is something of a "sales" edge to this: It would be nice to have as much as possible handled by a SD-software itself as to present "SD-abilities" as opposed to selling "patch work" - lest people being skeptical end up sticking to their "beloved" Excel once again and for all.

3. I found the possibility of using lookups in SyntheSim - which is not possible with reference modes (or Excel data) - quite intriguing. This seems to offer a quick was for manual calibration - so is this a feature worth considering for Vensim?

4. I would like to have some guidance for making the choice between GET DIRECT DATA and GET XLS DATA. If I wanted to quickly generate different exogenous scenarios with Excel and then simulate them in Vensim - maybe using a string variable to account for the different files? - what would be the solution of choice?

Kind regards,

Guido

PS: There is some balance to be struck between the capabilities of Vensim and ease of use and appeal of presentation. I like to hint at Kim Warren's myStrategy tool. While capabilities are less than Vensim's - some features and styles have struck me as a good way of making SD "sellable" to managers and the people having to work with SD in the end...
Administrator
Super Administrator
Posts: 4626
Joined: Wed Mar 05, 2003 3:10 am

Re: Using Reference Modes to model step function inputs

Post by Administrator »

I'll try and answer some of your questions.
1. For one thing I am still at a loss with regardt to the usage of reference modes in packaged models. You guys sure have thought of something when putting reference modes into Vensim, haven't you? - The ease of creating scenarios etc. (naming and saving them with the reference modes...) Shouldn't this be available to an end user?
I think this is terminology. A "reference mode" in my mind is something you give to the user, they should not be able to change it. But there is nothing to stop you from allowing the user to generate a baseline run/dataset and call that a reference mode instead.
3. I found the possibility of using lookups in SyntheSim - which is not possible with reference modes (or Excel data) - quite intriguing. This seems to offer a quick was for manual calibration - so is this a feature worth considering for Vensim?
Do you mean including the ability to change data/reference modes with SyntheSim? SyntheSim is designed to be a quick way of running experiments. If you want the user to be able to change things, it's straightforward to modify the model to add in sliders to modify the incoming data. Allowing a read from Excel when running SyntheSim would slow it down far too much to make SyntheSim usable.
4. I would like to have some guidance for making the choice between GET DIRECT DATA and GET XLS DATA. If I wanted to quickly generate different exogenous scenarios with Excel and then simulate them in Vensim - maybe using a string variable to account for the different files? - what would be the solution of choice?
It's purely up to you. Both functions will work.
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: 3816
Joined: Wed May 24, 2006 4:54 am

Re: Using Reference Modes to model step function inputs

Post by tomfid »

Re #4, the GET DIRECT functions are new, so I haven't used them much, but my preliminary thinking is as follows:

- GET DIRECT is more robust for general distribution, because it doesn't rely on the presence of Excel on the user's machine.
- GET DIRECT also tends to be faster at startup, and more convenient if the data isn't expected to change, because it doesn't launch extraneous windows.
- GET XLS makes more sense if the user may edit the data, because it automatically launches Excel, making the inputs visible.

Tom
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: Using Reference Modes to model step function inputs

Post by gwr »

tomfid wrote:Re #4, the GET DIRECT functions are new, so I haven't used them much, but my preliminary thinking is as follows:

- GET DIRECT is more robust for general distribution, because it doesn't rely on the presence of Excel on the user's machine.
- GET DIRECT also tends to be faster at startup, and more convenient if the data isn't expected to change, because it doesn't launch extraneous windows.
- GET XLS makes more sense if the user may edit the data, because it automatically launches Excel, making the inputs visible.

Tom
Thank you. The last point is essential as that was the whole idea behind it: To have somebody change exogenous input as a time series without having to build sliders for every period... In the reference I have found that GET XLS will allow the have the user change a string variable for the reference file name which would make it easy to quickly save differnt excel input files for the experimentation. Is this a different with the GET DIRECT function - I thought that I have read this somewhere in the documentation.

Guido
Post Reply