I have a question about vensim equations.
I have to define 2 equations for a variable.For example I have 50 time steps in my model. for time=25 to 35 I have to define an equation and for other times another equation. How can I define it with IF THEN ELSE ?
[Edited on 12-3-2010 by ahmadi2010]
Vensim Equations
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
-
- Senior Member
- Posts: 77
- Joined: Thu Aug 19, 2010 3:34 pm
Thank you Tony.
And if I have to define equation2 like this:
I have some constant (c26,c27,c28.......c34)
if time=26 then c26*equation2
if time=27 then c27*equation2
.
.
.
if time=34 then c34*equation2
Can you help me please?
Is there any way that I'm not forced to use IF THEN ELSE for each of time step?
I do't like to use this form:
IF THEN ELSE(Time=35,c35*equation2 , IF THEN ELSE(Time=36,c36*equation2 ,IF THEN ELSE(Time=37,c37*equation2 , IF THEN ELSE(Time=38,c38*equation2 , IF THEN ELSE(Time=39, c39*equation2 ...........
[Edited on 12-3-2010 by ahmadi2010]
And if I have to define equation2 like this:
I have some constant (c26,c27,c28.......c34)
if time=26 then c26*equation2
if time=27 then c27*equation2
.
.
.
if time=34 then c34*equation2
Can you help me please?
Is there any way that I'm not forced to use IF THEN ELSE for each of time step?
I do't like to use this form:
IF THEN ELSE(Time=35,c35*equation2 , IF THEN ELSE(Time=36,c36*equation2 ,IF THEN ELSE(Time=37,c37*equation2 , IF THEN ELSE(Time=38,c38*equation2 , IF THEN ELSE(Time=39, c39*equation2 ...........
[Edited on 12-3-2010 by ahmadi2010]
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
-
- Senior Member
- Posts: 77
- Joined: Thu Aug 19, 2010 3:34 pm
This could be accomplished with subscripting, where the equations reside in an array and VECTOR SELECT is used to pick the active element.
However, why would you want to do this? It sounds very cumbersome.
T
However, why would you want to do this? It sounds very cumbersome.
T
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
Using a different equation for every time step implies that either (a) different data is brought to bear at each time, in which case there should be a solution (like VECTOR SELECT) or (b) the system structure changes at every time step, in which case it would be far better to have a generic structure that applies at all time steps, changing only through parameter variations.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
-
- Super Administrator
- Posts: 4590
- Joined: Wed Mar 05, 2003 3:10 am
In that case the structure I built in Model3/4 of this thread does what's needed.
http://www.ventanasystems.co.uk/forum/v ... php?t=4272
Tom
http://www.ventanasystems.co.uk/forum/v ... php?t=4272
Tom
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/