AI Applications in Electrical Engineering

Chapter 8
Intelligent Control and Reinforcement Learning

Bachelors Program in Electrical Engineering
AI Applications in Electrical Engineering   •   Bachelor

Intelligent Control and Reinforcement Learning

Introduction and Context

Electrical-engineering systems increasingly operate in environments that are uncertain, nonlinear, time-varying, and only partly measurable. Examples include autonomous energy-storage systems, microgrids, power converters, industrial drives, robotic manipulators, and demand-response systems. Classical control remains the foundation of these applications, but artificial intelligence can extend control capability when accurate models are unavailable or when operating conditions change substantially.

Intelligent control does not mean replacing control engineering with a generic machine-learning model. A reliable intelligent controller combines plant knowledge, feedback, optimization, data, and safety mechanisms. The central engineering question is not simply whether an algorithm can achieve a low simulation error, but whether the resulting closed-loop system is stable, constraint-compliant, interpretable enough to validate, and robust to disturbances and model mismatch.

This chapter relates artificial intelligence to classical, optimal, adaptive, fuzzy, and model-predictive control. It then develops the Markov decision-process framework and introduces reinforcement learning (RL), with particular attention to stability, constraints, simulation-to-reality transfer, and safety.

Learning Objectives

After studying this chapter, a student should be able to:

  1. Explain how AI-based control differs from classical feedback control.
  2. Formulate a control problem as a Markov decision process.
  3. Distinguish value-based, policy-based, and actor–critic reinforcement learning.
  4. Relate RL to optimal, adaptive, fuzzy, and model-predictive control.
  5. Formulate rewards, constraints, and safety requirements for electrical systems.
  6. Analyze why training stability does not automatically imply closed-loop stability.
  7. Explain simulation-to-reality problems and appropriate mitigation methods.
  8. Propose a defensible intelligent-control architecture for an engineering application.

1. From Classical Control to Intelligent Control

A continuous-time plant may be represented by

ẋ(t) = f(x(t), u(t), d(t)), y(t) = h(x(t))

where x(t) is the state vector, u(t) is the control input, d(t) represents disturbances or uncertainty, and y(t) is the measured output. A feedback controller computes an input from measurements or estimated states:

u(t) = κ(y(t), r(t))

where r(t) is the reference and κ is the control law. In classical control, κ is commonly designed from a transfer function, state-space model, pole-placement requirement, or frequency-domain specification.

A proportional–integral–derivative controller, for example, uses the error e(t) = r(t) − y(t):

u(t) = Kp e(t) + Ki ∫₀ᵗ e(τ)dτ + Kd de(t)/dt

Here Kp, Ki, and Kd have units selected so that u has the correct actuator units. The derivative term is usually filtered in practice because measurement noise is amplified by differentiation. PID control is transparent and effective for many approximately linear systems, but fixed gains may perform poorly when the plant changes, saturates, or contains strong nonlinearities.

AI-based control may learn one or more of the following:

  • a plant model, such as x̂t+1 = fθ(xt, ut);
  • a policy that maps observations to actions;
  • a value function estimating long-term performance;
  • unknown parameters or disturbances;
  • a supervisory choice among trusted controllers.

The learning component should be distinguished from the safety-critical feedback loop. A useful engineering architecture often leaves a conventional controller in charge of fast stabilization while AI performs optimization, adaptation, prediction, or supervisory decision-making.

2. Relationships with Major Control Paradigms

2.1 Optimal control

Optimal control selects a sequence of inputs to minimize a cost. For a discrete-time system, a finite-horizon objective can be written as

J = Σₖ₌₀ᴺ⁻¹ ℓ(xₖ, uₖ) + Vf(xN)

where ℓ is the stage cost, Vf is a terminal cost, and N is the horizon length. A common quadratic cost is

ℓ(xₖ,uₖ) = xₖᵀQxₖ + uₖᵀRuₖ

with Q positive semidefinite and R positive definite. The terms penalize state deviation and control effort, respectively. Optimal control normally assumes a known model and a specified objective. RL can be viewed as a data-driven approach to estimating optimal policies when the transition model or solution is difficult to obtain.

2.2 Adaptive control

Adaptive control estimates changing plant parameters online and modifies the controller. For example, a motor controller may estimate resistance that varies with temperature. RL also adapts through experience, but its objective is generally a long-term return rather than explicit parameter convergence. Adaptive control often provides stronger analytical guarantees under stated assumptions; unconstrained RL usually provides weaker guarantees and requires extensive validation.

2.3 Fuzzy control

Fuzzy control represents qualitative rules such as “if speed error is positive and increasing, reduce torque.” Membership functions convert numerical variables into degrees of linguistic membership. Fuzzy systems are useful when expert knowledge exists but a precise model is difficult to derive. A neural or reinforcement-learning method may tune membership functions or rule weights, but learned rules must still be checked for sensible behavior, bounded outputs, and coverage of the operating domain.

2.4 Model-predictive control

Model-predictive control (MPC) repeatedly solves a finite-horizon optimization problem. At each sampling instant, it predicts future behavior, computes an input sequence, applies only the first input, and repeats the process after new measurements arrive. Its major strengths are explicit handling of constraints and a clear connection between performance and physical objectives.

An AI-enhanced MPC may learn a faster plant model, learn terminal costs, select a horizon, or approximate the optimizer. However, replacing a constrained optimizer with a neural network can remove the original feasibility guarantee. A practical design may therefore use a learned policy to propose an action and an MPC or safety filter to verify and modify it.

3. Markov Decision Processes

A Markov decision process (MDP) is the mathematical framework for many RL problems. It consists of a state space S, action space A, transition probability P, reward function R, and discount factor γ. The Markov property states that the next state depends on the current state and action, not on the full history:

P(sₜ₊₁ | sₜ, aₜ, sₜ₋₁, aₜ₋₁, …) = P(sₜ₊₁ | sₜ, aₜ)

For an electrical system, the state could include battery state of charge, bus voltage, frequency, load estimate, renewable generation, and temperatures. The action might be converter duty ratio, generator setpoint, or charging power. The state must contain enough information for effective prediction. If only partial measurements are available, the problem is a partially observable MDP, and an estimator or recurrent policy may be required.

A policy π specifies action selection. For a stochastic policy, π(a|s) is the probability of selecting action a in state s. The discounted return from time t is

Gₜ = Σₖ₌₀∞ γᵏrₜ₊ₖ₊₁, 0 ≤ γ < 1

where rt+1 is the reward received after action at. The discount factor determines how strongly future consequences matter. For continuing physical systems, γ less than one also helps make the objective finite, although it does not by itself guarantee safe or stable behavior.

The state-value function and action-value function are

V^π(s) = 𝔼π[Gₜ | sₜ = s]
Q^π(s,a) = 𝔼π[Gₜ | sₜ = s, aₜ = a]

The Bellman expectation equation is

V^π(s) = Σₐ π(a|s) Σₛ′ P(s′|s,a)[R(s,a,s′) + γV^π(s′)]

For continuous states or actions, summations are replaced by integrals or approximations. An optimal value function satisfies the Bellman optimality equation:

V*(s) = maxₐ Σₛ′ P(s′|s,a)[R(s,a,s′) + γV*(s′)]

These equations assume that rewards and transition probabilities are defined consistently and that the relevant expectations exist.

4. Reinforcement-Learning Methods

4.1 Model-free learning

Model-free RL learns value functions or policies without explicitly identifying P. Q-learning uses the temporal-difference target

yₜ = rₜ₊₁ + γ maxₐ′ Q(sₜ₊₁,a′)

and updates the estimate according to

Q(sₜ,aₜ) ← Q(sₜ,aₜ) + α[yₜ − Q(sₜ,aₜ)]

where α is the learning rate. Tabular Q-learning is mainly suitable for small discrete problems. Deep Q-networks approximate Q with a neural network and are generally used for discrete actions. They are not directly appropriate for continuously valued duty ratios without discretization or another algorithmic modification.

4.2 Policy-gradient and actor–critic methods

A policy-gradient method directly adjusts parameters θ of a policy πθ. In simplified form,

θ ← θ + α ∇θ J(θ)

where J is expected return. Actor–critic methods use an actor to represent the policy and a critic to estimate value or advantage. They are commonly used for continuous actions, but training can be sensitive to exploration, reward scaling, approximation error, and correlated data.

4.3 Model-based RL

Model-based RL learns or uses a transition model and plans through it. For electrical engineering, model-based methods are attractive because physical equations, parameter ranges, and constraints can be incorporated. A learned model should be evaluated not only by one-step prediction error but also by multi-step rollout accuracy in the regions visited by the controller.

4.4 Offline and safe data collection

Online exploration on a real power converter or grid can damage equipment. Offline RL learns from a fixed data set collected by existing controllers. Its principal difficulty is distribution shift: the learned policy may select actions absent from the data, where predictions are unreliable. Conservative policy updates, uncertainty estimation, action filters, and human-approved operating envelopes are therefore important.

5. Reward Design and Constraints

Reward design translates engineering objectives into a scalar learning signal. For voltage regulation, a possible stage reward is

rₜ = −(wv eᵥ,ₜ² + wu ∆uₜ² + wi iₜ²) − Cₜ

where ev,t is voltage error, Δut is the change in control action, it is current, wv, wu, and wi are nonnegative weights, and Ct is a large penalty for a constraint violation. Units must be considered: voltage-squared, current-squared, and actuator-change-squared are not directly comparable until normalized or assigned dimensionally meaningful weights.

Penalty rewards alone do not guarantee constraint satisfaction. A controller may accept a rare catastrophic violation if the accumulated reward is favorable. Constraints should therefore be represented explicitly:

gj(xₜ,uₜ) ≤ 0, j = 1, …, m

Examples include current limits, state-of-charge bounds, thermal limits, switching-frequency restrictions, and voltage-quality requirements. Approaches include constrained MDPs, action projection, barrier functions, backup controllers, reference governors, and safety filters.

A safety filter can solve a small optimization problem that finds the closest admissible action to the RL proposal:

usafe = arg minᵤ ‖u − uRL‖²
subject to predicted constraints and actuator limits

The norm and constraints must be selected according to physical units and system dynamics. A filter based only on instantaneous limits may be insufficient when violations depend on future temperature, energy, or state of charge.

6. Stability and Robustness

A high reward is not a proof of closed-loop stability. Stability concerns the behavior of the interconnected plant and controller for all relevant initial conditions and disturbances. For a discrete-time equilibrium x* = 0, a Lyapunov function V(x) is positive definite if V(0) = 0 and V(x) > 0 for x ≠ 0. A sufficient condition for asymptotic stability is

∆V = V(xₜ₊₁) − V(xₜ) < 0

in a suitable neighborhood of the equilibrium. In practice, an RL policy may be constrained to preserve a Lyapunov decrease condition, or it may operate inside a certified region while a conventional controller provides recovery outside that region.

Important robustness concerns include sensor bias, actuator saturation, delayed measurements, unmodeled dynamics, communication loss, adversarial inputs, and distribution shift. Random disturbances during training do not automatically represent all real faults. Robust testing should include structured worst-case scenarios, parameter variation, rare events, and fault-recovery transitions.

7. Simulation-to-Reality Transfer

Training in simulation is attractive because it is safer, faster, and less expensive than experimentation on electrical hardware. The difficulty is the reality gap: simulation may misrepresent parasitic elements, switching delays, sensor quantization, thermal behavior, communication latency, or external disturbances.

Useful transfer practices include:

  • system identification using measured data;
  • domain randomization over uncertain parameters;
  • calibrated sensor, actuator, and delay models;
  • curriculum learning from simple to difficult conditions;
  • hardware-in-the-loop testing;
  • conservative initialization from a trusted controller;
  • staged deployment with action limits and monitoring;
  • validation on operating conditions excluded from training.

Domain randomization is effective only when its parameter ranges include plausible real behavior. Excessive randomization can make learning inefficient, whereas insufficient randomization creates false confidence. Hardware-in-the-loop testing is particularly valuable because it combines real-time computation and interfaces with a simulated plant.

8. Applied Case: RL-Assisted Battery Energy-Storage Control

Background

Consider an illustrative 100 kW battery energy-storage system connected to a microgrid. The battery must reduce peak demand while maintaining state of charge (SOC), respecting converter current limits, and avoiding excessive thermal stress.

Problem

A rule-based controller charges during low-price periods and discharges during high-price periods. However, forecasting errors, variable photovoltaic generation, and changing load patterns cause inefficient operation. A pure RL controller is proposed to select a power reference.

Analysis

The observation vector may contain SOC, battery temperature, measured load, photovoltaic power, electricity price, time-of-day encoding, and a short-term load forecast. The action is a normalized battery-power command aₜ ∈ [−1,1], converted to a power reference. A positive convention must be stated; here positive power means discharge to the microgrid.

The reward can combine energy cost, peak demand, SOC regulation, and smooth operation:

rₜ = −cₜPgrid,ₜ∆t − wp max(0,Pgrid,ₜ − Ppeak)² − ws(SOCₜ − SOCref)² − w_∆(Pₜ − Pₜ₋₁)²

Here cₜ is the energy price, Pgrid,t is grid import, Δt is the sampling interval, Ppeak is a demand threshold, and the w terms are nonnegative weights. The reward must be normalized so that no single term dominates accidentally.

Hard constraints include

SOCmin ≤ SOCₜ ≤ SOCmax
|Pₜ| ≤ Pmax(Tₜ,SOCₜ)

where allowable power may depend on temperature and SOC. The RL policy proposes a power command, but a supervisory layer checks feasibility. If the action would exceed current or SOC limits, it is projected onto the admissible set. A conventional fallback controller maintains safe SOC and disconnects the battery under fault conditions.

Approach and solution

A practical development sequence is:

  1. Build and validate a battery and converter model using measured data.
  2. Train an RL policy against randomized loads, prices, efficiencies, delays, and forecast errors.
  3. Compare it with rule-based control, MPC, and a constrained optimization benchmark.
  4. Test in software-in-the-loop and hardware-in-the-loop environments.
  5. Deploy initially in advisory mode, recording proposed actions without applying them.
  6. Permit limited closed-loop operation under strict power, SOC, and temperature envelopes.
  7. Retain a watchdog, fallback controller, event logger, and operator override.

Outcome

The relevant outcome is not merely lower simulated energy cost. Acceptance should require constraint-violation rate, worst-case SOC deviation, thermal exposure, recovery after communication loss, performance under forecast error, and safe behavior during sensor faults. If the learned policy reduces cost but causes unacceptable battery degradation, it is not an engineering success.

Learning points

The case illustrates that RL is most defensible as part of a layered architecture. Forecasts and learned policies can improve economic decisions, while physical constraints, conventional control, and monitoring provide safety and accountability.

9. Implementation Workflow and Best Practices

A disciplined workflow includes:

  1. Define the controlled plant, sampling period, states, actions, disturbances, and failure modes.
  2. Establish a baseline controller and measurable performance metrics.
  3. Validate sensors, actuators, units, sign conventions, and data quality.
  4. Select a model-free, model-based, offline, or hybrid method based on risk and data availability.
  5. Design rewards and constraints with engineering stakeholders.
  6. Separate training, validation, and test scenarios by operating condition and random seed.
  7. Evaluate stability, constraint compliance, robustness, and computational latency.
  8. Use uncertainty estimates and abstention where the policy is outside its competence.
  9. Conduct staged commissioning and maintain rollback capability.
  10. Document data provenance, model versions, calibration, assumptions, and incidents.

Performance metrics should include tracking error, integral absolute error, energy use, peak demand, control effort, computation time, constraint violations, recovery time, and reliability. For an error eₜ sampled at interval Δt, the discrete integral absolute error is approximately

IAE ≈ Σₜ |eₜ|∆t

This metric has units equal to the error unit multiplied by time and is meaningful only when the sampling interval and test duration are reported.

10. Ethical, Regulatory, and Professional Considerations

Intelligent controllers can affect public safety, energy access, equipment life, and grid reliability. Engineers must preserve traceability from requirements to implementation and test evidence. Relevant concerns include cybersecurity, privacy of smart-meter data, unequal effects of demand-response decisions, responsibility when an autonomous controller fails, and compliance with electrical and functional-safety standards.

A learned controller should not be described as safe merely because it passed a limited test set. Safety claims require defined operating boundaries, evidence, monitoring, and a response plan. Cybersecurity controls should include authenticated commands, network segmentation, secure updates, anomaly detection, and fail-safe behavior. Human operators need meaningful override authority rather than a nominal control that is too slow or complicated to use.

11. Contemporary Directions

Current research combines RL with differentiable physical models, neural operators, safe exploration, uncertainty-aware policies, offline learning, multi-agent coordination, and formal verification. Digital twins support testing and condition monitoring, but their credibility depends on calibration and validation. Federated or privacy-preserving learning may support collaboration among distributed energy resources, although communication and poisoning risks remain.

The most promising direction for safety-critical electrical engineering is not unrestricted end-to-end autonomy. It is hybrid intelligence: physical models, optimization, conventional feedback, learning, and formal or empirical safety mechanisms working together. This approach exploits AI where it is strong—prediction, adaptation, and high-dimensional decision-making—while retaining engineering structure where guarantees matter.

Chapter Summary

Intelligent control extends classical feedback by learning models, policies, values, or adaptations from data. Optimal control supplies the language of objectives; adaptive control supplies mechanisms for changing parameters; fuzzy control incorporates qualitative expertise; and MPC provides prediction and explicit constraint handling. RL formulates sequential control as an MDP with states, actions, transitions, rewards, and discounted returns. Value functions and Bellman equations describe long-term consequences, while policy-gradient and actor–critic methods support continuous actions.

Reward maximization is not equivalent to safety or stability. Electrical applications require explicit constraints, action filtering, backup control, robustness analysis, and staged validation. Simulation-to-reality transfer depends on calibrated models, uncertainty randomization, hardware-in-the-loop testing, and conservative deployment. A layered hybrid architecture is usually more credible than an unprotected end-to-end learned controller.

Key Terms

Markov decision process: A sequential decision model defined by states, actions, transitions, rewards, and a discount factor.

Markov property: The condition that the next-state distribution depends on the present state and action, not the full history.

Policy: A rule or probability distribution for selecting actions from states.

Return: The accumulated, usually discounted, future reward.

Value function: Expected return from a state under a specified policy.

Action-value function: Expected return from a state–action pair.

Bellman equation: A recursive relationship expressing value in terms of immediate reward and future value.

Reinforcement learning: Learning control or decision policies through interaction and reward feedback.

Model-free RL: RL that does not explicitly estimate the transition model.

Model-based RL: RL that uses a plant or learned transition model for prediction or planning.

Actor–critic: An RL architecture combining a policy actor and value-estimating critic.

Reward shaping: Designing reward signals to encourage desired behavior.

Constrained MDP: An MDP in which policies must satisfy specified resource or safety constraints.

Safety filter: A mechanism that modifies proposed actions to satisfy admissibility conditions.

Adaptive control: Control that estimates changing system characteristics and adjusts its law.

Model-predictive control: Receding-horizon optimization using a plant model and constraints.

Lyapunov function: A scalar function used to analyze stability through its sign and change over time.

Domain randomization: Training across randomized model parameters to improve transfer robustness.

Reality gap: Difference between simulated and physical-system behavior.

Hybrid intelligent control: An architecture combining learning with models, optimization, and conventional control.

Review Questions

Short Answer Questions

  1. What distinguishes a policy from a value function in reinforcement learning?
  2. State the Markov property in the context of a controlled electrical system.
  3. Why can reward penalties fail to guarantee constraint satisfaction?
  4. Identify two advantages of model-predictive control for electrical applications.
  5. What is meant by the simulation-to-reality gap?

Long Answer Questions

  1. Compare classical, adaptive, fuzzy, MPC, and reinforcement-learning control in terms of models, adaptation, constraints, and verification.
  2. Explain the Bellman optimality equation and its significance for sequential control.
  3. Discuss why a high RL reward does not establish closed-loop stability.
  4. Develop a safe deployment workflow for an RL controller operating a power converter.
  5. Explain how domain randomization and hardware-in-the-loop testing can improve transfer to physical systems.

Analytical / Application Questions

  1. Design an MDP formulation for voltage regulation in a distribution feeder. Define the state, action, transition uncertainty, reward, and at least four constraints.
  2. An RL policy proposes battery discharge power that would violate an SOC limit. Propose an action-filtering and fallback strategy, and explain what evidence would be required before deployment.
  3. Compare an RL controller with constrained MPC for a microgrid with renewable intermittency. Recommend a hybrid architecture and justify the division of responsibilities.

Multiple Choice Questions with Answers

Question 1

Which statement best describes the Markov property?

A. The reward must always be positive.

B. The next-state distribution depends only on the current state and action.

C. The controller must use a linear plant model.

D. The policy must be deterministic.

Correct Answer: B. The next-state distribution depends only on the current state and action.

Question 2

In the discounted return Gₜ = Σₖ₌₀∞ γᵏrₜ₊ₖ₊₁, what does γ control?

A. The actuator bandwidth

B. The sampling frequency

C. The relative importance of future rewards

D. The number of actions

Correct Answer: C. The relative importance of future rewards

Question 3

Which method explicitly solves a constrained finite-horizon optimization repeatedly?

A. PID control

B. Model-predictive control

C. Tabular Q-learning

D. Unsupervised clustering

Correct Answer: B. Model-predictive control

Question 4

Why is a penalty term alone insufficient for guaranteeing safety?

A. Penalties cannot be computed numerically.

B. The controller may accept a catastrophic violation for greater long-term reward.

C. Penalties work only for discrete actions.

D. Penalties eliminate all exploration.

Correct Answer: B. The controller may accept a catastrophic violation for greater long-term reward.

Question 5

What is the principal role of a critic in an actor–critic method?

A. To estimate value or advantage

B. To measure battery temperature directly

C. To replace all constraints

D. To generate sensor hardware

Correct Answer: A. To estimate value or advantage

Question 6

Which is a suitable example of a hard electrical constraint?

A. A preferred neural-network architecture

B. A maximum converter current

C. A training random seed

D. A qualitative design preference

Correct Answer: B. A maximum converter current

Question 7

For sampled error data, the approximation IAE ≈ Σₜ |eₜ|∆t has units of:

A. Error divided by time

B. Time divided by error

C. Error multiplied by time

D. Dimensionless quantity in every case

Correct Answer: C. Error multiplied by time

Question 8

Which practice directly addresses the simulation-to-reality gap?

A. Removing all disturbances from simulation

B. Using calibrated models and hardware-in-the-loop testing

C. Training only on one nominal parameter set

D. Ignoring sensor delays

Correct Answer: B. Using calibrated models and hardware-in-the-loop testing

Question 9

What is a principal benefit of a safety filter?

A. It guarantees perfect prediction.

B. It modifies a proposed action to satisfy specified admissibility conditions.

C. It removes the need for testing.

D. It makes every reward positive.

Correct Answer: B. It modifies a proposed action to satisfy specified admissibility conditions.

Question 10

Which architecture is generally most defensible for safety-critical electrical control?

A. Unrestricted end-to-end learning without fallback

B. A layered hybrid architecture with learning, constraints, and conventional control

C. A random policy with a large penalty

D. A controller validated only in one simulation

Correct Answer: B. A layered hybrid architecture with learning, constraints, and conventional control

AI Applications in Electrical Engineering
Chapter 8 of 14