Pump Stroke Counter

gdglisch

Member
Join Date
Sep 2011
Location
houston
Posts
14
Hello All,

Does any one know a good way to calculate pump strokes in SPM using a limit switch to count the number of strokes. I have tried this a few different ways but cannot get the resolution that my customer needs.

My first though of doing this was counting the number of strokes every 10 seconds and multiplying the number of strokes by 6. The prblem with this is that you only get a resolution of 6.

I have also tried taking the time between strokes and dividing 60000 by this number. I gives good resolution but jumps around.

I am using Siemens S7-300 with Step 7. Any suggestions and /or solutions are greatly appreciated. Thank you.
 
What does your customer want - strokes per second, strokes per minute, or strokes per hour?
 
Ha-ha! Their wants exceeds the bounds of possibility! If they want it accurate to 1 Stroke per Minute, then you will have to count for 60 seconds, then display the total SPM, then not change it until 60 more seconds has expired.

Or you can calculate a running 60-second total each second by counting every 1 second, dropping the oldest 1-second count (from the previous 60-second total), and then adding the new 1-second count.
 
Last edited:
That was one of the first things we did actually. The problem they had with this was that if the change of SPM went from say 60 to 90 within a few seconds it took too long for the addition to catch up with the new SPM.

The second thing I tried like mentioned before was basically counting the time between strokes, then taking 60,000 ms / (time between strokes) to get SPM. I think the issue with this is that the program is too big so the amount of time it takes the cpu to scan through the entire program throws it off every one in a while. This has really been a pain for us.
 
What I would do is to start a timer and a counter and get the time it takes to do say five strokes. Get the value of the timer's accumulator at the end of your five strokes.

And let's assume your pump does 17 STM. So doing the math, 60/17 would give you a time of 3.5 seconds per stroke.

So, after 5 strokes your timer would have accumulated around 17.6 seconds - give or take a smidgen.

Now take that time and divide it by your five strokes (we're doing it this way because the resolution of your timer is going to be better than that of a fractional stroke). Call it "SecPerStroke" (or whatever) in your program.

Divide 60 by "SecPerStroke" to get your STM.

And you don't have to use five strokes, nor does it matter if you exceed a minute's worth of time in your timer.

Nor do you have to stop the timer and counter and reset them after each "batch" of strokes. Just do the math after each stroke using the current accumulator value and the number of current strokes.

Just be sure to reset your timer/counter before they rollover.
 
Last edited:
Now take that time and divide it by your five strokes (we're doing it this way because the resolution of your timer is going to be better than that of a fractional stroke). Call it "SecPerStroke" (or whatever) in your program.
This is a great method for 99% of applications, but still will not have an accuracy within 1 SPM (rounding and math errors will be greater than 1). That is a very tight specification for this type of count. Why the heck are they needing that range of accuracy?
 
This is a great method for 99% of applications, but still will not have an accuracy within 1 SPM (rounding and math errors will be greater than 1). That is a very tight specification for this type of count. Why the heck are they needing that range of accuracy?


Well, if you have a fraction of a stroke per minute, and you were dividing it into 60, then yes.

Divide it into 60.000 (keeping track of the fractional part) and you get a very accurate number of strokes per minute. Say, down to the thousandths...

After all, you are calulating the amount of time in seconds between strokes. How you want to represent your result is your choice.
 
Well, if you have a fraction of a stroke per minute, and you were dividing it into 60, then yes.

Divide it into 60.000 (keeping track of the fractional part) and you get a very accurate number of strokes per minute. Say, down to the thousandths...

After all, you are calulating the amount of time in seconds between strokes. How you want to represent your result is your choice.

It looks like this might work. I will do a simulation here and post results!
 
Try Something Like This. It will measure time between pulses and give you a real time RPM.
 
Try Something Like This. It will measure time between pulses and give you a real time RPM.

Yeah, this method was one that I tried before but the program is very large and there is only one prox in their system. Thank you for your time though.

I am still working on programming the logic suggested by rootboy.
 
Sorry that I didnt specify. It is strokes per minute but want it accurate to 1 SPM. They want it calculated every few seconds though. Thanks.

What is the value for average strokes per minute and what are upper and lower boundaries ie acceptible limits. It is so helpful when all the cards are dealt face up on the table.

Why do they need or want (and which one is it) to have an update every couple seconds?

Dan Bentler
 
What is the value for average strokes per minute and what are upper and lower boundaries ie acceptible limits. It is so helpful when all the cards are dealt face up on the table.

Why do they need or want (and which one is it) to have an update every couple seconds?

Dan Bentler

The lower boundary is about 6 SPM and the upper boundary is about 150 SPM.

We are not using this for any kind of countrol so I personally dont think it has to be within 1 stroke....Its just what they want. :rolleyes:
 
If it is that important to them could you put it some sort of timed or scheduled portion of the logic? (I don't have any S7 experience)

Generally there is a point where you lose accuracy if you try to be fast. Is there something that drives this pump that you could measure instead of when the pump hits one specific point in the stroke? AKA, measure a motor speed or something along those lines to estimate an instantaneous SPM instead of waiting for the pump to trip a limit switch before updating your data?
 

Similar Topics

Hi everyone, I wonder if some one can help with code to have one short pulse on out put for every piston stroke on piston pump. I have input from...
Replies
1
Views
2,289
Hi, I would like to assemble a simulator/practice booster pump system that uses PID to maintain steady water pressure under various outlet demands...
Replies
0
Views
70
I've gotten to the learning curve where I can program a call for pump to come on at set point but I'm not sure how to turn the same pump off when...
Replies
1
Views
130
Hey Guys, I was looking for a little help on a school project. I was asked to program three pumps with two inputs, more and less. The project...
Replies
23
Views
2,515
My department has been tasked with writing the program for a 4 pump lift station that alternates all four pumps (one lead, one lag, two on...
Replies
4
Views
1,072
Back
Top Bottom