Counting Velocity in a AB 5/04 PLC

Join Date
Apr 2003
Location
Toronto
Posts
151
I have another question hopefully someone can answer for me.

I have a 5/04 Processor and a 24 Vdc digital input card. The program that is executing has a background task (interupt) I have tried to make this sensor count pulses to show number of revolutions, my resolution is quite low, as in Maximum 100 Pulses per revolution. I have tried using the scan time (adding by 1´s) and using a timer to pulse to 30 and 60 seconds it is close but it is never the same. (I averaged the count out by counting pulses to 3006 multiplying by 2 and a second counter counted to 6012, adding these two together then dividing by 2) The machine is quite stable and I see almost no RPM changes on my Handheld Tachometer but my count is all over the place. Does any one have any code that will count the 100 pulses per Rev. and display it. I don't want to wait for 5 minutes during ramp up to stabelize the count either, it would be nice to show the count as the machine ramps up.I have a digital input card. I have tried the IIM statement and the HSC statement neither has given me any satisfactory results.

incidentally the target is aproximately 1 inch wide, the sensor sees the target for the complete 1 inch. the diameter of the tube that is rotating is aproximately 15 inches. all i want is 45, 46, 45, 44, 45. what i am getting is 44, 47, 41, 42, 44, 40 I think the scan is affecting the count.

Thanks in advance for any assistance here, I am starting to get lost in what I thought was simple.
 
45 RMP * 100 ppr = 75 pulses/sec. That is one pulse every 13.3 msec. Your scan time is probably greater than that.

You're probably thinking "what does the scan time have to do with it, I'm using an STI?"

Well, your IO updates in between the regular scans. So even if the STI executes a couple of times every scan, it only sees the condition of the input as it was last updated in between the regular scans. And since a counter has to see an input as false, then true, then false then true to count two pulses its quite likely that you are missing pulses.

So first I'm going to suggest the best way to solve the problem is to use an HSC card. Thats the correct approach.

But that involves some expense and re-wiring. So I'm going to also suggest a kludge - and a big kludge it is. Its ugly.

You could execute an IIM to force an IO update but that adds a lot of overhead to your program. And you know the old rule about not programming multiple outputs to the same address? Well that rule doesn't apply to timers and counters. You can actually execute a CTU instruction on the same address multiple times in the same program scan, so you can put a few IIMs distributed throughout your program followed by a CTU addressed to the same counter address. You'll have to play around a bit to find out how many times you need to do it.

You can still use the STI, but now it is used to look at the counter and see how many counts came in over the last second and compute the RPM.

Just be aware that this method is going to add a huge chunk of overhead to your program and it will slow the overall scan way down. See attached for an ugly example.
 
Take a step back and explain again the layout of this mechanism.

You talked about a 15 inch diameter tube that is rotating, and a target that is 1 inch wide. Is this a sensor flag that is on the perimeter of the tube, or on a shaft that is centered in the tube, or something else ?

You also mentioned "maximum 100 pulses per revolution", which implies an encoder or pulse generator disk.

You also mentioned a value of between 40 and 45, which I think is a revolutions per minute value.

Take a step back and explain the system, and folks can advise on the best mechanism to measure RPM.

Also, it would be handy to know the exact model number of the DC input card. Some are faster than others.
 
Thanks Ken and Aleric for responding to my question.

The machine is a wire strander that rotates at 100 RPM to 150 RPM, there are three sections each has a tube aproximately 15 inches in diameter. we are using a 1746-IN16 though we can swap this out for an IB16. Because of the low count i do not think a HSC2 is going to give me a better result.

The machine has multiple gear sets and we have upgraded the machine to RSVIEW32. The Recipe (See my other thread regarding RSVIEW recipe's) is used to remember the gear that the machine should be in for any particular product. I wanted to compare the actual speed against the calculated speed, if the actual rotational speed is greater than the recipe requested the operator has not changed the gearing and we are giving away wire. If on the other hand the speed is slower we have extended the wire pitch which is not as critical for this type of cable construction.

The machine originally had Dynapar Low rate meters on each cage and a small spring was used to pulse the meter's we wanted a low tech and cost solution, had the speed been greater than 150 RPM I would have opted for a high speed counter card.

As for the STI in the program we are using the PLC to ramp the machine up to speed. The STI resolution bit has been set and we typically ramp the machine up using an STI value of 60, stopping the STI time is changed to 30 and Emergency stopping we change the value to 15. We also change the STI value for Jogging and the STI is set to 20. I have used the STI for the last 10 years on all my machine designs strictly for ramping machines and works flawlessly. As for the changing times of the STI I could live with calculated while the machine is ramping, change the STI value to a rate value as Aleric is using in his program while at steady state.

Anyway I will try the small code that Aleric has left me, if this doesn`t work I suppose a HSC2 card is needed....

I will monitor this site throughout the day.

Thank you

Ronny
 
What you need to know is the worst case on duration and the off duration of the pulses. If your scan time exceeds those values then you will miss counts. Depending on the shape of the "flag", the on duration may be significantly shorter than the off duration.

Paul
 
Does the 5/04 have a hardware interrupt capability? IIRC the /05 does. You can select which bit of a word, positive/negative transition, etc. Just sayin'
 
I've actually never seen a wire strander, but I imagine that there's a heck of a gear train on it, and that your sensor is located not on the perimeter of the tube the wire is being wound around but somewhere else on the powertrain.

Could you explain one more time for me how many actual pulses per second or pulses per minute you are trying to count ?

If we just work off your statement that the incoming signal is about 100 pulses per revolution of the tube, and that the tube is rotating at 100 revolutions per minute, we can state that 100 x 100 = 10,000 pulses per minute are seen by the input module.

Divide a minute by 10,000 and you get a period of 60/10,000 = 0.006 seconds.

A single "pulse" has to be both an on and an off state observed by the controller. Therefore the width of each pulse's on-state must be half of the total pulse, or just 0.003 seconds.

To reliably sense pulses and never miss one, a controller has to scan the input point twice per interval that the input will be on, so that's 0.0015 seconds.

Now we're well into the realm of a hardware-based high speed counter. The 1746-IB16 and IN16 modules can't sense an input much faster than about 8 milliseconds.

If I've mis-assumed something about your system, please explain how it works. I'm curious now.

The SLC isn't a great super-fast-counting controller, but the STI and DII functions can make it do a lot of interesting things in the background.
 
The SLC isn't a great super-fast-counting controller, but the STI and DII functions can make it do a lot of interesting things in the background.

I agree with Ken, they can, but there is a practical limitation. I'm using the method I mentioned above in counting gear teeth on a drive sprocket for a 3 meter diameter carousel for changing huge die sets, but it moves much slower. It didn't work well at all when I inherited the POS in 1999 and $$ was tight then, tighter then than even now, so I programmed several immidiate input updates and counters interspersed about the program. I haven't been back to revisit it since then as it worked, but a much better solution would have been a HSC card. It doesn't take a very fast pulse train to quickly surpass the capabilities of standard 1746 discrete inputs and the PLC scan.
 
Try the DII Counter Mode

Here's how I would approach the application.

Postulate that a sensor generates 100 equally spaced pulses in 1 rotation of the machine, and that the machine rotates at 100 revolutions per minute.

As described above, this means that each pulse is 3 milliseconds long.

The standard 1746-IB16 and -IV16 modules cannot detect a pulse that short. The specifications for those two modules say the maximum signal delay
for off-to-on and on-to-off transitions is 8 milliseconds.

The 1746-ITB16 and 1746-ITV16 modules have much faster circuitry; the typical off-to-on time for one of those modules is 0.1 milliseconds.

To determine the rotational velocity of the machine, I would count pulses for 1 revolution of the machine then determine how long that revolution took.

The Discrete Input Interrupt (DII) function of the SLC-500 has an often-overlooked "Counter" mode, in which is counts pulses in the background and
executes the designated Program File once each time the background counter has reached its preset value.

The DII program file will have a very simple program in it: when the file is executed, it copies the value of Status file element S:4 to a holding register, then writes a zero into S:4. The S:4 clock will begin timing in the background again at zero while control returns to the main SLC program.

The DII will be configured to examine the sensor input, and set for a Preset value of 100 counts.

S:4 is the free-running clock in the SLC controller. It increments by 1 every 10 milliseconds.

Since we're executing the DII routine every 100 counts = 1 revolution of the machine, I should see about 1/100 of a minute worth of time in the holding register when the machine is rotating at 100 RPM.

1/100 x 60 seconds = 0.600 seconds = 60 ten-millisecond increments = 600 milliseconds.

Now I know that 1 revolution of the machine took 600 milliseconds, so I know the rotational velocity is 60 / 0.600 = 100 revolutions per minute.

The resolution of this approach should be about 1.67 RPM. You could change the sample to more than one rotation (200, 300, 400, 500) and get better resolution and a slightly slower update of the RPM value. Since you'd been waiting 30 seconds previously, getting 5 second updates would be great.

I know there are a bunch of ways to approach this, but I think this is a fairly simple method that makes good use of the DII feature of the SLC-500 controller.

If I was wrong about the 100 pulses per machine rotation, then of course this isn't the right way to approach it.

If you actually only get 1 pulse per machine rotation, we can still use the DII but use a faster timer, one that increments every 10 microseconds (Status element 2:45).
 
And the winner is.... Aleric I want to thank you for your little PLC program. I never thought you could make multiple calls and update the same counter within a single scan. I have set the count to 60 seconds and on a 99 pulse count per minute I am reading 99. The error is +/- 1 Pulse. Again I thought I was clear on the target, it is one target per revolution X 100 rotations is aproximately 99 RPM. My previous attmempts were all over the map with Aleric's program I am able to count the pulses repeatetly.

As for what a wire strander looks like imagine 20 tons of steel and copper spinning at 100 RPM on a long Tube.

I know your time is valuable but for anyone who needs to count pulses please look at the program in this thread, you will not be disappointed.

Regards

Ronny
 
Your original post:
my resolution is quite low, as in Maximum 100 Pulses per revolution

Your last post:
Again I thought I was clear on the target, it is one target per revolution X 100 rotations is aproximately 99 RPM.

That's what confused me.

I'm glad you got your machine working well.

There are other methods, some of which I think are more elegant, but you can't argue with results. :site:
 
Sorry for the quick replies, I am in a hotel with a verry poor hit and miss connection.

The Strander has three sections each rotating a little faster than the other one. The sections are called cages. The first cage has 24 Bobbins or reels in it, it spins at a maximum RPM of 125. The second cage has 18 Bobbins and spins at about 135 RPM. The final cage is 12 Bobbins and spins at 150 RPM. Each Bobbin can weigh up to 500 Lbs for Copper and 350 Lbs for Aluminium.

The bobbins are staggered along a Tube in sets of 6 So the 24 bobbin unit has 4 sets of six mounted in a circle around the tube.

The tube is mounted on Bearings and wire is pulled through a die by a Capstan This forms a Helix around the wire center path.

The importance on wire is to make the resistance and ampacity correctely. Typically this is checked by Weight, twisting wire more tightly will increase the weight, The bad part being that the circumference will also enlarge, subsequent stages (insulation etc) may have issues.

Typically we remove the drive shaft from older stranders, and use AC or DC drives to individually rotate the cages this allows the operator to enter the rotational pitch automatically. We would then also have a proportional signal of the RPM. By choosing the 1:1 gear sets the operator would never need to exchange the gear set's to get the different pitches needed for cable construction.

The biggest trick though is when the machine has to have all three cages rotating 1:1 and in syncronous rotation. Typically you would pull 24 + 18 + 12 or 54 wires to the front of the machine to create an 54 wire outer layer. I have done this as this is not the purpose of this thread, anyone who wants to know more about this please send me an E-mail and I would be glad to explain the pitfalls of this.

Anyway the pulses that are being created: I am using the theroetical values during ramping and after 2 minutes I am reverting to actual values using the "Aleric method". We are now seeing 99 when in fact it is 99

To all who are reading this thank you for your time any questions and I would be glad to answer.

Ronny
 

Similar Topics

Hello I am looking for tips on how to count the duration of a given function and then how to display it on the hmi panel in the hh:mm:ss format...
Replies
4
Views
1,702
Guys, I know it will be silly but can't get my head around it. I have 3 conveyors, every one on a separate servo drive, and 2...
Replies
25
Views
3,504
The 1734-IB8 has no hardware counting function correct? I am trying to find something to substitute in for a 5069-IB16F (since lead times are...
Replies
3
Views
1,416
Been scratching my head at what I thought should be a relatively simple task. I need to count how many rows a .csv file has, so I can later read...
Replies
6
Views
2,552
Hi All, I need to count my Contactor switching times. There are lots of them so I created a template logic with local variables in FC2000. Now I...
Replies
10
Views
2,138
Back
Top Bottom