Variables that influence inflow and outflow rates of stocks?

Use this forum to post Vensim related questions.
Post Reply
MarvinK
Junior Member
Posts: 11
Joined: Wed Nov 24, 2021 4:17 pm
Vensim version: PRO

Variables that influence inflow and outflow rates of stocks?

Post by MarvinK »

Hello everyone,

I’m a researcher from Germany and system dynamics modeling in Vensim, which I’m becoming more and more enthusiastic about, is new to me. I have encountered many of the excellent sources for learning and now have a question that came up while developing my first model. As a start, I wanted to replicate a transportation model that is presented by Sterman in Business Dynamics (chapter 5). The model is only described as a causal loop diagram. I would assume that according to the “snapshot test” (chapter 6.2.2) some of the elements should be defined as stocks (e.g. “Highway Capacity”, “Cars in Region”, “Size of the Region within Desired Travel Time”, and maybe also “Attractiveness of Driving”?).

How should I define stocks that have variables as inputs, which can influence the inflow and an outflow rates? “Cars in Region” for example would depend on “Cars per Person” and “Population”. These two, however, can rise or fall, and thereby increase (inflow) or decrease (outflow) “Cars in Region”. Would it make sense to define linkages to the inflow and the outflow rates and then saying that there is only an inflow when the input variable(s) increase(s) and an outflow when the input variable(s) decrease(s)? Wouldn’t that cause quite messy graphical representations when stock rates have several inputs (such as in the case of “Attractiveness of Driving”, which has “Travel Time”, “Desired Travel Time”, “Adequacy of Public Transit”, and “Public Transit Fare” in the given example). Would it be better to define these variables as auxiliary variables and not as stocks?

How should I handle this practically? I’m very much looking forward to your help (to this probably rather beginner question).

Best wishes and many thanks,
Marvin
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Variables that influence inflow and outflow rates of stocks?

Post by tomfid »

Taking your example of Cars in Region, I'd keep it simple. The stock of cars has an inflow of purchasing and an outflow of discarding. If the regions is connected to other regions, there might also be migration in/out, but I'd ignore that at the start.

Purchasing is then the link to population and desired cars/person. Typically, you'd model purchasing as doing several things:
- replacing discards
- adjusting the stock of cars toward the desired stock of cars

The desired stock of cars is then the product of the population and desired cars per capita. Desired cars per capita presumably depends on some kind of long term smoothed perception of the attractiveness of driving, which I would tend to think of as a stock, though your model might also have an instantaneous attractiveness reflecting current conditions.
MarvinK
Junior Member
Posts: 11
Joined: Wed Nov 24, 2021 4:17 pm
Vensim version: PRO

Re: Variables that influence inflow and outflow rates of stocks?

Post by MarvinK »

Many thanks for your quick reply! This was very helpful and the idea to use some long term smoothed function makes sense to me. I already tried to implement your suggestions yesterday and have continued to work on the stocks today. 2 short questions about this:

1. Wouldn’t it in some cases also make sense to directly link the inflows of different stocks (and outlows). For example, cars consume land space. So when I have a stock of cars, which has purchases as an inflow and scrappings as an outflow (e.g. depending on the average life time of a car), I assume the inflow of a stock that represents land consumption could simply correspond to new purchases (and some factor of how many square meters one car consumes)? The same respectively for the outflow...

2. Do you have suggestions on how to define units for intangible elements like “Attactiveness of Driving”. Is a dimensionless variable fine or should I define some imaginary unit?

Again many thanks!
MarvinK
Junior Member
Posts: 11
Joined: Wed Nov 24, 2021 4:17 pm
Vensim version: PRO

Re: Variables that influence inflow and outflow rates of stocks?

Post by MarvinK »

EDIT: With regard to question 1, that would also be possible for “Attractiveness for Driving”, wouldn’t it? When combining a stock “A” to a stock “B” I link the inflows and outflows and add a variable that accounts for the effect a change in stock A has on stock B. This would allow me to take more easily into account that stock "A" can both rise and fall, hence having different effects on stock "B". When there is a stock "C", which again has an effect on stock "B", I would do the same. That also seems to help a lot in defining the units correctly. I probably underestimated the amount of stocks...

Does this make sense or should I avoid this? Many thanks for your help with these probably simple questions. However, I feel like they are crucial to my understanding of modelling system dynamics...
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Variables that influence inflow and outflow rates of stocks?

Post by tomfid »

MarvinK wrote: Wed Dec 01, 2021 6:17 pm Wouldn’t it in some cases also make sense to directly link the inflows
Yes ... for example, an attribute of the vehicle like its fuel requirements for operation would be a good candidate. I think land is more complicated, because it's not strictly 1:1 with vehicles. When you buy a car, your city doesn't automatically pave an additional parking space at the same moment. So I think that's a related, but separate structure.
MarvinK wrote: Wed Dec 01, 2021 6:17 pm units for intangible elements
I often make these "dmnl" but in some cases it may be helpful to define some kind of "attr index" unit just to keep concepts separate.
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Variables that influence inflow and outflow rates of stocks?

Post by tomfid »

MarvinK wrote: Thu Dec 02, 2021 3:22 pm EDIT: With regard to question 1, that would also be possible for “Attractiveness for Driving”, wouldn’t it? When combining a stock “A” to a stock “B” I link the inflows and outflows and add a variable that accounts for the effect a change in stock A has on stock B. This would allow me to take more easily into account that stock "A" can both rise and fall, hence having different effects on stock "B". When there is a stock "C", which again has an effect on stock "B", I would do the same. That also seems to help a lot in defining the units correctly. I probably underestimated the amount of stocks...

Does this make sense or should I avoid this? Many thanks for your help with these probably simple questions. However, I feel like they are crucial to my understanding of modelling system dynamics...
Without knowing what A, B, C represent I'm not sure how to respond in the abstract.

My general inclination would be to start simple, maybe with just 2 stocks: cars and road capacity, for example. Once that is working, consider elaborating.
MarvinK
Junior Member
Posts: 11
Joined: Wed Nov 24, 2021 4:17 pm
Vensim version: PRO

Re: Variables that influence inflow and outflow rates of stocks?

Post by MarvinK »

Unfortunately, I have to come back to my problem. I have started simple and elaborated step-by-step. So far this has worked quite well. However, I realized that in some cases it doesn't make sense defining variables as stocks. For example, current “Car Usage”, at least in my understanding, does not “accumulate”. The same should be true for current “Travel Time”. These should rather represent in how far car usage and travel time in- or decrease relatively (as a fraction, starting with 1 “dmnl”).

This brings me, however, back to my original problem. Let’s assume “Road Capacity” influences “Travel Time” as more roads ease traffic jams. From a conceptual view point “Travel Time” would also need current “Car Usage” as an input (which also includes the number of vehicles), but I want to keep it simple here. So, whenever “Road Capacity” increases, “Travel Time” drops, all else equal; whenever it decreases, “Travel Time” increases. So far so good.

Now, you could assume that “Travel Time” influences “Attractiveness of Driving”, which could be perceived as a stock (as you have pointed out earlier). But how should I make a linkage from an auxiliary variable (“Travel Time”), which can both in- and decrease, to a stock (“Attractiveness of Driving”). I tried to pick up on one of your earlier posts and built in a smoothening function. The stock will, however, still increase, as long as “Travel Time” is positive. In other words, it continues to rise, even if “Travel Time” decreases, only at smaller rates. This is obviously the nature of a stock. If I also create a linkage to the stock's outflow, nothing should change, since in- and outflow cancel out each other’s effect. So, what can I do to have an auxiliary variable linked to a stock and let the stock increase (maybe with some delay) when the auxiliary variable changes in one direction and actually decrease when it changes in the other direction.

Please find attached a simple version of this in Vensim. In the upper part you can see the way I tried to solve this so far; in the lower part a new sketch (I know these do not behave identically). The variables containing the “effects” are made simple here and should actually be non-linear. Also, I attach a screenshot of a section of the larger model I have experimented with so far to give some background information (variable names translated quickly). In the model you can see that I am having the same problem again with “Trips per day” and “Length of trips” influencing “Car Usage”. However, I would actually also think of “Car Usage” as not being a stock. Either way it looks a bit messy because of the way I’m trying to solve my problem.

I hope I managed to make my problem clear. Many thanks for your help!

Best wishes,
Marvin
8628_5637024cb43b26ef379c7ba0f8eeec72.png
8628_5637024cb43b26ef379c7ba0f8eeec72.png (47.03 KiB) Viewed 3109 times
Attachments
Screenshot model.PNG
Screenshot model.PNG (46.84 KiB) Viewed 3160 times
Auxiliary variables and stocks.mdl
(6.35 KiB) Downloaded 121 times
MarvinK
Junior Member
Posts: 11
Joined: Wed Nov 24, 2021 4:17 pm
Vensim version: PRO

Re: Variables that influence inflow and outflow rates of stocks?

Post by MarvinK »

Does anyone have an idea? @tomfid Would you mind looking at my problem again? I would be very happy to receive tips!

Best wishes everyone!
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Variables that influence inflow and outflow rates of stocks?

Post by tomfid »

A couple thoughts:

I think separate inflows/outflows to stocks are overused here. Unlike vehicle purchases and discards, there aren't obvious distinct processes that increase vs. decrease car usage or travel time.

Also, I think making car utilization and travel time coflow stocks is problematic. Utilization is a good candidate for a stock, because people can't easily change their planned utilization instantly. However, once vehicles on the road and road capacity are fixed, travel time is basically instantaneous physics.

I've attached an excerpt from a simple model we used to support discussions in California a few years ago. It's not perfect, and a little messy due to surgical removal, but may give you some alternative ideas.
MarvinK
Junior Member
Posts: 11
Joined: Wed Nov 24, 2021 4:17 pm
Vensim version: PRO

Re: Variables that influence inflow and outflow rates of stocks?

Post by MarvinK »

Hey, many thanks for your thoughts and suggestions! I’m back at work and motivated to take up the ideas and improve my understanding.

I would be happy to have a look at that model you’ve mentioned, but can't find an attachment. Is this a problem on my side?

Best wishes!
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Variables that influence inflow and outflow rates of stocks?

Post by tomfid »

It's the new zero-length file format.

My bad. Here it is.
TranspoExcerpt.mdl
(24.19 KiB) Downloaded 135 times
Note that there are some hidden variables on the diagram, so you may need to unhide to see everything (h key or View menu).
alvinpoon
Member
Posts: 32
Joined: Sun Mar 01, 2020 6:23 am
Vensim version: PRO

Re: Variables that influence inflow and outflow rates of stocks?

Post by alvinpoon »

Tom

just a simple basic technical question about the file of TranspoExcerpt

The equation for the vairable of "Perceived Driving cost",
there should be two variables: "Time to Perc the cost" and "Normal driving cost"
Why I cannot see the two variables and the arrows in the sketch view.
how to do this and why to do so?

Thanks
Last edited by alvinpoon on Mon Jan 24, 2022 3:30 pm, edited 1 time in total.
alvinpoon
Member
Posts: 32
Joined: Sun Mar 01, 2020 6:23 am
Vensim version: PRO

Re: Variables that influence inflow and outflow rates of stocks?

Post by alvinpoon »

Sorry, I just find them by unhide
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Variables that influence inflow and outflow rates of stocks?

Post by tomfid »

The "why" part of your question may be a little harder to answer. This excerpt comes from a larger model that included the petroleum supply side. It was normally presented to people in more digestible chunks. There was a comprehensive view, with some of the details hidden, that we sometimes used to show the total scope of the problem, and I copied this from that view. So there may be a few things hidden to reduce visual spaghetti, that really shouldn't be if you want a good representation of the dynamics.
MarvinK
Junior Member
Posts: 11
Joined: Wed Nov 24, 2021 4:17 pm
Vensim version: PRO

Re: Variables that influence inflow and outflow rates of stocks?

Post by MarvinK »

Some time has passed and I wanted to give some feedback. Thank you so much for sharing the model (TranspoExcerpt.mdl). The model has been incredibly helpful!! I can hardly emphasise that enough. It was helpful and valuable both in terms of our mobility research and in terms of what I have learned about building Vensim models in general. This includes the way the model is calibrated with an initial equilibrium, all the sensitivities and the initial values to which changes in the model are compared. We have been able to develop our model quite a bit and have also built sub-models in different views. I can recommend everyone (especially those new to Vensim) to have a look at the model. I’ve learned quite a lot from it.

By the way, we have bought three licenses for Vensim Pro in the meantime, which I'm looking forward to working with.

Again, many thanks!
tomfid
Administrator
Posts: 3804
Joined: Wed May 24, 2006 4:54 am

Re: Variables that influence inflow and outflow rates of stocks?

Post by tomfid »

Great!
Post Reply