Creating Impulse alerts for multi instance alerts
In case of multi instance alerts the alert information is sent to the system and is then mapped by the Data Manager. The management of the status information and the corresponding mapping in WinCC OA via appropriate messages must be executed by the alert source (driver).
Impulse alerts can be created for multi instance alerts as follows:
Option 1:
- Set the acknowledgement type "Acknowledge deletes" for an alert class in the internal data point _AlertClass by selecting the desired alert class. In the figure below the acknowledgement type "Acknowledge deletes" was selected for the alert class "alert".
Trigger the impulse alert via a script as follows:
main(mapping event)
{
time t = getCurrentTime();
int rc = alertSetWait(t, 0,"System1:ExampleDP_Arg2.:_alert_hdl.._event", DPATTR_ALERTEVENT_CAME_IMPULSE);
DebugN("Alert came:", rc);
}
Acknowledge the alert via a script:
main(mapping event)
{
time t = makeTime(2017,5,29,14,16,36,622);
/* The time must be correspond to the CAME time including the milliseconds)*/
/* The second int parameter "count", in this case, 11, must correspond to the CAME alert */
int rc = alertSetWait(t, 11,"System1:ExampleDP_Arg2.:_alert_hdl.._ack", 1); /* Acknowledges the alert: 29.5.2017 14:16:36:622 */
DebugN("Alert acknowledged:", rc);
}
Trigger a new alert:
main(mapping event)
{
time t = getCurrentTime();
int rc = alertSetWait(t, 0,"System1:ExampleDP_Arg2.:_alert_hdl.._event", DPATTR_ALERTEVENT_CAME_IMPULSE);
int ret;
DebugN("Alert came:", rc);
}
Option 2:
Trigger the impulse alert via a script as follows:
main(mapping event)
{
time t = getCurrentTime();
int rc = alertSetWait(t, 0,"System1:ExampleDP_Arg2.:_alert_hdl.._event", DPATTR_ALERTEVENT_CAME_IMPULSE);
DebugN("Alert came:", rc);
}
Reset the alert via alertSet and the event type DPATTR_ALERTEVENT_WENT_OBSOLETE:
main(mapping event)
{
time t = makeTime(2017,5,26,11,05,04,401); /* The time must be correspond to the CAME time including the milliseconds)*/
/* The second int parameter "count", in this case, 4, must correspond to the count of the CAME alert */
int rc = alertSetWait(t,4,"System1:ExampleDP_Arg2.:_alert_hdl.._event", DPATTR_ALERTEVENT_WENT_OBSOLETE);
int ret;
DebugN("Alert went obsolete:", rc);
}
Trigger a new alert. See the script above.