Uptime / Downtime logic

protrac231

Member
Join Date
Dec 2009
Location
tampa
Posts
19
Does anyone have good example code for machine uptime / downtime tracking for AB 500, or RSlogix5000?

Im looking for something that can track well.

Thanks
 
Generate a pulse off of the real time clock every 'x' seconds.

If the machine is running, add 1 to an "Uptime" register every time you get your pulse. If it's stopped, add 1 to a "Downtime" register.

The Logix 5000 platform makes encapsulates a lot of this with the totalizer instruction.

Use integers, or DINT's, not reals to accumulate the times, and watch for rollovers.
 
Watch the green button rung. Count the on time and with a separate timer count the off time.
You can either write that out to a screen or access it every day to show the boss.
 
I have attached a PDF with a sample of some of the code I have used in the past. See what you think.:D

I have to admit to being curious how you have used that code in the past, AND achieved a correct result. To be frank, what you have posted will not work as you intend, hopefully what you have actually used does work.

Fundamentals : A-B counters do not reset themselves. so your seconds and minutes counters will continue counting past their targets, to +32767, then roll round to -32767, setting the overflow bit, and continuing counting round this circle ad infinitum, but the .DN bit never turns off again. Basically the instruction says "Because I have the .OV bit set, I must, by inference, be .DN

So after the first 60 seconds the seconds counter .DN bit comes on, and counts up the minutes counter. After that, nothing, the minutes counter will never get incremented again, and the seconds counter will hold ridiculous numbers most of the time.

What is actually needed is that each counter's .DN bit, as well as incrementing the next counter, is also used to reset the current counter.

If you are going to post code that you claim to have used successfully, then post a copy of the actual code, not what you thought it was. Your sample code could mislead people. Protrac231 asked for "a good example"....

Finally, is there any need to count downtime if you are taking figures over a set period, in your case 24 hours. What about if the machine is switched off, or a power failure occurs. Unless your PLC has a UPS, it will not accumulate these periods as downtime. Downtime can be easily calculated as Period-UpTime.
 
Last edited:
I have to admit to being curious how you have used that code in the past, AND achieved a correct result. To be frank, what you have posted will not work as you intend, hopefully what you have actually used does work.

Fundamentals : A-B counters do not reset themselves. so your seconds and minutes counters will continue counting past their targets, to +32767, then roll round to -32767, setting the overflow bit, and continuing counting round this circle ad infinitum, but the .DN bit never turns off again. Basically the instruction says "Because I have the .OV bit set, I must, by inference, be .DN

So after the first 60 seconds the seconds counter .DN bit comes on, and counts up the minutes counter. After that, nothing, the minutes counter will never get incremented again, and the seconds counter will hold ridiculous numbers most of the time.

What is actually needed is that each counter's .DN bit, as well as incrementing the next counter, is also used to reset the current counter.

If you are going to post code that you claim to have used successfully, then post a copy of the actual code, not what you thought it was. Your sample code could mislead people. Protrac231 asked for "a good example"....

Finally, is there any need to count downtime if you are taking figures over a set period, in your case 24 hours. What about if the machine is switched off, or a power failure occurs. Unless your PLC has a UPS, it will not accumulate these periods as downtime. Downtime can be easily calculated as Period-UpTime.

Something tells me that you didn't scroll down to page 2 before you started bashing his method.

EDIT: I take that back, I looked again and see what you mean!! Haha, I must be sleepy!
 
Last edited:
This is the complicated version. Elsewhere in the program, you have to define the states that you want to track. You also need a set of data files set up to hold utilization info by shift.

The logic (and HMI) hold two day's worth of data, hence the tags for "Yesterday" and "Today" that you see in the code. The HMI screens then display all this in tables that let the OPRs and mfg techs see how the machine is performing today, and how it performed yesterday.

Oh, and I never have actually used the calculated "Day of Year" for anything. But, I set it up and I've never bothered to remove the logic... "just in case," you know how it is!

If this looks useful to you, drop me a note and I can send you some more info.
 
Last edited:

Similar Topics

I am using studio 5000 and Compactlogix controllers. I am wanting to track uptime and downtime on 3 different machines. It is setup already but...
Replies
26
Views
9,782
hello! I have a little question about monitoring system uptime. So i want to monitor my activated coil uptime and reset the time indicator when...
Replies
1
Views
1,354
i have a plc5/80ethernet module.the issue i'm having is sometimes a 3rd party software we are using for mapping product stops communicating.they...
Replies
2
Views
1,499
Hello All, I have a need to monitor and record uptimes for both PLC & SCADA systems, this is to be used as a performance measure for our...
Replies
6
Views
3,178
This is the code for the Uptime Calc, that I asked help on a few days ago. Thanks to Allen Nelson for pointing me in the right direction. I...
Replies
0
Views
3,116
Back
Top Bottom