Hello,
I am making a calculation using a variable with a time step of .25. I am saving the results of the valuable every 500 units . Is there a way to make the calculation based on the saved results rather than the values at each time step ? The valuable is "IRE (∆I/∆Itp)" and it is used to calculate "(IRE)".
Thanks,
john
Saved Results vs TimeStep Results
-
- Member
- Posts: 47
- Joined: Mon Mar 14, 2016 4:58 pm
- Vensim version: PLE+
Saved Results vs TimeStep Results
- Attachments
-
- 3x6_FactorialVectorMV_082902016_Final_.vsc
- (339 Bytes) Downloaded 214 times
-
- Emergence_EngineeredSystem_Simulation_082272016_FINAL_Demo.mdl
- (12.44 KiB) Downloaded 212 times
Re: Saved Results vs TimeStep Results
You could use SAMPLE IF TRUE to sample the value of the variable every 500 units. Something like:
saved x = SAMPLE IF TRUE( PULSE TRAIN(INITIAL TIME, TIME STEP, SAVEPER, FINAL TIME), actual x, actual x )
saved x = SAMPLE IF TRUE( PULSE TRAIN(INITIAL TIME, TIME STEP, SAVEPER, FINAL TIME), actual x, actual x )
/*
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
*/
-
- Member
- Posts: 47
- Joined: Mon Mar 14, 2016 4:58 pm
- Vensim version: PLE+
Re: Saved Results vs TimeStep Results
Not sure I undertand. I am currently using the following formula:
IRE = SAMPLE IF TRUE(("IRE (∆I/∆Itp)")>=1,1,0)
I only want the ccalculation to occure every 500 units rather than ever time step ( which is .25).
IRE = SAMPLE IF TRUE(("IRE (∆I/∆Itp)")>=1,1,0)
I only want the ccalculation to occure every 500 units rather than ever time step ( which is .25).
Re: Saved Results vs TimeStep Results
The PULSE TRAIN(INITIAL TIME, TIME STEP, SAVEPER, FINAL TIME) creates a signal variable that is zero most of the time, and 1 at intervals equal to SAVEPER (assuming that SAVEPER=500). If you also want to capture a value only when IRE > 1, you can just add that to the condition with :AND:.
/*
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
*/
-
- Member
- Posts: 47
- Joined: Mon Mar 14, 2016 4:58 pm
- Vensim version: PLE+
Re: Saved Results vs TimeStep Results
Making progress!
I now have the IRE variable sampling on the SAVEPER intervals. Great! But it does not stay at the max value. The IRE variable is a tipping point. Once it reaches 1, it should stay at 1. The previous formula worked fine for this purpose but it was not sampling t the right interval. Now the sample interval correct but the value does not hold at one after it is triggered.
The idea is that when the saver value of "IRE (∆I/∆Itp)" >=1, then IRE should trigger and stay at 1. Based on the attached simulaiton, IRE should trigger at 3500 and stay at 1 continuously from that point forward.
New IRE formula: correct sample inteval and triggers at 3500 but does not hold at 1 after the trigger
IRE= SAMPLE IF TRUE(PULSE TRAIN(500, 1 , 500, 5000 ),IF THEN ELSE("IRE (∆I/∆Itp)">=1,1,0),0)
Old IRE formula: Holds at 1 after the trigger, but sample interval is wrong and trigger occures before 3500
SAMPLE IF TRUE(("IRE (∆I/∆Itp)")>=1,1,0)
Thanks!
john
I now have the IRE variable sampling on the SAVEPER intervals. Great! But it does not stay at the max value. The IRE variable is a tipping point. Once it reaches 1, it should stay at 1. The previous formula worked fine for this purpose but it was not sampling t the right interval. Now the sample interval correct but the value does not hold at one after it is triggered.
The idea is that when the saver value of "IRE (∆I/∆Itp)" >=1, then IRE should trigger and stay at 1. Based on the attached simulaiton, IRE should trigger at 3500 and stay at 1 continuously from that point forward.
New IRE formula: correct sample inteval and triggers at 3500 but does not hold at 1 after the trigger
IRE= SAMPLE IF TRUE(PULSE TRAIN(500, 1 , 500, 5000 ),IF THEN ELSE("IRE (∆I/∆Itp)">=1,1,0),0)
Old IRE formula: Holds at 1 after the trigger, but sample interval is wrong and trigger occures before 3500
SAMPLE IF TRUE(("IRE (∆I/∆Itp)")>=1,1,0)
Thanks!
john
- Attachments
-
- Emergence_EngineeredSystem_Simulation_082272016_FINAL_Demo.mdl
- (13.74 KiB) Downloaded 211 times
-
- Member
- Posts: 47
- Joined: Mon Mar 14, 2016 4:58 pm
- Vensim version: PLE+
Re: Saved Results vs TimeStep Results
Think I got it!
The duration of the pulse signal was longer than the time step which allowed the samples to occure beyond the saveper interval. Once I shorten the duration to <=time step, I get the tirgger occure at the correct interval and stays at 1 .
Thanks for your help!! Appreciate it very much.
john
The duration of the pulse signal was longer than the time step which allowed the samples to occure beyond the saveper interval. Once I shorten the duration to <=time step, I get the tirgger occure at the correct interval and stays at 1 .
Thanks for your help!! Appreciate it very much.
john