Polling vs report-by-exception in SCADA systems - Performance Comparison
We want to understand how the time cost changes when a SCADA system checks data regularly versus only when changes happen.
How does the method of getting data affect the work done as the system grows?
Analyze the time complexity of the following code snippet.
// Polling method
while (true) {
for (int i = 0; i < sensors.count; i++) {
readData(sensors[i]);
}
wait(pollInterval);
}
// Report-by-exception method
onDataChange(sensor) {
sendUpdate(sensor);
}
This code shows two ways to get sensor data: polling all sensors regularly, or only sending data when a sensor changes.
Identify the loops, recursion, array traversals that repeat.
- Primary operation: Polling loops over all sensors repeatedly; report-by-exception triggers only on changes.
- How many times: Polling runs for every poll interval over all sensors; report-by-exception runs only when a sensor changes.
Explain the growth pattern intuitively.
| Input Size (n) | Approx. Operations (Polling) | Approx. Operations (Report-by-exception) |
|---|---|---|
| 10 sensors | 10 reads per poll | Depends on changes, possibly fewer |
| 100 sensors | 100 reads per poll | Depends on changes, often fewer than 100 |
| 1000 sensors | 1000 reads per poll | Depends on changes, usually much fewer than 1000 |
Pattern observation: Polling work grows directly with number of sensors every time. Report-by-exception work grows only with how many sensors change.
Time Complexity: O(n)
This means polling checks every sensor each time, so work grows linearly with sensor count. Report-by-exception work depends on changes, not total sensors.
[X] Wrong: "Report-by-exception always uses less time than polling because it only sends updates on changes."
[OK] Correct: If many sensors change often, report-by-exception can generate as much or more work than polling.
Understanding how data collection methods scale helps you design efficient systems and explain your choices clearly in real projects.
"What if sensors report changes in batches instead of individually? How would that affect the time complexity?"
Practice
Solution
Step 1: Understand polling behavior
Polling means the system asks for data at fixed times, regardless of changes.Step 2: Understand report-by-exception behavior
Report-by-exception sends data only when there is a change or event to report.Final Answer:
Polling requests data regularly; report-by-exception sends data only on changes. -> Option CQuick Check:
Polling = regular requests, Report-by-exception = event-driven [OK]
- Confusing which method sends data regularly
- Thinking both methods behave the same
- Assuming report-by-exception always uses more bandwidth
Solution
Step 1: Identify correct syntax format
Configuration files often use key = 'value' format with quotes for time strings.Step 2: Check each option for syntax correctness
polling_interval = '5s' # Poll every 5 seconds uses correct key, equals sign, and quotes with valid time unit '5s'. Others have syntax errors or invalid formats.Final Answer:
polling_interval = '5s' # Poll every 5 seconds -> Option BQuick Check:
Correct config syntax uses key = 'value' [OK]
- Using spaces instead of underscores in keys
- Missing quotes around time values
- Using colons instead of equals sign
polling_interval = 10 # seconds
last_value = 100
current_value = 100
if current_value != last_value:
send_report()
else:
wait(polling_interval)What will happen when this code runs?
Solution
Step 1: Analyze the condition
The code compares current_value and last_value; if different, it calls send_report().Step 2: Check values given
Both values are 100, so condition is false; else branch waits for polling_interval.Final Answer:
send_report() is called only if current_value changes from last_value. -> Option DQuick Check:
Report sent only on value change [OK]
- Assuming send_report() runs every time
- Ignoring the if condition logic
- Thinking wait() causes an error
Solution
Step 1: Understand report-by-exception behavior
It sends data only when exceptions or changes occur and reporting is enabled.Step 2: Identify cause of no updates
If no updates are sent despite changes, reporting is likely disabled or misconfigured.Final Answer:
Exception reporting is disabled or misconfigured. -> Option AQuick Check:
Disabled reporting stops updates [OK]
- Confusing polling interval with report-by-exception
- Assuming high bandwidth stops updates
- Thinking frequent polling affects exception reporting
Solution
Step 1: Analyze network load and alert needs
Polling often increases network load; report-by-exception reduces it by sending only changes.Step 2: Combine methods for best result
Using report-by-exception for normal data saves bandwidth, while polling ensures critical alerts are checked regularly.Final Answer:
Use report-by-exception for normal data and polling for critical alerts. -> Option AQuick Check:
Combine polling and exception reporting for efficiency [OK]
- Using polling only causes high network load
- Ignoring critical alert needs
- Relying solely on report-by-exception may miss urgent data
Ready to prove it?
Pass the test and this pattern moves unknown
