RSLogix500 Hour Meter?

S

Thread Starter

SW Engineering

I have a small program in a Micrologix 1200 that controls air compressors. I would like to add a "Total Run Hours" hour meter in to display the total run hours on each comp. on the Panelview. I would say a 100,000 total hour meter would be large enough.

How could this be done since you are limited by the total counts in a count up timer?
 
K

Kevin Schiiler

The way I would approach this would be to have a retentitive timer counting up to an hour or half hour if you cannot time up to an hour. If you can count to an hour have an output that pulses a retentitive counter to count up to the max number allowed. The output of the retentitive timer will also reset itself and count up another hour and so on. If you can only count to 32767 like in GE then if you hit the max hours you pulse another counter to start another count up to 32767 the output of the first counter will also reset itself like the first timer. To get a total hour number onto the panelview at this point just take the first counter hours and add them to the second counter number times your max count from the first counter in this example it would be 32767 times x. This might sound a little bit confusing but it really is only three rungs of logic. Hope this helps.

Kevin Schiiler
Electrical Technologist
 
T
There are a number of ways to do this. First off you will need to make sure your version of ML1200 supports floating point math (series C OS). If it does not, you can download a flash upgrade from ab.com that will let you upgrade the PLC firmware to support floating point math. With a 100,000 hour meter, scan rate/timer resoultion differences can add up to be significant. What this means is that if your scan is long enough, and your timer happens to time out in mid scan and its location in the logic is such that it is not picked up until the next scan, you can have significant cumulative error. If this matters to your application then you should not use the timers DN bit, but rather set the timer preset to 32767 and use a comparrison insturuction to see it the timer value is greater than a certian time duration. If it is, subtract that duration from the accumulator, leaving any result >= 0 in the accumulator, and add that value to a floating point number. This way you won't loose any time due to scan rates. Ive done this many times to create high resolution long duration timers. The following mnemonic code shows a floating point long duration timer in F8:0 with a time resolution of 0.001 hours. Adjust the resolution according to your needs. Warning: Be very careful that you do not put a negative number into the timer accumulator or you will fault the processor.

XIC TON T4:0 0.001 32767 0
GRT T4:0.ACC 3600 SUB T4:0.ACC 3600 T4:0.acc
ADD F8:0 0.001 F8:0

You can also use bits from the free running clock to trigger the addition of time to a floating point number, but you will miss time slices when you enable and disable the timing, but not between. For something like a motor run hour timer, the resolution issues may not be a problem. Consult your programming guide on using the free running clock, you can download it from ab.com/manual on line.
 
T
Oops, correction to the example code. It should read:

> XIC enable_bit TON T4:0 0.001 32767 0
> GRT T4:0.ACC 3600 BST SUB T4:0.ACC 3600 T4:0.acc NXB ADD F8:0 0.001 F8:0 BND
 
I would say a 100,000 total hour meter would be large enough.

> How could this be done since you are limited by the total counts in a count up timer? <

You may try counting to 1,000 and count how many times you get there.

these values are within the magic max number and will allow you to count to 32767 thousand.

don't forget to compare the acc values and reset the counters before they overflow and cause a processor fault.
 
The key here is that you have a MicroLogix 1200; even the Series A firmware for those controllers supports the new 32-bit Long Integer data type. This helps overcome a limitation in SLC and MicroLogix 1000 controllers that only can count to 32767 because they use a 16-bit signed integer.

Use a timer to count off a minute or ten minutes or an hour... and use a oneshot and the ADD instruction to increment your hour meter value, instead of the CTU (count up) instruction.

The hour meter value will have to be a Long Integer data type, such as "L10:0".

The PanelView can display this if you set your tag data type to "DINT" (Double Integer).
 
M

Michael R. Batchelor

In the Panelview split the display into a high field and a low field, i.e., 100,000 becomes [100][000] in two fields. Then in the ladder use the register for the lower = 1000 to increment the
upper part and reset itself. As the lower value "rolls over" it will appear to the operator as if the next number is incrementing
because of the physical proximity on the screen.

Of course (there's always a down side isn't there) if you try to use the registers in any kind of automated data collection system you have to conjoin the two registers such that the resulting integer value makes sense.

I.e. TotalHours = (HighField X 1000) + LowField

--
Michael R. Batchelor - Industrial Informatics, Inc.
Contribute to society: http://www.distributed.net/ogr/
 
T

Trevor Ousey

You could use an RTO (retentative timer) to give you an hour pulse, then with that pulse increment a Floating Point file to give you hours. The Panelview will display real numbers. Or use two integer files, one for the 3 least significant digits, the other for the 3 most significant
digits. To do this increment the second file when the first reaches 1,000 and the set the first to 0.

Cheers.
 
Top