PLC Counters and timers

tendaishoko

Member
Join Date
Nov 2013
Location
Sydney
Posts
1
I am looking for ideas for implementing a logic to monitor vibration pulses using timers and counters. I would like to count every pulse greater than 3 sec and if I get 5 pulses within 2 minutes stop the machine.
 
Pseudocode:

Every 40 seconds (2 minutes divided by 5):
Count := Count - 1

Cyclically check the input:
Generate the oneshot of the input with a 3 sec delay.
If oneshot, then Count := Count + 1

Cyclically:
If Count < 0 then Count := 0
If Count > 4 then trigger alarm and set Count := 0
 
What if there were 5 pulses, two occuring near the end of one of the 24 second intervals and three occuring in the next interval, but no more. Your logic would not detect them. The end of the 24 second period would drop a count of 2 down to one. Three more would happen but that would only raise the count to 4. While the alarm should have tripped it doesn't.

Try this. Set up an array of 5 integers. Zero all of them. Create a pointer (index) to the first one.

If a pulse occurs store '120' in that indexed position then move the index to the next position.

Every second subtract 1 from each non-zero position. If the first position (which would have had the lowest non-zero number) goes to zero then move the other positions one and bump the index 1 position.

If a pulse occurs when the index is pointing to the last position then 5 have occured within 2 minutes (you don't actually have to store the last one).
 
Last edited:
I think my suggestion would be allright if not perfect if it is just to make an alarm not too sensitive.

If it has to be absolutely correct, I would make a FIFO with 5 entries, and store the system time of each impulse in the FIFO. If the last entry of the FIFO is less than 5 seconds old, then generate the alarm.

I think it is almost the same what you suggest, but your suggestion will have a resolution of 1 second, whereas my last suggestion will have the resolution of the system time, typically milliseconds.
 
Generate a oneshot everytime the pulse is greater then 3sec.

The oneshot will Start a timer TOF with a preset of 2min.

Create four memorys to store time in.

When a oneshot is triggered, save the elapsed time of the TOF to memory1. And then reset the timer. This will calculate the time between pulses.

The next time the oneshot is triggered repeat the above step and save it to memory2.

The next time the oneshot is triggered repeat the above step and save it to memory3.

The next time the oneshot is triggered repeat the above step and save it to memory4.

Just repeat this and if all memory1-4 are full, begin at memory1 again.

Add the memory1-4 and compare it to two minutes. If it's under, set the alarm.

Don't know if it's going to work but that's what I had in mind :p
 
There are vibration monitors you can get where you can set a level. On some on the pumps I've worked with, a 1 inch per second over a 5 second time works. It's much easier when you have a predetermined level to use.

I don't know the cost, but I don't think they are high. Depends on the industrial rating, if needed.
 

Similar Topics

Here is something that I am trying to wrap my head around. The short story is that I have a CX8090 with a fairly small amount of code on it. The...
Replies
1
Views
2,818
Hi everybody, I'm using a Durus IC210DDR012 PLC Controller. I want to count the number of pulses produced by the Hall Sensors present in BLDC...
Replies
10
Views
3,086
HI, Everyone, im working on small project, that's basically product counter. The current setup at our factory is the hardware counters that are...
Replies
6
Views
2,600
Hello, I'm working on a project where I have two encoders (which I'm reading through counters). What happens at the line is that an inspector is...
Replies
7
Views
2,807
N
hi how to use timer&counter in step 5 ,ladder programming
Replies
2
Views
2,733
Back
Top Bottom