Thread Starter


I'm using flow meters which provide me with a 4-20 ma signal representing gallons per minute. The flow results are amazingly accurate. The problem is the slc 505 that I'm using seems to be amazingly inacurate when it comes to using it's last scan time word (S:35). I convert the gallons/minute number into gallons per ms and multiply by the last scan time then add it to the previous total value. the results are way off. I also tried using a one second timer wich just toggled on and off every second. this didn't work either. Does anyone know of a card that can be used in an slc modular system that could give an integer or a floating point word accurate time information so that I wouldn't have to rely on the cpu to do it for me?
Thanks for your help
[email protected]

Steve Myres, PE

Whenever I need to make a recycling timer more accurate, I do this: I use a timer with a 0.01 sec time base and a large setpoint, say 9999. Then, every scan, I check the ACC value against the desired time interval. If the ACC value is greater than the threshold, subtract the threshold from the accumulator value and take the appropriate cyclic action. This way, the time between the theoretical timer expiration and following test is accounted for and error does not accumulate.

The actual observation of the time is still slightly scan time dependant, though less so than with your method. If you need even more accuracy, you can put the test in a separate routine and call it with an STI (selectable timed interrupt). Be careful about using too short an STI interval, as there is about 700-800 microseconds of undocumented overhead per STI call, so if you use a 1 or 2 ms STI interval your scan time will be seriously affected. I learned this tidbit the hard way. :)

[email protected]

Hakan Ozevin

I am not an expert for A-B PLC's, but I am on flow and volume/mass measurement. Altough I do not think that your method is the best alternative (see note below), you can try the following:
1. Use a time interrupt (dt) of say 10 ms=0.01 sec
2. Increase a value (say n) by one at each dt
3. Summarize the flow value (dv) at each dt
4. After a certain time t (for example n reaches 100=1 sec), the total flow can be expressed as:

Total volume(t)=Initial volume + dt x sum(dv) as n=0 to n=t/dt

5. Reset n, set total flow=initial flow and start from the beginning.

If you dont use an interrupt, you will not get an accurate result.

Best regards and good luck.

Hakan Ozevin

Note: Using analog input will always tend to have errors (and increasing errors). The best way to make a totalizer, is to get a pulse output from the flow meter. Then you do not have to make a summation (=integration; volume is the integral of flow). You just count the pulses. In your case, I dont think that you will have an accuracy better than 1%. But with a pulse output (and HSC input at the PLC), you can have it as good as 0.1%.

Jim Uthgenannt

Some considerations about totalizers:

1) Avoid floating point math for repeated summations of large and small numbers. With 4-byte (32 bit) floating point numbers, the machine accuracy will be about 10E-7, ie. 1. + 1.E-7 = 1., not 1.0000001. In your case, with a 20 ms scan time, the totalizer becomes low-fidelity in about a day’s worth of activity. (High fidelity floating point addition is achieved when the numbers you add are of the same order of magnitude). Therefore, for long-running totalizers, use integer arithmetic to maintain them. Use a timer and a workspace floating point number to do the additions; when the workspace sum reaches some threshold, increment an integer counter and reset the workspace. Use multiple counters to maintain large totals. You can then easily reconstruct the total from the counters and the workspace.
So, a pseudocode fragment may look like this:
] T4:x.DN[------TON T4.x
]T4:x.DN[------compute workspace Fwk = Fwk + input*scaling*time increment
If Fwk >= Fwklim then
Fwk = Fwk – Fwklim
If C5y Done then

2) Usually, it is unnecessary to perform increments as often as the machine (SLC) cycle time; the totalizer acts as a low-pass filter on a potentially noisy flow signal.

3) Make absolutely sure your scaling is correct. When you’re sure on paper, run easily verifiable test cases on the target processor with simulated inputs.

If you prefer a pulse counter I/O solution, speak to your distributor about the 1746-HSCE for this application. Your flowmeter will have to be compatible and you'll need to run additional wiring.

Good luck.