Linear Model Predictive Control in MATLAB - Part 3 (Constraints on Controlled Variable)
๐ฌ๐ผ๐๐ฟ ๐ณ๐ฎ๐๐ผ๐๐ฟ๐ถ๐๐ฒ ๐ณ๐ฒ๐ฎ๐๐๐ฟ๐ฒ ๐ถ๐ป ๐ ๐ผ๐ฑ๐ฒ๐น ๐ฃ๐ฟ๐ฒ๐ฑ๐ถ๐ฐ๐๐ถ๐๐ฒ ๐๐ผ๐ป๐๐ฟ๐ผ๐น? Constraints are a big one. Let's recap what was in the last post. โ ๐ฃ๐น๐ฎ๐ป๐ 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 Constraints: ๐ Manipulated variable: [-10, 10] N MPC parameters: ๐ Sample time: 0.1 s ๐ Prediction horizon: 10 ๐ Control horizon: 2 โ ๐๐ป๐ฎ๐น๐๐๐ถ๐ For this analysis, we want to test the effect of constraints on the controlled variable (the position). To make the effect more visible, the MPC controller has been modified to be more aggressive (weight on the manipulated variable rate of change = 0) and cause more overshoot. The overshoot with no constraints is up to 1.1 m. We want to test the impact of: ๐ Position constraint: [-1.15, 1.15] m ๐ Position constraint: [-1.05, 1.05] m ๐ Position constraint: [-1.02, 1.02] m โ ๐ฆ๐ถ๐บ๐๐น๐ฎ๐๐ถ๐ผ๐ป ๐ฅ๐ฒ๐๐๐น๐ The simulation is performed directly in MATLAB using the command ๐๐ถ๐บ, for 6 seconds, on the nominal system, with the 3 different combinations of constraints listed above. We can observe how the MPC algorithm changes its control approach to prevent the controlled variable (the position) from going above the constraint. I find this feature of MPC fascinating. The next steps will be: ๐ More constraints ๐ 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.