Skip to content

Level Events

The level object is available to the level event handler as a local variable. Level events are triggered by a level change on a particular device. This eliminates having to constantly evaluate a level against a previous value.

LEVEL.VALUE is an embedded object value in the LEVEL_EVENT statement. The LEVEL.VALUE object eliminates the need to create a level for the TEMP device.

Syntax:

1
2
3
4
LEVEL_EVENT[DEVICE,LEVEL] or LEVEL_EVENT[(DEVLEV[])]
{
    // level event handler
}

It contains the information shown in the table below:

Level Value Object

Property Name Type Description
Level.Input DEVLEV Device + Level that caused the event to occur
Level.Input.Device DEV Device
Level.Input.Device.Number INTEGER Device number
Level.Input.Device.Port INTEGER Device port
Level.Input.Device.System INTEGER System number
Level.Input.Level INTEGER Level number
Level.SourceDev DEV Source Device of Level Event
Level.SourceDev.Number INTEGER Source Device Number
Level.SourceDev.Port INTEGER Source Device Port
Level.SourceDev.System INTEGER Source Device System
Level.Value Numeric Level value

The numeric value is stored either as a floating-point number or integer as appropriate, but the value can be assigned to a variable of any numeric type.

Example

LEVEL_EVENT[TEMP, 1]
{
    IF (LEVEL.VALUE >= COOL_POINT)
    {
        ON[RELAY,FAN]
    }
    ELSE IF (LEVEL.VALUE  <= HEAT_POINT)
    {
        OFF[RELAY,FAN]
    }
}

See Also