42 #include "FGFDMExec.h" 43 #include "FGOutputType.h" 44 #include "input_output/FGXMLElement.h" 45 #include "input_output/FGPropertyManager.h" 49 IDENT(IdSrc,
"$Id: FGOutputType.cpp,v 1.17 2015/08/23 09:43:31 bcoconni Exp $");
50 IDENT(IdHdr,ID_OUTPUTTYPE);
66 Atmosphere = FDMExec->GetAtmosphere();
84 OutputProperties.clear();
92 string outputProp = CreateIndexedPropertyName(
"simulation/output", idx);
95 PropertyManager->
Tie(outputProp +
"/enabled", &enabled);
132 while (property_element) {
133 string property_str = property_element->
GetDataLine();
136 cerr <<
fgred <<
highint << endl <<
" No property by the name " 137 << property_str <<
" has been defined. This property will " << endl
138 <<
" not be logged. You should check your configuration file." 141 OutputProperties.push_back(node);
145 OutputCaptions.push_back(
"");
151 double outRate = 1.0;
164 bool ret = FGModel::InitModel();
175 if (!enabled)
return true;
190 rtHz = rtHz>1000?1000:(rtHz<0?0:rtHz);
204 return 1.0 / (rate * FDMExec->
GetDeltaT());
226 void FGOutputType::Debug(
int from)
228 if (debug_lvl <= 0)
return;
235 if (SubSystems &
ssSimulation) cout <<
" Simulation parameters logged" << endl;
236 if (SubSystems &
ssAerosurfaces) cout <<
" Aerosurface parameters logged" << endl;
237 if (SubSystems &
ssRates) cout <<
" Rate parameters logged" << endl;
238 if (SubSystems &
ssVelocities) cout <<
" Velocity parameters logged" << endl;
239 if (SubSystems &
ssForces) cout <<
" Force parameters logged" << endl;
240 if (SubSystems &
ssMoments) cout <<
" Moments parameters logged" << endl;
241 if (SubSystems &
ssAtmosphere) cout <<
" Atmosphere parameters logged" << endl;
242 if (SubSystems &
ssMassProps) cout <<
" Mass parameters logged" << endl;
243 if (SubSystems &
ssAeroFunctions) cout <<
" Coefficient parameters logged" << endl;
244 if (SubSystems &
ssPropagate) cout <<
" Propagate parameters logged" << endl;
246 if (SubSystems &
ssFCS) cout <<
" FCS parameters logged" << endl;
247 if (SubSystems &
ssPropulsion) cout <<
" Propulsion parameters logged" << endl;
248 if (OutputProperties.size() > 0) cout <<
" Properties logged:" << endl;
249 for (
unsigned int i=0;i<OutputProperties.size();i++) {
250 cout <<
" - " << OutputProperties[i]->GetName() << endl;
254 if (debug_lvl & 2 ) {
255 if (from == 0) cout <<
"Instantiated: FGOutputType" << endl;
256 if (from == 1) cout <<
"Destroyed: FGOutputType" << endl;
258 if (debug_lvl & 4 ) {
260 if (debug_lvl & 8 ) {
262 if (debug_lvl & 16) {
264 if (debug_lvl & 64) {
266 cout << IdSrc << endl;
267 cout << IdHdr << endl;
Subsystem: Propagate (= 512)
FGAccelerations * GetAccelerations(void)
Returns the FGAccelerations pointer.
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
virtual bool InitModel(void)
Init the output model according to its configitation.
bool HasAttribute(const std::string &key)
Determines if an element has the supplied attribute.
Class wrapper for property handling.
FGAuxiliary * GetAuxiliary(void)
Returns the FGAuxiliary pointer.
static char reset[5]
resets text properties
Subsystem: Aerosurfaces (= 2)
Subsystem: Simulation (= 1)
virtual void Print(void)=0
Generate the output.
Element * FindElement(const std::string &el="")
Searches for a specified element.
Subsystem: Velocities (= 8)
static char fgred[6]
red text
double GetRateHz(void) const
Get the output rate in Hz for this output.
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
void SetRateHz(double rtHz)
Set the output rate for this output instances.
void SetRate(unsigned int tt)
Set the ouput rate for the model in frames.
void Enable(void)
Enables the output generation.
FGExternalReactions * GetExternalReactions(void)
Returns the FGExternalReactions pointer.
FGBuoyantForces * GetBuoyantForces(void)
Returns the FGBuoyantForces pointer.
Subsystem: Atmosphere (= 64)
void Tie(const std::string &name, bool *pointer, bool useDefault=true)
Tie a property to an external bool variable.
FGWinds * GetWinds(void)
Returns the FGWinds pointer.
FGAircraft * GetAircraft(void)
Returns the FGAircraft pointer.
double GetAttributeValueAsNumber(const std::string &key)
Retrieves an attribute value as a double precision real number.
FGGroundReactions * GetGroundReactions(void)
Returns the FGGroundReactions pointer.
std::string FindElementValue(const std::string &el="")
Searches for the named element and returns the string data belonging to it.
Base class for all scheduled JSBSim models.
virtual bool Load(Element *el)
Init the output directives from an XML file (implement the FGModel interface).
bool Run(void)
Executes the output directives (implement the FGModel interface).
std::string GetDataLine(unsigned int i=0)
Gets a line of data belonging to an element.
FGOutputType(FGFDMExec *fdmex)
Constructor (implement the FGModel interface).
Subsystem: Moments (= 32)
FGFCS * GetFCS(void)
Returns the FGFCS pointer.
void SetIdx(unsigned int idx)
Set the idx for this output instance.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
static char highint[5]
highlights text
Subsystem: Ground Reactions (= 1024)
double GetDeltaT(void) const
Returns the simulation delta T.
FGAerodynamics * GetAerodynamics(void)
Returns the FGAerodynamics pointer.
FGPropulsion * GetPropulsion(void)
Returns the FGPropulsion pointer.
Subsystem: Mass Properties (= 128)
virtual ~FGOutputType()
Destructor.
Encapsulates the JSBSim simulation executive.
Subsystem: Body rates (= 4)
Subsystem: Coefficients (= 256)
Subsystem: Propulsion (= 4096)
void Disable(void)
Disables the output generation.
FGPropagate * GetPropagate(void)
Returns the FGPropagate pointer.
FGMassBalance * GetMassBalance(void)
Returns the FGAircraft pointer.