Skip to content
PLCampus
All examples

12Level 4

Two pumps with alternation and backup

Two pumps fill a tank. Each filling cycle uses a different one to share the wear, and if one fails the other takes over and an alarm lights up.

The simulator is designed for computers (screens 1024 px or wider).

Virtual plant

Pump 1 · Q0.00 s runningPump 2 · Q0.10 s running15 %I0.3I0.2AlarmQ0.2

Level: 15 %

Shown at rest. In the simulator the plant moves according to your program's outputs.

Inputs and outputs

AddressNameDescription
I0.0SYSTEMSystem switch
I0.2LEVEL_LOWLow level switch: 1 when covered (plant)
I0.3LEVEL_HIGHHigh level switch: 1 when covered (plant)
I0.4PUMP1_OKPump 1 NC fault contact: 0 = fault (plant)
I0.5PUMP2_OKPump 2 NC fault contact: 0 = fault (plant)
Q0.0PUMP_1Pump 1 contactor
Q0.1PUMP_2Pump 2 contactor
Q0.2ALARMFault alarm light
M0.0DEMANDThe tank needs water (between the two switches)
M0.1TURN_P2Pump 2's turn in this cycle
M0.2SWITCH_TO_P2Pulse: turn goes to pump 2
M0.3SWITCH_TO_P1Pulse: turn goes to pump 1

Program

Ladder diagram (LD)

  1. Rung 1 — Water demand with hysteresis between the low and high switches.

    SYSTEMI0.0LEVEL_LOWI0.2DEMANDM0.0LEVEL_HIGHI0.3DEMANDM0.0
  2. Rung 2 — New cycle and it was pump 1's turn: it goes to pump 2.

    PDEMANDM0.0TURN_P2M0.1SWITCH_TO_P2M0.2
  3. Rung 3 — New cycle and it was pump 2's turn: it goes to pump 1.

    PDEMANDM0.0TURN_P2M0.1SWITCH_TO_P1M0.3
  4. Rung 4 — Turn switches to pump 2.

    SWITCH_TO_P2M0.2STURN_P2M0.1
  5. Rung 5 — Turn switches to pump 1.

    SWITCH_TO_P1M0.3RTURN_P2M0.1
  6. Rung 6 — Pump 1: in its turn, or as backup if pump 2 fails.

    DEMANDM0.0PUMP1_OKI0.4TURN_P2M0.1PUMP2_OKI0.5PUMP_1Q0.0
  7. Rung 7 — Pump 2: in its turn, or as backup if pump 1 fails.

    DEMANDM0.0PUMP2_OKI0.5TURN_P2M0.1PUMP1_OKI0.4PUMP_2Q0.1
  8. Rung 8 — Alarm on any fault.

    PUMP1_OKI0.4PUMP2_OKI0.5ALARMQ0.2

Step by step

  1. 1Press ▶ Run (F5) and turn on SYSTEM. DEMAND turns on at low level and stays on until high level, as in the tank example.
  2. 2Rungs 2 to 5: on each rising edge of DEMAND, TURN_P2 changes value. That way each filling is done by a different pump; see each pump's running time in the plant.
  3. 3Rungs 6 and 7: each pump runs in its turn, or in the other's turn if the other one has a fault. In the plant, press “Fault” on a pump and watch the other one back it up.
  4. 4Rung 8: any fault turns on the ALARM. Faults are read with the equipment's NC contacts: a broken wire also shows up as a fault.