AI Energy Grid Monitoring: Anomaly Detection and Forecasting

We design and deploy artificial intelligence systems: from prototype to production-ready solutions. Our team combines expertise in machine learning, data engineering and MLOps to make AI work not in the lab, but in real business.
Showing 1 of 1All 1566 services
AI Energy Grid Monitoring: Anomaly Detection and Forecasting
Medium
~1-2 weeks
Frequently Asked Questions

AI Development Areas

AI Solution Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1317
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1226
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    925
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1156
  • image_logo-advance_0.webp
    B2B Advance company logo design
    620
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    894

AI System for Power Grid Monitoring: From Telemetry to Alerts

A power grid is critical infrastructure: an anomaly within seconds can cascade into a blackout. Dispatchers receive thousands of signals per minute — SCADA every 4 seconds, PMU 50 times per second. Humans cannot analyze such flow in time. We build AI systems that detect voltage, frequency deviations, overloads, and theft in real time — before they become emergencies. This article breaks down the architecture of such a solution: from data collection to dispatcher alerts. We show which models we use (Gradient Boosting, LSTM, Transformer) and how we integrate with existing EMS/SCADA. If you want to reduce losses by 15–30% and prevent downtime, this text is for you. Our experience: 10+ years in energy and machine learning, solutions deployed at 12 substations 110–330 kV.

Why Traditional Monitoring Methods Fall Short

SCADA systems use threshold detectors: voltage exceeds 110% — alarm. But that is insufficient.

  • False positives: thresholds often trip on short-term spikes (switching, motor starts). Dispatchers ignore alerts.
  • Missed anomalies: slow frequency drifts (0.1 Hz/min) go unnoticed but lead to network collapse.
  • No prediction: thresholds cannot forecast tomorrow's overload.

AI replaces thresholds with probabilistic models that consider context: time of day, temperature, history. Detection accuracy rises from 60–70% to 95%+, false alarms decrease by 5x. Savings from unaccounted losses — up to 30%.

How AI Detects Anomalies: Real Code

Telemetry Sources

Data is collected from multiple sources at different rates:

data_streams = {
    'pmu_synchrophasors': {
        'frequency': '50 Hz (50 readings/sec)',
        'measures': ['voltage_magnitude', 'voltage_angle', 'current_magnitude',
                     'frequency', 'ROCOF'],  # Rate of Change of Frequency
        'standard': 'IEEE C37.118'
    },
    'scada_ems': {
        'frequency': '4 seconds',
        'measures': ['active_power_mw', 'reactive_power_mvar', 'transformer_load_pct',
                     'bus_voltage_kv', 'line_current_a']
    },
    'smart_meters': {
        'frequency': '15 minutes',
        'measures': ['energy_kwh', 'peak_demand', 'power_factor']
    },
    'weather': {
        'frequency': '10 minutes',
        'measures': ['temperature', 'wind_speed', 'solar_irradiance', 'humidity']
    }
}

Frequency and Voltage Deviation Detection

The class below analyzes each PMU sample: checks frequency deviation (normal ±0.2 Hz), voltage (±10%), and rate of change of frequency (ROCOF). When thresholds are exceeded, it generates an event with critical/warning severity.

import numpy as np

class PowerQualityMonitor:
    # Standards: GOST 32144-2013 / EN 50160
    FREQ_NOMINAL = 50.0      # Hz
    FREQ_TOLERANCE = 0.2     # ±0.2 Hz normal
    VOLTAGE_TOLERANCE = 0.10 # ±10% of nominal

    def __init__(self, nominal_voltage_kv: float):
        self.nominal_voltage = nominal_voltage_kv
        self.history = []

    def analyze_sample(self, timestamp, voltage_kv: float,
                       frequency_hz: float, current_a: float) -> dict:
        events = []

        # Frequency deviation
        freq_deviation = abs(frequency_hz - self.FREQ_NOMINAL)
        if freq_deviation > self.FREQ_TOLERANCE:
            events.append({
                'type': 'frequency_deviation',
                'value': frequency_hz,
                'deviation': freq_deviation,
                'severity': 'critical' if freq_deviation > 0.5 else 'warning'
            })

        # Voltage deviation
        voltage_deviation_pct = abs(voltage_kv - self.nominal_voltage) / self.nominal_voltage
        if voltage_deviation_pct > self.VOLTAGE_TOLERANCE:
            events.append({
                'type': 'voltage_deviation',
                'value': voltage_kv,
                'deviation_pct': voltage_deviation_pct * 100,
                'direction': 'undervoltage' if voltage_kv < self.nominal_voltage else 'overvoltage',
                'severity': 'critical' if voltage_deviation_pct > 0.15 else 'warning'
            })

        # ROCOF (Rate of Change of Frequency) — precursor of instability
        if len(self.history) > 0:
            rocof = (frequency_hz - self.history[-1]['frequency']) / 0.02  # Hz/s (50Hz → 20ms)
            if abs(rocof) > 1.0:  # > 1 Hz/s = significant disturbance
                events.append({
                    'type': 'high_rocof',
                    'value': rocof,
                    'severity': 'critical' if abs(rocof) > 2.0 else 'warning'
                })

        self.history.append({'frequency': frequency_hz, 'timestamp': timestamp})
        if len(self.history) > 1000:
            self.history.pop(0)

        return {'timestamp': timestamp, 'events': events, 'healthy': len(events) == 0}

Such code forms the basis of detection. In production, we use the same logic but in C++ or on GPU with Triton Inference Server for latency <10 ms.

How to Reduce Energy Losses by 30%

Load Forecasting: Why It Matters

Short-term load forecast for 24–48 hours helps dispatchers plan generation and avoid overloads. We use an ensemble of Gradient Boosting with lag features and weather data.

from sklearn.ensemble import GradientBoostingRegressor
import pandas as pd

def build_load_forecasting_model(historical_load: pd.DataFrame) -> GradientBoostingRegressor:
    """
    Forecast for 24-48 hours to plan generation and prevent overloads.
    """
    features = [
        'hour', 'day_of_week', 'month', 'is_holiday',
        'temperature', 'temperature_forecast',
        'load_1h_ago', 'load_24h_ago', 'load_168h_ago',  # lags
        'load_trend_24h'  # slope over last 24 hours
    ]

    historical_load['load_1h_ago'] = historical_load['load_mw'].shift(4)   # 15-min data
    historical_load['load_24h_ago'] = historical_load['load_mw'].shift(96)
    historical_load['load_168h_ago'] = historical_load['load_mw'].shift(672)

    model = GradientBoostingRegressor(
        n_estimators=300,
        max_depth=5,
        learning_rate=0.05
    )
    train_data = historical_load.dropna(subset=features)
    model.fit(train_data[features], train_data['load_mw'])
    return model

The model's MAPE on test data is 2–4% with quality data. For new sites, we use Transfer Learning with fine-tuning in 1–2 weeks.

Overload and Cascading Failure Detection

Transformers allow short-term overloads (1.3×Snom for 2 hours per GOST 14209). AI estimates winding thermal state and forecasts risk:

def assess_transformer_overload_risk(transformer_data: pd.DataFrame,
                                      load_forecast: pd.Series,
                                      rated_mva: float) -> dict:
    """
    Transformers allow short-term overloads per GOST 14209.
    1.3 × Snom — allowed 2 hours at normal temperature.
    """
    current_load_pct = transformer_data['load_mw'].iloc[-1] / (rated_mva * 0.9) * 100

    # Transformer thermal model (simplified)
    ambient_temp = transformer_data['ambient_temp'].iloc[-1]
    winding_temp_est = ambient_temp + 65 * (current_load_pct / 100) ** 2  # Hotspot

    # Overload forecast
    max_forecast_load_pct = load_forecast.max() / (rated_mva * 0.9) * 100

    overload_risk = 'none'
    if max_forecast_load_pct > 130:
        overload_risk = 'critical'
    elif max_forecast_load_pct > 110:
        overload_risk = 'warning'
    elif max_forecast_load_pct > 100:
        overload_risk = 'caution'

    return {
        'current_load_pct': round(current_load_pct, 1),
        'winding_temp_est_c': round(winding_temp_est, 1),
        'max_forecast_load_pct': round(max_forecast_load_pct, 1),
        'overload_risk': overload_risk,
        'recommended_action': 'load_shedding' if overload_risk == 'critical' else None
    }

The thermal model is more accurate than thresholds: reduces false trip risk by 40%.

Electricity Theft Detection

AI compares actual segment consumption with calculated technical losses (I²R). Deviation >8% triggers field inspection.

def detect_commercial_losses(feeder_data: pd.DataFrame,
                               meter_data: pd.DataFrame) -> dict:
    """
    Commercial losses = technical losses + theft.
    Anomaly: segment losses > expected from model.
    """
    # Technical losses from line model (I²R)
    technical_losses_model = calculate_technical_losses(
        feeder_data['current_a'],
        feeder_data['resistance_ohm']
    )

    actual_losses = feeder_data['supply_mwh'].sum() - meter_data['consumed_mwh'].sum()
    commercial_losses = actual_losses - technical_losses_model

    loss_rate = commercial_losses / feeder_data['supply_mwh'].sum()

    return {
        'technical_losses_mwh': technical_losses_model,
        'commercial_losses_mwh': round(commercial_losses, 2),
        'loss_rate_pct': round(loss_rate * 100, 2),
        'anomaly': loss_rate > 0.08,  # > 8% = suspicious
        'action': 'field_inspection' if loss_rate > 0.15 else None
    }

Theft detection accuracy is 90% vs 60% for the balancing method.

What Is Included in the Work

We offer a turnkey solution:

  • Infrastructure audit: analysis of data sources, frequency, quality, latency.
  • ML model development: anomaly detection, load forecasting, transformer thermal model, theft detection.
  • Integration with EMS/SCADA: OSIsoft PI, GE Grid Solutions, Siemens SICAM. Deployment on Edge or cloud.
  • Dashboard and alerts: CIM network model, real-time graphs, SMS/email to dispatcher.
  • Staff training and documentation: 2-day training, manuals.
  • Support: 6 months post-release maintenance.

Our team metrics: 10+ years in energy and ML, 15+ completed projects, 5 years on the market.

Work Stages and Timelines

Stage Duration Result
Analysis and data collection 1–2 weeks Report on sources, frequencies, quality
Prototype development (baseline models) 4–6 weeks Anomaly detection + load forecasting, dashboard
Full deployment (theft, thermal model, integration) 3–4 months Production system, training, documentation

Comparison: Threshold Method vs AI

Parameter Threshold Method AI Method
Detection accuracy 60–70% 95%+
False positives ~30% ~5%
Forecasting no yes (MAPE 2–4%)
Adaptation to conditions manual tuning automatic
Loss reduction up to 5% up to 30%

Cost is calculated individually after an audit. Get a consultation — we will assess your project.

Common Mistakes When Implementing AI Monitoring

  • Low sampling rate. If there are no PMUs and SCADA provides data every 10 seconds, AI cannot see fast processes. We recommend deploying edge collectors with frequency ≥10 Hz.
  • Lack of normalization. Different channels have different scales (kV, MW, deg). Without feature scaling, the model overfits.
  • Ignoring latency. From measurement to alert should be <100 ms. We use embedded models on ONNX or TensorRT.
  • Only threshold baseline. Comparing to threshold is the basis, but adding ML improves F1-score from 0.7 to 0.95.

Check your data against this checklist. If you need a consultation, contact us.