Logic - is a mechanism for automatic management.
The syntax of a logic description
The logic is described by a line in the following form:
(SENSORID OLDSTATE-NEWSTATE OPERATOR ...){SENSORID1:TIMEOUT NEWSTATE2 OPERATOR2 ...}
Where:
SENSORID - unique sensor ID.
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 whose status should be changed under the conditions of the logical circuit.
TIMEOUT - A timeout condition.
NEWSTATE2 - The status code where you want to move the element (relay).
OPERATOR2 - Symbol '+'.
Status codes are:
'normal': 1;
'low': 2;
'warning': 3;
'alarm': 4;
'on': 5;
'off': 6.
'not connected': 7.
'pulse': 8.
Operators codes:
'and': symbol '+';
'or': symbol '|'.
Manage logic
To create a logic use field ctlLogicRowStatus. Moving field ctlLogicRowStatus in a state CreateAndWait(5) will create a new note in the table сtlLogicsTable.
After creating the logic it is necessary to specify its name in the field ctlLogicName and the logic description in the field ctlLogicDescription.
After creating a logic description, the logic becomes active, as indicated by the value active(1) in a field ctlLogicRowStatus.
Turning 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).
Example
Creating, editing, checking, and removing logic
Reading the logic table:
$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicsTable
| index | ID | Name | Description | Disable | RowStatus |
|---|---|---|---|---|---|
| 1 | 1 | "Logic circuit" | "(20 4 - 4){34:0 8}" | 0 | active |
Creating new logic:
$ snmpset -v2c -cwrite 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicName.2 s "New Logic" \
DIDACTUM-SYSTEM-MIB::ctlLogicDescription.2 s "(20 1-1){301:0 5}" \
DIDACTUM-SYSTEM-MIB::ctlTrapRowStatus.2 i createAndGo
DIDACTUM-SYSTEM-MIB::ctlLogicName.2 = STRING: "New Logic"
DIDACTUM-SYSTEM-MIB::ctlLogicDescription.2 = STRING: "(20 1-1){301:0 5}"
DIDACTUM-SYSTEM-MIB::ctlTrapRowStatus.2 = INTEGER: createAndGo(4)
View created logic table:
$ snmptable -Ci -Cb -v2c -cread 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicsTable
SNMP table: DIDACTUM-SYSTEM-MIB::ctlLogicsTable
| index | ID | Name | Description | Disable | RowStatus |
|---|---|---|---|---|---|
| 1 | 1 | "Logic circuit" | "(20 4-4){34:0 8}" | 0 | active |
| 2 | 2 | "New Logic" | "(20 1-1){301:0 5}" | 0 | active |
Now we have two logics:
Logic "Logic circuit" 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 in 60 seconds:
$ snmpset -v2c -cwrite 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicDisable.2 i 60
DIDACTUM-SYSTEM-MIB::ctlLogicDisable.2 = INTEGER: 60
Verify that the logic is disabled:
$ snmpget -v2c -cwrite 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicDisable.2
DIDACTUM-SYSTEM-MIB::ctlLogicDisable.2 = INTEGER: 1
Remove Logic:
$ snmpset -v2c -cwrite 192.168.0.193 DIDACTUM-SYSTEM-MIB::ctlLogicRowStatus.2 i destroy
DIDACTUM-SYSTEM-MIB::ctlLogicRowStatus.2 = INTEGER: destroy(6)
After the removal of the logic, the logic table should have an initial appearance.