Custom graphs

Use this forum to post Vensim related questions.
Post Reply
CLAUDIO
Member
Posts: 26
Joined: Tue Jun 13, 2006 4:37 pm

Custom graphs

Post by CLAUDIO »

Hi!

I just making a review of some exercices given in Vensim Course in march, Salisbury.

In slide number 100.

I've got strugling in how could I costumize the graph in order to visualize in the graphic by itself the correct time when the wolf population reaches 80? In other words, how could I costumize the graph to see the 2.8 years in the graph?

Could somebody help me please?

Cláudio:cool::D;):o:)

[Edited on 6-21-2006 by CLAUDIO]
Wilson
Administrator
Posts: 51
Joined: Thu Mar 06, 2003 5:05 am

Post by Wilson »

Claudio,

Hi it's Andy.

I'm using a modified new deck of slides now for the trainingg course since you visited, but I guess your refering to to slide that talks about the reference mode chart that talks about the doubling time approximation for exponential growth ?

If so, I'm still not sure what it is you require, is it just to be able to see the x axis label value of 2.8 ? If this is the case, you could do several things. The easiest is just to zoom in on the X-axis by holding the SHIFT key down and dragging around the 1-4 year period say on the axis.

Or you could build a custom graph of the "Wolf population" and add a second variable to display. This new Variable could have an equation like :

VAR x = if them else(Wolf pop > initial wolf pop *2,1,0)

If you then displayed both lines on the custom graph, VAR X would step from 0 to 1 at the time point the population had doubled.

A further alternative would be to log the time the population doubled using something like :

VAR Y = SAMPLE IF TRUE(
WOLF POP > initial WOLF POP*2 :AND: VAR Y = 0 ,TIME, 0)

Hope this helps

Andy
CLAUDIO
Member
Posts: 26
Joined: Tue Jun 13, 2006 4:37 pm

Post by CLAUDIO »

Hi! Andy

Thank you very much for your reply.

I did not realise where should I set the Equations you'd suggested. I tried to do it via Control Panel in Dataset box.... but it is not working... I tried several options and variations, including syntaxs. I'd gonne throught the Vensim Manual but I did not succeed in get that information. Well, should I define that Variable(Equation) before I start to plot the custom graph? If so, where? Otherwise could you give me a clue about that please?
Thank you

Claudio
Wilson
Administrator
Posts: 51
Joined: Thu Mar 06, 2003 5:05 am

Post by Wilson »

Claudio,

The example equations I gave should be created in the same way as all the other variables in your model, by using the VAR tool and adding them to the sketch. They are just new variables , nothing special about them.

Once you have them added and your model is simulating, , go to the control panel and select the GRPAHS tab. Then select NEW and you will be shown the custon graph dialogue box. In the first variable box put in the variable name for WOLF POPULATION that you have. In the second variable box, enter the name of the other variable you wish to display (eg var x). Since these two variables have different units of measurement, don't select the check box forcing them on to the same Y axis scaling.

Andy
CLAUDIO
Member
Posts: 26
Joined: Tue Jun 13, 2006 4:37 pm

I've got the point, but...

Post by CLAUDIO »

Hi! Andy.

Thank you.

I have got the point and I succeed in doing that.

However I would like to clarify the output of the Custom Graph and Table in the Control Panel that actually seems not to be so straight forward.

Just to make a better an precise explanation in order to make your understanding easier I described the simple model I have been reviewing from the slide.

The model I've sketched according to the slide have the following data and sets:
******************************
Initial Time: 0 ; Final Time: 10
Time Step: 1 : Unit for time: year
Initial Wolves Population - 20
Wolves Fertility: 0.5 wolves/wolves/year
Wolves Population: INTEG(Rate of Wolves Introduced, Initial Population)
Rate of Wolves Introduced: Wolves Population*Wolf Fertility
******************************
In order to get the a clear view of the doubling time, that is the period required for the Wolves Population to double in value. Thus, the Variable "VAR X" was introduced in the model in order to get the Custom GRAPH as you suggested.
Hence:
VAR X = IF THEN ELSE(Wolves Population > 2*Initial Population, 1, 0).

Once I had added VAR X in the model and run it I went to the Control Panel as you also suggested to built the Custom Graph that was named as GRAPH_0 with the following Basic parameters:
Variable Boxes:
Wolves Population and VAR X.
X-max = 5
X-division = 50
Y-div = 10
Y-min = 0
Y-max = 100

Afterwards the GRAPH_0 was plotted and visually we could see the following aspects:

The VAR X line(red) cross the exponential wolves growth population line(Blue) between 1.3 and 1.4 year(axis y), whereas the exponential wolves growth population line(Blue) is doubling when it get 40 wolves in 1.7 year and it is reaching 80 wolves close to 3.4 year.

Further more, if I change the Y-max = 200 the VAR X line(red) cross the exponential wolves growth population line(Blue) between 1.1 and 1.2 year(axis y), whereas the exponential wolves growth population line(Blue) remains doubling when it get 40 wolves in 1.7 year and it is reaching 80 wolves close to 3.4 year.

Hence, it seems that the VAR X was not showing consistence, at least according to the way I had plotted.

By the other side, in order to see numerically the year doubling time of wolf population I tried to plot a Table named GRAPH and set it as:
Time from 0 to 5
by + 50
Cell width First 30 rest 14.
Any way, also is not displayed the exact Time and Wolves Doubling Population... The sequence just go to Year 1 => Wolves Population = 20 and skipping to Year 2 => Wolves Population = 45.

My questions are:

1) Did I plot the GRAPH correctly?

2) If so, why such a inconsistence in its presentation?

3) If I plot the GRAPH wrongly, how could I do it the right way in order to clearly see the doubling time?

4) How could a plot a table in order to clearly see the doubling time and its values related(Time(Year) and Wolves Population)?

Thank you for your help.

Claudio
Wilson
Administrator
Posts: 51
Joined: Thu Mar 06, 2003 5:05 am

Post by Wilson »

Claudio,

In your model your TIME STEP is sest to 1 year. Hence the level accuracy you can go to in analysing the doubling time is to the closest integer year. In the model you listed, you can only say the the population doubled somewhere between year 1 and year 2.

Set your time step to a smaller binary fraction , such as 0.25 or 0.125 and have a look at the results. If you keep making the TIME STEP smaller you will see the runs start to converge, and the doubling time is shown to be about 1.4 years.

You shouldn't need to change the labelling intervals on the axis , Vensim will autoscale. But as you say, to get to the detail it's best to look at the results via a table. You casn just use the default Table tool in the analysis toolset down the left hand side of Vensim. Select the Wolf Population as the workbench variable then click on the table tool. Youwill then have two rows , first being the model time, the second the wolf population. If you want to add VAR X to the table as well, minimize the table , select VAR X as the workbench variable and click on the table tool again

Andy
CLAUDIO
Member
Posts: 26
Joined: Tue Jun 13, 2006 4:37 pm

Post by CLAUDIO »

;)

Thank you Andy!

Everything is ok for me in this issue.

Thank you very much.

Claudio
Post Reply