65 Atmosphere=fdmex->GetAtmosphere();
66 Aircraft=fdmex->GetAircraft();
68 cout <<
"FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
84 double p0,
double q0,
double r0,
85 double alpha0,
double beta0,
86 double phi0,
double theta0,
double psi0,
87 double latRad0,
double lonRad0,
double altAGLFt0,
90 double calpha = cos(alpha0), cbeta = cos(beta0);
91 double salpha = sin(alpha0), sbeta = sin(beta0);
95 vPQR_body = {p0, q0, r0};
96 alpha = alpha0; beta = beta0;
98 position.SetLongitude(lonRad0);
99 position.SetLatitude(latRad0);
100 fdmex->GetInertial()->SetAltitudeAGL(position, altAGLFt0);
105 const FGMatrix33& Tb2l = orientation.GetTInv();
108 vt = vUVW_NED.Magnitude();
111 Tw2b = { calpha*cbeta, -calpha*sbeta, -salpha,
113 salpha*cbeta, -salpha*sbeta, calpha };
114 Tb2w = Tw2b.Transposed();
126 double a = fdmex->GetInertial()->GetSemimajor();
127 double b = fdmex->GetInertial()->GetSemiminor();
129 position.SetEllipse(a, b);
131 position.SetPositionGeodetic(0.0, 0.0, 0.0);
134 vUVW_NED.InitMatrix();
135 vPQR_body.InitMatrix();
140 Tw2b = { 1., 0., 0., 0., 1., 0., 0., 0., 1. };
141 Tb2w = { 1., 0., 0., 0., 1., 0., 0., 0., 1. };
143 lastSpeedSet =
setvt;
155 double rho = Atmosphere->GetDensity(altitudeASL);
156 double rhoSL = Atmosphere->GetDensitySL();
158 lastSpeedSet =
setve;
166 double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
176 double pressure = Atmosphere->GetPressure(altitudeASL);
178 double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
181 lastSpeedSet =
setvc;
192 double ua = _vt_BODY(
eX);
193 double va = _vt_BODY(
eY);
194 double wa = _vt_BODY(
eZ);
195 double uwa = sqrt(ua*ua + wa*wa);
196 double calpha, cbeta;
197 double salpha, sbeta;
200 calpha = cbeta = 1.0;
201 salpha = sbeta = 0.0;
204 alpha = atan2( wa, ua );
213 beta = atan2( va, uwa );
225 Tw2b = { calpha*cbeta, -calpha*sbeta, -salpha,
227 salpha*cbeta, -salpha*sbeta, calpha };
228 Tb2w = Tw2b.Transposed();
237 const FGMatrix33& Tb2l = orientation.GetTInv();
241 vUVW_NED(
eU) = vg * orientation.GetCosEuler(
ePsi);
242 vUVW_NED(
eV) = vg * orientation.GetSinEuler(
ePsi);
244 _vt_NED = vUVW_NED + _vWIND_NED;
247 calcAeroAngles(_vt_NED);
249 lastSpeedSet =
setvg;
261 const FGMatrix33& Tb2l = orientation.GetTInv();
266 _vt_NED *= vtrue / vt;
271 vUVW_NED = _vt_NED - _vWIND_NED;
273 calcAeroAngles(_vt_NED);
275 lastSpeedSet =
setvt;
285 if (fabs(hdot) > vt) {
286 cerr <<
"The climb rate cannot be higher than the true speed." << endl;
290 const FGMatrix33& Tb2l = orientation.GetTInv();
293 double hdot0 = -_vt_NED(
eW);
295 if (fabs(hdot0) < vt) {
296 double scale = sqrt((vt*vt-hdot*hdot)/(vt*vt-hdot0*hdot0));
301 vUVW_NED = _vt_NED - _WIND_NED;
304 calcThetaBeta(alpha, _vt_NED);
314 const FGMatrix33& Tb2l = orientation.GetTInv();
316 calcThetaBeta(alfa, _vt_NED);
324void FGInitialCondition::calcThetaBeta(
double alfa,
const FGColumnVector3& _vt_NED)
327 double calpha = cos(alfa), salpha = sin(alfa);
338 -salpha, 0., calpha);
344 FGColumnVector3
p = y * n;
360 cerr <<
"Cannot modify angle 'alpha' from " << alpha <<
" to " << alfa << endl;
366 FGColumnVector3 v0xz(v0(
eU), 0., v0(
eW));
367 FGColumnVector3 v1xz(v1(
eU), 0., v1(
eW));
370 double sinTheta = (v1xz * v0xz)(
eY);
371 vOrient(
eTht) = asin(sinTheta);
373 orientation = FGQuaternion(vOrient);
375 const FGMatrix33& Tl2b = orientation.GetT();
376 FGColumnVector3 v2 = Talpha * Tl2b * _vt_NED;
379 beta = atan2(v2(
eV), v2(
eU));
380 double cbeta=1.0, sbeta=0.0;
385 Tw2b = { calpha*cbeta, -calpha*sbeta, -salpha,
387 salpha*cbeta, -salpha*sbeta, calpha };
388 Tb2w = Tw2b.Transposed();
399 const FGMatrix33& Tb2l = orientation.GetTInv();
404 double calpha = cos(alpha), salpha = sin(alpha);
405 double cbeta = cos(beta), sbeta = sin(beta);
406 double cphi = orientation.GetCosEuler(
ePhi), sphi = orientation.GetSinEuler(
ePhi);
411 Tw2b = { calpha*cbeta, -calpha*sbeta, -salpha,
413 salpha*cbeta, -salpha*sbeta, calpha };
414 Tb2w = Tw2b.Transposed();
422 if (vf(
eX) < 0.) v0xy(
eX) *= -1.0;
424 double sinPsi = (v1xy * v0xy)(
eZ);
426 vOrient(
ePsi) = atan2(sinPsi, cosPsi);
433 v2xz(
eV) = vfxz(
eV) = 0.0;
436 double sinTheta = (v2xz * vfxz)(
eY);
437 vOrient(
eTht) = -asin(sinTheta);
445void FGInitialCondition::SetEulerAngleRadIC(
int idx,
double angle)
454 vOrient(idx) = angle;
457 if ((lastSpeedSet !=
setned) && (lastSpeedSet !=
setvg)) {
459 vUVW_NED = newTb2l * _vUVW_BODY;
460 _vt_NED = vUVW_NED + _vWIND_NED;
464 calcAeroAngles(_vt_NED);
472void FGInitialCondition::SetBodyVelFpsIC(
int idx,
double vel)
474 const FGMatrix33& Tb2l = orientation.GetTInv();
475 const FGMatrix33& Tl2b = orientation.GetT();
476 FGColumnVector3 _vt_NED = Tb2l * Tw2b * FGColumnVector3(vt, 0., 0.);
477 FGColumnVector3 _vUVW_BODY = Tl2b * vUVW_NED;
478 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
480 _vUVW_BODY(idx) = vel;
481 vUVW_NED = Tb2l * _vUVW_BODY;
482 _vt_NED = vUVW_NED + _vWIND_NED;
485 calcAeroAngles(_vt_NED);
495void FGInitialCondition::SetNEDVelFpsIC(
int idx,
double vel)
497 const FGMatrix33& Tb2l = orientation.GetTInv();
498 FGColumnVector3 _vt_NED = Tb2l * Tw2b * FGColumnVector3(vt, 0., 0.);
499 FGColumnVector3 _vWIND_NED = _vt_NED - vUVW_NED;
502 _vt_NED = vUVW_NED + _vWIND_NED;
503 vt = _vt_NED.Magnitude();
505 calcAeroAngles(_vt_NED);
519 calcAeroAngles(_vt_NED);
529 const FGMatrix33& Tb2l = orientation.GetTInv();
535 _vWIND_NED -=
DotProduct(_vWIND_NED, _vCROSS) * _vCROSS;
538 _vWIND_NED += (cross *
ktstofps) * _vCROSS;
539 _vt_NED = vUVW_NED + _vWIND_NED;
542 calcAeroAngles(_vt_NED);
552 const FGMatrix33& Tb2l = orientation.GetTInv();
562 _vWIND_NED -=
DotProduct(_vWIND_NED, _vHEAD) * _vHEAD;
565 _vWIND_NED += (head *
ktstofps) * _vHEAD;
566 _vt_NED = vUVW_NED + _vWIND_NED;
570 calcAeroAngles(_vt_NED);
580 const FGMatrix33& Tb2l = orientation.GetTInv();
583 _vt_NED(
eW) = vUVW_NED(
eW) + wD;
586 calcAeroAngles(_vt_NED);
596 const FGMatrix33& Tb2l = orientation.GetTInv();
607 _vWIND_NED(
eU) = _vHEAD(
eU);
608 _vWIND_NED(
eV) = _vHEAD(
eV);
609 _vt_NED = vUVW_NED + _vWIND_NED;
612 calcAeroAngles(_vt_NED);
622 const FGMatrix33& Tb2l = orientation.GetTInv();
628 _vWIND_NED(
eU) = _vHEAD(
eU);
629 _vWIND_NED(
eV) = _vHEAD(
eV);
630 _vt_NED = vUVW_NED + _vWIND_NED;
633 calcAeroAngles(_vt_NED);
641 fdmex->GetInertial()->SetTerrainElevation(elev);
643 if (lastAltitudeSet ==
setagl)
651 return position.GetRadius() - position.GetSeaLevelRadius();
658 return fdmex->GetInertial()->GetAltitudeAGL(position);
667 double a = fdmex->GetInertial()->GetSemimajor();
668 double b = fdmex->GetInertial()->GetSemiminor();
670 fdmex->GetInertial()->GetContactPoint(position, contact, normal, v, w);
679 double pressure = Atmosphere->GetPressure(altitudeASL);
680 double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
681 double rho = Atmosphere->GetDensity(altitudeASL);
682 double rhoSL = Atmosphere->GetDensitySL();
684 double mach0 = vt / soundSpeed;
686 double ve0 = vt * sqrt(rho/rhoSL);
688 switch(lastLatitudeSet) {
690 fdmex->GetInertial()->SetAltitudeAGL(position, agl);
694 double a = fdmex->GetInertial()->GetSemimajor();
695 double b = fdmex->GetInertial()->GetSemiminor();
696 double e2 = 1.0-b*b/(a*a);
697 double tanlat = tan(position.GetLatitude());
701 double longitude = position.GetLongitude();
702 double alt = position.GetGeodAltitude();
703 double h = -2.0*max(a,b);
705 while ((fabs(n-prev_n) > 1E-15 || fabs(h-agl) > 1E-10) && iter < 10) {
706 geodLat = atan(tanlat/(1-n));
707 position.SetPositionGeodetic(
longitude, geodLat, alt);
710 double sinGeodLat = sin(geodLat);
711 double N = a/sqrt(1-e2*sinGeodLat*sinGeodLat);
721 soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
722 rho = Atmosphere->GetDensity(altitudeASL);
723 pressure = Atmosphere->GetPressure(altitudeASL);
725 switch(lastSpeedSet) {
751 double pressure = Atmosphere->GetPressure(altitudeASL);
752 double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
753 double rho = Atmosphere->GetDensity(altitudeASL);
754 double rhoSL = Atmosphere->GetDensitySL();
756 double mach0 = vt / soundSpeed;
758 double ve0 = vt * sqrt(rho/rhoSL);
760 switch(lastLatitudeSet) {
765 double a = fdmex->GetInertial()->GetSemimajor();
766 double b = fdmex->GetInertial()->GetSemiminor();
767 double e2 = 1.0-b*b/(a*a);
768 double geodLatitude = position.GetGeodLatitudeRad();
769 double cosGeodLat = cos(geodLatitude);
770 double sinGeodLat = sin(geodLatitude);
771 double N = a/sqrt(1-e2*sinGeodLat*sinGeodLat);
772 double geodAlt = 0.0;
778 if (cosGeodLat > fabs(sinGeodLat)) {
779 double tanGeodLat = sinGeodLat/cosGeodLat;
780 double x0 =
N*e2*cosGeodLat;
782 while (fabs(n-prev_n) > 1E-15 && iter < 10) {
783 double tanLat = (1-n)*tanGeodLat;
784 double cos2Lat = 1./(1.+tanLat*tanLat);
785 double slr = b/sqrt(1.-e2*cos2Lat);
786 double R = slr + alt;
792 geodAlt = x/cosGeodLat-
N;
795 double cotanGeodLat = cosGeodLat/sinGeodLat;
796 double z0 =
N*e2*sinGeodLat;
798 while (fabs(n-prev_n) > 1E-15 && iter < 10) {
799 double cotanLat = cotanGeodLat/(1-n);
800 double sin2Lat = 1./(1.+cotanLat*cotanLat);
801 double cos2Lat = 1.-sin2Lat;
802 double slr = b/sqrt(1.-e2*cos2Lat);
803 double R = slr + alt;
804 z =
R*
sign(cotanLat)*sqrt(sin2Lat);
809 geodAlt = z/sinGeodLat-
N*(1-e2);
812 double longitude = position.GetLongitude();
813 position.SetPositionGeodetic(
longitude, geodLatitude, geodAlt);
818 double slr = position.GetSeaLevelRadius();
819 position.SetRadius(slr+alt);
824 altitudeASL = position.GetGeodAltitude();
825 soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
826 rho = Atmosphere->GetDensity(altitudeASL);
827 pressure = Atmosphere->GetPressure(altitudeASL);
829 switch(lastSpeedSet) {
851 double lon = position.GetLongitude();
854 switch (lastAltitudeSet)
859 position.SetPositionGeodetic(lon, geodLatitude, 0.);
860 fdmex->GetInertial()->SetAltitudeAGL(position, agl);
866 position.SetPositionGeodetic(lon, geodLatitude, 0.);
881 switch(lastAltitudeSet) {
884 position.SetLatitude(lat);
889 position.SetLatitude(lat);
901 switch(lastAltitudeSet) {
904 position.SetLongitude(lon);
908 position.SetLongitude(lon);
917 const FGMatrix33& Tb2l = orientation.GetTInv();
921 return _vWIND_NED(
eV) == 0.0 ? 0.0
927double FGInitialCondition::GetNEDWindFpsIC(
int idx)
const
933 return _vWIND_NED(idx);
940 const FGMatrix33& Tb2l = orientation.GetTInv();
949double FGInitialCondition::GetBodyWindFpsIC(
int idx)
const
956 return _vWIND_BODY(idx);
964 double pressure = Atmosphere->GetPressure(altitudeASL);
965 double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
966 double mach = vt / soundSpeed;
976 double rho = Atmosphere->GetDensity(altitudeASL);
977 double rhoSL = Atmosphere->GetDensitySL();
978 return fpstokts * vt * sqrt(rho/rhoSL);
986 double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
987 return vt / soundSpeed;
992double FGInitialCondition::GetBodyVelFpsIC(
int idx)
const
997 return _vUVW_BODY(idx);
1004 SGPath init_file_name;
1005 if(useStoredPath && rstfile.isRelative()) {
1006 init_file_name = fdmex->GetFullAircraftPath()/rstfile.utf8Str();
1008 init_file_name = rstfile;
1017 s <<
"File: " << init_file_name <<
" could not be read.";
1018 cerr << s.str() << endl;
1022 if (document->
GetName() !=
string(
"initialize")) {
1024 s <<
"File: " << init_file_name <<
" is not a reset file.";
1025 cerr << s.str() << endl;
1029 double version = HUGE_VAL;
1030 bool result =
false;
1035 if (version == HUGE_VAL) {
1036 result = Load_v1(document);
1037 }
else if (version >= 3.0) {
1038 const string s(
"Only initialization file formats 1 and 2 are currently supported");
1039 cerr << document->
ReadFrom() << endl << s << endl;
1041 }
else if (version >= 2.0) {
1042 result = Load_v2(document);
1043 }
else if (version >= 1.0) {
1044 result = Load_v1(document);
1049 while (running_elements) {
1051 enginesRunning |= engineNumber == -1 ? engineNumber : 1 << engineNumber;
1060bool FGInitialCondition::LoadLatitude(
Element* position_el)
1069 if (unit_type.empty()) unit_type=
"RAD";
1071 cerr << latitude_el->
ReadFrom() <<
"The latitude value "
1073 <<
" is outside the range [";
1074 if (unit_type ==
"DEG")
1075 cerr <<
"-90 DEG ; +90 DEG]" << endl;
1077 cerr <<
"-PI/2 RAD; +PI/2 RAD]" << endl;
1084 if (lat_type ==
"geod" || lat_type ==
"geodetic") {
1099void FGInitialCondition::SetTrimRequest(std::string
trim)
1102 if (trimOption ==
"1")
1104 else if (trimOption ==
"longitudinal")
1106 else if (trimOption ==
"full")
1108 else if (trimOption ==
"ground")
1110 else if (trimOption ==
"pullup")
1112 else if (trimOption ==
"custom")
1114 else if (trimOption ==
"turn")
1120bool FGInitialCondition::Load_v1(
Element* document)
1136 result = LoadLatitude(document);
1138 FGColumnVector3 vOrient = orientation.GetEuler();
1147 orientation = FGQuaternion(vOrient);
1190 vPQR_body.InitMatrix();
1197bool FGInitialCondition::Load_v2(
Element* document)
1199 FGColumnVector3 vOrient;
1203 if (document->
FindElement(
"earth_position_angle"))
1205 if (document->
FindElement(
"planet_position_angle"))
1209 FGMatrix33 Ti2ec(cos(epa), sin(epa), 0.0,
1210 -sin(epa), cos(epa), 0.0,
1212 FGMatrix33 Tec2i = Ti2ec.Transposed();
1214 if (document->
FindElement(
"planet_rotation_rate")) {
1216 fdmex->GetPropagate()->in.vOmegaPlanet = fdmex->GetInertial()->GetOmegaPlanet();
1217 fdmex->GetAccelerations()->in.vOmegaPlanet = fdmex->GetInertial()->GetOmegaPlanet();
1219 FGColumnVector3 vOmegaEarth = fdmex->GetInertial()->GetOmegaPlanet();
1231 Element* position_el = document->
FindElement(
"position");
1235 if (frame ==
"eci") {
1237 }
else if (frame ==
"ecef") {
1244 }
else if (position_el->
FindElement(
"altitudeAGL")) {
1246 }
else if (position_el->
FindElement(
"altitudeMSL")) {
1249 cerr << endl <<
" No altitude or radius initial condition is given." << endl;
1254 result = LoadLatitude(position_el);
1260 cerr << endl <<
" Neither ECI nor ECEF frame is specified for initial position." << endl;
1264 cerr << endl <<
" Initial position not specified in this initialization file." << endl;
1293 Element* orientation_el = document->
FindElement(
"orientation");
1294 if (orientation_el) {
1298 if (frame ==
"eci") {
1310 FGQuaternion QuatI2Body = FGQuaternion(vOrient);
1311 QuatI2Body.Normalize();
1312 FGQuaternion QuatLocal2I = Tec2i * position.GetTl2ec();
1313 QuatLocal2I.Normalize();
1314 orientation = QuatLocal2I * QuatI2Body;
1316 }
else if (frame ==
"ecef") {
1328 FGQuaternion QuatEC2Body(vOrient);
1329 QuatEC2Body.Normalize();
1330 FGQuaternion QuatLocal2EC = position.GetTl2ec();
1331 QuatLocal2EC.Normalize();
1332 orientation = QuatLocal2EC * QuatEC2Body;
1334 }
else if (frame ==
"local") {
1336 orientation = FGQuaternion(vOrient);
1340 cerr << endl <<
fgred <<
" Orientation frame type: \"" << frame
1341 <<
"\" is not supported!" <<
reset << endl << endl;
1355 Element* velocity_el = document->
FindElement(
"velocity");
1356 FGMatrix33 mTec2l = position.GetTec2l();
1357 const FGMatrix33& Tb2l = orientation.GetTInv();
1365 if (frame ==
"eci") {
1366 FGColumnVector3 omega_cross_r = vOmegaEarth * (Tec2i * position);
1367 vUVW_NED = mTec2l * (vInitVelocity - omega_cross_r);
1369 }
else if (frame ==
"ecef") {
1370 vUVW_NED = mTec2l * vInitVelocity;
1372 }
else if (frame ==
"local") {
1373 vUVW_NED = vInitVelocity;
1375 }
else if (frame ==
"body") {
1376 vUVW_NED = Tb2l * vInitVelocity;
1380 cerr << endl <<
fgred <<
" Velocity frame type: \"" << frame
1381 <<
"\" is not supported!" <<
reset << endl << endl;
1388 vUVW_NED.InitMatrix();
1392 vt = vUVW_NED.Magnitude();
1394 calcAeroAngles(vUVW_NED);
1402 Element* attrate_el = document->
FindElement(
"attitude_rate");
1408 const FGMatrix33& Tl2b = orientation.GetT();
1411 if (frame ==
"eci") {
1412 FGMatrix33 Ti2l = position.GetTec2l() * Ti2ec;
1413 vPQR_body = Tl2b * Ti2l * (vAttRate - vOmegaEarth);
1414 }
else if (frame ==
"ecef") {
1415 vPQR_body = Tl2b * position.GetTec2l() * vAttRate;
1416 }
else if (frame ==
"local") {
1419 double radInv = 1.0 / position.GetRadius();
1420 FGColumnVector3 vOmegaLocal = {radInv*vUVW_NED(
eEast),
1421 -radInv*vUVW_NED(
eNorth),
1422 -radInv*vUVW_NED(
eEast)*tan(position.GetLatitude())};
1423 vPQR_body = Tl2b * (vAttRate + vOmegaLocal);
1424 }
else if (frame ==
"body") {
1425 vPQR_body = vAttRate;
1426 }
else if (!frame.empty()) {
1428 cerr << endl <<
fgred <<
" Attitude rate frame type: \"" << frame
1429 <<
"\" is not supported!" <<
reset << endl << endl;
1432 }
else if (frame.empty()) {
1433 vPQR_body.InitMatrix();
1437 vPQR_body.InitMatrix();
1447 PropertyManager->
Tie(
"ic/vc-kts",
this,
1450 PropertyManager->
Tie(
"ic/ve-kts",
this,
1453 PropertyManager->
Tie(
"ic/vg-kts",
this,
1456 PropertyManager->
Tie(
"ic/vt-kts",
this,
1459 PropertyManager->
Tie(
"ic/mach",
this,
1462 PropertyManager->
Tie(
"ic/roc-fpm",
this,
1465 PropertyManager->
Tie(
"ic/gamma-deg",
this,
1468 PropertyManager->
Tie(
"ic/alpha-deg",
this,
1471 PropertyManager->
Tie(
"ic/beta-deg",
this,
1474 PropertyManager->
Tie(
"ic/theta-deg",
this,
1477 PropertyManager->
Tie(
"ic/phi-deg",
this,
1480 PropertyManager->
Tie(
"ic/psi-true-deg",
this,
1483 PropertyManager->
Tie(
"ic/lat-gc-deg",
this,
1486 PropertyManager->
Tie(
"ic/long-gc-deg",
this,
1489 PropertyManager->
Tie(
"ic/h-sl-ft",
this,
1492 PropertyManager->
Tie(
"ic/h-agl-ft",
this,
1495 PropertyManager->
Tie(
"ic/terrain-elevation-ft",
this,
1498 PropertyManager->
Tie(
"ic/vg-fps",
this,
1501 PropertyManager->
Tie(
"ic/vt-fps",
this,
1504 PropertyManager->
Tie(
"ic/vw-bx-fps",
this,
1506 PropertyManager->
Tie(
"ic/vw-by-fps",
this,
1508 PropertyManager->
Tie(
"ic/vw-bz-fps",
this,
1510 PropertyManager->
Tie(
"ic/vw-north-fps",
this,
1512 PropertyManager->
Tie(
"ic/vw-east-fps",
this,
1514 PropertyManager->
Tie(
"ic/vw-down-fps",
this,
1516 PropertyManager->
Tie(
"ic/vw-mag-fps",
this,
1518 PropertyManager->
Tie(
"ic/vw-dir-deg",
this,
1522 PropertyManager->
Tie(
"ic/roc-fps",
this,
1525 PropertyManager->
Tie(
"ic/u-fps",
this,
1528 PropertyManager->
Tie(
"ic/v-fps",
this,
1531 PropertyManager->
Tie(
"ic/w-fps",
this,
1534 PropertyManager->
Tie(
"ic/vn-fps",
this,
1537 PropertyManager->
Tie(
"ic/ve-fps",
this,
1540 PropertyManager->
Tie(
"ic/vd-fps",
this,
1543 PropertyManager->
Tie(
"ic/gamma-rad",
this,
1546 PropertyManager->
Tie(
"ic/alpha-rad",
this,
1549 PropertyManager->
Tie(
"ic/theta-rad",
this,
1552 PropertyManager->
Tie(
"ic/beta-rad",
this,
1555 PropertyManager->
Tie(
"ic/phi-rad",
this,
1558 PropertyManager->
Tie(
"ic/psi-true-rad",
this,
1561 PropertyManager->
Tie(
"ic/lat-gc-rad",
this,
1564 PropertyManager->
Tie(
"ic/long-gc-rad",
this,
1567 PropertyManager->
Tie(
"ic/p-rad_sec",
this,
1570 PropertyManager->
Tie(
"ic/q-rad_sec",
this,
1573 PropertyManager->
Tie(
"ic/r-rad_sec",
this,
1576 PropertyManager->
Tie(
"ic/lat-geod-rad",
this,
1579 PropertyManager->
Tie(
"ic/lat-geod-deg",
this,
1582 PropertyManager->
Tie(
"ic/geod-alt-ft", &position,
1585 PropertyManager->
Tie(
"ic/targetNlf",
this,
1609void FGInitialCondition::Debug(
int from)
1616 if (from == 0) cout <<
"Instantiated: FGInitialCondition" << endl;
1617 if (from == 1) cout <<
"Destroyed: FGInitialCondition" << endl;
JSBSim::FGFDMExec * FDMExec
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.
double FindElementValueAsNumber(const std::string &el="")
Searches for the named element and returns the data belonging to it as a number.
FGColumnVector3 FindElementTripletConvertTo(const std::string &target_units)
Composes a 3-element column vector for the supplied location or orientation.
std::string FindElementValue(const std::string &el="")
Searches for the named element and returns the string data belonging to it.
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
Element * FindElement(const std::string &el="")
Searches for a specified element.
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 std::string & GetName(void) const
Retrieves the element name.
std::string ReadFrom(void) const
Return a string that contains a description of the location where the current XML element was read fr...
double GetAttributeValueAsNumber(const std::string &key)
Retrieves an attribute value as a double precision real number.
bool HasAttribute(const std::string &key)
Determines if an element has the supplied attribute.
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
double GetDataAsNumber(void)
Converts the element data to a number.
Element * FindElement(const std::string &el="")
Searches for a specified element.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
This class implements a 3 element column vector.
FGColumnVector3 & Normalize(void)
Normalize.
double Magnitude(void) const
Length of the vector.
void SetClimbRateFpmIC(double roc)
Sets the climb rate initial condition in feet/minute.
double GetUBodyFpsIC(void) const
Gets the initial body axis X velocity.
double GetVcalibratedKtsIC(void) const
Gets the initial calibrated airspeed.
void SetQRadpsIC(double Q)
Sets the initial body axis pitch rate.
double GetVgroundKtsIC(void) const
Gets the initial ground speed.
double GetQRadpsIC() const
Gets the initial body axis pitch rate.
void SetPsiRadIC(double psi)
Sets the initial heading angle.
void SetAlphaRadIC(double alpha)
Sets the initial angle of attack.
double GetVgroundFpsIC(void) const
Gets the initial ground velocity.
void SetLatitudeRadIC(double lat)
Sets the initial latitude.
double GetFlightPathAngleRadIC(void) const
Gets the initial flight path angle.
double GetMachIC(void) const
Gets the initial mach.
void SetPhiRadIC(double phi)
Sets the initial roll angle.
void SetAlphaDegIC(double a)
Sets angle of attack initial condition in degrees.
void SetWindDirDegIC(double dir)
Sets the initial wind direction.
double GetGeodLatitudeDegIC(void) const
Gets the initial geodetic latitude.
void SetLatitudeDegIC(double lat)
Sets the initial latitude.
void SetVEastFpsIC(double ve)
Sets the initial local axis east velocity.
double GetVBodyFpsIC(void) const
Gets the initial body axis Y velocity.
void InitializeIC(void)
Initialize the initial conditions to default values.
void SetGeodLatitudeDegIC(double glat)
Sets the initial geodetic latitude.
void SetVBodyFpsIC(double vbody)
Sets the initial body axis Y velocity.
double GetPhiRadIC(void) const
Gets the initial roll angle.
void SetThetaRadIC(double theta)
Sets the initial pitch angle.
double GetBetaRadIC(void) const
Gets the initial angle of sideslip.
double GetLongitudeDegIC(void) const
Gets the initial longitude.
double GetWindUFpsIC(void) const
Gets the initial body axis X wind velocity.
double GetWindFpsIC(void) const
Gets the initial total wind velocity in feet/sec.
~FGInitialCondition()
Destructor.
void SetVtrueFpsIC(double vt)
Sets the initial true airspeed.
void SetWindMagKtsIC(double mag)
Sets the initial total wind speed.
double GetLatitudeDegIC(void) const
Gets the initial latitude.
void SetPhiDegIC(double phi)
Sets the roll angle initial condition in degrees.
double GetPRadpsIC() const
Gets the initial body axis roll rate.
bool Load(const SGPath &rstname, bool useStoredPath=true)
Loads the initial conditions.
void SetHeadWindKtsIC(double head)
Sets the initial headwind velocity.
void SetRRadpsIC(double R)
Sets the initial body axis yaw rate.
void SetPsiDegIC(double psi)
Sets the heading angle initial condition in degrees.
double GetPsiDegIC(void) const
Gets the initial heading angle.
FGInitialCondition(FGFDMExec *fdmex)
Constructor.
void SetLongitudeRadIC(double lon)
Sets the initial longitude.
double GetWindNFpsIC(void) const
Gets the initial wind velocity in local frame.
double GetVNorthFpsIC(void) const
Gets the initial local frame X (North) velocity.
double GetLatitudeRadIC(void) const
Gets the initial latitude.
void SetGeodLatitudeRadIC(double glat)
Sets the initial geodetic latitude.
void SetBetaRadIC(double beta)
Sets the initial sideslip angle.
double GetTargetNlfIC(void) const
Gets the target normal load factor set from IC.
double GetClimbRateFpsIC(void) const
Gets the initial climb rate.
void SetAltitudeASLFtIC(double altitudeASL)
Sets the altitude above sea level initial condition in feet.
double GetAltitudeAGLFtIC(void) const
Gets the initial altitude above ground level.
void SetClimbRateFpsIC(double roc)
Sets the initial climb rate.
double GetGeodLatitudeRadIC(void) const
Gets the initial geodetic latitude.
double GetTerrainElevationFtIC(void) const
Gets the initial terrain elevation.
double GetVtrueKtsIC(void) const
Gets the initial true velocity.
void SetVcalibratedKtsIC(double vc)
Set calibrated airspeed initial condition in knots.
double GetFlightPathAngleDegIC(void) const
Gets the initial flight path angle.
void SetMachIC(double mach)
Set mach initial condition.
double GetWindDirDegIC(void) const
Gets the initial wind direction.
void SetCrossWindKtsIC(double cross)
Sets the initial crosswind speed.
double GetBetaDegIC(void) const
Gets the initial sideslip angle.
double GetThetaRadIC(void) const
Gets the initial pitch angle.
double GetAlphaRadIC(void) const
Gets the initial angle of attack.
void SetLongitudeDegIC(double lon)
Sets the initial longitude.
double GetVequivalentKtsIC(void) const
Gets the initial equivalent airspeed.
double GetPsiRadIC(void) const
Gets the initial heading angle.
double GetVDownFpsIC(void) const
Gets the initial local frame Z (Down) velocity.
void SetVgroundKtsIC(double vg)
Set ground speed initial condition in knots.
double GetAlphaDegIC(void) const
Gets the initial angle of attack.
void SetTerrainElevationFtIC(double elev)
Sets the initial terrain elevation.
void SetVDownFpsIC(double vd)
Sets the initial local axis down velocity.
void SetTargetNlfIC(double nlf)
Sets the target normal load factor.
void SetVNorthFpsIC(double vn)
Sets the initial local axis north velocity.
void SetWBodyFpsIC(double wbody)
Sets the initial body axis Z velocity.
void SetVequivalentKtsIC(double ve)
Set equivalent airspeed initial condition in knots.
void SetBetaDegIC(double b)
Sets angle of sideslip initial condition in degrees.
void SetAltitudeAGLFtIC(double agl)
Sets the initial Altitude above ground level.
void SetWindNEDFpsIC(double wN, double wE, double wD)
Sets the initial wind velocity.
void SetVtrueKtsIC(double vtrue)
Set true airspeed initial condition in knots.
double GetAltitudeASLFtIC(void) const
Gets the initial altitude above sea level.
double GetWBodyFpsIC(void) const
Gets the initial body axis Z velocity.
void SetPRadpsIC(double P)
Sets the initial body axis roll rate.
double GetWindDFpsIC(void) const
Gets the initial wind velocity in local frame.
double GetWindEFpsIC(void) const
Gets the initial wind velocity in local frame.
void SetFlightPathAngleRadIC(double gamma)
Sets the initial flight path angle.
void SetWindDownKtsIC(double wD)
Sets the initial wind downward speed.
void SetVgroundFpsIC(double vg)
Sets the initial ground speed.
double GetVtrueFpsIC(void) const
Gets the initial true velocity.
double GetLongitudeRadIC(void) const
Gets the initial longitude.
double GetClimbRateFpmIC(void) const
Gets the initial climb rate.
double GetWindVFpsIC(void) const
Gets the initial body axis Y wind velocity.
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 SetThetaDegIC(double theta)
Sets pitch angle initial condition in degrees.
void bind(FGPropertyManager *pm)
void SetUBodyFpsIC(double ubody)
Sets the initial body axis X velocity.
double GetRRadpsIC() const
Gets the initial body axis yaw rate.
double GetThetaDegIC(void) const
Gets the initial pitch angle.
void SetFlightPathAngleDegIC(double gamma)
Sets the flight path angle initial condition in degrees.
double GetPhiDegIC(void) const
Gets the initial roll angle.
double GetVEastFpsIC(void) const
Gets the initial local frame Y (East) velocity.
double GetWindWFpsIC(void) const
Gets the initial body axis Z wind velocity.
static constexpr double radtodeg
static constexpr double ktstofps
static char reset[5]
resets text properties
static constexpr double sign(double num)
static char fgred[6]
red text
static constexpr double fpstokts
static double VcalibratedFromMach(double mach, double p)
Calculate the calibrated airspeed from the Mach number.
static constexpr double degtorad
static double MachFromVcalibrated(double vcas, double p)
Calculate the Mach number from the calibrated airspeed.Based on the formulas in the US Air Force Airc...
FGLocation holds an arbitrary location in the Earth centered Earth fixed reference frame (ECEF).
double GetGeodAltitude(void) const
Gets the geodetic altitude in feet.
void SetEllipse(double semimajor, double semiminor)
Sets the semimajor and semiminor axis lengths for this planet.
Handles matrix math operations.
void Tie(const std::string &name, T *pointer)
Tie a property to an external variable.
Models the Quaternion representation of rotations.
const FGMatrix33 & GetT(void) const
Transformation matrix.
double GetSinEuler(int i) const
Retrieves sine of the given euler angle.
double GetCosEuler(int i) const
Retrieves cosine of the given euler angle.
const FGColumnVector3 & GetEuler(void) const
Retrieves the Euler angles.
const FGMatrix33 & GetTInv(void) const
Backward transformation matrix.
Element * LoadXMLDocument(const SGPath &XML_filename, bool verbose=true)
double DotProduct(const FGColumnVector3 &v1, const FGColumnVector3 &v2)
Dot product of two vectors Compute and return the euclidean dot (or scalar) product of two vectors v1...
std::string & to_lower(std::string &str)
std::string & trim(std::string &str)