Page 1 of 1

show variable at set times

Posted: Thu May 20, 2004 4:31 pm
by vraimondi
Dear all,

I am quite new to vensim, and am struggling with the following:
I have a variable whose values make sense only at set times (that is, when time = integer(time)), so I need to show only those values on a graph and then would like to interpolate between the showed points (so that the plot looks like a graph rather than a series of dots). Is there a function that I can use? I have attached a file showing the actual and the desired (to be shown) behaviour.

Thanks for your help,

Vittorio

Posted: Fri May 21, 2004 2:30 pm
by bob@vensim.com
By far the easiest solution is to just set SAVEPER = 1 in the model settings dialog. Then everything will show up only on integer times. If you don't want this use

measured var = IF THEN ELSE(Time = INTEGER(Time),var,:NA:)

And the graphs will look right.

Bob Eberlein

Posted: Mon May 24, 2004 10:11 am
by Pruyn
You could also use the sample if true funtion. This will hold a value untill the test statement returns true.

measured var = SAMPLE IF TRUE (Time = INTEGER(Time),var, var)

depending on what you want

Posted: Mon May 24, 2004 10:58 am
by vraimondi
Thanks to you both for your help and for taking the time to do so!


I decided to use the if then else function with the :NA: and it does work (I thought I had tried this one and it was not returing any result, but clearly must have done something wrong there).

As I was attempting to find a way to fix the problem, I noticed that it is not actually possible to create a custom bar- graph through the control panel, and the only way to create one is through the vgd file as text - but then the manual was not too helpful, only a few commands are mentioned - . Is that true?

Posted: Fri May 28, 2004 12:37 pm
by bob@vensim.com
Custom bar graphs do need to be created via a text editor. Details on the commands are in chapter 15 of the reference manual - look for Bar Graph Tool Keywords - there are quite a few.