Is there an example of a technical system model in Simscape with a PID controller and an LQR controller?

2 views (last 30 days)
The question is: is there a ready model of some technical system, in simscape, which is controlled by a classical sub-controller and a linear quadratic-controller, so that it is possible to compare the simulation results? For example, I have model of cooling system https://www.mathworks.com/help/hydro/ug/refrigeration-system-level.html In this model system controlled by thermostat and pid regulator with transfer function 1/(2s+1l... Is it possible to integrate a ready-made block for control with the help of the lqr regulator into this model? Or is there another example of a model in simscape?

Accepted Answer

Ashok
Ashok on 29 Nov 2024
Edited: Ashok on 29 Nov 2024
Thelqrcommand in the Control System Toolbox is used to design a linear quadratic controller in MATLAB. However, as noted in this MATLAB Answer, there isn't a Simulink block for the LQR controller that can be directly used:
An alternative approach is to design the LQR gain in a MATLAB script using a linearized state-space model. The calculated LQR gain can then be accessed inside Simulink to implement the controller. Here's an example of designing and implementing an LQR controller for a spring-mass-damper system modelled in Simscape.
In the attached files, thelqr_design_R2023a.mscript contains the LQR design for the linearized state-space model. The corresponding Simscape model is in themodel_R2023a.slxfile. The LQR gain,K, is designed in the MATLAB script and accessed by the gain block from the MATLAB workspace.
The state-cost and input-cost weights,Q’ and ‘R, can be adjusted in the MATLAB script to achieve the desired response. Here's the response for the current weights.
A similar approach can be used for a pole placement controller, which can be designed using theplacecommand. Here are some relevant documentation links:

More Answers (0)

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!