Alarm Notification Routine - Power Interrupted
This article provides an example of using the functionality Notification Procedure, available in the processing module of Alarms of the Action.NET. This is the possibility of including in the definition of a Alarm Group a call to a script procedure defined in the project itself. And also the possibility of this procedure intervene in the creation of the alarm message being created!
Â
Introduction
In Action.NET, when you want an alarm message to be generated from a condition monitored in a tag, you need to set a Alarm Group and a Alarm item for specifying what the system's behavior will be like in generating the message.
As can be seen in detail in Alarm Setup, in addition to various settings, such as horn, colors, recognition, alarm states, it can also be defined that a call be made to a procedure (a script) when the alarm condition is detected, before the message is generationed.
This article shows an example of deploying this facility, considering a specific case, in which the generation of an alarm message is defined whenever the state of a Circuit breaker changes. It then uses a notification procedure that will change the alarm message when it is indicative of the aperture circuit breaker, including in the message a text with the value of the current measure of power which was interrupted by the opening. This is the value of the power that was being measured in the circuit breaker before opening.
Functionality
The figure shows the result obtained on an Event Report screen.
Changes are made to the state of a circuit breaker, which is using the functionality created. When the circuit breaker is closed the message indicates the lock and text with the breaker name.
When the circuit breaker is opened, the message with the breaker name is changed and receives a text with the current measure of power in the circuit breaker. In the figure the text is highlighted with a yellow markup.
Implementation
For this implementation we need to have the breaker and power tags, create or change a group of alarms and create the alarm items
Structures in the project
Tags
We have an object Feeder members with type STA (digital dots) and MEA (measuring points), as seen in the figure
So the tags we need to use are:
@Tag.FED_01.STA. P52A, with the position of the circuit breaker and
@Tag.FED_01.MEA. MVA, with the power measure passing through the circuit breaker
Notification Class and Procedure
We started by creating a class in EDIT>SCRIPTS>CLASSES.
We assign a name to the class Alarmhnd. We chose the C# language. And let's go to the Code sheet to write the notification routine
As can be seen in Alarm Notification Routines, the routine to be written must have the prototype, with passage of the structure parameter
AlarmEventInfo[], - This structure has several fields with alarm data, such as TagName, Message, Value, as shown in the figure below.
Let's build a Notification routine with the name OpenBreaker. Your function will be to change the alarm message including a text with the current power at the time of opening.
At the time of the call, the info[0]. Value has the state of the circuit breaker before the occurrence. So let's run only when this state is in CLOSED.
From the breaker tag name you get the tag name of the power measure, with a string replace operation.
You then get the power value.
At the end a text with this value is placed in the "attribute." PrefixAlarmMessage", from the Circuit Breaker tag (which is the purpose of the Alarm Message)
This attribute has exactly this purpose: its text is included by the Alarms module by prefixing the message.
// AlarmHnd - Alarm handler Class
const string brkName = "STA.P52A"; // Breaker tag name below bay name
const string meaName = "MEA.MVA"; // Measure tag name below bay name
const string CLOSED = "2"; // Value of closed state
//
// Breaker change - Alarm Notification
// march 2021
// an-8.1
//
public void OpenBreaker(AlarmEventInfo[] info)
{
@Info.Trace("======> Notification Called: " + info[0].TagName);
// Test against last value before change CLOSED = "2"
if (info[0].Value == CLOSED)
{
// use breaker name to get measure name
string mvaName = info[0].TagName.Replace(brkName,meaName);
float mva = TConvert.To<float>(TK.GetObjectValue(mvaName+".Value"));
// Sets this atribute to string with mva current measure
string prfM = "Mva: " + mva.ToString() + " - ";
TK.SetObjectValue(info[0].TagName + ".PrefixAlarmMessage", prfM );
}
}
Alarms
Now a group of alarms must be created in the project, in EDIT > ALARMs > GROUP
We call it BREAK_CHANGE. In this group you should place the information with the name of the notification routine: AlarmHnd.OpenBreaker
In ALARM > items we will create the alarm message setting for changing the state of the circuit breaker
Tests
For a simple test include these objects in a project and test using the WATCH window.
Place a value for the power measure and change the state of the circuit breaker, which can assume the values 0 to 3.
Where 1 = Open and 2=Closed. Alarm messages will appear as shown in the first figure in this article.
Â
Â
On this page:
Â
Â