Filling and emptying a tank
Ladder Logic Basic Example II
Ladder Logic Basic Example I
In this another Ladder Logic basic example (filling and emptying a tank), we must follow conditions for this Ladder Logic Interlocking. We will go over the process step by step, so you do not miss anything. Firstly, let鈥檚 take a look at the required conditions:
The tank has 2 solenoid valves:
路 1 filling V1
路 1 emptying V2
In addition, it has 2 magnetic level sensors. If the tank is empty or half full, solenoid valve 1 must turn on and if the tank is full, solenoid valve V2 must open to allow the tank to empty.
Only 1 of the 2 solenoid valves can be active, not both simultaneously.
The process must have a start button for filling and a stop button.
Step 1: Identify the physical inputs and outputs

So, the first step is to identify the physical inputs and outputs. In this case, we have 4 inputs and 2 outputs.
INPUTS
路 Start button: I0.0
路 Stop button: I0.1
路 S1: I0.2
路 S2:I0.3
OUTPUTS
路 V1: Q0.0
路 V2: Q0.1
Step 2: Make the diagram of physical connections

Secondly, we have to construct the diagram of physical connections to the PLC.
As inputs, we find the start button, the stop button and 2 switches indicating both low level and high-level sensors.
How the magnet level sensors work?
There are several types and models. In this case, the magnet level sensors act as switches. We are going to explain an example to make it easier to understand:
Imagine that we have a magnet level sensor located at the top of the tank, which will be filled with some liquid. As long as the liquid level is below the sensor, the sensor will be off. If the liquid overflows the sensor, the sensor will send a signal, i.e., the switch will close.
This type of sensor works mechanically like a buoy in a tank, i.e., it floats in the water.
Step 3: Ladder Diagram for the Ladder Logic Interlocking

Thirdly, we are going to construct the Ladder Diagram, so let鈥檚 take a look at the conditions and do them step by step.
The process must have a start button for filling and a stop button.
The first rung is for the start and stop buttons. For the START button, we are going to use a Normally Open Contact, and for the STOP button a Normally Closed Contact.聽
Then, we need an interlocking, so we are going to use one and we are going to call it Interlocking M1 (M because of Memory). The function of this Interlocking Memory is to activate the other rungs.

If the tank is empty or half full, solenoid valve V1 must turn on.
For this condition, we have to suppose that the tank is empty. So, if the tank is empty, the sensor S1 will be inactive.
When the sensor S1 is off, we have to consider it as Normally Close, so it will send a signal. Then, as an output, we have the valve V1, which function is to fill the tank. In this way, we ensure that the tank will be filled.
What would happen if we press the STOP button and the tank is half full?
In this case, the sensor S1 is on. On one hand, we would have to consider it as Normally Open. On the other hand, the sensor S2 is off, therefore its contact is Normally Closed. In such a manner, we guarantee that the current will flow from the left to the coil, so it will activate the solenoid valve.


3. If the tank is full, the solenoid valve V2 must open to allow the tank to empty.
When the tank is full, the 2 sensors (S1 and S2) will be activated, but the one that activates the V2 valve will be the S2 sensor, which is activated when the tank is filled. The problem is when the tank starts to empty, as the sensor S2 will be deactivated. Then, we will make another interlock to ensure that the coil referenced to the V2 solenoid valve remains energized. Later, when the tank is empty, sensor S1 will be off, so this sensor is the one that will deactivate valve V2.
4. Only 1 of the 2 solenoid valves can be active, not both simultaneously.聽
Finally, the solenoid valve V2 must deactivate the solenoid valve V1, so we make sure that the 2 solenoid valves will be activated at the same time.
In the Ladder Diagram that we have constructed, the sensor S1 will deactivate the valve V2.