LLExec Alarms: Difference between revisions
No edit summary |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
You can now write a unique code for this alarm, write the label and select the ACK type.<br> | You can now write a unique code for this alarm, write the label and select the ACK type.<br> | ||
You can press the "Assign" button to associate a boolean variable that triggers that alarm.<br> | You can press the "Assign" button to associate a boolean variable that triggers that alarm.<br> | ||
You can choose a level for the alarm, or assign it to one defined group.<br> | |||
Level and groups can be used to filter on the querys for alarms or log.<br> | |||
= Example of Manual ACK = | |||
The code below can be used to manually ack an alarm: | |||
AlmNeedsAck := Alarm_IsWaitingForAck(1001); | |||
if TriggetAck then | |||
TriggetAck := false; | |||
Alarm_Ack(1001); | |||
end_if; | |||
= Example of log of all the alarms occoured = | |||
The code below shows you how to save to a file, all the alarms in the log: | |||
if TriggerPrintLog then | |||
TriggerPrintLog := false; | |||
fhandle := FS_OpenFile('foo.txt', FM_WT ); | |||
FS_WriteString(fhandle, 'Start log$L'); | |||
FS_WriteString(fhandle, '---------$L$L'); | |||
qhandle := sysAlarm_CreateAlarmLogQuery(0); | |||
qres := AlarmLogQuery_Query(qhandle); | |||
AlarmLogQueryResult_First(qres); | |||
while AlarmLogQueryResult_Current(qres) do | |||
AlarmLogQueryResult_GetTime(qres, | |||
ADR(day), ADR(month), ADR(year), ADR(dayOfWeek), | |||
ADR(hours), ADR(minutes), ADR(seconds) | |||
); | |||
alarm := AlarmLogQueryResult_GetAlarm(qres); | |||
line := ''; | |||
line2 := TO_STRING(hours); | |||
line := concat(line, line2); | |||
line := concat(line, ':'); | |||
line2 := TO_STRING(minutes); | |||
line := concat(line, line2); | |||
line := concat(line, ' --> '); | |||
line2 := TO_STRING(alarm); | |||
line := concat(line, line2); | |||
line := concat(line, '$L'); | |||
FS_WriteString(fhandle, line); | |||
AlarmLogQueryResult_Next(qres); | |||
end_while; | |||
FS_WriteString(fhandle, 'End log$L'); | |||
FS_WriteString(fhandle, '---- --$L$L'); | |||
FS_CloseFile(fhandle); | |||
end_if; | |||
= Other features = | |||
In order to obtain a full set of functions for the queries, please consult ObjectProperties for the functions in the library.<br> | |||
All the functions in library can be used from LogicLab or PageLab. | |||
[[Category:LLExec]] | [[Category:LLExec]] |
Latest revision as of 14:18, 24 July 2019
Overview
The alarms management feature allows you to define and manage a series of Alarms.
The alarms can have level and can be grouped with groups.
An API can be used to query the state of alarms, or query the logs of alarms occoured.
The events are logged in binary files, under the runtime filesystem,
you can use the API to read this log.
The API is fully accessible from PageLab, but the configuration can only be done in LogicLab.
Configuration
On the resources tree, select the Alarm node:
You can use the buttons "Add" and "Remove" to add a line in the grid.
You can now write a unique code for this alarm, write the label and select the ACK type.
You can press the "Assign" button to associate a boolean variable that triggers that alarm.
You can choose a level for the alarm, or assign it to one defined group.
Level and groups can be used to filter on the querys for alarms or log.
Example of Manual ACK
The code below can be used to manually ack an alarm:
AlmNeedsAck := Alarm_IsWaitingForAck(1001); if TriggetAck then TriggetAck := false; Alarm_Ack(1001); end_if;
Example of log of all the alarms occoured
The code below shows you how to save to a file, all the alarms in the log:
if TriggerPrintLog then TriggerPrintLog := false; fhandle := FS_OpenFile('foo.txt', FM_WT ); FS_WriteString(fhandle, 'Start log$L'); FS_WriteString(fhandle, '---------$L$L'); qhandle := sysAlarm_CreateAlarmLogQuery(0); qres := AlarmLogQuery_Query(qhandle); AlarmLogQueryResult_First(qres); while AlarmLogQueryResult_Current(qres) do AlarmLogQueryResult_GetTime(qres, ADR(day), ADR(month), ADR(year), ADR(dayOfWeek), ADR(hours), ADR(minutes), ADR(seconds) ); alarm := AlarmLogQueryResult_GetAlarm(qres); line := ; line2 := TO_STRING(hours); line := concat(line, line2); line := concat(line, ':'); line2 := TO_STRING(minutes); line := concat(line, line2); line := concat(line, ' --> '); line2 := TO_STRING(alarm); line := concat(line, line2); line := concat(line, '$L'); FS_WriteString(fhandle, line); AlarmLogQueryResult_Next(qres); end_while; FS_WriteString(fhandle, 'End log$L'); FS_WriteString(fhandle, '---- --$L$L'); FS_CloseFile(fhandle); end_if;
Other features
In order to obtain a full set of functions for the queries, please consult ObjectProperties for the functions in the library.
All the functions in library can be used from LogicLab or PageLab.