Estimation¶
The state observer: a copy of the linear model, corrected by the output it mispredicts.
- class minilink.estimation.observer.StateObserver(A, B, C, L, D=None, *, xbar=None, ubar=None, ybar=None, labels=None)[source]¶
Linear state observer
dx̂ = A (x̂ − x̄) + B (u − ū) + L (y − ŷ), the estimate onx.The observer runs the model
(A, B, C, D)of the plant about the operating point(x̄, ū, ȳ)and corrects it with the innovation, the measuredyminus the predictedŷ = ȳ + C (x̂ − x̄) + D (u − ū), through the gainL. The estimation error then followsA − L C, so the gain sets its poles:luenberger()places them andkalman()makes them optimal for white noise. Both return this block.Ports: the plant’s command
u(dimensionm) and measurementy(dimensionp) in; the estimatex(dimensionn, labelled with a hat) out. The initial estimatex0starts at x̄. The matrices, the gain and the operating point live inparams;ȳdefaults toC x̄ + D ū, the linear model’s own output, and the plant-taking designs passh(x̄, ū). A box holding this block under the keyobserverand a state-feedback gain, withr,y->uon its edge, is a controller for@.- property poles¶
the poles of the estimation error.
- Type:
Eigenvalues of
A − L C
- f(x, u, t=0, params=None)[source]¶
State derivative
dx = f(x, u, t; p).Subclasses should treat this as a function of
(x, u, t, params)only; the library does not verify purity.- Parameters:
x (array of shape (n,))
u (array of shape (m,))
t (float)
params (dict, optional) –
Nonemeans “useself.params”.
- Returns:
dx
- Return type:
array of shape (n,)
State-observer design: a model or arrays in, a StateObserver out, the duals of the state-feedback designs.
- minilink.estimation.design.luenberger_gain(A, C, poles)[source]¶
Return the observer gain
Lthat puts the eigenvalues ofA − L Catpoles.
- minilink.estimation.design.kalman_gain(A, C, Q_n, R_n)[source]¶
Return the Kalman gain
Lof the stationary filter for process noiseQ_nand measurement noiseR_n.
- minilink.estimation.design.luenberger(sys, poles, *, x_bar=None, u_bar=None, t=0.0, params=None, method='auto', eps=1e-06)[source]¶
Design an observer for
sysby pole placement and return aStateObserver.sysis a linear model, used as is with the operating point it carries, or any plant, linearized first about its command port at(x_bar, u_bar), the nominal state and inputs when omitted. The block runs the model about that point and corrects it withL (y − ŷ), so the estimation error has the requested poles. Arguments as inlqr(), withpolesin place ofQ, R. On arrays the gain isluenberger_gain(), and the modelLTISystem(A, B, C).The observer reads the plant’s output
y: a plant without one is refused (make the sensor part of the plant box,plant >> Gain(...)), and a design on another output is made onlinearize(plant, x_bar, of=...).
- minilink.estimation.design.kalman(sys, Q_n, R_n, *, x_bar=None, u_bar=None, t=0.0, params=None, method='auto', eps=1e-06)[source]¶
Design a stationary Kalman filter for
sysand return aStateObserver.sysis a linear model or any plant measured throughy, as inluenberger(). On arrays the gain iskalman_gain().Q_nis the intensity of the white process noise on the state,n × n(a noisewentering throughB_whasQ_n = B_w W B_wᵀ), andR_nthe intensity of the white measurement noise,p × p. The gain minimizes the steady-state estimation error covariance, and the block is the stationary Kalman–Bucy filter.