$25
Selected Topics in Engineering Science
Model Predictive Control
1 Suppose a constant disturbance δ is assumed for the prediction horizon, resulting in the single-output model
x(k + 1)
=
Adx(k) + Bdu(k)
y(k)
=
Cx(k) + Du(k) + δ
a. Obtain the pertinent prediction equations and show that the optimization cost function becomes
where ∆ is a column vector with all elements equal to δ.
b. For the nonlinear plant
=
sin(x1)x2 + u
=
cos(x1)x1
consider the problem of regulation to the origin under the constraint |u| ≤ 1/2 and unit box constraints for the states. Use an MPC linearization approach with linearized model updates at each control iteration (find Jacobians analytically). Take λ = 2, ny = 5, and nu = 4.
Complete the provided code templates to run MPC simulations with and without disturbance compensation. Show summary plots with the predicted and closed-loop outputs, with and without disturbance compensation. Re-tune the disturbance compensation MPC to recover or exceed the performance of the first case. Note that some settings may result in unfeasible OPCs at some iterations.
2 (mini-project) Consider the elevator control problem discussed in class. Your task is to complete the provided code template to simulate closed-loop system operation with linear predictions, as discussed in class. The objective is to move the elevator to a target position using an optimal combination of motor power and motion performance, while maintaining constraints on the cable tension, and car acceleration and velocity for passenger comfort. The mathematical model in C-T can be derived as
where V is the control voltage and the parameters are as follows:
Parameter
Units
Value
Jt
kg-m2
20
a
N-m/A
12
Rm
Ω
0.1
R
m
1
mc
kg
1000
mw
kg
750
The tensions on the car and counterweight cables are given by
Tc = mc(y¨+ g)
Tw = mw(g − y¨)
Assume the elevator starts at y0 = 0 and must stop at y = yf in a reasonable time. Motor voltage must be within ±40 V and the elevator speed and acceleration must be limited by ±3 m/s and ±0.2g.
The current consumed by the motor is given by
Therefore the power P = V im is a quadratic function whose integral can be considered for minimization over some horizon. The position control objective can be measured as an integral quadratic error, using e = y − yf.
Approach: Discretize the plant and use an incremental formulation. To eliminate gravity bias, define
To limit control bandwidth, we impose upper and lower bounds on ∆u of ±1000 V/s and also include a weight on the running cost to penalize ∆u. The running cost will therefore have the form
e2 + λP + λu(∆u)2
a. Using u as new control, obtain a continuous-time state-space representation where the states are position and velocity. Discretize it with ZOH, with Ts = 0.05 s. Verify that the discrete states have the same physical meaning as their continuous counterparts.
b. Use the incremental formulation and find the augmented matrices Ad and Bd. Write code to find matrices Hpos, Ppos, Hvel and Pvel associated with position and velocity predictions. Treat the extended state variable u as an output and write code to find its corresponding prediction matrices Hu and Pu, all this for any ny,nu.
c. Show that the cost function becomes
where
S = 2(HposT Hpos + λR2 m2HuTHu − λ2HuTHvel + λuI) a R R
T T T 2λRm T T
f = 2(−yˆf + xa Ppos)Hpos + 2 2 xa Pu Hu+ a R
2λmcwgRm λ T T T
a2 Hu − R2xa (Pu Hvel + PvelHu) − λmcwgHvel
where xa is the augmented state feedback used in the solution of the OCP.
d. The acceleration constraints are more stringent than the cable tension constraints, so only the former need to be considered. Find the C and D matrices for voltage V (treat as an output which depends on the extended state u), velocity and acceleration. Use that information to write code that builds the pertinent Hc matrix. Also find Cc based on the desired constraints for ∆u. Build all pertinent vectors and matrices to complete the data for the quadratic program.
c. Complete the provided code template to obtain closed-loop simulations.
d. For a 10-floor move (30 m), the elevator should not overshoot/undershoot by more than 8 cm and should make the trip in less than 12 seconds.
e. Tune the system for minimum energy consumption considering an up-down 30 m sequence of moves. Do some research on the actual power consumption of elevators. Note that the model incurs energy consumption just to hold the elevator still. You should not calculate energy consumption after the target floor has been reached.