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-10-26 02:45 AM . Last Modified: 2023-05-03 12:38 AM
>>Message imported from previous forum - Category:Scripts and Tips<<
User: mchartrand, originally posted: 2018-10-19 18:59:14 Id:156
This is a re-posting from the obsoleted (October 2018) "Schneider Electric Telemetry & SCADA" forum.
-------------------------------
**_hardin4019:
[Edit] Working code below and in the last post. I have removed the "Independent" alarm and also set options to "Variable Duration" under System Configuration / Alarms / Disable Alarms.
I am trying to write a manual redirection to be applied to specific alarms that often become a nuisance and repeat over and over every few minutes. The goal of the redirection would be to call a Structured Text program that #1 disables the alarm, and #2 re-enables the alarm after a fixed delay of say 1 hour.
So far my structured text file works to disable the alarms is working great when it comes to only disabling the alarms.
But when I add the code to "Enable By Time", the redirection ceases to even disable the alarm, and besided the event being entered in the event list that the manual redirection was run, nothing else happens.
Can anyone shed some light on how the "Enable By Time" is supposed to work, or spot check the code below for issues? Unfortunately the Help file seems to have very little information.
Redirection points to a Method Action with the following code:_**
_Execute('%ASource%', '%ACondName%')_
**_Structured Text (note that "EndTime" is set to 10 minutes for testing purposes):_**
_PROGRAM DisableAlarm
VAR
EndTime : UDINT;
END_VAR
VAR_INPUT
FullName : STRING;
Condition : STRING;
END_VAR
METHOD
Disable AT %M({FullName}.{Condition}.Disable):UDINT;
END_METHOD
EndTime := 10;
Disable(EndTime);
END_PROGRAM_
**_PS. Alarms on the system are configured to be "Idefintely Disabled", and operators do NOT have the security level for "Disable Alarms" turned on._**
-------------------------------
geoffpatton:
I have not used Enable By Time, However I would have done it differently so as an alternative option.
I would have had the alarm redirection Enable (put In Service) a ST program. The ST program runs at like a ten minute interval.
The program would Disable the Alarm and Start a timer.
Once the timer reaches an hour or more then it would Enable the Alarm and set itself Disable/Out of Service.
________
dmercer:
I can confirm that it's behaving the same way for me. It's werid that it takes a time of day rather than a date time.
Another way to do the reenable would be to add some metadata for the time to re-enable, which another program (running on interval) could then find using SQL.
Otherwise you'll need to talk to support.
__________________
**_hardin4019:
Upon running the enable by time method from a pick action om a button with no specified time, you get a pop up with a date and time, but entering any time in the future still immediately re-enables the alarm.
I had not thought of or ever seen a logic program being enabled and executed by a redirection. That sounds like an option. I was also thinking about writing a ST that uses a query to find any disabled alarms, disabled by logic, and disabled more than an hour ago and enabling any alarms it finds.
I guess the path I started down I was going for the simplest single ST program to cover both disabling and enabling in one simple step._**
___________
andrewscott:
The **CAlarm::EnableByTime** method immediately enables the alarm (if disabled), but allows the **CAlarm::VisibleTime** property and event journal message timestamp to be back dated. It was designed to be used when 'synchronising' alarms from a third party system to preserve the timestamp of when the alarm was enabled, rather than it being now.
Also, the argument to this method is an ordinary date/time, not a time of day.
___________________
**_hardin4019:
I am getting closer to the intended actions of the ST. The below code does almost everything I am expecting it to do. The problem I am having I think is due to a Date format issue between the server and The DATE_AND_TIME format. The date and time of "EndTime" come out as Year Month Day, but when I check the "DisabledEndTime" of the point in the OPC data, it is in order of Day Month Year, so when the ST sends a 2 minute in the future time of 2018-04-13-18:25:59.570, the OPC data says 13/05/2018 14:30:00_**
_PROGRAM DisableAlarm
VAR
EndTime : DATE_AND_TIME;
END_VAR
VAR_INPUT
FullName : STRING;
Condition : STRING;
END_VAR
METHOD
Disable AT %M({FullName}.{Condition}.Disable):DATE_AND_TIME;
END_METHOD
EndTime := ADD_DT_TIME(NOW(),TIME#0d0h0m10s);
Disable(EndTime);
END_PROGRAM_
__________________________________
andrewscott:
The OPC-DA explorer will **display** times using the current user's date time format settings, also this will normally be in local time.
The logic variables window displays times using the IEC 6-1131 format and in UTC.
The display format of the user will have no effect on the execution of the logic program.
In the program above the declaration of the 'Disable' method is incorrect. The argument to the method isn't of type **DATE_AND_TIME** but **UDINT**. The argument is a duration in minutes (i.e. how long the alarm will be disabled for, starting from the current time).
Also, to disable alarms from **logic** with an end time the following setting must be disabled in the server configuration tool: "System Configuration \\ Alarms \\ Disable Alarms \\ Independent".
_______________________
_**hardin4019:
Thanks, it works fine now. I had already disabled the Independent alarms. It has been a few weeks since I started down the road on this task and I only get part of a day here and there to tinker so I missed that the method called for a "Long" in the arguments...
The working code is below for anyone else going down the same path. Just change the "EndTime" to a relevant delay for the alarm to stay disabled. Currently set to 10 minutes for testing.**_
_PROGRAM DisableAlarm
VAR
EndTime : UDINT;
END_VAR
VAR_INPUT
FullName : STRING;
Condition : STRING;
END_VAR
METHOD
Disable AT %M({FullName}.{Condition}.Disable):UDINT;
END_METHOD
EndTime := 10;
Disable(EndTime);
END_PROGRAM_
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.