- Timestamp:
- 02/24/09 14:12:19 (16 years ago)
- Location:
- pmsm/old
- Files:
-
- 1 added
- 11 moved
Legend:
- Unmodified
- Added
- Removed
-
pmsm/old/mpf_u_delta.cpp
r278 r279 30 30 public: 31 31 //! Default constructor 32 EKFCh_du_kQ ( RV rx, RV ry,RV ru,RV rC ) :EKFCh ( rx,ry,ru ),BMcond ( rC ),Qref(rx.count()) {};32 EKFCh_du_kQ ( ) :EKFCh ( ),BMcond (),Qref() {}; 33 33 void set_ref(const chmat &Qref0){Qref=Qref0;} 34 34 void condition ( const vec &val ) { … … 98 98 mat Q2o=diag(Qdiag); 99 99 chmat R ( Rdiag ); 100 EKFCh KFE ( rx,ry,ru );100 EKFCh KFE ; 101 101 KFE.set_parameters ( &fxu0,&hxu,Q,R ); 102 102 KFE.set_est ( mu0, chmat ( ones ( 4 ) ) ); 103 103 104 104 RV rUd ( "{ud k}", "2 1" ); 105 EKFCh_du_kQ KFEp ( rx,ry,ru,rUd );105 EKFCh_du_kQ KFEp ; 106 106 KFEp.set_parameters ( &fxu,&hxu,Q,R ); 107 107 KFEp.set_ref(Q); 108 108 KFEp.set_est ( mu0, chmat ( ones ( 4 ) ) ); 109 109 110 mlnorm<ldmat> evolUd ( rUd,rUd );111 MPF<EKFCh_du_kQ> M ( rx,rUd,evolUd,evolUd,Npart,KFEp );110 mlnorm<ldmat> evolUd ; 111 MPF<EKFCh_du_kQ> M ( &evolUd,&evolUd,Npart,KFEp ); 112 112 // initialize 113 113 vec Ud0="0 0 1.0"; 114 114 evolUd.set_parameters ( eye ( 3 ), zeros(3), ldmat ( vec( "1e-4 1e-4 10e-4" ))); 115 115 evolUd.condition ( Ud0 ); 116 epdf& pfinit=evolUd. posterior();116 epdf& pfinit=evolUd._epdf(); 117 117 M.set_est ( pfinit ); 118 118 evolUd.set_parameters ( eye ( 3 ), zeros(3), ldmat ( vec(" 7e-4 7e-4 1e-5" ))); -
pmsm/old/mpf_u_delta_real.cpp
r278 r279 83 83 chmat Q ( Qdiag ); 84 84 chmat R ( Rdiag ); 85 EKFCh KFE ( rx,ry,ru );85 EKFCh KFE ; 86 86 KFE.set_parameters ( &fxu0,&hxu,Q,R ); 87 87 KFE.set_est ( mu0, chmat ( ones ( 4 ) ) ); 88 88 89 89 RV rUd ( "{ud }", "2" ); 90 EKFCh_cond KFEp ( rx,ry,ru,rUd );90 EKFCh_cond KFEp ; 91 91 KFEp.set_parameters ( &fxu,&hxu,Q,R ); 92 92 KFEp.set_est ( mu0, chmat ( ones ( 4 ) ) ); 93 93 94 mlnorm<ldmat> evolUd ( rUd,rUd );95 MPF<EKFCh_cond> M ( rx,rUd,evolUd,evolUd,Npart,KFEp );94 mlnorm<ldmat> evolUd ; 95 MPF<EKFCh_cond> M ( &evolUd,&evolUd,Npart,KFEp ); 96 96 // initialize 97 97 vec Ud0="0 0"; 98 98 evolUd.set_parameters ( eye ( 2 ), vec_2 ( 0.0,0.0 ), ldmat ( 10.0*eye ( 2 ) ) ); 99 99 evolUd.condition ( Ud0 ); 100 epdf& pfinit=evolUd. posterior();100 epdf& pfinit=evolUd._epdf(); 101 101 M.set_est ( pfinit ); 102 102 evolUd.set_parameters ( eye ( 2 ), vec_2 ( 0.0,0.0 ), ldmat ( 0.005*eye ( 2 ) ) ); -
pmsm/old/mpf_u_weight.cpp
r278 r279 28 28 class EKFCh_cond : public EKFCh , public BMcond { 29 29 public: 30 //! Default constructor 31 EKFCh_cond ( RV rx, RV ry,RV ru,RV rC ) :EKFCh ( rx,ry,ru ),BMcond ( rC ) {}; 30 //! condition on value of pfxu 32 31 void condition ( const vec &val ) { 33 32 pfxu->condition ( val ); … … 92 91 chmat Q ( Qdiag ); 93 92 chmat R ( Rdiag ); 94 EKFCh KFE ( rx,ry,ru );93 EKFCh KFE; 95 94 KFE.set_parameters ( &fxu0,&hxu,Q,R ); 96 95 KFE.set_est ( mu0, chmat ( ones ( 4 ) ) ); 97 96 98 97 RV rW ( "{w }" ); 99 EKFCh_cond KFEp ( rx,ry,ru,rW );98 EKFCh_cond KFEp; 100 99 KFEp.set_parameters ( &fxu,&hxu,Q,R ); 101 100 KFEp.set_est ( mu0, chmat ( ones ( 4 ) ) ); 102 101 103 mgamma_fix evolW ( rW,rW );104 MPF<EKFCh_cond> M ( rx,rW,evolW,evolW,Npart,KFEp );102 mgamma_fix evolW ; 103 MPF<EKFCh_cond> M (&evolW,&evolW,Npart,KFEp ); 105 104 // initialize 106 105 vec W0="0.5"; 107 106 evolW.set_parameters ( 10.0, W0, 1.0 ); //sigma = 1/10 mu 108 107 evolW.condition ( W0 ); 109 epdf& pfinit=evolW. posterior();108 epdf& pfinit=evolW._epdf(); 110 109 M.set_est ( pfinit ); 111 110 evolW.set_parameters ( 100.0, W0, 0.99 ); //sigma = 1/10 mu -
pmsm/old/pmsm_mix.cpp
r271 r279 57 57 mat Q =diag( Qdiag ); 58 58 mat R =diag ( Rdiag ); 59 EKFfull Efix ( rx,ry,ru );59 EKFfull Efix ; 60 60 Efix.set_est ( mu0, 1*eye ( 4 ) ); 61 61 Efix.set_parameters ( &fxu,&hxu,Q,R); 62 62 63 63 RV rQR( "{Q R }", "4 2 "); 64 EKFful_unQR EKU (rx,ry,ru,rQR);64 EKFful_unQR EKU; 65 65 EKU.set_est ( mu0, 1*ones ( 4 ) ); 66 66 EKU.set_parameters ( &fxu,&hxu,diag(Qdiag),diag(Rdiag) ); 67 67 68 68 //QU model 69 egamma Gcom (rQR);Gcom.set_parameters(ones(6),vec("1 1 1e4 1e10 1 1"));69 egamma Gcom;Gcom.set_parameters(ones(6),vec("1 1 1e4 1e10 1 1")); 70 70 /* cout << Gcom.mean() <<endl; 71 71 cout << Gcom.sample() <<endl;*/ 72 euni Ucom (rQR); Ucom.set_parameters(zeros(6),vec("60 60 453 0.03 100 100"));72 euni Ucom; Ucom.set_parameters(zeros(6),vec("60 60 453 0.03 100 100")); 73 73 /* cout << Ucom.mean() <<endl; 74 74 cout << Ucom.sample() <<endl;*/ … … 76 76 Coms(0) = &Gcom; 77 77 Coms(1) = &Ucom; 78 emix Eevol (rQR); Eevol.set_parameters("0.1 0.9", Coms);78 emix Eevol; Eevol.set_parameters("0.1 0.9", Coms); 79 79 // cout << Eevol.sample() <<endl; 80 80 81 81 mepdf evolQR(&Eevol); 82 MPF<EKFful_unQR> M ( rx,rQR, evolQR,evolQR, Npar, EKU );83 M.set_est ( evolQR. posterior() );82 MPF<EKFful_unQR> M ( &evolQR, &evolQR, Npar, EKU ); 83 M.set_est ( evolQR._epdf() ); 84 84 85 85 const epdf& Efix_ep = Efix.posterior(); -
pmsm/old/pmsm_sim.cpp
r271 r279 25 25 public: 26 26 //! Default constructor 27 EKF_unQ ( RV rx, RV ry,RV ru,RV rQ ) :EKFCh ( rx,ry,ru ),BMcond ( rQ ) {};28 27 void condition ( const vec &Q0 ) { 29 28 Q.setD ( Q0,0 ); … … 53 52 chmat Q ( Qdiag ); 54 53 chmat R ( Rdiag ); 55 EKFCh KFE ( rx,ry,ru );54 EKFCh KFE ; 56 55 KFE.set_parameters ( &fxu,&hxu,Q,R ); 57 56 KFE.set_est ( mu0, chmat ( 1*ones ( 4 ) ) ); 58 57 59 58 RV rQ ( "{Q }","2" ); 60 EKF_unQ KFEp ( rx,ry,ru,rQ );59 EKF_unQ KFEp; 61 60 KFEp.set_parameters ( &fxu,&hxu,Q,R ); 62 61 KFEp.set_est ( mu0, chmat ( zeros ( 4 ) ) ); 63 62 64 mgamma evolQ ( rQ,rQ );65 MPF<EKF_unQ> M ( rx,rQ,evolQ,evolQ,Npart,KFEp );63 mgamma evolQ ; 64 MPF<EKF_unQ> M (&evolQ,&evolQ,Npart,KFEp ); 66 65 // initialize 67 evolQ.set_parameters ( 10.0 ); //sigma = 1/10 mu66 evolQ.set_parameters ( 10.0, "0.01 0.01" ); //sigma = 1/10 mu 68 67 evolQ.condition ( "0.01 0.01" ); //Zdenek default 69 epdf& pfinit=evolQ. posterior();68 epdf& pfinit=evolQ._epdf(); 70 69 M.set_est ( pfinit ); 71 evolQ.set_parameters ( 10.0 70 evolQ.set_parameters ( 10.0, "0.01 0.01"); 72 71 73 72 // -
pmsm/old/pmsm_sim2.cpp
r271 r279 27 27 public: 28 28 //! Default constructor 29 EKF_unQ ( RV rx, RV ry,RV ru,RV rQ ) :EKFCh ( rx,ry,ru ),BMcond ( rQ ) {};30 29 void condition ( const vec &Q0 ) { 31 30 Q.setD ( Q0,0 ); … … 48 47 class EKF_unQful : public EKFfull , public BMcond { 49 48 public: 50 //! Default constructor51 EKF_unQful ( RV rx, RV ry,RV ru,RV rQ ) :EKFfull ( rx,ry,ru ),BMcond ( rQ ) {};52 49 void condition ( const vec &Q0 ) { 53 50 Q=diag(Q0); … … 89 86 chmat Q ( Qdiag ); 90 87 chmat R ( Rdiag ); 91 EKFCh KFE ( rx,ry,ru );88 EKFCh KFE ; 92 89 KFE.set_est ( mu0, chmat( 1*eye ( 4 ) ) ); 93 90 KFE.set_parameters ( &fxu,&hxu,Q,R); 94 91 95 92 RV rQ ( "{Q}","4" ); 96 EKF_unQful KFEp ( rx,ry,ru,rQ );93 EKF_unQful KFEp ; 97 94 KFEp.set_est ( mu0, 1*ones ( 4 ) ); 98 95 KFEp.set_parameters ( &fxu,&hxu,diag(Qdiag),diag(Rdiag) ); 99 96 100 mgamma_fix evolQ ( rQ,rQ );101 MPF<EKF_unQful> M ( rx,rQ,evolQ,evolQ,Npart,KFEp );97 mgamma_fix evolQ ; 98 MPF<EKF_unQful> M ( &evolQ,&evolQ,Npart,KFEp ); 102 99 // initialize 103 100 evolQ.set_parameters ( 1000.0 ,Qdiag, 0.5); //sigma = 1/10 mu 104 101 evolQ.condition ( Qdiag ); //Zdenek default 105 epdf& pfinit=evolQ. posterior();102 epdf& pfinit=evolQ._epdf(); 106 103 M.set_est ( pfinit ); 107 104 evolQ.set_parameters ( 100000.0, Qdiag, 0.9999 ); -
pmsm/old/pmsm_unkQ.cpp
r278 r279 46 46 chmat Q ( Qdiag ); 47 47 chmat R ( Rdiag ); 48 EKFCh KFE ( rx,ry,ru );48 EKFCh KFE ; 49 49 KFE.set_est ( mu0, chmat ( 1000*ones ( 4 ) ) ); 50 50 KFE.set_parameters ( &fxu,&hxu,Q,R ); … … 57 57 vec Qid ( Qdiag ); 58 58 Qid ( 0 ) = vQ ( i ); Qid ( 1 ) = vQ ( i ); 59 kfArray[i]= new EKFCh ( rx,ry,ru );59 kfArray[i]= new EKFCh; 60 60 kfArray[i]->set_est ( mu0, chmat ( 1000*ones ( 4 ) ) ); 61 61 kfArray[i]->set_parameters ( &fxu,&hxu,chmat ( Qid ),R ); -
pmsm/old/pmsm_unkQpf.cpp
r278 r279 24 24 public: 25 25 //! Default constructor 26 EKF_unQ ( RV rx, RV ry,RV ru,RV rQ ) :EKFCh ( rx,ry,ru ),BMcond ( rQ ) {};27 26 void condition ( const vec &Q0 ) { 28 27 Q.setD ( Q0,0 ); … … 53 52 54 53 RV rQ ( "{Q}","2" ); 55 EKF_unQ KFE ( rx,ry,ru,rQ );54 EKF_unQ KFE ; 56 55 KFE.set_parameters ( &fxu,&hxu,Q,R ); 57 56 KFE.set_est ( mu0, chmat ( 1000*ones ( 4 ) ) ); 58 57 59 mgamma evolQ ( rQ,rQ );58 mgamma evolQ ; 60 59 //evolQ.set_parameters ( 10000.0 ); //sigma = 1/10 mu 61 60 62 MPF<EKF_unQ> M ( rx,rQ,evolQ,evolQ,100,KFE );61 MPF<EKF_unQ> M ( &evolQ,&evolQ,100,KFE ); 63 62 64 63 const epdf& KFEep = KFE.posterior(); 65 64 const epdf& Mep = M.posterior(); 66 65 // initialize 67 evolQ.set_parameters ( 1.0 ); //sigma = 1/10 mu66 evolQ.set_parameters ( 1.0, "0.5 0.5" ); //sigma = 1/10 mu 68 67 evolQ.condition ( "0.5 0.5" ); 69 const epdf& pfinit=evolQ. posterior();68 const epdf& pfinit=evolQ._epdf(); 70 69 M.set_est ( pfinit ); 71 evolQ.set_parameters ( 1000.0 ); //sigma = 1/10 mu70 evolQ.set_parameters ( 1000.0 , "0.5 0.5"); //sigma = 1/10 mu 72 71 73 72 //simulator values -
pmsm/old/sim_var.cpp
r271 r279 63 63 mat Q =diag( Qdiag ); 64 64 mat R =diag ( Rdiag ); 65 EKFfull Efix ( rx,ry,ru );65 EKFfull Efix ; 66 66 Efix.set_est ( mu0, 1*eye ( 4 ) ); 67 67 Efix.set_parameters ( &fxu,&hxu,Q,R); 68 68 69 EKFfull Eop ( rx,ry,ru );69 EKFfull Eop ; 70 70 Eop.set_est ( mu0, 1*eye ( 4 ) ); 71 71 Eop.set_parameters ( &fxu,&hxu,Q,R); 72 72 73 EKFfull Edi ( rx,ry,ru );73 EKFfull Edi ; 74 74 Edi.set_est ( mu0, 1*eye ( 4 ) ); 75 75 Edi.set_parameters ( &fxu,&hxu,Q,R);