First of all, and before we getting into our code, we should know:
Why do we need to Delay a Sensor Signal?
As an operator one of the best features of your plant or process is the speedy response of your system (level sensors, pressure switches, actuators ….) that would really help you to control and monitor your plant easily, but as all of us know
“There is no fixed rule in our life”, there would be some other situations that really need the signal of some sensors in the plant to be delayed, look for the next alternative situation.
We have a storage tank in our process that maintain a certain level of (seeds, water, oil ….), this tank has a high-level switch.
When this level is on the whole process would start, for some reasons (some of the seeds touch the sensor when you fill up the silo) you may found the level sensor has a deceptive signal for just 100msec and this could happen several times. Such a problem would really make some Significant losses to your system.
So, here is the simple solution with just 2 or may 3 second delay for the level signal you will ensure that is the real signal of the switch and your silo is definitely is full.
NOTE do not make a long delay as that could make another issue and negative effects with the process.
Now It’s PLC Coding Time
Our code is built using just function as there is no need to use a function block.
First of all, we are calling the function that is responsible for delaying the desired sensors from the main OB (Organization Block).
As said before, the structure and organization of the code is a very critical point that you should be aware of.
Now we are in the function (FC1) that contains the blocks that control the sensor signals.
The first Network is a timer that responsible for initializing a pulse every one second.
The other networks contain the function that responsible for delaying the sensor signal (FC2)
- “ONDLY-TMR” is the function
- CONTACT-IN – It is the real-time sensor signal getting from the field.
- PULSE – it’s a one-second pulse from the first network that makes the delay between counts.
- DELAY-SET – It is the No. of set counts (this set is converted to seconds).
- DELAY-COUNTER – It is the counter that will be compared with the set value
- CONTACT-OUT – It is the delayed signal that you can put on Marker or Data Block to reuse it.
Here we have our Logic that handles the desired function with some comments to make it easy to understand…
Download the Logic
Code Made By Sachen
Author: Hussien Ghareb
If you liked this article, then please subscribe to our YouTube Channel for PLC and SCADA video tutorials.