Hour meter programming in Rockwell

"drbitboy;
Really? Which PLCs provide an hour-meter built-in?"




Siemens
S7 has an RTM instruction

When are you going to teach yourself how to program that S71200 you bought from Fleabay? :)
 
Last edited:
"drbitboy;
Really? Which PLCs provide an hour-meter built-in?"




Siemens
S7 has an RTM instruction

When are you going to teach yourself how to program that S71200 you bought from Fleabay? :)

PS It turns out CLX has one as well, and it's better because more general than just an hour meter.


Regarding S7: Well, you asked...


I'm working on it. It's slow, oh my goodness, how long it took me to write a simple test program with two timers because I couldn't suss out the tag scheme and could not for the life of me add a second timer tag, oh dear. 🍻


And the unbelievably poor real estate management of the TIA make anemic RSLogix seem almost preferable by comparison; how does anyone use TIA with fewer than two or four large monitors?


I mean, I've written software and I understand the positive correlation between powerful interfaces and complex interfaces, but I didn't realize it was an expnential!
 
Last edited:
I use a totalizer with the Timebase input set to the units you need: Seconds, Min or Hours. Like Ken said they can be overwritten so may not be suitable if you need a real totalizer number that cant be manipulated.
Hour meter.jpg
 
I always use Mike Lamond's method, and have for years.
Every program I write, I start by dropping in a Utility Routine to generate a global, base one second pulse off of the WallClockTime. In each separate Task, I also one-shot that to a task-local one second time pulse.


In Utility, I also generate a string version of the time/date (05/20/20 - 15:18), an integer for Day of the Week, and convert the WallClockTime into UTC Time (based in seconds)
 
The number of RTM timers in S7 are limited and depend on the CPU.
But even using timers and counters is not practical when you're logging hundreds of device with potential of 50-80 running at the same time.

I use one lonely timer and a whole lot of code to log start and stop time of each device and keep track of the sum. Methods/sub functions to add devices, querry device data and all that jazz. It's convoluted but very very cheap on resources.
 
All timers are bound to the same clock. In reality there are no separate timers. There is only a single timer no matter how many you declare in your program. Any and all timers rely on the same clock. It is just a simple compare used to determine when timer is "done" or what state the timer is in. Very very simple math. Having many timers rather than a few is not in any way more "stressful" on the processor. Internally, it is just a move and compare operation.
 
All timers are bound to the same clock. In reality there are no separate timers. There is only a single timer no matter how many you declare in your program. Any and all timers rely on the same clock. It is just a simple compare used to determine when timer is "done" or what state the timer is in. Very very simple math. Having many timers rather than a few is not in any way more "stressful" on the processor. Internally, it is just a move and compare operation.


Siemens RTM instruction for S7-1200 have a limit of 10 instances/counters. The reason is not very clear in the documentation but I am guessing they use hardware counters.


Specifically Siemens IEC_TON (SFB4) timers add considerably to load and work memory and don't seem to impact cycle scan that much.
The difference between 1 timer and 100 timers is over 60KB (Over 1.5% of available load memory) and over 50KB of work memory (over 4% of available work memory).
These numbers are to satisfy a very small requirement of a much larger program and if I design programs the same way I better have unlimited money to spend on hardware.


The older Siemens S5 had much smaller footprint.


What about Rockwell, is it very different?
 
Yeah, but he is from India, you mean 1135.20 Indian Rupees :)

I have total 48 equipments in our plant. I need to calculate the BAG maker total running hours through this interlock with power flux 527 . While this inverter running I can able to know the running hours of bag maker also . So that I will plan Preventative maintenance chart for this equipment.

Installing hour meter is simple only. But total for 48 equipment comparatively high . Due to that I planned for existing resources
 
Installing hour meter is simple only. But total for 48 equipment comparatively high . Due to that I planned for existing resources


There are other considerations, below, but those still might not change the decision to put this functionality this in the PLC.



  1. How does your time to write the software compare to the cost of 48 hour-meters? Although not relevant, I am fairly certain that the collective spare time spent on this thread alone has, metaphorically speaking, already paid for the 48 hour meters, plus a full set of spares, and then some. Of course that has to be weighed against installing 48 devices.
  2. PLCs memory is volatile; these data would be better accumulated and/or stored, elsewhere in a "cloud," spreadsheet, database, etc. It's a SCADA function, not a PLC function.
 
Last edited:
This is why I like Codesys based PLCs where you can have so many option for storing and manipulating data.
In open automation library OSCAT there is a ready to use function block called OnTime which implements an hour meter function.
The easiest solution is to save data in Persistent type variables which are not re-initialized even during program download.
Then are many other options like saving recorded hours in txt files in local plc flash or on a ftp server or even in cloud using MQTT and other protocols.

You could install a Codesys based PLC like Schneider's M241 and DI modules with total 48 digital inputs for each of your devices and program it to record the working hours. Should be much more cost effecting than having to buy and install 48 hardware counters.
You could also use AdvancedHMI to communicate with the PLC through Modbus TCP and log the data in to text files on your PC.
 
There are other considerations, below, but those still might not change the decision to put this functionality this in the PLC.



  1. How does your time to write the software compare to the cost of 48 hour-meters? Although not relevant, I am fairly certain that the collective spare time spent on this thread alone has, metaphorically speaking, already paid for the 48 hour meters, plus a full set of spares, and then some. Of course that has to be weighed against installing 48 devices.
  2. PLCs memory is volatile; these data would be better accumulated and/or stored, elsewhere in a "cloud," spreadsheet, database, etc. It's a SCADA function, not a PLC function.



Thanks. Every one posted on this thread. I don't have not much knowledge in PLC programming. But now somehow im learning through such like new ideas.

So could you kindly summarize same like with picture. Is the counter value will loss when PLC is off condition.
 
I use a totalizer with the Timebase input set to the units you need: Seconds, Min or Hours. Like Ken said they can be overwritten so may not be suitable if you need a real totalizer number that cant be manipulated.
View attachment 54421


Check out the "Data Preserved Download Tool". I haven't had need to use it myself, but it is supposed to allow you to download the entire program with the current data.

I suspect it uploads the tag values first into the offline file, then downloads the new program with those tags and values.

If that's what it does, make sure nothing is actually "running" that could change the values before the download starts ...
 

Similar Topics

B
Does anybody know a way to program in ti505 logic for a hour meter on a pump? We are doing studys on pumps (how long they run for PM's) I was just...
Replies
1
Views
3,959
Hi team, I am setting up my first E200 overload unit. I came across parameter 205 StartsPerHour. The default setting is 2. I presume, the motor...
Replies
2
Views
469
Hello all, I have been tasked with moving a mechanical run hour meter of a pump motor to a panelview. I have a slc 5/04 and an allen bradley PV...
Replies
6
Views
2,655
I am trying to record the run times and on-load times of 3 pumps in TIA Portal as hour meters. I want to monitor these on my HMI. I'm not familiar...
Replies
10
Views
8,561
Hi, I am using GE Fanuc PLC to calculate the Flow rate in cubic meter per hour from pulses output. i.e. Pulses per second. But the method i used...
Replies
10
Views
12,649
Back
Top Bottom