Automatic management with Logics

The logic is described by a line in the following form:

(SENSORID OLDSTATE-NEWSTATE OPERATOR ...){SENSORID1:TIMEOUT NEWSTATE2 OPERATOR2 ...}

where

  • SENSORID – unique ID of Didactum`s sensor.
  • OLDSTATE-NEWSTATE - sensor status codes, with which the condition is true in transition. The values of both parameters should be the same.
  • OPERATOR - the operator code with which the result of conditions is calculated.
  • SENSORID1 - Unique sensor id, which status should be changed under the conditions of the logical scheme.
  • TIMEOUT - A timeout condition.
  • NEWSTATE2 - The status code where you want to move the element (relay).
  • OPERATOR2 - Symbol '+'.

Status codes :

  • 'normal': 1;
  • 'low': 2;
  • 'warning': 3;
  • 'alarm': 4;
  • 'on': 5;
  • 'off': 6.
  • 'not connected': 7.
  • 'pulse': 8.

Operator codes:

  • 'and': symbol '+';
  • 'or': symbol '|'.

Management of logic

To create a logic, just use field ctlLogicRowStatus. Moving field ctlLogicRowStatus in a state CreateAndWait(5) will create a new note in the table ?tlLogicsTable.

After creating new logic, you must specify its name in field ctlLogicName and description of logic in field ctlLogicDescription.

After creating it, the logic becomes active, as indicated by value active(1) in field ctlLogicRowStatus.

Turn off the logic is performed by setting a field ctlLogicDisable desired interval in seconds.

Turn on logic is performed by setting the field ctlLogicDisable value of '0'.

Remove logic is performed by setting the field ctlLogicRowStatus in a state destroy(6).

Creating, editing, checking and removing the item Trap:

To read the logic table just use:

$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicsTable

1   SNMP table: DIDACTUM-SYSTEM-MIB::ctlLogicsTable

2   index ID           Name          Description Disable RowStatus

4   1  1 "Logic scheme" "(20 4 - 4){34:0 8}"       0    active
 
To create a new logic:

1   $ snmpset -v2c -cwrite 192.168.0.193 ZERTCIO-SYSTEM-MIB::ctlLogicName.2 s "New Logic" \

2   DIDACTUM-SYSTEM-MIB::ctlLogicDescription.2 s "(20 1-1){301:0 5}" \

3   DIDACTUM-SYSTEM-MIB::ctlTrapRowStatus.2 i createAndGo

1   DIDACTUM-SYSTEM-MIB::ctlLogicName.2 = STRING: "New Logic"

3   DIDACTUM-SYSTEM-MIB::ctlLogicDescription.2 = STRING: "(20 1-1){301:0 5}"

4   DIDACTUM-SYSTEM-MIB::ctlTrapRowStatus.2 = INTEGER: createAndGo(4)
 
To view your created logic table:

$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicsTable

1   SNMP table: DIDACTUM-SYSTEM-MIB::ctlLogicsTable

2

3   index ID           Name          Description Disable RowStatus

4   1  1 "Logic scheme"   "(20 4-4){34:0 8}"       0    active

5   2  2    "New Logic"  "(20 1-1){301:0 5}"       0    active
 
Now you have two logics:

  • Logic "Logic scheme" is triggered when an element of the system with ID = 20 goes to state "alarm"(4), and provides an incentive "pulse"(8) on the element with ID=34 (relay or outlet, see table above) immediately (through 0 ?);
  • Logic "New Logic" is triggered, when an element of the system with ID=20 goes to state "normal"(1), and provides an incentive "on"(8) on the element with ID=301 (Trap element, see table above) immediately (through 0 ?);

Disabling the logic for 60 seconds:

$ snmpset -v2c -cwrite 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicDisable.2 i 60

DIDACTUM-SYSTEM-MIB::ctlLogicDisable.2 = INTEGER: 60
 
To check that logic is disabled:

$ snmpget -v2c -cwrite 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicDisable.2

DIDACTUM-SYSTEM-MIB::ctlLogicDisable.2 = INTEGER: 1
 
To delete existing logic:

$ snmpset -v2c -cwrite 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicRowStatus.2 i destroy

DIDACTUM-SYSTEM-MIB::ctlLogicRowStatus.2 = INTEGER: destroy(6)
 
After deleting the logic, the logic table will have default settings.