Time-Series Data and Aggregation
📊 Module 3: Real-Time Telemetry
Time-Series Data and Aggregation
Grid telemetry generates enormous volumes of time-series data: sequences of (timestamp, value) pairs at regular or irregular intervals. Efficiently storing, querying, and aggregating this data is a core competency for energy software platforms.
Data Volumes
Consider a typical grid deployment:
- 500 devices x 20 data points each x 1-second resolution = 10,000 data points per second = 864 million points per day
- At 16 bytes per point (8-byte timestamp + 8-byte float), that is 13.8 GB per day raw
Strategies for managing this volume:
- Down-sampling at the edge: Reduce 1-second data to 15-second or 1-minute averages before transmission
- Compression: Delta encoding, run-length encoding, or dictionary compression for repeated values
- Tiered storage: Hot (1 day, 1-second resolution) -> Warm (30 days, 1-minute) -> Cold (years, 15-minute)
Aggregation Functions
Common aggregation functions for energy data:
- Average: Mean value over the interval. Appropriate for continuous signals (voltage, frequency).
- Weighted average: Power-weighted average for quantities like power factor.
- Sum/Integration: Total energy (kWh) = integral of power (kW) over time. Use the trapezoidal rule for accurate integration.
- Min/Max: Peak values within the interval. Essential for demand charges (peak kW).
- Count: Number of events (alarms, switching operations) in the interval.
Time Alignment
Energy data comes from devices with different reporting intervals and clock accuracies. Aligning data to uniform time boundaries is critical:
Raw data: 10:00:01.234 | 10:00:03.891 | 10:00:05.002
Aligned (5s): 10:00:00.000 | 10:00:05.000 | 10:00:10.000Use snap-to-grid alignment: assign each raw point to its nearest boundary, then aggregate within each bucket. Handle edge cases:
- No data in a bucket: Interpolate from adjacent buckets or mark as gap
- Multiple points in a bucket: Apply the aggregation function (average, last, etc.)
Demand Intervals
Utilities measure demand in 15-minute intervals (standard in most markets). The demand value is the average power over the interval:
Demand (kW) = Energy in interval (kWh) / Interval duration (hours)
Demand (kW) = Energy in 15 min (kWh) / 0.25 (hours)Peak demand (the highest 15-minute interval in a billing period) drives demand charges, which can represent 30-70% of a commercial electricity bill.
Rolling Calculations
Useful rolling calculations for grid operations:
- Rolling average (5 min, 15 min, 1 hour): Smooths out transients for trend analysis
- Rate of change (dP/dt): Detects ramps. Solar ramp rate exceeding 10% per minute triggers mitigation.
- Moving standard deviation: Detects volatility. High volatility indicates unstable generation or load.
Storage Architectures
| Architecture | Strengths | Weaknesses | Examples |
|---|---|---|---|
| TimescaleDB | PostgreSQL compatible, hypertables, continuous aggregates | Single-node scaling | TimescaleDB |
| InfluxDB | Purpose-built, high ingest rate, flux query language | Proprietary clustering | InfluxDB |
| PostgreSQL + partitioning | Mature, ACID, range partitioning by time | Manual partition management | PostgreSQL 14+ |
| ClickHouse | Column-oriented, extremely fast aggregation | Less mature ecosystem | ClickHouse |
EnergyAtIt uses PostgreSQL with time-based partitioning for telemetry storage and pre-computed materialized views for common aggregation queries.
Log in to track your progress and earn certifications.