Sign In Help
Schneider Electric
HelpSign In
Schneider Electric Exchange
  • Home
  • Collaborate
  • Develop
  • Shop
Home Collaborate Develop Shop Log in or Register Help

Invite a Co-worker

Send a co-worker an invite to the Exchange 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
  • Home
  • Collaborate
  • Exchange Community
  • :
  • SCADA & Telemetry Solutions
  • :
  • Geo SCADA Expert Forum
  • :
  • [Imported] Dynamic User Time Duration Input
Community Menu
  • Forums
    • By Topic
        • EcoStruxure IT
          • EcoStruxure IT forum
        • Industrial Automation
          • Industry Automation and Control Forum
          • Alliance System Integrators Forum
          • Machine Solutions in the Digital Transformation
          • EcoStruxure Automation Expert / IEC 61499 Forum
          • Industrial Edge Computing Forum
          • Level and Pressure Instrumentation Forum
          • Modicon User Group
          • PLC Club Indonesia
          • SEE Automation Club Forum
          • Fabrika ve Makina Otomasyonu Çözümleri
          • Форум по промышленной автоматизации СНГ
        • SCADA & Telemetry Solutions
          • Geo SCADA Expert Forum
          • SCADA and Telemetry Devices Forum
        • Power Distribution IEC
          • Power Distribution and Digital
          • Power Standards & Regulations
          • Paneelbouw & Energie Distributie
          • Eldistribution & Fastighetsautomation
        • Power Distribution Softwares
          • EcoStruxure Power Design Forum
          • SEE Electrical Building+ Forum
          • LayoutFAST User Group Forum
        • Wireless Information Network Solutions
          • Instrument Area Network
          • Remote Monitoring
          • Tank Level Monitoring
          • Remote Data Collection
        • Solutions for your Business
          • Solutions for Food & Beverage Forum
          • Solutions for Healthcare Forum
    • By Segment
        • Food & Beverage
          • Solutions for Food & Beverage Forum
        • Healthcare
          • Solutions for Healthcare Forum
      • EcoStruxure IT
        • EcoStruxure IT forum
      • Industrial Automation
        • Industry Automation and Control Forum
        • Alliance System Integrators Forum
        • Machine Solutions in the Digital Transformation
        • EcoStruxure Automation Expert / IEC 61499 Forum
        • Industrial Edge Computing Forum
        • Level and Pressure Instrumentation Forum
        • Modicon User Group
        • PLC Club Indonesia
        • SEE Automation Club Forum
        • Fabrika ve Makina Otomasyonu Çözümleri
        • Форум по промышленной автоматизации СНГ
      • SCADA & Telemetry Solutions
        • Geo SCADA Expert Forum
        • SCADA and Telemetry Devices Forum
      • Power Distribution IEC
        • Power Distribution and Digital
        • Power Standards & Regulations
        • Paneelbouw & Energie Distributie
        • Eldistribution & Fastighetsautomation
      • Power Distribution Softwares
        • EcoStruxure Power Design Forum
        • SEE Electrical Building+ Forum
        • LayoutFAST User Group Forum
      • Wireless Information Network Solutions
        • Instrument Area Network
        • Remote Monitoring
        • Tank Level Monitoring
        • Remote Data Collection
      • Solutions for your Business
        • Solutions for Food & Beverage Forum
        • Solutions for Healthcare Forum
      • Food & Beverage
        • Solutions for Food & Beverage Forum
      • Healthcare
        • Solutions for Healthcare Forum
  • Blogs
    • By Topic
        • Industrial Automation
          • Industrial Edge Computing Blog
          • Industry 4.0 Blog
          • Industrie du Futur France
        • SCADA & Telemetry Solutions
          • SCADA and Telemetry Blog
        • Power Distribution IEC
          • Power Events & Webinars
          • Power Foundations Blog
        • Power Distribution NEMA
          • NEMA Power Foundations Blog
        • Power Distribution Softwares
          • EcoStruxure Power Design Blog
          • SEE Electrical Building+ Blog
        • Solutions for your Business
          • Solutions for Food & Beverage Blog
          • Solutions for Healthcare Blog
          • Solutions for Retail Blog
        • Community experts & publishers
          • Publishers Community
    • By Segment
        • Food & Beverage
          • Solutions for Food & Beverage Blog
        • Healthcare
          • Solutions for Healthcare Blog
        • Retail
          • Solutions for Retail Blog
      • Industrial Automation
        • Industrial Edge Computing Blog
        • Industry 4.0 Blog
        • Industrie du Futur France
      • SCADA & Telemetry Solutions
        • SCADA and Telemetry Blog
      • Power Distribution IEC
        • Power Events & Webinars
        • Power Foundations Blog
      • Power Distribution NEMA
        • NEMA Power Foundations Blog
      • Power Distribution Softwares
        • EcoStruxure Power Design Blog
        • SEE Electrical Building+ Blog
      • Solutions for your Business
        • Solutions for Food & Beverage Blog
        • Solutions for Healthcare Blog
        • Solutions for Retail Blog
      • Community experts & publishers
        • Publishers Community
      • Food & Beverage
        • Solutions for Food & Beverage Blog
      • Healthcare
        • Solutions for Healthcare Blog
      • Retail
        • Solutions for Retail Blog
  • Ideas
        • Industrial Automation
          • Modicon Ideas & new features
        • SCADA & Telemetry Solutions
          • Geo SCADA Expert Ideas
          • SCADA and Telemetry Devices Ideas
  • Knowledge Center
    • Building Automation Knowledge Base
    • Industrial Automation Knowledge Base
    • Industrial Automation How-to videos
    • SCADA & Telemetry Solutions Knowledge Base
    • Digital E-books
    • Success Stories Corner
    • Power Talks
  • Events & Webinars
    • Innovation Talks
    • Innovation Summit
    • Let's Exchange Series
    • Technology Partners
  • Support
    • Ask Exchange
    • Leaderboard
    • Our Community Guidelines
    • Community User Guide
    • How-To & Best Practices
    • More
Join Now
How can we help?
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: 
51132members
Join Now
245263posts
Join Now

[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
Back to Geo SCADA Expert Forum
sbeadle
Sisko sbeadle Sisko
Sisko
‎2019-10-26 02:59 AM
0 Likes
0
327
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content
‎2019-10-26 02:59 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
  • SCADA
Share
  • All forum topics
  • Previous Topic
  • Next Topic
Related Products
Schneider Electric
EcoStruxure™ Geo SCADA Expert
Top Experts
User Count
sbeadle
Sisko sbeadle Sisko
188
BevanWeiss
Sisko BevanWeiss
52
AdamWoodland
Lt. Commander AdamWoodland Lt. Commander
16
JChamberlain
Lieutenant JChamberlain Lieutenant
16
AndrewScott
Lieutenant AndrewScott
15
See More Top Experts
Find a Service Provider
Find a certified partner to help you address your integration, installation, maintenance and project needs.
View all Providers
Support

Have a question? Please contact us with details, and we will respond.

Contact Us
FAQ

Look through existing questions to find popular answers.

Learn More
About

Want to know more about Exchange and its possibilities?

Learn More

Full access is just steps away!

Join Exchange for FREE and get unlimited access to our global community of experts.

Connect with Peers & Experts

Discuss challenges in energy and automation with 30,000+ experts and peers.

Get Support in Our Knowledge Base

Find answers in 10,000+ support articles to help solve your product and business challenges.

Ask Questions. Give Solutions

Find peer based solutions to your questions. Provide answers for fellow community members!

Register today for FREE

Register Now

Already have an account?Log in

About Us FAQ Terms & Conditions Privacy Notice Change your cookie settings
©2020, Schneider Electric