I'm building a model with timesteps in months. I want to look at the levels every year and then reset to zero at time = 12, 24 etc. (So I can see the accumulated costs at year end.)
Is there an easy way to do this?
Resetting Levels
-
- Junior Member
- Posts: 17
- Joined: Thu Jul 29, 2004 8:28 pm
I'd do this using a PULSE function. So basically you can create an additional vaiable (auxiliary) and pulse the content of the level to this variable after every 12 months (so you don't have to reset the content of the level of course).
Although it might cause some unit inconsistency problems, if you don't have such concerns it should work just fine.
Although it might cause some unit inconsistency problems, if you don't have such concerns it should work just fine.
There are many ways to do this. The one I use most often is to create a Level and a new Auxilary. The auxilary has the format:
if then else( MODULO(time,12)=0, 1,0)
which is an "end of year flag" (assuming you are starting them model at the beginning of a year).
The LEVEL equation would then be
LEVEL =
INFLOW - LEVEL * FLAG/TIME STEP
This will create a level giving you a saw tooth kind of output, with each peak being the end of year value.
if then else( MODULO(time,12)=0, 1,0)
which is an "end of year flag" (assuming you are starting them model at the beginning of a year).
The LEVEL equation would then be
LEVEL =
INFLOW - LEVEL * FLAG/TIME STEP
This will create a level giving you a saw tooth kind of output, with each peak being the end of year value.