Historian architecture overview in SCADA systems - Time & Space Complexity
When we look at historian architecture, we want to understand how the system handles data over time.
We ask: How does the work grow as more data points come in?
Analyze the time complexity of the data collection and storage loop.
// Pseudocode for historian data collection
for each sensor in sensors:
data = read_sensor(sensor)
store_data(data)
// Periodically archive old data
archive_old_data()
This code reads data from each sensor and stores it, then archives old data periodically.
Look for loops or repeated actions.
- Primary operation: Loop over all sensors to read and store data.
- How many times: Once per sensor each cycle.
As the number of sensors grows, the work grows too.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | 10 reads and stores |
| 100 | 100 reads and stores |
| 1000 | 1000 reads and stores |
Pattern observation: The work grows directly with the number of sensors.
Time Complexity: O(n)
This means the time to collect and store data grows in a straight line as sensors increase.
[X] Wrong: "Adding more sensors won't affect performance much because data collection is fast."
[OK] Correct: Each sensor adds work, so more sensors mean more time needed to read and store data.
Understanding how data collection scales helps you design systems that stay reliable as they grow.
"What if the system batches sensor data before storing? How would the time complexity change?"