Automatic Control Module

Overview

Automatic Control Module is an additional module for the Server application that sends commands and generates events when certain conditions are met. The module helps to implement various control algorithms and sending notifications without the need for programming, through the user interface. The following figure shows the form for configuring the module.

Automatic Control Module

Information about fired triggers, sent commands and events is recorded in the ModAutoControl.log module log file, which can be viewed using the Administrator application or any text editor.

Installation

Automatic Control Module is installed according to the instructions. The module installation sequence is typical.

Configuring

Setting up the module involves creating triggers that fire when certain conditions are met. Triggers can be of different types, discussed below. When a trigger fires, the module sends commands and generates events that relate to that trigger.

To open the module configuration form, go to the Server > Modules page, select the ModAutoControl module and click the Properties button. The module should be in the list of active modules. The module configuration is saved in the ModAutoControl.xml file.

Triggers

Channel Data Trigger

A channel data trigger is fired when the channel value and status match the conditions specified in the trigger parameters. When started, the module populates a list of channels that satisfy the channel filter. The value and status of the channel, which are specified by the trigger parameters, are checked individually for each channel from that list. If the channel filter is empty, the trigger works for all active channels of the input type.

The trigger has a state that provides the ability to delay and repeat the trigger firing. The trigger state is saved during the module's operation and is loaded when Server starts.

Channel data trigger

Multi-Channel Data Trigger

This type of trigger is used if the condition must take into account the values ​​of more than one channel. If the status of any of the specified channels is not defined, then the condition for that channel is considered not to be met. The trigger state is saved and loaded by the module.

Multi-channel data trigger

Channel Data Change Trigger

A trigger fires when the value or status of the specified channel changes. The corresponding parameter is intended to limit the trigger frequency.

Channel data change trigger

Event Trigger

An event trigger fires if an event that occurs in the system meets the specified conditions. The trigger also responds to events generated by the module itself. When a trigger fires, new events cannot be generated to avoid an infinite loop.

Event trigger

Time Trigger

A time trigger can fire every day at specified times, on specific days of the week, days of the month, or on a specific date.

Time trigger

Command Trigger

A trigger on a command is convenient to use in cases where a series of commands need to be sent based on one command. If a trigger has a data validation condition, the incoming command data is converted to a string using UTF8 encoding and then checked against the condition.

The trigger also responds to commands sent by the module itself. The maximum recursion depth is limited to 10 levels.

Command trigger

Commands

The figure below shows the parameters of the command that is sent when the trigger fires or normalizes. A command can be sent to a channel or directly to a device. If a command is sent to a channel, the command will be checked for permissions and the output formula will be calculated. If a command is sent to a device, it will be added to the queue for sending to clients as is, without any additional processing. When sending a command to a device, specify the command number or code.

Command configuration

If the Copy value checkbox is checked, the value of the command being sent will be copied from the value of the channel or command that fired the trigger, if applicable for the given trigger type. The string data specified in the command parameters may contain variables, which are described below.

Events

The following figure shows the parameters of the event that is generated when the trigger fires or normalizes.

Event configuration

If the event severity is set to default (0) in the module configuration, it is assigned by Server based on the channel status. If the severity is non-zero, the event is created with the specified severity.

If the Acknowledgment required checkbox is not set, but the Ack Required field is set in the configuration database for the channel status, then the event acknowledgement flag is assigned by Server based on the status.

The Custom text of the generated event is static without variable support.

Variables

The string data of commands that are sent when triggers fire can contain variables. Variables are written in curly braces.

The following variables are supported:

Variable Description
For triggers of all types
{n} Current value of channel n, formatted, with dimensions. If n = 0, the trigger channel is used (if applicable)
{Now} Current date and time in the server time zone
{NowUtc} Current UTC date and time
{Time} Trigger fire time in the server time zone
{TimeUtc} Trigger fire time, UTC
For triggers on channel data
{CnlNum} Channel number
{CnlName} Channel name
{ObjNum} Object number
{ObjName} Object name
{DevNum} Device number
{DevName} Device name
{LoLo} Low low channel limit
{Low} Lower channel limit
{High} Upper channel limit
{HiHi} High high channel limit
{CnlVal} Channel value that caused the trigger to fire
{CnlStat} Channel status that caused the trigger to fire
For event triggers
{EvID} Event ID
{EvTime} Event time in the server time zone
{EvObjNum} Object number of the event
{EvObj} Object name of the event
{EvDevNum} Device number of the event
{EvDev} Device name of the event
{EvCnlNum} Channel number of the event
{EvCnl} Channel name of the event
{EvText} Display text of the event
{EvSev} Displayed event severity
For command triggers
{CmdVal} Command value that caused the trigger to fire
{CmdDataStr} Command data as a string
{CmdDataHex} Command data in hexadecimal