Page 1 of 1
Dimentional Unit in equation
Posted: Wed May 19, 2010 12:57 am
by qingri212
I want to get a y with a lookup about x
but the unit of x is widget
and the unit of y is widget/month
how to make the unit of y be widget/month in a lookup function?
I have tried to write it as "withlookup{x/1 month..."
or "withlookup{x/1~month..."
or "withlookup{x/1<month>..."
but they are wrong.
Posted: Wed May 19, 2010 7:33 am
by LAUJJL
the standard way to do that is:
Y = standard value of y * lookup function(x / standard value of x) where standard value of y has unit widget/month and standard value of x has unit widget and the ratio x / standard value of x has unit dimensionless (DMNL). The standard value of y = the value that takes Y when x equal the standard value of x. This means that in the lookup table, the value of 1 gives the corresponding value of 1. I always write my lookup function like this. It is very understandable and practical. If you do not use a dimensionless value in the lookup function, Vensim will generate a warning. Notice that the lookup function itself is dimensionless (DMNL) too.
Example joined
JJ
[Edited on 19-5-2010 by LAUJJL]
[Edited on 19-5-2010 by LAUJJL]
Posted: Wed May 19, 2010 9:30 am
by bob@vensim.com
What JJ describes is the best practice. It is often called normalization.
If you do want the x axis to be interpreted as actual values rather than normalized values use the format
output = my lookup(input / unit widget)
unit widget = 1
or equivalently
output = WITH LOOKUP(input/unit widget ([(0,0.

-(1,1)],(0,1),(1,1) ))
Thank you
Posted: Wed May 19, 2010 9:48 am
by qingri212
Originally posted by LAUJJL
the standard way to do that is:
Y = standard value of y * lookup function(x / standard value of x) where standard value of y has unit widget/month and standard value of x has unit widget and the ratio x / standard value of x has unit dimensionless (DMNL). The standard value of y = the value that takes Y when x equal the standard value of x. This means that in the lookup table, the value of 1 gives the corresponding value of 1. I always write my lookup function like this. It is very understandable and practical. If you do not use a dimensionless value in the lookup function, Vensim will generate a warning. Notice that the lookup function itself is dimensionless (DMNL) too.
Example joined
JJ
[Edited on 19-5-2010 by LAUJJL]
[Edited on 19-5-2010 by LAUJJL]
I think I can go through with your help, thanks.
But I just wonder can I write an equation with units in it?
what if I want to compute as " Y = 1 widgets / X (which has a unit, month)" ?
Posted: Wed May 19, 2010 9:58 am
by qingri212
Originally posted by bob@vensim.com
What JJ describes is the best practice. It is often called normalization.
If you do want the x axis to be interpreted as actual values rather than normalized values use the format
output = my lookup(input / unit widget)
unit widget = 1
or equivalently
output = WITH LOOKUP(input/unit widget ([(0,0.

-(1,1)],(0,1),(1,1) ))
If I write like:
"
output = my lookup(input / unit widget)
unit widget = 1
"
Does that mean I creat a new variable?
and if I write:
"
output = WITH LOOKUP(input/unit widget ([(0,0.

-(1,1)],(0,1),(1,1) ))
"
Vensim will ask me if I want to add a new variable "unit wighet"
Posted: Wed May 19, 2010 10:16 am
by LAUJJL
You cannot write an equation with units in it. Unless you specify that 1 widget is a constant whose value is 1 and unit is widget.
JJ
Posted: Thu May 20, 2010 2:36 am
by qingri212
Originally posted by LAUJJL
You cannot write an equation with units in it. Unless you specify that 1 widget is a constant whose value is 1 and unit is widget.
JJ
At last...
So I should not think of it...
I can do it in Powersim software, so, maybe it is one of the needed development of Vensim.
Thank you!
Posted: Thu May 20, 2010 2:33 pm
by tomfid
I don't know how it works in Powersim, but in general, I think that building unit conversions into equations is not a good practice. It's too easy to introduce inconsistencies or errors, where a unit conversion is used in multiple places. Also, implicit unit conversions often hide an actual uncertain parameter that should be subject to sensitivity analysis, and that's only practical if the unit is made a separate variable.
Tom
Posted: Fri May 21, 2010 1:43 am
by qingri212
Good point
I will show you the way in Powersim
I just think that would be a little bit more convenient sometimes.
in Powersim you can write like:
(Y widget; x widget/month)
Y = X*1<<month>>
then the unit of Y become widget
Posted: Fri May 21, 2010 4:06 pm
by tomfid
Interesting ...
I agree that this would be convenient in some cases, especially where the conversion has a fixed definition, as from English to SI units (feet to meters, for example).
Conversions involving time often imply a shift from stock (widget) to flow (widget/time) dimensions, in which case the conversion factor (1<<month>> above) represents an implicit time constant, which should always be made explicit, so that it is subject to sensitivity analysis and model testing for robustness to TIME STEP variation.
Tom