How Do I Tell JaamSim an attribute or a constant is a Dimensionless Unit (vs Unknown Unit)?

264 views
Skip to first unread message

Jerry L

unread,
Jan 5, 2015, 7:06:51 PM1/5/15
to jaamsi...@googlegroups.com
I could not get BooleanIndicator to work (will discuss in another post), so I tried some logic of my own using UniformDistribution. 

See the two attached screenshots.

The logic works, but when I save and re-load I get the error message:

*** INPUT ERROR *** Entity: Branch1, Keyword: Choice - Unit mismatch: 'Unknown Unit' and 'DimensionlessUnit' are not compatible
([UniformDistribution1].Value<=[UniformDistribution1].ProbabilityOfSuccess)+1

After experimenting with it, it seems "1" and [UniformDistribution1].ProbabilityOfSuccess are both Unknown Unit, but I do not see a way to add a Unit "Dimensionless".

Could JaamSim be made to default to "Dimensionless" if a unit is not specified?
Capture2.PNG
Capture1.PNG

Jerry L

unread,
Jan 5, 2015, 7:31:27 PM1/5/15
to jaamsi...@googlegroups.com

I was able to easily solve my problem after reading the thread on BooleanIndicator/DiscreteDistribution with Jean-Christophe and Harry.  Yeah!

But my broader question remains about how to tell a constant or attribute that it is Dimensionless.  I hit that problem a lot.

Jerry L

unread,
Jan 5, 2015, 7:32:38 PM1/5/15
to jaamsi...@googlegroups.com
(I meant Boolean Selector above)

Harry King

unread,
Jan 5, 2015, 8:09:04 PM1/5/15
to jaamsi...@googlegroups.com
Jerry,

I have been meaning to remove BooleanSelector from JaamSim. It is only used in some of our TLS models and doesn't work properly with the rest of JaamSim. As I mention in the other post, its job is done better by DiscreteDistribution.

A dimensionless attribute is defined simply by leaving out the unit in the input to the AttributeDefinitionList keyword, e.g. { a 0 } defines attribute "a" with initial value 0 (dimensionless), { b 1 m } defines attribute "b" with initial value 1 m (DistanceUnit).

The inputs in your screenshots look correct to me. I tried the same thing and didn't get an error message. Can you send me your input file? Enforcing consistent units is new to attributes and expressions, so it is quite possible that there are bugs.

Harry

Jerry L

unread,
Jan 6, 2015, 1:02:08 AM1/6/15
to jaamsi...@googlegroups.com

Yes, once I read that other thread, DiscreteDistribution worked easily.

I'll e-mail the model with the errors.  It runs, but if I save it it gives the error when loading.  I am using 52b (unreleased) 64-bit.

In other places, I do not put a unit and have no problems.

Harry King

unread,
Jan 6, 2015, 4:03:31 PM1/6/15
to jaamsi...@googlegroups.com
Jerry,

Thanks for sending your model. It exposes a problem with the sequence in which the input file entries are saved. A UnitType input for UniformDistribution1 appeared AFTER the Choice input for Branch1. I will email you version of the input file with this problem fixed.

To fix this problem in the code, we need to save all the UnitType inputs for the various objects immediately after the objects are defined. We already so this for the AttributeDefinitionList inputs, so this should not be too difficult.

Harry

Jerry L

unread,
Jan 6, 2015, 4:38:32 PM1/6/15
to jaamsi...@googlegroups.com
Thanks Harry,

I already worked around the problem and finished the model, so no need to send me a fix.  The work-around used the DiscreteDistribution object and actually worked much better than the original approach.

If it helps fix a software bug, then I am glad we found it!

Harry King

unread,
Jan 8, 2015, 8:22:01 PM1/8/15
to jaamsi...@googlegroups.com
Jerry,

The bug you experienced is now fixed in release 2015-01.

Harry
Reply all
Reply to author
Forward
0 new messages