Has Alarms been added yet?

Just wondering if alarm journals have been added yet

Yes it has for 8.0 you can add it in the gateway and use it in the designer and should be working as expected as such you should be able to use the alarm journal table.

An additional point, Alarm Journals are working in Vision but there is not currently a Perspective component that will take advantage of them.

1 Like

I had to do this so I figured I’d include my query because I figure it could help someone who searches the forums for displaying alarms in perspective before a control exists. All I did was data bind a data grid control to this query from the alarm journals tables. This code is TSQL so it is for Microsoft SQL Server.

SELECT
SUBSTRING(AE.source, PATINDEX(’%alm:%’, AE.source) + 4, LEN(AE.source) - PATINDEX(’%alm:%’, AE.source)) AS Alarm,
AE.eventtime AS Alarmed,
(
SELECT TOP 1 MAX(AEC.eventtime)
FROM alarm_events AS AEC
WHERE
AEC.eventtype = 1
AND SUBSTRING(AEC.source, PATINDEX(’%alm:%’, AEC.source) + 4, LEN(AEC.source) - PATINDEX(’%alm:%’, AEC.source)) = SUBSTRING(AE.source, PATINDEX(’%alm:%’, AE.source) + 4, LEN(AE.source) - PATINDEX(’%alm:%’, AE.source))
AND AEC.eventtime > AE.eventtime
) AS Cleared,
(
SELECT TOP 1 MAX(AEA.eventtime)
FROM alarm_events AS AEA
WHERE
AEA.eventtype = 2
AND SUBSTRING(AEA.source, PATINDEX(’%alm:%’, AEA.source) + 4, LEN(AEA.source) - PATINDEX(’%alm:%’, AEA.source)) = SUBSTRING(AE.source, PATINDEX(’%alm:%’, AE.source) + 4, LEN(AE.source) - PATINDEX(’%alm:%’, AE.source))
AND AEA.eventtime > AE.eventtime
) AS Acknowledged
FROM alarm_events AS AE
INNER JOIN alarm_event_data as ED
ON AE.id = ED.id
WHERE AE.eventtype = 0 AND ED.dtype = 0
ORDER BY AE.eventtime DESC

Basically, It’s just grabbing the alarm name (a subset of one of the fields) along with the date the alarm occurred. Then it uses a pair of sub queries to pull in alarm cleared and alarm acknowledged. You could easily add a date filter by adding parameters to the query and wiring them up to user inputs.

There might be a better way to do this but I didn’t see one with what little research I did into the alarm journal data layout. Notice that I am filtering for integer alarms only because all of my alarms were bits which come in as integer alarms.

1 Like

Will an alarm journal viewer for the perspective module be included in the general release of v8?

This thread is the last update I've seen on it.

If you do that you'll have alarms in a logging table in your database. You can display a history of that by querying the table and displaying the results in a data grid control.

I wrote this query to display alarm information from the logging tables logging to a Microsoft SQL Server database (in case it's helpful to you). It just displays the alarm name, start time and end time. You could potentially get incorrect results if you have multiple alarms with the same name.

SELECT
SUBSTRING(AE.source, PATINDEX('%alm:%', AE.source) + 4, LEN(AE.source) - PATINDEX('%alm:%', AE.source)) AS Alarm,
AE.eventtime AS Alarmed,
(
SELECT TOP 1 MAX(AEC.eventtime)
FROM alarm_events AS AEC
WHERE
AEC.eventtype = 1
AND SUBSTRING(AEC.source, PATINDEX('%alm:%', AEC.source) + 4, LEN(AEC.source) - PATINDEX('%alm:%', AEC.source)) = SUBSTRING(AE.source, PATINDEX('%alm:%', AE.source) + 4, LEN(AE.source) - PATINDEX('%alm:%', AE.source))
AND AEC.eventtime > AE.eventtime
) AS Cleared,
(
SELECT TOP 1 MAX(AEA.eventtime)
FROM alarm_events AS AEA
WHERE
AEA.eventtype = 2
AND SUBSTRING(AEA.source, PATINDEX('%alm:%', AEA.source) + 4, LEN(AEA.source) - PATINDEX('%alm:%', AEA.source)) = SUBSTRING(AE.source, PATINDEX('%alm:%', AE.source) + 4, LEN(AE.source) - PATINDEX('%alm:%', AE.source))
AND AEA.eventtime > AE.eventtime
) AS Acknowledged
FROM alarm_events AS AE
INNER JOIN alarm_event_data as ED
ON AE.id = ED.id
WHERE AE.eventtype = 0 AND ED.dtype = 0
ORDER BY AE.eventtime DESC

1 Like