I'm looking into the Alert & Event Panel (AES). The AEScreen panel is running, and lists all current alerts.
In my system I would like to design how the list of alerts is displayed myself, and not use the list view as in AEScreen. Still I would like to utilize the built in functionality of the AES system, with priority, sorting etc.
Is there any documentation on the AES system, besides the hlep file, I should look into to get a understanding of how everything is connected? What functions needs to be triggered to connect to alert DPs? Is there a internal DP that contains active alerts?
Alert system
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: Alert system
there are no internal dp-elements available where the active/pending alerts are listed.
The AEScreen uses dpQueryConnectSingle() functions with SELECT ALERT at the SQL statement to get the active/pending alerts based on the settings made in the properties dialog.
How to use the dpQuery*-functions is described in the WinCC OA online help.
Additional documentation for the detailed structure and implementation of the AEScreen is not available. Explaining all the implemented functionality in detail would be too complex.
For the AEScreen you can find a user documenation how to change the layout of the tables (columns, fonts, ...) and how to use the AEScreen during runtime, e.g. filtering for alerts.
Best Regards
Leopold Knipp
Senior Support Specialist
The AEScreen uses dpQueryConnectSingle() functions with SELECT ALERT at the SQL statement to get the active/pending alerts based on the settings made in the properties dialog.
How to use the dpQuery*-functions is described in the WinCC OA online help.
Additional documentation for the detailed structure and implementation of the AEScreen is not available. Explaining all the implemented functionality in detail would be too complex.
For the AEScreen you can find a user documenation how to change the layout of the tables (columns, fonts, ...) and how to use the AEScreen during runtime, e.g. filtering for alerts.
Best Regards
Leopold Knipp
Senior Support Specialist
- Dag-Are.Trydal@nov.com
- Posts:37
- Joined: Fri Feb 26, 2016 11:52 am
Re: Alert system
Thank for your answer Leopold.
I have some more questions related _alert_hdl and _alert_class.
In my project there is one bool DPE with a _alert_hdl, continous and pointing to an alertClass-item that requires individual ack and CAME and WENT must be acknowledged.
I manage to read the class using: dpGet($dp + ":_alert_hdl.._class",className);. And the priority using: dpGet(className + ":_alert_class.._prior",pri);.
Questions.
1. How can I acknowledge the alert on this DPE? dpSet($dp + ":_alert_hdl.._ack",0); returns value 0. But the alert is not acknowledged when I look in PARA.
The following error message is from the log viewer:
WCCILevent (0), 2016.03.07 10:31:02.533, PARAM,WARNING, 23, Setting/modifying attributes failed, DP: System1:MW-HT-Travel-ArmPos.Sta.Alarm.EncErr:_alert_hdl.._ack, MAN: (SYS: 1 Ui -num 1 CONN: 1)
2. How can I read the CAME time of the alert? The following only returns "1970.01.01....".
time t;
bool ok;
atime a;
ok = TRUE;
dpGet($dp+":_alert_hdl.._ok_range", ok);
alertGet(a, getACount(a), $dp+":_alert_hdl.._came_time", t);
I have some more questions related _alert_hdl and _alert_class.
In my project there is one bool DPE with a _alert_hdl, continous and pointing to an alertClass-item that requires individual ack and CAME and WENT must be acknowledged.
I manage to read the class using: dpGet($dp + ":_alert_hdl.._class",className);. And the priority using: dpGet(className + ":_alert_class.._prior",pri);.
Questions.
1. How can I acknowledge the alert on this DPE? dpSet($dp + ":_alert_hdl.._ack",0); returns value 0. But the alert is not acknowledged when I look in PARA.
The following error message is from the log viewer:
WCCILevent (0), 2016.03.07 10:31:02.533, PARAM,WARNING, 23, Setting/modifying attributes failed, DP: System1:MW-HT-Travel-ArmPos.Sta.Alarm.EncErr:_alert_hdl.._ack, MAN: (SYS: 1 Ui -num 1 CONN: 1)
2. How can I read the CAME time of the alert? The following only returns "1970.01.01....".
time t;
bool ok;
atime a;
ok = TRUE;
dpGet($dp+":_alert_hdl.._ok_range", ok);
alertGet(a, getACount(a), $dp+":_alert_hdl.._came_time", t);
- jimtaylor
- Posts:32
- Joined: Tue Jun 11, 2013 10:18 am
Re: Alert system
We are implementing a similar thing at the moment, and the following works for us (not sure if it is the ETM optimum way but hey)
1. I think the 0 is your problem. It should be dpSet($dp + ":_alert_hdl.._ack", DPATTR_ACKTYPE_SINGLE). Also make sure you are logged in as a user with alarm acknowledge permissions (bit 5).
2. I use _alert_hdl.._system_time. Seems to be the same as the came time.
1. I think the 0 is your problem. It should be dpSet($dp + ":_alert_hdl.._ack", DPATTR_ACKTYPE_SINGLE). Also make sure you are logged in as a user with alarm acknowledge permissions (bit 5).
2. I use _alert_hdl.._system_time. Seems to be the same as the came time.
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: Alert system
if an alert shall be acknowledged normally the function alertSet() is used. At the function alertSet() you have to specify the time of the alert, the count parameter and the dp-element.
When using dpSet() all pending alerts for a dp-element are acknowledged. You can't acknowledge a specific alert when using dpSet().
_alert_hdl.._came_time and _alert_hdl.._system_time is not the same.
E.g. if an alert is raised with a specified time the values for those attributes differ.
When using the function alertGet() you have to know the time when the alert occured. This function cannot be used to read the _came_time without knowing when the alert was raised.
To get the pending alerts normally a dpQuery("SELECT ALERT ..."); command is used.
Best Regards
Leopold Knipp
Senior Support Specialist
When using dpSet() all pending alerts for a dp-element are acknowledged. You can't acknowledge a specific alert when using dpSet().
_alert_hdl.._came_time and _alert_hdl.._system_time is not the same.
E.g. if an alert is raised with a specified time the values for those attributes differ.
When using the function alertGet() you have to know the time when the alert occured. This function cannot be used to read the _came_time without knowing when the alert was raised.
To get the pending alerts normally a dpQuery("SELECT ALERT ..."); command is used.
Best Regards
Leopold Knipp
Senior Support Specialist
- Dag-Are.Trydal@nov.com
- Posts:37
- Joined: Fri Feb 26, 2016 11:52 am
Re: Alert system
Thanks info Leopold. Now I am able to read state, and acknowledge an alert using the following code:
Now this is not totally fail safe. The alerts I have is still a boolean. The _alert_hdl is continous, and the alertClass requires individual ack, and CAME and WENT must be acknowledged.
If I activate the alert, and click Apply once more in Para, in effect making a new timestamp on an already high alert the above does not work.
_online.._stime gives me the latest timestamp, but the state of this alert is DPATTR_ALERTSTATE_NONE, even though the state shown in Para is CAME unacknowledged.
In your previous post you mention dpQuery(. Below is a updated version of the first code.
This seem to work, but I am really struggling to find information and examples about the return values from the dpQuery.
Especially the t = tab[dynlen(tab)][2] statement is only based on trial and error.
Questions:
[ol]
[*] Why is the state CAMEunacknowledged (int 0) when I read from the latest timestamp, even though there is an earlier write to the alert that made the transision from NoAlarm to CAMEunacknowledged? [*]
[*] What is the return data from dpQuery("SELECT ALERT '_alert_hdl.. ? Can you provide more information about the dpQuery and what triggers the alert handeling to make multiple "timestamps"? [*]
[/ol]
Code: Select all
int state;
time t;
atime At;
// get time of the alert
dpGet($dp+\\":_online.._stime\\", t);
// make time to be of type \\"atime\\"
At= makeATime(t, 0, $dp);
// get state of alert. CAME unack, CAME ack, WENT unack, No alert
alertGet(t, getACount(At), $dp+\\":_alert_hdl.._act_state\\", state);
//make sure acknowledging is needed. Only needed in unacknowledged states
if ( (state==DPATTR_ALERTSTATE_APP_NOT_ACK) || (state==DPATTR_ALERTSTATE_DISAPP_NOT_ACK) )
alertSet(t, getACount(At), $dp+\\":_alert_hdl.._ack_state\\", DPATTR_ACKTYPE_SINGLE); // single-acknowledge alert
If I activate the alert, and click Apply once more in Para, in effect making a new timestamp on an already high alert the above does not work.
_online.._stime gives me the latest timestamp, but the state of this alert is DPATTR_ALERTSTATE_NONE, even though the state shown in Para is CAME unacknowledged.
In your previous post you mention dpQuery(. Below is a updated version of the first code.
Code: Select all
int state;
time t;
atime At;
// get time of the alert FIRST alert
dyn_dyn_anytype tab;
dpQuery("SELECT ALERT '_alert_hdl.._came_time' FROM '"+$dp+"'", tab);
// If -> alarm is not active, there is no _came_time, and tab[dynlen(tab)][2] doesn't exsist.
if ( dynlen(tab)==1 )
dpGet($dp+":_online.._stime", t);
else
t = tab[dynlen(tab)][2];
// make time to be of type "atime"
At= makeATime(t, 0, $dp);
// get state of alert. CAME unack, CAME ack, WENT unack, No alert
alertGet(t, getACount(At), $dp+":_alert_hdl.._act_state", state);
//make sure acknowledging is needed. Only needed in unacknowledged states
if ( (state==DPATTR_ALERTSTATE_APP_NOT_ACK) || (state==DPATTR_ALERTSTATE_DISAPP_NOT_ACK) )
alertSet(t, getACount(At), $dp+":_alert_hdl.._ack_state", DPATTR_ACKTYPE_SINGLE); // single-acknowledge alert
Especially the t = tab[dynlen(tab)][2] statement is only based on trial and error.
Questions:
[ol]
[*] Why is the state CAMEunacknowledged (int 0) when I read from the latest timestamp, even though there is an earlier write to the alert that made the transision from NoAlarm to CAMEunacknowledged? [*]
[*] What is the return data from dpQuery("SELECT ALERT '_alert_hdl.. ? Can you provide more information about the dpQuery and what triggers the alert handeling to make multiple "timestamps"? [*]
[/ol]
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: Alert system
an explanation for the syntax and result of dpQuery-commands can be found in the WinCC OA online help: System Management --> Reporting --> SQL.
A list of _alert_hdl attributes can also be found in the online help: Reference tables --> Data point configs.
The time of a pending alert must not fit the time stamp of the _original/_online value. The value can also be changed afterwards without changing the state/time of the alert.
Therefore using this time to read/set information for an alert will not work in all cases.
Best Regards
Leopold Knipp
Senior Support Specialist
A list of _alert_hdl attributes can also be found in the online help: Reference tables --> Data point configs.
The time of a pending alert must not fit the time stamp of the _original/_online value. The value can also be changed afterwards without changing the state/time of the alert.
Therefore using this time to read/set information for an alert will not work in all cases.
Best Regards
Leopold Knipp
Senior Support Specialist
- Dag-Are.Trydal@nov.com
- Posts:37
- Joined: Fri Feb 26, 2016 11:52 am
Re: Alert system
I'm trying to find the history of an alert, and I'm having trouble finding info on how to do this.
Checking the archiveSetting of the alert handle, I get back a true state:
How can I access the history of this data point element?
Checking the archiveSetting of the alert handle, I get back a true state:
Code: Select all
bool archiveSetting;
alertGet(t, getACount(At), $dp+":_alert_hdl.._archive", archiveSetting);
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: Alert system
Hello,
if you want to read the history for an alert you have to use the function alertGetPeriod() or dpQuery() with a SELECT ALERT statement using a TIMERANGE condition.
When you want to get the configuration for an _alert_hdl-config the function dpGet() is used.
Best Regards
Leopold Knipp
Senior Support Specialist
if you want to read the history for an alert you have to use the function alertGetPeriod() or dpQuery() with a SELECT ALERT statement using a TIMERANGE condition.
When you want to get the configuration for an _alert_hdl-config the function dpGet() is used.
Best Regards
Leopold Knipp
Senior Support Specialist
- AGorbatykh
- Posts:59
- Joined: Thu Dec 17, 2015 1:01 pm
Re: Alert system
Code: Select all
time t1, t2; // init it
dyn_dyn_anytype tab;
dpQuery("SELECT ALL ALERT '_alert_hdl.._archive' FROM '{"+$dp+"}' TIMERANGE(\\""+formatTime("%y.%m.%d %H:%M:%S", t1)+"\\",\\""+formatTime("%y.%m.%d %H:%M:%S", t2)+"\\",1,0)", tab);