Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Trend analysis and reporting
📖 Scenario: You work with a SCADA system that collects temperature readings from multiple sensors every hour. Your task is to analyze the temperature trends and generate a simple report showing average temperatures per sensor.
🎯 Goal: Build a small program that stores hourly temperature data for sensors, configures a threshold for reporting, calculates average temperatures per sensor, and prints a summary report.
📋 What You'll Learn
Create a dictionary with sensor names as keys and lists of hourly temperature readings as values
Add a threshold variable to filter sensors with average temperature above this value
Calculate the average temperature per sensor using a loop
Print a report listing sensors with average temperature above the threshold
💡 Why This Matters
🌍 Real World
SCADA systems monitor industrial sensors and analyze trends to detect anomalies or optimize processes.
💼 Career
DevOps engineers often automate data collection and reporting pipelines for monitoring system health and performance.
Progress0 / 4 steps
1
Create sensor temperature data
Create a dictionary called sensor_data with these exact entries: 'SensorA': [22.5, 23.0, 22.8], 'SensorB': [19.0, 18.5, 19.2], 'SensorC': [25.1, 24.8, 25.3]
SCADA systems
Hint
Use a dictionary with sensor names as keys and lists of floats as values.
2
Add temperature threshold
Create a variable called threshold and set it to 22.0 to filter sensors with average temperature above this value
SCADA systems
Hint
Just assign the number 22.0 to a variable named threshold.
3
Calculate average temperatures
Create a new dictionary called average_temps that stores the average temperature for each sensor using a for loop with variables sensor and temps iterating over sensor_data.items()
SCADA systems
Hint
Use a for loop to calculate the average by summing the list and dividing by its length.
4
Print sensors above threshold
Use a for loop with variables sensor and avg iterating over average_temps.items() to print lines like SensorA: 22.77 only if avg is greater than threshold. Use print(f"{sensor}: {avg:.2f}") to format the output.
SCADA systems
Hint
Loop over average_temps and print only if average is above threshold using formatted string.
Practice
(1/5)
1. What is the main purpose of trend analysis in SCADA systems?
easy
A. To configure hardware devices
B. To track changes in data over time
C. To write code for automation
D. To backup system files
Solution
Step 1: Understand trend analysis concept
Trend analysis means observing how data changes over a period.
Step 2: Match purpose with options
Only tracking data changes over time fits the definition of trend analysis.
Final Answer:
To track changes in data over time -> Option B
Quick Check:
Trend analysis = track data changes [OK]
Hint: Trend analysis = watching data over time [OK]
Common Mistakes:
Confusing trend analysis with system backup
Thinking it configures devices
Mixing it with coding tasks
2. Which of the following is the correct command to generate a trend report in a SCADA system CLI?
easy
A. generate_trend_report --start 2024-01-01 --end 2024-01-31
B. trend report create start=2024-01-01 end=2024-01-31
C. create report trend from 2024-01-01 to 2024-01-31
D. report --trend --from 2024-01-01 --to 2024-01-31
Solution
Step 1: Identify correct command syntax
SCADA CLI commands usually follow verb_action --option value format.
Step 2: Compare options
generate_trend_report --start 2024-01-01 --end 2024-01-31 matches the expected syntax with clear flags and dates.
Final Answer:
generate_trend_report --start 2024-01-01 --end 2024-01-31 -> Option A