50 #include "FGFDMExec.h" 51 #include "models/atmosphere/FGStandardAtmosphere.h" 52 #include "models/atmosphere/FGWinds.h" 53 #include "models/FGFCS.h" 54 #include "models/FGPropulsion.h" 55 #include "models/FGMassBalance.h" 56 #include "models/FGGroundReactions.h" 57 #include "models/FGExternalReactions.h" 58 #include "models/FGBuoyantForces.h" 59 #include "models/FGAerodynamics.h" 60 #include "models/FGInertial.h" 61 #include "models/FGAircraft.h" 62 #include "models/FGAccelerations.h" 63 #include "models/FGPropagate.h" 64 #include "models/FGAuxiliary.h" 65 #include "models/FGInput.h" 66 #include "models/FGOutput.h" 67 #include "initialization/FGTrim.h" 68 #include "input_output/FGScript.h" 69 #include "input_output/FGXMLFileRead.h" 75 IDENT(IdSrc,
"$Id: FGFDMExec.cpp,v 1.193 2017/02/25 14:23:18 bcoconni Exp $");
76 IDENT(IdHdr,ID_FDMEXEC);
85 FGFDMExec::FGFDMExec(
FGPropertyManager* root,
unsigned int* fdmctr) : Root(root), FDMctr(fdmctr)
105 IncrementThenHolding =
false;
106 TimeStepsUntilHold = -1;
112 AircraftPath =
"aircraft";
113 EnginePath =
"engine";
114 SystemsPath =
"systems";
117 char* num = getenv(
"JSBSIM_DEBUG");
118 if (num) debug_lvl = atoi(num);
129 FDMctr =
new unsigned int;
139 FGPropertyNode* instanceRoot = Root->GetNode(
"/fdm/jsbsim",IdFDM,
true);
143 char* num = getenv(
"JSBSIM_DISPERSE");
145 if (atoi(num) != 0) disperse = 1;
149 std::cerr <<
"Could not process JSBSIM_DISPERSIONS environment variable: Assumed NO dispersions." << endl;
156 }
catch (
const string& msg ) {
157 cout <<
"Caught error: " << msg << endl;
166 typedef int (
FGFDMExec::*iPMF)(void)
const;
169 instance->
Tie(
"simulation/disperse",
this, &FGFDMExec::GetDisperse);
170 instance->
Tie(
"simulation/randomseed",
this, (iPMF)&FGFDMExec::SRand, &FGFDMExec::SRand,
false);
171 instance->
Tie(
"simulation/terminate", (
int *)&Terminate);
175 instance->
Tie(
"simulation/frame", (
int *)&Frame,
false);
176 instance->
Tie(
"simulation/trim-completed", (
int *)&trim_completed,
false);
179 Constructing =
false;
203 }
catch (
const string& msg ) {
204 cout <<
"Caught error: " << msg << endl;
207 for (
unsigned int i=1; i<ChildFDMList.size(); i++)
delete ChildFDMList[i]->exec;
208 ChildFDMList.clear();
210 PropertyCatalog.clear();
214 if (FDMctr != 0) (*FDMctr)--;
221 bool FGFDMExec::Allocate(
void)
225 Models.resize(eNumStandardModels);
238 Models[eInput] =
new FGInput(
this);
240 Models[eWinds] =
new FGWinds(
this);
241 Models[eSystems] =
new FGFCS(
this);
251 Models[eOutput] =
new FGOutput(
this);
257 Winds = (
FGWinds*)Models[eWinds];
258 FCS = (
FGFCS*)Models[eSystems];
268 Output = (
FGOutput*)Models[eOutput];
271 LoadPlanetConstants();
274 for (
unsigned int i = 0; i < Models.size(); i++) {
276 if (i == eInput || i == eOutput)
continue;
279 Models[i]->InitModel();
292 bool FGFDMExec::DeAllocate(
void)
295 for (
unsigned int i=0; i<eNumStandardModels; i++)
delete Models[i];
316 for (
unsigned int i=1; i<ChildFDMList.size(); i++) {
317 ChildFDMList[i]->AssignState( (
FGPropagate*)Models[ePropagate] );
318 ChildFDMList[i]->Run();
326 for (
unsigned int i = 0; i < Models.size(); i++) {
328 Models[i]->Run(holding);
332 unsigned int mode = ResetMode;
338 if (Terminate) success =
false;
345 void FGFDMExec::LoadInputs(
unsigned int idx)
349 Propagate->in.vPQRidot = Accelerations->
GetPQRidot();
350 Propagate->in.vUVWidot = Accelerations->
GetUVWidot();
351 Propagate->in.DeltaT = dT;
356 Inertial->in.Radius = Propagate->GetRadius();
357 Inertial->in.Latitude = Propagate->GetLatitude();
364 Winds->in.DistanceAGL = Propagate->GetDistanceAGL();
365 Winds->in.Tl2b = Propagate->
GetTl2b();
366 Winds->in.Tw2b = Auxiliary->
GetTw2b();
367 Winds->in.V = Auxiliary->
GetVt();
368 Winds->in.totalDeltaT = dT * Winds->
GetRate();
371 Auxiliary->in.Pressure = Atmosphere->
GetPressure();
372 Auxiliary->in.Density = Atmosphere->
GetDensity();
374 Auxiliary->in.PressureSL = Atmosphere->GetPressureSL();
378 Auxiliary->in.DistanceAGL = Propagate->GetDistanceAGL();
379 Auxiliary->in.Mass = MassBalance->GetMass();
380 Auxiliary->in.Tl2b = Propagate->
GetTl2b();
381 Auxiliary->in.Tb2l = Propagate->
GetTb2l();
382 Auxiliary->in.vPQR = Propagate->
GetPQR();
383 Auxiliary->in.vPQRi = Propagate->
GetPQRi();
384 Auxiliary->in.vPQRidot = Accelerations->
GetPQRidot();
385 Auxiliary->in.vUVW = Propagate->
GetUVW();
386 Auxiliary->in.vUVWdot = Accelerations->
GetUVWdot();
387 Auxiliary->in.vVel = Propagate->
GetVel();
388 Auxiliary->in.vBodyAccel = Accelerations->
GetBodyAccel();
389 Auxiliary->in.ToEyePt = MassBalance->
StructuralToBody(Aircraft->GetXYZep());
390 Auxiliary->in.VRPBody = MassBalance->
StructuralToBody(Aircraft->GetXYZvrp());
392 Auxiliary->in.vFw = Aerodynamics->
GetvFw();
393 Auxiliary->in.vLocation = Propagate->GetLocation();
394 Auxiliary->in.CosTht = Propagate->
GetCosEuler(eTht);
395 Auxiliary->in.SinTht = Propagate->
GetSinEuler(eTht);
396 Auxiliary->in.CosPhi = Propagate->
GetCosEuler(ePhi);
397 Auxiliary->in.SinPhi = Propagate->
GetSinEuler(ePhi);
398 Auxiliary->in.Psi = Propagate->
GetEuler(ePsi);
400 Auxiliary->in.TurbPQR = Winds->GetTurbPQR();
408 Propulsion->in.Pressure = Atmosphere->
GetPressure();
412 Propulsion->in.Density = Atmosphere->
GetDensity();
416 Propulsion->in.Vt = Auxiliary->
GetVt();
417 Propulsion->in.qbar = Auxiliary->Getqbar();
418 Propulsion->in.TAT_c = Auxiliary->GetTAT_C();
419 Propulsion->in.AeroUVW = Auxiliary->GetAeroUVW();
420 Propulsion->in.AeroPQR = Auxiliary->GetAeroPQR();
421 Propulsion->in.alpha = Auxiliary->Getalpha();
422 Propulsion->in.beta = Auxiliary->Getbeta();
423 Propulsion->in.TotalDeltaT = dT * Propulsion->
GetRate();
430 Propulsion->in.H_agl = Propagate->GetDistanceAGL();
431 Propulsion->in.PQRi = Propagate->
GetPQRi();
435 Aerodynamics->in.Alpha = Auxiliary->Getalpha();
436 Aerodynamics->in.Beta = Auxiliary->Getbeta();
437 Aerodynamics->in.Qbar = Auxiliary->Getqbar();
438 Aerodynamics->in.Vt = Auxiliary->
GetVt();
439 Aerodynamics->in.Tb2w = Auxiliary->
GetTb2w();
440 Aerodynamics->in.Tw2b = Auxiliary->
GetTw2b();
441 Aerodynamics->in.RPBody = MassBalance->
StructuralToBody(Aircraft->GetXYZrp());
443 case eGroundReactions:
445 GroundReactions->in.Vground = Auxiliary->
GetVground();
449 GroundReactions->in.BrakePos = FCS->GetBrakePos();
450 GroundReactions->in.FCSGearPos = FCS->
GetGearPos();
451 GroundReactions->in.EmptyWeight = MassBalance->GetEmptyWeight();
452 GroundReactions->in.Tb2l = Propagate->
GetTb2l();
453 GroundReactions->in.Tec2l = Propagate->
GetTec2l();
454 GroundReactions->in.Tec2b = Propagate->
GetTec2b();
455 GroundReactions->in.PQR = Propagate->
GetPQR();
456 GroundReactions->in.UVW = Propagate->
GetUVW();
457 GroundReactions->in.DistanceAGL = Propagate->GetDistanceAGL();
459 GroundReactions->in.TotalDeltaT = dT * GroundReactions->
GetRate();
460 GroundReactions->in.WOW = GroundReactions->GetWOW();
461 GroundReactions->in.Location = Propagate->GetLocation();
462 GroundReactions->in.vXYZcg = MassBalance->GetXYZcg();
464 case eExternalReactions:
468 BuoyantForces->in.Density = Atmosphere->
GetDensity();
469 BuoyantForces->in.Pressure = Atmosphere->
GetPressure();
471 BuoyantForces->in.gravity = Inertial->gravity();
475 MassBalance->in.GasMass = BuoyantForces->
GetGasMass();
477 MassBalance->in.TanksWeight = Propulsion->GetTanksWeight();
478 MassBalance->in.TanksMoment = Propulsion->GetTanksMoment();
479 MassBalance->in.TankInertia = Propulsion->CalculateTankInertias();
482 Aircraft->in.AeroForce = Aerodynamics->
GetForces();
483 Aircraft->in.PropForce = Propulsion->GetForces();
484 Aircraft->in.GroundForce = GroundReactions->GetForces();
485 Aircraft->in.ExternalForce = ExternalReactions->
GetForces();
486 Aircraft->in.BuoyantForce = BuoyantForces->
GetForces();
487 Aircraft->in.AeroMoment = Aerodynamics->
GetMoments();
488 Aircraft->in.PropMoment = Propulsion->GetMoments();
489 Aircraft->in.GroundMoment = GroundReactions->GetMoments();
490 Aircraft->in.ExternalMoment = ExternalReactions->
GetMoments();
491 Aircraft->in.BuoyantMoment = BuoyantForces->
GetMoments();
494 Accelerations->in.
J = MassBalance->GetJ();
495 Accelerations->in.
Jinv = MassBalance->GetJinv();
500 Accelerations->in.
Moment = Aircraft->GetMoments();
501 Accelerations->in.
GroundMoment = GroundReactions->GetMoments();
502 Accelerations->in.
Force = Aircraft->GetForces();
503 Accelerations->in.
GroundForce = GroundReactions->GetForces();
504 Accelerations->in.
GAccel = Inertial->GetGAccel(Propagate->GetRadius());
505 Accelerations->in.
J2Grav = Inertial->GetGravityJ2(Propagate->GetLocation());
510 Accelerations->in.
DeltaT = dT;
511 Accelerations->in.
Mass = MassBalance->GetMass();
512 Accelerations->in.
MultipliersList = GroundReactions->GetMultipliersList();
523 void FGFDMExec::LoadPlanetConstants(
void)
525 Propagate->in.vOmegaPlanet = Inertial->GetOmegaPlanet();
526 Accelerations->in.
vOmegaPlanet = Inertial->GetOmegaPlanet();
527 Propagate->in.SemiMajor = Inertial->GetSemimajor();
528 Propagate->in.SemiMinor = Inertial->GetSemiminor();
529 Auxiliary->in.SLGravity = Inertial->SLgravity();
534 void FGFDMExec::LoadModelConstants(
void)
537 Aerodynamics->in.Wingarea = Aircraft->
GetWingArea();
538 Aerodynamics->in.Wingchord = Aircraft->
Getcbar();
539 Aerodynamics->in.Wingincidence = Aircraft->GetWingIncidence();
540 Aerodynamics->in.Wingspan = Aircraft->
GetWingSpan();
542 Auxiliary->in.Wingchord = Aircraft->
Getcbar();
543 Auxiliary->in.PitotAngle = Aircraft->GetPitotAngle();
544 GroundReactions->in.vXYZcg = MassBalance->GetXYZcg();
546 LoadPlanetConstants();
559 Models[eInput]->InitModel();
560 Models[eOutput]->InitModel();
563 Propagate->InitializeDerivatives();
567 MassBalance->GetMassPropertiesReport(0);
570 <<
"End of vehicle configuration loading." << endl
571 <<
"-------------------------------------------------------------------------------" 572 <<
reset << std::setprecision(6) << endl;
575 for (
unsigned int n=0; n < propulsion->
GetNumEngines(); ++n) {
579 }
catch (
const string& str) {
593 Propagate->SetInitialState(FGIC);
602 if (Constructing)
return;
606 for (
unsigned int i = 0; i < Models.size(); i++) {
608 if (i == eInput || i == eOutput)
continue;
611 Models[i]->InitModel();
615 Script->ResetEvents();
629 Propagate->in.vPQRidot = Accelerations->
GetPQRidot();
630 Propagate->in.vUVWidot = Accelerations->
GetUVWidot();
639 vector <string> FDMList;
644 for (
unsigned int i=1; i<ChildFDMList.size(); i++) {
645 FDMList.push_back(ChildFDMList[i]->exec->GetAircraft()->GetAircraftName());
654 const SGPath& initfile)
659 result = Script->
LoadScript(GetFullPath(script), deltaT, initfile);
667 const SGPath& SystemsPath,
const string& model,
670 FGFDMExec::AircraftPath = GetFullPath(AircraftPath);
671 FGFDMExec::EnginePath = GetFullPath(EnginePath);
672 FGFDMExec::SystemsPath = GetFullPath(SystemsPath);
681 SGPath aircraftCfgFileName;
686 if( AircraftPath.isNull() || EnginePath.isNull() || SystemsPath.isNull()) {
687 cerr <<
"Error: attempted to load aircraft with undefined ";
688 cerr <<
"aircraft, engine, and system paths" << endl;
692 FullAircraftPath = AircraftPath;
693 if (addModelToPath) FullAircraftPath.append(model);
694 aircraftCfgFileName = FullAircraftPath/(model +
".xml");
701 int saved_debug_lvl = debug_lvl;
703 Element *document = XMLFileRead.LoadXMLDocument(aircraftCfgFileName);
706 if (IsChild) debug_lvl = 0;
708 ReadPrologue(document);
710 if (IsChild) debug_lvl = saved_debug_lvl;
715 result = ReadFileHeader(element);
717 cerr << endl <<
"Aircraft fileheader element has problems in file " << aircraftCfgFileName << endl;
722 if (IsChild) debug_lvl = 0;
727 result = ((
FGAircraft*)Models[eAircraft])->Load(element);
729 cerr << endl <<
"Aircraft metrics element has problems in file " << aircraftCfgFileName << endl;
733 cerr << endl <<
"No metrics element was found in the aircraft config file." << endl;
740 result = ((
FGMassBalance*)Models[eMassBalance])->Load(element);
742 cerr << endl <<
"Aircraft mass_balance element has problems in file " << aircraftCfgFileName << endl;
746 cerr << endl <<
"No mass_balance element was found in the aircraft config file." << endl;
751 element = document->
FindElement(
"ground_reactions");
756 <<
"Aircraft ground_reactions element has problems in file " 757 << aircraftCfgFileName << endl;
761 cerr << endl <<
"No ground_reactions element was found in the aircraft config file." << endl;
766 element = document->
FindElement(
"external_reactions");
770 cerr << endl <<
"Aircraft external_reactions element has problems in file " << aircraftCfgFileName << endl;
780 cerr << endl <<
"Aircraft buoyant_forces element has problems in file " << aircraftCfgFileName << endl;
788 result = ((
FGPropulsion*)Models[ePropulsion])->Load(element);
790 cerr << endl <<
"Aircraft propulsion element has problems in file " << aircraftCfgFileName << endl;
793 for (
unsigned int i=0; i<((
FGPropulsion*)Models[ePropulsion])->GetNumEngines(); i++)
794 ((
FGFCS*)Models[eSystems])->AddThrottle();
800 result = ((
FGFCS*)Models[eSystems])->Load(element);
802 cerr << endl <<
"Aircraft system element has problems in file " << aircraftCfgFileName << endl;
811 result = ((
FGFCS*)Models[eSystems])->Load(element);
813 cerr << endl <<
"Aircraft autopilot element has problems in file " << aircraftCfgFileName << endl;
821 result = ((
FGFCS*)Models[eSystems])->Load(element);
823 cerr << endl <<
"Aircraft flight_control element has problems in file " << aircraftCfgFileName << endl;
833 cerr << endl <<
"Aircraft aerodynamics element has problems in file " << aircraftCfgFileName << endl;
837 cerr << endl <<
"No expected aerodynamics element was found in the aircraft config file." << endl;
843 if (!static_cast<FGInput*>(Models[eInput])->Load(element))
853 if (!static_cast<FGOutput*>(Models[eOutput])->Load(element))
862 result = ReadChild(element);
864 cerr << endl <<
"Aircraft child element has problems in file " << aircraftCfgFileName << endl;
871 LoadModelConstants();
875 if (IsChild) debug_lvl = saved_debug_lvl;
879 <<
" JSBSim failed to open the configuration file: " << aircraftCfgFileName
883 for (
unsigned int i=0; i< Models.size(); i++) LoadInputs(i);
888 masterPCS.
node = Root->GetNode();
897 string FGFDMExec::GetPropulsionTankReport()
899 return ((
FGPropulsion*)Models[ePropulsion])->GetPropulsionTankReport();
908 for (
int i=0; i<pcs->
node->nChildren(); i++) {
911 int node_idx = pcs->
node->getChild(i)->getIndex();
915 if (pcs->
node->getChild(i)->nChildren() == 0) {
916 if (pcsNew->
base_string.substr(0,12) == string(
"/fdm/jsbsim/")) {
919 if (pcs->
node->getChild(i)->getAttribute(SGPropertyNode::READ)) access=
"R";
920 if (pcs->
node->getChild(i)->getAttribute(SGPropertyNode::WRITE)) access+=
"W";
921 PropertyCatalog.push_back(pcsNew->
base_string+
" ("+access+
")");
935 for (
unsigned i=0; i<PropertyCatalog.size(); i++) {
936 if (PropertyCatalog[i].find(in) != string::npos) results += PropertyCatalog[i] +
"\n";
938 if (results.empty())
return "No matches found\n";
944 void FGFDMExec::PrintPropertyCatalog(
void)
948 << modelName <<
reset << endl << endl;
949 for (
unsigned i=0; i<PropertyCatalog.size(); i++) {
950 cout <<
" " << PropertyCatalog[i] << endl;
956 void FGFDMExec::PrintSimulationConfiguration(
void)
const 958 cout << endl <<
"Simulation Configuration" << endl <<
"------------------------" << endl;
959 cout << MassBalance->Name << endl;
960 cout << GroundReactions->Name << endl;
961 cout << Aerodynamics->Name << endl;
962 cout << Propulsion->Name << endl;
967 bool FGFDMExec::ReadFileHeader(
Element* el)
971 if (debug_lvl == 0)
return result;
974 cout << endl <<
highint <<
fgblue <<
"Reading child model: " << IdFDM <<
reset << endl << endl;
991 bool FGFDMExec::ReadPrologue(
Element* el)
995 if (!el)
return false;
998 ((
FGAircraft*)Models[eAircraft])->SetAircraftName(AircraftName);
1000 if (debug_lvl & 1) cout <<
underon <<
"Reading Aircraft Configuration File" 1007 cout <<
" Version: " <<
highint << CFGVersion
1009 if (CFGVersion != needed_cfg_version) {
1010 cerr << endl <<
fgred <<
"YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT." 1011 " RESULTS WILL BE UNPREDICTABLE !!" << endl;
1012 cerr <<
"Current version needed is: " << needed_cfg_version << endl;
1013 cerr <<
" You have version: " << CFGVersion << endl <<
fgdef << endl;
1017 if (Release ==
"ALPHA" && (debug_lvl & 1)) {
1018 cout << endl << endl
1019 <<
highint <<
"This aircraft model is an " <<
fgred << Release
1021 <<
"This aircraft model may not even properly load, and probably" 1022 <<
" will not fly as expected." << endl << endl
1023 <<
fgred <<
highint <<
"Use this model for development purposes ONLY!!!" 1025 }
else if (Release ==
"BETA" && (debug_lvl & 1)) {
1026 cout << endl << endl
1027 <<
highint <<
"This aircraft model is a " <<
fgred << Release
1029 <<
"This aircraft model probably will not fly as expected." << endl << endl
1030 <<
fgblue <<
highint <<
"Use this model for development purposes ONLY!!!" 1032 }
else if (Release ==
"PRODUCTION" && (debug_lvl & 1)) {
1033 cout << endl << endl
1034 <<
highint <<
"This aircraft model is a " <<
fgblue << Release
1036 }
else if (debug_lvl & 1) {
1037 cout << endl << endl
1038 <<
highint <<
"This aircraft model is an " <<
fgred << Release
1040 <<
"This aircraft model may not even properly load, and probably" 1041 <<
" will not fly as expected." << endl << endl
1042 <<
fgred <<
highint <<
"Use this model for development purposes ONLY!!!" 1051 bool FGFDMExec::ReadChild(
Element* el)
1061 struct childData* child =
new childData;
1063 child->exec =
new FGFDMExec(Root, FDMctr);
1064 child->exec->SetChild(
true);
1068 if (sMated ==
"false") child->mated =
false;
1070 if (sInternal ==
"true") child->internal =
true;
1072 child->exec->SetAircraftPath( AircraftPath );
1073 child->exec->SetEnginePath( EnginePath );
1074 child->exec->SetSystemsPath( SystemsPath );
1075 child->exec->LoadModel(childAircraft);
1081 cerr << endl <<
highint <<
fgred <<
" No location was found for this child object!" <<
reset << endl;
1088 }
else if (debug_lvl > 0) {
1089 cerr << endl <<
highint <<
" No orientation was found for this child object! Assuming 0,0,0." <<
reset << endl;
1092 ChildFDMList.push_back(child);
1109 Trim =
new FGTrim(
this,tNone);
1118 if( IncrementThenHolding ) {
1120 if (TimeStepsUntilHold == 0) {
1127 IncrementThenHolding =
false;
1128 TimeStepsUntilHold--;
1130 }
else if ( TimeStepsUntilHold > 0 ) {
1132 TimeStepsUntilHold--;
1141 if (Constructing)
return;
1143 if (mode < 0 || mode > JSBSim::tNone)
1144 throw(
"Illegal trimming mode!");
1146 FGTrim trim(
this, (JSBSim::TrimMode)mode);
1147 bool success = trim.
DoTrim();
1151 throw(
"Trim Failed");
1158 void FGFDMExec::SRand(
int sr)
1161 gaussian_random_number_phase = 0;
1184 void FGFDMExec::Debug(
int from)
1186 if (debug_lvl <= 0)
return;
1188 if (debug_lvl & 1 && IdFDM == 0) {
1191 <<
"JSBSim Flight Dynamics Model v" << JSBSim_version << endl;
1192 cout <<
" [JSBSim-ML v" << needed_cfg_version <<
"]\n\n";
1193 cout <<
"JSBSim startup beginning ...\n\n";
1194 if (disperse == 1) cout <<
"Dispersions are ON." << endl << endl;
1195 }
else if (from == 3) {
1196 cout <<
"\n\nJSBSim startup complete\n\n";
1199 if (debug_lvl & 2 ) {
1200 if (from == 0) cout <<
"Instantiated: FGFDMExec" << endl;
1201 if (from == 1) cout <<
"Destroyed: FGFDMExec" << endl;
1203 if (debug_lvl & 4 ) {
1205 cout <<
"================== Frame: " << Frame <<
" Time: " 1206 << sim_time <<
" dt: " << dT << endl;
1209 if (debug_lvl & 8 ) {
1211 if (debug_lvl & 16) {
1213 if (debug_lvl & 64) {
1215 cout << IdSrc << endl;
1216 cout << IdHdr << endl;
Encapsulates an Aircraft and its systems.
const FGMatrix33 & GetTw2b(void)
Calculates and returns the wind-to-body axis transformation matrix.
const FGColumnVector3 & GetGasMassMoment(void)
Gets the total moment from the gas mass.
const FGMatrix33 & GetTec2b(void) const
Retrieves the ECEF-to-body transformation matrix.
const FGColumnVector3 & GetBodyAccel(void) const
Retrieves the acceleration resulting from the applied forces.
Encapsulates the Buoyant forces calculations.
double GetCosEuler(int idx) const
Retrieves the cosine of a vehicle Euler angle component.
bool LoadScript(const SGPath &Script, double deltaT=0.0, const SGPath &initfile=SGPath())
Loads a script.
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
const FGMatrix33 & GetTl2b(void) const
Retrieves the local-to-body transformation matrix.
FGTrim * GetTrim(void)
Returns a pointer to the FGTrim object.
std::vector< std::string > EnumerateFDMs(void)
Returns a vector of strings representing the names of all loaded models (future)
virtual const FGColumnVector3 & GetTotalWindNED(void) const
Retrieves the total wind components in NED frame.
void SuspendIntegration(void)
Suspends the simulation and sets the delta T to zero.
const FGColumnVector3 & GetPQRi(void) const
Retrieves the body angular rates vector, relative to the ECI (inertial) frame.
bool RunIC(void)
Initializes the sim from the initial condition object and executes each scheduled model without integ...
virtual void SetWindNED(double wN, double wE, double wD)
Sets the wind components in NED frame.
Class wrapper for property handling.
const std::string & GetAircraftName(void) const
Gets the aircraft name.
static char reset[5]
resets text properties
Encapsulates the aerodynamic calculations.
bool LoadScript(const SGPath &script, double default_dT, const SGPath &initfile)
Loads a script to drive JSBSim (usually in standalone mode).
virtual double GetPressure(void) const
Returns the pressure in psf.
Element * FindElement(const std::string &el="")
Searches for a specified element.
double GetThrottlePos(int engine) const
Gets the throttle position.
void DoTrim(int mode)
Executes trimming in the selected mode.
double GetWingSpan(void) const
Gets the wing span.
void SetGroundCallback(FGGroundCallback *gc)
Sets the ground callback pointer.
double GetAltitudeASL(void) const
Returns the current altitude above sea level.
void SetHoldDown(bool hd)
Sets the property forces/hold-down.
double GetSinEuler(int idx) const
Retrieves the sine of a vehicle Euler angle component.
const FGColumnVector3 & GetPQRidot(void) const
Retrieves the axis angular acceleration vector in the ECI frame.
double GetMixtureCmd(int engine) const
Gets the mixture command.
static char normint[6]
normal intensity text
Models inertial forces (e.g.
void Report(void)
Print the results of the trim.
const FGColumnVector3 & GetUVWdot(void) const
Retrieves the body axis acceleration.
std::string base_string
Name of the property.
void BuildPropertyCatalog(struct PropertyCatalogStructure *pcs)
Builds a catalog of properties.
FGPropertyManager * GetPropertyManager(void)
Returns a pointer to the property manager object.
const FGColumnVector3 & GetvFw(void) const
Retrieves the aerodynamic forces in the wind axes.
const FGColumnVector3 & GetUVW(void) const
Retrieves the body frame vehicle velocity vector.
double GetMixturePos(int engine) const
Gets the mixture position.
const FGColumnVector3 & GetPQR(void) const
Retrieves the body angular rates vector, relative to the ECEF frame.
static char fgred[6]
red text
void Initialize(FGInitialCondition *FGIC)
Initializes the simulation with initial conditions.
void SetDebugLevel(int level)
Sets the debug level.
double GetPropAdvance(int engine) const
Gets the prop pitch position.
Models atmospheric disturbances: winds, gusts, turbulence, downbursts, etc.
double Setsim_time(double cur_time)
Sets the current sim time.
virtual double GetPressureRatio(void) const
Returns the ratio of at-altitude pressure over the sea level value.
double GetThrottleCmd(int engine) const
Gets the throttle command.
int GetDebugLevel(void) const
Retrieves the current debug level setting.
Models the EOM and integration/propagation of state.
bool GetPropFeather(int engine) const
Gets the prop feather position.
void Tie(const std::string &name, bool *pointer, bool useDefault=true)
Tie a property to an external bool variable.
const FGColumnVector3 & GetForces(void) const
Gets the total aerodynamic force vector.
const FGMatrix33 & GetTec2i(void) const
Retrieves the ECEF-to-ECI transformation matrix.
const FGColumnVector3 & GetMoments(void) const
Retrieves the total moment resulting from the forces defined in the external reactions.
const FGMatrix33 & GetTb2i(void) const
Retrieves the body-to-ECI transformation matrix.
const FGMatrix33 & GetGasMassInertia(void)
Gets the total moments of inertia for the gas mass in the body frame.
const FGColumnVector3 & GetForces(void) const
Retrieves the total forces defined in the external reactions.
static char fgdef[6]
default text
bool RunScript(void)
This function is called each pass through the executive Run() method IF scripting is enabled...
Propulsion management class.
virtual double GetDensitySL(void) const
Returns the sea level density in slugs/ft^3.
const FGColumnVector3 & GetUVWidot(void) const
Retrieves the body axis acceleration in the ECI frame.
Encapsulates the JSBSim scripting capability.
virtual double GetSoundSpeed(void) const
Returns the speed of sound in ft/sec.
const FGColumnVector3 & GetMoments(void) const
Gets the total Buoyancy moment vector.
virtual double GetWindPsi(void) const
Retrieves the direction that the wind is coming from.
const FGMatrix33 & GetTec2l(void) const
Retrieves the ECEF-to-local transformation matrix.
double GetGasMass(void) const
Gets the total gas mass.
const FGMatrix33 & GetTb2l(void) const
Retrieves the body-to-local transformation matrix.
const FGColumnVector3 & GetVel(void) const
Retrieves the velocity vector.
const FGColumnVector3 & GetForces(void) const
Gets the total Buoyant force vector.
std::string GetDataLine(unsigned int i=0)
Gets a line of data belonging to an element.
static char underoff[6]
underline off
const FGColumnVector3 & GetEuler(void) const
Retrieves the Euler angles that define the vehicle orientation.
FGPropertyNode_ptr node
The node for the property.
Models an empty, abstract base atmosphere class.
virtual double GetDensity(void) const
Returns the density in slugs/ft^3.
void ResumeIntegration(void)
Resumes the simulation by resetting delta T to the correct value.
The trimming routine for JSBSim.
double Getcbar(void) const
Gets the average wing chord.
const FGColumnVector3 & GetInertialPosition(void) const
Retrieves the inertial position vector.
static char fgblue[6]
blue text
Initializes the simulation run.
Encapsulates the Flight Control System (FCS) functionality.
unsigned int GetRate(void)
Get the output rate for the model in frames.
bool IntegrationSuspended(void) const
Returns the simulation suspension state.
std::string QueryPropertyCatalog(const std::string &check)
Retrieves property or properties matching the supplied string.
double GetSimTime(void) const
Returns the cumulative simulation time in seconds.
std::string ReadFrom(void) const
Return a string that contains a description of the location where the current XML element was read fr...
const FGColumnVector3 GetWindNEDFpsIC(void) const
Gets the initial wind velocity in the NED local frame.
Manages ground reactions modeling.
const FGMatrix33 & GetTb2w(void)
Calculates and returns the body-to-wind axis transformation matrix.
void SetStartNewOutput(void)
Reset the output prior to a restart of the simulation.
Handles the calculation of accelerations.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
static char highint[5]
highlights text
void InitRunning(int n)
Sets up the engines as running.
Encapsulates various uncategorized scheduled functions.
FGFDMExec(FGPropertyManager *root=0, unsigned int *fdmctr=0)
Default constructor.
bool IsEngineRunning(unsigned int n) const
Is an engine running ?
double Magnitude(void) const
Length of the vector.
double GetDeltaT(void) const
Returns the simulation delta T.
void CheckIncrementalHold(void)
Checks if required to hold afer increment.
bool Run(void)
This function executes each scheduled model in succession.
double GetTotalPressure(void) const
Returns the total pressure.
double GetVcalibratedKTS(void) const
Returns Calibrated airspeed in knots.
void SetHoldDown(bool hd)
Sets the property forces/hold-down.
double GetGearPos(void) const
Gets the gear position (0 up, 1 down), defaults to down.
Encapsulates the JSBSim simulation executive.
Models weight, balance and moment of inertia information.
virtual double GetDensityRatio(void) const
Returns the ratio of at-altitude density over the sea level value.
~FGFDMExec()
Default destructor.
double GetVground(void) const
Gets the ground speed in feet per second.
bool LoadModel(const SGPath &AircraftPath, const SGPath &EnginePath, const SGPath &SystemsPath, const std::string &model, bool addModelToPath=true)
Loads an aircraft model.
void ResetToInitialConditions(int mode)
Resets the initial conditions object and prepares the simulation to run again.
FGColumnVector3 StructuralToBody(const FGColumnVector3 &r) const
Conversion from the structural frame to the body frame.
FGColumnVector3 FindElementTripletConvertTo(const std::string &target_units)
Composes a 3-element column vector for the supplied location or orientation.
static char underon[5]
underlines text
double GetVt(void) const
Gets the magnitude of total vehicle velocity including wind effects in feet per second.
bool GetHoldDown(void) const
Gets the value of the property forces/hold-down.
const FGMatrix33 & GetTi2b(void) const
Retrieves the ECI-to-body transformation matrix.
virtual double GetTemperature() const
Returns the actual, modeled temperature at the current altitude in degrees Rankine.
void Unbind(void)
Unbind all tied JSBSim properties.
virtual double GetKinematicViscosity(void) const
Returns the kinematic viscosity.
const FGColumnVector3 & GetMoments(void) const
Gets the total aerodynamic moment vector about the CG.
Manages the external and/or arbitrary forces.
void SetHoldDown(bool hd)
Sets the property forces/hold-down.
double GetWingArea(void) const
Gets the wing area.
bool DoTrim(void)
Execute the trim.
Handles simulation output.
double IncrTime(void)
Increments the simulation time if not in Holding mode.
unsigned int GetNumEngines(void) const
Retrieves the number of engines defined for the aircraft.