MAOS
Multithreaded Adaptive Optics Simulator
kalman.h File Reference

Data Structures

struct  kalman_t
 

Functions

dmatsde_fit (const dmat *psdin, const dmat *coeff0, real tmax_fit, int vibid)
 
dmatreccati (dmat **Pout, const dmat *A, const dmat *Qn, const dmat *C, const dmat *Rn)
 
dcellreccati_cell (dmat **Pout, const dmat *A, const dmat *Qn, const dcell *C, const dcell *Rn)
 
kalman_tsde_kalman (const dmat *coeff, const real dthi, const lmat *dtrat, const dcell *Gwfs, const dcell *Rwfs, const dmat *Proj)
 
void kalman_free (kalman_t *kalman)
 
dmatkalman_test (kalman_t *kalman, dmat *input)
 
void kalman_init (kalman_t *kalman)
 
void kalman_update (kalman_t *kalman, dmat *meas, int ik)
 
void kalman_output (kalman_t *kalman, dmat **out, real alpha, real beta)
 
void kalman_write (kalman_t *kalman, const char *format,...)
 
void sde_psd (dmat **psd, const dmat *f, const real *coeff, int ncoeff, int nmod)
 
dmatsde_psd2 (const dmat *ff, const dmat *coeff)
 

Data Structure Documentation

◆ kalman_t

struct kalman_t
+ Collaboration diagram for kalman_t:
Data Fields
dmat * Ad

discrete state propagation at dT

dcell * Cd

From discrete state to WFS measurement

dmat * AdM

discrete state propagation at dthi

dmat * FdM

From discrete state to averaged mode for dthi

dmat * Qn

Covariance of the process noise term e_k

dcell * M

M is innovation gain.

dmat * P

Error covariance matrix

real dthi

Sampling period of control loop

lmat * dtrat

WFS sampling period over dthi

dcell * Gwfs

WFS measurement from modes. Can be identity.

dcell * Rwfs

WFS measurement noise covariance due to photon and RoN.

dcell * Rn

Total WFS measurement error due to signal evolution and Rwfs.

dmat * xhat

Temporary state

dmat * xhat2

Temporary state

dmat * xhat3

Temporary state

Function Documentation

◆ sde_fit()

dmat* sde_fit ( const dmat psdin,
const dmat coeff0,
real  tmax_fit,
int  vibid 
)

Estiamte the total PSD power for vibration peaks using FWHM*peak If coeff0 is not null, use it immediately, otherwise, do vibration identification

◆ reccati()

dmat* reccati ( dmat **  Pout,
const dmat A,
const dmat Qn,
const dmat C,
const dmat Rn 
)

Compute the reccati equation.

◆ reccati_cell()

dcell* reccati_cell ( dmat **  Pout,
const dmat A,
const dmat Qn,
const dcell Cs,
const dcell Rns 
)

Compute the reccati equation.

◆ sde_kalman()

kalman_t* sde_kalman ( const dmat coeff,
const real  dthi,
const lmat dtrat_wfs,
const dcell Gwfs,
const dcell Rwfs,
const dmat Proj 
)

Kalman filter based on SDE model

Parameters
coeffSDE coefficients
dthiLoop frequency
dtrat_wfsWFS frequency as a fraction of loop
GwfsWFS measurement from modes. Can be identity
RwfsWFS measurement noise covariance
ProjProject modes in statespace to DM/correction space

◆ kalman_free()

void kalman_free ( kalman_t kalman)

free the struct

◆ kalman_test()

dmat* kalman_test ( kalman_t kalman,
dmat input 
)

Test the performance of kalman filter (LQG controller). Derived from servo_test()

◆ kalman_init()

void kalman_init ( kalman_t kalman)

Initialize kalman filter state

◆ kalman_update()

void kalman_update ( kalman_t kalman,
dmat meas,
int  ik 
)

Update state vector when there is a measurement. It modifies meas.

xhat3=xhat+M*(meas-Cd*xhat) xhat2=AdM*xhat3; xhat =Ad*xhat3;

◆ kalman_output()

void kalman_output ( kalman_t kalman,
dmat **  out,
real  alpha,
real  beta 
)

Output correction

out=out*alpha+Fdm*(AdM*xhat2)*beta

◆ kalman_write()

void kalman_write ( kalman_t kalman,
const char *  format,
  ... 
)

Save kalman_t to file

◆ sde_psd()

void sde_psd ( dmat **  psd,
const dmat f,
const real *  coeff,
int  ncoeff,
int  nmod 
)

Computes PSD of SDE with coefficients (coeff) and frequency (f)

◆ sde_psd2()

dmat* sde_psd2 ( const dmat ff,
const dmat coeff 
)

A convenient wrapper for sde_psd()