Logic for Pulse Totalizing

AaronW

Member
Join Date
Mar 2013
Location
Whittier
Posts
6
HELP, PLEASE!!!!!

I need to set up a totalizer (In a PLC5/40E) to measure total daily flow of reclaim water here at our plant. I have been doing some research and have noticed several threads talking about totalizers and pulse counters. Our engineer wants to use a pulse counter. I just dont understand how to develope the ladder logic for this..

Specs.
Make: Micrometer
Model E7500-011
Contact: Dry N.O.
Contact Closure Duration is: 20ms Can

1 Pulse = 10,000 gallons
Max clicks per minute is 10

I would like to set up an actual flow and a daily flow total but I'm not sure how to build the logic.

I also noticed that a digital input card may miss the count and a special card may need to be used? 1771 CFM
 
Welcome to the Forum !

The 1771-CFM is for fast flowmeter pulse trains.. if yours literally gives a pulse every 6 seconds, then you should be able to use an ordinary discrete input.

Do you have any DC discrete input modules in the local chassis with the PLC-5 controller ? The Pulse Input Interrupt (PII) feature might be appropriate for overcoming any scantime vs. pulse duration problems.

If you are counting pulses at 10 per minute, that's only 10 x 60 x 24 = 14,400 pulses per day, which doesn't overflow the ordinary 16-bit Signed Integer maximum value in a PLC-5 (-32768 to +32767).
 
Thanks for reply and Welcoming to the forum....!!!

The pulse per minute is straight from the manual so I would have to say yes. I do not have a DC discrete module installed... I'm guessing I just power down the processor and slide it into one of the empty slots. This is a very small program, just some pump control and a few analog outputs.

So, I take and multipy the number of pulse by 10,000 gallons (1 pulse = 10,000 gallons) then in need to move that an add instruction. Then reset my counter so I dont overflow the single..

Does this sound correct?
 
If this were my system I would calculate the flow two different ways.

Method 1 is measuring the time between individual pulses. This will give you a calculation for "instantaneous flow rate".

Method 2 is counting the number of pulses per day. This will give you your total flow per day.

Method 2 is probably the simplest to describe, and you're already most of the way there with an ordinary Count Up (CTU) instruction in a subroutine that is called by the controller's PII function. You just decide when your plant's day resets and use the controller clock to store the day's count of pulses and to reset the Counter.

You could multiply by 10,000 and use a Floating Point register as your totalizer. With these values you won't run into significant IEEE 754 rounding problems with a daily count.

If it were me, I'd stick with an integer count and just use the HMI to multiply the value by 10,000 or just label it "x 10,000 GPH"
 
Method 1 is actually more fun, mathematically.

To measure "instantaneous flow" we need to know the number of seconds between pulses, rather than the number of pulses over a given number of seconds.

That means we need a way to measure time precisely in the controller.

The Status data table of the PLC-5 will show you the time since the last PII event in data table register S2:55. The units are in milliseconds.

So let's say that the pulse input triggers the PII, and the value in S2:55 is 16667.

That means it's been 16.667 seconds since the last pulse.

If each pulse means 10,000 gallons, then

10000 * (3600 / 16.667) = 2,159,956 gallons per hour.

I think this method falls down once the time between pulses exceeds 32,767 milliseconds, which is the integer maximum for the PII duration. I would have to experiment with the PLC-5 PII function to know for sure.
 
Good Morning Ken... Method 2 works good. the math i used is

Pulse per day X 10,000 / 1,000,000 = MGD
Then I reset the CTU every morning at 7am

Can i just keep this running with out reseting the counter? I'm worried my timer will over flow? Can I store the daily total to make a monthly total?

Sorry for all the questions!!! You have been very helpful... THANKS YOU VERY MUCH.
Aaron
 
The tips are great, but I just noticed something here and I couldn't help but comment.

1 Pulse = 10,000 gallons
Max clicks per minute is 10

WHOA! A quick math here: 10k gal * 10/minute * 60 mins/hour = 6 million gallons per hour maximum flow.

As Wolfram|Alpha puts it, that's over half the flow of all oil transported by oil tankers worldwide: http://www.wolframalpha.com/input/?i=6000000+gallons/h That's a whole lotta water!

Now, assuming the 1 pulse = 10k gals and the max pulses/min are A-OK, I'd ask a couple of things to your engineer:
1) Is this measurement a custody transfer thing? Will the measurement itself be used as a metric in any sort of contract?

2) Is the over 9 thousand gallons error on the daily total really acceptable?

I'd add that precision could be improved tenfold if the instrument was configured to 1 click = 1,000 gal and the PLC wouldn't notice a difference.

A hundredfold improvement could be seen by configuring it to 1 click = 100 gal, and the PLC could still run with the 1000 clicks/minute (maybe - check your application and maximum recorded scan rate, which really shouldn't be over 30 ms - pushing it for a PLC5). At that point, you'd be looking at specialty I/O and the idea of totalizing flow on an integer out the window - you'd need a float.

P.S.: Just realized how late I am to the game, but now that it's written, here it goes.
 

Similar Topics

Hello, I am struggling to figure out some logic. I have an analog pressure sensor coming into the PLC and would like to have multiple timing...
Replies
4
Views
150
Hello, I work for a beverage company that uses a laser coder to print date codes on bottles. We have a problem where occasionally the photo-eye...
Replies
8
Views
2,538
Hi Guys, I am trying to create a triangle (Sawtooth) pulse in RSlogix 5000 using counters/timers and anything else. I'm not sure what the ladder...
Replies
43
Views
17,015
Ok, I'm guessing this is pretty simple, as I'm in a beginner program for PLCs. In one question I'm asked to draw the ladder logic needed to make...
Replies
15
Views
10,656
Hello, I am trying to replicate a piece of logic on the PLC5 onto an SEL RTAC. I am using ladder on SEL and FBD. I am having issue on the ladder...
Replies
10
Views
119
Back
Top Bottom