Finding MAX of simulation variable

Use this forum to post Vensim related questions.
Post Reply
geo_curious
Member
Posts: 46
Joined: Tue Mar 14, 2023 2:05 am
Vensim version: DSS

Finding MAX of simulation variable

Post by geo_curious »

Hi all,

I am running into this requirement on several simulations. I need to solve for another variable by using the MAX of another variable which may only be found through running of the simulation. VMAX and VMIN appear inappropriate for the case I will show here. I believe it seems appropriate for the GET DATA MAX() function, but I cannot get it to run correctly.

Case:
Find the MAX logarithmic mean temperature difference (LMTD) for a heat exchanger. So, I can easily find a rolling LMTD, but to size a heat exchanger I need the MAX. Therefore, I need to search across the simulation time for the occurrence of the MAX LMTD and extract it from the Vensim output.

GET DATA MAX(LMTD, initial time, final time) would work, I think, but for whatever reason it does not return anything.

After getting the MAX, I need it to solve another equation, so maybe I can execute the final equation at time=FINAL TIME. In either case, I need to first extract that MAX across time from INITIAL TIME to FINAL TIME.

How else can I approach this problem?
Thank you.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Finding MAX of simulation variable

Post by tomfid »

If you can make the calculation at FINAL TIME, you can use SAMPLE IF TRUE to hold the max value over the simulation - there's an example in the help system.
geo_curious
Member
Posts: 46
Joined: Tue Mar 14, 2023 2:05 am
Vensim version: DSS

Re: Finding MAX of simulation variable

Post by geo_curious »

Thank worked, thank you!
Looks like...
SAMPLE IF TRUE( LMTD>max LMTD, LMTD, LMTD)
Post Reply