What kind of variable to use

Use this forum to post Vensim related questions.
Post Reply
Priscila
Senior Member
Posts: 51
Joined: Thu Aug 25, 2016 1:11 pm
Vensim version: PRO

What kind of variable to use

Post by Priscila »

Good afternoon,
I need to create a variable (can be level) where I have an initial value and need to go discounting this value, for example:
X = 30 initial value
Y = 1,2,3,4
Z = 20 at the end of the simulation

How Do I Get Z?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: What kind of variable to use

Post by tomfid »

I think you'll have to supply some more detail here. What are x, y and z and their units? What is this system doing?
Priscila
Senior Member
Posts: 51
Joined: Thu Aug 25, 2016 1:11 pm
Vensim version: PRO

Re: What kind of variable to use

Post by Priscila »

X is an initial value, amount of raw material that the company receives per month
Y is the amount of raw material consumed over the month
Z is what still has available raw material
What has available (Z) is used for the production of the product (W) that will supply the amount of raw material used (Y).
The units are all liters.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: What kind of variable to use

Post by tomfid »

So, putting this in SD language,
X is the inflow of material supply
Y is the outflow of material consumption
Z is the stock of material on hand

Then:
Z = INTEG(X-Y, initial Z)

If the units for Z are liters, then X and Y must be in liters/month.

One way to frame this is as an optimization problem, using the optimizer to determine the X needed to provide enough material to serve Y and leave Z=20 at the end.

An approach that's more likely to be satisfying is to treat this as a dynamic stock management problem, like the "target production" decision in the workforce-inventory model distributed with Vensim:
https://www.vensim.com/documentation/21445.htm
Priscila
Senior Member
Posts: 51
Joined: Thu Aug 25, 2016 1:11 pm
Vensim version: PRO

Re: What kind of variable to use

Post by Priscila »

Is Z a level variable?
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: What kind of variable to use

Post by tomfid »

Correct. Terminology varies unfortunately, but stock = level = state variable = integral, and flow = rate = derivative.

In Vensim, stocks are defined by the INTEG function, and usually a box on the diagram (though you can change the diagram to diverge from the convention).
Priscila
Senior Member
Posts: 51
Joined: Thu Aug 25, 2016 1:11 pm
Vensim version: PRO

Re: What kind of variable to use

Post by Priscila »

It is not working because the simulation runs in a period of 2683 (which is the period of a month of 15 in 15 minutes) and the variable X is a data that enters at t = 0 and decays as used (Y), however the Variable Z is accumulating at each t + 1 it increases the value of X and decreases Y. I need a variable that reduces the stock (initial value when t = 0) over time, as production increases.
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: What kind of variable to use

Post by tomfid »

Can you post the model?
Priscila
Senior Member
Posts: 51
Joined: Thu Aug 25, 2016 1:11 pm
Vensim version: PRO

Re: What kind of variable to use

Post by Priscila »

The model is attached, the variables I am trying to adjust are in blue, contextualizing with the previous conversations the amount of fuel received is X, Y is the fuel output and Z represents stored alcohol.
Attachments
Demanda e consumo UFSM- abril 2014 e 2015.xlsx
(873.66 KiB) Downloaded 175 times
Etanol Hard- Pequena Escala 3.mdl
(24.75 KiB) Downloaded 191 times
tomfid
Administrator
Posts: 3806
Joined: Wed May 24, 2006 4:54 am

Re: What kind of variable to use

Post by tomfid »

I think the problem is that you don't have any feedback to determine the inflow (Quantidade de combustível recebido). Setting it to a constant won't work in general.

The generic form of what you need is something like:

inflow = expected outflow + (desired stock - stock)/stock adjustment time

There's an example of this in the workforce-inventory model link I posted above (except in that case, the inflow is not direct, but mediated by the labor force).
Post Reply