📖 Scenario: You work in a factory that uses a SCADA system to monitor machines. The factory must report compliance data about machine statuses every day to meet safety rules.This project helps you create a simple compliance report from machine data.
🎯 Goal: Build a small program that collects machine status data, sets a compliance threshold, filters machines that meet the threshold, and prints a compliance report.
📋 What You'll Learn
Create a dictionary with machine names and their status scores
Add a compliance threshold variable
Filter machines that meet or exceed the threshold
Print the list of compliant machines
💡 Why This Matters
🌍 Real World
Factories and industrial plants use SCADA systems to monitor machine health and ensure safety compliance. Automated reports help managers quickly see which machines meet safety standards.
💼 Career
Understanding how to process and report compliance data is important for roles in industrial automation, operations, and DevOps for manufacturing systems.
Progress0 / 4 steps
1
Create machine status data
Create a dictionary called machine_status with these exact entries: 'Pump1': 85, 'Valve2': 78, 'Conveyor3': 92, 'Sensor4': 70, 'Motor5': 88
SCADA systems
Hint
Use curly braces to create a dictionary with the exact machine names and scores.
2
Set compliance threshold
Add a variable called threshold and set it to 80 to represent the minimum status score for compliance.
SCADA systems
Hint
Just create a variable named threshold and assign it the value 80.
3
Filter compliant machines
Create a list called compliant_machines that contains the names of machines from machine_status whose status score is greater than or equal to threshold. Use a list comprehension with for machine, score in machine_status.items().
SCADA systems
Hint
Use a list comprehension to check each machine's score against the threshold.
4
Print compliance report
Print the text "Compliant machines:" followed by the compliant_machines list on the next line using two separate print statements.
SCADA systems
Hint
Use two print statements: one for the label and one for the list.
Practice
(1/5)
1. What is the main purpose of compliance reporting in SCADA systems?
easy
A. To backup all system files automatically
B. To increase the speed of data processing
C. To reduce the number of sensors in the system
D. To prove the system follows safety and regulatory rules
Solution
Step 1: Understand compliance reporting
Compliance reporting is about showing that the system meets required rules and standards.
Step 2: Identify the main goal
The main goal is to prove the system follows safety and regulatory rules to ensure safe operation and legal compliance.
Final Answer:
To prove the system follows safety and regulatory rules -> Option D
Quick Check:
Compliance reporting = Prove rules followed [OK]
Hint: Compliance reports show rule-following, not speed or backups [OK]
Common Mistakes:
Confusing compliance with performance optimization
Thinking compliance reports reduce hardware
Assuming compliance reports are for backups
2. Which command syntax correctly generates a compliance report for SCADA system 'PlantA' from 2024-01-01 to 2024-01-31 and saves it to '/reports/january.pdf'?
easy
A. generate_report --system PlantA --start 2024-01-01 --end 2024-01-31 --output /reports/january.pdf
B. report_generate -system=PlantA -from=2024-01-01 -to=2024-01-31 -file=/reports/january.pdf
C. createReport PlantA 2024-01-01 2024-01-31 /reports/january.pdf
D. make_report system=PlantA start=2024-01-01 end=2024-01-31 output=/reports/january.pdf
Solution
Step 1: Check command structure
The correct command uses clear flags: --system, --start, --end, --output with proper values.
Step 2: Match syntax to options
generate_report --system PlantA --start 2024-01-01 --end 2024-01-31 --output /reports/january.pdf matches the expected syntax exactly with correct flags and values.
Correct flags and order = generate_report --system PlantA --start 2024-01-01 --end 2024-01-31 --output /reports/january.pdf [OK]
Hint: Look for double dashes and clear flag names [OK]
Common Mistakes:
Using single dashes instead of double
Mixing flag names or missing equals signs
Wrong order or missing output path
3. Given the command generate_report --system PlantB --start 2024-02-01 --end 2024-02-28 --output /reports/february.pdf, what will be the expected result?
medium
A. A report for PlantB but only for one day, 2024-02-01
B. A PDF report for PlantB covering February 2024 saved at /reports/february.pdf
C. An error because the output path is missing
D. A CSV report instead of PDF
Solution
Step 1: Analyze command parameters
The command specifies system PlantB, start and end dates for February 2024, and output file path ending with .pdf.
Step 2: Determine expected output
The command should generate a PDF report for the full date range and save it to the given path.
Final Answer:
A PDF report for PlantB covering February 2024 saved at /reports/february.pdf -> Option B
Quick Check:
Correct dates and output path = PDF report [OK]
Hint: Check date range and output file extension carefully [OK]
Common Mistakes:
Assuming output path is missing or wrong
Thinking report covers only one day
Confusing file format from extension
4. You run the command generate_report --system PlantC --start 2024-03-01 --end 2024-02-28 --output /reports/march.pdf but get an error. What is the most likely cause?
medium
A. The output file path is invalid
B. The system name PlantC is not recognized
C. The end date is before the start date
D. The command is missing the --format flag
Solution
Step 1: Check date parameters
The start date is 2024-03-01 but the end date is 2024-02-28, which is before the start date.
Step 2: Identify error cause
Most systems reject date ranges where the end date is earlier than the start date, causing an error.
Final Answer:
The end date is before the start date -> Option C
Quick Check:
End date < start date = Error [OK]
Hint: Check if end date is after start date [OK]
Common Mistakes:
Ignoring date order and assuming output path error
Assuming system name error without checking dates
Thinking a missing format flag causes this error
5. You need to automate monthly compliance reports for three SCADA systems: PlantX, PlantY, and PlantZ. Which approach best ensures reports are generated correctly and saved with clear filenames?
hard
A. Write a script that loops over system names and dates, generating reports with filenames like 'PlantX_2024-04.pdf'
B. Manually run the generate_report command for each system every month
C. Generate one report for all systems combined without separate files
D. Use a single command with all system names and one output file
Solution
Step 1: Understand automation needs
Automating means using a script to repeat commands for each system and date range.
Step 2: Choose clear file naming
Using filenames with system name and date like 'PlantX_2024-04.pdf' keeps reports organized and easy to find.
Final Answer:
Write a script that loops over system names and dates, generating reports with filenames like 'PlantX_2024-04.pdf' -> Option A
Quick Check:
Automation + clear filenames = Write a script that loops over system names and dates, generating reports with filenames like 'PlantX_2024-04.pdf' [OK]
Hint: Automate with loops and clear file names [OK]
Common Mistakes:
Running commands manually each month
Combining all systems into one report file
Using unclear or generic filenames
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.