Dimentional Unit in equation

Use this forum to post Vensim related questions.
Post Reply
qingri212
Junior Member
Posts: 14
Joined: Thu Jan 22, 2009 5:43 am

Dimentional Unit in equation

Post 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.
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Post 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]
Attachments
standard lookup.mdl
(2.21 KiB) Downloaded 233 times
bob@vensim.com
Senior Member
Posts: 1107
Joined: Wed Mar 12, 2003 2:46 pm

Post 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.8)-(1,1)],(0,1),(1,1) ))
qingri212
Junior Member
Posts: 14
Joined: Thu Jan 22, 2009 5:43 am

Thank you

Post 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)" ?
qingri212
Junior Member
Posts: 14
Joined: Thu Jan 22, 2009 5:43 am

Post 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.8)-(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.8)-(1,1)],(0,1),(1,1) ))
"
Vensim will ask me if I want to add a new variable "unit wighet"
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Post 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
qingri212
Junior Member
Posts: 14
Joined: Thu Jan 22, 2009 5:43 am

Post 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!
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Post 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
qingri212
Junior Member
Posts: 14
Joined: Thu Jan 22, 2009 5:43 am

Post 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
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Post 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
Post Reply