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.
Finding MAX of simulation variable
-
- Senior Member
- Posts: 136
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
Re: Finding MAX of simulation variable
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.
/*
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: 136
- Joined: Tue Mar 14, 2023 2:05 am
- Vensim version: DSS
Re: Finding MAX of simulation variable
Thank worked, thank you!
Looks like...
SAMPLE IF TRUE( LMTD>max LMTD, LMTD, LMTD)
Looks like...
SAMPLE IF TRUE( LMTD>max LMTD, LMTD, LMTD)