bool FGFDMExec::Allocate(void) { bool result=true; Models.resize(eNumStandardModels); // See the eModels enum specification in the header file. The order of the enums // specifies the order of execution. The Models[] vector is the primary // storage array for the list of models. Models[ePropagate] = new FGPropagate(this); Models[eInput] = new FGInput(this); Models[eInertial] = new FGInertial(this); Models[eAtmosphere] = new FGStandardAtmosphere(this); Models[eWinds] = new FGWinds(this); Models[eAuxiliary] = new FGAuxiliary(this); Models[eSystems] = new FGFCS(this); Models[ePropulsion] = new FGPropulsion(this); Models[eAerodynamics] = new FGAerodynamics (this); GetGroundCallback()->SetSeaLevelRadius(((FGInertial*)Models[eInertial])->GetRefRadius()); Models[eGroundReactions] = new FGGroundReactions(this); Models[eExternalReactions] = new FGExternalReactions(this); Models[eBuoyantForces] = new FGBuoyantForces(this); Models[eMassBalance] = new FGMassBalance(this); Models[eAircraft] = new FGAircraft(this); Models[eAccelerations] = new FGAccelerations(this); // Assign the Model shortcuts for internal executive use only. Propagate = (FGPropagate*)Models[ePropagate]; Inertial = (FGInertial*)Models[eInertial]; Atmosphere = (FGAtmosphere*)Models[eAtmosphere]; Winds = (FGWinds*)Models[eWinds]; Auxiliary = (FGAuxiliary*)Models[eAuxiliary]; FCS = (FGFCS*)Models[eSystems]; Propulsion = (FGPropulsion*)Models[ePropulsion]; Aerodynamics = (FGAerodynamics*)Models[eAerodynamics]; GroundReactions = (FGGroundReactions*)Models[eGroundReactions]; ExternalReactions = (FGExternalReactions*)Models[eExternalReactions]; BuoyantForces = (FGBuoyantForces*)Models[eBuoyantForces]; MassBalance = (FGMassBalance*)Models[eMassBalance]; Aircraft = (FGAircraft*)Models[eAircraft]; Accelerations = (FGAccelerations*)Models[eAccelerations]; // Initialize planet (environment) constants LoadPlanetConstants(); // Initialize models for (unsigned int i = 0; i < Models.size(); i++) { LoadInputs(i); Models[i]->InitModel(); } IC = new FGInitialCondition(this); modelLoaded = false; return result; }
void FGFDMExec::LoadModelConstants(void) { Winds->in.wingspan = Aircraft->GetWingSpan(); FCS->in.NumGear = GroundReactions->GetNumGearUnits(); Aerodynamics->in.Wingarea = Aircraft->GetWingArea(); Aerodynamics->in.Wingchord = Aircraft->Getcbar(); Aerodynamics->in.Wingincidence = Aircraft->GetWingIncidence(); Aerodynamics->in.Wingspan = Aircraft->GetWingSpan(); Auxiliary->in.Wingspan = Aircraft->GetWingSpan(); Auxiliary->in.Wingchord = Aircraft->Getcbar(); GroundReactions->in.vXYZcg = MassBalance->GetXYZcg(); LoadPlanetConstants(); }
void FGFDMExec::LoadModelConstants(void) { Winds->in.wingspan = Aircraft->GetWingSpan(); FCS->in.NumGear = GroundReactions->GetNumGearUnits(); Aerodynamics->in.Wingarea = Aircraft->GetWingArea(); Aerodynamics->in.Wingchord = Aircraft->Getcbar(); Aerodynamics->in.Wingincidence = Aircraft->GetWingIncidence(); Aerodynamics->in.Wingspan = Aircraft->GetWingSpan(); Auxiliary->in.Wingspan = Aircraft->GetWingSpan(); Auxiliary->in.Wingchord = Aircraft->Getcbar(); for (int i=0; i<GroundReactions->GetNumGearUnits(); i++) { GroundReactions->in.vWhlBodyVec[i] = MassBalance->StructuralToBody(GroundReactions->GetGearUnit(i)->GetLocation()); } LoadPlanetConstants(); }
bool FGFDMExec::Allocate(void) { bool result=true; Models.resize(eNumStandardModels); // First build the inertial model since some other models are relying on // the inertial model and the ground callback to build themselves. // Note that this does not affect the order in which the models will be // executed later. Models[eInertial] = new FGInertial(this); SetGroundCallback(new FGDefaultGroundCallback(static_cast<FGInertial*>(Models[eInertial])->GetRefRadius())); // See the eModels enum specification in the header file. The order of the // enums specifies the order of execution. The Models[] vector is the primary // storage array for the list of models. Models[ePropagate] = new FGPropagate(this); Models[eInput] = new FGInput(this); Models[eAtmosphere] = new FGStandardAtmosphere(this); Models[eWinds] = new FGWinds(this); Models[eSystems] = new FGFCS(this); Models[eMassBalance] = new FGMassBalance(this); Models[eAuxiliary] = new FGAuxiliary(this); Models[ePropulsion] = new FGPropulsion(this); Models[eAerodynamics] = new FGAerodynamics (this); Models[eGroundReactions] = new FGGroundReactions(this); Models[eExternalReactions] = new FGExternalReactions(this); Models[eBuoyantForces] = new FGBuoyantForces(this); Models[eAircraft] = new FGAircraft(this); Models[eAccelerations] = new FGAccelerations(this); Models[eOutput] = new FGOutput(this); // Assign the Model shortcuts for internal executive use only. Propagate = (FGPropagate*)Models[ePropagate]; Inertial = (FGInertial*)Models[eInertial]; Atmosphere = (FGAtmosphere*)Models[eAtmosphere]; Winds = (FGWinds*)Models[eWinds]; FCS = (FGFCS*)Models[eSystems]; MassBalance = (FGMassBalance*)Models[eMassBalance]; Auxiliary = (FGAuxiliary*)Models[eAuxiliary]; Propulsion = (FGPropulsion*)Models[ePropulsion]; Aerodynamics = (FGAerodynamics*)Models[eAerodynamics]; GroundReactions = (FGGroundReactions*)Models[eGroundReactions]; ExternalReactions = (FGExternalReactions*)Models[eExternalReactions]; BuoyantForces = (FGBuoyantForces*)Models[eBuoyantForces]; Aircraft = (FGAircraft*)Models[eAircraft]; Accelerations = (FGAccelerations*)Models[eAccelerations]; Output = (FGOutput*)Models[eOutput]; // Initialize planet (environment) constants LoadPlanetConstants(); // Initialize models for (unsigned int i = 0; i < Models.size(); i++) { // The Input/Output models must not be initialized prior to IC loading if (i == eInput || i == eOutput) continue; LoadInputs(i); Models[i]->InitModel(); } IC = new FGInitialCondition(this); IC->bind(instance); modelLoaded = false; return result; }