![]() |
MAOS
Multithreaded Adaptive Optics Simulator
|
Data Structures | |
| struct | kalman_t |
Functions | |
| real | sde_fit (dmat **pcoeff, const dmat *psdin, real tmax_fit, int vibid) |
| real | sde_fit_auto (dmat **pcoeff, const_anyarray psdin, real tfit) |
| Fit PSD to SHO by maximum the damping ratio while keeping it less than. | |
| void | sde_psd (dmat **psd, const dmat *f, const real *coeff, int ncoeff, int nmod) |
| dmat * | sde_psd2 (const dmat *ff, const dmat *coeff) |
| real | reccati (dmat **Kinf, dmat **Pout, const dmat *A, const dmat *Qn, const dmat *C, const dmat *Rn) |
| Compute the reccati equation. When noise (Rn) is too large, the iteration will fail to converge. | |
| kalman_t * | sde_kalman (const dmat *coeff, const real dthi, const lmat *dtrat_wfs, const lmat *mdirect, const dcell *Gwfs, const dcell *Cnn, const dmat *Proj) |
| Kalman filter based on SDE model. | |
| void | kalman_free (kalman_t *kalman) |
| dmat * | kalman_test (kalman_t *kalman, const dcell *goff, const dmat *input, int flag) |
| dmat * | kalman_test2 (const dmat *coeff, const real dthi, const lmat *dtrat, const lmat *mdirect, const dcell *Gwfs, const dcell *Cnn, const dmat *Proj, const dcell *goff, const dmat *input, int flag) |
| dmat * | kalman_test3 (const dmat *input, int flag, const char *fn) |
| void | kalman_init (kalman_t *kalman) |
| void | kalman_update (kalman_t *kalman, dcell *meas, int idtrat) |
| void | kalman_output (kalman_t *kalman, dmat **out, real alpha, real beta, int idtrat) |
| void | kalman_write (kalman_t *kalman, const char *format,...) |
| kalman_t * | kalman_read (const char *format,...) |
| struct kalman_t |
Collaboration diagram for kalman_t:| Data Fields | ||
|---|---|---|
| dmat * | AdM |
discrete state propagation at dthi |
| dmat * | BM |
From discrete state to averaged mode for dthi |
| lmat * | dtrat_wfs |
WFS sampling period over dthi |
| lmat * | dtrats |
uniq dtrats |
| lmat * | mdirect |
Modes that are directly controlled by the slow loop |
| dcell * | Ad |
discrete state propagation at dT |
| dcell * | Cd |
From discrete state to WFS measurement |
| dcell * | Gwfs |
WFS measurement from modes. Can be identity. |
| dcell * | Cnn |
WFS measurement noise covariance due to photon and RoN. |
| dcell * | Rn |
Total WFS measurement error due to signal evolution and Rwfs. |
| dcell * | M |
M is innovation gain. |
| dcell * | P |
Sigma_infty: Error covariance matrix |
| dccell * | Rlsq |
least squares reconstructor |
| real | dthi |
Sampling period of control loop |
| dcell * | xhat |
stores x_k+1|k |
| dcell * | xhat2 |
stores x_k+(1+j)/M|k |
| dmat * | xhat3 |
temporary |
| dcell * | xout |
output |
| dcell * | psol |
current correction for psol |
Estiamte the total PSD power for vibration peaks using FWHM*peak If coeff0 is not null, use it immediately, otherwise, do vibration identification
| real sde_fit_auto | ( | dmat ** | pcoeff, |
| const_anyarray | psdin_, | ||
| real | tfit | ||
| ) |
Fit PSD to SHO by maximum the damping ratio while keeping it less than.
| [in,out] | pcoeff | Return the SHO coefficients |
| psdin_ | The input PSD | |
| tfit | For covariance fitting, time span. |
Computes PSD of SDE with coefficients (coeff) and frequency (f)
| real reccati | ( | dmat ** | Kinf, |
| dmat ** | Pout, | ||
| const dmat * | A, | ||
| const dmat * | Qn, | ||
| const dmat * | C, | ||
| const dmat * | Rn | ||
| ) |
Compute the reccati equation. When noise (Rn) is too large, the iteration will fail to converge.
| Kinf | [Out] Asymptotic Kalman gain \(K_\infty\) |
| Pout | [Out] The Sigma_infty: Estimation error covariance matrix |
| A | Block diagonal stage evolution matrix |
| Qn | Discrete state noise covariance |
| C | Measurement interaction matrix |
| Rn | Measurement error covariance matrix |
| kalman_t * sde_kalman | ( | const dmat * | coeff, |
| const real | dthi, | ||
| const lmat * | dtrat_wfs, | ||
| const lmat * | mdirect, | ||
| const dcell * | Gwfs, | ||
| const dcell * | Cnn, | ||
| const dmat * | Proj | ||
| ) |
Kalman filter based on SDE model.
| coeff | SDE coefficients |
| dthi | High order loop frequency |
| dtrat_wfs | WFS dtrat over high order loop. Each wfs may have a different rate. Only 1 or 2 rates are supported |
| mdirect | Mode indices that are directly controlled by the slower loop. |
| Gwfs | WFS measurement from modes. Can be identity if reconstructor is already applied. |
| Cnn | WFS measurement noise covariance in radian^2. nwfs*ndtrat. |
| Proj | Project modes in statespace to DM/correction space. Can be identity or NULL. |
Test the performance of kalman filter (LQG controller). Derived from servo_test() Gwfs2 is a different gradient interaction matrix to model the aliasing in system flag controlls the servo type: 0: both LQG 1: both integrator 2: LQG (fast) + integrator (slow)
| dmat * kalman_test2 | ( | const dmat * | coeff, |
| const real | dthi, | ||
| const lmat * | dtrat, | ||
| const lmat * | mdirect, | ||
| const dcell * | Gwfs, | ||
| const dcell * | Cnn, | ||
| const dmat * | Proj, | ||
| const dcell * | goff, | ||
| const dmat * | input, | ||
| int | flag | ||
| ) |
| coeff | SDE coefficients |
| dthi | Loop frequency |
| dtrat | WFS frequency as a fraction of loop |
| mdirect | mask for modes directly controlled by slower loop |
| Gwfs | WFS measurement from modes. Can be identity |
| Cnn | WFS measurement noise covariance in radian^2 |
| Proj | Kalman Projection matrix |
| goff | Gradient measurement offset (fast loop) |
| input | Time series |
| flag | flag controlls the servo type: 0: both LQG 1: both integrator 2: LQG (fast) + integrator (slow) |
Update state vector when there is a measurement. It modifies meas.
xhat3=xhat+M*(meas-Cd*xhat) //xhat is x_k|k-1. xhat3 is x_k|k xhat =Ad*xhat3; //xhat is now x_k+1|k xhat2=AdM*xhat3; //xhat2 is x_k+1/M|k
Output correction xhat2=AdM*xhat2 //evolve correction forward out=out*alpha+(BM*xhat2-psol)*beta