// ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
- set_Mach_number( FDMExec.GetState()->GetMach());
+ set_Mach_number( FDMExec.GetTranslation()->GetMach());
// Positions
- double lat_geoc = FDMExec.GetState()->Getlatitude();
- double lon = FDMExec.GetState()->Getlongitude();
- double alt = FDMExec.GetState()->Geth();
+ double lat_geoc = FDMExec.GetPosition()->GetLatitude();
+ double lon = FDMExec.GetPosition()->GetLongitude();
+ double alt = FDMExec.GetPosition()->Geth();
double lat_geod, tmp_alt, sl_radius1, sl_radius2, tmp_lat_geoc;
fgGeocToGeod( lat_geoc, EQUATORIAL_RADIUS_M + alt * FEET_TO_METER,
&lat_geod, &tmp_alt, &sl_radius1 );
AxisIdx["PITCH"] = 4;
AxisIdx["YAW"] = 5;
- numTanks = numEngines = 0;
+ numTanks = numEngines = numSelectedFuelTanks = numSelectedOxiTanks = 0;
}
Weight += Tank[t]->GetContents();
Mass = Weight / GRAVITY;
-
// Calculate new CG here.
Tw = 0;
{
if (!FGModel::Run()) { // if false then execute this Run()
if (!useExternal) {
- h = State->Geth();
+ h = Position->Geth();
Calculate(h);
} else {
density = exDensity;
return false;
}
+
void FGAtmosphere::Calculate(float altitude)
{
//see reference [1]
-
float slope,reftemp,refpress,refdens;
int i=0;
float htab[]={0,36089,82020,154198,173882,259183,295272,344484}; //ft.
void FGAuxiliary::GetState(void)
{
- qbar = State->Getqbar();
- mach = State->GetMach();
+ qbar = Translation->Getqbar();
+ mach = Translation->GetMach();
p = Atmosphere->GetPressure();
rhosl = Atmosphere->GetDensitySL();
psl = Atmosphere->GetPressureSL();
}
-void FGAuxiliary::PutState(void){}
float qbar,rhosl,rho,p,psl,pt;
void GetState(void);
- void PutState(void);
-
};
/******************************************************************************/
// $Log$
+// Revision 1.9 2000/04/28 17:59:46 curt
+// 0429 updates from Jon.
+//
+// Revision 1.3 2000/04/26 10:55:57 jsb
+// Made changes as required by Curt to install JSBSim into FGFS
+//
// Revision 1.8 2000/04/24 21:49:06 curt
// Updated JSBsim code.
//
// $Log$
+// Revision 1.8 2000/04/28 17:59:46 curt
+// 0429 updates from Jon.
+//
+// Revision 1.4 2000/04/26 10:55:57 jsb
+// Made changes as required by Curt to install JSBSim into FGFS
+//
// Revision 1.7 2000/04/24 21:49:07 curt
// Updated JSBsim code.
//
}
EngineNumber = num;
- Thrust = 0.0;
+ Thrust = PctPower = 0.0;
Starved = Flameout = false;
}
Throttle = FCS->GetThrottlePos(EngineNumber);
Throttle /= 100;
-
- v=State->GetVt();
- h=State->Geth();
+
+ v=Translation->GetVt();
+ h=Position->Geth();
if(v < 10)
v=10;
if(h < 0)
FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex)
{
Name = "FGFCS";
+ for (int i=0; i < MAX_ENGINES; i++) {
+ ThrottleCmd[i] = 0.0;
+ ThrottlePos[i] = 0.0;
+ }
+ DaCmd = DeCmd = DrCmd = DfCmd = DsbCmd = DspCmd = 0.0;
+ DaPos = DePos = DrPos = DfPos = DsbPos = DspPos = 0.0;
}
/******************************************************************************/
/******************************************************************************/
+#pragma warn -8030
+
bool FGFCS::LoadFCS(FGConfigFile* AC_cfg)
{
string token;
return true;
}
+#pragma warn .8030
+
/******************************************************************************/
float FGFCS::GetComponentOutput(int idx)
FGMatrix::FGMatrix(const unsigned int r, const unsigned int c) : rows(r), cols(c)
{
data = FGalloc(rows,cols);
+ InitMatrix();
rowCtr = colCtr = 1;
}
}
cout << State->Getsim_time() << ",";
- cout << State->Getqbar() << ",";
- cout << State->GetVt() << ",";
+ cout << Translation->Getqbar() << ",";
+ cout << Translation->GetVt() << ",";
cout << FCS->GetThrottlePos(0) << ",";
cout << FCS->GetDaPos() << ",";
cout << FCS->GetDePos() << ",";
cout << Aircraft->GetXYZcg() << ",";
cout << Aircraft->GetForces() << ",";
cout << Aircraft->GetMoments() << ",";
- cout << State->Geth() << ",";
+ cout << Position->Geth() << ",";
cout << Rotation->GetEuler() << ",";
cout << Rotation->GetPQR() << ",";
cout << Translation->GetUVW() << ",";
cout << Translation->Getalpha() << ",";
cout << Position->GetVel() << ",";
- cout << State->Getlatitude() << ",";
- cout << State->Getlongitude();
+ cout << Position->GetLatitude() << ",";
+ cout << Position->GetLongitude();
cout << endl;
}
}
datafile << State->Getsim_time() << ",";
- datafile << State->Getqbar() << ",";
- datafile << State->GetVt() << ",";
+ datafile << Translation->Getqbar() << ",";
+ datafile << Translation->GetVt() << ",";
datafile << FCS->GetThrottlePos(0) << ",";
datafile << FCS->GetDaPos() << ",";
datafile << FCS->GetDePos() << ",";
datafile << Aircraft->GetXYZcg() << ",";
datafile << Aircraft->GetForces() << ",";
datafile << Aircraft->GetMoments() << ",";
- datafile << State->Geth() << ",";
+ datafile << Position->Geth() << ",";
datafile << Rotation->GetEuler() << ",";
datafile << Rotation->GetPQR() << ",";
datafile << Translation->GetUVW() << ",";
datafile << Translation->Getalpha() << ",";
datafile << Position->GetVel() << ",";
- datafile << State->Getlatitude() << ",";
- datafile << State->Getlongitude();
+ datafile << Position->GetLatitude() << ",";
+ datafile << Position->GetLongitude();
datafile << endl;
datafile.flush();
}
socket->Clear();
socket->Append(State->Getsim_time());
- socket->Append(State->Geth());
+ socket->Append(Position->Geth());
socket->Append(Rotation->Getphi());
socket->Append(Rotation->Gettht());
socket->Append(Rotation->Getpsi());
socket->Append(Atmosphere->GetDensity());
- socket->Append(State->GetVt());
+ socket->Append(Translation->GetVt());
socket->Append(Translation->GetU());
socket->Append(Translation->GetV());
socket->Append(Translation->GetW());
socket->Append(Aircraft->GetFx());
socket->Append(Aircraft->GetFy());
socket->Append(Aircraft->GetFz());
- socket->Append(State->Getlatitude());
- socket->Append(State->Getlongitude());
- socket->Append(State->Getqbar());
+ socket->Append(Position->GetLatitude());
+ socket->Append(Position->GetLongitude());
+ socket->Append(Translation->Getqbar());
socket->Append(Translation->Getalpha());
socket->Append(Aircraft->GetL());
socket->Append(Aircraft->GetM());
Name = "FGPosition";
LongitudeDot = LatitudeDot = RadiusDot = 0.0;
lastLongitudeDot = lastLatitudeDot = lastRadiusDot = 0.0;
+ Longitude = Latitude = 0.0;
+ h = 0.0;
}
/******************************************************************************/
Latitude += 0.5*dt*rate*(LatitudeDot + lastLatitudeDot);
Radius += 0.5*dt*rate*(RadiusDot + lastRadiusDot);
+ h = Radius - EARTHRAD;
+
lastLatitudeDot = LatitudeDot;
lastLongitudeDot = LongitudeDot;
lastRadiusDot = RadiusDot;
- PutState();
return false;
} else {
vUVW = Translation->GetUVW();
- Latitude = State->Getlatitude();
- Longitude = State->Getlongitude();
-
invMass = 1.0 / Aircraft->GetMass();
- invRadius = 1.0 / (State->Geth() + EARTHRAD);
- Radius = State->Geth() + EARTHRAD;
-}
-
-/******************************************************************************/
-
-void FGPosition::PutState(void)
-{
- State->Setlatitude(Latitude);
- State->Setlongitude(Longitude);
- State->Seth(Radius - EARTHRAD);
+ invRadius = 1.0 / (h + EARTHRAD);
+ Radius = h + EARTHRAD;
}
-/******************************************************************************/
-
FGColumnVector vVel;
float Vee, invMass, invRadius;
- double Radius;
+ double Radius, h;
float LatitudeDot, LongitudeDot, RadiusDot;
float lastLatitudeDot, lastLongitudeDot, lastRadiusDot;
float Longitude, Latitude;
float dt;
void GetState(void);
- void PutState(void);
public:
FGPosition(FGFDMExec*);
inline float GetVn(void) {return vVel(1);}
inline float GetVe(void) {return vVel(2);}
inline float GetVd(void) {return vVel(3);}
+ inline float Geth(void) {return h;}
+ inline float GetLatitude(void) {return Latitude;}
+ inline float GetLongitude(void) {return Longitude;}
+ void SetvVel(const FGColumnVector& v) {vVel = v;}
+ void SetLatitude(float tt) {Latitude = tt;}
+ void SetLongitude(float tt) {Longitude = tt;}
+ void Seth(float tt) {h = tt;}
bool Run(void);
};
CLASS DECLARATION
*******************************************************************************/
+#pragma warn -8026
+
class FGRotation : public FGModel
{
FGColumnVector vPQR;
inline float Gettht(void) {return vEuler(2);}
inline float Getpsi(void) {return vEuler(3);}
};
+#pragma warn .8026
/******************************************************************************/
#endif
{
FDMExec = fdex;
- Vt = 0.0;
- latitude = longitude = 0.0;
adot = bdot = 0.0;
- h = 0.0;
a = 1000.0;
- qbar = 0.0;
sim_time = 0.0;
dt = 1.0/120.0;
string resetDef;
float U, V, W;
float phi, tht, psi;
+ float latitude, longitude, h;
resetDef = path + "/" + acname + "/" + fname;
resetfile >> h;
resetfile.close();
+ FDMExec->GetPosition()->SetLatitude(latitude*DEGTORAD);
+ FDMExec->GetPosition()->SetLongitude(longitude*DEGTORAD);
+ FDMExec->GetPosition()->Seth(h);
+
Initialize(U, V, W, phi*DEGTORAD, tht*DEGTORAD, psi*DEGTORAD,
latitude*DEGTORAD, longitude*DEGTORAD, h);
float Latitude, float Longitude, float H)
{
FGColumnVector vUVW(3);
+ FGColumnVector vLocalVelNED(3);
FGColumnVector vEuler(3);
float alpha, beta, gamma;
+ float qbar, Vt;
+
+ FDMExec->GetPosition()->SetLatitude(Latitude*DEGTORAD);
+ FDMExec->GetPosition()->SetLongitude(Longitude*DEGTORAD);
+ FDMExec->GetPosition()->Seth(H);
- latitude = Latitude;
- longitude = Longitude;
- h = H;
FDMExec->GetAtmosphere()->Run();
gamma = 0.0;
vUVW << U << V << W;
FDMExec->GetTranslation()->SetUVW(vUVW);
+
vEuler << phi << tht << psi;
FDMExec->GetRotation()->SetEuler(vEuler);
+
FDMExec->GetTranslation()->SetABG(alpha, beta, gamma);
Vt = sqrt(U*U + V*V + W*W);
+ FDMExec->GetTranslation()->SetVt(Vt);
+
qbar = 0.5*(U*U + V*V + W*W)*FDMExec->GetAtmosphere()->GetDensity();
+ FDMExec->GetTranslation()->Setqbar(qbar);
InitMatrices(phi, tht, psi);
+
+ vLocalVelNED = mTb2l*vUVW;
+ FDMExec->GetPosition()->SetvVel(vLocalVelNED);
}
/******************************************************************************/
{
float tht,psi,phi;
- float U,V,W;
+ float U, V, W, h;
+ float latitude, longitude;
latitude = FGIC->GetLatitudeRadIC();
longitude = FGIC->GetLongitudeRadIC();
datafile << (FDMExec->GetTranslation()->GetUVW())(1);
datafile << (FDMExec->GetTranslation()->GetUVW())(2);
datafile << (FDMExec->GetTranslation()->GetUVW())(3);
- datafile << latitude;
- datafile << longitude;
+ datafile << FDMExec->GetPosition()->GetLatitude();
+ datafile << FDMExec->GetPosition()->GetLongitude();
datafile << (FDMExec->GetRotation()->GetEuler())(1);
datafile << (FDMExec->GetRotation()->GetEuler())(2);
datafile << (FDMExec->GetRotation()->GetEuler())(3);
- datafile << h;
+ datafile << FDMExec->GetPosition()->Geth();
datafile.close();
return true;
} else {
{
switch(val_idx) {
case FG_QBAR:
- return Getqbar();
+ return FDMExec->GetTranslation()->Getqbar();
case FG_WINGAREA:
return FDMExec->GetAircraft()->GetWingArea();
case FG_WINGSPAN:
case FG_FLAPS_CMD:
return FDMExec->GetFCS()->GetDfCmd();
case FG_MACH:
- return GetMach();
+ return FDMExec->GetTranslation()->GetMach();
case FG_ALTITUDE:
- return Geth();
+ return FDMExec->GetPosition()->Geth();
case FG_BI2VEL:
- return FDMExec->GetAircraft()->GetWingSpan()/(2.0 * GetVt());
+ return FDMExec->GetAircraft()->GetWingSpan()/(2.0 * FDMExec->GetTranslation()->GetVt());
case FG_CI2VEL:
- return FDMExec->GetAircraft()->Getcbar()/(2.0 * GetVt());
+ return FDMExec->GetAircraft()->Getcbar()/(2.0 * FDMExec->GetTranslation()->GetVt());
}
return 0;
}
void Initialize(FGInitialCondition *FGIC);
bool StoreData(string);
- inline float GetVt(void) {return Vt;}
-
- inline float Getlatitude(void) {return latitude;}
- inline float Getlongitude(void) {return longitude;}
- inline float GetGeodeticLat(void) {return GeodeticLat;}
-
inline float Getadot(void) {return adot;}
inline float Getbdot(void) {return bdot;}
inline float GetLocalAltitudeOverRunway(void) {return LocalAltitudeOverRunway;}
- inline float Geth(void) {return h;}
inline float Geta(void) {return a;}
- inline float GetMach(void) {return Mach;}
inline float Getsim_time(void) {return sim_time;}
inline float Getdt(void) {return dt;}
- inline float Getqbar(void) {return qbar;}
float GetParameter(int val_idx);
float GetParameter(string val_string);
int GetParameterIndex(string val_string);
- inline void SetVt(float tt) {Vt = tt;}
-
- inline void Setlatitude(float tt) {latitude = tt;}
- inline void Setlongitude(float tt) {longitude = tt;}
- inline void SetGeodeticLat(float tt) {GeodeticLat = tt;}
-
inline void Setadot(float tt) {adot = tt;}
inline void Setbdot(float tt) {bdot = tt;}
- inline void Setqbar(float tt) {qbar = tt;}
-
inline void SetLocalAltitudeOverRunway(float tt) {LocalAltitudeOverRunway = tt;}
- inline void Seth(float tt) {h = tt;}
inline void Seta(float tt) {a = tt;}
- inline void SetMach(float tt) {Mach = tt;}
inline float Setsim_time(float tt) {sim_time = tt; return sim_time;}
inline void Setdt(float tt) {dt = tt;}
private:
- float Vt; // Total velocity
- float latitude, longitude; // position
- float GeodeticLat; // Geodetic Latitude
float adot, bdot; // alpha dot and beta dot
- float h, a; // altitude above sea level, speed of sound
- float qbar; // dynamic pressure
+ float a; // speed of sound
float sim_time, dt;
- float Mach; // Mach number
FGFDMExec* FDMExec;
float LocalAltitudeOverRunway;
vEuler(3)
{
Name = "FGTranslation";
+ qbar = 0;
+ Vt = 0.0;
+ Mach = 0.0;
+ alpha = beta = gamma = 0.0;
+ rho = 0.002378;
}
/******************************************************************************/
qbar = 0.5*rho*Vt*Vt;
- mach = Vt / State->Geta();
+ Mach = Vt / State->Geta();
vlastUVWdot = vUVWdot;
- PutState();
} else {
}
return false;
vEuler = Rotation->GetEuler();
}
-/******************************************************************************/
-
-void FGTranslation::PutState(void)
-{
- State->SetVt(Vt);
- State->Setqbar(qbar);
- State->SetMach(mach);
-}
-
CLASS DECLARATION
*******************************************************************************/
+#pragma warn -8026
+
class FGTranslation : public FGModel
{
public:
inline float Getalpha(void) {return alpha;}
inline float Getbeta (void) {return beta; }
inline float Getgamma(void) {return gamma;}
+ inline float Getqbar (void) {return qbar;}
+ inline float GetVt (void) {return Vt;}
+ inline float GetMach (void) {return Mach;}
void SetUVW(FGColumnVector tt) {vUVW = tt;}
inline void Setalpha(float tt) {alpha = tt;}
inline void Setbeta (float tt) {beta = tt;}
inline void Setgamma(float tt) {gamma = tt;}
+ inline void Setqbar (float tt) {qbar = tt;}
+ inline void SetVt (float tt) {Vt = tt;}
inline void SetABG(float t1, float t2, float t3) {alpha=t1; beta=t2; gamma=t3;}
FGColumnVector vPQR;
FGColumnVector vForces;
FGColumnVector vEuler;
- float Vt, qbar, mach;
+ float Vt, qbar, Mach;
float Mass, dt;
float alpha, beta, gamma;
float rho;
void GetState(void);
- void PutState(void);
};
+#pragma warn .8026
/******************************************************************************/
#endif
FGUtility::~FGUtility()
{
}
-
-
-float FGUtility::ToGeodetic()
-{
- return 0.0;
-}
-
-
-float FGUtility:: FromGeodetic()
-{
- return 0.0;
-}
FGUtility(void);
~FGUtility(void);
- float ToGeodetic(void);
- float FromGeodetic(void);
-
protected:
private:
void FGfdmSocket::Send(void)
{
- int len;
-
buffer += string("\n");
- if ((len = send(sckt,buffer.c_str(),buffer.size(),0)) <= 0) {
+ if ((send(sckt,buffer.c_str(),buffer.size(),0)) <= 0) {
perror("send");
} else {
}