_alert_hdl

This chapter describes the attributes of alert handling, attributes of sum alert handling as well as status bits for the _alert_hdl.._state attribute .

There are two different kinds of attributes for an alert handling.

  • Attributes for the configuration

Attributes for configuration, for example, limits of alert handling of a data point element are written using dpSet() and read using dpGet() or dpConnect().

  • Attributes of alerts

Attributes of alerts, for example, the _comment for an alarm triggered at 10 o'clock can only be written or read using alertSet(), alertGet(), alertConnect() or dpQuery with SELECT ALERT, since in order to determine the attribute, in addition to the DPE also the alert time is needed.

CAUTION: dpQuery with SELECT ALERT works solely with attributes that can be queried via alertConnect(). These are attributes that belong to an alert instance (see attributes of alerts above and in the table below). Attributes that belong to configuration and not to an alert instance can therefore not be queried via SELECT ALERT or alertConnect().

The following table shows all attributes of an alert handling. In the table you can also find the functions that can be used to set or query an attribute.

Attribute (neutral)

of

_alert_hdl..

Data type Bit Description

Attributes can be written (W)

Attributes can only be read

(R)

Attributes that can be set using dpSet() or queried using dpGet()

/

dpConnect()

Attributes that can be modified using alertSet() Attributes that can be queried using alertGet() / alertConnect() ordpQuery() by using SQL query SELECT ALERT Attributes that can be set when _alert_hdl is active
_abbr langString Short sign of the priority of an alarm (e.g.: A for alarm) that occurred at atime. R X
_abbr_pattern string

Short sign pattern for sum alert.

Allows selecting alerts according to their priority abbreviation. If you specify several characters, all alerts that possess one of these characters will be included ("AW" includes all alerts with the priority "A" and "W").

Can only be used for sum alerts.

R/W X
_ack int

Acknowledge all alerts of an alert handling.

Is used to acknowledge all unacknowledged alarms of a data point (see also _ack_state respectively _alert_hdl.<i>._ack_state" alert handling).

This, for example, is used in the _alert_hdl PARA panel when there the alarms are acknowledged to configure the alarm.

W X
_ack_deletes bool

Sum alert for "acknowledge deletes"?

The included individual alerts are limited to alerts of certain acknowledgement types. See chapter _alert_class (Alert class)

Can only be used for sum alerts.

R/W X
_ack_has_prio bool

Sequence of acknowledgement statuses for sum alerts.

Can only be used for sum alerts.

R/W X
_ack_oblig bool 6/22

Is set on CAME and/or WENT side (bit 5 and 21), depending on what must be acknowledged.

As long as _oblig is set an alert is visible and cannot be deleted.

R X
_ack_possible bool 5/21 Is set on CAME and/or WENT side (bit 5 and 21), depending on what is possible to acknowledge. R X
_ack_state int

Acknowledgement type of an alert:

The query returns how the alert (CAME/WENT) that was active at that given moment was acknowledged. In order to acknowledge the alert, use alertSet(). Therefore, you have to know the time of the alert. For this attribute only DPATTR_ACKTYPE_SINGLE or DPATTR_ACKTYPE_MULTIPLE are possible.. See also _alert_hdl.<i>._ack_state" alert handling.

R/W X X
_ack_time time Acknowledgement time of an alert. R X
_ack_type int

Type of acknowledgement

Constants:

/Acknowledgement deletes

ACKNOWLEDGEMENT_DELETES = 0,

// cannot be acknowledged

ACKNOWLEDGEMENT_NONE = 1,

// Came can be acknowledged

ACKNOWLEDGEMENT_CAME = 2,

// Alert pair must be acknowledged

ACKNOWLEDGEMENT_PAIR = 3,

//came and went has to be acknowledged

ACKNOWLEDGEMENT_CAMEANDGONE = 4,

//Acknowledgement type for sum alerts. Corresponds to the type "cannot be acknowledged".

ACKNOWLEDGEMENT_SUMALERT = 5

R X
_ack_user uint User who has acknowledged the alert. R X
_ackable bool 5/21 Is alert acknowledgeable? R X
_act_prior char

Priority of the current range

Not relevant for multiinstance alerts.

R X
_act_range int

Current range

Not relevant for multiinstance alerts.

R X
_act_state int

Acknowledgement status of the highest pending alert. With this attribute the current acknowledgement state of the highest pending alert can be queried.

1 = CAME unacknowledged

2 = CAME acknowledged

3 = WENT unacknowledged

4 = CAME/WENT/unacknowledged

0 = No alert

For possible constants see chapter "_alert_hdl.<i>._act_state" alert handling.

Not relevant for multiinstance alerts.

R X
_act_state_color string

Background color string of the current highest pending alert.

Not relevant for multiinstance alerts.

R X
_act_state_fore_color string

Foreground color string of the current highest pending alert.

Not relevant for multiinstance alerts.

R X
_act_state_font_style string

Font style of the highest pending alert.

Not relevant for multiinstance alerts.

R X
_act_state_prior char

Priority of the current highest pending alert.

Not relevant for multiinstance alerts.

R X
_act_state_range int

Range of the current alert status of the highest pending alert.

In case of alert with the ranges OK/HI/URGENT. A value triggers an alert and results in URGENT and thereafter in HI. As long as URGENT is not acknowledged and is pending, the _act_state_range is 3 (URGENT is pending and has the highest priority). act_range is 2 (the last value change resulted in the range HI). If the URGENT is acknowledged, the _act_state_range is also 2 (HI is now the highest alert).

Not relevant for multiinstance alerts.

R X
_act_state_text langString

Text of the current highest pending alert.

Not relevant for multiinstance alerts.

R X
_act_text langString

Text of the current range

Not relevant for multiinstance alerts.

R X
_active bool Is alert handling active? R/W X X
_add_text dpid Saves text fragments for status bits. R/W X
_add_values dyn_anytype Contains all additional values of an alarm. R/W X x
_add_value_1 .. _add_value_32 anytype Direct access to the first 32 additional values of an alarm. R/W X x
_alert_color string Background color string of the alert. R X
_alert_fore_color string Foreground color string of the alert. R X
_alert_font_style string Font style of the alert. R X
_alert_id string Used for the identification of a multiinstance alarm from and to the periphery through a driver or manager. This attribute is available separately for the CAME and WENT alarm of an alarm pair. R/W X x
_alerts dyn_atime

_alert_hdl.<detail>._alerts

Returns all alert pairs (CAME time and WENT time) that are known for this detail by the Event. This also applies for alerts, which are intended to be deleted. If <detail> is 0, the alerts of all details are returned.

R X
_archive bool 10/26 Should/Is the alert (be) archived? Is set on both sides (bit 10 and 26). R X
_both_ack bool

Sum alert for "both must be acknowledged"?

The included individual alerts are limited to alerts of certain acknowledgement types. See chapter _alert_class (Alert class).

Can only be used for sum alerts.

R/W X
_came_time time Time of the CAME alert. R X
_came_time_idx int Count in order to disambiguate the CAME time for simultaneous alerts. R X
_gone_time time Time of the WENT alert. R X
_gone_time_idx int

Count in order to disambiguate the WENT time for simultaneous alerts.

The _gone_time_idx is a read-only attribute. Therefore, you can only query the attribute.

R X
_class dpid

Reference to alert class of the range

The alert class will be converted internally to a DPIdentifier.

Note: For multiinstance alerts it is not permitted to escalate an alert class while an alert action (_event) is being triggered.

Note: _class must not be defined directly behind _event:DPATTR_ALERTEVENT_CAME to be used as alert class.

R/W X
_comment string User comment to an alert. R/W X x
_del_date time

When is the alert deleted or moved?

Configure the attribute through the config _alert_class (alert class) -> "Arguments" tab.

R X
_delete bool 15/31

Defines whether an alert pair which can be deleted (if obsolete and invisible) is deleted or stored. Is set on both sides (bit 15 and 31).

In the alert class you can specify whether archived alerts shall be deleted or stored after the archive period elapses. The bit is only relevant when ARCHIVE_ALERT_BIT_ATTR = 1. Due to this bit, the data manager decides whether the alert will be deleted (Bit = 1) or will be stored (Bit =0).

Configure the attribute through the config _alert_class (alert class) -> "Arguments" tab.

R X
_dest int Displays the current alert range. R X
_dest_text langString Displays the status text of the destination alert range of the alert. R X
_direction bool 0/16 Direction of the alert. Always TRUE for CAME (bit 0) and FALSE for WENT (bit 16). R X
_discrete_states bool

Is it an alert handling of discrete values?

_discrete_states is set implicitly when adding an alert range of the _type DPDETAIL_RANGETYPE_MATCH or DPDETAIL_RANGETYPE_SET.

Note:

This attribute is only used during runtime and is not saved in the database. Therefore it is not used for the ASCII export.

R X
_dp_list dyn_dpid

DP list for sum alert.

You can either only set a _dp_list or a _dp_pattern. You cannot set both simultaneously.

Can only be used for sum alerts. R/W X x
_dp_pattern string DP pattern for group alert. Can only be used for sum alerts. R/W X x
_escalation_class dpid

Escalated alert class of an alert. The alert class will be converted internally to a DpIdentifier.

Note: The detail number (alarm range) must be given when querying, e.g.:

main()

{

time t;

string value;

setTime(t,2011,2,18, 12,17,59,781);

alertGet(t, 3, "dist_2:ExampleDP_AlertHdl1.:_alert_hdl.2._escalation_class", value);

DebugN("value: ", value);

}

--->

WCCOActrl2:["value: "]["dist_2:danger."]

Can only be used if RDB is applied. R X
_event int

Triggers an alert action. Multiinstance alarms can only be triggered/updated/acknowledged using this attribute. For possible constants see "_alert_hdl.<i>._event" alert handling.

Note: For multiinstance alarms it is not permitted to escalate an alarm class while an alert action (_event) is being triggered.

Note: _class must not be defined directly behind _event:DPATTR_ALERTEVENT_CAME to be used as alert class.

Note: Multiple equal attributes to the same alert instance are ignored (e.g. _event:DPATTR_ALERTEVENT_CAME and _event:DPATTR_ALERTEVENT_SINGLE_ACK can not be defined in one alertSet()).

W X
_filtered bool Defines whether this alarm shall be hidden due to an active filter in the corresponding sum alert (_filter_active or _force_filtered). Used for single alerts. R X X (only in case of sum alerts)
_force_filtered bool When set to true, it acts as if a sum alert set the “_filtered” attribute (_filtered will return true). Can only be used for sum alerts. R/W X (only in case of binary alerts or sum alerts) X x X (only in case of binary alerts or sum alerts)
_filter_threshold int Defines the maximum number of sub alarms that can be active before filtering will be activated. See chapter Alarm filtering. Can only be used for sum alerts. R/W X
_filter_active bool Is true when _filter_threshold (see above) is reached or _force_filter_active (see below) has been set. See chapter Alarm filtering. Can only be used for sum alerts. R X X (only in case of sum alerts)
_force_filter_active bool Read/write attribute (for sum alarms) that, when set to true, acts as if the threshold has been reached (_filter_active will return true). See chapter Alarm filtering. Can only be used for sum alerts. R/W X X (only in case of sum alerts)
_help langString Help (help text or path to help file). R/W X
_hyst_time int

The _hyst_time attribute (called Delay in the alert_hdl configuration) specifies the minimum time in seconds that an alert must be in a bad range for it to be triggered. When the alert is back in a good range, it is immediately cleared. For an alert instance, the _alert_hdl.<detail>._hyst_time can be used to get the values used for an alert instance. The configuration applies per alert range. See chapter Delayed Alerts for more information.

R/W
_hyst_type int Is hysteresis used? _hyst_time - see above. R/W X
_impulse bool Activate/deactivate impulse alarms. R/W X
_inact_ack bool Alerts that are no longer current must be acknowledged. R X
_inactive bool 11/27 Marks "WENT" alerts generated by deactivation of the alert handling. R X
_l_hyst_limit var*

Lower insensitivity barrier (hysterisis)

The attribute is of the same variable type as the data point element, for example, int _I_hyst_limit.

NOTE: The value must be set in absolute and not in relative (= use in PARA!)

R/W X
_l_incl bool Lower limit of the range included W X
_l_limit var* Lower limit of the range R/W X
_last bool 2/18

Represents the state of the last alert pair. When an alert pair is created (CAME) _last (bit 18) is set. As soon as the pair is gone, _last (bit 18) is set. If an alert pair is still in a CAME state, and a gone impulse occurs, the CAME side is set to FALSE. However, bit 18 is not changed. The attribute is set either on CAME or GONE side. As soon as the alert pair is obsolete, both sides are set to FALSE.

If a measured value has more than one "bad" range, the measured value may change to a range that is not close-by the range "good". In WinCC OA all the ranges between "good" and the current "bad" range are pending (e.g. together with the alert also a warning is pending). The _last flag is set for the current "bad" range, the other ranges in between are also pending but without an activated flag.

R X
_last_of_all bool 3/19

If a measured value changes to a "bad" range several times and leaves the range without being acknowledged in the meantime, a quite number of still not acknowledged messages is pending. The first (=oldest) message is assigned with the _last_of_all flag. This event should also be acknowledged first. In the example of _last, not only the flag "_last" but also the flag "last_of_all" is set for the message.

the "last_of_all" flag is passed on from the current event of the measured value to the next event of this measured value. The flag "_last" is interesting only when you have more than one "bad" range. "_last" can be set in case of a stack of not acknowledged messages of a measured value also for several events .

R X
_mapped_text string Currently not used. R X
_match string

Pattern that defines when the range should trigger an EVENT. The patterns depend on the data type of the DPE:

Bit32: 01X…

1 .. pattern matched when Bit32 has a 1 at this position.

0 .. pattern matched when Bit32 has a 0 at this position.

X .. pattern matched when Bit32 has a 0 or a 1 at this position.

For example:

11111111111111111111111111111111

10101010101010101010101010101010

XXXXXXXXXXXXXXXX1111111111111111

INT, FLOAT: Ranges, for example, 0-10 or 6.3 - 20.8 (period is used as decimal point in all languages).

TEXT: Wildcards with * and ?

A * can always be used for all data types and always matches.

Can only be used for discrete alerts.

R/W X
_min_prio char

Minimum priority (to suppress alerts)

Alerts below this minimum priority do not apply to the sum alert for that, this attribute was set.

R/W X X
_multi_instance bool Alert handling at the data point element is used for multiinstance alarms. R/W X
_neg bool

Reverse (negate) value range handling.

Negate means that the attributes _match and _set will be negated.

Can only be used for discrete alerts. R/W X x
_non_ack bool

Group alert for "cannot be acknowledged"?

The included individual alerts are limited to alerts of certain acknowledgement types. See chapter _alert_class (Alert class).

W X
_num_ranges unsigned

Number of ranges

You can create the ranges using _alert_hdl.<rangeNo>._type

W X X
_obsolete bool 1/17 Indicates whether an alert is considered obsolete. Bit 1 and 17 are set pairwise. An alert is obsolete if the alert state changes to "no alert" or if the alert can be deleted because there is a new pending alert. If an alert is obsolete _last and _last_of_all are set to FALSE. R X
_ok_range bool Valid range for bit-alert handling R/W X
_oldest_ack bool 9/25 Oldest alert to be acknowledged in an alert handling. Is set either on CAME side (bit 9) or WENT side (bit 25). R X
_order int

Sequence of alerts for group alerts

Constants:

ORDER_PRIO_STATE = 0,

// Priority prior to alert state

ORDER_SIGN_STATE = 1,

// Abbreviation prior to alert state

ORDER_STATE_PRIO = 2,

// Alert state prior to priority

ORDER_STATE_SIGN = 3

// Alert state prior to abbreviation.

Can only be used for sum alerts.

R X
_orig_hdl bool Original (TRUE) or online value treatment for alert handling R/W X
_panel string Panel for cross-selection. R/W X
_panel_param dyn_string Parameter for cross-selection panel. R/W X
_param bool Can alert handling be configured ? R X
_partn_idx int

Alert index for the alert partner

In order to disambiguate alarms that occur simultaneously, there is a counter in the alert time. The attribute _partn_idx is this counter for the attribute _partner of type time.

R X
_partner time

Alert time for the alert partner

An alert is comprised of 2 events CAME and WENT. The partner of CAME is WENT and the partner of WENT is CAME. _partner of the CAME event therefore returns the WENT time or 1.1.1970 (if the alarm did not go yet). _partner des WENT events returns the CAME time.

R X
_partner_alert_id string Alert identifier of the partner alert. The partner of CAME is WENT and the partner of WENT is CAME. R X
_prio_pattern string Priority pattern for group alert. Can only be used for sum alerts. R/W X
_prior char Priority of the alert range R X
_set dyn_var* Quantity attribute. An arbitrary number of single (isolated) values for the definition of the valid value range can be specified. Can only be used for discrete alerts. R/W X
_single_ack bool 7/23

Is set on CAME (bit 7) and/or GONE side (bit 23) if a single acknowledgement occurs.

The _single_ack is a read-only attribute. Therefore, you can only query the attribute.

Configure the attribute through the config _alert_class (alert class) -> "Arguments" tab.

R X
_state bit32

The attribute alert_hdl.._state summarizes the status bits (_obsolete, _ackable etc) in a bit32 pattern.

_state of a CAME event returns in the first 16 bits the status bits for the CAME event.

_state includes bits as well for coming alerts as for going alerts. The bits 0 - 15 are reserved for "CAME", the bits 16 - 31 for "WENT".

_state of a WENT event returns in the first 16 bits the status bits for the WENT event. The bit 0 _direction can be used to identify whether the state is a WENT or CAME event state.

R X
_status64_pattern bit64 Filters the bits, which trigger an alert in case of a state change. If the specified state bits of the pattern change, an alert will be triggered. The attribute is only valid for discrete alert handling. R/W X
_status64_match string

Filters the bits, which trigger an alert in case of a state change in a specific range. If the specified state bits of the match change, an alert will be given.

The attribute is only valid for discrete alert handling.

R/W X
_sum bool 12/28 Is alert a sum alert? Is set on both sides (bit 12 and 28). R X
_sumalerts dyn_dpid Shows in which sum alert an alert is located. Can only be used for alerts. R X
_system_time time

Current system time.

The alert time will be set due to the time of a value change or due to the time of the _event attribute. This can be different than the current time, for example, in case of a periphery that is not always online. _system_time is the time as WinCC OA created an alarm.

For example:

A PLC is connected to a WinCC OA system through a dial-up connection. At 12:00 o'clock a fire breaks out. The PLC tries to establish a connection to the control center. For 20 minutes this does not work due to problems with the telephone line. When the alert is reported at 12:20 o'clock, the alert possesses the alert time 12:00. If the question "why did the control room need 20 minutes before alerting the fire department, arises later,

the control room can verify that it took 20 minutes before the alert arrived.

R X
_text langString Status text for the range. R/W X X (read only)
_text0 langString Text for digital 0 (DPCONFIG_ALERT_BINARYSIGNAL). R/W X
_text1 langString Text for digital 1 (DPCONFIG_ALERT_BINARYSIGNAL). R/W X
_type int

The attribute _type will be used for creating an alert handling and for adding alert ranges for a DPCONFIG_ALERT_NONBINARY_SIGNAL.

Create an alert handling as follows_

_alert_hdl.._type =

DPCONFIG_ALERT_BINARYSIGNAL = 12

DPCONFIG_ALERT_NONBINARYSIGNAL = 13

DPCONFIG_SUM_ALERT = 59

Create alert classes as follows:

_alert_hdl.<rangeNo>._type =

DPDETAIL_RANGETYPE _MIN=6,

DPDETAIL_RANGETYPE _MAX=7,

DPDETAIL_RANGETYPE MINMAX=4, DPDETAIL_RANGETYPE MATCH=5,

DPDETAIL_RANGETYPE SET=3

W X
_u_hyst_limit var*

Upper insensitivity barrier (hysteresis).

NOTE: The value must be set in absolute and not in relative (= use in PARA!)

R/W X
_u_incl bool Upper limit of the range included. R/W X
_u_limit var* Upper limit of the range. R/W X
_value var* Value leading to the alert. R X
_value_status64 Bit64 Status change leading to the alert R X
_visible bool 4/20

The alert panel only displays alerts with the value _visible = true.

An alert is not visible if the alert state changes to "no alert" or there is a new pending alert and the option "acknowledge old alarms" is not defined in the alert class.

R X
_went_text langString Status text for the "WENT" alert R/W X

*The type "var" is the type of the element to which the alert handling is assigned.

Attributes which can be queried with dpQuery - SELECT ALERT

For the following attributes it is possible to use dpQuery - SELECT ALERT (query current alerts) respectively dpQuery - SELECT ALERT + TIME RANGE (historical query).

Attribute dpQuery - SELECT ALERT dpQuery - SELECT ALERT + TIME RANGE
_abbr Yes Yes
_abbr_pattern Yes No
_ack_deletes Yes No
_ack_has_prio Yes No
_ack_oblig Yes Yes
_ack_possible Yes No
_ack_state Yes Yes
_ack_time Yes Yes
_ack_type Yes Yes
_ack_user Yes Yes
_ackable Yes Yes
_act_prior Yes No
_act_range Yes No
_act_state Yes No
_act_state_color Yes No
_act_state_font_style Yes No
_act_state_fore_color Yes No
_act_state_prior Yes No
_act_state_range Yes No
_act_state_text Yes No
_act_text Yes No
_active Yes No
_add_values Yes Yes
_add_value_1 Yes Yes
_alert_color Yes Yes
_alert_font_style Yes Yes
_alert_fore_color Yes Yes
_alert_id Yes Yes
_alerts Yes No
_archive Yes Yes
_both_ack Yes No
_came_ack Yes No
_came_time Yes No
_came_time_idx Yes No
_class Yes Yes
_comment Yes Yes
_del_date Yes Yes
_delete Yes Yes
_dest Yes Yes
_dest_text Yes Yes
_direction Yes Yes
_dp_list Yes No
_dp_pattern Yes No
_escalation_class Yes No
_filter_active Yes No
_filter_threshold Yes No
_filtered Yes Yes
_force_filter_active Yes No
_force_filtered Yes Yes
_gone_time Yes No
_gone_time_idx Yes No
_help Yes No
_hyst_type Yes No
_impulse Yes No
_inact_ack Yes Yes
_inactive Yes Yes
_last Yes Yes
_last_of_all Yes Yes
_mapped_text Yes No
_match Yes No
_min_prio Yes No
_multi_instance Yes No
_neg Yes No
_non_ack Yes No
_obsolete Yes Yes
_ok_range Yes No
_oldest_ack Yes Yes
_order Yes No
_orig_hdl Yes No
_pair_ack Yes No
_panel Yes No
_panel_param Yes No
_param Yes No
_partn_idx Yes Yes
_partner Yes Yes
_partner_alert_id Yes No
_prio_pattern Yes No
_prior Yes Yes
_set Yes No
_single_ack Yes Yes
_state Yes Yes
_status64_match Yes No
_status64_pattern Yes No
_sum Yes Yes
_sumalerts Yes No
_summed_abbr Yes No
_summed_alerts Yes No
_summed_alerts_count Yes No
_summed_classes Yes No
_summed_colors Yes No
_summed_prios Yes No
_summed_states Yes No
_system_time Yes Yes
_text0 Yes No
_text1 Yes No
_type Yes No
_value Yes Yes
_value_status64 Yes Yes
_visible Yes Yes

Attributes for sum alerts

Attributes of the group alerts Type Description
_sumalerts dyn_dpid Shows in which sum alerts an alarm is located.
_summed_abbr dyn_langString List of current abbreviations
_summed_alerts dyn_atime List of current alerts (DPE + alert time)
_summed_colors dyn_string List of current alert colors
_summed_classes dyn_string List of current alert classes
_summed_prios dyn_char List of current priorities
_summed_states dyn_int List of current alert status (came acknowledge...)
_summed_alerts_count int Shows the number of alarms which are located in the sum alerts.
CTRL constant int value Description
DPCONFIG_NONE 0 no alert handling
DPCONFIG_ALERT_BINARYSIGNAL 12 alert handling binary values
DPCONFIG_ALERT_NONBINARYSIGNAL 13 alert handling analogous values

DPCONFIG_SUM_ALERT

59 alert handling sum alerts

"_alert_hdl.<i>._act_state" alert handling

The following integer constants are used to query the current alert status (acknowledgement status) of an alert range, like the entire alert handling, for a data point element. The detail number in the attribute refers to the index of the alert range (see attributes "_alert_hdl.<i>._type"). If this is omitted or set to zero, the attribute refers to the current status of the alert handling (see dpGet()).

CTRL constant int value Description
DPATTR_ALERTSTATE_NONE 0 no alert
DPATTR_ALERTSTATE_APP_NOT_ACK 1 CAME or CAME/unacknowledged
DPATTR_ALERTSTATE_APP_ACK 2 CAME/acknowledged
DPATTR_ALERTSTATE_DISAPP_NOT_ACK 3 WENT/unacknowledged
DPATTR_ALERTSTATE_APP_DISAPP_NOT_ACK 4 CAME/WENT/unacknowledged

"_alert_hdl.<i>._ack_state" alert handling

The following integer constants can be used to query the acknowledgement state of a data point element.

In the function alertSet() the _ack_state has to be used with the correct detail number (alarm range for analog alerts) and the correct time. With alertSet() a special alert can be acknowledged. This function is used in the AEScreen.

CTRL constant int value Description
DPATTR_ACKTYPE_NOT 0 Not acknowledged
DPATTR_ACKTYPE_MULTIPLE 1 Acknowledge all
DPATTR_ACKTYPE_SINGLE 2 Single acknowledgement

"_alert_hdl.<i>._event" alert handling

The following integer constants can be used to set event actions.

CTRL constant int value Description
DPATTR_ALERTEVENT_CAME 0 Alert CAME.
DPATTR_ALERTEVENT_CAME_IMPULSE 1 Alert CAME with impulse alarm.
DPATTR_ALERTEVENT_WENT 2 Alert WENT.
DPATTR_ALERTEVENT_MULTIPLE_ACK 3 Alert was sum acknowledged.
DPATTR_ALERTEVENT_SINGLE_ACK 4 Alert was single acknowledged.
DPATTR_ALERTEVENT_WENT_INACTIVE 5 Deactivated alert WENT.
DPATTR_ALERTEVENT_WENT_OBSOLETE 7 Neither a CAME nor a WENT event is triggered. You can use the constant to delete an alarm explicitly (e.g., when an alarm does not exist on a PLC anymore).

"_alert_hdl.<i>._hyst_type" alert handling

The following integer constants can be used to determine whether a hysteresis is assigned to an alert handling.

CTRL constant int value Description
DPATTR_HYST_NONE 0 no hysteresis
DPATTR_HYST_VALUE 1 hysteresis
DPATTR_HYST_TIME 2 The _hyst_time attribute (called Delay in the alert_hdl configuration) specifies the minimum time in seconds that an alert must be in a bad range for it to be triggered. When the alert is back in a good range, it is immediately cleared. For an alert instance, the _alert_hdl.<detail>._hyst_time can be used to get the values used for an alert instance. The configuration applies per alert range.

"_alert_hdl.<i>._type" alert handling for analog values

The integer constants below can be used to determine the type of alert-handling of the alert range of a data point element. The detail number in the attribute determines the alert range: "alert_hdl.1._type" refers to the first (or lowest) range (see dpSet()).

CTRL constant int value Description
DPDETAIL_RANGETYPE_NONE 0 No alert range
DPDETAIL_RANGETYPE_MINMAX 4 MinMax alert range

Sum alert

CTRL constant int value Description
DPCONFIG_NONE 0 No alert handling
DPCONFIG_SUM_ALERT 59 Sum alert

Example

Applies an alert handling of analog values with 3 ranges:

main()
{
  dyn_float limits;
  dyn_string alerttext;
  dyn_string alertclass;
  dyn_bool limitsincl;
  int rc;
  dyn_errClass err;
  limits=makeDynFloat(20, 80);
  alerttext=makeDynString("Warning", "OK", "Alert");
  alertclass=makeDynString("System1:warning.",
  "System1:alert.");
  limitsincl=makeDynBool(TRUE, TRUE);
  rc = dpSetWait("TestDP_1.element:_alert_hdl.._type",
  DPCONFIG_ALERT_NONBINARYSIGNAL,
  "TestDP_1.element:_alert_hdl.1._type", 4,
  "TestDP_1.element:_alert_hdl.2._type", 4,
  "TestDP_1.element:_alert_hdl.3._type", 4,
  "TestDP_1.element:_alert_hdl.1._u_limit", limits[1],
  "TestDP_1.element:_alert_hdl.2._u_limit", limits[2],
  "TestDP_1.element:_alert_hdl.2._l_limit", limits[1],
  "TestDP_1.element:_alert_hdl.3._l_limit", limits[2],
  "TestDP_1.element:_alert_hdl.1._u_incl", limitsincl[1],
  "TestDP_1.element:_alert_hdl.1._l_incl", limitsincl[1],
  "TestDP_1.element:_alert_hdl.2._u_incl", limitsincl[2],
  "TestDP_1.element:_alert_hdl.2._l_incl", !limitsincl[1],
  "TestDP_1.element:_alert_hdl.3._u_incl", limitsincl[1],
  "TestDP_1.element:_alert_hdl.3._l_incl", !limitsincl[2],
  "TestDP_1.element:_alert_hdl.1._text", alerttext[1],
  "TestDP_1.element:_alert_hdl.2._text", alerttext[2],
  "TestDP_1.element:_alert_hdl.3._text", alerttext[3],
  "TestDP_1.element:_alert_hdl.1._class", alertclass[1],
  "TestDP_1.element:_alert_hdl.3._class", alertclass[2],
  "TestDP_1.element:_alert_hdl.._orig_hdl", TRUE,
  "TestDP_1.element:_alert_hdl.._active", TRUE);
  err = getLastError();
  if(dynlen(err)>0)
  {
    throwError(err);
  }
  DebugN("done", rc);
}

Example

Applies an alert handling of discrete values:

void addCondAlert(string dpeName)
{
  dyn_float limits;
  dyn_string alerttext;
  dyn_string alertclass;
  int rc;
  dyn_errClass err;
  limits=makeDynString("*","2","3","4");
  alerttext=makeDynString("", "Warning", "Fault",
  "Unavailable");
  alertclass=makeDynString("", "warning.", "alert.",
  "information.");
  rc = dpSetTimedWait(0, dpeName + ":_alert_hdl.._type",
  DPCONFIG_ALERT_NONBINARYSIGNAL,
  dpeName + ":_alert_hdl.1._type", DPDETAIL_RANGETYPE_MATCH,
  dpeName + ":_alert_hdl.2._type", DPDETAIL_RANGETYPE_MATCH,
  dpeName + ":_alert_hdl.3._type", DPDETAIL_RANGETYPE_MATCH,
  dpeName + ":_alert_hdl.4._type", DPDETAIL_RANGETYPE_MATCH,
  dpeName + ":_alert_hdl.1._text", alerttext[1],
  dpeName + ":_alert_hdl.2._text", alerttext[2],
  dpeName + ":_alert_hdl.3._text", alerttext[3],
  dpeName + ":_alert_hdl.4._text", alerttext[4],
  dpeName + ":_alert_hdl.1._class", alertclass[1],
  dpeName + ":_alert_hdl.2._class", alertclass[2],
  dpeName + ":_alert_hdl.3._class", alertclass[3],
  dpeName + ":_alert_hdl.4._class", alertclass[4],
  dpeName + ":_alert_hdl.1._match", limits[1],
  dpeName + ":_alert_hdl.2._match", limits[2],
  dpeName + ":_alert_hdl.3._match", limits[3],
  dpeName + ":_alert_hdl.4._match", limits[4],
  dpeName + ":_alert_hdl.._active", TRUE);
  err = getLastError();
  if(dynlen(err)>0)
  {
    DebugTN("Error " + err + " adding alert for " + dpeName);
  }
}

Status bits for attribute _alert_hdl.._state

The status bits 0-15 are reserved for "CAME", the bits 16-31 for "WENT". The Attribute _alert_hdl.._state summarizes these status bits to a bit32 pattern. Besides the attributes in the table the following bits can be set:

Bit 7/23 (alert was single acknowledged?)

Bit 8/24 (all alerts were acknowledged?)

Bit 13/29 + 14/30 for the states of group alerts

For the group alerts states the bits 13/14 (came) or 29/30 (went) are set as follows:

FALSE/FALSE went acknowledged

FALSE/TRUE went unacknowledged

TRUE/FALSE came acknowledged

TRUE/TRUE came unacknowledged

Number of the Status bit Attribute Direction
0 _direction _direction CAME
1 _obsolete _direction CAME
2 _last _direction CAME
3 _last_of_all _direction CAME
4 _visible _direction CAME
5 _ackable _direction CAME
6 _ack_oblig _direction CAME
7 _single_ack _direction CAME
8 - _direction CAME
9 _oldest_ack _direction CAME
10 _archive _direction CAME
11 _inactive _direction CAME
12 _sum _direction CAME
13 - Sum alert state first bit. _direction CAME
14 - Sum alert state second bit. _direction CAME
15 _delete _direction CAME
16 _direction _direction WENT
17 _obsolete _direction WENT
18 _last _direction WENT
19 _last_of_all _direction WENT
20 _visible _direction WENT
21 _ackable _direction WENT
22 _ack_oblig _direction WENT
23 _single_ack _direction WENT
24 - _direction WENT
25 _oldest_ack _direction WENT
26 _archive _direction WENT
27 _inactive _direction WENT
28 _sum _direction WENT
29 - Sum alert state first bit. _direction WENT
30 - Sum alert state second bit. _direction WENT
31 _delete _direction WENT

Further details to the config "_alert_hdl" you will find in the chapter Module PARA - _alert_hdl (alert handling)