CSTR Optimal Control with Quasilinearization Method
Version 1.0.7 (244 KB) by
Alireza Esmailnezhad
Implementation of optimal control for a CSTR system using QL method to maintain temperature & concentration close to steady state values.
The Continuous Stirred-Tank Reactor (CSTR) is a key system in chemical engineering, used to model reactions and control processes in various industries. This project demonstrates the application of Optimal Control techniques using the Quasilinearization Method to manage and optimize the temperature and concentration states of the reactor. The implementation is based on Example 6.4-3 from the textbook "Optimal Control Theory: An Introduction" by Donald E. Kirk.
State Equations:
The system's dynamics are modeled by the following state equations, describing the deviations in temperature and concentration:
Where:
- x1(t) = T(t): Deviation of temperature from steady-state.
- x2(t) = C(t): Deviation of concentration from steady-state.
- u(t): Normalized coolant flow control input.
Initial Conditions:
The initial conditions for the system are:
Performance Measure:
The control objective is to minimize the following performance measure J, which penalizes deviations in the states and the control effort:
Where:
- R=0.1: Control weight parameter.
Control Objective:
The goal is to design an optimal control law to minimize J over a fixed-time t ∈ [0, 0.78] while ensuring that the system's states are efficiently regulated. The solution employs quasi-linearization techniques to iteratively refine the control and trajectory.
Quasi-linearization (QL):
It is an iterative numerical optimization method used to solve nonlinear optimal control problems. Here's how it works:
- Linearization: The nonlinear system dynamics and costate equations are linearized around an initial guess for the state and costate trajectories.
- Solve Linear Equations: The linearized system is split into homogeneous and non-homogeneous parts. Homogeneous solutions are computed first, followed by particular solutions.
- Superposition Principle: The overall solution is constructed as a combination of the homogeneous solutions, scaled by coefficients (determined using boundary conditions), and the particular solution.
- Update Trajectories: The new trajectories for state and costate variables are calculated and used to update the previous guess.
- Convergence Check: The norm of the difference between successive trajectories is evaluated. If the difference is below a specified threshold (e.g., γ), the algorithm converges.
- Iteration: If not converged, the process repeats by linearizing around the updated trajectories.
The figure below shows result of optimal trajectories for stare and costate and optimal control effort with predefined conditions and γ=0.001:
Cite As
Alireza Esmailnezhad (2025). CSTR Optimal Control with Quasilinearization Method (https://uk.mathworks.com/matlabcentral/fileexchange/178884-cstr-optimal-control-with-quasilinearization-method), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2024a
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
