Jump to content
Simio Forum

Explanation of traveltime expression


Recommended Posts

Math.If(Token.ReturnValue > 0.0, Size.Length / (Token.ReturnValue + (Token.ReturnValue == 0.0)), Infinity)


determines the EntityMovementRate on a timepath.


Can someone explain the "(Token.ReturnValue == 0.0)"?


Token.ReturnValue is equal to the time the entity will take to traverse the path, so I can see the inverse relationship of time and speed, but I do no understand the purpose of that sub expression. If my thinking is correct, it will always evaluate to 0. If the IF statement somehow broke, only then would it evaluate to 1.

 

2013-09-19_16-14-20.thumb.png.ae2e4d8714e697f8979203e1377c7c4d.png

Link to post
Share on other sites

I think that expression was simply originally coded that way to avoid any possibility of a Divide By Zero error, because the Math.If function in early Simio versions was evaluating every argument.


However, I think now the Math.If only evaluates an argument in the expression if it has to, so possibly that TimePath expression could be simplified to remove that '+ (Token.ReturnValue==0.0)' stuff.


Regardless, it is of course harmless coded as is.

Link to post
Share on other sites
×
×
  • Create New...