@@ -20,7 +20,7 @@ AirDC::AirDC(int pid)
2020 _RH=0.0 ;
2121 _qc=0.0 ;
2222 _AOA=0.17 ;
23- _AOS=0.01 ;
23+ _AOS=0.00 ;
2424 _IAS=0.0 ;
2525 _TASPCorrected=0.0 ;
2626 // Uncertainty of measurements
@@ -33,7 +33,7 @@ AirDC::AirDC(int pid)
3333 _uTAT=0.0 ;// To be calculated, 0 default value
3434// Inertial Unit
3535 _Ip=0 ;
36- _Iq=2.6 ;
36+ _Iq=3 ;
3737 _Ir=0 ;
3838 _Ipdot=0.00 ;
3939 _Iqdot=0.00 ;
@@ -330,45 +330,39 @@ void AirDC::PitotCorrection(int mode)
330330 float PW[3 ][1 ]; // Position of probe tip in wind ref. frame
331331 float PWDOT[3 ][1 ]; // Velocity of tip in wind ref. frame
332332 float VCorrected[3 ][1 ]; // Measured Airspeed
333- PB[1 ][1 ]=0.5 ; // Installation position respect c.o.g.
334- PB[2 ][1 ]=0 ;
335- PB[3 ][1 ]=0 ;
336- WB[1 ][1 ]=_Ip; // Angular rates . P, q, r from sensors
337- WB[2 ][1 ]=_Iq;
338- WB[3 ][1 ]=_Ir;
339-
340- R[1 ][1 ]=cos (_AOA)*cos (_AOS);
341- R[1 ][2 ]=sin (_AOS);
342- R[1 ][3 ]=sin (_AOA)*sin (_AOS);
343- R[2 ][1 ]=-1 *cos (_AOA)*sin (_AOS);
344- R[2 ][2 ]=cos (_AOS);
345- R[2 ][3 ]=-1 *sin (_AOA)*sin (_AOS);
346- R[3 ][1 ]=-1 *sin (_AOA);
347- R[3 ][2 ]=0 ;
348- R[3 ][3 ]=cos (_AOA);
349- Serial.Println (" Debug" )
350- Matrix.Print ((float *)R,3 ,3 ," R" );
333+ PB[0 ][0 ]=0.5 ; // Installation position respect c.o.g.
334+ PB[1 ][0 ]=0 ;
335+ PB[2 ][0 ]=0 ;
336+ WB[0 ][0 ]=_Ip; // Angular rates . P, q, r from sensors
337+ WB[1 ][0 ]=_Iq;
338+ WB[2 ][0 ]=_Ir;
339+ // Matrix.Print((float*)PB,3,1,"PB");
340+ R[0 ][0 ]=cos (_AOA)*cos (_AOS);
341+ R[0 ][1 ]=sin (_AOS);
342+ R[0 ][2 ]=sin (_AOA)*sin (_AOS);
343+ R[1 ][0 ]=-1 *cos (_AOA)*sin (_AOS);
344+ R[1 ][1 ]=cos (_AOS);
345+ R[1 ][2 ]=-1 *sin (_AOA)*sin (_AOS);
346+ R[2 ][0 ]=-1 *sin (_AOA);
347+ R[2 ][1 ]=0 ;
348+ R[2 ][2 ]=cos (_AOA);
351349
352350// Calculation of Position vector in wind axes
353351 Matrix.Multiply ((float *)R,(float *)PB,3 ,3 ,1 ,(float *)PW);
354352// Calculation of angular rates at tip in wind frame. Attention, assumed low angular acceleration. High rates in another method.
353+
355354 Matrix.Multiply ((float *)R,(float *)WB,3 ,3 ,1 ,(float *)WW);
356- Serial.Println (" Debug" )
357- Matrix.Print ((float *)PW,3 ,1 ," PW" );
358- Matrix.Print ((float *)WW,3 ,1 ," WW" );
359355// Calculation of velocity vector at tip in wind coordinates
360356// Cross product WWxPW
361- PWDOT[1 ][ 1 ]=WW[2 ][ 1 ]*PW[3 ][ 1 ]-WW[3 ][ 1 ]*PW[2 ][ 1 ];
362- PWDOT[2 ][ 1 ]=WW[3 ][ 1 ]*PW[1 ][ 1 ]-WW[1 ][ 1 ]*PW[3 ][ 1 ];
363- PWDOT[3 ][ 1 ]=WW[1 ][ 1 ]*PW[2 ][ 1 ]-WW[2 ][ 1 ]*PW[1 ][ 1 ];
357+ PWDOT[0 ][ 0 ]=WW[1 ][ 0 ]*PW[2 ][ 0 ]-WW[2 ][ 0 ]*PW[1 ][ 0 ];
358+ PWDOT[1 ][ 0 ]=WW[2 ][ 0 ]*PW[0 ][ 0 ]-WW[0 ][ 0 ]*PW[2 ][ 0 ];
359+ PWDOT[2 ][ 0 ]=WW[0 ][ 0 ]*PW[1 ][ 0 ]-WW[1 ][ 0 ]*PW[0 ][ 0 ];
364360// Airspeed vector
365- VCorrected[1 ][1 ]=_TAS-PWDOT[1 ][1 ];
366- VCorrected[2 ][1 ]= -PWDOT[2 ][1 ];
367- VCorrected[3 ][1 ]= -PWDOT[3 ][1 ];
368- Serial.Println (" Debug" )
369- Matrix.Print ((float *)VCorrected,3 ,1 ," VCorrected" );
370- // _TASPCorrected=sqrt(pow(VCorrected[1][1],2)+pow(VCorrected[2][1],2)+pow(VCorrected[3][1],2));
371- _TASPCorrected=0 ;
361+ VCorrected[0 ][0 ]=_TAS-PWDOT[0 ][0 ];
362+ VCorrected[1 ][0 ]= -PWDOT[1 ][0 ];
363+ VCorrected[2 ][0 ]= -PWDOT[2 ][0 ];
364+ _TASPCorrected=sqrt (pow (VCorrected[0 ][0 ],2 )+pow (VCorrected[1 ][0 ],2 )+pow (VCorrected[2 ][0 ],2 ));
365+ // _TASPCorrected=0;
372366 break ;
373367 }
374368 }
0 commit comments