Bachelors Program in Electrical Engineering
IoT & Smart Electrical Systems
•
Bachelor
Data Analytics, AI, and Digital Twins
Introduction and Context
Modern electrical systems generate data continuously from smart meters, protection relays, phasor measurement units, inverter controllers, building-management systems, electric vehicles, and industrial sensors. Data analytics converts these observations into evidence for action. In an IoT-enabled electrical system, the objective is not merely to collect data, but to improve reliability, efficiency, safety, resilience, and economic performance.
Analytics can be classified by the question being answered:
Analytics type
Central question
Typical electrical application
Descriptive
What happened?
Daily load profile and energy report
Diagnostic
Why did it happen?
Cause of voltage sag or transformer overheating
Predictive
What is likely to happen?
Tomorrow's demand or probability of insulation failure
Prescriptive
What should be done?
Battery dispatch or optimal maintenance scheduling
Artificial intelligence (AI) supports these activities through statistical learning, machine learning, optimization, and knowledge-based reasoning. A digital twin extends the idea by maintaining a computational representation of a physical asset or system, synchronized with measured data and used for monitoring, simulation, prediction, and decision support.
Learning Objectives
After studying this chapter, a student should be able to:
Distinguish descriptive, diagnostic, predictive, and prescriptive analytics.
Prepare electrical-system data for reliable analytical use.
Apply forecasting, anomaly-detection, fault-diagnosis, optimization, and remaining-useful-life methods.
Compare supervised, unsupervised, deep-learning, TinyML, and federated-learning approaches.
Interpret model accuracy, uncertainty, explainability, and operational risk.
Describe the architecture and lifecycle of a digital twin.
Recognize limitations arising from data quality, distribution shift, cybersecurity, bias, and model misuse.
1. From Measurements to Decisions
An analytical system normally contains six stages: sensing, communication, data management, modelling, decision support, and operational feedback. Measurements must be time-stamped and associated with asset identity, location, units, calibration status, and operating conditions. A voltage value without its phase, line-to-line or line-to-neutral definition, and timestamp may be unusable.
Data quality
Important data-quality dimensions include completeness, validity, consistency, timeliness, uniqueness, and accuracy. Missing values may result from communication failure, sensor saturation, maintenance, or deliberate protection-system blocking. Replacing every missing value with zero is dangerous: zero power may represent either an outage or absent data.
For a time series xₜ, a simple first-difference feature is
∆xₜ = xₜ − xₜ₋₁
where xₜ is the measurement at time t. This feature can reveal abrupt changes, but it is sensitive to noise and irregular sampling. Resampling, filtering, interpolation, and outlier treatment must therefore be documented. Any transformation applied during model training must also be applied identically during deployment.
A useful forecasting baseline is the persistence model:
ŷₜ₊ₕ = xₜ
Here ŷₜ₊ₕ is the forecast h time steps ahead and xₜ is the latest observation. A complex model should demonstrate improvement over such a baseline, not merely a high score in isolation.
2. Descriptive and Diagnostic Analytics
Descriptive analytics summarizes historical behaviour using profiles, distributions, trends, dashboards, and key performance indicators. For an interval energy measurement Pᵢ in kilowatts recorded for duration ∆tᵢ in hours, energy is approximated by
E = ∑ᵢ Pᵢ∆tᵢ
The result is in kilowatt-hours when Pᵢ is in kilowatts and ∆tᵢ is in hours. The approximation assumes each interval value represents the average power over that interval.
Common descriptive indicators include peak demand, load factor, energy consumption, voltage-unbalance trend, transformer loading, outage frequency, and renewable-energy curtailment. Load factor over a period is
LF = Pavg ÷ Pmax
where P_avg is average power and P_max is maximum power over the same period. Both quantities must use the same power definition and time interval. A high load factor generally indicates smoother utilization, but it does not by itself prove efficient or safe operation.
Diagnostic analytics seeks causes rather than merely reporting symptoms. It combines event logs, topology, weather, operating state, maintenance records, and correlations among measurements. For example, a feeder voltage reduction may be associated with increased current and reactive-power flow, a regulator operating limit, a capacitor-bank failure, or an upstream fault. Correlation is evidence for investigation, not proof of causation.
A diagnostic workflow is:
Verify the time alignment and quality of all relevant signals.
Establish the system's operating state and topology.
Identify abnormal variables and their sequence of change.
Compare observations with physical laws, protection records, and historical cases.
Rank possible causes and request confirming evidence.
Physics-based checks remain essential. For a balanced three-phase system, apparent power is
S = √3 VL IL
where S is apparent power in volt-amperes, V_L is line-to-line RMS voltage in volts, and I_L is line RMS current in amperes. The expression assumes a balanced three-phase system and consistent RMS quantities. A physically impossible result may indicate a sensor, scaling, or data-integration error rather than a new operating phenomenon.
3. Predictive Analytics
Load forecasting
Load forecasting supports generation scheduling, network planning, demand response, and storage control. Forecast horizons include very short-term (seconds to minutes), short-term (hours to days), medium-term (weeks to months), and long-term (years).
Explanatory variables may include historical load, hour, weekday, holidays, temperature, humidity, solar irradiance, tariff, occupancy, and electric-vehicle charging. A linear model can be written as
yₜ = β₀ + β₁x₁,ₜ + β₂x₂,ₜ + … + βₚxₚ,ₜ + εₜ
where yₜ is load, xⱼ,ₜ are predictors, βⱼ are coefficients, β₀ is the intercept, and εₜ is unexplained error. The model assumes the selected relationship is sufficiently stable and that the error assumptions used for inference are appropriate. Nonlinear methods such as random forests, gradient boosting, and neural networks can capture interactions but may require more data and offer less transparent reasoning.
Forecast accuracy should be assessed on chronologically later data, not random samples that leak future information into training. Common measures include mean absolute error:
MAE = (1/n) ∑ₜ |yₜ − ŷₜ|
and root mean square error:
RMSE = √[(1/n) ∑ₜ (yₜ − ŷₜ)²]
where yₜ is observed load, ŷₜ is predicted load, and n is the number of test observations. MAE is expressed in the units of load and weights all absolute errors equally. RMSE is also in load units but penalizes large errors more strongly. Percentage measures become unstable when actual load is near zero.
Prediction intervals are preferable to point forecasts when decisions carry risk. An interval is meaningful only if its stated coverage is approximately achieved on representative test data.
Anomaly detection
An anomaly is an observation or sequence inconsistent with expected behaviour. It may indicate a fault, cyberattack, sensor failure, unusual but legitimate operation, or data-processing error. Supervised detection requires labelled examples of normal and abnormal states. Unsupervised methods learn normal structure using clustering, principal-component methods, autoencoders, density estimation, or isolation-based methods.
Thresholds should be selected using operational consequences. A low threshold may detect more events but generate excessive false alarms. A high threshold may miss early degradation. Detection performance is commonly summarized with precision and recall:
Precision = TP ÷ (TP + FP)
Recall = TP ÷ (TP + FN)
TP, FP, and FN denote true positives, false positives, and false negatives. In safety-critical protection support, the cost of a false negative may greatly exceed that of a false positive; the appropriate operating point should reflect that asymmetry.
Fault diagnosis
Fault diagnosis identifies the likely failed component and fault mechanism. A classifier may distinguish phase-to-ground, phase-to-phase, overload, insulation deterioration, bearing damage, or sensor faults. A robust diagnostic architecture combines learned patterns with engineering constraints, sequence components, relay operation, and topology.
Classification accuracy alone may conceal poor performance on rare faults. A confusion matrix, class-specific recall, calibration, and inference latency should be examined. The model must also distinguish unknown conditions from known classes; forcing every unfamiliar event into a familiar class is unsafe.
Remaining useful life
Remaining useful life (RUL) is the estimated time until a defined failure or performance limit. The definition must specify the failure criterion, operating regime, censoring treatment, and time unit. A degradation indicator zₜ may be modelled as
zₜ = f(t, uₜ, θ) + εₜ
where uₜ represents operating conditions, θ model parameters, and εₜ modelling error. RUL is not a universal property of an asset: it depends on load, temperature, duty cycle, maintenance, environment, and the chosen end-of-life threshold. Predictions should therefore include uncertainty and be updated as new evidence arrives.
4. Prescriptive Analytics and Optimization
Predictive analytics estimates future states; prescriptive analytics selects actions subject to constraints. An optimization problem can be expressed as
minimize J(a) subject to g(a) ≤ 0, h(a) = 0
where a is the vector of decisions, J is the objective function, and g and h represent inequality and equality constraints. In electrical applications, objectives may include energy cost, losses, emissions, battery degradation, or unserved energy. Constraints may include voltage limits, thermal ratings, state-of-charge limits, ramp rates, and switching restrictions.
For a battery, a simplified state-of-charge model is
where SOC is a fractional state of charge, P_c and P_d are charging and discharging powers, η_c and η_d are efficiencies, E_B is nominal battery energy, and ∆t is the interval duration. Charging and discharging should not occur simultaneously unless the formulation explicitly permits and penalizes it. The model is approximate and omits temperature, rate dependence, and degradation unless those effects are added.
Methods include linear programming, mixed-integer programming, nonlinear optimization, model-predictive control, and reinforcement learning. The chosen method must respect hard engineering constraints. An apparently optimal schedule that violates voltage or thermal limits is not an acceptable solution.
5. Machine Learning Architectures for IoT Electrical Systems
Supervised learning uses labelled input-output examples. Unsupervised learning searches for structure without labels. Semi-supervised learning combines a small labelled set with a larger unlabelled set. Deep learning is valuable for high-dimensional signals, images, and long sequences, but it requires careful training, validation, and monitoring.
TinyML
TinyML places inference on resource-constrained microcontrollers or edge devices. Benefits include low latency, reduced bandwidth, resilience during communication loss, and improved privacy. Constraints include limited memory, processing capacity, energy, and numerical precision. Quantization, pruning, feature extraction, and compact architectures can reduce resource demand. A compressed model must be re-tested for false alarms, missed faults, latency, and robustness—not judged only by its size.
Federated learning
Federated learning trains a shared model across sites while keeping raw data local. A typical round sends model updates to a coordinating server, aggregates them, and returns a new model. It can reduce direct data sharing, but updates may still leak information, and sites may have different sensors, loads, labels, and operating conditions. Secure aggregation, access control, update validation, and differential-privacy techniques may be required. Federated learning is not automatically private or unbiased.
Explainable AI
Explainability methods include feature importance, partial-dependence analysis, local surrogate explanations, saliency methods, counterfactual explanations, and inherently interpretable models. An explanation should answer a specific engineering question, such as why an overheating alarm was raised or which measurements changed the decision. Explanations are not proof of causality and can be unstable when the model is extrapolating beyond its training distribution.
6. Digital Twins
A digital twin is a maintained digital representation of a physical asset, process, or network. It differs from a static simulation because it is linked to a particular physical instance and updated using operational data. A practical twin contains:
asset identity, geometry, ratings, and configuration;
sensor and event data with time synchronization;
physical or data-driven models;
state estimation and parameter updating;
simulation, prediction, and visualization services;
interfaces to maintenance and operational decisions.
A useful lifecycle is: design model → connect data → validate state → estimate and predict → evaluate decisions → record outcomes → update the twin. The twin may be component-level, such as a transformer, or system-level, such as a distribution feeder. It may combine first-principles equations with machine-learning residual models.
Twin fidelity must match the decision. A detailed electromagnetic transient model may be suitable for protection studies but excessive for a daily energy dashboard. Conversely, a simple dashboard model may be inadequate for insulation-failure prediction. Validation should test both numerical accuracy and decision usefulness under normal, abnormal, and changing conditions.
Digital twin feedback architecture
Figure: Digital twin feedback architecture
Figure: A digital twin links physical measurements, data management, models, and operational decisions in a feedback cycle.
7. Worked Example: Short-Term Load Forecasting
An educational microgrid records the following hourly loads in kilowatts: 80, 84, 82, and 86. A persistence forecast for the fifth hour is 86 kW. Suppose the actual fifth-hour load is 90 kW. The absolute error is |90 − 86| = 4 kW.
If forecasts for three hours are 86, 90, and 88 kW, while actual loads are 90, 87, and 91 kW, then
MAE = (4 + 3 + 3) ÷ 3 = 3.33 kW.
The corresponding RMSE is √[(4² + 3² + 3²) ÷ 3] = √(34 ÷ 3) ≈ 3.37 kW. The similar values indicate that no single error is exceptionally large in this small sample. This example does not establish general model quality; a longer chronological test set covering seasons and unusual events is required.
8. Illustrative Case: Digital Twin for a Distribution Transformer
Background
A 500 kVA distribution transformer supplies a commercial district. It has temperature, current, voltage, oil-level, and ambient-temperature sensors. Historical maintenance records are incomplete, and nuisance thermal alarms have caused unnecessary inspections.
Problem
The utility wants earlier detection of overheating while reducing false alarms. It also wants an estimate of remaining service life, but actual failures are rare.
Analysis
Engineers first audit sensor calibration, timestamp alignment, missingness, and transformer configuration. They create a physics-based thermal estimate and compare it with measured top-oil temperature. Residuals are analysed by load, ambient temperature, and cooling state. Events are labelled only when maintenance evidence supports a fault; unconfirmed alarms are retained as uncertain rather than treated as failures.
Approach and solution
A hybrid twin combines a thermal model with a machine-learning residual model. Edge processing calculates rolling load, temperature rise, and rate-of-change features. The cloud stores longer histories and retrains models. A diagnostic classifier ranks sensor fault, overload, cooling restriction, and insulation concern. The maintenance dashboard displays the prediction, confidence interval, influential variables, and data-quality status. A constrained maintenance optimizer schedules inspection before the predicted risk exceeds the utility's chosen threshold, subject to crew availability.
Outcome
In an evaluation period, the hybrid model reduces false alarms relative to a fixed temperature threshold while preserving detection of confirmed abnormal events. The utility does not interpret the RUL estimate as a guaranteed failure date. Instead, it uses risk bands, inspection evidence, and engineering review. The twin is recalibrated after sensor replacement and after changes in loading or cooling configuration.
Learning points
The case demonstrates that model performance depends on data governance, physical knowledge, labels, and decision thresholds. A sophisticated algorithm cannot compensate for ambiguous failure definitions or unreliable sensors. Human review remains important where the cost of an incorrect intervention is high.
9. Limitations, Governance, and Professional Practice
Data-driven models can fail because of missing or biased data, rare-event scarcity, label noise, sensor drift, changing network topology, weather extremes, cyber manipulation, and distribution shift. Training and test data must be separated in time where appropriate. Leakage occurs when information unavailable at decision time is accidentally used during training.
Important governance practices include asset and data ownership, access control, encryption, secure update mechanisms, audit logs, retention rules, incident response, and documented model versions. Critical-infrastructure deployments should follow applicable electrical-safety, cybersecurity, privacy, and AI-governance requirements. Personal or occupancy-related data require special protection even when collected for energy management.
A responsible deployment should specify:
intended use and prohibited use;
decision authority and human override;
validation population and operating envelope;
performance, calibration, and alarm metrics;
monitoring for drift and degradation;
rollback and safe-fallback behaviour;
explainability and record-keeping requirements.
AI should support engineering judgement, not silently replace it. Automated control requires stronger validation than advisory analytics because an incorrect recommendation can directly affect stability, safety, or equipment life.
Contemporary Developments
Current developments include graph neural networks for network-structured data, physics-informed learning, probabilistic forecasting, foundation models for time series, edge-cloud orchestration, privacy-preserving computation, and reinforcement learning for control. These approaches are promising but should be evaluated against transparent baselines and realistic operational constraints. Research novelty does not establish field reliability.
Best-Practice Checklist
Define the operational decision before selecting an algorithm.
Establish a simple physical and statistical baseline.
Document units, timestamps, topology, transformations, and missing-data rules.
Split data to prevent temporal and operational leakage.
Evaluate rare-event performance and uncertainty, not accuracy alone.
Test under sensor faults, communication loss, topology changes, and extremes.
Use human review and safe fallback for high-consequence decisions.
Monitor drift, recalibrate, and retire models that no longer apply.
Protect data, model updates, and control interfaces.
Record assumptions, limitations, and evidence supporting deployment.
Chapter Summary
Electrical IoT data become operationally valuable through a progression from descriptive reporting to diagnostic explanation, predictive estimation, and prescriptive action. Forecasting requires suitable features, chronological validation, meaningful error measures, and uncertainty awareness. Anomaly detection and fault diagnosis must address class imbalance, false alarms, unknown conditions, and physical constraints. RUL estimation depends on explicit failure definitions and changing operating conditions.
Machine learning, TinyML, federated learning, and explainable AI offer useful capabilities but introduce resource, privacy, interpretability, and distribution-shift challenges. Digital twins connect physical assets, synchronized data, models, and decisions in a maintained feedback loop. Reliable deployment requires cybersecurity, governance, human oversight, baseline comparison, validation, and continuous monitoring.
Key Terms
Descriptive analytics: Analysis that summarizes what has happened.
Diagnostic analytics: Analysis intended to explain why an event occurred.
Predictive analytics: Estimation of future states or outcomes.
Prescriptive analytics: Selection of actions under objectives and constraints.
Load forecasting: Prediction of future electrical demand.
Anomaly detection: Identification of behaviour inconsistent with an expected pattern.
Fault diagnosis: Determination of the likely component and mechanism causing abnormal operation.
Remaining useful life: Estimated time until a specified end-of-life condition.
Data leakage: Use of information during training that would not be available at decision time.
Distribution shift: Change between the data used for training and deployment conditions.
TinyML: Machine learning inference on resource-constrained embedded devices.
Federated learning: Collaborative model training that keeps raw data at participating sites.
Explainable AI: Methods that make model outputs more understandable to users.
Digital twin: A maintained digital representation of a particular physical asset or system.
State of charge: Stored-energy fraction of a battery relative to its defined capacity.
Precision: Fraction of predicted positives that are correct.
Recall: Fraction of actual positives that are detected.
Model drift: Degradation caused by changing data or system behaviour.
Review Questions
Short Answer Questions
Distinguish descriptive, diagnostic, predictive, and prescriptive analytics.
Why is chronological testing important in load forecasting?
Define precision and recall in anomaly detection.
What is TinyML, and why is it useful in electrical IoT systems?
State two differences between a digital twin and a static simulation.
Long Answer Questions
Explain a complete data-to-decision architecture for analytics in a smart distribution network.
Compare supervised and unsupervised anomaly detection, including their data requirements and risks.
Explain how physical models and machine-learning models can be combined in a digital twin.
Discuss the principal limitations and governance requirements of AI in critical electrical infrastructure.
Describe a prescriptive battery-dispatch problem, including objectives, constraints, and validation requirements.
Analytical / Application Questions
A feeder has actual hourly loads of 100, 110, and 90 kW and forecasts of 95, 115, and 96 kW. Calculate MAE and RMSE, and explain which measure is more sensitive to the largest error.
Design an anomaly-detection strategy for a transformer with current, temperature, and vibration sensors. Specify features, labels, thresholds, validation tests, and safe response actions.
Propose a digital-twin architecture for an electric-vehicle charging site. Explain how it would forecast demand, detect faults, optimize charging, protect user data, and handle communication loss.
Multiple Choice Questions with Answers
Question 1
Which type of analytics answers the question, “What should be done?”
A. Descriptive analytics
B. Diagnostic analytics
C. Predictive analytics
D. Prescriptive analytics
Correct Answer: D. Prescriptive analytics
Question 2
A forecast has errors of 4 kW, 3 kW, and 3 kW. What is its MAE?
A. 3.00 kW
B. 3.33 kW
C. 3.67 kW
D. 10.00 kW
Correct Answer: B. 3.33 kW
Question 3
Which measure is especially sensitive to large forecasting errors?
A. RMSE
B. Median load
C. Precision
D. Load factor
Correct Answer: A. RMSE
Question 4
What does recall measure in binary fault detection?
A. The fraction of predicted faults that are correct
B. The fraction of actual faults that are detected
C. The fraction of normal cases correctly rejected
D. The average magnitude of prediction error
Correct Answer: B. The fraction of actual faults that are detected
Question 5
Which is a defining feature of federated learning?
A. All raw data must be uploaded to one server
B. Models cannot be updated after deployment
C. Sites can train collaboratively while retaining raw data locally
D. It guarantees complete privacy without additional safeguards
Correct Answer: C. Sites can train collaboratively while retaining raw data locally
Question 6
Why is a persistence forecast useful?
A. It provides a simple baseline for comparison
B. It always outperforms neural networks
C. It removes the need for test data
D. It estimates transformer insulation life directly
Correct Answer: A. It provides a simple baseline for comparison
Question 7
In the simplified battery equation, ηc represents
A. Battery nominal energy
B. Charging efficiency
C. Discharging power
D. Sampling interval
Correct Answer: B. Charging efficiency
Question 8
Which statement about RUL is most accurate?
A. It is independent of operating conditions
B. It is always an exact failure date
C. It depends on the defined end-of-life criterion and conditions
D. It can be computed reliably without historical or sensor data
Correct Answer: C. It depends on the defined end-of-life criterion and conditions
Question 9
What makes a digital twin different from a static simulation model?
A. It never uses physical equations
B. It is connected to and updated from a particular physical system
C. It cannot support prediction
D. It is used only for visual display
Correct Answer: B. It is connected to and updated from a particular physical system
Question 10
Which practice best reduces temporal data leakage?
A. Randomly mixing all observations before splitting
B. Using future measurements as historical features
C. Testing on chronologically later data
D. Replacing all missing values with zero
Correct Answer: C. Testing on chronologically later data