Hour Meter

BoxerBrats

Member
Join Date
Jan 2005
Location
Chico California
Posts
187
On my project, trying to put in some bells and whistles on the touch screen. One of the things I am trying is putting in a hour meter to show how long each lines run for the season. But for some reason it is not working right, it shows basically seconds... I uploaded a sample of the code so if someone can see where my mistake is, any help would be appreciated.
 
I'm not familar with the PLC your using but most timer instrution can have there time base changed. (ie. 1.0 sec, 0.1 secs, .01 secs.)just quessing.Or maybe a preset error?
 
Last edited:
What you have should work. T356 will expire once per hour (note your comment is wrong), incrementing V420. A common mistake is to forget that TMRA instructions use TWO V-memory locations. IOW, T356 will ALSO use T357, so make sure you don't use T357 elsewhere. I have a feeling that's the problem, but if not, check that V420 isn't being overwritten elsewhere in the program.

EDIT: After looking a second time, I realize your preset is 60000. That's 6000 seconds, which is NOT one hour, it's 100 minutes. Your preset should be 36000 to expire in one hour.

Side note: If you reverse the addition, you won't need V500 for your constant. LD K1, ADD V420, OUT V420 does the same thing without having to preload a "1" in V500.

Let us know what you find.

🍻

-Eric
 
Last edited:
Sorry my mistake the preset should have been 600 so it should equell 1 minute so every time it cycles it adds one to the minute total. Then when this total reaches 60 it adds one to the hour total, and the minute total resets to zero.

The 6000 was something I put in earlier today experimitting with he problem. Hopefully I didnt cause to much confusion

I also forgpt to metion I am using AD 450 plc, with EZTouch screen
 
Last edited:
A different approach...

Since this is just a simple hours:minutes meter, you could instead use a one-shot of the 1 second clock bit (SP3) to increment the minutes V-memory location. When it reaches 60, increment the hours location, and reset the minutes.

| RUN SP3 +-------+
|------] [-----]^[---------| INC | INCREMENT
| | V0420 | MINUTES
| +-------+
| V0420 > K60 +-------+
|------] [------------+----| INC | INCREMENT
| | V0421 | HOURS
| +-------+
| +-------+
+----| LD |
| | K0 |
| +-------+
| +-------+
+----| OUT | RESET
| V0420 | MINUTES
+-------+

On second thought, your retentive timer is probably better for this application. SP3 triggers once each minute, regardless of the state of your RUN contact, so you could be off by ± 59 seconds each run cycle... :(

🍻

-Eric

P.S. I didn't just go ahead and delete this post, because it may help you (or others) with different applications... :confused:
 
Boxer a question and possible answer as I too am not familiar with the Plc type you use. Does it just display up to 60 seconds then go back to Zero if yes then put your C7 reset to the end of the program and see if that works
 
Take a look at this code it should help. This is what we've been using for years on the AD PLCs (230, 240, 250, 260, and 06) as a hour meter for our heaters. It should be easy to modify if you want minutes as well (one more counter).
 
Go back to the basics. Use counters to keep track of the minutes and hours, it will speed up your logic and make your code easier to read. Depending on how you want to display the information and how much information you want to keep track of will determine how many counters you need to use.

You need to use a TMRA and it's preset value will be based on the time measurement you want to display. If you want to track minutes the preset value will be K600, if you want to keep track of 1/10ths of an hour the preset value will be K3600.

For this example lets say you want to keep track of hours and minutes, and the max hours you will have is 9999.

Rung 1 - Hour counter. Incremented by Minute counter. Preset 9999.

Rung 2 - Minute counter. Incremented by Minute timer (TMRA). Preset 60. Reset by Minute counter.

Rung 3 - Minute timer. Enabled by Machine Running. Preset K600. Reset by Minute timer.

You can use Timer and Counter status bits to reset the timer or counter. So in your pfd, you have you TRMA status bit enable C7, and then you use C7 to reset the TRMA. You don't need to do this, you can use the TRMA status bit to reset itself.

The reason you can do this is because the counter will not be reset during the scan that the status bit becomes active, it will reset the counter on the next scan.
 
Eric Nelson said:
Since this is just a simple hours:minutes meter, you could instead use a one-shot of the 1 second clock bit (SP3) to increment the minutes V-memory location. When it reaches 60, increment the hours location, and reset the minutes.

| RUN SP3 +-------+
|------] [-----]^[---------| INC | INCREMENT
| | V0420 | MINUTES
| +-------+
| V0420 > K60 +-------+
|------] [------------+----| INC | INCREMENT
| | V0421 | HOURS
| +-------+
| +-------+
+----| LD |
| | K0 |
| +-------+
| +-------+
+----| OUT | RESET
| V0420 | MINUTES
+-------+




Ok i tried the logic above... think I did something wrong with the sp3 contact it cycles every minute, but it also stay on for a minute. did I use the wrong SP contact?

 
BoxerBrats said:
think I did something wrong with the sp3 contact it cycles every minute, but it also stay on for a minute. did I use the wrong SP contact?
SP3 is ON for 30 seconds, then OFF for 30 seconds, over and over. This is why I used a 'positive differential contact', which will turn on for 1 scan only each time SP3 turns on (transitions from OFF to ON). I should have elaborated on the meaning of the ^ I added to the contact.

🍻

-Eric
 
Eric Nelson said:
SP3 is ON for 30 seconds, then OFF for 30 seconds, over and over. This is why I used a 'positive differential contact', which will turn on for 1 scan only each time SP3 turns on (transitions from OFF to ON). I should have elaborated on the meaning of the ^ I added to the contact.

🍻

-Eric


not famaliar with 'positive diffrential contact' when i use one and use SP3 says a invalid element. sure something I am doing wrong... but still not sure what this does
 
BoxerBrats said:
not famaliar with 'positive diffrential contact' when i use one and use SP3 says a invalid element. sure something I am doing wrong... but still not sure what this does
Maybe your processor doesn't have this instruction? If so, then simply use a one-shot (PD) coil.

| SP3 C10
|------] [-------------------( PD )
|
| RUN C10 +-------+
|------] [-----] [---------| INC | INCREMENT
| | V0420 | MINUTES
| +-------+
| V0420 > K60 +-------+
|------] [------------+----| INC | INCREMENT
| | V0421 | HOURS
| +-------+
| +-------+
+----| LD |
| | K0 |
| +-------+
| +-------+
+----| OUT | RESET
| V0420 | MINUTES
+-------+


You can use any free bit you have in place of C10.

🍻

-Eric
 
You can't use the SP bits on differential contacts. So you would have to do it as Eric has pointed out by using a PD coil.

But, doing the logic like this will not be accurate, as Eric noted in his first post. To be accurate you will need to use a TRMA timer.
 
for some reason when I use the TRMA timers, instaed of getting the 0.1 time base it seems to go somewhere around 0.001 I have checked to make sure they are not TRMAF.

I have loaded the hour meter I am using now, seems to be working good, but seems to not be 100% accurate noticed over a 20 minute period, it was losing about 4 minutes.

I also included my original logic using the TRMA timers

here is also another odd question seems like wired things have been happing with my program. For instance when i try using the regester for the INC box I origianlly tried using V0425 but when I did it after I loaded onto the PLC, on rung #2 with the greater than statement it would change to '3888 is greater than K3600'.

Another really odd thing the PLC was up and line was running just fine, then at home made some minor changes with the hour meters. Then when I loaded the program all my E-Stop contacts where N/O instead of N/C. I am positive that I never messed with these, unless I been getting up in the middle of the night and programming in my sleep.

Ever hear of things just changing, or do I have gremlins.
 

Similar Topics

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
492
Hi all , Good day to everyone. Can any one suggest how to program for hour meter In Rockwell L72 processors. I’m using power flux 527 in...
Replies
64
Views
20,069
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,663
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,609
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,744
Back
Top Bottom