I have a model that is supposed to calculate Transit ridership, and I have unit of time set to Year but time step set to daily (1/365) , most of the calculations done are daily except birth and death rates.
Daily Transit ridership is calculated and I want to have a way to see the total rides in a year, so add up all rides from each day.
I considered a stock variable but I don't know of a way to make it go back to zero at the beginning of each year in the simulation. Should i be using a stock variable or a stock variable? and how can I zero the total rides each year? or should i change the models time unit?
The model is attached below.
how to have a stock variable that zeros at a specific time step?
how to have a stock variable that zeros at a specific time step?
- Attachments
-
- New Model copy.mdl
- (7.15 KiB) Downloaded 282 times
-
- Super Administrator
- Posts: 4827
- Joined: Wed Mar 05, 2003 3:10 am
Re: how to have a stock variable that zeros at a specific time step?
The time step in the model is one year, not 1/365. There is guidance in the Vensim help system on how to select an appropriate time step. In this model, I would probably use day as a time measurement, not year.
To reset a level you can do something like this.
level = integ (inflow-outflow,initial value)
outflow = level / time step
I'd strongly urge you to add units to the model and make sure it passes this test.
To reset a level you can do something like this.
level = integ (inflow-outflow,initial value)
outflow = level / time step
I'd strongly urge you to add units to the model and make sure it passes this test.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: how to have a stock variable that zeros at a specific time step?
Thank you for the replay, it was really helpful.
Regarding the Outflow I want to check if I understand what you mean
If the models measurement is in days and the time step is also a day and Yearly transit ridership is a level with formula (daily transit ridership- outflow, initial value)
The outflow would be = Yearly transit ridership/Day -> Level/Time Step?
I am unsure of how that would collect the yearly ridership in this case and subtracts it.
Am I missing something or is your suggestion based on different time settings?
Regarding the Outflow I want to check if I understand what you mean
If the models measurement is in days and the time step is also a day and Yearly transit ridership is a level with formula (daily transit ridership- outflow, initial value)
The outflow would be = Yearly transit ridership/Day -> Level/Time Step?
I am unsure of how that would collect the yearly ridership in this case and subtracts it.
Am I missing something or is your suggestion based on different time settings?
Re: how to have a stock variable that zeros at a specific time step?
Also how would the population be calculated given that the birth rate is in years