@@ -20,7 +20,7 @@ AirDC::AirDC(int pid)
20
20
_RH=0.0 ;
21
21
_qc=0.0 ;
22
22
_AOA=0.17 ;
23
- _AOS=0.01 ;
23
+ _AOS=0.00 ;
24
24
_IAS=0.0 ;
25
25
_TASPCorrected=0.0 ;
26
26
// Uncertainty of measurements
@@ -33,7 +33,7 @@ AirDC::AirDC(int pid)
33
33
_uTAT=0.0 ;// To be calculated, 0 default value
34
34
// Inertial Unit
35
35
_Ip=0 ;
36
- _Iq=2.6 ;
36
+ _Iq=3 ;
37
37
_Ir=0 ;
38
38
_Ipdot=0.00 ;
39
39
_Iqdot=0.00 ;
@@ -330,45 +330,39 @@ void AirDC::PitotCorrection(int mode)
330
330
float PW[3 ][1 ]; // Position of probe tip in wind ref. frame
331
331
float PWDOT[3 ][1 ]; // Velocity of tip in wind ref. frame
332
332
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);
351
349
352
350
// Calculation of Position vector in wind axes
353
351
Matrix.Multiply ((float *)R,(float *)PB,3 ,3 ,1 ,(float *)PW);
354
352
// Calculation of angular rates at tip in wind frame. Attention, assumed low angular acceleration. High rates in another method.
353
+
355
354
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" );
359
355
// Calculation of velocity vector at tip in wind coordinates
360
356
// 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 ];
364
360
// 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;
372
366
break ;
373
367
}
374
368
}
0 commit comments