Upload
vuongtrinh
View
232
Download
0
Embed Size (px)
Citation preview
8/9/2019 07 mpc jbr stanfd
1/13
Getting Started with Moving Horizon Estimation
James B. Rawlings
Department of Chemical and Biological EngineeringUniversity of Wisconsin–Madison
Insitut für Systemtheorie und RegelungstechnikUniversität StuttgartStuttgart, Germany
June 20, 2011
Stuttgart – June 2011 MPC short course 1 / 25
Outline
1 Least squares estimation for linear, unconstrained systems
2 Moving horizon estimation
3 Convergence of the state estimator
Stuttgart – June 2011 MPC short course 2 / 25
8/9/2019 07 mpc jbr stanfd
2/13
State Estimation
In most applications, the variables that are conveniently or
economically measurable (y ) are a small subset of the variablesrequired to model the system (x ).
The measurement is corrupted with sensor noise and the stateevolution is corrupted with process noise.
Determining a good state estimate for use in the regulator in the face of anoisy and incomplete output measurement is a challenging task.
Stuttgart – June 2011 MPC short course 3 / 25
State estimation
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0 00 01 11 1 0 00 00 01 11 11 1
0
0
1
1
0
0
1
1
0
0
0
1
1
1
Measurement
MH EstimateMPC control
Forecast
t time
Reconcile the past Forecast the future
sensorsy
actuatorsu
minx 0,w (t )
0−T
|y − g (x , u )|2R + |ẋ − f (x , u )|2Q dt
ẋ = f (x , u ) + w (process noise)
y = g (x , u ) + v (measurement noise)
Stuttgart – June 2011 MPC short course 4 / 25
8/9/2019 07 mpc jbr stanfd
3/13
Least Squares Estimation
Consider the state estimation problem as a deterministic optimizationproblem, given:
a time horizon with measurements y (k ), k = 0, 1, . . . , T
the prior information to be our best initial guess of the initial state
x (0), denoted x (0)weighting matrices P −(0), Q , and R for the initial state, processdisturbance, and measurement disturbance
The objective function is
V T (x(T )) = 1
2
|x (0) − x (0)|2(P −(0))−1 +
T −1k =0
|x (k + 1) − Ax (k )|2Q −1 +
T k =0
|y (k ) − Cx (k )|2R −1 (1)in which x(T ) := {x (0), x (1), . . . , x (T )}.
Stuttgart – June 2011 MPC short course 5 / 25
Forward Dynamic Programming (DP)
Using forward DP, we can decompose and solve recursively the leastsquares state estimation problem:
minx(T )
V T (x(T )) (2)
First we combine the prior and the measurement y (0) into the quadraticfunction V 0(x (0)) as shown in the following equation
minx (T ),...,x (1)
arrival cost V −1 (x (1)) minx (0)
1
2
|x (0) − x (0)|2(P −(0))−1 + |y (0) − Cx (0)|
2R −1
combine V 0(x (0))
+ |x (1) − Ax (0)|2Q −1
+
|y (1) − Cx (1)|2R −1
+ |x (2) − Ax (1)|2Q −1
+ · · · +
|x (T ) − Ax (T − 1)|2Q −1
+ |y (T ) − Cx (T )|2R −1
Stuttgart – June 2011 MPC short course 6 / 25
8/9/2019 07 mpc jbr stanfd
4/13
Forward DP
Then we optimize over the first state, x (0). This produces the arrival costfor the first stage, V −1 (x (1)), which we will show is also quadratic
V −1 (x (1)) = 1
2 x (1) − x̂ −(1)
2
(P −(1))−1
Next we combine the arrival cost of the first stage with the nextmeasurement y (1) to obtain V 1(x (1))
minx (T ),...,x (2)
arrival cost V −2 (x (2)) minx (1)
1
2
x (1) − x̂ −(1)2(P −(1))−1
+ |y (1) − Cx (1)|2R −1
combine V 1(x (1))
+ |x (2) − Ax (1)|2Q −1
+
|y (2) − Cx (2)|2R −1 + |x (3) − Ax (2)|
2Q −1 + · · · +
|x (T ) − Ax (T − 1)|2Q −1
+ |y (T ) − Cx (T )|2R −1
(3)
Stuttgart – June 2011 MPC short course 7 / 25
Combine Prior and Measurement
Combining the prior and measurement defines V 0
V 0(x (0)) = 1
2
|x (0) − x (0)|2(P −(0))−1
prior
+ |y (0) − Cx (0)|2R −1 measurement
(4)
We can combine these two terms into a single quadratic function
V 0(x (0)) = (1/2) (x (0) − x (0) − v )H̃ −1(x (0) − x (0) − v ) + constant
in which
v = P −(0)C (CP −(0)C + R )−1C R −1 (y (0) − C x (0))
H̃ = P −(0) − P −(0)C (CP −(0)C + R )−1CP −(0)
and we set the constant term to zero because it does not depend on x (1).
Stuttgart – June 2011 MPC short course 8 / 25
8/9/2019 07 mpc jbr stanfd
5/13
Combine Prior and Measurement
By defining
P (0) = P −(0) − P −(0)C (CP −(0)C + R )−1CP −(0)
L(0) = P −
(0)C
(CP −
(0)C
+ R )−1
C
R −1
and with the state estimate x̂ (0) as follows
x̂ (0) = x (0) + v
x̂ (0) = x (0) + L(0)(y (0) − C x (0))
We have derived the following compact expression for the function V 0:
V 0(x (0)) = (1/2) |x (0) − x̂ (0)|2P (0)−1
Stuttgart – June 2011 MPC short course 9 / 25
State Evolution and Arrival Cost
Now we add the next term and denote the sum as V (·):
V (x (0), x (1)) = V 0(x (0)) + (1/2) |x (1) − Ax (0)|2Q −1
V (x (0), x (1)) = 1
2
|x (0) − x̂ (0)|2P (0)−1 + |x (1) − Ax (0)|
2Q −1
We can add the two quadratics to obtain
V (x (0), x (1)) = (1/2) |x (0) − v |2H −1 + d in which
v = x̂ (0) + P (0)A
AP (0)A + Q −1
(x (1) − Ax̂ (0))
d = (1/2)
|v − x̂ (0)|2P (0)−1 + |x (1) − Av |2Q −1
Stuttgart – June 2011 MPC short course 10 / 25
8/9/2019 07 mpc jbr stanfd
6/13
State Evolution and Arrival Cost
We define the arrival cost to be the result of this optimization
V −1 (x (1)) = minx (0)
V (x (0), x (1))
Substituting v into the expression for d and simplifying gives
V −1 (x (1)) = (1/2) |x (1) − Ax̂ (0)|2(P −(1))−1
in whichP −(1) = AP (0)A + Q
We define x̂ −(1) = Ax̂ (0) and express the arrival cost compactly as
V −1 (x (1)) = (1/2) x (1) − x̂ −(1)2(P −(1))−1
Stuttgart – June 2011 MPC short course 11 / 25
Combine Arrival Cost and Measurement
Now combine the arrival cost and measurement for the next stage:
V 1(x (1)) = V −
1 (x (1)) prior
+ (1/2) |(y (1) − Cx (1))|2R −1 measurement
V 1(x (1)) = 1
2
x (1) − x̂ −(1)2(P −(1))−1
+ |y (1) − Cx (1)|2R −1
This equation is exactly the form as (4) of the previous step.By simply changing the variable names, we have that
P (1) = P −(1) − P −(1)C (CP −(1)C + R )−1CP −(1)
L(1) = P −(1)C (CP −(1)C + R )−1
x̂ (1) = x̂ −(1) + L(1)(y (1) − C ̂x −(1))
Stuttgart – June 2011 MPC short course 12 / 25
8/9/2019 07 mpc jbr stanfd
7/13
Combine Arrival Cost and Measurement
The cost function V 1 is defined as
V 1(x (1)) = (1/2)(x (1) − x̂ (1))P (1)−1(x (1) − x̂ (1))
in which
x̂ −(1) = Ax̂ (0)
P −(1) = AP (0)A + Q
Stuttgart – June 2011 MPC short course 13 / 25
Recursion and Termination
The recursion can be summarized by two steps:
1 Adding the measurement at time k produces
P (k ) = P −(k ) − P −(k )C (CP −(k )C + R )−1CP −(k )
L(k ) = P −(k )C (CP −(k )C + R )−1
x̂ (k ) = x̂ −(k ) + L(k )(y (k ) − C x̂ −(k ))
2 Propagating the model to time k + 1 produces
x̂ −(k + 1) = Ax̂ (k )
P −(k + 1) = AP (k )A + Q
The arrival cost, V −k , and arrival cost plus measurement, V k , for eachstage are given by
V −k (x (k )) = (1/2)x (k ) − x̂ −(k )
(P −(k ))−1
V k (x (k )) = (1/2) |x (k ) − x̂ (k )|(P (k ))−1
Stuttgart – June 2011 MPC short course 14 / 25
8/9/2019 07 mpc jbr stanfd
8/13
Moving Horizon Estimation
For least squares method, we must optimize all the states in thetrajectory x(T ) simultaneously to obtain the state estimates.
When using nonlinear models or considering constraints on theestimates, this optimization problem becomes computationallyintractable as T increases.
We cannot solve recursively the least squares problem.
Moving horizon estimation (MHE) removes this difficulty byconsidering only the most recent N measurements and finds only themost recent N values of the state trajectory.
Stuttgart – June 2011 MPC short course 15 / 25
Moving Horizon Estimation
The simplest form of MHE is the following least squares problem
minxN (T )
V̂ T (xN (T )) (5)
in which the objective function is
V̂ T (xN (T )) = 1
2
T −1k =T −N
|x (k + 1) − Ax (k )|2Q −1 +
T k =T −N
|y (k ) − Cx (k )|2R −1
(6)
The measurements are yN (T ) = {y (T − N ), . . . , y (T )}.
The states to be estimated are xN (T ) = {x (T − N ), . . . , x (T )}.
Assume T ≥ N − 1 to ignore the initial period in which theestimation window fills with measurements.
Stuttgart – June 2011 MPC short course 16 / 25
8/9/2019 07 mpc jbr stanfd
9/13
Moving Horizon Estimation
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0000000000000000000000000000011111111111111111111111111111
00000000000000001111111111111111
T T − N 0
x (T )
moving horizon
full information
x (T − N )
y (T ) y (T − N )
Stuttgart – June 2011 MPC short course 17 / 25
MHE in Terms of Least Squares
From our previous DP recursion, the full least squares problem is also of form
V T (xN (T )) = V −T −N (x (T − N ))+
1
2 T −1
k =T −N |x (k + 1) − Ax (k )|2Q −1 +
T
k =T −N |y (k ) − Cx (k )|2R −1
in which V −T −N (·) is the arrival cost at time T − N .It is clear that the simplest form of MHE is equivalent to setting up a fullleast squares problem but then setting the arrival cost function V −T −N (·) tozero.
Stuttgart – June 2011 MPC short course 18 / 25
8/9/2019 07 mpc jbr stanfd
10/13
Convergence of Estimator
Given an initial estimate error, and zero state and measurement noises,
does the state estimate converge to the state as time increases and more
measurements become available?
If the answer is yes, we say the estimates converge, or the estimatorconverges.
As with the regulator, optimality of an estimator does not ensure itsstability.
Now we go back to the Kalman filtering or full least squares problem...
Recall that this estimator optimizes over the entire state trajectoryx(T ) := {x (0), . . . , x (T )} based on all measurements y(T ) := {y (0),
. . . , y (T )}.
Stuttgart – June 2011 MPC short course 19 / 25
Convergence of Estimator Cost
Lemma 1 (Convergence of estimator cost)
Given noise-free measurements y(T ) =
Cx (0), CAx (0), . . . , CAT x (0)
,
the optimal estimator cost V 0T (y(T )) converges as T → ∞.
The optimal estimator cost converges regardless of system observability.But if we want the optimal estimate to converge to the state, the systemneeds to be restricted further as in the following lemma.
Stuttgart – June 2011 MPC short course 20 / 25
8/9/2019 07 mpc jbr stanfd
11/13
Convergence of Estimator
Lemma 2 (Estimator convergence)For (A, C ) observable, Q , R > 0, and noise-free measurements y(T ) =
Cx (0), CAx (0), . . . , CAT x (0)
, the optimal linear state estimate
converges to the state
x̂ (T ) → x (T ) as T → ∞
Stuttgart – June 2011 MPC short course 21 / 25
Convergence of Estimator
The simplest form of MHE, which discounts prior data completely, isalso a convergent estimator, as discussed in Exercise 1.28.
The estimator convergence result in Lemma 2 is the simplest toestablish.
As in the case of the LQ regulator, however, we can enlarge the classof systems and weighting matrices (variances) for which estimator
convergence is guaranteed: The system restriction can be weakened from observability to
detectability , which is discussed in Exercises 1.31 and 1.32. The restriction on the process disturbance weight (variance) Q can be
weakened from Q > 0 to Q ≥ 0 and (A, Q ) stabilizable , which isdiscussed in Exercise 1.33.
The restriction R > 0 remains to ensure uniqueness of the estimator.
Stuttgart – June 2011 MPC short course 22 / 25
8/9/2019 07 mpc jbr stanfd
12/13
Recommended exercises
MHE Convergence. Exercise 1.28.1
Detectability and semi-definite state noise. Exercise 1.31, 1.32, 1.33.
Least squares and recursive least squares. Exercises 1.41, 1.48.
Arrival cost. Exercises 1.51, 1.52, and 1.53.
1Rawlings and Mayne (2009, Chapter 1). Downloadable fromwww.che.wisc.edu/~jbraw/mpc.
Stuttgart – June 2011 MPC short course 23 / 25
Further Reading
J. B. Rawlings and D. Q. Mayne. Model Predictive Control: Theory and Design. Nob Hill Publishing, Madison, WI, 2009. 576 pages, ISBN
978-0-9759377-0-9.
Stuttgart – June 2011 MPC short course 24 / 25
http://www.che.wisc.edu/~jbraw/mpchttp://www.che.wisc.edu/~jbraw/mpchttp://www.che.wisc.edu/~jbraw/mpchttp://www.che.wisc.edu/~jbraw/mpchttp://www.che.wisc.edu/~jbraw/mpc
8/9/2019 07 mpc jbr stanfd
13/13
Acknowledgments
The author is indebted to Luo Ji of the University of Wisconsin andGanzhou Wang of the Universität Stuttgart for their help in organizing thematerial and preparing the overheads.
Stuttgart – June 2011 MPC short course 25 / 25