Stock & Flow: Initial Value Issue
Posted: Sat Jun 24, 2023 12:46 pm
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.
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.