Ventana Systems UK Forum Last active: Never
Not logged in [Login - Register]
Go To Bottom

Printable Version | Subscribe | Add to Favourites   Post new thread Poll:
Author: Subject: ordering outflows
msc87
Junior Member
**




Posts: 6
Registered: 1-5-2010
Member Is Offline


wink.gif posted on 1-5-2010 at 12:15 Reply With Quote
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]
View User's Profile View All Posts By User U2U Member
Administrator
Super Administrator
*********




Posts: 599
Registered: 3-5-2003
Member Is Offline

Mood: No Mood.

[*] posted on 1-6-2010 at 11:28 Reply With Quote


Can you create an aux variable, eg,

remaining stock = stock0 - outflow_1 * time step

outflow_2 = .5 * remaining stock
View User's Profile View All Posts By User U2U Member
bob@vensim.com
Administrator
********




Posts: 1005
Registered: 3-12-2003
Member Is Offline

Mood: No Mood.

[*] posted on 1-6-2010 at 11:31 Reply With Quote


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.
View User's Profile View All Posts By User U2U Member
msc87
Junior Member
**




Posts: 6
Registered: 1-5-2010
Member Is Offline


[*] posted on 3-10-2010 at 12:09 Reply With Quote


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?
View User's Profile View All Posts By User U2U Member
Administrator
Super Administrator
*********




Posts: 599
Registered: 3-5-2003
Member Is Offline

Mood: No Mood.

[*] posted on 3-10-2010 at 15:57 Reply With Quote


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.
View User's Profile View All Posts By User U2U Member
msc87
Junior Member
**




Posts: 6
Registered: 1-5-2010
Member Is Offline


sad.gif posted on 3-26-2010 at 22:46 Reply With Quote


[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
View User's Profile View All Posts By User U2U Member
bob@vensim.com
Administrator
********




Posts: 1005
Registered: 3-12-2003
Member Is Offline

Mood: No Mood.

[*] posted on 3-27-2010 at 10:06 Reply With Quote


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.
View User's Profile View All Posts By User U2U Member
Post new thread Poll:


Go To Top


Powered by XMB
Developed By Aventure Media & The XMB Group © 2002-2006


[queries: 15]
[PHP: 80.6% - SQL: 19.4%]