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

We Value Your Feedback!
Could you please spare a few minutes to share your thoughts on Cloud Connected vs On-Premise Services. Your feedback can help us shape the future of services.
Learn more about the survey or Click here to Launch the survey
Schneider Electric Services Innovation Team!

Wait (Sleep) in Structured Text

Geo SCADA Knowledge Base

Access vast amounts of technical know-how and pro tips from our community of Geo SCADA experts.

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
  • Knowledge Center
  • Geo SCADA Knowledge Base
  • Wait (Sleep) in Structured Text
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 Labels
Top Labels
  • Alphabetical
  • database 32
  • Web Server and Client 31
  • WebX 19
  • Request Form 18
  • Lists, Events & Alarms 16
  • ViewX 15
  • Application Programming 12
  • Setup 12
  • Telemetry 8
  • Events & Alarms 7
  • Lists 7
  • Mimic Graphics 7
  • Downloads 6
  • Support 5
  • IoT 5
  • SCADA 5
  • Geo SCADA Expert 5
  • Drivers and Communications 4
  • Security 4
  • DNP 3 3
  • IEC 61131-3 Logic 3
  • Trends and Historian 2
  • Virtual ViewX 2
  • Geo Scada 1
  • ClearSCADA 1
  • Templates and Instances 1
  • Releases 1
  • Maps and GIS 1
  • Mobile 1
  • Architectures 1
  • Tools & Resources 1
  • Privacy Policy 1
  • OPC-UA 1
  • Previous
  • 1 of 4
  • Next
Latest Blog Posts
  • OPC UA - Driver and Server
  • Requirements for Generating a Valid OPC UA Server Certificate
  • Load Events Using LoadRecord and LoadRecords
  • Geo SCADA Embedded Component Licenses
  • Geo SCADA 2023 Known Issues
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
Anonymous user
Not applicable
‎2021-06-09 06:11 PM
0 Likes
0
5931
  • Bookmark
  • Subscribe
  • Email to a Friend
  • Printer Friendly Page
  • Report Inappropriate Content

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

‎2021-06-09 06:11 PM

Wait (Sleep) in Structured Text

Originally published on Geo SCADA Knowledge Base by Anonymous user | June 10, 2021 03:11 AM

📖 Home  Back  
In structured text, there is no wait, sleep or pause function. You could do while loops to delay the code, however that just locks the logic thread for an extended time (which is bad

There is a simple way to introduce a loop count into logic, however your program must be running on interval rather than on-input processed and the effective delay will be a multiple of the interval. E.g.:

PROGRAM CountTest 
VAR
Count AT %M(.Count.Value) : INT;
Action AT %M(.Action.CurrentState) : INT;
END_VAR

IF Count < 40 THEN
Count := Count + 1;
ELSIF Count = 40 THEN
Action := 1; (* Do whatever you need to do *)
Count := 999; (* This sets the count to a "useless" value. To restart the count set it back to 0 in the database *)
END_IF;
END_PROGRAM

 

The above code, when the database item Count is set to 0, will count up to 40 (so will be 40 seconds with a 1 second execution interval) and then execute whatever action is required. Once done it sets the Count to something out of the way (999 in this case) ready to be set back to 0 the next time it's needed. The Count variable could be a Variable object defined in the database or an internal variable within the logic program defined as VAR RETAIN.

The above code is simple, however for some scenarios isn't very suitable. An alternative is at the start of the calculation to calculate a date and time when the "delay is up" and then re-execute the logic program on schedule and checking that the stored date and time is not less than NOW().

For more information on how logic executes refer to Logic Execution.

Using Sequential Function Charts (SFC) as an Alternative to Structured Text

Structured Text isn't the best solution for implementing sleep and wait functions in ClearSCADA's logic engine although is the most popular. SFC functionality can use transitions which can use time based delays similar to TON functions and branching depending on the various conditions and has a program flow much better suited to this kind of behaviour.

However, SFCs have similar limitations as FBDs and as such the current functionality available is less than provided by the more flexible and powerful ST. For example, SFCs cannot execute SQL statements against the database although could call the Execute method on a separate Structured Text program to do so. For more information on limitations see Comparison of Logic Languages.

Go: Home Back

Author

Biography

Anonymous user

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

  • Back to Blog
  • Newer Article
  • Older Article
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