Page 1 of 1

Tipping Point

Posted: Mon Mar 14, 2016 5:38 pm
by johnjohnson4
Hello , I am attempting to model the dynamics of a tipping point:
1) Stock A increases then returns to its initial value.
2) If Stock A increase beyond a certain point (tipping point) then it will decrease to a new level = initial value +X

Any good ideas / examples?

I gave it a try ( see attached)
Outflow rate for Stock A (Rx)= IF THEN ELSE(MAX(Stock A,Stock A)<= TippingPoint, Stock A*(Stock A - Initial Value)/Initial Value), Stock A*(Stock A - Initial Value-X)/Initial Value))* 1/Time

Problem: Rx drops below zero and causes Stock A to increase rather than decrease.

Thanks in advance!

Re: Tipping Point

Posted: Tue Mar 15, 2016 11:50 am
by Administrator
There are lots of discussions on the forum regarding negative rates.

Typically if I were to do something like you describe, I'd have a "desired stock". This would start at the initial value, and then be changed to "initial value + X" when the tipping point was reached (you can use the SAMPLE IF TRUE function to get this). You can then use the "desired stock" and "stock" to calculate the available capacity, and use to control the outflow.

If might help to review the following thread,
http://www.ventanasystems.co.uk/forum/v ... red#p21869

Re: Tipping Point

Posted: Tue Mar 15, 2016 3:03 pm
by johnjohnson4
Thank you very much. This is a good hint. My challenge now is holding the tipping point once it is reached.

1) Lets say the values for "stock A" are: 1,3,2,4,10,1,2
2) The tipping point =9
3) I used the Max function to "Test" if tipping point was reached:
"Test" =MAX ("stock A","stock A")

The problem is When I use the MAX function I get "Test"= 1,3,2,4,10,1,2. The results I need are "Test"= 1,3,3,4,10,10,10
I need the value of the variable to always be equal to or greater than the previous value.

Any Ideas?

Re: Tipping Point

Posted: Tue Mar 15, 2016 3:05 pm
by Administrator
Try SAMPLE IF TRUE. Max will only give you the maximum of a value at a point in time (it has no memory).

Re: Tipping Point

Posted: Tue Mar 15, 2016 3:51 pm
by johnjohnson4
That sounds exactly like what I need. Unfortunately SAMPLE IF TRUE is not available for PLE+ ( or PLP)

Guess I should have mentioned the version of Vensim I am working with in my original post. Can I create the functionality manually by combining other functions?

Re: Tipping Point

Posted: Tue Mar 15, 2016 4:19 pm
by Administrator
If you type it into the equation editor it should still work (I just tried it).

If it doesn't, you can get very close using a level (it will be one time step out).

Eg, this is almost the same as sampled variable = SAMPLE IF TRUE ( time > 10 , val to sample , initial sample var )

sampled variable = integ(
+ if then else ( Time > 10 , val to sample / TIME STEP , 0 )
- if then else ( Time > 10 , sampled variable / TIME STEP , 0 )
, initial sample var )

Re: Tipping Point

Posted: Tue Mar 15, 2016 5:31 pm
by johnjohnson4
AWESOME!
SAMPLE IF TRUE works! This may be the key to my tipping point problem. Will post my final solution.

Thanks

Re: Tipping Point

Posted: Wed Mar 16, 2016 4:35 pm
by johnjohnson4
Thanks very much for your help! My tipping point model works great (see attached). Any recommended improvements are welcome.

John