Strange behaviour
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Strange behaviour
Hi all
I would like to know what is wrong with the attached model. If you run it it is in a steady state with the level at a constant value but if you increase a little bit the alpha value you get an output flow greter than the input flow with the level still at a constant value. If moreover you increase even more the value of that parameter you can see how the output flow drops to zero but anyway the level keeps its constant value though we have a constant input flow (so we would expect a lineary incresing behavior).
Can some of you help me?
Best regards and best wishes.
Lorenzo
I would like to know what is wrong with the attached model. If you run it it is in a steady state with the level at a constant value but if you increase a little bit the alpha value you get an output flow greter than the input flow with the level still at a constant value. If moreover you increase even more the value of that parameter you can see how the output flow drops to zero but anyway the level keeps its constant value though we have a constant input flow (so we would expect a lineary incresing behavior).
Can some of you help me?
Best regards and best wishes.
Lorenzo
- Attachments
-
- m0c.mdl
- (3.36 KiB) Downloaded 257 times
-
- Super Administrator
- Posts: 4683
- Joined: Wed Mar 05, 2003 3:10 am
Re: Strange behaviour
What values are you using for Alpha? The level does not go negative for me.
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Strange behaviour
Hi, thank you for your answer. I use values greater that 0.06 (the steady state value). The problem (according to me) is that S1 stay at a constant value even if out1 is greater that in1....Administrator wrote:What values are you using for Alpha? The level does not go negative for me.
Loorenzo
-
- Super Administrator
- Posts: 4683
- Joined: Wed Mar 05, 2003 3:10 am
Re: Strange behaviour
You have the equation
fout = IF THEN ELSE(diff>0, 0 , S1*ALPHA )
diff is always greater than zero. So fout will always be zero.
fout = IF THEN ELSE(diff>0, 0 , S1*ALPHA )
diff is always greater than zero. So fout will always be zero.
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Strange behaviour
Hi
I posted a reply that has been cancelled... the reply stays in the following screenshot....
L.
I posted a reply that has been cancelled... the reply stays in the following screenshot....
L.
- Attachments
-
- m0c.JPG (95.06 KiB) Viewed 6734 times
-
- Super Administrator
- Posts: 4683
- Joined: Wed Mar 05, 2003 3:10 am
Re: Strange behaviour
I don't understand the problem here. What stock is going negative?
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Strange behaviour
I never wrote that there is a stock going negative... I only wrote that I find it surpising that a stock with an output flow greater that it's only input flow stays at a constant value and I asked for a possible (rational) reason ....Administrator wrote:I don't understand the problem here. What stock is going negative?
That's all (and enough, at least for me..)
L.
-
- Super Administrator
- Posts: 4683
- Joined: Wed Mar 05, 2003 3:10 am
Re: Strange behaviour
Sorry, I must have got this confused with another thread.
Change the integration type to Euler instead of RK4. I'm not sure why things are not working out correctly with RK4, I'll look into it.
Change the integration type to Euler instead of RK4. I'm not sure why things are not working out correctly with RK4, I'll look into it.
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
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Strange behaviour
Hi, thank you a lot... I changed and it seemingly (and strangely) works... any rational explanation?Administrator wrote:Sorry, I must have got this confused with another thread.
Change the integration type to Euler instead of RK4. I'm not sure why things are not working out correctly with RK4, I'll look into it.
Lorenzo
Re: Strange behaviour
Tony identified the problem as the integration method, which is correct. Here's why.
Simplifying and translating a bit, you have:
in = 60
out = fout = if( stock > desired stock, alpha*stock, 0)
for alpha =.06 and stock=1000, alpha*stock=in=60.
However, if stock = desired stock, out = 0. So, the only way this system can be in equilibrium is in the limit as stock approaches 1000 from the high side (i.e. 1000.0001 is very close). With Euler integration, you can see this happening - if you initialize the stock to 1000, the initial outflow is 0, the stock jumps to 1060, and then decays towards 1000.
Runge Kutta integration calculates flows via several updates within a time step. So, the same kind of behavior happens, but you can't see it, because the data isn't recorded. The result is that the outflow can be 60 when the stock is 1000, even though the equations suggest that can't be.
The large discrete change in the stock at the s1=1000 boundary is a violation of the continuity assumptions of RK integration, so Euler is a better choice (or a different formulation, depending on what this is).
Simplifying and translating a bit, you have:
in = 60
out = fout = if( stock > desired stock, alpha*stock, 0)
for alpha =.06 and stock=1000, alpha*stock=in=60.
However, if stock = desired stock, out = 0. So, the only way this system can be in equilibrium is in the limit as stock approaches 1000 from the high side (i.e. 1000.0001 is very close). With Euler integration, you can see this happening - if you initialize the stock to 1000, the initial outflow is 0, the stock jumps to 1060, and then decays towards 1000.
Runge Kutta integration calculates flows via several updates within a time step. So, the same kind of behavior happens, but you can't see it, because the data isn't recorded. The result is that the outflow can be 60 when the stock is 1000, even though the equations suggest that can't be.
The large discrete change in the stock at the s1=1000 boundary is a violation of the continuity assumptions of RK integration, so Euler is a better choice (or a different formulation, depending on what this is).
/*
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
*/
-
- Senior Member
- Posts: 102
- Joined: Wed Jul 30, 2014 7:09 am
- Vensim version: PLE
Re: Strange behaviour
Hi Tonytomfid wrote:Tony identified the problem as the integration method, which is correct. Here's why.
Simplifying and translating a bit, you have:
in = 60
out = fout = if( stock > desired stock, alpha*stock, 0)
for alpha =.06 and stock=1000, alpha*stock=in=60.
However, if stock = desired stock, out = 0. So, the only way this system can be in equilibrium is in the limit as stock approaches 1000 from the high side (i.e. 1000.0001 is very close). With Euler integration, you can see this happening - if you initialize the stock to 1000, the initial outflow is 0, the stock jumps to 1060, and then decays towards 1000.
Runge Kutta integration calculates flows via several updates within a time step. So, the same kind of behavior happens, but you can't see it, because the data isn't recorded. The result is that the outflow can be 60 when the stock is 1000, even though the equations suggest that can't be.
The large discrete change in the stock at the s1=1000 boundary is a violation of the continuity assumptions of RK integration, so Euler is a better choice (or a different formulation, depending on what this is).
great explanation... thank you a lot.
Lorenzo