This repository contains a rigorous, simulation-based engineering project for the closed-loop speed control of a Brushless DC (BLDC) motor. The project implements a continuous-time Proportional-Integral-Derivative (PID) controller architecture within MATLAB/Simulink, fully characterizing reference tracking, disturbance rejection, actuator saturation, and controller sensitivity.
Precise speed control of BLDC motors is critical in applications ranging from robotics to industrial automation. However, high-performance control must manage nonlinear physical constraints such as actuator voltage saturation, load-torque disturbances, and integrator windup. This project addresses these challenges by designing and thoroughly analyzing a robust continuous-time PID controller under realistic electromechanical constraints.
- Formulate the linear mathematical model of the BLDC motor.
- Design a continuous-time PID control architecture with derivative filtering.
- Implement realistic
$\pm 24\text{ V}$ actuator saturation limits. - Mitigate integrator windup using a clamping anti-windup configuration.
- Evaluate the system across a broad reference-speed and load-torque envelope.
- Validate reproducibility through a fully automated MATLAB test suite.
The closed-loop architecture operates via the following continuous-time signal flow:
Reference Speed [rad/s]
│
▼
[Error] ◄────────────────────────────────────────┐
│ │
▼ │
[PID Controller] (with clamping & derivative filter) │
│ │
▼ │
[Saturation] (±24V Limits) │
│ │
▼ │
[BLDC Motor] ◄──── [Disturbance Torque (TL)] │
│ │
▼ │
Speed Feedback [rad/s] ─────────────────────────────┘
The BLDC motor is governed by two interlinked linear differential equations:
Electrical Stator Dynamics (KVL):
Electromechanical Torque Coupling:
Mechanical Rotor Dynamics (Newton's Second Law):
Combining these yields the open-loop transfer function (from armature voltage to rotor speed):
The physical constants utilized in the mathematical model are defined in scripts/params.m:
-
$R$ (Armature Resistance):$0.5,\Omega$ -
$L$ (Armature Inductance):$0.5,\text{mH}$ -
$K_t$ (Torque Constant):$0.05,\text{N}\cdot\text{m/A}$ -
$K_e$ (Back-EMF Constant):$0.05,\text{V}\cdot\text{s/rad}$ -
$J$ (Rotor Inertia):$10^{-5},\text{kg}\cdot\text{m}^2$ -
$B$ (Viscous Friction):$10^{-5},\text{N}\cdot\text{m}\cdot\text{s/rad}$
A parallel continuous-time PID controller was designed with the following baseline gains:
-
$K_p$ (Proportional):$0.0100$ -
$K_i$ (Integral):$10.0000$ -
$K_d$ (Derivative):$0.001000$ -
$N$ (Filter Coefficient):$100\text{ rad/s}$
These parameters provide a validated operating point satisfying transient constraints (
The derivative term incorporates a first-order low-pass filter (
The project strictly models actuator saturation at
To mitigate this, the controller uses a clamping anti-windup configuration. Under the tested saturation conditions, the clamping configuration limited integral accumulation during saturation, preventing delayed recovery and ensuring the measured steady-state error remained
The model is constructed in Simulink (models/bldc_cl_model.slx) and simulated using the continuous variable-step ode45 solver, providing a high-fidelity evaluation of the closed-loop system dynamics.
Under a nominal reference step of
-
Rise time (
$10\text{--}90%$ ):$\approx 23.35\text{ ms}$ -
Settling time (
$2%$ band):$\approx 61.18\text{ ms}$ -
Percentage Overshoot:
$\approx 2.83%$ -
Steady-State Error:
$0.0000%$ -
Peak Control Voltage:
$24.00\text{ V}$ -
Saturation Duration:
$\approx 20.14\text{ ms}$
The dynamic scaling of the closed-loop system was evaluated across a multi-setpoint envelope to verify linearity. The tested reference sweep included:
$50, 75, 100, 125, 150, 200\text{ rad/s}$
Measured results confirmed that the percentage overshoot and steady-state error (
The controller's robustness against external load variations was evaluated using a bidirectional step disturbance sweep spanning:
$-0.015, -0.010, 0, +0.005, +0.010, +0.015, +0.020, +0.025, +0.030\text{ N}\cdot\text{m}$
For the authoritative baseline disturbance (
Parametric sweeps evaluating
An automated test suite (scripts/run_all_tests.m) programmatically verifies system stability and numerical tolerances. The suite executes 10 distinct checks covering parameters, model integrity, transient metrics, anti-windup clamping, and disturbance recovery.
All automated validation checks passed, matching authoritative baseline evidence without regression.
| Metric | Measured Result |
|---|---|
|
Rise Time ( |
|
|
Settling Time ( |
|
| Overshoot | |
| Steady-State Error | |
| Baseline Disturbance Dip | |
| Actuator Limit | |
| Saturation Duration | |
| Reference-Speed Range | |
| Load-Torque Range |
Project1/
├── README.md
├── LICENSE
├── .gitignore
├── models/ # Simulink (.slx) plant and closed-loop models
├── scripts/ # Execution scripts and automated test suite
├── results/ # Validated experimental CSV data and test logs
models/: The core continuous-time architecture.scripts/: The master validation suite and component analysis scripts.results/: The quantitative historical outputs and CSV datasets verifying performance.
The results documented in this repository are subject to the following simulation constraints:
- Simulation-Only Model: Continuous-time MATLAB/Simulink simulation utilizing the adaptive
ode45solver. - No Hardware Verification: The project does NOT include physical BLDC motor testing, STM32 MCU deployment, or Hardware-In-the-Loop (HIL) validation.
- Idealized Parameters: Plant parameters are fixed, excluding real-world phenomena like temperature drift or magnetic saturation.
- No Switching Harmonics: The inverter is modeled as a continuous voltage source; PWM switching harmonics, deadtime distortion, and inverter hardware limits are not simulated.
- Ideal Sensing: Speed feedback is assumed instantaneous and noise-free, lacking encoder quantization or sensor noise validation.
Developed as an engineering demonstration of applied continuous-time control theory in MATLAB/Simulink.