alertSet for add_value_1 not working

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
10 posts • Page 1 of 1
dbindernagel
Posts:161
Joined: Mon Feb 23, 2015 1:34 pm

alertSet for add_value_1 not working

Post by dbindernagel »

I have a script which should add a value to the _alert_hdl.._add_value_1 for every alarm (sieh working example below).
This works fine when the _alert_hdl config is on a bool. If the config is on a integer dpe (continuous) then I get the following error message.

PVSS00event (0), 2016.07.21 13:10:06.707, PARAM,SEVERE, 23, Setting/modifying attributes failed, DP: SystemTest:AlarmTest1.AlarmInt:_alert_hdl.._add_value_1

Is this a bug or am I trying something wrong.

Version: WinCC OA 3.10

Code: Select all

void main()
{
  alertConnect("AlertCB", false, ":_alert_hdl.._value");
}

void AlertCB(time tTime, int iCount, string strAlert, bool bValue)
{
  string strAddValueDPE = dpSubStr(strAlert, DPSUB_DP_EL) + ":_alert_hdl.._add_value_1";  
  alertSet(tTime, iCount, strAddValueDPE, "Test");
}

fmulder
Posts:330
Joined: Wed Feb 03, 2010 9:46 am

Re: alertSet for add_value_1 not working

Post by fmulder »

I ran into the exact same problem yesterday. I will look at it early next week and will post a solution (assuming that I find one)

My first assumption is that you need to do something like:
string strAddValueDPE = dpSubStr(strAlert, DPSUB_DP_EL) + ":_alert_hdl.1._add_value_1"; OR
string strAddValueDPE = dpSubStr(strAlert, DPSUB_DP_EL) + ":_alert_hdl.2._add_value_1"; OR
string strAddValueDPE = dpSubStr(strAlert, DPSUB_DP_EL) + ":_alert_hdl.3._add_value_1";

Will let you know

An analog alarm has multiple ranges (1, 2, 3, ...). I assume that we need to specify the range. In an analog alarm, multiple alarms can be active. In a Boolean there is just one

Gertjan van Schijndel
Posts:634
Joined: Mon Aug 02, 2010 10:37 am

Re: alertSet for add_value_1 not working

Post by Gertjan van Schijndel »

You only need to remove the attribute with the 'dpSubStr' and add the add_value attribute, then it should work. Like this:

Code: Select all

string strAddValueDPE = dpSubStr(strAlert, DPSUB_DP_EL_CONF_DET) + "._add_value_1";

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: alertSet for add_value_1 not working

Post by leoknipp »

at the example I've seen that you are using the CTRL function alertConnect() to get a hotlink when an alert is raised.
If you want to get the information when alert has changed it's state it is recommended to use the function dpQueryConnectSingle() with a query statement using "SELECT ALERT ...".
At the query statement you can exactly specfiy when the work function shall be called (FROM-clause, WHERE-condition).

Which type information shall be written to _add_value_1?
Is it always the same (static) information?

If the information is static (more or less) please try to find another solution.
When a high load situation occurs (a lot of a value changes and alerts in a short time) a script which modifies every alert will cause additional load.

Best Regards
Leopold Knipp
Senior Support Specialist

dbindernagel
Posts:161
Joined: Mon Feb 23, 2015 1:34 pm

Re: alertSet for add_value_1 not working

Post by dbindernagel »

The solution from Gertjan van Schijndel works perfectly. Thanks alot.
I can now see why my previous approach could not work because I did not consider the alarm range.
Instead of:
SystemTest:AlarmTest1.AlarmInt:_alert_hdl.._add_value_1
the correct value should be (for this specific range):
SystemTest:AlarmTest1.AlarmInt:_alert_hdl.2._add_value_1

@Leopold Knipp:
The information is different for every alarm.
Right now I'm modifying a existing script from my customer which is using "alertConnect". I will look into this if we can improve the current script.
Thanks for the info.

a_labropoulos@akatt.gr
Posts:25
Joined: Sun Nov 06, 2016 2:02 pm

Re: alertSet for add_value_1 not working

Post by a_labropoulos@akatt.gr »

I am using the following script to add a text “Service” at _add_value_10. I am checking the status of bit “.internal.Service_Mode:_original.._value == 1” and if is TRUE am adding this text to the _add_value_10 attribute. This script works for me only to the alerts with ‘Alert handling’ Power config . I want also to use this script for adding value to alerts with ‘Alert handling 5 ranges’ Power config but it doesn’t work. Is there any solution for that.

Code: Select all

main()
{
  string sQuery = "SELECT ALERT '_alert_hdl.._value','_alert_hdl.._direction'"
                  " FROM '*' WHERE '.internal.Service_Mode:_original.._value' == 1";

  dpQueryConnectSingle("ReadDB", false, "", sQuery, 200);
}

ReadDB(string sIdent, dyn_dyn_anytype ddaTab)
{
  for (int i=2; i

Gertjan van Schijndel
Posts:634
Joined: Mon Aug 02, 2010 10:37 am

Re: alertSet for add_value_1 not working

Post by Gertjan van Schijndel »

Using the datapoint element in the where clause without specifying the datapoint type might be the cause why it does not always work.

a_labropoulos@akatt.gr
Posts:25
Joined: Sun Nov 06, 2016 2:02 pm

Re: alertSet for add_value_1 not working

Post by a_labropoulos@akatt.gr »

How can i define in WHERE clause the datapoint type;;
In my case I want to check if the bit '.internal.Service_Mode:_original.._value' (datatype bool) is true . I have noticed that when I trigger an alert of type bool this script works perfect but when I trigger an alert of type Float (5 ranges alert handling) it doesn’t work.

Gertjan van Schijndel
Posts:634
Joined: Mon Aug 02, 2010 10:37 am

Re: alertSet for add_value_1 not working

Post by Gertjan van Schijndel »

With the '_DPT' keyword a datapoint type can be defined in a query. This and other keywords can be found in the online help under: System management -> Reporting -> SQL -> Basics SQL in Control

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: alertSet for add_value_1 not working

Post by leoknipp »

there is no difference if an _alert_hdl config was added using power configs or not.
The power config functionality also only adds configs to a datapoint element.

Please note that using configs different to the _alert_hdl config in a query using SELECT ALERT is not the correct approach. Depending on the version you are using also an error is reported when such queries are executed.

If the _add_value shall only be set for an alert configured at ".internal.Service_Mode" the DPE name needs to be defined at the FROM clause.

Best Regards
Leopold Knipp
Senior Support Specialist

10 posts • Page 1 of 1