EcoStruxure Geo SCADA Expert Forum
Schneider Electric support forum about installation, configuration, integration and troubleshooting of EcoStruxure Geo SCADA Expert (ClearSCADA, ViewX, WebX).
Link copied. Please paste this link to share this article on your social media post.
Posted: 2019-11-05 02:56 PM . Last Modified: 2023-05-03 12:31 AM
>>Message imported from previous forum - Category:Scripts and Tips<<
User: ROVSCADAENGINEER, originally posted: 2018-11-08 21:17:13 Id:314
I am trying to set up a code which inhibits ** (Disables alarms)** of an object folder based on the folder directory. I understand that you can disable alarms through creating a click button with pick action as method/Disable alarms and specifying that the object is relative with say for example location **SCX:////CTemplate/..**
I have created a logic timer which re-enables the alarms after a certain time and based on the logic I want the script to call the method based on the Boolean value of the inhibit alarm digital point. Is there a way you can call a method to a digital point? this would save time also. but I still need the folder to be relative so I can deploy the script and logic on several sites.
I understand that there is a server option for enable timed disable alarms, this is not what I want as this is a global server action. I just need it to run on a timer for specified folders.
the code is inserted below:
****PROGRAM NewStructuredTextProgram
VAR
InhibitAlarm AT %I(.inhibit alrm):BOOL;
END_VAR
METHOD
(*DisableAlarms AT %M(SCX:////CTemplate/MackayRC.AlarmDisabled):BOOL;*)
DIS AT %M(SCX:////CTemplate/MackayRC.Alarm Disabled):BOOL;
(* The path for the PSTNOS database item includes the PSTN aggregate aswell as the PromoteDialOut method. For methods that are associated with arguments rather than the database item, you need to define the method in this format:
AT %M(..):,, ;
*)
END_METHOD
IF (InhibitAlarm = 0) THEN
DIS(0);
ELSE
DIS(1);
END_IF;
END_PROGRAM****
I keep getting this problem with the code
Compile...
Method error: SCX:////CTemplate/MackayRC.Alarm Disabled not found
No matter how establish the location it does not want to establish the method in my method declaration section.
ANY help is appreciated with this script. I cannot seem to find any method call references to the disable alarm function.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2019-11-05 02:56 PM
>>Responses imported from previous forum
Reply From User: adamwoodland, posted: 2018-11-08 22:21:17
Check the schema, i.e. https://localhost/schema/cgroup from the server itself may work, and that explains the method calls available to you.
In the logic you probably just want:
DIS AT %M(MackayRC.DisableAlarms):DINT;
ENA AT %M(MackayRC.EnableAlarms);
To disable the alarms call DIS() and to enable alarms call ENA()
You may need to pass a integer to DIS() depending on your server config for the disabling duration.
Reply From User: ROVSCADAENGINEER, posted: 2018-11-08 23:24:53
thanks adam! that worked. However I just need to do one more thing. I need to make sure that the script is disabling the alarms relevant to 2 steps up from the folder it is stored in. Do you know how I could implement this? it does not allow me to specify the folder directly like,
DIS AT %M(MackayRC.Sewer System. Avocado Ct SPS.DisableAlarms):DINT;
this is the folder directory yet it does not recognise the method strored here, I think this is because maybe the folder runs from a template, or what they call an aggregate. not to sure.
The purpose is to inhibit alarms just for that group. I am afraid this script will inhibit alarms for the whole group. is there a way to inhibit alarms for a group with relevant spacing to the scripts location?
Reply From User: ROVSCADAENGINEER, posted: 2018-11-08 23:42:54
I got it working. just not sure how to specify relative folders from the script file.
Reply From User: adamwoodland, posted: 2018-11-09 03:05:38
You use . to specify relative addressing, you probably want the following to go two levels up:
DIS AT %M(...DisableAlarms):DINT;
Reply From User: ROVSCADAENGINEER, posted: 2018-11-14 23:53:49
thanks Adam. your help is appreciated
Reply From User: ROVSCADAENGINEER, posted: 2018-12-18 00:56:48
So after running this code inserted here below, there were some issues with the server as when the code runs every (x) set amount of time due to this section of code at the end:
****IF (inhibitalrms = 0) THEN
ENA();
ELSE
DIS(1);
END_IF;****
This resulted in a event logging storm as it was actuating the enable alarms method constantly with every time the code ran. What I am thinking may work as a way around this would be to write the code so that it only actuates the call method on a state change from high to low on the digital point. We ended up using clear SCADA's built in timer on the server settings for alarm inhibit options. the interface is not as flash but it still works.
I hope this prevents anyone having the same issue and maybe they make the code better! as this can be used for interactive interfaces like so! if you find a way to prevent this let me know!
...![]((see attachments below) pz/syjebt2vwypn.png "")
****
The Final code is here below****
PROGRAM NewStructuredTextProgram
METHOD
DIS AT %M(Test mimics.Mitch latch logic test.DisableAlarms):BOOL;
ENA AT %M(Test mimics.Mitch latch logic test.EnableAlarms);
END_METHOD
VAR
Inhibitalarmstime AT %I(.Inhibit alarms time) : TIME;
Timeinhibited AT %M(.Time inhibited) : TIME;
inhibitalrm AT %I(.inhibit alrm) : BOOL;
inhibitalrms AT %M(.inhibit alrm) : BOOL;
END_VAR
(*This section compiles the blocks that are going to be used in building the logic program*)
VAR
TIMER : TON;
LATCH : SR;
RISETRIGGER : R_TRIG;
FALLTRIGGER : F_TRIG;
END_VAR
(*This section classifies the false state for each block allowing it
to be called later on in functions, it may be only necessery for the
false functions of blocks where readable outputs are required in order
for the code to work propperly*)
VAR
FALLTRIGGER_ENO : BOOL := FALSE;
RISETRIGGER_ENO : BOOL := FALSE;
TimeToReal_ENO : BOOL := FALSE;
TimeToReal : REAL;
MinToMilliseconds_ENO : BOOL := FALSE;
MinToMilliseconds : REAL;
OperatorMillisecondsToTime_ENO : BOOL := FALSE;
OperatorMillisecondsToTime : TIME;
TIMER_ENO : BOOL := FALSE;
LATCH_ENO : BOOL := FALSE;
ElapsedTimeToReal_ENO : BOOL := FALSE;
ElapsedTimeToReal : REAL;
ETmsToSeconds_ENO : BOOL := FALSE;
ETmsToSeconds : REAL;
ConvertedETtoTime_ENO : BOOL := FALSE;
ConvertedETtoTime : TIME;
END_VAR
(*ESTABLISHING INPUTS TO RISE AND FALL TRIGGERS FROM OPERATOR BUTTON*)
FALLTRIGGER( CLK := inhibitalrm, ENO = FALLTRIGGER_ENO );
RISETRIGGER( CLK := inhibitalrm, ENO = RISETRIGGER_ENO );
(*SPECIFYING THE INPUTS AND OUTPUTS OF THE LATCH FOR ALARM SETTINGS*)
LATCH( S1 := RISETRIGGER.Q, R := OR( TIMER.Q, FALLTRIGGER.Q ), ENO = LATCH_ENO );
(*Converts the Operators input of Miutes to milliseconds through Time to Real, convert then back to time. *)
TimeToReal := TIME_TO_REAL( IN := Inhibitalarmstime, ENO = TimeToReal_ENO );
MinToMilliseconds := MUL( IN1 := TimeToReal, IN2 := 60000, ENO = MinToMilliseconds_ENO );
OperatorMillisecondsToTime := REAL_TO_TIME( IN := MinToMilliseconds, ENO = OperatorMillisecondsToTime_ENO );
(*Establishing the Timer Block with correct time format*)
TIMER( IN := inhibitalrm, PT := OperatorMillisecondsToTime, ENO = TIMER_ENO );
(*Converts the output time of the elapsed time into correct units Seconds for operator*)
ElapsedTimeToReal := TIME_TO_REAL( IN := TIMER.ET, ENO = ElapsedTimeToReal_ENO );
ETmsToSeconds := DIV( IN1 := ElapsedTimeToReal, IN2 := 1000, ENO = ETmsToSeconds_ENO );
ConvertedETtoTime := REAL_TO_TIME( IN := ETmsToSeconds, ENO = ConvertedETtoTime_ENO );
(*Calls the inhibit alrm digital point as the LATCH output*)
IF LATCH_ENO THEN
inhibitalrms := LATCH.Q1;
END_IF;
(*Calls the converted ET output as the digital point Timeinhibited*)
IF ConvertedETtoTime_ENO THEN
Timeinhibited := ConvertedETtoTime;
END_IF;
IF (inhibitalrms = 0) THEN
ENA();
ELSE
DIS(1);
END_IF;
END_PROGRAM
Attached file: (editor/pz/syjebt2vwypn.png), inhibit alarms option.PNG File size: 2020
Reply From User: geoffpatton, posted: 2018-12-18 01:23:04
You could have used the Alarm State of the group you are disabling.
GroupName.AlarmState
IF (inhibitalrms = 0) and (GroupAlarmState = 1) THEN
ENA();
END_IF
IF (inhibitalrms = 1) and (GroupAlarmState 1) THEN
DIS(1);
END_IF;
END_PROGRAM
Reply From User: BevanWeiss, posted: 2019-01-03 22:41:16
I would recommend not having just logic re-enabling the alarms if you can avoid it, but instead using the option to Disable Alarms to provide a duration of the alarm disablement.
This way the alarm will automatically be re-enabled at the appropriate time, even if your logic stops working.
It does look although what you are kind of trying to do is a Consequential Alarm Suppression however, so it might be worth you looking more into how this is configured in ClearSCADA.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2019-11-05 02:56 PM
>>Responses imported from previous forum
Reply From User: adamwoodland, posted: 2018-11-08 22:21:17
Check the schema, i.e. https://localhost/schema/cgroup from the server itself may work, and that explains the method calls available to you.
In the logic you probably just want:
DIS AT %M(MackayRC.DisableAlarms):DINT;
ENA AT %M(MackayRC.EnableAlarms);
To disable the alarms call DIS() and to enable alarms call ENA()
You may need to pass a integer to DIS() depending on your server config for the disabling duration.
Reply From User: ROVSCADAENGINEER, posted: 2018-11-08 23:24:53
thanks adam! that worked. However I just need to do one more thing. I need to make sure that the script is disabling the alarms relevant to 2 steps up from the folder it is stored in. Do you know how I could implement this? it does not allow me to specify the folder directly like,
DIS AT %M(MackayRC.Sewer System. Avocado Ct SPS.DisableAlarms):DINT;
this is the folder directory yet it does not recognise the method strored here, I think this is because maybe the folder runs from a template, or what they call an aggregate. not to sure.
The purpose is to inhibit alarms just for that group. I am afraid this script will inhibit alarms for the whole group. is there a way to inhibit alarms for a group with relevant spacing to the scripts location?
Reply From User: ROVSCADAENGINEER, posted: 2018-11-08 23:42:54
I got it working. just not sure how to specify relative folders from the script file.
Reply From User: adamwoodland, posted: 2018-11-09 03:05:38
You use . to specify relative addressing, you probably want the following to go two levels up:
DIS AT %M(...DisableAlarms):DINT;
Reply From User: ROVSCADAENGINEER, posted: 2018-11-14 23:53:49
thanks Adam. your help is appreciated
Reply From User: ROVSCADAENGINEER, posted: 2018-12-18 00:56:48
So after running this code inserted here below, there were some issues with the server as when the code runs every (x) set amount of time due to this section of code at the end:
****IF (inhibitalrms = 0) THEN
ENA();
ELSE
DIS(1);
END_IF;****
This resulted in a event logging storm as it was actuating the enable alarms method constantly with every time the code ran. What I am thinking may work as a way around this would be to write the code so that it only actuates the call method on a state change from high to low on the digital point. We ended up using clear SCADA's built in timer on the server settings for alarm inhibit options. the interface is not as flash but it still works.
I hope this prevents anyone having the same issue and maybe they make the code better! as this can be used for interactive interfaces like so! if you find a way to prevent this let me know!
...![]((see attachments below) pz/syjebt2vwypn.png "")
****
The Final code is here below****
PROGRAM NewStructuredTextProgram
METHOD
DIS AT %M(Test mimics.Mitch latch logic test.DisableAlarms):BOOL;
ENA AT %M(Test mimics.Mitch latch logic test.EnableAlarms);
END_METHOD
VAR
Inhibitalarmstime AT %I(.Inhibit alarms time) : TIME;
Timeinhibited AT %M(.Time inhibited) : TIME;
inhibitalrm AT %I(.inhibit alrm) : BOOL;
inhibitalrms AT %M(.inhibit alrm) : BOOL;
END_VAR
(*This section compiles the blocks that are going to be used in building the logic program*)
VAR
TIMER : TON;
LATCH : SR;
RISETRIGGER : R_TRIG;
FALLTRIGGER : F_TRIG;
END_VAR
(*This section classifies the false state for each block allowing it
to be called later on in functions, it may be only necessery for the
false functions of blocks where readable outputs are required in order
for the code to work propperly*)
VAR
FALLTRIGGER_ENO : BOOL := FALSE;
RISETRIGGER_ENO : BOOL := FALSE;
TimeToReal_ENO : BOOL := FALSE;
TimeToReal : REAL;
MinToMilliseconds_ENO : BOOL := FALSE;
MinToMilliseconds : REAL;
OperatorMillisecondsToTime_ENO : BOOL := FALSE;
OperatorMillisecondsToTime : TIME;
TIMER_ENO : BOOL := FALSE;
LATCH_ENO : BOOL := FALSE;
ElapsedTimeToReal_ENO : BOOL := FALSE;
ElapsedTimeToReal : REAL;
ETmsToSeconds_ENO : BOOL := FALSE;
ETmsToSeconds : REAL;
ConvertedETtoTime_ENO : BOOL := FALSE;
ConvertedETtoTime : TIME;
END_VAR
(*ESTABLISHING INPUTS TO RISE AND FALL TRIGGERS FROM OPERATOR BUTTON*)
FALLTRIGGER( CLK := inhibitalrm, ENO = FALLTRIGGER_ENO );
RISETRIGGER( CLK := inhibitalrm, ENO = RISETRIGGER_ENO );
(*SPECIFYING THE INPUTS AND OUTPUTS OF THE LATCH FOR ALARM SETTINGS*)
LATCH( S1 := RISETRIGGER.Q, R := OR( TIMER.Q, FALLTRIGGER.Q ), ENO = LATCH_ENO );
(*Converts the Operators input of Miutes to milliseconds through Time to Real, convert then back to time. *)
TimeToReal := TIME_TO_REAL( IN := Inhibitalarmstime, ENO = TimeToReal_ENO );
MinToMilliseconds := MUL( IN1 := TimeToReal, IN2 := 60000, ENO = MinToMilliseconds_ENO );
OperatorMillisecondsToTime := REAL_TO_TIME( IN := MinToMilliseconds, ENO = OperatorMillisecondsToTime_ENO );
(*Establishing the Timer Block with correct time format*)
TIMER( IN := inhibitalrm, PT := OperatorMillisecondsToTime, ENO = TIMER_ENO );
(*Converts the output time of the elapsed time into correct units Seconds for operator*)
ElapsedTimeToReal := TIME_TO_REAL( IN := TIMER.ET, ENO = ElapsedTimeToReal_ENO );
ETmsToSeconds := DIV( IN1 := ElapsedTimeToReal, IN2 := 1000, ENO = ETmsToSeconds_ENO );
ConvertedETtoTime := REAL_TO_TIME( IN := ETmsToSeconds, ENO = ConvertedETtoTime_ENO );
(*Calls the inhibit alrm digital point as the LATCH output*)
IF LATCH_ENO THEN
inhibitalrms := LATCH.Q1;
END_IF;
(*Calls the converted ET output as the digital point Timeinhibited*)
IF ConvertedETtoTime_ENO THEN
Timeinhibited := ConvertedETtoTime;
END_IF;
IF (inhibitalrms = 0) THEN
ENA();
ELSE
DIS(1);
END_IF;
END_PROGRAM
Attached file: (editor/pz/syjebt2vwypn.png), inhibit alarms option.PNG File size: 2020
Reply From User: geoffpatton, posted: 2018-12-18 01:23:04
You could have used the Alarm State of the group you are disabling.
GroupName.AlarmState
IF (inhibitalrms = 0) and (GroupAlarmState = 1) THEN
ENA();
END_IF
IF (inhibitalrms = 1) and (GroupAlarmState 1) THEN
DIS(1);
END_IF;
END_PROGRAM
Reply From User: BevanWeiss, posted: 2019-01-03 22:41:16
I would recommend not having just logic re-enabling the alarms if you can avoid it, but instead using the option to Disable Alarms to provide a duration of the alarm disablement.
This way the alarm will automatically be re-enabled at the appropriate time, even if your logic stops working.
It does look although what you are kind of trying to do is a Consequential Alarm Suppression however, so it might be worth you looking more into how this is configured in ClearSCADA.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.