1
0
Fork 0

Updates contributed by Jon Berndt.

This commit is contained in:
curt 1999-06-28 17:39:20 +00:00
parent a85b537e75
commit bb94a6ef5c
8 changed files with 65 additions and 51 deletions

View file

@ -385,9 +385,14 @@ void FGAircraft::FAero(void)
for (int ctr=0; ctr < coeff_ctr[axis_ctr]; ctr++) for (int ctr=0; ctr < coeff_ctr[axis_ctr]; ctr++)
F[axis_ctr] += Coeff[axis_ctr][ctr]->TotalValue(); F[axis_ctr] += Coeff[axis_ctr][ctr]->TotalValue();
Forces[0] += F[DragCoeff]*cos(alpha)*cos(beta) - F[SideCoeff]*cos(alpha)*sin(beta) - F[LiftCoeff]*sin(alpha); Forces[0] += - F[DragCoeff]*cos(alpha)*cos(beta)
Forces[1] += F[DragCoeff]*sin(beta) + F[SideCoeff]*cos(beta); - F[SideCoeff]*cos(alpha)*sin(beta)
Forces[2] += F[DragCoeff]*sin(alpha)*cos(beta) - F[SideCoeff]*sin(alpha)*sin(beta) + F[LiftCoeff]*cos(alpha); + 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);
} }

View file

@ -82,8 +82,8 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile)
coeffdef["FG_RUDDER"] = 8192; coeffdef["FG_RUDDER"] = 8192;
coeffdef["FG_MACH"] = 16384; coeffdef["FG_MACH"] = 16384;
coeffdef["FG_ALTITUDE"] = 32768L; coeffdef["FG_ALTITUDE"] = 32768L;
coeffdef["FG_I2VEL"] = 65536L; coeffdef["FG_BI2VEL"] = 65536L;
coeffdef["FG_HALF"] = 131072L; coeffdef["FG_CI2VEL"] = 131072L;
FDMExec = fdex; FDMExec = fdex;
State = FDMExec->GetState(); State = FDMExec->GetState();
@ -245,10 +245,15 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile)
mult_count++; mult_count++;
cout << "h "; cout << "h ";
} }
if (multipliers & FG_I2VEL) { if (multipliers & FG_BI2VEL) {
mult_idx[mult_count] = FG_I2VEL; mult_idx[mult_count] = FG_BI2VEL;
mult_count++; mult_count++;
cout << "1 /(2*Vt) "; cout << "b /(2*Vt) ";
}
if (multipliers & FG_CI2VEL) {
mult_idx[mult_count] = FG_CI2VEL;
mult_count++;
cout << "c /(2*Vt) ";
} }
cout << endl; cout << endl;
@ -450,8 +455,10 @@ float FGCoefficient::GetCoeffVal(int val_idx)
return State->GetMach(); return State->GetMach();
case FG_ALTITUDE: case FG_ALTITUDE:
return State->Geth(); return State->Geth();
case FG_I2VEL: case FG_BI2VEL:
return 1.0/(0.5 * State->GetVt()); return Aircraft->GetWingSpan()/(2.0 * State->GetVt());
case FG_CI2VEL:
return Aircraft->Getcbar()/(2.0 * State->GetVt());
} }
return 0; return 0;
} }

View file

@ -75,7 +75,8 @@ using namespace std;
#define FG_RUDDER 8192 #define FG_RUDDER 8192
#define FG_MACH 16384 #define FG_MACH 16384
#define FG_ALTITUDE 32768L #define FG_ALTITUDE 32768L
#define FG_I2VEL 65536L #define FG_BI2VEL 65536L
#define FG_CI2VEL 131072L
/******************************************************************************* /*******************************************************************************
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -114,7 +115,8 @@ FG_AILERON 4096
FG_RUDDER 8192 FG_RUDDER 8192
FG_MACH 16384 FG_MACH 16384
FG_ALTITUDE 32768L FG_ALTITUDE 32768L
FG_I2VEL 65536L FG_BI2VEL 65536L
FG_CI2VEL 131072L
******************************************************************************** ********************************************************************************
CLASS DECLARATION CLASS DECLARATION

View file

@ -51,8 +51,8 @@ FGControls::~FGControls() {
// $Log$ // $Log$
// Revision 1.2 1999/06/21 03:01:38 curt // Revision 1.3 1999/06/28 15:39:23 curt
// Updated for both JSBsim and Tony Peden's c172 flight model. // Updates contributed by Jon Berndt.
// //
// Revision 1.1 1999/02/13 01:12:03 curt // Revision 1.1 1999/02/13 01:12:03 curt
// Initial Revision. // Initial Revision.

View file

@ -177,8 +177,8 @@ extern FGControls controls;
// $Log$ // $Log$
// Revision 1.2 1999/06/21 03:01:39 curt // Revision 1.3 1999/06/28 15:39:24 curt
// Updated for both JSBsim and Tony Peden's c172 flight model. // Updates contributed by Jon Berndt.
// //
// Revision 1.1 1999/02/13 01:12:03 curt // Revision 1.1 1999/02/13 01:12:03 curt
// Initial Revision. // Initial Revision.

View file

@ -38,9 +38,9 @@ void main(int argc, char** argv)
// //
if (FDMExec->GetState()->Getsim_time() > 5.0) { if (FDMExec->GetState()->Getsim_time() > 5.0) {
FDMExec->GetFCS()->SetDa(0.05); FDMExec->GetFCS()->SetDe(0.05);
// FDMExec->GetFCS()->SetDr(0.05); // FDMExec->GetFCS()->SetDr(0.05);
// FDMExec->GetFCS()->SetDe(0.05); // FDMExec->GetFCS()->SetDa(0.05);
} }
FDMExec->Run(); FDMExec->Run();

View file

@ -120,8 +120,8 @@ FGMatrix& FGMatrix::operator=(const FGMatrix& A)
data = A.data; data = A.data;
} else { } else {
data = alloc(rows,cols); data = alloc(rows,cols);
for (int i=0; i<=rows; i++) { for (unsigned int i=0; i<=rows; i++) {
for (int j=0; j<=cols; j++) { for (unsigned int j=0; j<=cols; j++) {
data[i][j] = A.data[i][j]; data[i][j] = A.data[i][j];
} }
} }
@ -161,8 +161,8 @@ void FGMatrix::SetOParams(char delim,int width,int prec,int origin)
void FGMatrix::InitMatrix(double value) void FGMatrix::InitMatrix(double value)
{ {
if (data) { if (data) {
for (int i=0;i<=rows;i++) { for (unsigned int i=0;i<=rows;i++) {
for (int j=0;j<=cols;j++) { for (unsigned int j=0;j<=cols;j++) {
operator()(i,j) = value; operator()(i,j) = value;
} }
} }
@ -187,8 +187,8 @@ FGMatrix operator-(FGMatrix& A, FGMatrix& B)
FGMatrix Diff(A.Rows(),A.Cols()); FGMatrix Diff(A.Rows(),A.Cols());
Diff.keep=true; Diff.keep=true;
for (int i=1;i<=A.Rows();i++) { for (unsigned int i=1;i<=A.Rows();i++) {
for (int j=1;j<=A.Cols();j++) { for (unsigned int j=1;j<=A.Cols();j++) {
Diff(i,j)=A(i,j)-B(i,j); Diff(i,j)=A(i,j)-B(i,j);
} }
} }
@ -205,8 +205,8 @@ void operator-=(FGMatrix &A,FGMatrix &B)
exit(1); exit(1);
} }
for (int i=1;i<=A.Rows();i++) { for (unsigned int i=1;i<=A.Rows();i++) {
for (int j=1;j<=A.Cols();j++) { for (unsigned int j=1;j<=A.Cols();j++) {
A(i,j)-=B(i,j); A(i,j)-=B(i,j);
} }
} }
@ -224,8 +224,8 @@ FGMatrix operator+(FGMatrix& A, FGMatrix& B)
FGMatrix Sum(A.Rows(),A.Cols()); FGMatrix Sum(A.Rows(),A.Cols());
Sum.keep = true; Sum.keep = true;
for (int i=1;i<=A.Rows();i++) { for (unsigned int i=1;i<=A.Rows();i++) {
for (int j=1;j<=A.Cols();j++) { for (unsigned int j=1;j<=A.Cols();j++) {
Sum(i,j)=A(i,j)+B(i,j); Sum(i,j)=A(i,j)+B(i,j);
} }
} }
@ -241,8 +241,8 @@ void operator+=(FGMatrix &A,FGMatrix &B)
cout << endl; cout << endl;
exit(1); exit(1);
} }
for (int i=1;i<=A.Rows();i++) { for (unsigned int i=1;i<=A.Rows();i++) {
for (int j=1;j<=A.Cols();j++) { for (unsigned int j=1;j<=A.Cols();j++) {
A(i,j)+=B(i,j); A(i,j)+=B(i,j);
} }
} }
@ -253,8 +253,8 @@ FGMatrix operator*(double scalar,FGMatrix &A)
{ {
FGMatrix Product(A.Rows(),A.Cols()); FGMatrix Product(A.Rows(),A.Cols());
Product.keep = true; Product.keep = true;
for (int i=1;i<=A.Rows();i++) { for (unsigned int i=1;i<=A.Rows();i++) {
for (int j=1;j<=A.Cols();j++) { for (unsigned int j=1;j<=A.Cols();j++) {
Product(i,j) = scalar*A(i,j); Product(i,j) = scalar*A(i,j);
} }
} }
@ -264,8 +264,8 @@ FGMatrix operator*(double scalar,FGMatrix &A)
void operator*=(FGMatrix &A,double scalar) void operator*=(FGMatrix &A,double scalar)
{ {
for (int i=1;i<=A.Rows();i++) { for (unsigned int i=1;i<=A.Rows();i++) {
for (int j=1;j<=A.Cols();j++) { for (unsigned int j=1;j<=A.Cols();j++) {
A(i,j)*=scalar; A(i,j)*=scalar;
} }
} }
@ -284,10 +284,10 @@ FGMatrix operator*(FGMatrix &Left, FGMatrix &Right)
FGMatrix Product(Left.Rows(),Right.Cols()); FGMatrix Product(Left.Rows(),Right.Cols());
Product.keep = true; Product.keep = true;
for (int i=1;i<=Left.Rows();i++) { for (unsigned int i=1;i<=Left.Rows();i++) {
for (int j=1;j<=Right.Cols();j++) { for (unsigned int j=1;j<=Right.Cols();j++) {
Product(i,j) = 0; Product(i,j) = 0;
for (int k=1;k<=Left.Cols();k++) { for (unsigned int k=1;k<=Left.Cols();k++) {
Product(i,j)+=Left(i,k)*Right(k,j); Product(i,j)+=Left(i,k)*Right(k,j);
} }
} }
@ -309,10 +309,10 @@ void operator*=(FGMatrix &Left,FGMatrix &Right)
double **prod; double **prod;
prod=alloc(Left.Rows(),Right.Cols()); prod=alloc(Left.Rows(),Right.Cols());
for (int i=1;i<=Left.Rows();i++) { for (unsigned int i=1;i<=Left.Rows();i++) {
for (int j=1;j<=Right.Cols();j++) { for (unsigned int j=1;j<=Right.Cols();j++) {
prod[i][j] = 0; prod[i][j] = 0;
for (int k=1;k<=Left.Cols();k++) { for (unsigned int k=1;k<=Left.Cols();k++) {
prod[i][j]+=Left(i,k)*Right(k,j); prod[i][j]+=Left(i,k)*Right(k,j);
} }
} }
@ -327,8 +327,8 @@ FGMatrix operator/(FGMatrix& A, double scalar)
{ {
FGMatrix Quot(A.Rows(),A.Cols()); FGMatrix Quot(A.Rows(),A.Cols());
A.keep = true; A.keep = true;
for (int i=1;i<=A.Rows();i++) { for (unsigned int i=1;i<=A.Rows();i++) {
for (int j=1;j<=A.Cols();j++) { for (unsigned int j=1;j<=A.Cols();j++) {
Quot(i,j)=A(i,j)/scalar; Quot(i,j)=A(i,j)/scalar;
} }
} }
@ -338,8 +338,8 @@ FGMatrix operator/(FGMatrix& A, double scalar)
void operator/=(FGMatrix &A,double scalar) void operator/=(FGMatrix &A,double scalar)
{ {
for (int i=1;i<=A.Rows();i++) { for (unsigned int i=1;i<=A.Rows();i++) {
for (int j=1;j<=A.Cols();j++) { for (unsigned int j=1;j<=A.Cols();j++) {
A(i,j)/=scalar; A(i,j)/=scalar;
} }
} }
@ -357,8 +357,8 @@ void FGMatrix::T(void)
void FGMatrix::TransposeSquare(void) void FGMatrix::TransposeSquare(void)
{ {
for (int i=1;i<=rows;i++) { for (unsigned int i=1;i<=rows;i++) {
for (int j=i+1;j<=cols;j++) { for (unsigned int j=i+1;j<=cols;j++) {
double tmp=data[i][j]; double tmp=data[i][j];
data[i][j]=data[j][i]; data[i][j]=data[j][i];
data[j][i]=tmp; data[j][i]=tmp;
@ -372,8 +372,8 @@ void FGMatrix::TransposeNonSquare(void)
double **tran; double **tran;
tran=alloc(rows,cols); tran=alloc(rows,cols);
for (int i=1;i<=rows;i++) { for (unsigned int i=1;i<=rows;i++) {
for (int j=1;j<=cols;j++) { for (unsigned int j=1;j<=cols;j++) {
tran[j][i]=data[i][j]; tran[j][i]=data[i][j];
} }
} }

View file

@ -190,9 +190,9 @@ void FGOutput::DelimitedOutput(void)
cout << "Latitude,"; cout << "Latitude,";
cout << "Longitude,"; cout << "Longitude,";
cout << "QBar,"; cout << "QBar,";
cout << "Alpha"; cout << "Alpha,";
cout << "L"; cout << "L,";
cout << "M"; cout << "M,";
cout << "N"; cout << "N";
cout << endl; cout << endl;
FirstPass = false; FirstPass = false;