(Although just as I have trouble telling the difference between IL and STL, I don't see the big difference between LD and FBD. Which might be a little daunting if you don't know FBD. If you follow Ron's link, you'll see the concern - it's not the Ladder Timer, but the Function Block Timer: He didn't ask for just a single line of code. If it's even less critical than that, then use a 100-mSec Timer and only have an accumulating error occurring every 3200-seconds (53.3 minutes). If it ain't that critical then use a 10-mSec Timer and only have an accumulating error occurring every 320-seconds (5.3 minutes). Again, resetting the accumulator to the difference. Then you will only have an accumulating error occurring every 32 seconds (or so). Watch for every case of the timer exceeding XX.000. Then, if something is supposed to happen on a 1-Sec basis, it becomes a matter of watching for the bit-transition either OFF-to-ON or ON-to-OFF.Īnother method that will help to minimize the "in-house" error is to run the timer for the maximun time but reset at 32.000 seconds. If the scan sees that the accumulator is 1009, then flip the bit and subtract 1000 from the current accumulator value and write the difference back into the timer accumulator.Īt that point, the bit has been flipped and the current value = 0.009-Sec. If the value is Greater Than or Equal to 1000 then, flip the 1-minute bit. (Sorta, Kinda Pseudo-code)Įvery scan check the value in the Timer Accumulator. In addition to all of the above, the internal timing functions in the PLC are not as accurate as the timer chips used to maintain a real-time clock. In the next scan, when the timer gets reset, you lose those nine milliseconds. In the next scan, 10 milliseconds later, the accumulated value is 60.009 seconds so the 'Done' bit gets set. During a PLC scan, the timer is evaluated and the accumulated time is 59.999 seconds, so the 'Done' bit remains false. When you reset a timer, you drive the accumulated value to zero. They turn on their 'Done' bit when the accumulated time is greater than or equal to the preset time. PLC timers store their acculmulated time internally. If your PLC scan is 10 milliseconds, it adds up to six tenths of a second per hour when you use a one minute time period. Those few milliseconds are lost, but they are cumulative. The first is the fact that for one PLC scan, the timer is held in a reset condition. There are two cumulative sources of error in the self-resetting timer. It should not be used to roll your own time-of-day clock. If your need is to make something happen approximately once per minute or to keep track of running time to signal somebody to come and do PM, it's an excellent tool. Eric's method is the easiest way to create a self-resetting timer, but be careful how you apply it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |