MPC#
This method requires a model or model estimation of the system along with a Kalman Gain matrix. The process noise and measurement noise covariance matrices need to be provided or estimated.
For more details on the MPC method, refer to the Wikipedia page.
We have two variants implemented to obtain the model:
Oracle
N4SID
Oracle#
The Oracle MPC is intended to be used as a benchmark. In this variant, the true state model (or linearized dynamics) is injected. The optimal Kalman gain is calculated. No other DDPC method can outperform this variant.
N4SID#
The Numerical Subspace State Space System Identification (N4SID or NFourSID) is a system identification algorithm,
detailed in this paper.
The tunable parameter n_block_rows \(\geq 1\) must be an integer.
The state dimension \(n_{state}\) is calculated as:
where \(p\) is the number of outputs.
Note
Choosing a large n_block_rows increases computational complexity,
while a small n_block_rows may hinder the accurate determination of the system order in the eigenvalue diagram.
Optimization Formulation#
Here:
\(\Gamma\) is the extended observability matrix,
\(H_u\) maps future inputs to future outputs,
\(x\) is the estimated state of the system which needs to be updated.
\(\Gamma\) is constructed as follow:
\(H_u\) is constructed as follow:
Solving#
The solution is set up in two steps:
Update the state using the Kalman Filter.
Solve the optimization problem
Closed-Form Solution Derivation#
Set \(y_f\) into the cost equation leads to:
Now taking the derivative in respect to \(u_f\) and set it to zero.
Defining the help matrices:
Leads to the following closed-form gain matrices:
With the optimal \(u_f^\star\) calculated as: