Stock Accumulation

Use this forum to discuss any issues relating to Systems Dynamics and Systems Thinking.
Post Reply
aalto-comnet
Member
Posts: 20
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Stock Accumulation

Post by aalto-comnet » Mon Feb 04, 2019 10:55 am

Hello!

I have a stock which is accumulating data. When this data is constant, the stock is normally showing the data accumulation per year. However, when I read some non-constant data per year from a csv file, the accumulation is not accurate.

Could it be an integration function issue? Any ideas?

Thanks!

Administrator
Super Administrator
Posts: 3286
Joined: Wed Mar 05, 2003 3:10 am

Re: Stock Accumulation

Post by Administrator » Mon Feb 04, 2019 10:57 am

Can you upload an example?

Vensim will interpolate between points, so you might need to make use of the RAW data keyword to ensure you just accumulate the points.
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

aalto-comnet
Member
Posts: 20
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Stock Accumulation

Post by aalto-comnet » Mon Feb 04, 2019 2:00 pm

Hi!

Thank you for relying. In the end, I believe it is a timestep issue. The model was accumulating in one stock based on time that was written in decimal form whereas for the other time didn't contain decimal points (e.g., 2010 for one stock, 2010.5 for the other stock).

Administrator
Super Administrator
Posts: 3286
Joined: Wed Mar 05, 2003 3:10 am

Re: Stock Accumulation

Post by Administrator » Mon Feb 04, 2019 2:20 pm

I'd be surprised if it were a time step issue.
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

aalto-comnet
Member
Posts: 20
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Stock Accumulation

Post by aalto-comnet » Mon Feb 04, 2019 2:47 pm

Here is the file I am using as input, and its output with a 0.25 timestep. There are two stocks accumulating equally so the result should be the input divided by two. As you can see from the closer screen shot the result is wrong. If timestep is set to 1 then the output is as it should.
Attachments
output-2.png
output-2.png (30.16 KiB) Viewed 976 times
output-1.png
output-1.png (48.71 KiB) Viewed 976 times
input.png
input.png (30.44 KiB) Viewed 976 times

Administrator
Super Administrator
Posts: 3286
Joined: Wed Mar 05, 2003 3:10 am

Re: Stock Accumulation

Post by Administrator » Mon Feb 04, 2019 2:55 pm

Changing time step to make something look correct indicates an error in the model.
Here are some guidelines on selecting a suitable time step.
http://www.vensim.com/documentation/ind ... e_step.htm

Have you looked at
http://www.vensim.com/documentation/ind ... mulate.htm

I think this is what you need (along with the correct time step for your model).
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

aalto-comnet
Member
Posts: 20
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Stock Accumulation

Post by aalto-comnet » Mon Feb 04, 2019 6:43 pm

Hi there!

Thank you for spending time on this.

The model here states that it is missing a vdf file and therefore I cannot simulate it.
http://www.vensim.com/documentation/ind ... mulate.htm

Essentially, the model I am using is this one attached. I doubt that there could be an error in it, as it is a sample model from Vensim's website.

What I am doing, in the end, is reading the demand from the csv that I have attached above instead of giving a constant demand of 1 million/year.

However, the installed bases are displayed incorrectly as shown in the figures, if the timestep is left at 0.25. If timestep is set at 1 the results are correct.

If you could be so kind to let me know how would you treat the installed bases using the cumulate function (I presume this is what you suggest), I would really appreciate it.
Attachments
NETWORKE.MDL
(11.82 KiB) Downloaded 27 times

Administrator
Super Administrator
Posts: 3286
Joined: Wed Mar 05, 2003 3:10 am

Re: Stock Accumulation

Post by Administrator » Tue Feb 05, 2019 8:06 am

That model (networke.mdl) runs fine for me and does not need any external data. And it's not one of our models (a quick search of the web suggests it comes with the Business Dynamics book).

For Vensim sample models, look on your machine, try C:\Users\Public\Vensim\Models\FunctionExamples.

If you upload what you are working on, I'm sure I can help.
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

aalto-comnet
Member
Posts: 20
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Stock Accumulation

Post by aalto-comnet » Tue Feb 05, 2019 11:07 am

Hello!

Please find attached the model I am working on. What is not making sense, as I have mentioned, is that when timestep is set to 1, the installed bases (and the apps stocks) are accumulating fine, whereas when it is set to 0.25 or 0.5 they are not.

Please feel free to ask in case anything is not making sense to you or make recommendations/suggestions on how would you design anything differently.

Thank you!
Attachments
model.zip
(11.78 KiB) Downloaded 29 times

Administrator
Super Administrator
Posts: 3286
Joined: Wed Mar 05, 2003 3:10 am

Re: Stock Accumulation

Post by Administrator » Tue Feb 05, 2019 3:20 pm

What are the exact parameters that are giving errors?

And what is a suitable time step to use?
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

aalto-comnet
Member
Posts: 20
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Stock Accumulation

Post by aalto-comnet » Tue Feb 05, 2019 6:57 pm

A 0.25 timestep would be suitable.

The four stocks, two installed bases and two app stocks, are not accumulating correctly at this timestep. And neither they do with a 0.5 timestep for example. They do accumulate correctly nevertheless with a timestep of 1.

Administrator
Super Administrator
Posts: 3286
Joined: Wed Mar 05, 2003 3:10 am

Re: Stock Accumulation

Post by Administrator » Wed Feb 06, 2019 12:16 pm

I think you need to look into more detail at the data equations.

Between data points, Vensim interpolates the data. For example, the value used for "TOTAL number of app store and google play apps" will be interpolated between the two yearly points which is why the total accumulation is not correct.

I think if you use :HOLD_BACKWARD:, the numbers will match what you expect.
http://www.vensim.com/documentation/ind ... ations.htm

You might also want to put units into your model, this is another very common source of errors.
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

aalto-comnet
Member
Posts: 20
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Stock Accumulation

Post by aalto-comnet » Wed Feb 06, 2019 6:45 pm

Let me just double-check this with you, to see if there is something I misunderstand here.

Let's just run the model with a 0.5 timestep. As far as I understand, this implies that the smartphone demand of 2009 for example, which is 173500000, will be evenly accumulated from the two installed bases in two steps. That is 86750000 (173500000/2) until 2009.5 and another 86750000 until 2010.

If that is correct, I can understand the 433750000 (86750000/2) that is shown for each installed base at 2009.5, however I cannot understand the 103150000 that is shown at 2010. Where does this value come from? Shouldn't it be 86750000 for each installed base? The 433750000 that is accumulated until 2009.5 plus another 433750000 to sum a total of 173500000 from the two installed bases.

Am I saying something wrong?

Administrator
Super Administrator
Posts: 3286
Joined: Wed Mar 05, 2003 3:10 am

Re: Stock Accumulation

Post by Administrator » Thu Feb 07, 2019 9:01 am

I cannot follow what you are describing. Can you quote exact variable names so I can look at those in the model?

I'd also strongly suggest adding units to ensure your model passes the most basic of quality checks. Personally, I do not believe any results I see from a model unless it is dimensionally correct.
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

aalto-comnet
Member
Posts: 20
Joined: Fri Dec 07, 2018 9:20 am
Vensim version: DSS

Re: Stock Accumulation

Post by aalto-comnet » Thu Feb 07, 2019 10:41 am

Yes, you are right about adding units.

Please run the model as it is, with a timestep of 0.5. Does the value of 103150000 that shows up for both "iPhone Installed Base" and "Android Installed Base" at year 2010 make sense to you?

From what I understand it should be 86750000.

Post Reply