Model Predictive Control (MPC) - Control Automatic Control

3y ago
72 Views
2 Downloads
2.23 MB
51 Pages
Last View : 23d ago
Last Download : 3m ago
Upload by : Evelyn Loftin
Transcription

Model Predictive Control (MPC)Bo Bernhardsson and Karl Johan ÅströmDepartment of Automatic Control LTH,Lund UniversityBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Model Predictive Control (MPC)MPC Problem Setup and ParametersOptimization ProblemMPC ToolsHow to get Integral ActionExample - Quad TankExplicit MPC and CVXGENMaterial:Rawlings (2000), Tutorial overview of model predictive controlÅkesson (2006), Manual to MPC tools 1.0Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Basic Idea of MPC: Receding Horizon Control12At time k solve an open loop optimal control problem over apredefined horizon and apply the first inputAt time k 1 repeat the same procedure (the previous optimalsolution can be used as initial guess)Bellman’s principle of optimalityBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Model Predictive ControlModel Predictive Control (MPC)Uses models explicitly to predict future plant behaviourConstraints on inputs, outputs, and states are respectedControl sequence is determined by solving an (often convex)optimization problem each sampleCombined with state estimationBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPCRefineries (Shell in 1970s, "Dynamic Matrix Control")(Bellman), Propoi (1963), Richalet, Prett, Morari, . . .Main reasons for successSuitable for multivariable systemsRespects actuator limitations: no integrator wind-up, saturationproblems handled explicitlyProcess can be run close to constraints, which is oftencost-effectiveBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Optimization CriterionControl changes u(k i) u(k i) u(k i 1) areoptimization variablesHp Hw 1J(k) X ẑ(k i k) r(k i) 2Q HXu 1 u(k i) 2Ri 0i HwEvaluated signals z Cz x Dz uHw : system time-delayHu : cover typical closed loop time constantHp : somewhat larger than HuBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Prediction Horizons (with Hw 0)r(k)ŷ(k)y(k)u(k)u(k)kk Huk HptLarge Hu and Hp give better performance but more computations andnumerical problemsBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

u(k) vs u(k)Why penalize u(k) instead of u(k)?Reference r 6 0 requires u 6 0 to avoid static errorNo need to guess and specify urStill possible to penalize u(k), just include u in z -vectorTAT: Do we get integral action by penalizing u instead of u?Consider y u d, do we get y r in stationarity if d 6 0?Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Block Diagram (typical)evryyuMPCPLANTdv, d, e disturbances, v available for feedforwardr reference valueBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Assumed Dynamicsxk 1 Axk Bu uk Bv vk Bw wkyk Cxk Dv vk Dw wk"#dkwhere vk is a measured disturbance and wk .ekBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Prediction AlgorithmsFuture trajectories starting at time k over the prediction horizon HpAssuming v is not known in advance yk Hp k C AHp xk Hp 1XAHp 1 B(uk 1 j 0Bo Bernhardsson and Karl Johan ÅströmjXi 0 ui ) Dv vHpModel Predictive Control (MPC)

MPC Prediction AlgorithmsAll Hp predicted time steps can be summarized as yk 1 yk 2 . . yk Hp uk uk 1 Sx xk Su 1 uk 1 Su . . Bo Bernhardsson and Karl Johan Åström uk Hp 1 vk vk 1 Hv . . Model Predictive Control (MPC)vk Hp

MPC Prediction Algorithms.where CA 2 CA Sx RHp ny nx. . . Hp CASu 1 CBu RHp nx nuCAB CB uu P Hp 1 jj 0CA BuBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Prediction Algorithms. and CBu0.0 CBu CABuCBu.0 RHp ny Hp nu.Su . . . . PHp 1 PHp 1jj. . . CBuj 0 CA Buj 0 CA Bu CBvD0. 0 CABvCBvD0 RHp ny (Hp 1)nvHv . . . CAHp 1 Bv CAHp 2 Bv CAHp 3 Bv . . . DBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Blocking FactorsAt each step the following cost function is minimizedHp 1J(k) X ŷ(k i k) r(k i k) 2Q i kHXu 1 u(k i k) 2Ri kBlocking factors can be used to ease the computationalrequirements. This means that constraints and cost is onlyevaluated at certain time steps, contained in sets Ip and Iu .J(k) X ŷ(k i k) r(k i k) 2Q i IpX u(k i k) 2Ri IuMove blocking restrictions can also be imposed on the controlsignal, so that u 0 at certain time stepsBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Optimization VariablesIntroduce the optimization variables, if we have reference controlsignals urkeu uk uk 1 . . uk Hp 1ande u uk uk 1 . . uk Hu 1 , urk urk 1 . . ruk Hp 1 yk 1 y k 2 ey . . yk Hpfor control moves and reference trackingBo Bernhardsson and Karl Johan Åström , rk 1 rk 2 . . Model Predictive Control (MPC)rk Hp

MPC Optimization VariablesFor unconstrained optimization, the cost function is2J(z) eTu Wu2 eu eT u W ue u eTy Wy2 eywhere the first term penalizes control signals, the second penalizescontrol moves and the last term penalizes tracking error.Matrices Wu , W u , and Wy are design parameters.Alternative notation (here without eu )Hp 1J(k) X ŷ(k i k) r(k i ki k) 2Q HXu 1 u(k i k) 2Ri kMatrices Q and R are (possibly time-varying) design parameters.Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

ConstraintsThe MPC controller should respect the constraints umin u(k) umaxumin u(k) umaxzmin zc (k) zmaxSome variables might be constrained, but have no reference valuesIf a constrained variable is not measured, the constraints will be put onan estimate insteadBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Soft or Hard Constraints?Always need to find a u. Problem if constraints unfeasible.Replace hard constraints with soft constraints.Minimize slack variable ǫ 0 so that ymin max y yk 1k 1 k 1 . . . . . ymin max yk H k Hpyk Hpp umin umax uk k 1k 1 . . ǫV min . . uk H. 1 umin max upk Hp k Hp max u umin k uk k . . . . max . min uk Hu 1 u uk H 1uk Hu 1 max ǫV Relaxation vectors V min 0, V max 0 are user definedparameters. Larger V , more relaxed constraintBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Optimization ConstraintsFor the constrained case, a suitable MPC cost criterion to beminimized is2J(z, ǫ) eTu Wu2 eu eT u W ue u eTy Wy2 ey ρǫ ǫ2subject to dynamics and constraintsA large value of ρǫ penalizes constraint violation harder.In practice, softening of output constraints is often a good idea.Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Design ParametersInternal Dynamic Model(State Estimation Parameters)Prediction- and Control HorizonsBlocking factorsWeighting MatricesConstraint ParametersSample rateIntegral action? alt. disturbance modelBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Quadratic OptimizationThe optimization problem is often posed as quadraticprogrammingminx1 T2 x Hx fTxsubject to Ax bIn M ATLAB: ’quadprog’Advantages with QP: Fast, reliable softwareBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Disturbance ModelsWhen solving the optimization problem, predicted future values ofthe disturbances are neededWith some knowledge about the nature of the disturbances theprediction can be improvedOften Gaussian noise and Kalman filter is usedCan also formulate the prediction problem as a QP problem, e.g.maximizing log-likelihood of measurementsOptimization approach to estimation can e.g. give robustness tooutliersBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

State Estimation - Error Update 0 0 x̂k k x̂k k 1 x̂d d x̂ K (ykm ŷkm ) k kk k 1 m m x̂k kx̂k k 1d : known disturbancem : reference modelBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Internal Dynamic Model 0 x k 1 d x k 1 m xk 1B0 Cd 0 x0k Bu d Ad0 x0 uk k m xk0Am0 A 0 0 0 Bv B0 Dd 0 v k Bd 0 ykm C0 Cd0 0 Bu00Bm 0 0 xk D d xCm mk mBo Bernhardsson and Karl Johan Åström wd k Bv wkm 0 u w k 0 v wkD 0xkModel Predictive Control (MPC) d wk m wk 0 u w k wkv

State Estimation - Temporal Update 0 x̂k 1 k d x̂ k 1 k m x̂k 1 kx̂0k k 1 B0 Cd 0 Bu d x̂Ad0 0uk k k 1 v0Am0x̂k k 1 A0 0 0 Bv B0 Dd 0 Bd vk 0ŷkm C00Cd wkd 0 Bu Bv wkm 000 u w k Bm 00 v wk 0 x̂k k 1 x̂d Cm k k 1 m Bo Bernhardsson and Karl Johan Åström x̂k k 1Model Predictive Control (MPC)

SoftwareMPCtools - Developed by Johan Åkesson, Automatic Control,LundSeparates measured/constrained/controlled outputsIntegral action by means of disturbance estimationDifferent QP-solvers for the optimization problemUsed in Lab 3 i Predictive controlMathworks - Model Predictive Control ToolboxGUI or text-based control designIntegrated observer design and basic disturbance modelingMPT - Multi-Parametric Toolbox for Matlab from ETHSupports linear, nonlinear, and hybrid system descriptionsExplicit MPCCVX CVXGen: MPC code generator, runs typically on micro ormillisec for small size problems. Nice project!Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC ToolboxModel assumptions in MPC toolboxx(k 1) Ax(k) Bu(k)y(k) Cy x(k)z(k) Cz x(k) Dz u(k)zc (k) Cc x(k) Dc u(k)Measured outputs yControlled outputs zConstrained outputs zc(no known disturbances)Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPCTool - Control ProblemCost functionHp Hw 1J(k) Xkẑ(k i k) r(k i k)k2Q i HwHXu 1k u(k i k)k2Ri 0Prediction Horizon, HpControl Horizon, HuFirst sample to be included, HwBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)(1)

Solving the Quadratic Program (QP)One can rewrite the optimization criterion on the formmin J(k) U T H U U T G E T QEsubject to Ω U ωwhere U, H, G, E, Q, Ω, ω are large vectors/matrices, used to stackup the equations above for all time indices.Details are in the MPC toolbox manual, but will not be neededConvex problem - efficient algorithmsBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

State EstimationUse a traditional Kalman filter, having the formx̂(k 1) Ax̂(k) Bu(k) K(y(k) Cy x̂(k)).Gain matrix K obtained by solving a Riccati equation(information about state constraints are not utilized in MPCTool)Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Error-free tracking - Integral Action 1One option is to use a disturbance observerA step disturbance is assumed to act on the input, the followingextended model is then used (when r 0): xk 1 A 0 B xk B 0 ukv0I0 v k 1 k dk 1z yzya0 Cz Ca0I0dk 0 0 xTk I 0 xTkvkTvkT TdTk TdTk Using an observer with this model structure will introduce integralaction giving z 0 in stationarity.If more outputs than inputs, one must introduce constant outputdisturbances vk on the outputs ya that shouldn’t get integral actionIf nr inputs nr outputs one doesn’t need ya and vkBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Error-free tracking - Integral Action 2Another option is to add integrator states in the model"# "#"#x(k 1)xi (k 1)A0 Cz I y(k) z(k) hhCy 0Cz 0x(k) B0u(k) "0I#r(k)iiA stabilizing feedback is calculated using the extended state. Note thatthe state xi need not be estimated, since it is known perfectly by thecontrollerPolynomial design interpretation to the two methodsA(q 1)R′ BS Am Ao B where either Ao (previous slide) or Am (this slide) has an increasedorder compared to the minimal orderBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Linear Properties of the MPC ControllerThe MPC controller is nonlinear, because of constraints on state andcontrolHowever, if the constraints are not active, the controller is linearThe minimizing solutions of the unconstrained QP is then U(k) (ΘT QΘ R) 1 ΘT QE(k) . for some vector K̄s r(k) K̄s u(k 1) x̂(k)Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Linear Properties of the MPC ControllerThis means the control law can be writtenihh u(k) wherehKsr Ksu KsxKsr Ksu KsxThis means that withir T (k) uT (k 1) x̂T (k)is given by the first m rows of K̄sP (z) Cy (zI A) 1 BH(z) Ksx Hy (z)Hy (z) (zI A KCy ) 1 KHu (z) (zI A KCy ) 1 Bwe get the following figureBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)iT

Linear Properties of the MPC Controller u(k)r(k)Ksr zz 1 IKsuz 1 IKsxHu (z) KsxHy (z)u(k)y(k)P (z)Equivalent linear timeinvariant controllerK(z) 1z1zKsu Ksx Hu (z)I z 1z 1z 1 Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC ToolsMPC controller calculate ,simulate and evaluate in Matlab/SimulinkGood QP solver implementations with active set and interior pointmethodsMain commands: MPCInit (output: data-structure "md"), MPCSim,MPCController, MPCfrspMode 0: State feedback.Mode 1: State feedback with explicit integrators.Mode 2: Observer-based output feedback.Mode 3: Observer-based output feedback with explicitintegrators.Mode 4: Observer-based output feedback with a disturbancemodel that gives error free tracking.Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC ToolsFigure: A Simulink model where the MPC controller is used to control anonlinear plant.Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Example - Quad Tank1 γ1replacementsTank 31 γ2Tank 4γ2γ1Pump 1u1Pump 2Tank 1Tank 2u2Challenging MIMO process. Parameters γ1 , γ2 control the flowstructure to the upper and lower tanks respectivelyNon-minimum phase dynamics if e.g. γ1 γ2 0.3See e.g. MPCTools manual for a modelBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

MPC Controller ParametersParameterhHpHwHuIpIuQRWVValuesampling rate 3 sec30110blocking factor 2blocking factor 2diag(4, 1)diag(0.01, 0.01)diag(1, 1, 1, 1)/diag(1, 1, 1, 1, 1, 1)diag(0.01, 0.01)Constraints: 0 x 19.8 cm on all tanks0 u 10 V on both pumpsBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Typical Code% Some initialisation of matrices left out hereHp 30; % Prediction horizonHu 10; % Horizon for varying input signalHw 1; % First penalty samplezblk 2;ublk 2;Q diag([4 1]);R 0.01*diag([1 1]);W diag([1 1 1 1]);V diag(0.01*ones(1,2));md lk,du max,du min,u max,u min,z max, .z min,Q,R,W,V,h,2,’qp as’);MPCfrsp(md,10);[x,u,y,z,zp,up] MPCSim(md,s,d);% Plotting left out hereBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Results, simulation on linearized plant8h4 [cm]1010h3 [cm]1286644020040060080021000 120016201419.5h [cm]121002004006008001000 120018u2 [V]16008001000 120002004006008001000 12000200400600t [s]8001000 120083u [V]4001942641020018.58602h1 [cm]20200400600t [s]8001000 12002Dashed: Kalman filter, no integral actionSolid: Kalman filter with disturbance observerBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Results, simulation on nonlinear plant1410810h4 [cm]h3 [cm]1286644020040060080021000 120016201419.5h [cm]1202004006008001000 120002004006008001000 12000200400600t [s]8001000 1200192h1 [cm]21018.5861802004006008001000 120048u2 [V]1u [V]3241060200400600t [s]8001000 12002Works wellBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Results, MPC linear behaviorWithout the contraints, the MPC controller gives the following gaincurves. The plots show singular values for the 2 2 system.-20-20-10-20-30-41001010Frequency (rad/s)Complimentary Sensitivity-20-2010-40-60-80-4100Complimentary Sensitivity100-10-20-4100-20-210Frequency (rad/s)010Left: Without integral actionBo Bernhardsson and Karl Johan Åström0103050-5-10-15-410-210Frequency (rad/s)Control Sensitivity to Noise10Singular Values (dB)Singular Values (dB)Singular Values (dB)0-10-21010Frequency (rad/s)0102010Frequency (rad/s)-20Control Sensitivity to Noise10-30-4100-10-30-210Frequency (rad/s)20Singular Values (dB)-10Sensitivity Function10Singular Values (dB)Singular Values (dB)Singular Values (dB)0-30Closed LoopSensitivity Function10Singular Values (dB)Closed Loop10-210Frequency (rad/s)01020100-10-20-410Right: With integral actionModel Predictive Control (MPC)-210Frequency (rad/s)010

Explicit MPCFor applications where very short sample times are required,there may not be time to solve the optimization problem at eachtime step.Explicit MPC calculates a state feedback law that is equivalent toMPC in a specific region of the state-spaceAs constraints are activated, the feedback law changes indifferent parts of the state-spaceCertainty equivalance used u K(x̂)x̂Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Explicit MPC ExampleFor the plantY (s) 1U (s)s 1with constraints 3 y(t) 3 0.1 u(t) 0.1 0.05 u(t) 0.05the regions might look like.Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Explicit MPC Example0.1u0.050 0.05 0.1 3 2 1Bo Bernhardsson and Karl Johan Åström0x12Model Predictive Control (MPC)3

CVXGENDeveloped at StanfordCVXGEN generates fast custom code for small, QP-representableconvex optimization problems, using an online interface with nosoftware installation. With minimal effort, turn a mathematical problemdescription into a high speed solver.See http://cvxgen.com/Bo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

CVXGENDescribe your small, quadratic program (QP) representableproblem with a simple, powerful language.CVXGEN automatically creates library-free C code for a custom,high-speed solver. This can be downloaded and usedimmediately, and requires nothing but a C compiler. CVXGENalso supplies a Matlab function that, with one command,downloads and builds a custom Matlab mex solver.CVXGEN performs most transformations and optimizationsoffline, to make online solution as fast as possible. Codegeneration takes a few seconds or minutes, producing solversthat work in microseconds or milliseconds. Compared withgeneric code (CVX), solution times are typically at least 20 timesfaster, with the smallest problems showing speedup as large as10,000xBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

CVXGEN: MPC ExampleBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

CVXGEN: MPC Example - Input CodeBo Bernhardsson and Karl Johan ÅströmModel Predictive Control (MPC)

Model Predictive Control Model Predictive Control (MPC) Uses models explicitly to predict future plant behaviour Constraints on inputs, outputs, and states are respected Control sequence is determined by solving an (often convex) optimization problem each sample Combined with state estimation

Related Documents:

We highly recommend using your MPC hardware’s sound card (Akai Pro MPC X/Live/Touch ASIO). If you need to use the internal sound card on a Windows computer, we recommend downloading the latest ASIO4ALL driver at asio4all.com. To view the MPC software user guide, click the Help menu in the MPC software, select MPC Help, and select

MN SU-MPC ING March 2008 Page 1 of 9 INSTRUCTION MANUAL ALSATOM SU 50-MPC, SU 100-MPC, SU 140-MPC, SU 140/D-MPC This unit is manufactured by ALSA APPARECCHI MEDICALI S.R.L., Via C. Bonazzi 16, 40013 Castel Maggiore (BO), Italy, that guarantees its safety,

automotive systems, and we highlight the benefits that MPC can provide as well as the challenges faced by MPC in this domain. Then, given that MPC is a model-basedcontrol approach,for the main automotive . network control in automotive systems [15], stochastic MPC for cooperative cruise control [72], robust

CHAPTER 10 Aggregate Demand I 13 Solving for Y: (1 MPC) MPC Y T MPC 1MPC Final result: Y T The tax multiplier def: the change in income resulting from a 1 increase in T : MPC 1MPC Y T CHAPTER 10 Aggregate Demand I 14 0.8 0.8 4 10.8 0.2 Y T If MPC 0.8, then the tax multiplier equals The tax multiplier

MPC Renaissance and MPC Studio are unrivaled instruments for music production. The new flagship is a fully integrated hardware/software system: MPC Renaissance allows you to create using classic hardware controls and an integrated pop-up display, while its exclusive MPC

model predictive control (MPC). As an advanced control methodology, MPC has been applied in real-time operation of industrial chemical plants to optimize process performance accounting for process stabil-ity, control actuator, and safety/state constraints.5,6 One key require-ment of MPC is the availability of an accurate process model to .

nonlinear controller, called model predictive control, MPC. The idea in MPC is to repeatedly solve optimization problems on-line in order to calculate control inputs that minimize some performance measure evaluated over a future horizon. MPC has been very successful in practice, but there are still considerable gaps in the theory.

Here are a few suggested references for this course, [12,15,1]. The latter two references are downloadable if you are logging into MathSci net through your UCSD account. For a proof that all p{ variation paths have some extension to a rough path see, [14] and also see [6, Theorem 9.12 and Remark 9.13]. For other perspectives on the the theory, see [3] and also see Gubinelli [7,8] Also see, [9 .