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?"