how to have a stock variable that zeros at a specific time step?

Use this forum to post Vensim related questions.
Post Reply
Noorgm
Junior Member
Posts: 5
Joined: Wed Aug 16, 2023 4:41 pm
Vensim version: DSS

how to have a stock variable that zeros at a specific time step?

Post by Noorgm »

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.
Attachments
New Model copy.mdl
(7.15 KiB) Downloaded 37 times
Administrator
Super Administrator
Posts: 4590
Joined: Wed Mar 05, 2003 3:10 am

Re: how to have a stock variable that zeros at a specific time step?

Post by Administrator »

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.
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
Noorgm
Junior Member
Posts: 5
Joined: Wed Aug 16, 2023 4:41 pm
Vensim version: DSS

Re: how to have a stock variable that zeros at a specific time step?

Post by Noorgm »

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?
Noorgm
Junior Member
Posts: 5
Joined: Wed Aug 16, 2023 4:41 pm
Vensim version: DSS

Re: how to have a stock variable that zeros at a specific time step?

Post by Noorgm »

Also how would the population be calculated given that the birth rate is in years
Post Reply