Min/Max

The Min/Max accessor (class ) is similar to the Condition accessor but handles common cases when an attribute must be tested against a minimum and a maximum threshold. When the attribute is changed, another attribute is set. The assigned value depends on whether the value of the current attribute is less than the minimum, between the minimum and the maximum, or greater than the maximum. In addition, an exception condition can be specified: if the exception condition is true, no value is changed.

Parameters

  • Minimum: Defines the minimum value.

  • Maximum: Defines the maximum value.

  • Except if: If this value is true, the value is ignored and the output value or attribute is not set. The expression must result in a Boolean value.

  • Attribute: Attribute that is set to one of the following three values.

  • If x < min: Value to which the attribute is set if the value is less than the minimum.

  • If min < x < max: Value to which the attribute is set if the value is between the minimum and the maximum.

  • If x > max: Value to which the attribute is set if the value is greater than the maximum.

Example 1

This accessor is attached to a Temperature attribute. When Temperature is set, if Nobody’s at Home is true, nothing is done. If the Temperature is below 15, HeatOn is assigned to ClimateControl. If Temperature is above 25, CoolingOn is assigned to ClimateControl. If the temperature is between 15 and 25, AllOff is assigned to ClimateControl.

Example 2

This example shows the vertGauge prototype in the sample library.