Linear Model Predictive Control in MATLAB - Part 1
Linear Model Predictive Control in MATLAB - Part 1 Here's a ๐ฃ๐ผ๐๐ถ๐๐ถ๐ผ๐ป ๐๐ผ๐ป๐๐ฟ๐ผ๐น example: โ ๐ฃ๐น๐ฎ๐ป๐ An object of mass m = 10 kg, sliding on a surface, subject to a damping coefficient k = 0.5 N*s/m, pushed by a force F. The dynamic equation is: ๐ z'' m = F - k z' Using MPC, we want to control the object's position via the force input. Note that the system is linear. โ ๐ฃ๐น๐ฎ๐ป๐ ๐ ๐ผ๐ฑ๐ฒ๐น ๐ถ๐ป ๐ ๐๐ง๐๐๐ ๐ณ๐ผ๐ฟ ๐ ๐ฃ๐ To implement linear MPC in MATLAB/Simulink we need to create a linear MPC object (mpc) in MATLAB and give it our dynamic system. The system is of the type: ๐ x' = Ax + Bu ๐ y = Cx + Du where u = F and x = [z' z]. ๐ A = [-k/m 0; 1 0] ๐ B = [1/m; 0] ๐ C = [0 1] ๐ D = 0 Note that we only measure the position z, not z', as C = [0 1]. โ ๐ง๐๐ป๐ถ๐ป๐ด Scaling factors: ๐ Output variable: 2 ๐ Manipulated Variable: 10 Weights: ๐ Output variable: 1 ๐ Manipulated Variable: 0 ๐ Manipulated Variable Rate of Change: 0.1 Constraints: ๐ Output variable: [-2, 2] m ๐ Manipulated Variable: [-10, 10] N MPC parameters: ๐ Sample time: 0.1 s ๐ Prediction horizon: 10 ๐ Control horizon: 2 โ ๐ฆ๐ถ๐บ๐๐น๐ฎ๐๐ถ๐ผ๐ป ๐ฅ๐ฒ๐๐๐น๐ The simulation is performed directly in MATLAB using the command ๐๐ถ๐บ, for 5 seconds, on the nominal system. The Model Predictive Control algorithm is controlling smoothly and with minimum overshoot. Note that the model used for the algorithm is the same as the model used for the validation, which is not a realistic scenario, and the result is expected to be very good. The next steps will be: ๐ Disturbance rejection ๐ Test for robustness ๐ What else would you like to see? Let me know in the comments! ------------------- โ Know someone who could benefit from this? Tag them in the comments! โ Do you like this content? Subscribe! โ Do you want more? Follow me on LinkedIn https://www.linkedin.com/in/simone-bertoni-control-eng or visit my website https://simonebertonilab.com/ #controlsystems #matlab #simulink #controltheory #mpc
Download
0 formatsNo download links available.