Saved Results vs TimeStep Results

Use this forum to post Vensim related questions.
Post Reply
johnjohnson4
Member
Posts: 47
Joined: Mon Mar 14, 2016 4:58 pm
Vensim version: PLE+

Saved Results vs TimeStep Results

Post by johnjohnson4 »

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
Attachments
3x6_FactorialVectorMV_082902016_Final_.vsc
(339 Bytes) Downloaded 207 times
Emergence_EngineeredSystem_Simulation_082272016_FINAL_Demo.mdl
(12.44 KiB) Downloaded 201 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Saved Results vs TimeStep Results

Post by tomfid »

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 )
johnjohnson4
Member
Posts: 47
Joined: Mon Mar 14, 2016 4:58 pm
Vensim version: PLE+

Re: Saved Results vs TimeStep Results

Post by johnjohnson4 »

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).
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Saved Results vs TimeStep Results

Post by tomfid »

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:.
johnjohnson4
Member
Posts: 47
Joined: Mon Mar 14, 2016 4:58 pm
Vensim version: PLE+

Re: Saved Results vs TimeStep Results

Post by johnjohnson4 »

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
Attachments
Emergence_EngineeredSystem_Simulation_082272016_FINAL_Demo.mdl
(13.74 KiB) Downloaded 204 times
johnjohnson4
Member
Posts: 47
Joined: Mon Mar 14, 2016 4:58 pm
Vensim version: PLE+

Re: Saved Results vs TimeStep Results

Post by johnjohnson4 »

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
Post Reply