Stock & Flow: Initial Value Issue

Use this forum to post Vensim related questions.
Post Reply
Husky123
Newbie
Posts: 1
Joined: Sat Jun 24, 2023 8:55 am
Vensim version: PLE

Stock & Flow: Initial Value Issue

Post by Husky123 »

Hi there,

I have a question about a simplified Vensim stock and flow diagram and would greatly appreciate your help!

Background:
I would like to demonstrate a stock "Demand for Student Housing" with an inflow "On-Campus Accommodation" and an outflow "Off-Campus Accommodation.

Values:
Time measured in Years
Demand for Student Housing initial value = 5000
On-Campus Accommodation value (fixed) = 500
Off-Campus Accommodation value = 4500


On-Campus Accommodation is a fixed value based on campus amenities available. Off-Campus Accommodation would increase depending on the overall Demand for Student Housing (this depends on the number of enrolled students, but I have left this out for simplification and to demonstrate my problem). But let's believe the above values are true for any years to come.

Problem:
When running the simulation, everything seems neat in "Year 0" based on the above values. However, when looking at "Year 1", it appears that Vensim carries over the initial value (here, "5000") to the next year and incorporates it into the result. I do not want to carry the initial value into the next year as it falsifies the demand I want to demonstrate.

Question:
Is there a formula that incorporates a time element saying that if the current time is greater than Year 0, the initial value is set to 0? Or even a formula that I could add that always resets the initial value from Year 1 (and following) to 0?
I was thinking potentially the below equations, but both equations came back with errors:

Equation 1
Demand for Student Housing = INTEG ("On-Campus Accommodation" - "Off-Campus Accommodation", 0, IF THEN ELSE (TIME > 0, 0, "On-Campus Accommodation" - "Off-Campus Accommodation"))
Error: "expecting an operator"
Note: I also don't believe there is a variable available to demonstrate "TIME" (as the first input for the IF THEN ELSE formula)

Or Equation 2
Demand for Student Housing = INTEG(("On-Campus Accommodation" - "Off-Campus Accommodation"), 0)
Error: Info beyond the final closing ) - check for an extra )


I have attached the .mdl file as well as a screenshot of the diagram. I also reworked the results in Excel and uploaded the file, which makes it very clear that Vensim takes the demand from the previous year into account when calculating following years.
Potentially, the matter at hand should not be demonstrated as a stock and flow diagram?
I am a newbie and just started working with Vensim, so I apologise if anything of the above does not make sense.

Thank you in advance for any support.
Attachments
Picture2_Demand for Student Housing.png
Picture2_Demand for Student Housing.png (90.8 KiB) Viewed 2180 times
Student Housing issue.xlsx
(9.63 KiB) Downloaded 336 times
Student Housing issue.mdl
(1.82 KiB) Downloaded 345 times
Administrator
Super Administrator
Posts: 4827
Joined: Wed Mar 05, 2003 3:10 am

Re: Stock & Flow: Initial Value Issue

Post by Administrator »

It might be best to start with a tutorial in Vensim before attempting this. That would help with the understanding of the difference between stocks and flows.

http://www.public.asu.edu/~kirkwood/sysdyn/SDRes.htm
On this page you will find a really good Vensim PLE tutorial.

I think you've got things wrong conceptually. The "demand for rooms" can be a level, it would increase with the "number of new students" each year, and decrease by "students finishing their courses".

"On campus accommodation" is probably a constant. Or maybe a level, it increases with "new on campus accommodation built", and decreases with "on campus accommodation demolished".

"Off campus accommodation" would then be
demand for rooms - on campus accommodation.
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
tomfid
Administrator
Posts: 3986
Joined: Wed May 24, 2006 4:54 am

Re: Stock & Flow: Initial Value Issue

Post by tomfid »

Husky123 wrote: Sat Jun 24, 2023 12:46 pm Problem:
When running the simulation, everything seems neat in "Year 0" based on the above values. However, when looking at "Year 1", it appears that Vensim carries over the initial value (here, "5000") to the next year and incorporates it into the result. I do not want to carry the initial value into the next year as it falsifies the demand I want to demonstrate.
This is not a problem, it's the definition of a stock or level variable, which represents accumulation. With Euler integration,

Stock(t+TIME STEP) = Stock(t) + TIME STEP*(inflow-outflow)

As Admin suggests, reformulating the model with stocks of students and housing is a good solution.
Post Reply