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.
Dimentional Unit in equation
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]
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
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
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 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
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)" ?
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"
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!
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
Tom
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
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
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
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/