ExpressionThreshold

The ExpressionThreshold object varies its state between open and closed depending on the value returned by an expression.

The expression to be evaluated is specified by the OpenCondition keyword.  It is re-evaluated with every time advance of the model, and on demand when the Open output is tested by another Expression.

Normally, an ExpressionThreshold is open when the OpenCondition is TRUE and IS closed when it is FALSE.  However, it is possible to specify a separate expression to close the ExpressionThreshold using the CloseCondition keyword.  When this keyword is specified, the threshold remains open until the CloseCondition expression is TRUE.

The CloseCondition keyword introduces some special cases to be addressed:

·         If the two conditions conflict by both returning TRUE, then the threshold is considered to be open.

·         If both conditions are FALSE, then the threshold's previous open or closed state is retained.

·         If both conditions are FALSE at the start of the simulation run, then InitialOpenValue keyword determines whether the threshold is open or closed.

Expression thresholds CANNOT be used in some circumstances.  The expressions entered to the OpenCondition and CloseCondition keywords are tested only when an event occurs in the model such as the arrival of an entity or the completion of processing a Server.  Normally, this restriction has no effect on a discrete event simulation since every change of the model's state is associated with an event.  However, it is possible to enter an expression that changes between TRUE and FALSE without an event occurring.  This can occur when simulation time is used explicitly in an expression, e.g. 'this.SimTime > 5[s]'.  An ExpressionThreshold will detect this condition becoming TRUE at the first event that occurs after 5 seconds.  The correct way to model this type of condition is to use a TimeSeries and a TimeSeriesThreshold.

The ShowPendingStates keyword is used to detect situations where an ExpressionThreshold is being used inappropriately.  A "pending state" is the situation where the present values for the OpenCondition and CloseCondition expressions are inconsistent with the present state of the ExpressionTheshold.  This situation can be detected when the ExpressionTheshold is visible in the View window because the OpenCondition and CloseCondition expressions are re-evaluated every time the computer screen is refreshed.