Timer ?

fcflores

Member
Join Date
May 2006
Location
ohio
Posts
11
I have a project where I need to do a process after 24 hours of operation. One thing that im stuck on is; I need to do adjust my time when I loose power to the processor. And example would be: We accumulated 20 hours in the program and I lost power for one hour. Once power is restored; advance my timer to 21 hours and continue timing.



Im currently using a Micrologix 1100 for this project
 
Something like this. The PLC should be on a UPS.

24-HOUR_PROCESS.jpg
 
I don't know what you mean by "time strap". Rung 0 records the time that the process starts, and Rung 1 records the time that the process stops.

The sample program is a method to calculate the total running time of a process or other condition. Once you know the total time, you can use it however you need. Using plain old timers may be easier for you to understand. You can cascade three timers together to get a 24-hour time period.
 
Last edited:
Try something like this:

When the process starts take a snapshot of the current time of day - ie, day, hour, min, sec. Then add one to the day (account for end of week or end of month roll over depending on whether you use the day of the week or the day of the month.) Now when the real time becomes equal to that value, trigger your event. Since the RTC keeps time even when power is off, you don't need a UPS or any special logic to advance a timer - though obviously your PLC will have to be running when the 24 hours expires or it will miss the event.

The attahced file has three examples of how you might do it.

Example 1 uses a CPW instruction to copy values from the real time clock and triggers using the day of the month with roll over detection for the last day of the month. Leap years are not accounted for.

Example 2 uses the day of the week with roll over detection for Saturday-Sunday, and MOV instructions to individually move values from the real time clock.

Example 3 uses the day of the week also but takes its values from the S file. Be warned that in the MicroLogix family S file date and time words are not updated while you are online with RSLogix 500.

Potential pitfall: Because the time is continuously changing you will want to write your event trigger to be a single shot and use it to start and latch in whatever it is doing. If you use GEQ statements in rung 1 of the examples you could get multiple triggers over an hour or a day.

(disclaimer: I have not tested these examples)
 
Last edited:
Thank you, Alaric

I have implemented example 2 and I am going to test it today. One last request; how would I make the program so that my desired time can be adjustable? Lets say 20 hrs. I have an idea, but your input would be greatly appreciated.
 
Last edited:
You could do something like this. Note that this example will only work for event delay time periods of less than one week (168 hours). If you want to use a longer time period you will have to use the day of the month - RTC:0.DAY - and check for month roll over, including December to January roll over (handle that the same way Saturday-Sunday rollover is handled). If you limit it to 1 week I would do some range error checking on N7:5, you might run into big process problems otherwise.

Personally, I would only jump thru this kind of convolution only if you must keep the time period constant even if the PLC is not operating for a period of time during the delay. Otherwise, in the ML1100 I would build a 32 bit timer. See: http://forums.mrplc.com/index.php?showtopic=10483

What happens to the process if the PLC is not operating when the 24 hour delay expires?
 
Thank you, Alaric
The process will not be affected drastically due to the fact the oven heaters will not be on. This project main goal is to alert the operator that the product in the oven needs pulled out. Note I will never excede 24 hours.
 
Alaric,

Program works great!!!!
Being new to advanced programming; how can I store the time before loosing power and compare it after power up. Im looking to monitor down time when the power goes off.

Thanks again!!!
 
To do that you would need to have a rung that continuously updates the time to a storage place. Then use the first scan bit S:1/15 to trigger a comparrison of the stored values to the current RTC values, compute downtime, and store the downtime.
 

Similar Topics

I have some logic that I have written within a 5380 series controller that tracks the time an event is started, while the event is running an RTO...
Replies
2
Views
93
Hi all, I have a simple question that I have overcomplicated and gotten stuck on. I have a variable, we can call it "light" that I need to stay...
Replies
4
Views
313
Question to anyone with ideas about my thoughts on upgrading a very vintage timer, which is being used to switch between 2 5hp domestic water...
Replies
14
Views
437
why my timer only executes once here? After first time i use it, ET stays at 0ms all the time. It is in FB
Replies
5
Views
314
Good morning guys, I'm searching for a Timer relay which accomplishes the "flasher" condition in the photo attached, however, I need the ability...
Replies
2
Views
556
Back
Top Bottom