49 #include "FGInitialCondition.h" 50 #include "FGFDMExec.h" 51 #include "models/FGInertial.h" 52 #include "models/FGAtmosphere.h" 53 #include "models/FGAircraft.h" 54 #include "models/FGAccelerations.h" 55 #include "input_output/FGXMLFileRead.h" 61 IDENT(IdSrc,
"$Id: FGInitialCondition.cpp,v 1.114 2017/02/25 14:23:18 bcoconni Exp $");
62 IDENT(IdHdr,ID_INITIALCONDITION);
66 FGInitialCondition::FGInitialCondition(
FGFDMExec *FDMExec) : fdmex(FDMExec)
70 if(FDMExec != NULL ) {
71 Atmosphere=fdmex->GetAtmosphere();
74 cout <<
"FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
90 double p0,
double q0,
double r0,
91 double alpha0,
double beta0,
92 double phi0,
double theta0,
double psi0,
93 double latRad0,
double lonRad0,
double altAGLFt0,
96 double calpha = cos(alpha0), cbeta = cos(beta0);
97 double salpha = sin(alpha0), sbeta = sin(beta0);
102 alpha = alpha0; beta = beta0;
107 lastLatitudeSet = setgeoc;
108 lastAltitudeSet = setagl;
115 lastSpeedSet = setuvw;
117 Tw2b =
FGMatrix33(calpha*cbeta, -calpha*sbeta, -salpha,
119 salpha*cbeta, -salpha*sbeta, calpha);
127 void FGInitialCondition::InitializeIC(
void)
141 vUVW_NED.InitMatrix();
142 vPQR_body.InitMatrix();
147 Tw2b.
InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.);
148 Tb2w.
InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.);
150 lastSpeedSet = setvt;
151 lastAltitudeSet = setasl;
152 lastLatitudeSet = setgeoc;
162 double rho = Atmosphere->
GetDensity(altitudeASL);
165 lastSpeedSet = setve;
175 lastSpeedSet = setmach;
183 double pressure = Atmosphere->
GetPressure(altitudeASL);
184 double pressureSL = Atmosphere->GetPressureSL();
188 double PitotAngle = Aircraft->GetPitotAngle();
190 SetVtrueFpsIC(mach * soundSpeed / (cos(alpha+PitotAngle) * cos(beta)));
191 lastSpeedSet = setvc;
198 void FGInitialCondition::calcAeroAngles(
const FGColumnVector3& _vt_NED)
202 double ua = _vt_BODY(eX);
203 double va = _vt_BODY(eY);
204 double wa = _vt_BODY(eZ);
205 double uwa = sqrt(ua*ua + wa*wa);
206 double calpha, cbeta;
207 double salpha, sbeta;
210 calpha = cbeta = 1.0;
211 salpha = sbeta = 0.0;
214 alpha = atan2( wa, ua );
223 beta = atan2( va, uwa );
235 Tw2b =
FGMatrix33(calpha*cbeta, -calpha*sbeta, -salpha,
237 salpha*cbeta, -salpha*sbeta, calpha);
249 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
254 _vt_NED = vUVW_NED + _vWIND_NED;
257 calcAeroAngles(_vt_NED);
259 lastSpeedSet = setvg;
273 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
276 _vt_NED *= vtrue / vt;
278 _vt_NED = Tb2l * Tw2b * FGColumnVector3(vtrue, 0., 0.);
281 vUVW_NED = _vt_NED - _vWIND_NED;
283 calcAeroAngles(_vt_NED);
285 lastSpeedSet = setvt;
295 if (fabs(hdot) > vt) {
296 cerr <<
"The climb rate cannot be higher than the true speed." << endl;
302 FGColumnVector3 _WIND_NED = _vt_NED - vUVW_NED;
303 double hdot0 = -_vt_NED(eW);
305 if (fabs(hdot0) < vt) {
306 double scale = sqrt((vt*vt-hdot*hdot)/(vt*vt-hdot0*hdot0));
307 _vt_NED(eU) *= scale;
308 _vt_NED(eV) *= scale;
311 vUVW_NED = _vt_NED - _WIND_NED;
314 calcThetaBeta(alpha, _vt_NED);
326 calcThetaBeta(alfa, _vt_NED);
334 void FGInitialCondition::calcThetaBeta(
double alfa,
const FGColumnVector3& _vt_NED)
337 double calpha = cos(alfa), salpha = sin(alfa);
348 -salpha, 0., calpha);
356 if (DotProduct(p, v0) < 0) p *= -1.0;
359 u *= DotProduct(v0, y) / DotProduct(u, y);
369 if (DotProduct(v0, v0) < DotProduct(u, u)) {
370 cerr <<
"Cannot modify angle 'alpha' from " << alpha <<
" to " << alfa << endl;
374 FGColumnVector3 v1 = u + sqrt(DotProduct(v0, v0) - DotProduct(u, u))*p;
380 double sinTheta = (v1xz * v0xz)(eY);
381 vOrient(eTht) = asin(sinTheta);
389 beta = atan2(v2(eV), v2(eU));
390 double cbeta=1.0, sbeta=0.0;
395 Tw2b =
FGMatrix33(calpha*cbeta, -calpha*sbeta, -salpha,
397 salpha*cbeta, -salpha*sbeta, calpha);
411 FGColumnVector3 vOrient = orientation.
GetEuler();
414 double calpha = cos(alpha), salpha = sin(alpha);
415 double cbeta = cos(beta), sbeta = sin(beta);
421 Tw2b =
FGMatrix33(calpha*cbeta, -calpha*sbeta, -salpha,
423 salpha*cbeta, -salpha*sbeta, calpha);
426 FGColumnVector3 vf = TphiInv * Tw2b * FGColumnVector3(vt, 0., 0.);
427 FGColumnVector3 v0xy(_vt_NED(eX), _vt_NED(eY), 0.);
428 FGColumnVector3 v1xy(sqrt(v0xy(eX)*v0xy(eX)+v0xy(eY)*v0xy(eY)-vf(eY)*vf(eY)),vf(eY),0.);
432 if (vf(eX) < 0.) v0xy(eX) *= -1.0;
434 double sinPsi = (v1xy * v0xy)(eZ);
435 double cosPsi = DotProduct(v0xy, v1xy);
436 vOrient(ePsi) = atan2(sinPsi, cosPsi);
441 FGColumnVector3 v2xz = Tpsi * _vt_NED;
442 FGColumnVector3 vfxz = vf;
443 v2xz(eV) = vfxz(eV) = 0.0;
446 double sinTheta = (v2xz * vfxz)(eY);
447 vOrient(eTht) = -asin(sinTheta);
455 void FGInitialCondition::SetEulerAngleRadIC(
int idx,
double angle)
460 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
461 FGColumnVector3 _vUVW_BODY = Tl2b * vUVW_NED;
462 FGColumnVector3 vOrient = orientation.
GetEuler();
464 vOrient(idx) = angle;
467 if ((lastSpeedSet != setned) && (lastSpeedSet != setvg)) {
469 vUVW_NED = newTb2l * _vUVW_BODY;
470 _vt_NED = vUVW_NED + _vWIND_NED;
474 calcAeroAngles(_vt_NED);
482 void FGInitialCondition::SetBodyVelFpsIC(
int idx,
double vel)
487 FGColumnVector3 _vUVW_BODY = Tl2b * vUVW_NED;
488 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
490 _vUVW_BODY(idx) = vel;
491 vUVW_NED = Tb2l * _vUVW_BODY;
492 _vt_NED = vUVW_NED + _vWIND_NED;
495 calcAeroAngles(_vt_NED);
497 lastSpeedSet = setuvw;
505 void FGInitialCondition::SetNEDVelFpsIC(
int idx,
double vel)
509 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
512 _vt_NED = vUVW_NED + _vWIND_NED;
515 calcAeroAngles(_vt_NED);
517 lastSpeedSet = setned;
529 calcAeroAngles(_vt_NED);
541 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
545 _vWIND_NED -= DotProduct(_vWIND_NED, _vCROSS) * _vCROSS;
548 _vWIND_NED += (cross * ktstofps) * _vCROSS;
549 _vt_NED = vUVW_NED + _vWIND_NED;
552 calcAeroAngles(_vt_NED);
564 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
572 _vWIND_NED -= DotProduct(_vWIND_NED, _vHEAD) * _vHEAD;
575 _vWIND_NED += (head * ktstofps) * _vHEAD;
576 _vt_NED = vUVW_NED + _vWIND_NED;
580 calcAeroAngles(_vt_NED);
593 _vt_NED(eW) = vUVW_NED(eW) + wD;
596 calcAeroAngles(_vt_NED);
608 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
609 FGColumnVector3 _vHEAD(_vWIND_NED(eU), _vWIND_NED(eV), 0.);
613 _vHEAD *= (mag*ktstofps) / windMag;
615 _vHEAD = FGColumnVector3((mag*ktstofps), 0., 0.);
617 _vWIND_NED(eU) = _vHEAD(eU);
618 _vWIND_NED(eV) = _vHEAD(eV);
619 _vt_NED = vUVW_NED + _vWIND_NED;
622 calcAeroAngles(_vt_NED);
634 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
635 double mag = _vWIND_NED.
Magnitude(eU, eV);
636 FGColumnVector3 _vHEAD(mag*cos(dir*degtorad), mag*sin(dir*degtorad), 0.);
638 _vWIND_NED(eU) = _vHEAD(eU);
639 _vWIND_NED(eV) = _vHEAD(eV);
640 _vt_NED = vUVW_NED + _vWIND_NED;
643 calcAeroAngles(_vt_NED);
661 if (lastAltitudeSet == setagl)
686 lastAltitudeSet = setagl;
697 double pressure = Atmosphere->
GetPressure(altitudeASL);
698 double pressureSL = Atmosphere->GetPressureSL();
700 double rho = Atmosphere->
GetDensity(altitudeASL);
703 double mach0 = vt / soundSpeed;
705 double ve0 = vt * sqrt(rho/rhoSL);
706 double PitotAngle = Aircraft->GetPitotAngle();
714 if (lastLatitudeSet == setgeod)
721 switch(lastSpeedSet) {
724 pressure, pressureSL, rhoSL);
725 SetVtrueFpsIC(mach0 * soundSpeed / (cos(alpha+PitotAngle) * cos(beta)));
737 lastAltitudeSet = setasl;
744 double h = ComputeGeodAltitude(geodLatitude);
748 lastLatitudeSet = setgeod;
757 lastLatitudeSet = setgeoc;
759 switch(lastAltitudeSet) {
777 switch(lastAltitudeSet) {
797 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
799 return _vWIND_NED(eV) == 0.0 ? 0.0
800 : atan2(_vWIND_NED(eV), _vWIND_NED(eU))*radtodeg;
805 double FGInitialCondition::GetNEDWindFpsIC(
int idx)
const 809 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
811 return _vWIND_NED(idx);
820 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
827 double FGInitialCondition::GetBodyWindFpsIC(
int idx)
const 831 FGColumnVector3 _vUVW_BODY = Tl2b * vUVW_NED;
832 FGColumnVector3 _vWIND_BODY = _vt_BODY - _vUVW_BODY;
834 return _vWIND_BODY(idx);
842 double pressure = Atmosphere->
GetPressure(altitudeASL);
843 double pressureSL = Atmosphere->GetPressureSL();
846 double PitotAngle = Aircraft->GetPitotAngle();
847 double mach = vt * cos(alpha+PitotAngle) * cos(beta) / soundSpeed;
857 double rho = Atmosphere->
GetDensity(altitudeASL);
859 return fpstokts * vt * sqrt(rho/rhoSL);
868 return vt / soundSpeed;
873 double FGInitialCondition::GetBodyVelFpsIC(
int idx)
const 878 return _vUVW_BODY(idx);
885 SGPath init_file_name;
886 if(useStoredPath && rstfile.isRelative()) {
889 init_file_name = rstfile;
893 Element* document = XMLFileRead.LoadXMLDocument(init_file_name);
897 cerr <<
"File: " << init_file_name <<
" could not be read." << endl;
901 if (document->
GetName() != string(
"initialize")) {
902 cerr <<
"File: " << init_file_name <<
" is not a reset file." << endl;
906 double version = HUGE_VAL;
912 if (version == HUGE_VAL) {
913 result = Load_v1(document);
914 }
else if (version >= 3.0) {
915 cerr <<
"Only initialization file formats 1 and 2 are currently supported" << endl;
917 }
else if (version >= 2.0) {
918 result = Load_v2(document);
919 }
else if (version >= 1.0) {
920 result = Load_v1(document);
925 while (running_elements) {
940 double FGInitialCondition::ComputeGeodAltitude(
double geodLatitude)
943 double slat = sin(geodLatitude);
944 double RN = a / sqrt(1.0 - e2*slat*slat);
945 double p1 = e2*RN*slat*slat;
946 double p2 = e2*e2*RN*RN*slat*slat-R*R;
947 return p1 + sqrt(p1*p1-p2) - RN;
952 bool FGInitialCondition::LoadLatitude(
Element* position_el)
959 if (fabs(latitude) > 0.5*M_PI) {
961 if (unit_type.empty()) unit_type=
"RAD";
963 cerr << latitude_el->
ReadFrom() <<
"The latitude value " 965 <<
" is outside the range [";
966 if (unit_type ==
"DEG")
967 cerr <<
"-90 DEG ; +90 DEG]" << endl;
969 cerr <<
"-PI/2 RAD; +PI/2 RAD]" << endl;
976 if (lat_type ==
"geod" || lat_type ==
"geodetic")
980 lastLatitudeSet = setgeoc;
989 bool FGInitialCondition::Load_v1(
Element* document)
1005 result = LoadLatitude(document);
1062 double radInv = 1.0 / position.
GetRadius();
1064 radInv*vUVW_NED(eEast),
1065 -radInv*vUVW_NED(eNorth),
1068 vPQR_body = Tl2b * vOmegaLocal;
1075 bool FGInitialCondition::Load_v2(
Element* document)
1081 if (document->
FindElement(
"earth_position_angle"))
1083 if (document->
FindElement(
"planet_position_angle"))
1086 if (document->
FindElement(
"planet_rotation_rate")) {
1105 frame = to_lower(frame);
1106 if (frame ==
"eci") {
1108 }
else if (frame ==
"ecef") {
1115 }
else if (position_el->
FindElement(
"altitudeAGL")) {
1117 }
else if (position_el->
FindElement(
"altitudeMSL")) {
1120 cerr << endl <<
" No altitude or radius initial condition is given." << endl;
1124 result = LoadLatitude(position_el);
1130 cerr << endl <<
" Neither ECI nor ECEF frame is specified for initial position." << endl;
1134 cerr << endl <<
" Initial position not specified in this initialization file." << endl;
1164 if (orientation_el) {
1166 frame = to_lower(frame);
1168 if (frame ==
"eci") {
1184 orientation = QuatLocal2I * QuatI2Body;
1186 }
else if (frame ==
"ecef") {
1202 orientation = QuatLocal2EC * QuatEC2Body;
1204 }
else if (frame ==
"local") {
1210 cerr << endl <<
fgred <<
" Orientation frame type: \"" << frame
1211 <<
"\" is not supported!" <<
reset << endl << endl;
1233 frame = to_lower(frame);
1236 if (frame ==
"eci") {
1238 vUVW_NED = mTec2l * (vInitVelocity - omega_cross_r);
1239 lastSpeedSet = setned;
1240 }
else if (frame ==
"ecef") {
1241 vUVW_NED = mTec2l * vInitVelocity;
1242 lastSpeedSet = setned;
1243 }
else if (frame ==
"local") {
1244 vUVW_NED = vInitVelocity;
1245 lastSpeedSet = setned;
1246 }
else if (frame ==
"body") {
1247 vUVW_NED = Tb2l * vInitVelocity;
1248 lastSpeedSet = setuvw;
1251 cerr << endl <<
fgred <<
" Velocity frame type: \"" << frame
1252 <<
"\" is not supported!" <<
reset << endl << endl;
1259 vUVW_NED = Tb2l * vInitVelocity;
1265 calcAeroAngles(vUVW_NED);
1278 double radInv = 1.0 / position.
GetRadius();
1280 radInv*vUVW_NED(eEast),
1281 -radInv*vUVW_NED(eNorth),
1287 frame = to_lower(frame);
1290 if (frame ==
"eci") {
1291 vPQR_body = Tl2b * position.
GetTi2l() * (vAttRate - vOmegaEarth);
1292 }
else if (frame ==
"ecef") {
1293 vPQR_body = Tl2b * position.
GetTec2l() * vAttRate;
1294 }
else if (frame ==
"local") {
1295 vPQR_body = Tl2b * (vAttRate + vOmegaLocal);
1296 }
else if (frame ==
"body") {
1297 vPQR_body = vAttRate;
1298 }
else if (!frame.empty()) {
1300 cerr << endl <<
fgred <<
" Attitude rate frame type: \"" << frame
1301 <<
"\" is not supported!" <<
reset << endl << endl;
1304 }
else if (frame.empty()) {
1305 vPQR_body = Tl2b * vOmegaLocal;
1309 vPQR_body = Tl2b * vOmegaLocal;
1319 PropertyManager->
Tie(
"ic/vc-kts",
this,
1323 PropertyManager->
Tie(
"ic/ve-kts",
this,
1327 PropertyManager->
Tie(
"ic/vg-kts",
this,
1331 PropertyManager->
Tie(
"ic/vt-kts",
this,
1335 PropertyManager->
Tie(
"ic/mach",
this,
1339 PropertyManager->
Tie(
"ic/roc-fpm",
this,
1343 PropertyManager->
Tie(
"ic/gamma-deg",
this,
1347 PropertyManager->
Tie(
"ic/alpha-deg",
this,
1351 PropertyManager->
Tie(
"ic/beta-deg",
this,
1355 PropertyManager->
Tie(
"ic/theta-deg",
this,
1359 PropertyManager->
Tie(
"ic/phi-deg",
this,
1363 PropertyManager->
Tie(
"ic/psi-true-deg",
this,
1367 PropertyManager->
Tie(
"ic/lat-gc-deg",
this,
1371 PropertyManager->
Tie(
"ic/long-gc-deg",
this,
1375 PropertyManager->
Tie(
"ic/h-sl-ft",
this,
1379 PropertyManager->
Tie(
"ic/h-agl-ft",
this,
1383 PropertyManager->
Tie(
"ic/terrain-elevation-ft",
this,
1387 PropertyManager->
Tie(
"ic/vg-fps",
this,
1391 PropertyManager->
Tie(
"ic/vt-fps",
this,
1395 PropertyManager->
Tie(
"ic/vw-bx-fps",
this,
1397 PropertyManager->
Tie(
"ic/vw-by-fps",
this,
1399 PropertyManager->
Tie(
"ic/vw-bz-fps",
this,
1401 PropertyManager->
Tie(
"ic/vw-north-fps",
this,
1403 PropertyManager->
Tie(
"ic/vw-east-fps",
this,
1405 PropertyManager->
Tie(
"ic/vw-down-fps",
this,
1407 PropertyManager->
Tie(
"ic/vw-mag-fps",
this,
1409 PropertyManager->
Tie(
"ic/vw-dir-deg",
this,
1414 PropertyManager->
Tie(
"ic/roc-fps",
this,
1418 PropertyManager->
Tie(
"ic/u-fps",
this,
1422 PropertyManager->
Tie(
"ic/v-fps",
this,
1426 PropertyManager->
Tie(
"ic/w-fps",
this,
1430 PropertyManager->
Tie(
"ic/vn-fps",
this,
1434 PropertyManager->
Tie(
"ic/ve-fps",
this,
1438 PropertyManager->
Tie(
"ic/vd-fps",
this,
1442 PropertyManager->
Tie(
"ic/gamma-rad",
this,
1446 PropertyManager->
Tie(
"ic/alpha-rad",
this,
1450 PropertyManager->
Tie(
"ic/theta-rad",
this,
1454 PropertyManager->
Tie(
"ic/beta-rad",
this,
1458 PropertyManager->
Tie(
"ic/phi-rad",
this,
1462 PropertyManager->
Tie(
"ic/psi-true-rad",
this,
1466 PropertyManager->
Tie(
"ic/lat-gc-rad",
this,
1470 PropertyManager->
Tie(
"ic/long-gc-rad",
this,
1474 PropertyManager->
Tie(
"ic/p-rad_sec",
this,
1478 PropertyManager->
Tie(
"ic/q-rad_sec",
this,
1482 PropertyManager->
Tie(
"ic/r-rad_sec",
this,
1486 PropertyManager->
Tie(
"ic/lat-geod-rad",
this,
1490 PropertyManager->
Tie(
"ic/lat-geod-deg",
this,
1494 PropertyManager->
Tie(
"ic/geod-alt-ft", &position,
1517 void FGInitialCondition::Debug(
int from)
1519 if (debug_lvl <= 0)
return;
1521 if (debug_lvl & 1) {
1523 if (debug_lvl & 2 ) {
1524 if (from == 0) cout <<
"Instantiated: FGInitialCondition" << endl;
1525 if (from == 1) cout <<
"Destroyed: FGInitialCondition" << endl;
1527 if (debug_lvl & 4 ) {
1529 if (debug_lvl & 8 ) {
1531 if (debug_lvl & 16) {
1533 if (debug_lvl & 64) {
1535 cout << IdSrc << endl;
1536 cout << IdHdr << endl;
double GetAlphaDegIC(void) const
Gets the initial angle of attack.
double GetLatitudeRadIC(void) const
Gets the initial latitude.
void SetThetaDegIC(double theta)
Sets pitch angle initial condition in degrees.
FGAccelerations * GetAccelerations(void)
Returns the FGAccelerations pointer.
void SetThetaRadIC(double theta)
Sets the initial pitch angle.
void SetVEastFpsIC(double ve)
Sets the initial local axis east velocity.
double GetThetaDegIC(void) const
Gets the initial pitch angle.
Models the Quaternion representation of rotations.
double GetGeodLatitudeRadIC(void) const
Gets the initial geodetic latitude.
double GetVgroundFpsIC(void) const
Gets the initial ground velocity.
double GetBetaRadIC(void) const
Gets the initial angle of sideslip.
double GetVtrueFpsIC(void) const
Gets the initial true velocity.
FGInertial * GetInertial(void)
Returns the FGInertial pointer.
double GetFlightPathAngleRadIC(void) const
Gets the initial flight path angle.
double GetVDownFpsIC(void) const
Gets the initial local frame Z (Down) velocity.
void SetVtrueFpsIC(double vt)
Sets the initial true airspeed.
const FGMatrix33 & GetT(void) const
Transformation matrix.
void SetLongitude(double longitude)
Set the longitude.
void SetLatitudeRadIC(double lat)
Sets the initial latitude.
double GetLongitudeDegIC(void) const
Gets the initial longitude.
double GetSeaLevelRadius(void) const
Get the local sea level radius.
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
double GetVtrueKtsIC(void) const
Gets the initial true velocity.
void SetVNorthFpsIC(double vn)
Sets the initial local axis north velocity.
double GetBetaDegIC(void) const
Gets the initial sideslip angle.
void SetLatitude(double latitude)
Set the latitude.
double GetRRadpsIC() const
Gets the initial body axis yaw rate.
double GetSinEuler(int i) const
Retrieves sine of the given euler angle.
void SetSeaLevelRadiusFtIC(double slr)
Sets the initial sea level radius from planet center.
double GetAltitudeASL(void) const
Get the altitude above sea level.
~FGInitialCondition()
Destructor.
double GetTerrainElevationFtIC(void) const
Gets the initial terrain elevation.
void SetAltitudeAGL(double altitudeAGL)
Set the altitude above ground level.
double GetVequivalentKtsIC(void) const
Gets the initial equivalent airspeed.
void SetRadius(double radius)
Set the distance from the center of the earth.
double GetGeodAltitude(void) const
Gets the geodetic altitude in feet.
double GetAltitudeAGLFtIC(void) const
Gets the initial altitude above ground level.
void SetPhiRadIC(double phi)
Sets the initial roll angle.
bool HasAttribute(const std::string &key)
Determines if an element has the supplied attribute.
void SetBetaDegIC(double b)
Sets angle of sideslip initial condition in degrees.
double GetPhiRadIC(void) const
Gets the initial roll angle.
double FindElementValueAsNumberConvertTo(const std::string &el, const std::string &target_units)
Searches for the named element and converts and returns the data belonging to it. ...
const SGPath & GetFullAircraftPath(void)
Retrieves the full aircraft path name.
double GetUBodyFpsIC(void) const
Gets the initial body axis X velocity.
double GetVgroundKtsIC(void) const
Gets the initial ground speed.
void SetClimbRateFpsIC(double roc)
Sets the initial climb rate.
const FGMatrix33 & GetTInv(void) const
Backward transformation matrix.
static char reset[5]
resets text properties
void SetClimbRateFpmIC(double roc)
Sets the climb rate initial condition in feet/minute.
void SetWindDownKtsIC(double wD)
Sets the initial wind downward speed.
virtual void SetSeaLevelRadius(double radius)
Set the sea level radius.
double GetQRadpsIC() const
Gets the initial body axis pitch rate.
double GetVBodyFpsIC(void) const
Gets the initial body axis Y velocity.
void SetQRadpsIC(double Q)
Sets the initial body axis pitch rate.
FGColumnVector3 & Normalize(void)
Normalize.
virtual double GetPressure(void) const
Returns the pressure in psf.
Element * FindElement(const std::string &el="")
Searches for a specified element.
double FindElementValueAsNumber(const std::string &el="")
Searches for the named element and returns the data belonging to it as a number.
void SetFlightPathAngleDegIC(double gamma)
Sets the flight path angle initial condition in degrees.
void ResetIC(double u0, double v0, double w0, double p0, double q0, double r0, double alpha0, double beta0, double phi0, double theta0, double psi0, double latitudeRad0, double longitudeRad0, double altitudeAGL0, double gamma0)
Resets the IC data structure to new values.
void SetUBodyFpsIC(double ubody)
Sets the initial body axis X velocity.
void SetWindDirDegIC(double dir)
Sets the initial wind direction.
void SetVequivalentKtsIC(double ve)
Set equivalent airspeed initial condition in knots.
void SetGeodLatitudeRadIC(double glat)
Sets the initial geodetic latitude.
void SetWindNEDFpsIC(double wN, double wE, double wD)
Sets the initial wind velocity.
double GetLongitudeRadIC(void) const
Gets the initial longitude.
void SetPositionGeodetic(double lon, double lat, double height)
Sets the longitude, latitude and the distance above the reference ellipsoid.
void SetTerrainElevationFtIC(double elev)
Sets the initial terrain elevation.
void SetEarthPositionAngle(double EPA)
Sets the Earth position angle.
void SetFlightPathAngleRadIC(double gamma)
Sets the initial flight path angle.
void SetGeodLatitudeDegIC(double glat)
Sets the initial geodetic latitude.
double GetWindNFpsIC(void) const
Gets the initial wind velocity in local frame.
double GetPRadpsIC() const
Gets the initial body axis roll rate.
double GetRadius() const
Get the distance from the center of the earth.
void SetEllipse(double semimajor, double semiminor)
Sets the semimajor and semiminor axis lengths for this planet.
static char fgred[6]
red text
void SetWindMagKtsIC(double mag)
Sets the initial total wind speed.
double GetVcalibratedKtsIC(void) const
Gets the initial calibrated airspeed.
static double VcalibratedFromMach(double mach, double p, double psl, double rhosl)
Calculate the calibrated airspeed from the Mach number.
const FGMatrix33 & GetTi2ec(void) const
Transform matrix from inertial to earth centered frame.
void SetHeadWindKtsIC(double head)
Sets the initial headwind velocity.
double GetLongitude() const
Get the longitude.
void Tie(const std::string &name, bool *pointer, bool useDefault=true)
Tie a property to an external bool variable.
void SetRRadpsIC(double R)
Sets the initial body axis yaw rate.
static double MachFromVcalibrated(double vcas, double p, double psl, double rhosl)
Calculate the Mach number from the calibrated airspeed.
void SetAltitudeASL(double altitudeASL)
Set the altitude above sea level.
double GetWindDirDegIC(void) const
Gets the initial wind direction.
void SetVgroundFpsIC(double vg)
Sets the initial ground speed.
void SetLatitudeDegIC(double lat)
Sets the initial latitude.
double GetFlightPathAngleDegIC(void) const
Gets the initial flight path angle.
double GetTanLatitude() const
Get the cosine of Latitude.
double GetGeodLatitudeDegIC(void) const
Gets the initial geodetic latitude.
double GetDataAsNumber(void)
Converts the element data to a number.
virtual double GetDensitySL(void) const
Returns the sea level density in slugs/ft^3.
void SetVBodyFpsIC(double vbody)
Sets the initial body axis Y velocity.
double GetPsiDegIC(void) const
Gets the initial heading angle.
void SetVgroundKtsIC(double vg)
Set ground speed initial condition in knots.
void SetTargetNlfIC(double nlf)
Sets the target normal load factor.
FGAircraft * GetAircraft(void)
Returns the FGAircraft pointer.
double GetAttributeValueAsNumber(const std::string &key)
Retrieves an attribute value as a double precision real number.
virtual double GetSoundSpeed(void) const
Returns the speed of sound in ft/sec.
const std::string & GetName(void) const
Retrieves the element name.
double GetWindEFpsIC(void) const
Gets the initial wind velocity in local frame.
double GetPsiRadIC(void) const
Gets the initial heading angle.
void SetVcalibratedKtsIC(double vc)
Set calibrated airspeed initial condition in knots.
void SetVtrueKtsIC(double vtrue)
Set true airspeed initial condition in knots.
double GetVEastFpsIC(void) const
Gets the initial local frame Y (East) velocity.
double GetWindUFpsIC(void) const
Gets the initial body axis X wind velocity.
void SetLongitudeDegIC(double lon)
Sets the initial longitude.
double GetTerrainRadius(void) const
Get the local terrain radius.
bool Load(const SGPath &rstname, bool useStoredPath=true)
Loads the initial conditions.
double GetPhiDegIC(void) const
Gets the initial roll angle.
const FGMatrix33 & GetTl2i(void) const
Transform matrix from local horizontal to inertial frame.
FGGroundCallback * GetGroundCallback(void)
Get a pointer to the ground callback currently used.
void SetAltitudeAGLFtIC(double agl)
Sets the initial Altitude above ground level.
void SetPhiDegIC(double phi)
Sets the roll angle initial condition in degrees.
This class implements a 3 element column vector.
void SetAlphaDegIC(double a)
Sets angle of attack initial condition in degrees.
virtual double GetDensity(void) const
Returns the density in slugs/ft^3.
void SetVDownFpsIC(double vd)
Sets the initial local axis down velocity.
void SetCrossWindKtsIC(double cross)
Sets the initial crosswind speed.
double GetGeodLatitudeRad(void) const
Get the geodetic latitude.
double GetWindDFpsIC(void) const
Gets the initial wind velocity in local frame.
std::string ReadFrom(void) const
Return a string that contains a description of the location where the current XML element was read fr...
void SetAlphaRadIC(double alpha)
Sets the initial angle of attack.
const FGMatrix33 & GetTec2l(void) const
Transform matrix from the earth centered to local horizontal frame.
void SetPsiDegIC(double psi)
Sets the heading angle initial condition in degrees.
double GetVNorthFpsIC(void) const
Gets the initial local frame X (North) velocity.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
double GetAlphaRadIC(void) const
Gets the initial angle of attack.
double GetLatitudeDegIC(void) const
Gets the initial latitude.
double GetCosEuler(int i) const
Retrieves cosine of the given euler angle.
Handles matrix math operations.
FGMatrix33 Transposed(void) const
Transposed matrix.
double GetWindVFpsIC(void) const
Gets the initial body axis Y wind velocity.
double Magnitude(void) const
Length of the vector.
void InitMatrix(void)
Initialize the matrix.
void Normalize(void)
Normalize.
const FGColumnVector3 & GetEuler(void) const
Retrieves the Euler angles.
double GetWindWFpsIC(void) const
Gets the initial body axis Z wind velocity.
double GetMachIC(void) const
Gets the initial mach.
void SetPRadpsIC(double P)
Sets the initial body axis roll rate.
void SetWBodyFpsIC(double wbody)
Sets the initial body axis Z velocity.
void SetLongitudeRadIC(double lon)
Sets the initial longitude.
double GetClimbRateFpmIC(void) const
Gets the initial climb rate.
const FGMatrix33 & GetTec2i(void) const
Transform matrix from the earth centered to inertial frame.
double GetThetaRadIC(void) const
Gets the initial pitch angle.
const FGMatrix33 & GetTl2ec(void) const
Transform matrix from local horizontal to earth centered frame.
double GetWBodyFpsIC(void) const
Gets the initial body axis Z velocity.
Encapsulates the JSBSim simulation executive.
const FGMatrix33 & GetTi2l(void) const
Transform matrix from the inertial to local horizontal frame.
void SetBetaRadIC(double beta)
Sets the initial sideslip angle.
double GetWindFpsIC(void) const
Gets the initial total wind velocity in feet/sec.
void SetMachIC(double mach)
Set mach initial condition.
void SetAltitudeASLFtIC(double altitudeASL)
Sets the altitude above sea level initial condition in feet.
void SetPsiRadIC(double psi)
Sets the initial heading angle.
FGColumnVector3 FindElementTripletConvertTo(const std::string &target_units)
Composes a 3-element column vector for the supplied location or orientation.
double GetAltitudeASLFtIC(void) const
Gets the initial altitude above sea level.
double GetClimbRateFpsIC(void) const
Gets the initial climb rate.
FGPropagate * GetPropagate(void)
Returns the FGPropagate pointer.
double GetAltitudeAGL(void) const
Get the altitude above ground level.
virtual void SetTerrainGeoCentRadius(double radius)
Set the local terrain radius.