📖 Scenario: You are working in an industrial automation company. Your task is to create a simple program that represents the basic hardware components of a PLC system: the CPU, the input/output (I/O) modules, and the power supply. This will help new technicians understand how these parts are organized and connected.
🎯 Goal: Build a simple PLC hardware model using variables to represent the CPU, I/O modules, and power supply. Then, write a script to display the status of each component.
📋 What You'll Learn
Create variables for CPU, I/O modules, and power supply with exact names and values
Add a configuration variable to represent the number of I/O modules
Use a loop to simulate checking each I/O module status
Print the status of CPU, power supply, and all I/O modules
💡 Why This Matters
🌍 Real World
Technicians and engineers often need to understand and document the hardware setup of PLC systems before programming or troubleshooting.
💼 Career
Knowing how to represent and check PLC hardware components in code helps automation professionals prepare for real-world system configuration and diagnostics.
Progress0 / 4 steps
1
Create PLC hardware components variables
Create three variables with exact names and values: cpu set to "CPU Model X1", power_supply set to "24V DC", and io_modules as a list with these exact strings: "Input Module", "Output Module", "Analog Module".
PLC Programming
Hint
Use simple variable assignments. The io_modules is a list with three exact strings.
2
Add configuration for number of I/O modules
Create a variable called num_io_modules and set it to the length of the io_modules list.
PLC Programming
Hint
Use the len() function to get the number of items in the list.
3
Check status of each I/O module
Use a for loop with variable index to iterate from 0 to num_io_modules - 1. Inside the loop, create a variable module_status and set it to the string "OK" for each module.
PLC Programming
Hint
Use range(num_io_modules) to loop over all modules by index.
4
Print the status of CPU, power supply, and I/O modules
Print the cpu and power_supply variables. Then use a for loop with variable index from 0 to num_io_modules - 1 to print each I/O module name from io_modules and its status "OK".
PLC Programming
Hint
Use print() with f-strings to show the variables and loop through the modules again to print their status.
Practice
(1/5)
1. Which part of a PLC acts as the brain, processing all instructions?
easy
A. Input module
B. Power supply
C. CPU
D. Output module
Solution
Step 1: Understand the role of CPU in PLC
The CPU processes instructions and controls the PLC operation.
Hint: CPU is the brain that thinks and controls [OK]
Common Mistakes:
Confusing power supply with CPU
Thinking input module processes data
Mixing output module with CPU
2. Which of the following is the correct symbol for the power supply in a PLC diagram?
easy
A. A box labeled 'PS' or 'Power Supply'
B. A circle labeled 'I/O'
C. An arrow pointing to output devices
D. A rectangle labeled 'CPU'
Solution
Step 1: Identify common PLC diagram symbols
Power supply is usually shown as a box labeled 'PS' or 'Power Supply'.
Step 2: Eliminate other options
CPU is labeled 'CPU', I/O is not a circle, arrows show signal flow not power supply.
Final Answer:
A box labeled 'PS' or 'Power Supply' -> Option A
Quick Check:
Power supply symbol = Box labeled PS [OK]
Hint: Power supply is labeled 'PS' in diagrams [OK]
Common Mistakes:
Choosing CPU box as power supply
Confusing arrows with power supply
Thinking I/O is power supply symbol
3. Given a PLC with 8 input sensors connected to the input module and 6 output devices connected to the output module, what is the total number of I/O points?
medium
A. 48
B. 8
C. 6
D. 14
Solution
Step 1: Understand I/O points
I/O points are the sum of input points and output points connected to the PLC.
Step 2: Calculate total I/O points
8 inputs + 6 outputs = 14 total I/O points.
Final Answer:
14 -> Option D
Quick Check:
8 + 6 = 14 I/O points [OK]
Hint: Add input and output counts for total I/O [OK]
Common Mistakes:
Counting only inputs
Counting only outputs
Multiplying inputs by outputs
4. A PLC system is not powering on. Which of the following is the most likely hardware issue?
medium
A. Faulty CPU
B. Disconnected power supply
C. Broken output module
D. Input module error
Solution
Step 1: Analyze symptoms
PLC not powering on means no power is reaching the system.
Step 2: Identify hardware responsible for power
The power supply provides energy; if disconnected or faulty, PLC won't start.
Final Answer:
Disconnected power supply -> Option B
Quick Check:
No power = Power supply issue [OK]
Hint: No power means check power supply first [OK]
Common Mistakes:
Blaming CPU when no power
Assuming output module stops power
Ignoring power supply connection
5. You need to expand a PLC system to control 12 new sensors and 10 new actuators. Which hardware components must you add to the existing PLC setup?
hard
A. Add input and output modules
B. Add more CPU units
C. Add extra power supplies only
D. Replace the existing CPU with a bigger one
Solution
Step 1: Identify hardware for sensors and actuators
Sensors connect to input modules; actuators connect to output modules.
Step 2: Determine what to add
To handle more devices, add input modules for sensors and output modules for actuators.
Step 3: Consider CPU and power supply
CPU usually handles more modules without replacement; power supply may need upgrade but not always.
Final Answer:
Add input and output modules -> Option A
Quick Check:
More devices = Add I/O modules [OK]
Hint: Add I/O modules to handle more devices [OK]
Common Mistakes:
Thinking CPU must be replaced
Adding only power supplies
Adding CPU units instead of modules
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.