Bird
Raised Fist0
PLC Programmingscripting~10 mins

Level control system in PLC Programming - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Level control system
Start
↓
Read Level Sensor
↓
Is Level < Low Limit?
Yes→Turn ON Pump
↓
Pump ON
↓
Is Level > High Limit?
Yes→Turn OFF Pump
↓
Pump OFF
↓
Wait & Repeat
↓
End or Loop
The system reads the tank level, turns the pump on if level is low, off if level is high, then repeats.
Execution Sample
PLC Programming
IF level < low_limit THEN
  pump := ON;
ELSIF level > high_limit THEN
  pump := OFF;
END_IF;
This PLC code turns the pump on if level is below low limit, off if above high limit.
Execution Table
StepLevelConditionActionPump State
13030 < 40? YesTurn ON PumpON
24545 < 40? NoCheck next conditionON
34545 > 60? NoNo changeON
46565 < 40? NoCheck next conditionON
56565 > 60? YesTurn OFF PumpOFF
65555 < 40? NoCheck next conditionOFF
75555 > 60? NoNo changeOFF
83535 < 40? YesTurn ON PumpON
9EndLoop ends or repeatsSystem waits for next cycleON
💡 Loop ends or repeats after checking all conditions for current level.
Variable Tracker
VariableStartAfter Step 1After Step 5After Step 8Final
level3030653535
pumpOFFONOFFONON
Key Moments - 2 Insights
Why does the pump turn ON at step 1 but stay ON at step 3 even though level is above low limit?
At step 1, level is below low limit, so pump turns ON. At step 3, level is above low limit but below high limit, so pump stays ON (no OFF condition met). See execution_table rows 1 and 3.
What happens if level is exactly equal to the low or high limit?
The conditions use < and >, so equal values do not trigger ON or OFF changes. Pump state remains as before. This avoids rapid switching at boundary values.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the pump state at step 5 when level is 65?
AON
BOFF
CNo change
DUndefined
💡 Hint
Check the 'Pump State' column at step 5 in the execution_table.
At which step does the pump turn ON after being OFF?
AStep 3
BStep 5
CStep 8
DStep 6
💡 Hint
Look for the step where pump state changes from OFF to ON in variable_tracker or execution_table.
If the low limit was changed to 50, what would happen at step 2 with level 45?
APump turns ON
BPump stays ON
CPump turns OFF
DNo change
💡 Hint
Compare level 45 with new low limit 50 and check condition logic in execution_table.
Concept Snapshot
Level Control System PLC Logic:
- Read level sensor value
- If level < low_limit, turn pump ON
- Else if level > high_limit, turn pump OFF
- Else keep pump state unchanged
- Repeat cycle continuously
Use simple IF-ELSIF-END_IF structure
Full Transcript
This level control system reads the tank level and controls a pump. If the level is below a low limit, the pump turns ON to fill the tank. If the level is above a high limit, the pump turns OFF to stop filling. If the level is between limits, the pump keeps its current state. The system repeats this check continuously to maintain the level within safe bounds. The execution table shows step-by-step how the pump state changes based on level readings. Key moments clarify why the pump stays ON between limits and how boundary values are handled. The visual quiz tests understanding of pump state changes at different steps and how changing limits affects behavior.

Practice

(1/5)
1. What is the main purpose of a level control system in a tank?
easy
A. To measure the temperature of the liquid
B. To keep the liquid level within safe limits automatically
C. To change the color of the liquid
D. To increase the pressure inside the tank

Solution

  1. Step 1: Understand the system goal

    A level control system is designed to maintain liquid levels safely.
  2. Step 2: Identify the correct function

    It uses sensors and pumps to keep levels steady, not temperature or color.
  3. Final Answer:

    To keep the liquid level within safe limits automatically -> Option B
  4. Quick Check:

    Level control = safe liquid level [OK]
Hint: Focus on what 'level control' means in real life [OK]
Common Mistakes:
  • Confusing level control with temperature control
  • Thinking it changes liquid properties
  • Assuming it controls pressure
2. Which of the following is the correct simple IF statement to turn ON a pump when the level is below 30%?
easy
A. IF level = 30 THEN pump = OFF;
B. IF level > 30 THEN pump = ON;
C. IF level < 30 THEN pump = ON;
D. IF level <= 30 THEN pump = OFF;

Solution

  1. Step 1: Understand the condition for turning pump ON

    The pump should turn ON when level is below 30% to fill the tank.
  2. Step 2: Match the correct syntax

    IF level < 30 THEN pump = ON; correctly uses IF level < 30 THEN pump = ON;
  3. Final Answer:

    IF level < 30 THEN pump = ON; -> Option C
  4. Quick Check:

    Turn ON pump if level less than 30% [OK]
Hint: Pump ON when level is less, so use '<' operator [OK]
Common Mistakes:
  • Using > instead of < for turning pump ON
  • Confusing ON and OFF states
  • Using equality instead of inequality
3. Given this PLC logic snippet:
IF level < 40 THEN pump = ON;
ELSE pump = OFF;

What will be the pump state if the level sensor reads 45?
medium
A. Pump will be ON
B. Pump will stay in previous state
C. Pump state will toggle rapidly
D. Pump will be OFF

Solution

  1. Step 1: Check the condition with level = 45

    Since 45 is not less than 40, the IF condition is false.
  2. Step 2: Follow the ELSE branch

    Because IF is false, pump = OFF is executed.
  3. Final Answer:

    Pump will be OFF -> Option D
  4. Quick Check:

    Level 45 ≥ 40 means pump OFF [OK]
Hint: Check IF condition with given value carefully [OK]
Common Mistakes:
  • Assuming pump stays ON without checking ELSE
  • Confusing < and > operators
  • Ignoring ELSE branch
4. Identify the error in this PLC code snippet for level control:
IF level > 70 THEN pump = ON;
ELSE pump = ON;
medium
A. Pump is always ON regardless of level
B. Syntax error: missing ENDIF
C. Pump never turns ON
D. Level sensor value is not checked

Solution

  1. Step 1: Analyze the IF and ELSE assignments

    Both IF and ELSE branches set pump = ON, so pump is always ON.
  2. Step 2: Understand the logic flaw

    This means pump never turns OFF, ignoring level changes.
  3. Final Answer:

    Pump is always ON regardless of level -> Option A
  4. Quick Check:

    Same action in IF and ELSE means no control [OK]
Hint: Check if IF and ELSE do different things [OK]
Common Mistakes:
  • Thinking ELSE is missing
  • Assuming pump turns OFF somewhere
  • Ignoring logic duplication
5. You want to design a level control system that turns ON the pump when level is below 30%, turns OFF when above 70%, and keeps the pump state unchanged between 30% and 70%. Which logic correctly implements this?
hard
A. IF level < 30 THEN pump = ON; ELSE IF level > 70 THEN pump = OFF;
B. IF level <= 70 THEN pump = OFF; ELSE pump = ON;
C. IF level < 30 THEN pump = ON; ELSE pump = OFF;
D. IF level > 70 THEN pump = ON; ELSE IF level < 30 THEN pump = OFF;

Solution

  1. Step 1: Understand the required behavior

    Turn pump ON below 30%, OFF above 70%, and keep state unchanged between 30% and 70%.
  2. Step 2: Analyze each option

    IF level < 30 THEN pump = ON; ELSE IF level > 70 THEN pump = OFF; turns ON if level < 30, OFF if level > 70, and does nothing in between (keeps state).
  3. Final Answer:

    IF level < 30 THEN pump = ON; ELSE IF level > 70 THEN pump = OFF; -> Option A
  4. Quick Check:

    Two conditions control pump ON/OFF, else no change [OK]
Hint: Use two IFs for ON and OFF, no ELSE for unchanged [OK]
Common Mistakes:
  • Turning pump OFF immediately below 70%
  • Not handling the middle range correctly
  • Reversing ON and OFF conditions
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard