Hour timer with tenths

2004sk4

Member
Join Date
May 2005
Location
Georgia
Posts
172
I have a request to install 2 meters on the touch screen. one for each side with a password protected reset.

60 mins /10 = 6 min
6 mins *60 sec = 360 secs

I preset the rto to 360 seconds which when DN goes to a counter preset to 10.

When the counter acc = 10 then it goes to the second counter

I muliplied the second counter by 10 to make it a whole number

I then added the first and second counter together. which is the acc total time

All of the counters are working . I am wondering if i need to change the 1st counter to 9 becuase it appears i am losing hours over time
 
thanks for the information

I am using a 5/04 slc 500 plc. Will the scan time has any negative effects on being accurate.
 
See this thread where this very topic has been discussed earlier today, as well as a way to preserve accuracy.

http://www.plctalk.net/qanda/showthread.php?t=14748

When a timer is executed the lower 8 bits of word 0 of the timer structure is given a timestamp. The next time the timer is executed that time stamp is compared to the current time to see how much time has elapsed. This is then added to the ACC at the timebase rate. The time stamp is then updated. When a timer reaches its PRE it almost never reaches it exactly, but rather it overruns it by as much as the scan time. When totalizing time, if you then reset the timer and start over, you have just added in the overrun due to the scan to your time total. If however you make the timer preset 32767 and never let the timer time out by subtracting 360 seconds from the ACC whenever it is greater than that value, then you preserve the time stamp in the lower 8 bits of word 0.

-------------------------------------------------------

The issue is not the hightest value a floating point number can go, but the highest value it can go before loosing resolution. With floating point numbers larger than 2^20-1 you can no longer represent 1/10th. However, it is unlikely that your PLC will last that long.

Alaric said:
When counting hours using floating point values there are limits to what you can resolve because of the way that floating point
numbers are stored.

If you want 1/10th of an hour resolution you can count 1,048,575 hours (119 years). Beyond this value floating point numbers begin loosing resolution in the 1/10 digit.

If you want 1/100th of an hour resolution your can count 131,071 hours (15 years) before you start loosing resolution in the 1/100 digit.

If you want 1/1000th of an hour resolution you can count 16,383 hours (1 year,10 months) before loosing resolution in the 1/1000 digit.
 
Last edited:
Try this out:

Make the value of F8:0 = 1,000,000.0

Program and run the following rung:

ADD F8:0 0.1 F8:0
You should see the value of F8:0 incrementing up by .1 increments.

Change the value of F8:0 to 1,048,000. It should still be incrementing up in .1 increments.

At 1048575 it will stop incrementing. You are still executing the ADD instruction, but what you are adding is smaller than what can now be represented in a single precision floating point number of that size, therfore the .1 is lost.
 
So in a 120 years he has a problem. HMMMM?
Hopefully someone remembers the password so they can
reset the thing.
 
Last edited:

Similar Topics

I am using a CompactLogix. I need to know whether it has been at least 24 hours since a certain event happened. I want to use the wallclock so the...
Replies
16
Views
4,655
Hello everyone, i have searched this forum and looked here for advice before but this time i wasn't able to find an exact answer for what i'm...
Replies
14
Views
10,416
Hi there, I have an SLC503 that I'd like to control an external contact with. Basically I'd like to assert my local contact on the 503 every 12...
Replies
14
Views
7,172
hello I have a system to program in which there are two HVAC's.Always one is standby and the other is running.The HVAC RUN command is given from...
Replies
4
Views
2,266
Need help a source code to make timer display into hour:min descending from a time of delay 1 sec base timer. Thanks
Replies
22
Views
5,920
Back
Top Bottom