Retentive Timers with no RTO command

afm

Member
Join Date
Aug 2023
Location
Tennessee
Posts
88
Hi all,

I have what is likely not a complex issue, but I am working in Automation Studio and want an accumulating/retentive timer when a variable is true. I do not believe there is any RTO available in AS, only TON, TOF, and TP. What is the best way to go about this or "create" an RTO?

I want to initialize the timer to 0 when a session begins (start button is pressed) and accumulate the total time that variable is true during a "session" (after Start is pressed until Stop is pressed) then store that value into an array that will stay there until a new session is begun (start pressed).
 
There are a few ways to do it. Most involve a counter and some form of repeating timer:

  • repeating TON timer
  • timing bits (e.g. 10Hz, 100Hz) in some PLC brands
  • There is a system tick in Automation Studio that could be used to drive a time-critical task such as this
  • calibrate a mean continuous program scan cycle time and increment a counter every scan cycle when the process should be accumulating run time.
Try searching this forum with the title of this thread.
 
Last edited:
A TON accumulates as long as the enabling logic is true. Create a bit that remains true as long as the session is in progress and use that bit to enable the TON. If you need to keep track of the duration of the session after the session has ended, in the rung before the TON, move the TON's accumulated value to a holding memory location as long as the accumulated value is greater than zero.
Here it is in ladder.
 
This is how I had went about it to time how long the light is on per session. Last thing to add is adding a "NewSession" variable; when a new session starts ("NewSession" is TRUE) I will move 0 to SaveEffort_ET which should do the trick I think. Thanks!

RTO.PNG
 
Last edited:
Have a self resetting 1 second TON.

When Timer.DN and your object is running CTU a counter called RTO_Object.

Or, have a RTO_Object integer and ADD 1 to it.

To reset the RTO simply MOV 0 to the integer or counter. ACC
 
Got it, The "EffortLightOn" variable can be on for smaller durations of time, so the 1 s resetting timer isn't catching every instance it goes true. So I will reduce the preset on the timer to catch the quicker flashes when the variable is true. Thanks!
 
I'm working in Automation studio which unfortunately doesn't have RTO blocks available :/ so Ive been trying to find a simple work around with a TON

I'm not familiar with Automation Studio, but doesn't it provide the developer with the option to create their own "block"?? The RTO that I posted "In Ladder" in the post above is one that I created. The code for it is shown in the post above it.
 
I don't know Automation Studio, but does it have a cycle time variable you could just increment? Or if you can create a timed interrupt, set the time for 1 second and increment a variable internally.
 
I don't know Automation Studio, but does it have a cycle time variable you could just increment? Or if you can create a timed interrupt, set the time for 1 second and increment a variable internally.

It does, I have briefly looked into doing a interrupt but have not found how to do it with AS, I like that thought so I'll try looking into it some more for future applications.

I'm not familiar with Automation Studio, but doesn't it provide the developer with the option to create their own "block"?? The RTO that I posted "In Ladder" in the post above is one that I created. The code for it is shown in the post above it.

This worked great, thanks! I haven't worked with AS very long and haven't made FB, so was looking for alternatives, instead of your direct approach, thanks.

I have run into one more issue. This RTO is tracking how long a user does work/effort in a session. Now that I have the ACC time from the RTO, lets call it "EffortTimer_MS", I converted it to seconds and then from TIME to INT type ("EffortTimeInt") and have this displaying on my HMI. I want to simply find how much the effort was done over the session (PercentEffort). Its simple enough to find, and if I live monitor each value I have a value for each, but the output of the compute block is 0. I'm assuming there is something glaringly obvious I am missing.

perfent effort.PNG
 

Similar Topics

I am posting to pick your brains. I am trying to create an automated maintenace notification system for equipment. The one obstacle I think I am...
Replies
5
Views
2,310
Anyone please Whats the different between the retentive and non-retentive timers
Replies
4
Views
11,595
Does anybody know the maximum number of retentive timers I can use in a Mitsubishi FX series? As far as I can tell it's 10(T246-T255). Problem is...
Replies
4
Views
5,811
Ok here is my problem. Below is a picture of the ladder i am using to control two timers. T13 is simply a looping timer that counts down from 60...
Replies
19
Views
10,249
Back
Top Bottom