SCADA Applications for Water, Power, and Oil & Gas
📖 Scenario: You are working as a junior DevOps engineer supporting a SCADA system that monitors critical infrastructure: water supply, power grid, and oil & gas pipelines. Your task is to create a simple data structure representing sensor readings from these three sectors, configure alert thresholds, process the data to find sensors exceeding thresholds, and finally display the alerting sensors.
🎯 Goal: Build a small SCADA data monitoring script that stores sensor readings, sets alert thresholds, identifies sensors with readings above thresholds, and prints the alerting sensors.
📋 What You'll Learn
Create a dictionary named sensor_readings with exact sensor names and their readings
Create a dictionary named alert_thresholds with exact threshold values for each sector
Write a loop to find sensors with readings above their sector's threshold
Print the list of alerting sensors with their readings
💡 Why This Matters
🌍 Real World
SCADA systems monitor critical infrastructure like water supply, power grids, and oil pipelines to ensure safety and efficiency.
💼 Career
DevOps engineers supporting SCADA systems need to handle sensor data, configure alerts, and automate monitoring tasks to prevent failures.
Progress0 / 4 steps
1
Create sensor readings dictionary
Create a dictionary called sensor_readings with these exact entries: 'water_sensor_1': 75, 'water_sensor_2': 55, 'power_sensor_1': 120, 'power_sensor_2': 95, 'oil_sensor_1': 85, 'oil_sensor_2': 65.
SCADA systems
Hint
Use a Python dictionary with sensor names as keys and their readings as values.
2
Set alert thresholds for each sector
Create a dictionary called alert_thresholds with these exact entries: 'water': 60, 'power': 100, 'oil': 80.
SCADA systems
Hint
Use a dictionary with sector names as keys and threshold values as integers.
3
Find sensors exceeding thresholds
Create a list called alerting_sensors that contains tuples of sensor name and reading for sensors whose reading is greater than their sector's threshold. Use a for loop with variables sensor and reading to iterate over sensor_readings.items(). Determine the sector by splitting the sensor name at the underscore and use it to compare with alert_thresholds.
SCADA systems
Hint
Use a loop to check each sensor's reading against its sector threshold and add to the list if above.
4
Print alerting sensors
Write a print statement to display the alerting_sensors list.
SCADA systems
Hint
Use print(alerting_sensors) to show the sensors that triggered alerts.
Practice
(1/5)
1. What is the primary purpose of a SCADA system in water, power, or oil industries?
easy
A. To store historical data only without real-time access
B. To monitor and control critical infrastructure in real-time
C. To replace human operators completely
D. To design new hardware components
Solution
Step 1: Understand SCADA system role
SCADA systems are designed to monitor and control infrastructure like water, power, and oil systems in real-time.
Step 2: Eliminate unrelated options
Designing hardware, replacing humans fully, or only storing data do not describe SCADA's main function.
Final Answer:
To monitor and control critical infrastructure in real-time -> Option B
Quick Check:
SCADA = real-time monitoring and control [OK]
Hint: SCADA means real-time control and monitoring [OK]
Common Mistakes:
Thinking SCADA designs hardware
Assuming SCADA replaces all human operators
Believing SCADA only stores data without control
2. Which of the following is the correct way to configure an alarm threshold in a SCADA system for water pressure?
easy
A. alarm_threshold > 50 psi
B. alarm_threshold == 50 psi
C. alarm_threshold := '50 psi'
D. Set alarm_threshold = 50 psi
Solution
Step 1: Identify correct assignment syntax
In SCADA configuration, setting a threshold uses assignment with =, not comparison or other operators.
Step 2: Check option formats
Set alarm_threshold = 50 psi uses correct assignment syntax with a numeric value and unit.
Final Answer:
Set alarm_threshold = 50 psi -> Option D
Quick Check:
Assignment uses = in config [OK]
Hint: Use single = for setting values in SCADA configs [OK]
Common Mistakes:
Using == which is a comparison, not assignment
Using := which is not standard in SCADA configs
Using > which is a condition, not assignment
3. Given this SCADA script snippet monitoring oil flow rate:
What will be the value of alarm if flow_rate is 800?
medium
A. 'High flow rate'
B. Error: flow_rate undefined
C. 'Normal'
D. 'Low flow rate'
Solution
Step 1: Evaluate the condition with flow_rate = 800
Since 800 is not greater than 1000, the condition is false.
Step 2: Determine the else branch result
Because the condition is false, the else block sets alarm to 'Normal'.
Final Answer:
'Normal' -> Option C
Quick Check:
800 <= 1000 means alarm = 'Normal' [OK]
Hint: Check if condition is true or false to pick alarm [OK]
Common Mistakes:
Assuming 800 > 1000 is true
Confusing else with if block
Expecting error when variable is defined
4. A SCADA script to check power voltage is:
if voltage < 220
alarm = 'Low voltage'
What is the error in this script?
medium
A. Missing colon ':' after the if condition
B. Using < instead of >
C. alarm variable not declared
D. No error, script is correct
Solution
Step 1: Check syntax of if statement
In Python-like SCADA scripts, the if condition must end with a colon ':' to define the block.
Step 2: Identify missing colon
The script misses ':' after 'if voltage < 220', causing syntax error.
Final Answer:
Missing colon ':' after the if condition -> Option A
Quick Check:
if statements require ':' [OK]
Hint: Always put ':' after if condition in SCADA scripts [OK]
Common Mistakes:
Ignoring missing colon syntax
Thinking < should be >
Assuming variable declaration needed explicitly
5. In a SCADA system for oil pipelines, you want to trigger an alarm only if the pressure is above 500 psi and the temperature is above 100°C. Which condition correctly implements this?
hard
A. if pressure > 500 and temperature > 100:
B. if pressure > 500 or temperature > 100:
C. if pressure > 500 and temperature < 100:
D. if pressure < 500 and temperature > 100:
Solution
Step 1: Understand the requirement
The alarm triggers only when both pressure is above 500 psi AND temperature is above 100°C.
Step 2: Match condition with logical operators
Logical AND (and) ensures both conditions must be true; OR (or) would trigger if either is true.
Step 3: Evaluate options
if pressure > 500 and temperature > 100: uses 'and' with correct comparison operators, matching the requirement.
Final Answer:
if pressure > 500 and temperature > 100: -> Option A
Quick Check:
Both conditions must be true = use AND [OK]
Hint: Use AND to require both conditions true [OK]
Common Mistakes:
Using OR instead of AND
Mixing comparison operators incorrectly
Triggering alarm on wrong condition
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.