See the header file FGCoefficient.h for the values of the identifiers.
-ARGUMENTS
---------------------------------------------------------------------------------
-
-
HISTORY
--------------------------------------------------------------------------------
12/28/98 JSB Created
INCLUDES
*******************************************************************************/
-class FGCoefficient;
-#include <stdio.h>
-#include <stdlib.h>
+#include "FGCoefficient.h"
+#include "FGAtmosphere.h"
+#include "FGState.h"
+#include "FGFDMExec.h"
#include "FGFCS.h"
#include "FGAircraft.h"
-#include "FGCoefficient.h"
+#include "FGTranslation.h"
+#include "FGRotation.h"
+#include "FGPosition.h"
+#include "FGAuxiliary.h"
+#include "FGOutput.h"
/*******************************************************************************
************************************ CODE **************************************
*******************************************************************************/
-FGCoefficient::FGCoefficient(void)
+FGCoefficient::FGCoefficient(FGFDMExec* fdex)
{
+ FDMExec = fdex;
+ State = FDMExec->GetState();
+ Atmosphere = FDMExec->GetAtmosphere();
+ FCS = FDMExec->GetFCS();
+ Aircraft = FDMExec->GetAircraft();
+ Translation = FDMExec->GetTranslation();
+ Rotation = FDMExec->GetRotation();
+ Position = FDMExec->GetPosition();
+ Auxiliary = FDMExec->GetAuxiliary();
+ Output = FDMExec->GetOutput();
+
rows = columns = 0;
}
-FGCoefficient::FGCoefficient(char* fname)
+FGCoefficient::FGCoefficient(FGFDMExec* fdex, string fname)
{
int r, c;
float ftrashcan;
- ifstream coeffDefFile(fname);
+ FDMExec = fdex;
+ State = FDMExec->GetState();
+ Atmosphere = FDMExec->GetAtmosphere();
+ FCS = FDMExec->GetFCS();
+ Aircraft = FDMExec->GetAircraft();
+ Translation = FDMExec->GetTranslation();
+ Rotation = FDMExec->GetRotation();
+ Position = FDMExec->GetPosition();
+ Auxiliary = FDMExec->GetAuxiliary();
+ Output = FDMExec->GetOutput();
+
+ ifstream coeffDefFile(fname.c_str());
if (coeffDefFile) {
if (!coeffDefFile.fail()) {
coeffDefFile >> description;
coeffDefFile >> method;
- if (strcmp(method,"EQUATION") == 0) type = 4;
- else if (strcmp(method,"TABLE") == 0) type = 3;
- else if (strcmp(method,"VECTOR") == 0) type = 2;
- else if (strcmp(method,"VALUE") == 0) type = 1;
- else type = 0;
+ if (method == "EQUATION") type = EQUATION;
+ else if (method == "TABLE") type = TABLE;
+ else if (method == "VECTOR") type = VECTOR;
+ else if (method == "VALUE") type = VALUE;
+ else type = UNKNOWN;
- if (type == 2 || type == 3) {
+ if (type == VECTOR || type == TABLE) {
coeffDefFile >> rows;
- if (type == 3) {
+ if (type == TABLE) {
coeffDefFile >> columns;
}
coeffDefFile >> LookupR;
}
- if (type == 3) {
+ if (type == TABLE) {
coeffDefFile >> LookupC;
}
}
switch(type) {
- case 1:
+ case VALUE:
coeffDefFile >> StaticValue;
break;
- case 2:
+ case VECTOR:
Allocate(rows,2);
for (r=1;r<=rows;r++) {
coeffDefFile >> Table3D[r][1];
}
break;
- case 3:
+ case TABLE:
Allocate(rows, columns);
for (c=1;c<=columns;c++) {
}
-FGCoefficient::FGCoefficient(int r, int c)
+FGCoefficient::FGCoefficient(FGFDMExec* fdex, int r, int c)
{
+ FDMExec = fdex;
+ State = FDMExec->GetState();
+ Atmosphere = FDMExec->GetAtmosphere();
+ FCS = FDMExec->GetFCS();
+ Aircraft = FDMExec->GetAircraft();
+ Translation = FDMExec->GetTranslation();
+ Rotation = FDMExec->GetRotation();
+ Position = FDMExec->GetPosition();
+ Auxiliary = FDMExec->GetAuxiliary();
+ Output = FDMExec->GetOutput();
+
rows = r;
columns = c;
Allocate(r,c);
}
-FGCoefficient::FGCoefficient(int n)
+FGCoefficient::FGCoefficient(FGFDMExec* fdex, int n)
{
+ FDMExec = fdex;
+ State = FDMExec->GetState();
+ Atmosphere = FDMExec->GetAtmosphere();
+ FCS = FDMExec->GetFCS();
+ Aircraft = FDMExec->GetAircraft();
+ Translation = FDMExec->GetTranslation();
+ Rotation = FDMExec->GetRotation();
+ Position = FDMExec->GetPosition();
+ Auxiliary = FDMExec->GetAuxiliary();
+ Output = FDMExec->GetOutput();
+
rows = n;
columns = 0;
Allocate(n);
case FG_CBAR:
return Aircraft->Getcbar();
case FG_ALPHA:
- return State->Getalpha();
+ return Translation->Getalpha();
case FG_ALPHADOT:
return State->Getadot();
case FG_BETA:
- return State->Getbeta();
+ return Translation->Getbeta();
case FG_BETADOT:
return State->Getbdot();
case FG_PITCHRATE:
- return State->GetQ();
+ return Rotation->GetQ();
case FG_ROLLRATE:
- return State->GetP();
+ return Rotation->GetP();
case FG_YAWRATE:
- return State->GetR();
+ return Rotation->GetR();
case FG_ELEVATOR:
return FCS->GetDe();
case FG_AILERON: