Thanks Bob. My random lookup is now doing what I expect. Of course, I still have to make the delay work properly:)
Jen
How to use "Random Lookup"
Sorry, one more minor problem. I am still having unit incompatibility issues.
The stretch parameter is expected to be dimensionless. This works fine in the conceptual world because:
stretch = (outMax-outMin)/(inMax-inMin)
where in and out denote the input and output distributions. In this situation, the units cancel each other out.
In the RANDOM LOOKUP structure, the min and max parameters are truncation not rescaling. This is why they can be set to -1e9 and 1e9 if the stretch and shift are appropriate. However, the units for the output of the RANDOM LOOKUP are taken from the min and max parameters.
Where the input lookup is structured so the x axis is [0,1], this simplifies to outMax-outMin (your formulation above) but this has units. In fact, it is really (outMax-outMin)/unit but this is not in the model.
I don't think I have explained this well. Essentially, the stretch parameter must be dimensionless, but:
1/ if maxOut and MinOut have units, the formula will lead to a unit error
2/ if maxOut and minOut don't have units, there is no obvious way to give units to the results of the RANDOM LOOKUP
At the moment I have a 'UnitFix' auxiliary which has a value of 1 and has the time unit. I then do (outMax-outMin)/UnitFix. This is not elegant. Anything better?
[Edited on 11-11-2008 by tangent]
The stretch parameter is expected to be dimensionless. This works fine in the conceptual world because:
stretch = (outMax-outMin)/(inMax-inMin)
where in and out denote the input and output distributions. In this situation, the units cancel each other out.
In the RANDOM LOOKUP structure, the min and max parameters are truncation not rescaling. This is why they can be set to -1e9 and 1e9 if the stretch and shift are appropriate. However, the units for the output of the RANDOM LOOKUP are taken from the min and max parameters.
Where the input lookup is structured so the x axis is [0,1], this simplifies to outMax-outMin (your formulation above) but this has units. In fact, it is really (outMax-outMin)/unit but this is not in the model.
I don't think I have explained this well. Essentially, the stretch parameter must be dimensionless, but:
1/ if maxOut and MinOut have units, the formula will lead to a unit error
2/ if maxOut and minOut don't have units, there is no obvious way to give units to the results of the RANDOM LOOKUP
At the moment I have a 'UnitFix' auxiliary which has a value of 1 and has the time unit. I then do (outMax-outMin)/UnitFix. This is not elegant. Anything better?
[Edited on 11-11-2008 by tangent]
- Attachments
-
- DelayRandom.mdl
- (3.56 KiB) Downloaded 367 times
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
Thanks, much more elegantOriginally posted by bob@vensim.com
As long as you are not truncating the table - and not really any reason to do this you could simply use
TargetMin + (TargetMax-TargetMin) * RANDOM LOOKUP(DelayShape, 0, 1, 0, 1, 0)
that should fix the units problem.
