Hour meter programming in Rockwell

That tool is a piece of junk. Don't waste time.

There speaks someone who has tried it, I don't know, never used it.

But let's face it, if you have to make modifications that will require a download, just "Go Online", "Save" (You will get a prompt that tag values may have changed... say yes to upload and save them), "Go Offline" , do your mods as quickly as possible, then "Go Online" and "Download".

If nothing was running while you did your mods, your "Run-Hours", however you have derived them, will be correct. and if some background process was running motors/fans etc., a few minutes isn't gonna be a deal-breaker in terms of hours run.
 
I preserve an uploaded version and transcribe relevant values to new program. I've never been a fan of AB's all or nothing at all program downloads for this very reason. The preserved data tool looks like it was the semester project of a 10th grade automation programming student. Conceptually useful but practically useless in my experience. Name your variables that need to be preserved so you can find them later is the best suggestion I can give. AB should now and always should have offered the ability to download logic only. They don't and no doubt never will. AD does...no need to worry about changing volatile memory on a DL06.
 
I want to throw out one more idea. We reset when we swap a pump and I like to know when that happens. I like to see hourmeters to .1 hour. If I tried to just add .1, we would get odd decimals. This keeps floating point to a single decimal place. It’s only good for about a million hours though.

8ED6C91B-4D78-4B15-B91A-DBE1B30E467A.jpeg
 
I like to simplify: I think you can eliminate one of the ONe-Shots and change the counter preset from 360 to 180.

You’re right. That could have been simpler. Is a program ever really done? After I posted that I was looking at it wondering “Why didn’t I make a one second pulse in that system?” I already created a pulse and converted all the hour meters. I have a todo for a September shutdown to delete the old ONS bits from the UDT when I can do a download.
 
I like to simplify: I think you can eliminate one of the ONe-Shots and change the counter preset from 360 to 180.

I like to simplify also, so if you did that, you could get rid of BOTH of the one-shots ....
 
I want to throw out one more idea. We reset when we swap a pump and I like to know when that happens. I like to see hourmeters to .1 hour. If I tried to just add .1, we would get odd decimals. This keeps floating point to a single decimal place. It’s only good for about a million hours though.

Here's a little "trick".... You are presumably GSV'ing the LocalDateTime from the WallClock into a DINT[7] array.

If you created a UDT, called something like "DateTime" with 7 DINT members named ...

Year
Month
Day
Hour
Minute
Seconds
uSeconds

... then create your LocalDateTime tag as data-type "DateTime", then you can GSV to LocalDateTime.Year. So long as the UDT matches in SIZE to a DINT[7] array, the GSV is happy with it.

Your LocalDateTime[5] then becomes LocalDateTime.Seconds, which makes it easier, and more immediate, to understand. I had to count through on my fingers to work out what word 5 was of the LocalDateTime data.

I also use this method for Controller Recoverable Fault information, module fault information etc. I build my UDTs exactly to the structures defined in the documentation, and then I don't have to worry about splitting DINTs into two INTs (as you would need to for Fault Type and Code for example), the GSV just overlays the data into the appropriately named members of the destination tags.
 
I want to throw out one more idea. We reset when we swap a pump and I like to know when that happens. I like to see hourmeters to .1 hour. If I tried to just add .1, we would get odd decimals. This keeps floating point to a single decimal place. It’s only good for about a million hours though.

Hi

I tried a same program in one of my machine but if we removed one shots timer not working. Then I proceed with same two one shots as same as copy your program and preset as 180, once the timer elapsed his time its done bit not came . Pump running hours not changing. . Could you explain whether I did any mistake .
 
Hi

I tried a same program in one of my machine but if we removed one shots timer not working. Then I proceed with same two one shots as same as copy your program and preset as 180, once the timer elapsed his time its done bit not came . Pump running hours not changing. . Could you explain whether I did any mistake .




No explanation is likely without seeing the code.
 
If you are duplicating the example I posted, use a cleaner version here. Almost immediately after posting that I didn't like it. That was where I left it a couple years ago.


I made a one second pulse in the main routine and cleaned up the hourmeters. Also while editing I used Daba's suggestion for the wallclock UDT. It does make it easier for a UK tech to notice the backwards format. I'm a huge fan of UDTs. I even made a three bit one for the pulse. You will have to rework tags as needed to match your data type usage.

The reset bit is from a password protected SET action button on a HMI.

WallclockGSV.JPG Hourmeter.JPG DateTime.JPG
 
Last edited:
I like to simplify also, so if you did that, you could get rid of BOTH of the one-shots ....



whoops, missed that, yes, of course.


heh, we are both wrong: the reset of the 180s counter will reset .CU as well, so that counter will increment to 1 on the next scan, instead of waiting for the next rising edge of the RTC seconds.


See the example below, which demonstrates two minute-meters.


Caveats

  • This is based on 5618's prototype here; he has since provided better examples.
    • @5618: I apologize in advance for giving your previous code an extended life; apparently it is going to hang around (like a stale **** ; we can only hope mine will have similar strength and staying power ;)).
    • To be clear and explicit to anyone who has not yet fallen asleep:
      • 5618's more recent example is what you should follow;
      • This post is about my OCD-driven need to correct my mistake, which does not matter anymore.
  • This is MicroLogix 1100, and its RTC only updates every 2s
    • so the RTC:0.SEC/0 never changes
    • so I use RTC:9.SEC/1 instead, which changes every 2s
  • To make it run faster for visual observation, I wrote this to update a float, representing minutes instead of hours, by 0.2 i.e by 12 seconds.
    • Rung 0000
      • RTC:0.SEC/1 sends a rising edge to the CTU with C5:0 every 4s,
      • So the counter preset is 3 i.e. 4s/count x 3count => 12s
      • N.B. the Latch of C5:0.CU after the reset of C5:0.CU, to maintain the memory of the rising edge of RTC:0.SEC/1
    • Rung 0001
      • The ORed oneshots on the XIO and XIC send a rising edge to the CTR with C5:1 every 2s
      • So the counter preset is 6 i.e. 2s/count x 6count => 12s
      • N.B. MicroLogix 1100 does not allow an ONS instruction without a following output instruction, so the CTU on C5:1 is on both branches, instead of on the ORed result, as was done in the original example.
Other than those multiple, confusing, silly differences, it's exactly like 5618's original!

xxx.png
 
Last edited:
I think your linerErunning_hours is a DINT instead of Real. The code could be simpler to just count hours but I have a compulsion to see tenths of an hour.
 
I had two reasons for my original post. The example by dirtboy shows the joys of floating point addition. I originally tried that and couldn’t take the .000001 showing up. Muliply by 10, add 1, divide by 10 keeps that away, at least in Logix 5000 platforms. The other reason was to share the idea of recording the date when reset.

For something simple for whole hours, count to 3600 or 1800 if a two second pulse. Then just add 1 to a DINT.
 

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,960
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