From 8b5ed97db291734a9ac268d3f07f93ebc711766c Mon Sep 17 00:00:00 2001 From: cliu Date: Thu, 1 Oct 2026 11:41:45 +1000 Subject: [PATCH] Add alarm definitions and TANK1.LEVEL alarming to CI-Eng-Sample Co-Authored-By: Claude Opus 5.5 --- examples/CI-Eng-Sample/01b_alarm_df.qli | 33 +++++++++++++++++++ examples/CI-Eng-Sample/16_item_alarm_df.qli | 13 ++++++++ examples/CI-Eng-Sample/93_remove_alarm_df.qli | 18 ++++++++++ examples/CI-Eng-Sample/README.md | 18 ++++++++-- examples/CI-Eng-Sample/load.cmd | 4 +++ examples/CI-Eng-Sample/remove.cmd | 2 ++ 6 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 examples/CI-Eng-Sample/01b_alarm_df.qli create mode 100644 examples/CI-Eng-Sample/16_item_alarm_df.qli create mode 100644 examples/CI-Eng-Sample/93_remove_alarm_df.qli diff --git a/examples/CI-Eng-Sample/01b_alarm_df.qli b/examples/CI-Eng-Sample/01b_alarm_df.qli new file mode 100644 index 0000000..420664b --- /dev/null +++ b/examples/CI-Eng-Sample/01b_alarm_df.qli @@ -0,0 +1,33 @@ +@LANGUAGE +ENGLISH + +@VERSION +1.03.00 + +! Alarm definitions used by TANK1.LEVEL (16_item_alarm_df.qli). Load before the items refer to them. +! Acknowledgement type: every alarm needs a manual acknowledgement; a return to normal is +! acknowledged automatically only if the alarm was acknowledged (same matrix as MANUAL). +! Field _: from state N/A1/A2/A3 with Ack/Nack, to state N/A1/A2/A3; 1 = automatic. +! Unlisted matrix fields default to 0 (manual). +@FIELDS +NAME,DESCRIPTION,EAL_ACK,NA_N,NN_N,A1A_N,A2A_N,A3A_N + +@ALARM_ACK_DF +"CIENG_ACK","CI-Eng-Sample: manual ack; auto ack on return to normal if acked",0,1,1,1,1,1 + +! Area of interest (alarm grouping for displays and destinations) +@FIELDS +NAME,DESCRIPTION + +@ALARM_AOI_DF +"CIENG_TANKS","CI-Eng-Sample tank items" + +! Alarm selection area, compiled on load (COMPILE = 1). Keywords and operators need spaces. +@FIELDS +NAME,DESCRIPTION,COMPILE,EXPRESSION + +@ALARM_ASA_DF +"CIENG_TANK1","Alarms of section CI-Eng-Sample.TANK1",1,\ +@" +/* Alarm selection area : CIENG_TANK1 */ +SECTION = "CI-Eng-Sample.TANK1""@ diff --git a/examples/CI-Eng-Sample/16_item_alarm_df.qli b/examples/CI-Eng-Sample/16_item_alarm_df.qli new file mode 100644 index 0000000..d005d47 --- /dev/null +++ b/examples/CI-Eng-Sample/16_item_alarm_df.qli @@ -0,0 +1,13 @@ +@LANGUAGE +ENGLISH + +@VERSION +1.03.00 + +! Switch on alarming for TANK1.LEVEL (limits 10/20/80/90 come from 02_item_df.qli). Load with dssqld -m. +! Status and alarm state come from STATUS_DF: > 80 HIGH (Alarm 2, prio 2), > 90 HIGH HIGH (Alarm 3, prio 1). +@FIELDS +NAME,ALARMING,ACKN_TYPE,AOI_1 + +@ITEM_DF +"CI-Eng-Sample.TANK1.LEVEL",1,"CIENG_ACK","CIENG_TANKS" diff --git a/examples/CI-Eng-Sample/93_remove_alarm_df.qli b/examples/CI-Eng-Sample/93_remove_alarm_df.qli new file mode 100644 index 0000000..0345018 --- /dev/null +++ b/examples/CI-Eng-Sample/93_remove_alarm_df.qli @@ -0,0 +1,18 @@ +@LANGUAGE +ENGLISH + +@VERSION +1.03.00 + +! Remove CI-Eng-Sample alarm definitions (after the items: an acknowledgement type in use cannot be deleted) +@FIELDS +NAME + +@ALARM_ASA_DF +"CIENG_TANK1" + +@ALARM_AOI_DF +"CIENG_TANKS" + +@ALARM_ACK_DF +"CIENG_ACK" diff --git a/examples/CI-Eng-Sample/README.md b/examples/CI-Eng-Sample/README.md index 5f84a03..88a18c4 100644 --- a/examples/CI-Eng-Sample/README.md +++ b/examples/CI-Eng-Sample/README.md @@ -31,7 +31,7 @@ cmd /c "\examples\CI-Eng-Sample\remove.cmd" |---|---|---| | `CI-Eng-Sample` | Section | Top level | | `CI-Eng-Sample.TANK1`, `.PUMP1`, `.SYSTEM` | Sections | Tank, pump, system monitoring | -| `CI-Eng-Sample.TANK1.LEVEL` | Item, Real | %, format `999.9`, limits LL 10 / L 20 / H 80 / HH 90, scale 0–100 (alarming off), stored in `CIENG_EVENT` | +| `CI-Eng-Sample.TANK1.LEVEL` | Item, Real | %, format `999.9`, limits LL 10 / L 20 / H 80 / HH 90, scale 0–100, stored in `CIENG_EVENT`; alarming on (ack type `CIENG_ACK`, area `CIENG_TANKS`; `16_item_alarm_df.qli`) | | `CI-Eng-Sample.TANK1.INFLOW` | Item, Real | m3/h, format `9999.9`, scale 0–500, stored in `CIENG_EVENT` | | `CI-Eng-Sample.PUMP1.RUNNING` | Item, Boolean | | | `CI-Eng-Sample.PUMP1.MODE` | Item, Integer | 0 manual, 1 auto | @@ -67,6 +67,9 @@ cmd /c "\examples\CI-Eng-Sample\remove.cmd" | `CIENG_UA_LINE` | OPC UA client line | Client process `OPXCIENG` (created and started by loading the line) | | `CIENG_UA` | OPC UA station | `opc.tcp://localhost:34493`, Basic256Sha256 / SignAndEncrypt, anonymous; subscription `CIENG_SUB` (1 s); points `LEVEL`, `SRV_STATE` | | OPC visible | Flags | Sections `CI-Eng-Sample`, `TANK1` and item `TANK1.LEVEL` are OPC visible, item read-only (`12_opc_visible_df.qli`) | +| `CIENG_ACK` | Acknowledgement type | Every alarm needs an acknowledgement; return to normal automatic only if the alarm was acknowledged (same matrix as `MANUAL`) | +| `CIENG_TANKS` | Area of interest | Label for tank items (`TANK1.LEVEL` `AOI_1`) | +| `CIENG_TANK1` | Alarm selection area | `SECTION = "CI-Eng-Sample.TANK1"`, compiled on load | | `CIENG_VIEWER` | Authorization group | Read-only: `ITEM_READ`, `SECTION_READ`, `ALARM_CURRENT_READ`, `ALARM_CHRONO_READ`. No users are created by the sample. | Items created by objects (`TANK1.CALC.VOLUME`, `TANK1.JFLOW.sPerMin`) and their sections are @@ -89,8 +92,10 @@ New items start with status 13 (`NOT INIT`) until a value is written. | `09_modbus_line_df.qli`, `10_modbus_station_df.qli`, `11_item_eqp_df.qli` | Modbus line; station, scan type, points; items connected to points | | `12_opc_visible_df.qli` | OPC visible / read flags (loaded with `dssqld -m`) | | `13_opcua_line_df.qli`, `14_opcua_station_df.qli`, `15_item_opcua_df.qli` | OPC UA client line; station, subscription, points; connected items | +| `01b_alarm_df.qli` | Alarm definitions: acknowledgement type, area of interest, alarm selection area (`ALARM_ACK_DF`, `ALARM_AOI_DF`, `ALARM_ASA_DF`) | +| `16_item_alarm_df.qli` | Switch on alarming for `TANK1.LEVEL` (loaded with `dssqld -m`) | | `equipment/eqpciengslv_start.cmd`, `_stop.cmd` | Start/stop the Modbus slave mirror (copy to `tls\com`) | -| `80_`…`92_remove_*.qli` | Names to delete, in reverse order | +| `76_`…`93_remove_*.qli` | Names to delete, in reverse order (alarm definitions last, `93`) | | `load.cmd`, `remove.cmd` | Run the steps in the right order | | `monitoring/*.sup.txt` | Setup-file lines for the monitoring processes (not applied by `load.cmd`) | @@ -126,6 +131,14 @@ exchange, done by the user (skill `data-access`, task `opcua-client.md` §4): Then `UA.COMM_OK` = 1 and `UA.LEVEL_COPY` follows `TANK1.LEVEL`. The trust is kept when the sample is removed and loaded again. +## Alarms (TANK1.LEVEL) + +`TANK1.LEVEL` raises HIGH above 80 (Alarm 2, priority 2) and HIGH HIGH above 90 (Alarm 3, +priority 1). To try it on a test system: `itmval -p -n CI-Eng-Sample.TANK1.LEVEL -v 85`, export +`ALARM_CURRENT` (filter on `ITEM_NAME`), acknowledge with `dssqld -m` on `ALARM_CURRENT` +(`NAME`, `ACK` 1), write the level back below 80. See skill `alarm-management`, task +`item-alarming.md`. + ## Monitoring processes (optional) `monitoring/` holds the lines to add to the setup files in `%TLS_ROOT_PATH%\tls\sup\` so that @@ -137,7 +150,6 @@ testing. See the `system-management` skill, task `monitoring-processes.md`. | Phase | Adds | |---|---| -| 8 | Alarm settings on sample items | | 9 | More storage groups (scan/time, aggregation) | | 10 | A display and symbol | | 11 | A report | diff --git a/examples/CI-Eng-Sample/load.cmd b/examples/CI-Eng-Sample/load.cmd index 58bf228..c3d7666 100644 --- a/examples/CI-Eng-Sample/load.cmd +++ b/examples/CI-Eng-Sample/load.cmd @@ -5,6 +5,8 @@ rem Results go to *.qlo listing files; check that Errors = 0. rem Restart CI Server afterwards: new storage groups only start storing after a restart. cd /d "%~dp0" dssqld -i 01_section_df.qli -l 01_section_df.qlo +rem Alarm definitions (acknowledgement type, area of interest, alarm selection area) +dssqld -i 01b_alarm_df.qli -l 01b_alarm_df.qlo dssqld -i 02_item_df.qli -l 02_item_df.qlo dssqld -i 02b_sub_item_df.qli -l 02b_sub_item_df.qlo dssqld -i 03_his_group_df.qli -l 03_his_group_df.qlo @@ -33,3 +35,5 @@ echo Waiting 10 seconds for OPC UA client OPXCIENG to start... powershell -NoProfile -Command "Start-Sleep -Seconds 10" dssqld -i 14_opcua_station_df.qli -l 14_opcua_station_df.qlo dssqld -i 15_item_opcua_df.qli -l 15_item_opcua_df.qlo +rem Alarming: switch on alarms for TANK1.LEVEL (modify existing record) +dssqld -m 16_item_alarm_df.qli -l 16_item_alarm_df.qlo diff --git a/examples/CI-Eng-Sample/remove.cmd b/examples/CI-Eng-Sample/remove.cmd index 486236c..07aa5d1 100644 --- a/examples/CI-Eng-Sample/remove.cmd +++ b/examples/CI-Eng-Sample/remove.cmd @@ -24,4 +24,6 @@ dssqld -r 90_remove_his_group_df.qli -l 90_remove_his_group_df.qlo dssqld -r 90b_remove_sub_item_df.qli -l 90b_remove_sub_item_df.qlo dssqld -r 91_remove_item_df.qli -l 91_remove_item_df.qlo dssqld -r 92_remove_section_df.qli -l 92_remove_section_df.qlo +rem Alarm definitions last: an acknowledgement type still used by an item cannot be deleted. +dssqld -r 93_remove_alarm_df.qli -l 93_remove_alarm_df.qlo del 90a_stop_his_group_df.qli