This project represents a comprehensive engineering study on the mathematical modeling and automated control of DC motors. It transitions from classical control theory (Ziegler-Nichols) to advanced state-space representations and AI-driven optimization using Genetic Algorithms (GA).
- Mathematical Modeling: Derived differential equations for the electrical and mechanical subsystems of a DC motor.
- State-Space Representation: Developed the state-space model to analyze internal system variables.
- Advanced PID Features: Implemented a Filter Coefficient (N) in the derivative term to suppress high-frequency noise amplification.
- Stability Analysis: Comprehensive validation using Bode Diagrams and Nyquist Plots to ensure robust stability margins.
The project utilizes a high-fidelity plant model developed in MATLAB/Simulink.
We defined the motor dynamics using the following parameters (as derived in the paper):
-
Electrical: Resistance (
$R$ ), Inductance ($L$ ), Back-EMF constant ($K_e$ ). -
Mechanical: Inertia (
$J$ ), Friction ($b$ ), Torque constant ($K_t$ ).
| Method | Description |
|---|---|
| Ziegler-Nichols | Open-loop step response analysis using the tangent method at the inflection point. |
| Genetic Algorithm (GA) | Metaheuristic search for optimal |
| State-Space Control | Analysis of the system through state variables for more complex control requirements. |
The optimization process targets the minimization of a weighted cost function
-
Settling Time Optimization: Heavily weighted (
$\beta = 0.5$ ) to ensure rapid system response. - Constraint Handling: A penalty factor is applied if the system exceeds the 2-second stability threshold.
As detailed in the research paper, the system's stability was verified through frequency response methods. The Bode Plot analysis ensures that the phase and gain margins are sufficient to handle load variations without oscillation.
functions/: Contains the Simulink models (.slx) and the GA fitness function.scripts/: MATLAB scripts for Z-N parameters and performance extraction.docs/: (Recommended) Place thekomandim det kursi.docxor a PDF version here for full theoretical reference.
- Open MATLAB and add the project folders to your path.
- Run
pid_optimizationGA.mto execute the AI-driven tuning. - Observe the output in the Scope block of the Simulink model for real-time visualization of the speed regulation.
This project was developed as part of the "Computer Control" course at the Polytechnic University of Tirana (FTI). Contributors: Samuel Koçi and classmates. Supervisor: Prof. Miranda Hariza.

