// Bayesian Filtering for PMSM using Marginalized Particle Filter 

//#define Fpm 0.1989
#ifndef M_PI
#define M_PI 3.141596
#endif

#define N 4

//#define Lsd Ls*0.9
//#define Lsq Ls

#define VYBER_MODELU	0	// 0 = plny model s respektovanim Lsd/Lsq ... implicitne
							// 1 = parametry modelu z identifikace
#define _dt	0.000125

#define floatx float

floatx qrandn();
floatx qrandu();
void rng_init();

void mpf_bayes ( const floatx isa, const floatx isb , const floatx usa, const floatx usb );
void mpf_init(floatx qom0, floatx qth0, floatx r0);
void mpf_mean(floatx *Ecosth, floatx *Esinth, floatx *Eome);
void mpf_th(floatx th1[N]);
void mpf_om(floatx om1[N]);
void mpf_best( floatx *Ecosth, floatx *Esinth, floatx *Eome);

floatx kalman_om ( const floatx isa, const floatx isb , const floatx usa, const floatx usb, const floatx th );
