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: 2020-01-13 08:53 AM . Last Modified: 2023-05-03 12:19 AM
I have some points (Advanced Modbus) that I would like to alarm for the Operator as soon as the value changes above the High High set point in SCADA that are timed Alarms in the Field RTU. I am working on getting the timer values from the RTU, but would like to make a short term work around. I understand polling times will effect the results. And if anyone has a better way of doing this, I'm open to suggestions.
I have made a Mimic that lists the Value of the point, the HH set point with no Persistance, a text field that indicates how long the point must be in HH alarm before any action is taken by the Field RTU. What I need some guidance on is, I would like to use a Mimic Animation Expression to calculate a very rough countdown timer on time remaining before the Field RTU logic causes some action so that the operator knows how much time they have left to react.
The rough idea would be:
IIF(Point.AlarmState >= 2 ,(Fixed time period before action) - (Now - Point.StateChangeTime),'False')
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: 2020-01-14 07:33 AM
I had to modify it some to get seconds since the alarm came in. The original formula was coming up with a result of / 86400 of a day as the final answer (I think).
IIF ( (TIME('NOW') - ".Point.StateChangeTime")*86400 > 86400,
FORMATVAL('0.# days', ((TIME('NOW')-".Point.StateChangeTime")*86400)/86400),
IIF( (TIME('NOW') - ".Point.StateChangeTime")*86400 > 3600,
FORMATVAL('0.# hours', ((TIME('NOW')-".Point.StateChangeTime")*86400)/3600),
IIF( (TIME('NOW') - ".Point.StateChangeTime")*86400 > 60,
FORMATVAL( '0.# minutes', ((TIME('NOW')-".Point.StateChangeTime")*86400)/60.0),
FORMATVAL( '0.# seconds', ((TIME('NOW')-".Point.StateChangeTime")*86400))
)
)
)
I trimmed this down and made it a Minutes and Seconds count down timer, where the 1200 is a constant = 20 minutes, and in mine I am using a Variable that is the current time instead of TIME('NOW') :
IIF( (1200-(TIME('NOW') - ".Point.StateChangeTime")*86400) > 60,
FORMATVAL( '0.# minutes', (1200-(("...Time"-".Point.StateChangeTime")*86400))/60.0),
FORMATVAL( '0 seconds', (1200-(("...Time"-".Point.StateChangeTime")*86400)))
)
(Final Result)
To clean it up further and prevent going less than 0 Seconds while counting down, and to prevent count down after the alarm has cleared :
IIF( "Point.AlarmState" >= 2,
IIF( ("...Time" - ".Point.StateChangeTime")*86400) <= 1200,
IIF( (1200-("...Time" - ".Point.StateChangeTime")*86400) > 60,
FORMATVAL( '0.# minutes', (1200-(("...Time"-".Point.StateChangeTime")*86400))/60.0),
FORMATVAL( '0 seconds', (1200-(("...Time"-".Point.StateChangeTime")*86400)))
),
'0 Seconds'),
'Not in Alarm')
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: 2020-01-13 10:09 AM
You'll want to look into the Properties of the point for something like a StateChangeTime.
And then you could difference that against "Now".
It's not going to account for polling time, but for long enough action times this wouldn't be so important.
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: 2020-01-13 10:33 AM
Thanks for the reply Bevan. The "Now" doesn't seem to work as a part of an expression, but I had figured out that I already have a point created for current Date_Time that I can use. So I am making some progress.
Right now I have it counting down seconds, but I am having issues getting the results of the expression to combine the (Remaining seconds) + ' Seconds' into a string to display in a text field. Ideally I am trying to use an IIF statement to change the display from saying X.X Minutes to X.X Seconds if the remaining time is < 60 seconds. I'm sure I'm doing something wrong with syntax of trying to combine a number and a string.
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: 2020-01-13 10:53 AM
I really remembered there being a NOW in the Expression syntax, but looking at the help file (useful guide), it suggests that I'm wrong, and that it should be:
TIME(TIME VALUE)
Where:
•TIME VALUE is a STRING that provides an OPC relative time value.
one slightly annoying thing about expressions is that you can't store intermediate results, so to do something like conditional formatting you're going to end up repeating certain expression terms quite a lot.
You could do something like
IIF (TIME('NOW') - ".Point.StateChangeTime" > 86400,
FORMATVAL('0.# days', (TIME('NOW') - ".Point.StateChangeTime")/86400,
IIF( TIME('NOW') - ".Point.StateChangeTime" > 3600,
FORMATVAL('0.# hours', (TIME('NOW') - ".Point.StateChangeTime")/3600,
IIF( TIME('NOW') - ".Point.StateChangeTime" > 60,
FORMATVAL( '0.# minutes', (TIME('NOW')-".Point.StateChangeTime")/60.0),
FORMATVAL( '0.# seconds', (TIME('NOW')-".Point.StateChangeTime")
)
)
)
Not sure if my syntax is right on that.. it's been a while since I've dived into the expressions, and I'm rusty already.
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: 2020-01-13 10:55 AM
I should add... within expressions, you can use { ... } to include comments.
When you start to make complicated expressions then it will become useful to comment them
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: 2020-01-13 11:03 AM
I figured out my issue. I was forgetting to add STR() when combining a number value and a String. All good now.
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: 2020-01-13 11:30 AM
I'm glad there are people as experienced as you to find things like TIME('NOW'), because that completely slipped my mind. I found TIME() in the help viewer, but wasn't thinking about how 'NOW' was also a valid OPC time. I also tried searching the help viewer for "Expression Now" and came up blank. Clearly I have room for improvement on the programming and syntax side.
Side note. I tried TIME('NOW') and my method of using a Time Variable that has the current system time assigned to it. Oddly enough the TIME('NOW') only updates when the mimic is opened or saved, so I suspect that some action is required to kick the TIME('NOW') to update, and won't quite work for the intended Mimic.
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: 2020-01-13 12:02 PM
I'd recommend just filing the TIME('NOW') as a 'bug' with Schneider Tech Support. It's possible that they will push back with a reasoning, but perhaps there is a more recommend manner to get current time (outside of having a DB object, with it's additional server load etc).
I suspect the issue is that nothing 'inside' the TIME('NOW') expression is changing in the mimic. The 'NOW' is a constant, so is evaluated once on mimic load / navigate, and then not again. I suspect that this same issue would occur with TIME('s') or TIME('s-2s') or any equivalent OPC valid string.
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: 2020-01-13 12:03 PM
I'd recommend FORMATVAL over STR... FORMATVAL gives more explicit definition of the string format for the numeric value.
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: 2020-01-14 07:33 AM
I had to modify it some to get seconds since the alarm came in. The original formula was coming up with a result of / 86400 of a day as the final answer (I think).
IIF ( (TIME('NOW') - ".Point.StateChangeTime")*86400 > 86400,
FORMATVAL('0.# days', ((TIME('NOW')-".Point.StateChangeTime")*86400)/86400),
IIF( (TIME('NOW') - ".Point.StateChangeTime")*86400 > 3600,
FORMATVAL('0.# hours', ((TIME('NOW')-".Point.StateChangeTime")*86400)/3600),
IIF( (TIME('NOW') - ".Point.StateChangeTime")*86400 > 60,
FORMATVAL( '0.# minutes', ((TIME('NOW')-".Point.StateChangeTime")*86400)/60.0),
FORMATVAL( '0.# seconds', ((TIME('NOW')-".Point.StateChangeTime")*86400))
)
)
)
I trimmed this down and made it a Minutes and Seconds count down timer, where the 1200 is a constant = 20 minutes, and in mine I am using a Variable that is the current time instead of TIME('NOW') :
IIF( (1200-(TIME('NOW') - ".Point.StateChangeTime")*86400) > 60,
FORMATVAL( '0.# minutes', (1200-(("...Time"-".Point.StateChangeTime")*86400))/60.0),
FORMATVAL( '0 seconds', (1200-(("...Time"-".Point.StateChangeTime")*86400)))
)
(Final Result)
To clean it up further and prevent going less than 0 Seconds while counting down, and to prevent count down after the alarm has cleared :
IIF( "Point.AlarmState" >= 2,
IIF( ("...Time" - ".Point.StateChangeTime")*86400) <= 1200,
IIF( (1200-("...Time" - ".Point.StateChangeTime")*86400) > 60,
FORMATVAL( '0.# minutes', (1200-(("...Time"-".Point.StateChangeTime")*86400))/60.0),
FORMATVAL( '0 seconds', (1200-(("...Time"-".Point.StateChangeTime")*86400)))
),
'0 Seconds'),
'Not in Alarm')
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.