Improvements to Tony's c172 model.
This commit is contained in:
parent
aa68d067d0
commit
0bb22cd0a7
5 changed files with 132 additions and 99 deletions
|
@ -88,6 +88,8 @@
|
|||
#include "ls_cockpit.h"
|
||||
#include "ls_constants.h"
|
||||
#include "ls_types.h"
|
||||
#include "c172_aero.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -144,84 +146,55 @@ void aero( SCALAR dt, int Initialize ) {
|
|||
|
||||
|
||||
static SCALAR trim_inc = 0.0002;
|
||||
SCALAR long_trim;
|
||||
|
||||
|
||||
SCALAR elevator, aileron, rudder;
|
||||
|
||||
|
||||
|
||||
static SCALAR alpha_ind[NCL]={-0.087,0,0.175,0.209,0.24,0.262,0.278,0.303,0.314,0.332,0.367};
|
||||
static SCALAR CLtable[NCL]={-0.14,0.31,1.21,1.376,1.51249,1.591,1.63,1.60878,1.53712,1.376,1.142};
|
||||
|
||||
|
||||
|
||||
|
||||
/*Note that CLo,Cdo,Cmo will likely change with flap setting so
|
||||
|
||||
/*Note that CLo,Cdo,Cmo will likely change with flap setting so
|
||||
they may not be declared static in the future */
|
||||
|
||||
|
||||
static SCALAR CLadot=1.7;
|
||||
static SCALAR CLq=3.9;
|
||||
static SCALAR CLde=0.43;
|
||||
static SCALAR CLo=0;
|
||||
|
||||
|
||||
static SCALAR Cdo=0.031;
|
||||
static SCALAR Cda=0.13; /*Not used*/
|
||||
static SCALAR Cdde=0.06;
|
||||
|
||||
static SCALAR Cma=-0.89;
|
||||
static SCALAR Cmadot=-5.2;
|
||||
static SCALAR Cmq=-12.4;
|
||||
static SCALAR Cmo=-0.062;
|
||||
static SCALAR Cmde=-1.28;
|
||||
|
||||
static SCALAR Clbeta=-0.089;
|
||||
static SCALAR Clp=-0.47;
|
||||
static SCALAR Clr=0.096;
|
||||
static SCALAR Clda=-0.178;
|
||||
static SCALAR Cldr=0.0147;
|
||||
|
||||
static SCALAR Cnbeta=0.065;
|
||||
static SCALAR Cnp=-0.03;
|
||||
static SCALAR Cnr=-0.099;
|
||||
static SCALAR Cnda=-0.053;
|
||||
static SCALAR Cndr=-0.0657;
|
||||
|
||||
static SCALAR Cybeta=-0.31;
|
||||
static SCALAR Cyp=-0.037;
|
||||
static SCALAR Cyr=0.21;
|
||||
static SCALAR Cyda=0.0;
|
||||
static SCALAR Cydr=0.187;
|
||||
|
||||
/*nondimensionalization quantities*/
|
||||
/*units here are ft and lbs */
|
||||
static SCALAR cbar=4.9; /*mean aero chord ft*/
|
||||
static SCALAR b=35.8; /*wing span ft */
|
||||
static SCALAR Sw=174; /*wing planform surface area ft^2*/
|
||||
static SCALAR rPiARe=0.054; /*reciprocal of Pi*AR*e*/
|
||||
|
||||
SCALAR W=Mass/INVG;
|
||||
|
||||
SCALAR CLwbh,CL,cm,cd,cn,cy,croll,cbar_2V,b_2V,qS,qScbar,qSb,ps,rs;
|
||||
|
||||
SCALAR F_X_wind,F_Y_wind,F_Z_wind,W_X,W_Y,W_Z;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (Initialize != 0)
|
||||
if (Initialize != 0)
|
||||
{
|
||||
|
||||
CLadot=1.7;
|
||||
CLq=3.9;
|
||||
CLde=0.43;
|
||||
CLo=0;
|
||||
|
||||
|
||||
|
||||
|
||||
Cdo=0.031;
|
||||
Cda=0.13; /*Not used*/
|
||||
Cdde=0.06;
|
||||
|
||||
Cma=-0.89;
|
||||
Cmadot=-5.2;
|
||||
Cmq=-12.4;
|
||||
Cmo=-0.062;
|
||||
Cmde=-1.28;
|
||||
|
||||
Clbeta=-0.089;
|
||||
Clp=-0.47;
|
||||
Clr=0.096;
|
||||
Clda=-0.178;
|
||||
Cldr=0.0147;
|
||||
|
||||
Cnbeta=0.065;
|
||||
Cnp=-0.03;
|
||||
Cnr=-0.099;
|
||||
Cnda=-0.053;
|
||||
Cndr=-0.0657;
|
||||
|
||||
Cybeta=-0.31;
|
||||
Cyp=-0.037;
|
||||
Cyr=0.21;
|
||||
Cyda=0.0;
|
||||
Cydr=0.187;
|
||||
|
||||
/*nondimensionalization quantities*/
|
||||
/*units here are ft and lbs */
|
||||
cbar=4.9; /*mean aero chord ft*/
|
||||
b=35.8; /*wing span ft */
|
||||
Sw=174; /*wing planform surface area ft^2*/
|
||||
rPiARe=0.054; /*reciprocal of Pi*AR*e*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
LaRCsim uses:
|
||||
|
@ -233,11 +206,12 @@ void aero( SCALAR dt, int Initialize ) {
|
|||
aileron > 0 => right wing up
|
||||
rudder > 0 => ANL
|
||||
*/
|
||||
|
||||
long_trim=0;
|
||||
if(Aft_trim) long_trim = long_trim - trim_inc;
|
||||
if(Fwd_trim) long_trim = long_trim + trim_inc;
|
||||
|
||||
/*scale pct control to degrees deflection*/
|
||||
/* printf("Long_control: %7.4f, long_trim: %7.4f,DEG_TO_RAD: %7.4f, RAD_TO_DEG: %7.4f\n",Long_control,long_trim,DEG_TO_RAD,RAD_TO_DEG);
|
||||
*/ /*scale pct control to degrees deflection*/
|
||||
if ((Long_control+long_trim) <= 0)
|
||||
elevator=(Long_control+long_trim)*28*DEG_TO_RAD;
|
||||
else
|
||||
|
@ -274,11 +248,8 @@ void aero( SCALAR dt, int Initialize ) {
|
|||
qScbar=qS*cbar;
|
||||
qSb=qS*b;
|
||||
|
||||
/*transform the aircraft rotation rates*/
|
||||
ps=-P_body*Cos_alpha + R_body*Sin_alpha;
|
||||
rs=-P_body*Sin_alpha + R_body*Cos_alpha;
|
||||
|
||||
/* printf("Wb: %7.4f, Ub: %7.4f, Alpha: %7.4f, elev: %7.4f, ail: %7.4f, rud: %7.4f\n",W_body,U_body,Alpha*RAD_TO_DEG,elevator*RAD_TO_DEG,aileron*RAD_TO_DEG,rudder*RAD_TO_DEG);
|
||||
/* printf("Wb: %7.4f, Ub: %7.4f, Alpha: %7.4f, elev: %7.4f, ail: %7.4f, rud: %7.4f, long_trim: %7.4f\n",W_body,U_body,Alpha*RAD_TO_DEG,elevator*RAD_TO_DEG,aileron*RAD_TO_DEG,rudder*RAD_TO_DEG,long_trim*RAD_TO_DEG);
|
||||
printf("Theta: %7.4f, Gamma: %7.4f, Beta: %7.4f, Phi: %7.4f, Psi: %7.4f\n",Theta*RAD_TO_DEG,Gamma_vert_rad*RAD_TO_DEG,Beta*RAD_TO_DEG,Phi*RAD_TO_DEG,Psi*RAD_TO_DEG);
|
||||
*/
|
||||
|
||||
|
@ -286,11 +257,11 @@ void aero( SCALAR dt, int Initialize ) {
|
|||
CLwbh = interp(CLtable,alpha_ind,NCL,Alpha);
|
||||
CL = CLo + CLwbh + (CLadot*Alpha_dot + CLq*Theta_dot)*cbar_2V + CLde*elevator;
|
||||
cd = Cdo + rPiARe*CL*CL + Cdde*elevator;
|
||||
cy = Cybeta*Beta + (Cyp*ps + Cyr*rs)*b_2V + Cyda*aileron + Cydr*rudder;
|
||||
cy = Cybeta*Beta + (Cyp*P_body + Cyr*R_body)*b_2V + Cyda*aileron + Cydr*rudder;
|
||||
|
||||
cm = Cmo + Cma*Alpha + (Cmq*Theta_dot + Cmadot*Alpha_dot)*cbar_2V + Cmde*(elevator+long_trim);
|
||||
cn = Cnbeta*Beta + (Cnp*ps + Cnr*rs)*b_2V + Cnda*aileron + Cndr*rudder;
|
||||
croll=Clbeta*Beta + (Clp*ps + Clr*rs)*b_2V + Clda*aileron + Cldr*rudder;
|
||||
cm = Cmo + Cma*Alpha + (Cmq*Q_body + Cmadot*Alpha_dot)*cbar_2V + Cmde*(elevator+long_trim);
|
||||
cn = Cnbeta*Beta + (Cnp*P_body + Cnr*R_body)*b_2V + Cnda*aileron + Cndr*rudder;
|
||||
croll=Clbeta*Beta + (Clp*P_body + Clr*R_body)*b_2V + Clda*aileron + Cldr*rudder;
|
||||
|
||||
/* printf("CL: %7.4f, Cd: %7.4f, Cm: %7.4f, Cy: %7.4f, Cn: %7.4f, Cl: %7.4f\n",CL,cd,cm,cy,cn,croll);
|
||||
*/ /*calculate wind axes forces*/
|
||||
|
@ -302,16 +273,12 @@ void aero( SCALAR dt, int Initialize ) {
|
|||
*/
|
||||
/*calculate moments and body axis forces */
|
||||
|
||||
/*find body-axis components of weight*/
|
||||
/*with earth axis to body axis transform */
|
||||
W_X=-1*W*Sin_theta;
|
||||
W_Y=W*Sin_phi*Cos_theta;
|
||||
W_Z=W*Cos_phi*Cos_theta;
|
||||
|
||||
|
||||
/* requires ugly wind-axes to body-axes transform */
|
||||
F_X_aero = W_X + F_X_wind*Cos_alpha*Cos_beta - F_Y_wind*Cos_alpha*Sin_beta - F_Z_wind*Sin_alpha;
|
||||
F_Y_aero = W_Y + F_X_wind*Sin_beta + F_Y_wind*Cos_beta;
|
||||
F_Z_aero = W_Z*NZ + F_X_wind*Sin_alpha*Cos_beta - F_Y_wind*Sin_alpha*Sin_beta + F_Z_wind*Cos_alpha;
|
||||
F_X_aero = F_X_wind*Cos_alpha*Cos_beta - F_Y_wind*Cos_alpha*Sin_beta - F_Z_wind*Sin_alpha;
|
||||
F_Y_aero = F_X_wind*Sin_beta + F_Y_wind*Cos_beta;
|
||||
F_Z_aero = F_X_wind*Sin_alpha*Cos_beta - F_Y_wind*Sin_alpha*Sin_beta + F_Z_wind*Cos_alpha;
|
||||
|
||||
/*no axes transform here */
|
||||
M_l_aero = croll*qSb;
|
||||
|
@ -319,10 +286,9 @@ void aero( SCALAR dt, int Initialize ) {
|
|||
M_n_aero = cn*qSb;
|
||||
|
||||
/* printf("I_yy: %7.4f, qScbar: %7.4f, qbar: %7.4f, Sw: %7.4f, cbar: %7.4f, 0.5*rho*V^2: %7.4f\n",I_yy,qScbar,Dynamic_pressure,Sw,cbar,0.5*0.0023081*V_rel_wind*V_rel_wind);
|
||||
printf("Fxbody: %7.4f Fybody: %7.4f Fzbody: %7.4f Weight: %7.4f\n",F_X_wind,F_Y_wind,F_Z_wind,W);
|
||||
printf("Maero: %7.4f Naero: %7.4f Raero: %7.4f\n",M_m_aero,M_n_aero,M_l_aero);
|
||||
*/
|
||||
|
||||
*/
|
||||
/* printf("Fxaero: %7.4f Fyaero: %7.4f Fzaero: %7.4f Weight: %7.4f\n",F_X_aero,F_Y_aero,F_Z_aero,W);
|
||||
*//* printf("Maero: %7.4f Naero: %7.4f Raero: %7.4f\n",M_m_aero,M_n_aero,M_l_aero);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
55
src/FDM/LaRCsim/c172_aero.h
Normal file
55
src/FDM/LaRCsim/c172_aero.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*c172_aero.h*/
|
||||
|
||||
/*global declarations of aero model parameters*/
|
||||
|
||||
static SCALAR CLadot;
|
||||
static SCALAR CLq;
|
||||
static SCALAR CLde;
|
||||
static SCALAR CLo;
|
||||
|
||||
|
||||
static SCALAR Cdo;
|
||||
static SCALAR Cda; /*Not used*/
|
||||
static SCALAR Cdde;
|
||||
|
||||
static SCALAR Cma;
|
||||
static SCALAR Cmadot;
|
||||
static SCALAR Cmq;
|
||||
static SCALAR Cmo;
|
||||
static SCALAR Cmde;
|
||||
|
||||
static SCALAR Clbeta;
|
||||
static SCALAR Clp;
|
||||
static SCALAR Clr;
|
||||
static SCALAR Clda;
|
||||
static SCALAR Cldr;
|
||||
|
||||
static SCALAR Cnbeta;
|
||||
static SCALAR Cnp;
|
||||
static SCALAR Cnr;
|
||||
static SCALAR Cnda;
|
||||
static SCALAR Cndr;
|
||||
|
||||
static SCALAR Cybeta;
|
||||
static SCALAR Cyp;
|
||||
static SCALAR Cyr;
|
||||
static SCALAR Cyda;
|
||||
static SCALAR Cydr;
|
||||
|
||||
/*nondimensionalization quantities*/
|
||||
/*units here are ft and lbs */
|
||||
static SCALAR cbar; /*mean aero chord ft*/
|
||||
static SCALAR b; /*wing span ft */
|
||||
static SCALAR Sw; /*wing planform surface area ft^2*/
|
||||
static SCALAR rPiARe; /*reciprocal of Pi*AR*e*/
|
||||
|
||||
|
||||
|
||||
SCALAR CLwbh,CL,cm,cd,cn,cy,croll,cbar_2V,b_2V,qS,qScbar,qSb,ps,rs;
|
||||
|
||||
SCALAR F_X_wind,F_Y_wind,F_Z_wind;
|
||||
|
||||
SCALAR long_trim;
|
||||
|
||||
|
||||
SCALAR elevator, aileron, rudder;
|
|
@ -80,5 +80,3 @@ void engine( SCALAR dt, int init ) {
|
|||
|
||||
Throttle_pct = Throttle[3];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
|
||||
$Header$
|
||||
$Log$
|
||||
Revision 1.2 1999/06/21 03:01:47 curt
|
||||
Updated for both JSBsim and Tony Peden's c172 flight model.
|
||||
Revision 1.3 1999/07/31 02:57:36 curt
|
||||
Improvements to Tony's c172 model.
|
||||
|
||||
Revision 1.1.1.1 1999/04/05 21:32:45 curt
|
||||
Start of 0.6.x branch.
|
||||
|
@ -93,7 +93,6 @@ Initial Flight Gear revision.
|
|||
#include "ls_generic.h"
|
||||
#include "ls_cockpit.h"
|
||||
|
||||
|
||||
void sub3( DATA v1[], DATA v2[], DATA result[] )
|
||||
{
|
||||
result[0] = v1[0] - v2[0];
|
||||
|
@ -137,6 +136,8 @@ void clear3( DATA v[] )
|
|||
void gear( SCALAR dt, int Initialize ) {
|
||||
char rcsid[] = "$Id$";
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Aircraft specific initializations and data goes here
|
||||
*/
|
||||
|
@ -181,7 +182,7 @@ char rcsid[] = "$Id$";
|
|||
* V V
|
||||
*/
|
||||
|
||||
|
||||
|
||||
static DATA sliding_mu = 0.5;
|
||||
static DATA rolling_mu = 0.01;
|
||||
static DATA max_brake_mu = 0.6;
|
||||
|
@ -208,6 +209,8 @@ char rcsid[] = "$Id$";
|
|||
|
||||
int i; /* per wheel loop counter */
|
||||
|
||||
Brake_pct=0;
|
||||
|
||||
/*
|
||||
* Execution starts here
|
||||
*/
|
||||
|
|
|
@ -74,3 +74,14 @@ void model_init( void ) {
|
|||
|
||||
|
||||
}
|
||||
/* a quick navion_init.h */
|
||||
|
||||
|
||||
#ifndef _NAVION_INIT_H
|
||||
#define _NAVION_INIT_H
|
||||
|
||||
|
||||
void model_init( void );
|
||||
|
||||
|
||||
#endif _NAVION_INIT_H
|
||||
|
|
Loading…
Add table
Reference in a new issue