Totalizers with AB-PLC

D

Thread Starter

Debabrata Nandi

Hi!! I just wondered if I can get some ready made routines for acurately calculating totalized parameters (flow etc.), rather than the conventional way of dividing by the time slice & doing a cumulative addition!!!
 
A totaliser is just an integrator with write parameters set for integration. So just put an integrator and your totaliser is ready.You may add some coustamisations to add more functionalies to this totaliser.

Regards
[email protected]
 
G

Gavin MacLean

Scan Time as time slice:
In an AB PLC you can access the last scan time (eg. S:35 in SLC 500, from a GSV instruction in ControlLogix). If there is a more accurate way than using this as your time slice and totalising every scan, I would like to know about it.

Why yours is (probably) inaccurate:
If you use a timer that times off the NOT of it's own .DN (done) bit it will be inaccurate by 1.5x the scan rate for every time slice. This is because there is one complete scan when the .DN is on, before it's starts to time again, and an average of .5x scans to get to the timer.

Using a fixed period:
If you want a fixed time period timer that is accurate, use a free running timer and trigger a pulse off a change in the .ACC modulus period (eg. for every 250ms look for change in .ACC MOD 250).

Gavin MacLean
[email protected]
www.applicon.com.au
 
T
I've had several applications where I needed a very long duration accurate timer in an AB PLC. You won't need the long duration, but you will need accuracy. What I have done is set up an unconditonal timer with the T4:X.pre = 32767, with the desired time base and then I use a GRE T4:x.acc TIMESLICE comparsion. When its true, I add to a floating point accumulator, then do SUB T4:x.ACC TIMESLICE T4:x.ACC. That way you can keep time up to the timers resolution, but scan time is out of the picture. The timer never times out so you can't use its /DN bit. Another slick method is to use bits from the S:4 word, the free running clock. S:4/0 has a leading edge pulse every 20mS, S:4/1 every 40mS, S:4/2 every 80mS, s:4/3 every 160mS,..... S:4/15 every 656360mS. S4 is asynchronous with your scan, so if the pulse occurs right after your rung executes, it will be off by up to your scan rate for that scan, but on average it should stay fairly accurate however.
 
Top