Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

[Imported] Dynamic User Time Duration Input

EcoStruxure Geo SCADA Expert Forum

Schneider Electric support forum about installation, configuration, integration and troubleshooting of EcoStruxure Geo SCADA Expert (ClearSCADA, ViewX, WebX).

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • Remote Operations
  • EcoStruxure Geo SCADA Expert Forum
  • [Imported] Dynamic User Time Duration Input
Options
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
sbeadle
Kirk sbeadle Kirk
307
AndrewScott
Admiral AndrewScott
95
BevanWeiss
Spock BevanWeiss
89
AdamWoodlandToo
Lt. Commander AdamWoodlandToo
36
View All
Related Products
product field
Schneider Electric
EcoStruxure™ Geo SCADA Expert

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Back to EcoStruxure Geo SCADA Expert Forum
sbeadle
Kirk sbeadle Kirk
Kirk

Posted: ‎2019-10-26 02:59 AM . Last Modified: ‎2023-05-03 12:38 AM

0 Likes
0
1057
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

Posted: ‎2019-10-26 02:59 AM . Last Modified: ‎2023-05-03 12:38 AM

[Imported] Dynamic User Time Duration Input

>>Message imported from previous forum - Category:Scripts and Tips<<
User: admin, originally posted: 2018-10-19 19:37:43 Id:159
This is a re-posting from the obsoleted (October 2018) "Schneider Electric Telemetry & SCADA" forum.

-------------------------------

**_NIWTelemetry:
Hi everyone. Looking for some help if possible. I have a ST program which generates a future time from current time using the following:_**

_Futuretime := ADD_DT_TIME(NOW(),T#15m)_

**_The T#15m is hard coded as you know. Is there any way I can create a way for a end user to input a time value in hours or minutes and then have it referenced within the calculation above without having to hard code the script 'T#15m' each time?? Thank you all in advance._**

-------------------------------

geoffpatton:
You can use a variable, constant variable, or a internal point to hold the numeric value, Variables and Internal points are easy to write to. Internal points you can keep history on, but they do count against the point count, Variables are not points so they don't count. Constant Variables hold the value in a configuration property so you cannot just write to it using a method, you have to write a script on a graphic to set the property. The plus side, for me anyway, of a constant variable is you can preset the value in your template, and when you copy or do an export the value is retained.
I have used all three depending on the overall need.

I did this using a Constant Variable to set variables on a timer.
Here is the relevant ST:

_CPA_Concat_ENO : BOOL := FALSE;
CPA_String : STRING[255];
CPA_STT_ENO : BOOL := FALSE;
CPA_Time : TIME;
CPADelay AT %M(.CPA Delay.ConstantValue) : INT; (*Time SETTING in seconds*)
CPA_String := CONCAT( IN1 := 'T#',IN2 := INT_TO_STRING(SUB(IN1:= CPADelay, IN2:= 10)), IN3 := 's', ENO = CPA_Concat_ENO );
CPA_Time:= STRING_TO_TIME( IN := CPA_String, ENO = CPA_STT_ENO );_

I have not used this with the ADD_DT_Time but I think that will be:

_Futuretime := ADD_DT_TIME(NOW(),CPA_Time)_

This was the script on my mimic:

_Function CPADelaySec
Dim frmEditBox, frmOKButton, frmCancelButton
Form.Init "Set Control Power Alarm Delay"
Form.AddStaticText 2,1, "Control Power ''Alarm Delay'' Setting"
Set frmEditBox = Form.AddEditBox(2,3,10,1)
frmEditBox.MaxLength = 10
frmEditBox.Align = 0
frmEditBox.Value = Server.GetOPCValue("...IO.Power Email Alarm.CPA Delay.ConstantValue")
Form.AddStaticText 14,3, "Seconds"
Set frmOKButton = Form.AddPushButton(25,3,"OK")
frmOKButton.Default = True
Set frmCancelButton = Form.AddPushButton(40,3,"Cancel")
Form.Show
If Form.Selection = "OK" Then
IF isNumeric(frmEditBox.Value) = True Then
Server.SetOPCValue "...IO.Power Email Alarm.CPA Delay.Value", Round(Cint(frmEditBox.Value))
Else
iResponse = MsgBox("Value is not a Number." , vbOK + vbDefaultButton2, "Set Control Power Alarm Delay")
End If
End If
End Function_

___________________________________

**_NIWTelemetry:
Thank you very much for taking the time and trouble to respond. This response was very detailed.
I will try this._**

______________

Author Icon
dmercer:
Hi Tony.
The answer that Geoff gave you is for a mimic script, which is different to an ST program. Either can work, but it depends on exactly what you're trying to acchieve.

Mimic scripts run on the client side, and only run when a particular mimic is open. ST programs run on the server side.

In the ST programs you can define some input variables and use those:

_VAR_INPUT
Input1 : TIME;
END_VAR_

Or you can use a direct variable:

_VAR
Input AT %I(..TimeDelay.CurrentValue): TIME;
END_VAR;_

https://www.citect.schneider-electric.com/scada/clearscada/help/2017/Content/LogicGuide/UsingtheVARL...

________________

**_NIWTelemetry:
Hi Dean. Very interesting response. Would you mind elaborating please? I'd like the end user to have the ability to handdress say for example with a value from 1 to 360 on a mimic and have that value stored and added to NOW() as minutes to create a future date time once the ST program executes therefore replacing the hard coded T#15m if you understand. I thought something like this should be a fundamental part of ClearSCADA such as using an internal time point or variable in the data tree then reference it within the script, however it does not appear to be so straightforward. Could you give me an example? It would be fantastic if I was able to get something to work. Thanks._**

_________________

AWoodland:
You could also pass them in as individual components (hours, mins, secs) and use the MAKE_TIME function.

_________________

**_NIWTelemetry:
Hi Adam. Thank you for this suggestion.
Tony_**

___________________

dmercer:
Whether you do it in ST or mimic script depends mostly on whether you want to run the logic once; or if the user enters the time once, and then the logic runs in the background on a schedule or a point changing.

If it's the latter, then I would allow some points from the database to be controlled from a mimic, then bring them in as direct variables.

Attached is a zipped export with an extremely quick example. (Time Offset Example 1.zip) Note that the value of the integer point will be lost if the system is exported and re imported. To avoid this you can use a parameter, but then you need to create a custom form in a mimic script.

___________

**_NIWTelemetry:
Hi Dean. Amazing Sir! Thank you very much for taking the time and effort to respond. I wish to store a time variable in the data tree and allow it to be handressed by a user from a mimic. On the same mimic there is a button to launch a ST program which disables alarms on a series of analogue points. Part of this ST program is to set a future time which will trigger further ST to re enable the same point alarms once The current date time exceeds that future time. So I'm looking for a way to permit control room staff enter a value in minutes..or hours have that value stored then referenced by the ST program when executed to create a time out. if that makes sense.
I will import your attachment into my T&D server and try it out. Thank you once again._**

____________________

**_NIWTelemetry:
Hi Everyone.
I managed to get this working!
Thank you all very much for your assistance._**


Attached file: (editor/yi/mqtirw4u9hda.zip), Time Offset Example 1.zip File size: 236878

Attachments
mqtirw4u9hda.zip
Labels
  • Labels:
  • SCADA
Reply

Link copied. Please paste this link to share this article on your social media post.

  • All forum topics
  • Previous Topic
  • Next Topic
Replies 0
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

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.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of