Hi,
Don't know if this is exactly the right place to ask, but let's give it a shot.
I made a (OMRON) PLC control system for a pharmaceutical machine. One of its main tasks is measuring pressure. Everytime a tablet is "punched", a digital pulse is made and the current pressure on that tablet must be stored for that "punch". (Punch[0] = 20 kN, Punch[1] = 22 kN, ....
To make it difficult, the machine rotates very fast. Once engaged, the PLC could have less than 20ms between 2 punch pulses. And, the pressure acts like an aggressive sinus with a high frequency and amplitude. That means the timing (when to measure) is crucial here. Read the value 1 ms later and you will have the wrong pressure. The question is, how to read such quickly changing values?
So far I tried this:
- The punch pulse activates an interrupt. At this point the highest peak value from the last ~10 ms will be used. So, if the pulse comes 2 ms too late, it wouldn't hurt since the peak value won't be different. We actually give the pulse slightly after the sinus peak (when the pressure is dropping again).
- A second interrupt pulse resets the peak in between 2 punch pulses (at the sinus bottom).
- Measure the pressure every ms with a cyclic interrupt (however, the OMRON analog module needs 2 ms to refresh, so making it faster won't help anymore...). We store the peak value.
It works until the machine rotates very fast again. My guess is that the readings are just not quick enough.
- Sensor (measures metal curve)
- Sensor signal gets amplified (don't know how fast this one goes)
- OMRON Analog Input reads every 2 ms
I'm afraid I can't fix this in the software. An obvious weak link here is the analog input. Is a refreshrate of 500 times per second slow? Anyway, I was thinking about an electronic solution. Is it possible to keep the peak signal for, let's say 6 ms? After that the signal can drop again. If this is possible, the PLC has enough time to read the peak for sure. Any other suggestion is also welcome!
Greetings,
Rick
Don't know if this is exactly the right place to ask, but let's give it a shot.
I made a (OMRON) PLC control system for a pharmaceutical machine. One of its main tasks is measuring pressure. Everytime a tablet is "punched", a digital pulse is made and the current pressure on that tablet must be stored for that "punch". (Punch[0] = 20 kN, Punch[1] = 22 kN, ....
To make it difficult, the machine rotates very fast. Once engaged, the PLC could have less than 20ms between 2 punch pulses. And, the pressure acts like an aggressive sinus with a high frequency and amplitude. That means the timing (when to measure) is crucial here. Read the value 1 ms later and you will have the wrong pressure. The question is, how to read such quickly changing values?
So far I tried this:
- The punch pulse activates an interrupt. At this point the highest peak value from the last ~10 ms will be used. So, if the pulse comes 2 ms too late, it wouldn't hurt since the peak value won't be different. We actually give the pulse slightly after the sinus peak (when the pressure is dropping again).
- A second interrupt pulse resets the peak in between 2 punch pulses (at the sinus bottom).
- Measure the pressure every ms with a cyclic interrupt (however, the OMRON analog module needs 2 ms to refresh, so making it faster won't help anymore...). We store the peak value.
It works until the machine rotates very fast again. My guess is that the readings are just not quick enough.
- Sensor (measures metal curve)
- Sensor signal gets amplified (don't know how fast this one goes)
- OMRON Analog Input reads every 2 ms
I'm afraid I can't fix this in the software. An obvious weak link here is the analog input. Is a refreshrate of 500 times per second slow? Anyway, I was thinking about an electronic solution. Is it possible to keep the peak signal for, let's say 6 ms? After that the signal can drop again. If this is possible, the PLC has enough time to read the peak for sure. Any other suggestion is also welcome!
Greetings,
Rick