streampos gpos;
int axis;
string axis_descript;
+ bool readAeroRp=false;
axis = -1;
aircraftDef = aircraft_path + "/" + fname + "/" + fname + ".cfg";
numTanks = numEngines = 0;
numSelectedOxiTanks = numSelectedFuelTanks = 0;
+ Xcg=Ycg=Zcg=0; //protection for no cg specified in file
+
while (!aircraftfile.fail()) {
holding_string.erase();
aircraftfile >> holding_string;
cout << "Aircraft Empty Weight: " << EmptyWeight << endl;
} else if (holding_string == "AC_AERORP") {
aircraftfile >> Xrp >> Yrp >> Zrp;
+ readAeroRp=true;
cout << "Aerodynamic Reference Point: " << Xrp << " " << Yrp << " " << Zrp << endl;
} else if (holding_string == "AC_CGLOC") {
aircraftfile >> baseXcg >> baseYcg >> baseZcg;
aircraftfile.getline(scratch, 127);
}
}
- cout << "End of Configuration File Parsing." << endl;
+
+ if(!readAeroRp) {
+ Xrp = Xcg;
+ Yrp = Ycg;
+ Zrp = Zcg;
+ cout << "Aerodynamic reference point not found, set to empty weight cg location" << endl;
+ }
+ cout << "End of Configuration File Parsing." << endl;
return true;
}
void FGAircraft::FMAero(void)
{
float F[3];
- float Fxaero,Fyaero,Fzaero;
float dxcg,dycg,dzcg;
+ float ca, cb, sa, sb;
int axis_ctr,ctr;
F[0] = F[1] = F[2] = 0.0;
- for (axis_ctr = 0; axis_ctr < 3; axis_ctr++)
- for (ctr=0; ctr < coeff_ctr[axis_ctr]; ctr++)
+ for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
+ for (ctr=0; ctr < coeff_ctr[axis_ctr]; ctr++) {
F[axis_ctr] += Coeff[axis_ctr][ctr]->TotalValue();
+ Coeff[axis_ctr][ctr]->DumpSD();
+ }
+ }
+
+ ca = cos(alpha);
+ sa = sin(alpha);
+ cb = cos(beta);
+ sb = sin(beta);
- Fxaero = - F[DragCoeff]*cos(alpha)*cos(beta)
- - F[SideCoeff]*cos(alpha)*sin(beta)
- + F[LiftCoeff]*sin(alpha);
- Fyaero = F[DragCoeff]*sin(beta)
- + F[SideCoeff]*cos(beta);
- Fzaero = - F[DragCoeff]*sin(alpha)*cos(beta)
- - F[SideCoeff]*sin(alpha)*sin(beta)
- - F[LiftCoeff]*cos(alpha);
-
- Forces[0] += - F[DragCoeff]*cos(alpha)*cos(beta)
- - F[SideCoeff]*cos(alpha)*sin(beta)
- + F[LiftCoeff]*sin(alpha);
- Forces[1] += F[DragCoeff]*sin(beta)
- + F[SideCoeff]*cos(beta);
- Forces[2] += - F[DragCoeff]*sin(alpha)*cos(beta)
- - F[SideCoeff]*sin(alpha)*sin(beta)
- - F[LiftCoeff]*cos(alpha);
+ Forces[0] += - F[DragCoeff]*ca*cb
+ - F[SideCoeff]*ca*sb
+ + F[LiftCoeff]*sa;
+ Forces[1] += F[DragCoeff]*sb
+ + F[SideCoeff]*cb;
+ Forces[2] += - F[DragCoeff]*sa*cb
+ - F[SideCoeff]*sa*sb
+ - F[LiftCoeff]*ca;
// The d*cg distances below, given in inches, are the distances FROM the c.g.
// TO the reference point. Since the c.g. and ref point are given in inches in
dycg = (Yrp - Ycg)/12;
dzcg = -(Zrp - Zcg)/12;
- Moments[0] += Fzaero*dycg - Fyaero*dzcg; //rolling moment
- Moments[1] += Fxaero*dzcg - Fzaero*dxcg; //pitching moment
- Moments[2] += -Fxaero*dycg + Fyaero*dxcg; //yawing moment
+ Moments[0] += Forces[2]*dycg - Forces[1]*dzcg; //rolling moment
+ Moments[1] += Forces[0]*dzcg - Forces[2]*dxcg; //pitching moment
+ Moments[2] += -Forces[0]*dycg + Forces[1]*dxcg; //yawing moment
for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
for (ctr = 0; ctr < coeff_ctr[axis_ctr+3]; ctr++) {
Moments[axis_ctr] += Coeff[axis_ctr+3][ctr]->TotalValue();
+ Coeff[axis_ctr+3][ctr]->DumpSD();
}
}
}
col1temp = rFactor*(Table3D[r][c-1] - Table3D[r-1][c-1]) + Table3D[r-1][c-1];
col2temp = rFactor*(Table3D[r][c] - Table3D[r-1][c]) + Table3D[r-1][c];
- Value = col1temp + cFactor*(col2temp - col1temp);
+ SD = Value = col1temp + cFactor*(col2temp - col1temp);
for (midx=0;midx<mult_count;midx++) {
Value *= GetCoeffVal(mult_idx[midx]);
Factor = 1.0;
}
- Value = Factor*(Table3D[r][1] - Table3D[r-1][1]) + Table3D[r-1][1];
+ SD = Value = Factor*(Table3D[r][1] - Table3D[r-1][1]) + Table3D[r-1][1];
for (midx=0;midx<mult_count;midx++) {
Value *= GetCoeffVal(mult_idx[midx]);
float Value;
int midx;
- Value = StaticValue;
+ SD = Value = StaticValue;
for (midx=0;midx<mult_count;midx++) {
Value *= GetCoeffVal(mult_idx[midx]);
return 0;
}
+
+void FGCoefficient::DumpSD(void)
+{
+ cout << " " << name << " = " << SD << endl;
+}
elevator_trim( 1.969572E-03 ),
rudder( 0.0 )
{
- for ( int engine = 0; engine < MAX_ENGINES; engine++ ) {
- throttle[engine] = 0.0;
- }
+ for ( int engine = 0; engine < MAX_ENGINES; engine++ ) {
+ throttle[engine] = 0.0;
+ }
- for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
- brake[wheel] = 0.0;
- }
+ for ( int wheel = 0; wheel < MAX_WHEELS; wheel++ ) {
+ brake[wheel] = 0.0;
+ }
}
// $Log$
+// Revision 1.7 1999/12/30 17:01:59 curt
+// Here is a wrap-up of the latest changes to JSBSim. It still is flaky, but
+// much less so due to returning the aero reference point stuff to the config
+// files. Don't know what happened there ...
+//
+// Additionally, I have added a new field to the config file: CFG_VERSION. A
+// version number, currently 1.1, is assigned to the config file and a matching
+// definition is found in FGDefs.h. The two need to match. Tony has also added
+// code into FGAircraft.cpp to handle if aero reference point is not specified.
+//
// Revision 1.6 1999/09/07 21:15:45 curt
// Updates to get engine working.
//