Cast time unit to dimensionless unit

162 views
Skip to first unread message

Sean Bergstedt

unread,
Aug 23, 2016, 4:39:06 PM8/23/16
to Jaamsim Users Discussion Group
Is there any way to convert a TimeUnit to DimensionLess?  In Java you can normally cast types between each other.  I'm trying to use a timestamp as key for priority in a queue.

Sean Bergstedt

unread,
Aug 23, 2016, 5:04:57 PM8/23/16
to Jaamsim Users Discussion Group
Harry, you can disregard.  I found a work around.  I simply use an assignment early in the process logic to sync with said timestamp and use the priority key in the queue when I need it.

Harry King

unread,
Aug 23, 2016, 5:15:39 PM8/23/16
to Jaamsim Users Discussion Group
Sean,

Simply divide the value with units of time by a constant with units of time. For example, if your object has an attribute called timestamp with units of time, then enter the expression 'this.timestamp/1[s]'. JaamSim does all the unit manipulations automatically, so it knows that this expression returns a dimensionless value.

Harry

Sean Bergstedt

unread,
Aug 23, 2016, 5:28:08 PM8/23/16
to Jaamsim Users Discussion Group
Thank you, Harry!
Reply all
Reply to author
Forward
0 new messages