Machine DownTime

raamakoti

Member
Join Date
Apr 2021
Location
home
Posts
20
I am trying to build a Machine Downtime within the PLC. I was thinking to capture system time but I got tripped on how to store downtime start and stop to find the difference. I have to develop this in Rockwell PLC
I would appreciate suggestions or pointers.
 
Last edited:
Welcome to the forum.

you did not mention the plc, plc 5, 500, 5000?
you also did not mention what the machine does.
MOST importantly,
get with maintenance, engineering, and management to determine WHAT IS CONSIDERED DOWNTIME!!!! i'm not yelling, just stressing the importance of determining what is considered downtime.
examples are, product change over, tooling issue, required maintenance, quality issue. get these answers before going forward and save some heartache.
we have a program that tracks non production time in a lot of these areas.
james
 
My two pennies, this is better suited for an HMI, assuming you have one. You can track and store in the PLC but you are just limited vs anything an HMI with a database has to offer.
 
Welcome to the forum.

you did not mention the plc, plc 5, 500, 5000?
you also did not mention what the machine does.
MOST importantly,
get with maintenance, engineering, and management to determine WHAT IS CONSIDERED DOWNTIME!!!! i'm not yelling, just stressing the importance of determining what is considered downtime.
examples are, product change over, tooling issue, required maintenance, quality issue. get these answers before going forward and save some heartache.
we have a program that tracks non production time in a lot of these areas.
james

Thank you James. Sorry this was my first post, I will include more details in future post.
This machine is a finished bottle conveyor. After applying the label to the bottle. There is a photoeye that keeps track of backlog. When the bottles are not moving the timer starts. after timer is done it shuts the conveyor down. I got handle upto this part.
Now when the conveyor stops and restarts that is the time the engineer is interested in. I am using studio 5000. The tooling, product changeover C&S etc are already being collected using Vorne OEE. We want to determine how many times the machine stopped because of backlog and how long each stop lasted.
 
when the photocell timer is done,
increment a counter.
the easy part is to start a 1 second timer and increment a counter every time it times out. set the counter for 100,000 - 84,600 sends in a day
or
start a 1 second timer that increments a counter - preset 60 for 60 seconds
when the 60 seconds counter is done, increment a second counter for minutes and reset the 60 second counter.
repeat this process for hours.
now the tricky part.
you will need an index to keep up with the number of seconds each time the conveyor stops.
when the conveyor starts, store the elapsed time in the index register and reset the seconds counter. increment your index.
i'm not sure ho you will get the data to those that need it.
you will also need a way to reset the system at the end of the dy, week, month.....
james
 
KISS.

Record Wallclock time @ start of downtime, record wallclock time @ end of downtime.

Compare to get the difference, some great Date Time tools in the sample library, one specifically does what you want.

https://www.rockwellautomation.com/...ads/application-code-library/sample-code.html
+1 for KISS.

At a bare minimum, every time the conveyor starts or stops, get the current value of WallClockTime (cf. this link), and push it on into a FIFO array, and OTE its low bit to the same state as the conveyor's RUN bit (the low bit is microseconds, so accuracy will not be significantly affected).

An approach not quite a simple would create a UDT to time-tag each change of state of the conveyor run bit.

Using the search term LINT at @janner-10's URL above should get you to this link; which has links to download tools (AOIs, I would assume) for doing math with long integers.

You will spend more time fiddling about with converting the data in that FIFO to various output formats (don't forget daylight savings time) than with the code to do basic data gathering into the FIFO. Possibly the best way to handle it would be to upload the FIFO data to another machine, where calculations are easier to code e.g. a spreadsheet with VBA.


TL;DR


WallClockTime can be a 64-bit integer, LINT, or two 32-integers, DINTs, in an array. It represents elapsed microseconds since the epoch 1970-JAN-01 00:00:00.000000.

If you do everything in the PLC, make sure any floating-point calculations use LREALs.
 
RTO and a simple counter and mov the difference of the .acc into an array each event. Reset every 24 hours or whenever you want to. I dont know why people complicate this stuff.
 
RTO and a simple counter and mov the difference of the .acc into an array each event. Reset every 24 hours or whenever you want to. I dont know why people complicate this stuff.


Like this?

BST LES ctl.POS 1 OTU ctl.EN NXB XIO run BND FFL 0 real_array[0] ctl Length 0 XIC ctl.DN FFU popped real_array[0] ctl Length 0

XIC run MUL timer.acc 0.001 real_array[ctl.POS-1] TON timer 999999999 0


N.B. array has one more element than Length.


The TON eliminates calculating the difference.

ctl.POS (less 1) eliminates the need for a counter.
 
Like this?

BST LES ctl.POS 1 OTU ctl.EN NXB XIO run BND FFL 0 real_array[0] ctl Length 0 XIC ctl.DN FFU popped real_array[0] ctl Length 0

XIC run MUL timer.acc 0.001 real_array[ctl.POS-1] TON timer 999999999 0


N.B. array has one more element than Length.


The TON eliminates calculating the difference.

ctl.POS (less 1) eliminates the need for a counter.


Something similar yes.

I leave the date and timestamps to database software, unless OP really wants to concat it as a string.

What I do is indirect address the counter value as the array position, use the RTO as a downtime totalizer for overall downtime. I use the /EN on the RTO to start a TON and OSR the RTO /EN to increment the counter by one, and OSF the /TT of the TON to MOV the /ACC of the TON to the array position.

I honestly couldn't think of a simpler way to do it.
 
On another note, I realize that not all versions support OSF / OSR so maybe this isn't the best way, but it's a method that even the newest of greenhorns can grasp.

You've seen the look in their eyes when you start talking bitshifting and file filling, especially bitwise operations.. I remember those days myself.
 
You've seen the look in their eyes when you start talking bitshifting and file filling, especially bitwise operations ...

Everybody who programs would really benefit from a course in machine code or even assembler. The choice of CPU hardly matters, just knowing the typical atomic instructions/operations makers everything else so simple.

And yeah, not understanding binary is just so limiting.
 
+1 for KISS.

At a bare minimum, every time the conveyor starts or stops, get the current value of WallClockTime (cf. this link), and push it on into a FIFO array, and OTE its low bit to the same state as the conveyor's RUN bit (the low bit is microseconds, so accuracy will not be significantly affected).

An approach not quite a simple would create a UDT to time-tag each change of state of the conveyor run bit.

Using the search term LINT at @janner-10's URL above should get you to this link; which has links to download tools (AOIs, I would assume) for doing math with long integers.

You will spend more time fiddling about with converting the data in that FIFO to various output formats (don't forget daylight savings time) than with the code to do basic data gathering into the FIFO. Possibly the best way to handle it would be to upload the FIFO data to another machine, where calculations are easier to code e.g. a spreadsheet with VBA.


TL;DR


WallClockTime can be a 64-bit integer, LINT, or two 32-integers, DINTs, in an array. It represents elapsed microseconds since the epoch 1970-JAN-01 00:00:00.000000.

If you do everything in the PLC, make sure any floating-point calculations use LREALs.

Would it be easier just a you Timer, Counter and DateTime three tags? When it stops, Timer starts to time the duration, and count 1; when it stops, Timer stops and copy timer ACC, Counter counts and current datetime to there FIFO. You can even copy all these there tag to excel. You do not even need FIFO. IF you have a RSLinx Class, you can use python to write a simple program run in the backgroupd of your pc to populate the value to a csv excel file. Python can auto create and populate values.
 

Similar Topics

Good Morning , Yesterday we had some downtime due to some communication problems with remote Ethernet I/O. I am still a fan of hardwiring...
Replies
9
Views
3,386
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,840
Hello Everybody Anybody knows where I can get this version of SoMachine? The new machine expert version won't open my project saying there is a...
Replies
0
Views
39
Hello, As part of our project, we are using an M241 controller. This controller interfaces with an industrial computer and a router via a switch...
Replies
2
Views
105
I'm getting frustrated creating arrays of variables in Machine edition. I need to make 2 variable arrays that are 102x2 in size, with varying...
Replies
3
Views
105
Back
Top Bottom