JSBSim Flight Dynamics Model 1.2.2 (22 Mar 2025)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGOutputTextFile Class Reference

Detailed Description

Implements the output to a human readable text file.

This class uses the standard C++ library to open and close a file to which output values are comma-separated (CSV) or tabulated (TAB).

Definition at line 65 of file FGOutputTextFile.h.

#include <FGOutputTextFile.h>

+ Inheritance diagram for FGOutputTextFile:
+ Collaboration diagram for FGOutputTextFile:

Public Member Functions

 FGOutputTextFile (FGFDMExec *fdmex)
 Constructor.
 
bool Load (Element *el) override
 Init the output directives from an XML file.
 
void Print (void) override
 Generates the output to the text file.
 
void SetDelimiter (const std::string &delim)
 Set the delimiter.
 
- Public Member Functions inherited from FGOutputFile
 FGOutputFile (FGFDMExec *fdmex)
 Constructor.
 
 ~FGOutputFile () override
 Destructor : closes the file.
 
bool InitModel (void) override
 Initializes the instance.
 
void SetOutputName (const std::string &fname) override
 Overwrites the name identifier under which the output will be logged.
 
void SetStartNewOutput (void) override
 Reset the output prior to a restart of the simulation.
 
- Public Member Functions inherited from FGOutputType
 FGOutputType (FGFDMExec *fdmex)
 Constructor (implement the FGModel interface).
 
 ~FGOutputType () override
 Destructor.
 
void Disable (void)
 Disables the output generation.
 
void Enable (void)
 Enables the output generation.
 
virtual const std::string & GetOutputName (void) const
 Get the name identifier to which the output will be directed.
 
double GetRateHz (void) const
 Get the output rate in Hz for this output.
 
bool InitModel (void) override
 Init the output model according to its configitation.
 
bool Load (Element *el) override
 Init the output directives from an XML file (implement the FGModel interface).
 
bool Run (bool Holding) override
 Executes the output directives (implement the FGModel interface).
 
void SetIdx (unsigned int idx)
 Set the idx for this output instance.
 
void SetOutputProperties (std::vector< FGPropertyNode_ptr > &outputProperties)
 Set the list of properties that should be output for this output instance.
 
void SetRateHz (double rtHz)
 Set the output rate for this output instances.
 
void SetSubSystems (int subSystems)
 Set the activated subsystems for this output instance.
 
bool Toggle (void)
 Toggles the output generation.
 
- Public Member Functions inherited from FGModel
 FGModel (FGFDMExec *)
 Constructor.
 
 ~FGModel () override
 Destructor.
 
virtual SGPath FindFullPathName (const SGPath &path) const
 
FGFDMExecGetExec (void)
 
const std::string & GetName (void)
 
unsigned int GetRate (void)
 Get the output rate for the model in frames.
 
void SetPropertyManager (std::shared_ptr< FGPropertyManager > fgpm)
 
void SetRate (unsigned int tt)
 Set the ouput rate for the model in frames.
 
- Public Member Functions inherited from FGModelFunctions
std::string GetFunctionStrings (const std::string &delimeter) const
 Gets the strings for the current set of functions.
 
std::string GetFunctionValues (const std::string &delimeter) const
 Gets the function values.
 
std::shared_ptr< FGFunctionGetPreFunction (const std::string &name)
 Get one of the "pre" function.
 
bool Load (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void PostLoad (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void PreLoad (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void RunPostFunctions (void)
 
void RunPreFunctions (void)
 
- Public Member Functions inherited from FGJSBBase
 FGJSBBase ()
 Constructor for FGJSBBase.
 
virtual ~FGJSBBase ()
 Destructor for FGJSBBase.
 
void disableHighLighting (void)
 Disables highlighting in the console output.
 

Protected Member Functions

void CloseFile (void) override
 Closes the file.
 
bool OpenFile (void) override
 Opens the file.
 
- Protected Member Functions inherited from FGOutputType
void Debug (int from) override
 
- Protected Member Functions inherited from FGModel
bool Upload (Element *el, bool preLoad)
 Uploads this model in memory.
 

Protected Attributes

sg_ofstream datafile
 
std::string delimeter
 
- Protected Attributes inherited from FGOutputFile
SGPath Filename
 
- Protected Attributes inherited from FGOutputType
std::shared_ptr< FGAccelerationsAccelerations
 
std::shared_ptr< FGAerodynamicsAerodynamics
 
std::shared_ptr< FGAircraftAircraft
 
std::shared_ptr< FGAuxiliaryAuxiliary
 
std::shared_ptr< FGBuoyantForcesBuoyantForces
 
bool enabled
 
std::shared_ptr< FGExternalReactionsExternalReactions
 
std::shared_ptr< FGFCSFCS
 
std::shared_ptr< FGGroundReactionsGroundReactions
 
std::shared_ptr< FGMassBalanceMassBalance
 
std::vector< std::string > OutputCaptions
 
unsigned int OutputIdx
 
std::vector< FGPropertyValue * > OutputParameters
 
std::shared_ptr< FGPropagatePropagate
 
std::shared_ptr< FGPropulsionPropulsion
 
int SubSystems
 
std::shared_ptr< FGWindsWinds
 
- Protected Attributes inherited from FGModel
unsigned int exe_ctr
 
FGFDMExecFDMExec
 
std::string Name
 
std::shared_ptr< FGPropertyManagerPropertyManager
 
unsigned int rate
 
- Protected Attributes inherited from FGModelFunctions
FGPropertyReader LocalProperties
 
std::vector< std::shared_ptr< FGFunction > > PostFunctions
 
std::vector< std::shared_ptr< FGFunction > > PreFunctions
 

Additional Inherited Members

- Public Types inherited from FGOutputType
enum  eSubSystems {
  ssSimulation = 1 , ssAerosurfaces = 2 , ssRates = 4 , ssVelocities = 8 ,
  ssForces = 16 , ssMoments = 32 , ssAtmosphere = 64 , ssMassProps = 128 ,
  ssAeroFunctions = 256 , ssPropagate = 512 , ssGroundReactions = 1024 , ssFCS = 2048 ,
  ssPropulsion = 4096
}
 Subsystem types for specifying which will be output in the FDM data logging. More...
 
- Public Types inherited from FGJSBBase
enum  { eL = 1 , eM , eN }
 Moments L, M, N. More...
 
enum  { eP = 1 , eQ , eR }
 Rates P, Q, R. More...
 
enum  { eU = 1 , eV , eW }
 Velocities U, V, W. More...
 
enum  { eX = 1 , eY , eZ }
 Positions X, Y, Z. More...
 
enum  { ePhi = 1 , eTht , ePsi }
 Euler angles Phi, Theta, Psi. More...
 
enum  { eDrag = 1 , eSide , eLift }
 Stability axis forces, Drag, Side force, Lift. More...
 
enum  { eRoll = 1 , ePitch , eYaw }
 Local frame orientation Roll, Pitch, Yaw. More...
 
enum  { eNorth = 1 , eEast , eDown }
 Local frame position North, East, Down. More...
 
enum  { eLat = 1 , eLong , eRad }
 Locations Radius, Latitude, Longitude. More...
 
enum  {
  inNone = 0 , inDegrees , inRadians , inMeters ,
  inFeet
}
 Conversion specifiers. More...
 
- Static Public Member Functions inherited from FGJSBBase
static const std::string & GetVersion (void)
 Returns the version number of JSBSim.
 
static constexpr double KelvinToFahrenheit (double kelvin)
 Converts from degrees Kelvin to degrees Fahrenheit.
 
static constexpr double CelsiusToRankine (double celsius)
 Converts from degrees Celsius to degrees Rankine.
 
static constexpr double RankineToCelsius (double rankine)
 Converts from degrees Rankine to degrees Celsius.
 
static constexpr double KelvinToRankine (double kelvin)
 Converts from degrees Kelvin to degrees Rankine.
 
static constexpr double RankineToKelvin (double rankine)
 Converts from degrees Rankine to degrees Kelvin.
 
static constexpr double FahrenheitToCelsius (double fahrenheit)
 Converts from degrees Fahrenheit to degrees Celsius.
 
static constexpr double CelsiusToFahrenheit (double celsius)
 Converts from degrees Celsius to degrees Fahrenheit.
 
static constexpr double CelsiusToKelvin (double celsius)
 Converts from degrees Celsius to degrees Kelvin.
 
static constexpr double KelvinToCelsius (double kelvin)
 Converts from degrees Kelvin to degrees Celsius.
 
static constexpr double FeetToMeters (double measure)
 Converts from feet to meters.
 
static bool EqualToRoundoff (double a, double b)
 Finite precision comparison.
 
static bool EqualToRoundoff (float a, float b)
 Finite precision comparison.
 
static bool EqualToRoundoff (float a, double b)
 Finite precision comparison.
 
static bool EqualToRoundoff (double a, float b)
 Finite precision comparison.
 
static constexpr double Constrain (double min, double value, double max)
 Constrain a value between a minimum and a maximum value.
 
static constexpr double sign (double num)
 
- Public Attributes inherited from FGOutputType
enum JSBSim::FGOutputType::eSubSystems subsystems
 
- Static Public Attributes inherited from FGJSBBase
static char highint [5] = {27, '[', '1', 'm', '\0' }
 highlights text
 
static char halfint [5] = {27, '[', '2', 'm', '\0' }
 low intensity text
 
static char normint [6] = {27, '[', '2', '2', 'm', '\0' }
 normal intensity text
 
static char reset [5] = {27, '[', '0', 'm', '\0' }
 resets text properties
 
static char underon [5] = {27, '[', '4', 'm', '\0' }
 underlines text
 
static char underoff [6] = {27, '[', '2', '4', 'm', '\0' }
 underline off
 
static char fgblue [6] = {27, '[', '3', '4', 'm', '\0' }
 blue text
 
static char fgcyan [6] = {27, '[', '3', '6', 'm', '\0' }
 cyan text
 
static char fgred [6] = {27, '[', '3', '1', 'm', '\0' }
 red text
 
static char fggreen [6] = {27, '[', '3', '2', 'm', '\0' }
 green text
 
static char fgdef [6] = {27, '[', '3', '9', 'm', '\0' }
 default text
 
static short debug_lvl = 1
 
- Static Protected Member Functions inherited from FGJSBBase
static std::string CreateIndexedPropertyName (const std::string &Property, int index)
 
- Static Protected Attributes inherited from FGJSBBase
static constexpr double radtodeg = 180. / M_PI
 
static constexpr double degtorad = M_PI / 180.
 
static constexpr double hptoftlbssec = 550.0
 
static constexpr double psftoinhg = 0.014138
 
static constexpr double psftopa = 47.88
 
static constexpr double fttom = 0.3048
 
static constexpr double ktstofps = 1852./(3600*fttom)
 
static constexpr double fpstokts = 1.0 / ktstofps
 
static constexpr double inchtoft = 1.0/12.0
 
static constexpr double m3toft3 = 1.0/(fttom*fttom*fttom)
 
static constexpr double in3tom3 = inchtoft*inchtoft*inchtoft/m3toft3
 
static constexpr double inhgtopa = 3386.38
 
static constexpr double slugtolb = 32.174049
 Note that definition of lbtoslug by the inverse of slugtolb and not to a different constant you can also get from some tables will make lbtoslug*slugtolb == 1 up to the magnitude of roundoff.
 
static constexpr double lbtoslug = 1.0/slugtolb
 
static constexpr double kgtolb = 2.20462
 
static constexpr double kgtoslug = 0.06852168
 
static const std::string needed_cfg_version = "2.0"
 
static const std::string JSBSim_version = JSBSIM_VERSION " " __DATE__ " " __TIME__
 

Constructor & Destructor Documentation

◆ FGOutputTextFile()

FGOutputTextFile ( FGFDMExec fdmex)
inline

Constructor.

Definition at line 69 of file FGOutputTextFile.h.

69: FGOutputFile(fdmex), delimeter(",") {}
FGOutputFile(FGFDMExec *fdmex)
Constructor.

Member Function Documentation

◆ CloseFile()

void CloseFile ( void  )
inlineoverrideprotectedvirtual

Closes the file.

Reimplemented from FGOutputFile.

Definition at line 90 of file FGOutputTextFile.h.

90{ if (datafile.is_open()) datafile.close(); }

◆ Load()

bool Load ( Element el)
overridevirtual

Init the output directives from an XML file.

Parameters
elementXML Element that is pointing to the output directives

Reimplemented from FGOutputFile.

Definition at line 65 of file FGOutputTextFile.cpp.

66{
67 if(!FGOutputFile::Load(el))
68 return false;
69
70 string type = el->GetAttributeValue("type");
71 string delim;
72 if (type == "TABULAR") {
73 delim = "\t";
74 } else {
75 delim = ",";
76 }
77
78 SetDelimiter(delim);
79
80 return true;
81}
bool Load(Element *el) override
Init the output directives from an XML file.
void SetDelimiter(const std::string &delim)
Set the delimiter.
+ Here is the call graph for this function:

◆ OpenFile()

bool OpenFile ( void  )
overrideprotectedvirtual

Opens the file.

Implements FGOutputFile.

Definition at line 85 of file FGOutputTextFile.cpp.

86{
87 datafile.clear();
88 datafile.open(Filename);
89 if (!datafile) {
90 cerr << endl << fgred << highint << "ERROR: unable to open the file "
91 << reset << Filename.c_str() << endl
92 << fgred << highint << " => Output to this file is disabled."
93 << reset << endl << endl;
94 Disable();
95 return false;
96 }
97
98 string scratch = "";
99 streambuf* buffer = datafile.rdbuf();
100 ostream outstream(buffer);
101
102 outstream.precision(10);
103
104 outstream << "Time";
105 if (SubSystems & ssSimulation) {
106 // Nothing here, yet
107 }
108 if (SubSystems & ssAerosurfaces) {
109 outstream << delimeter;
110 outstream << "Aileron Command (norm)" + delimeter;
111 outstream << "Elevator Command (norm)" + delimeter;
112 outstream << "Rudder Command (norm)" + delimeter;
113 outstream << "Flap Command (norm)" + delimeter;
114 outstream << "Left Aileron Position (deg)" + delimeter;
115 outstream << "Right Aileron Position (deg)" + delimeter;
116 outstream << "Elevator Position (deg)" + delimeter;
117 outstream << "Rudder Position (deg)" + delimeter;
118 outstream << "Flap Position (deg)";
119 }
120 if (SubSystems & ssRates) {
121 outstream << delimeter;
122 outstream << "P (deg/s)" + delimeter + "Q (deg/s)" + delimeter + "R (deg/s)" + delimeter;
123 outstream << "P dot (deg/s^2)" + delimeter + "Q dot (deg/s^2)" + delimeter + "R dot (deg/s^2)" + delimeter;
124 outstream << "P_{inertial} (deg/s)" + delimeter + "Q_{inertial} (deg/s)" + delimeter + "R_{inertial} (deg/s)";
125 }
126 if (SubSystems & ssVelocities) {
127 outstream << delimeter;
128 outstream << "q bar (psf)" + delimeter;
129 outstream << "Reynolds Number" + delimeter;
130 outstream << "V_{Total} (ft/s)" + delimeter;
131 outstream << "V_{Inertial} (ft/s)" + delimeter;
132 outstream << "UBody" + delimeter + "VBody" + delimeter + "WBody" + delimeter;
133 outstream << "UdotBody" + delimeter + "VdotBody" + delimeter + "WdotBody" + delimeter;
134 outstream << "UdotBody_i" + delimeter + "VdotBody_i" + delimeter + "WdotBody_i" + delimeter;
135 outstream << "BodyAccel_X" + delimeter + "BodyAccel_Y" + delimeter + "BodyAccel_Z" + delimeter;
136 outstream << "Aero V_{X Body} (ft/s)" + delimeter + "Aero V_{Y Body} (ft/s)" + delimeter + "Aero V_{Z Body} (ft/s)" + delimeter;
137 outstream << "V_{X_{inertial}} (ft/s)" + delimeter + "V_{Y_{inertial}} (ft/s)" + delimeter + "V_{Z_{inertial}} (ft/s)" + delimeter;
138 outstream << "V_{X_{ecef}} (ft/s)" + delimeter + "V_{Y_{ecef}} (ft/s)" + delimeter + "V_{Z_{ecef}} (ft/s)" + delimeter;
139 outstream << "V_{North} (ft/s)" + delimeter + "V_{East} (ft/s)" + delimeter + "V_{Down} (ft/s)";
140 }
141 if (SubSystems & ssForces) {
142 outstream << delimeter;
143 outstream << "F_{Drag} (lbs)" + delimeter + "F_{Side} (lbs)" + delimeter + "F_{Lift} (lbs)" + delimeter;
144 outstream << "L/D" + delimeter;
145 outstream << "F_{Aero x} (lbs)" + delimeter + "F_{Aero y} (lbs)" + delimeter + "F_{Aero z} (lbs)" + delimeter;
146 outstream << "F_{Prop x} (lbs)" + delimeter + "F_{Prop y} (lbs)" + delimeter + "F_{Prop z} (lbs)" + delimeter;
147 outstream << "F_{Gear x} (lbs)" + delimeter + "F_{Gear y} (lbs)" + delimeter + "F_{Gear z} (lbs)" + delimeter;
148 outstream << "F_{Ext x} (lbs)" + delimeter + "F_{Ext y} (lbs)" + delimeter + "F_{Ext z} (lbs)" + delimeter;
149 outstream << "F_{Buoyant x} (lbs)" + delimeter + "F_{Buoyant y} (lbs)" + delimeter + "F_{Buoyant z} (lbs)" + delimeter;
150 outstream << "F_{Weight x} (lbs)" + delimeter + "F_{Weight y} (lbs)" + delimeter + "F_{Weight z} (lbs)" + delimeter;
151 outstream << "F_{Total x} (lbs)" + delimeter + "F_{Total y} (lbs)" + delimeter + "F_{Total z} (lbs)";
152 }
153 if (SubSystems & ssMoments) {
154 outstream << delimeter;
155 outstream << "L_{Aero} (ft-lbs)" + delimeter + "M_{Aero} (ft-lbs)" + delimeter + "N_{Aero} (ft-lbs)" + delimeter;
156 outstream << "L_{Aero MRC} (ft-lbs)" + delimeter + "M_{Aero MRC} (ft-lbs)" + delimeter + "N_{Aero MRC} (ft-lbs)" + delimeter;
157 outstream << "L_{Prop} (ft-lbs)" + delimeter + "M_{Prop} (ft-lbs)" + delimeter + "N_{Prop} (ft-lbs)" + delimeter;
158 outstream << "L_{Gear} (ft-lbs)" + delimeter + "M_{Gear} (ft-lbs)" + delimeter + "N_{Gear} (ft-lbs)" + delimeter;
159 outstream << "L_{ext} (ft-lbs)" + delimeter + "M_{ext} (ft-lbs)" + delimeter + "N_{ext} (ft-lbs)" + delimeter;
160 outstream << "L_{Buoyant} (ft-lbs)" + delimeter + "M_{Buoyant} (ft-lbs)" + delimeter + "N_{Buoyant} (ft-lbs)" + delimeter;
161 outstream << "L_{Total} (ft-lbs)" + delimeter + "M_{Total} (ft-lbs)" + delimeter + "N_{Total} (ft-lbs)";
162 }
163 if (SubSystems & ssAtmosphere) {
164 outstream << delimeter;
165 outstream << "Rho (slugs/ft^3)" + delimeter;
166 outstream << "Absolute Viscosity" + delimeter;
167 outstream << "Kinematic Viscosity" + delimeter;
168 outstream << "Temperature (R)" + delimeter;
169 outstream << "P_{SL} (psf)" + delimeter;
170 outstream << "P_{Ambient} (psf)" + delimeter;
171 outstream << "Turbulence Magnitude (ft/sec)" + delimeter;
172 outstream << "Turbulence X Direction (deg)" + delimeter;
173 outstream << "Wind V_{North} (ft/s)" + delimeter + "Wind V_{East} (ft/s)" + delimeter + "Wind V_{Down} (ft/s)" + delimeter;
174 outstream << "Roll Turbulence (deg/sec)" + delimeter + "Pitch Turbulence (deg/sec)" + delimeter + "Yaw Turbulence (deg/sec)";
175 }
176 if (SubSystems & ssMassProps) {
177 outstream << delimeter;
178 outstream << "I_{xx}" + delimeter;
179 outstream << "I_{xy}" + delimeter;
180 outstream << "I_{xz}" + delimeter;
181 outstream << "I_{yx}" + delimeter;
182 outstream << "I_{yy}" + delimeter;
183 outstream << "I_{yz}" + delimeter;
184 outstream << "I_{zx}" + delimeter;
185 outstream << "I_{zy}" + delimeter;
186 outstream << "I_{zz}" + delimeter;
187 outstream << "Mass" + delimeter;
188 outstream << "Weight" + delimeter;
189 outstream << "X_{cg}" + delimeter + "Y_{cg}" + delimeter + "Z_{cg}";
190 }
191 if (SubSystems & ssPropagate) {
192 outstream << delimeter;
193 outstream << "Altitude ASL (ft)" + delimeter;
194 outstream << "Altitude AGL (ft)" + delimeter;
195 outstream << "Phi (deg)" + delimeter + "Theta (deg)" + delimeter + "Psi (deg)" + delimeter;
196 outstream << "Q(1)_{LOCAL}" + delimeter + "Q(2)_{LOCAL}" + delimeter + "Q(3)_{LOCAL}" + delimeter + "Q(4)_{LOCAL}" + delimeter;
197 outstream << "Q(1)_{ECEF}" + delimeter + "Q(2)_{ECEF}" + delimeter + "Q(3)_{ECEF}" + delimeter + "Q(4)_{ECEF}" + delimeter;
198 outstream << "Q(1)_{ECI}" + delimeter + "Q(2)_{ECI}" + delimeter + "Q(3)_{ECI}" + delimeter + "Q(4)_{ECI}" + delimeter;
199 outstream << "Alpha (deg)" + delimeter;
200 outstream << "Beta (deg)" + delimeter;
201 outstream << "Latitude (deg)" + delimeter;
202 outstream << "Latitude Geodetic (deg)" + delimeter;
203 outstream << "Longitude (deg)" + delimeter;
204 outstream << "X_{ECI} (ft)" + delimeter + "Y_{ECI} (ft)" + delimeter + "Z_{ECI} (ft)" + delimeter;
205 outstream << "X_{ECEF} (ft)" + delimeter + "Y_{ECEF} (ft)" + delimeter + "Z_{ECEF} (ft)" + delimeter;
206 outstream << "Earth Position Angle (deg)" + delimeter;
207 outstream << "Distance AGL (ft)" + delimeter;
208 outstream << "Terrain Elevation (ft)";
209 }
210 if (SubSystems & ssAeroFunctions) {
211 scratch = Aerodynamics->GetAeroFunctionStrings(delimeter);
212 if (scratch.length() != 0) outstream << delimeter << scratch;
213 }
214 if (SubSystems & ssFCS) {
215 scratch = FCS->GetComponentStrings(delimeter);
216 if (scratch.length() != 0) outstream << delimeter << scratch;
217 }
218 if (SubSystems & ssGroundReactions) {
219 outstream << delimeter;
220 outstream << GroundReactions->GetGroundReactionStrings(delimeter);
221 }
222 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
223 outstream << delimeter;
224 outstream << Propulsion->GetPropulsionStrings(delimeter);
225 }
226
227 for (unsigned int i=0;i<OutputParameters.size();++i) {
228 if (!OutputCaptions[i].empty())
229 outstream << delimeter << OutputCaptions[i];
230 else
231 outstream << delimeter << OutputParameters[i]->GetFullyQualifiedName();
232 }
233
234 if (!PreFunctions.empty()) {
235 for (unsigned int i=0;i<PreFunctions.size();i++) {
236 outstream << delimeter << PreFunctions[i]->GetName();
237 }
238 }
239
240 outstream << endl;
241 outstream.flush();
242
243 return true;
244}
static char fgred[6]
red text
Definition FGJSBBase.h:166
static char reset[5]
resets text properties
Definition FGJSBBase.h:156
static char highint[5]
highlights text
Definition FGJSBBase.h:150
void Disable(void)
Disables the output generation.
@ ssPropulsion
Subsystem: Propulsion (= 4096)
@ ssForces
Subsystem: Forces (= 16)
@ ssAtmosphere
Subsystem: Atmosphere (= 64)
@ ssPropagate
Subsystem: Propagate (= 512)
@ ssGroundReactions
Subsystem: Ground Reactions (= 1024)
@ ssFCS
Subsystem: FCS (= 2048)
@ ssMoments
Subsystem: Moments (= 32)
@ ssRates
Subsystem: Body rates (= 4)
@ ssVelocities
Subsystem: Velocities (= 8)
@ ssAerosurfaces
Subsystem: Aerosurfaces (= 2)
@ ssMassProps
Subsystem: Mass Properties (= 128)
@ ssSimulation
Subsystem: Simulation (= 1)
@ ssAeroFunctions
Subsystem: Coefficients (= 256)
+ Here is the call graph for this function:

◆ Print()

void Print ( void  )
overridevirtual

Generates the output to the text file.

Implements FGOutputFile.

Definition at line 248 of file FGOutputTextFile.cpp.

249{
250 streambuf* buffer;
251 string scratch = Filename.utf8Str();
252
253 if (to_upper(scratch) == "COUT") {
254 buffer = cout.rdbuf();
255 } else {
256 buffer = datafile.rdbuf();
257 }
258
259 ostream outstream(buffer);
260
261 outstream.precision(10);
262
263 outstream << FDMExec->GetSimTime();
264 if (SubSystems & ssSimulation) {
265 }
266 if (SubSystems & ssAerosurfaces) {
267 outstream << delimeter;
268 outstream << FCS->GetDaCmd() << delimeter;
269 outstream << FCS->GetDeCmd() << delimeter;
270 outstream << FCS->GetDrCmd() << delimeter;
271 outstream << FCS->GetDfCmd() << delimeter;
272 outstream << FCS->GetDaLPos(ofDeg) << delimeter;
273 outstream << FCS->GetDaRPos(ofDeg) << delimeter;
274 outstream << FCS->GetDePos(ofDeg) << delimeter;
275 outstream << FCS->GetDrPos(ofDeg) << delimeter;
276 outstream << FCS->GetDfPos(ofDeg);
277 }
278 if (SubSystems & ssRates) {
279 outstream << delimeter;
280 outstream << (radtodeg*Propagate->GetPQR()).Dump(delimeter) << delimeter;
281 outstream << (radtodeg*Accelerations->GetPQRdot()).Dump(delimeter) << delimeter;
282 outstream << (radtodeg*Propagate->GetPQRi()).Dump(delimeter);
283 }
284 if (SubSystems & ssVelocities) {
285 outstream << delimeter;
286 outstream << Auxiliary->Getqbar() << delimeter;
287 outstream << Auxiliary->GetReynoldsNumber() << delimeter;
288 outstream << setprecision(12) << Auxiliary->GetVt() << delimeter;
289 outstream << Propagate->GetInertialVelocityMagnitude() << delimeter;
290 outstream << setprecision(12) << Propagate->GetUVW().Dump(delimeter) << delimeter;
291 outstream << setprecision(12) << Accelerations->GetUVWdot().Dump(delimeter) << delimeter;
292 outstream << setprecision(12) << Accelerations->GetUVWidot().Dump(delimeter) << delimeter;
293 outstream << setprecision(12) << Accelerations->GetBodyAccel().Dump(delimeter) << delimeter;
294 outstream << Auxiliary->GetAeroUVW().Dump(delimeter) << delimeter;
295 outstream << Propagate->GetInertialVelocity().Dump(delimeter) << delimeter;
296 outstream << Propagate->GetECEFVelocity().Dump(delimeter) << delimeter;
297 outstream << Propagate->GetVel().Dump(delimeter);
298 outstream.precision(10);
299 }
300 if (SubSystems & ssForces) {
301 outstream << delimeter;
302 outstream << Aerodynamics->GetvFw().Dump(delimeter) << delimeter;
303 outstream << Aerodynamics->GetLoD() << delimeter;
304 outstream << Aerodynamics->GetForces().Dump(delimeter) << delimeter;
305 outstream << Propulsion->GetForces().Dump(delimeter) << delimeter;
306 outstream << Accelerations->GetGroundForces().Dump(delimeter) << delimeter;
307 outstream << ExternalReactions->GetForces().Dump(delimeter) << delimeter;
308 outstream << BuoyantForces->GetForces().Dump(delimeter) << delimeter;
309 outstream << Accelerations->GetWeight().Dump(delimeter) << delimeter;
310 outstream << Accelerations->GetForces().Dump(delimeter);
311 }
312 if (SubSystems & ssMoments) {
313 outstream << delimeter;
314 outstream << Aerodynamics->GetMoments().Dump(delimeter) << delimeter;
315 outstream << Aerodynamics->GetMomentsMRC().Dump(delimeter) << delimeter;
316 outstream << Propulsion->GetMoments().Dump(delimeter) << delimeter;
317 outstream << Accelerations->GetGroundMoments().Dump(delimeter) << delimeter;
318 outstream << ExternalReactions->GetMoments().Dump(delimeter) << delimeter;
319 outstream << BuoyantForces->GetMoments().Dump(delimeter) << delimeter;
320 outstream << Accelerations->GetMoments().Dump(delimeter);
321 }
322 if (SubSystems & ssAtmosphere) {
323 const auto Atmosphere = FDMExec->GetAtmosphere();
324 outstream << delimeter;
325 outstream << Atmosphere->GetDensity() << delimeter;
326 outstream << Atmosphere->GetAbsoluteViscosity() << delimeter;
327 outstream << Atmosphere->GetKinematicViscosity() << delimeter;
328 outstream << Atmosphere->GetTemperature() << delimeter;
329 outstream << Atmosphere->GetPressureSL() << delimeter;
330 outstream << Atmosphere->GetPressure() << delimeter;
331 outstream << Winds->GetTurbMagnitude() << delimeter;
332 outstream << Winds->GetTurbDirection() << delimeter;
333 outstream << Winds->GetTotalWindNED().Dump(delimeter) << delimeter;
334 outstream << (Winds->GetTurbPQR()*radtodeg).Dump(delimeter);
335 }
336 if (SubSystems & ssMassProps) {
337 outstream << delimeter;
338 outstream << MassBalance->GetJ().Dump(delimeter) << delimeter;
339 outstream << MassBalance->GetMass() << delimeter;
340 outstream << MassBalance->GetWeight() << delimeter;
341 outstream << MassBalance->GetXYZcg().Dump(delimeter);
342 }
343 if (SubSystems & ssPropagate) {
344 outstream.precision(14);
345 outstream << delimeter;
346 outstream << Propagate->GetAltitudeASL() << delimeter;
347 outstream << Propagate->GetDistanceAGL() << delimeter;
348 outstream << (radtodeg*Propagate->GetEuler()).Dump(delimeter) << delimeter;
349 outstream << Propagate->GetQuaternion().Dump(delimeter) << delimeter;
350 FGQuaternion Qec = Propagate->GetQuaternionECEF();
351 outstream << Qec.Dump(delimeter) << delimeter;
352 outstream << Propagate->GetQuaternionECI().Dump(delimeter) << delimeter;
353 outstream << Auxiliary->Getalpha(inDegrees) << delimeter;
354 outstream << Auxiliary->Getbeta(inDegrees) << delimeter;
355 outstream << Propagate->GetLatitudeDeg() << delimeter;
356 outstream << Propagate->GetGeodLatitudeDeg() << delimeter;
357 outstream << Propagate->GetLongitudeDeg() << delimeter;
358 outstream.precision(18);
359 outstream << ((FGColumnVector3)Propagate->GetInertialPosition()).Dump(delimeter) << delimeter;
360 outstream << ((FGColumnVector3)Propagate->GetLocation()).Dump(delimeter) << delimeter;
361 outstream.precision(14);
362 outstream << Propagate->GetEarthPositionAngleDeg() << delimeter;
363 outstream << Propagate->GetDistanceAGL() << delimeter;
364 outstream << Propagate->GetTerrainElevation();
365 outstream.precision(10);
366 }
367 if (SubSystems & ssAeroFunctions) {
368 scratch = Aerodynamics->GetAeroFunctionValues(delimeter);
369 if (scratch.length() != 0) outstream << delimeter << scratch;
370 }
371 if (SubSystems & ssFCS) {
372 scratch = FCS->GetComponentValues(delimeter);
373 if (scratch.length() != 0) outstream << delimeter << scratch;
374 }
375 if (SubSystems & ssGroundReactions) {
376 outstream << delimeter;
377 outstream << GroundReactions->GetGroundReactionValues(delimeter);
378 }
379 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
380 outstream << delimeter;
381 outstream << Propulsion->GetPropulsionValues(delimeter);
382 }
383
384 outstream.precision(18);
385 for (unsigned int i=0;i<OutputParameters.size();++i) {
386 outstream << delimeter << OutputParameters[i]->GetValue();
387 }
388 for (unsigned int i=0;i<PreFunctions.size();i++) {
389 outstream << delimeter << PreFunctions[i]->getDoubleValue();
390 }
391 outstream.precision(10);
392
393 outstream << endl;
394 outstream.flush();
395}
double GetSimTime(void) const
Returns the cumulative simulation time in seconds.
Definition FGFDMExec.h:549
+ Here is the call graph for this function:

◆ SetDelimiter()

void SetDelimiter ( const std::string &  delim)
inline

Set the delimiter.

Parameters
delimdelimiter of the output values (most likely a comma or a tab)

Definition at line 75 of file FGOutputTextFile.h.

75{ delimeter = delim; }
+ Here is the caller graph for this function:

Member Data Documentation

◆ datafile

sg_ofstream datafile
protected

Definition at line 87 of file FGOutputTextFile.h.

◆ delimeter

std::string delimeter
protected

Definition at line 86 of file FGOutputTextFile.h.


The documentation for this class was generated from the following files: