show variable at set times

Use this forum to post Vensim related questions.
Post Reply
vraimondi
Junior Member
Posts: 9
Joined: Mon Mar 29, 2004 4:47 pm

show variable at set times

Post 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
Attachments
desired graph example.pdf
(71.71 KiB) Downloaded 682 times
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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
Pruyn
Senior Member
Posts: 80
Joined: Fri Mar 05, 2004 2:34 pm

Post 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
vraimondi
Junior Member
Posts: 9
Joined: Mon Mar 29, 2004 4:47 pm

Post 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?
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.
Post Reply