 |
JSBSim Flight Dynamics Model
1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
|
42 #include "FGFDMExec.h"
43 #include "FGOutputType.h"
44 #include "input_output/FGXMLElement.h"
45 #include "input_output/FGPropertyManager.h"
46 #include "math/FGTemplateFunc.h"
47 #include "math/FGFunctionValue.h"
65 Atmosphere = FDMExec->GetAtmosphere();
83 for (
auto param: OutputParameters)
93 string outputProp = CreateIndexedPropertyName(
"simulation/output", idx);
96 PropertyManager->
Tie(outputProp +
"/enabled", &enabled);
133 while (property_element) {
134 string property_str = property_element->
GetDataLine();
137 cerr << property_element->
ReadFrom()
138 <<
fgred <<
highint << endl <<
" No property by the name "
139 << property_str <<
" has been defined. This property will " << endl
140 <<
" not be logged. You should check your configuration file."
149 cerr << property_element->
ReadFrom()
151 << function_str <<
" has been defined. This property will "
152 <<
"not be logged. You should check your configuration file."
162 OutputCaptions.push_back(
"");
167 double outRate = 1.0;
180 bool ret = FGModel::InitModel();
191 if (!enabled)
return true;
206 rtHz = rtHz>1000?1000:(rtHz<0?0:rtHz);
220 return 1.0 / (rate * FDMExec->
GetDeltaT());
227 for (
auto prop: outputProperties)
251 void FGOutputType::Debug(
int from)
253 if (debug_lvl <= 0)
return;
259 if (SubSystems &
ssSimulation) cout <<
" Simulation parameters logged" << endl;
260 if (SubSystems &
ssAerosurfaces) cout <<
" Aerosurface parameters logged" << endl;
261 if (SubSystems &
ssRates) cout <<
" Rate parameters logged" << endl;
262 if (SubSystems &
ssVelocities) cout <<
" Velocity parameters logged" << endl;
263 if (SubSystems &
ssForces) cout <<
" Force parameters logged" << endl;
264 if (SubSystems &
ssMoments) cout <<
" Moments parameters logged" << endl;
265 if (SubSystems &
ssAtmosphere) cout <<
" Atmosphere parameters logged" << endl;
266 if (SubSystems &
ssMassProps) cout <<
" Mass parameters logged" << endl;
267 if (SubSystems &
ssAeroFunctions) cout <<
" Coefficient parameters logged" << endl;
268 if (SubSystems &
ssPropagate) cout <<
" Propagate parameters logged" << endl;
270 if (SubSystems &
ssFCS) cout <<
" FCS parameters logged" << endl;
271 if (SubSystems &
ssPropulsion) cout <<
" Propulsion parameters logged" << endl;
272 if (!OutputParameters.empty()) cout <<
" Properties logged:" << endl;
273 for (
auto param: OutputParameters)
274 cout <<
" - " << param->GetName() << endl;
277 if (debug_lvl & 2 ) {
278 if (from == 0) cout <<
"Instantiated: FGOutputType" << endl;
279 if (from == 1) cout <<
"Destroyed: FGOutputType" << endl;
281 if (debug_lvl & 4 ) {
283 if (debug_lvl & 8 ) {
285 if (debug_lvl & 16) {
287 if (debug_lvl & 64) {
@ ssMoments
Subsystem: Moments (= 32)
Encapsulates the JSBSim simulation executive.
Represents a property value on which a function is applied.
@ ssAeroFunctions
Subsystem: Coefficients (= 256)
double GetRateHz(void) const
Get the output rate in Hz for this output.
void Enable(void)
Enables the output generation.
Base class for all scheduled JSBSim models.
bool HasAttribute(const std::string &key)
Determines if an element has the supplied attribute.
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
virtual void Print(void)=0
Generate the output.
Element * FindElement(const std::string &el="")
Searches for a specified element.
@ ssAtmosphere
Subsystem: Atmosphere (= 64)
FGAircraft * GetAircraft(void)
Returns the FGAircraft pointer.
void Disable(void)
Disables the output generation.
bool InitModel(void) override
Init the output model according to its configitation.
FGGroundReactions * GetGroundReactions(void)
Returns the FGGroundReactions pointer.
FGAuxiliary * GetAuxiliary(void)
Returns the FGAuxiliary pointer.
Class wrapper for property handling.
@ ssPropagate
Subsystem: Propagate (= 512)
void SetIdx(unsigned int idx)
Set the idx for this output instance.
@ ssMassProps
Subsystem: Mass Properties (= 128)
FGWinds * GetWinds(void)
Returns the FGWinds pointer.
void SetOutputProperties(std::vector< FGPropertyNode_ptr > &outputProperties)
Set the list of properties that should be output for this output instance.
static char fgred[6]
red text
FGPropagate * GetPropagate(void)
Returns the FGPropagate pointer.
@ ssRates
Subsystem: Body rates (= 4)
Represents a property value which can use late binding.
FGMassBalance * GetMassBalance(void)
Returns the FGAircraft pointer.
@ ssForces
Subsystem: Forces (= 16)
@ ssFCS
Subsystem: FCS (= 2048)
std::string FindElementValue(const std::string &el="")
Searches for the named element and returns the string data belonging to it.
static char reset[5]
resets text properties
FGAerodynamics * GetAerodynamics(void)
Returns the FGAerodynamics pointer.
@ ssPropulsion
Subsystem: Propulsion (= 4096)
double GetDeltaT(void) const
Returns the simulation delta T.
FGPropulsion * GetPropulsion(void)
Returns the FGPropulsion pointer.
void SetRate(unsigned int tt)
Set the ouput rate for the model in frames.
std::string GetDataLine(unsigned int i=0)
Gets a line of data belonging to an element.
double GetAttributeValueAsNumber(const std::string &key)
Retrieves an attribute value as a double precision real number.
FGFCS * GetFCS(void)
Returns the FGFCS pointer.
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
~FGOutputType() override
Destructor.
@ ssAerosurfaces
Subsystem: Aerosurfaces (= 2)
@ ssGroundReactions
Subsystem: Ground Reactions (= 1024)
@ ssSimulation
Subsystem: Simulation (= 1)
FGExternalReactions * GetExternalReactions(void)
Returns the FGExternalReactions pointer.
void SetRateHz(double rtHz)
Set the output rate for this output instances.
std::string ReadFrom(void) const
Return a string that contains a description of the location where the current XML element was read fr...
static char highint[5]
highlights text
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
bool Run(void)
Executes the output directives (implement the FGModel interface).
FGAccelerations * GetAccelerations(void)
Returns the FGAccelerations pointer.
FGBuoyantForces * GetBuoyantForces(void)
Returns the FGBuoyantForces pointer.
bool Load(Element *el) override
Init the output directives from an XML file (implement the FGModel interface).
@ ssVelocities
Subsystem: Velocities (= 8)
void Tie(const std::string &name, T *pointer)
Tie a property to an external variable.