msc87
Junior Member

Posts: 6
Registered: 1-5-2010
Member Is Offline
|
posted on 1-5-2010 at 12:15 |
|
|
ordering outflows
Hi dear friends
I want to have a outflow(outflow_2) from stock which should be ordered with another outflow(outflow_1).it means that the size of outflow_2 should be
calculated remnant amount of stock after outflow_1 reduced the stock from.
formulation would be like this :
outflow_2= .5 * (stock0 - outflow_1+ inflow)
:D
[Edited on 1-5-2010 by msc87]
|
|
|
Administrator
Super Administrator
       
Posts: 599
Registered: 3-5-2003
Member Is Offline
Mood: No Mood.
|
posted on 1-6-2010 at 11:28 |
|
|
Can you create an aux variable, eg,
remaining stock = stock0 - outflow_1 * time step
outflow_2 = .5 * remaining stock
|
|
|
bob@vensim.com
Administrator
      
Posts: 1005
Registered: 3-12-2003
Member Is Offline
Mood: No Mood.
|
posted on 1-6-2010 at 11:31 |
|
|
You can use that equation for outflow_2 - though it has units errors. The standard formulation to prevent a stock going negative would be
outflow 2 = MIN(target outflow 2,(stock + (inflow - outflow 1)*TIME STEP)/TIME STEP)
Note that this will only work with Euler/Diff integration techniques - generally it is much better practice to use formulations based only on the
stock and choose TIME STEP small relative to those flow rates as in
outflow 2 = MIN(target outflow,stock/min stock processing time 2)
See the molecules for more discussion of this.
|
|
|
msc87
Junior Member

Posts: 6
Registered: 1-5-2010
Member Is Offline
|
posted on 3-10-2010 at 12:09 |
|
|
Hi
I tried to use your recommendations but when i introduced Time Step parameter i faced with an error message saying that there is a parameter with this
name.
so now what should I do?
how can i use time step? and another question:
As i know this time step depends on simulation time step of modeling but i don't know if i have to change this parameter manually in model or not, if
I want to change time step in any running time?
|
|
|
Administrator
Super Administrator
       
Posts: 599
Registered: 3-5-2003
Member Is Offline
Mood: No Mood.
|
posted on 3-10-2010 at 15:57 |
|
|
Use the shadow tool to add TIME STEP to a model view. Or just type it in the equation, Vensim will add it to the sketch automatically.
|
|
|
msc87
Junior Member

Posts: 6
Registered: 1-5-2010
Member Is Offline
|
posted on 3-26-2010 at 22:46 |
|
|
[quote][i]Originally posted by Administrator[/i]
Use the shadow tool to add TIME STEP to a model view. Or just type it in the equation, Vensim will add it to the sketch automatically. [/quote]
i did it but it again showed an error message. I should introduce this variable to the model but when i want to use it as a auxiliary variable, an
error message "the variable TIME STEP already exists" appears or when I write it directly in an equation, another message " unexpected variable"
emerges.
if it is possible for yo, please give me a simple sample of your proposed model.
thanks a lot
|
|
|
bob@vensim.com
Administrator
      
Posts: 1005
Registered: 3-12-2003
Member Is Offline
Mood: No Mood.
|
posted on 3-27-2010 at 10:06 |
|
|
The Ball.mdl model shows how to write auxiliary equations for Time Step.
If you are using Vensim PLE you will need to Add TIME STEP (which is a built in variable) to the sketch using the Shadow Variable tool (keyboard 8)
then creating an arrow from that to your equation.
|
|
|