1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
44 # include <simgear/compiler.h>
45 # include STL_IOSTREAM
48 # if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
49 # include <iostream.h>
57 #include "FGfdmSocket.h"
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63 #define ID_OUTPUT "$Id$"
65 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
71 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75 /** Handles simulation output.
76 OUTPUT section definition
78 The following specifies the way that JSBSim writes out data.
80 NAME is the filename you want the output to go to
83 CSV Comma separated data. If a filename is supplied then the data
84 goes to that file. If COUT or cout is specified, the data goes
85 to stdout. If the filename is a null filename the data goes to
87 SOCKET Will eventually send data to a socket output, where NAME
88 would then be the IP address of the machine the data should be
89 sent to. DON'T USE THIS YET!
90 TABULAR Columnar data. NOT IMPLEMENTED YET!
91 TERMINAL Output to terminal. NOT IMPLEMENTED YET!
92 NONE Specifies to do nothing. THis setting makes it easy to turn on and
93 off the data output without having to mess with anything else.
95 The arguments that can be supplied, currently, are
97 RATE_IN_HZ An integer rate in times-per-second that the data is output. This
98 value may not be *exactly* what you want, due to the dependence
99 on dt, the cycle rate for the FDM.
101 The following parameters tell which subsystems of data to output:
113 GROUND_REACTIONS ON|OFF
117 NOTE that Time is always output with the data.
121 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
125 class FGOutput : public FGModel
128 FGOutput(FGFDMExec*);
133 void DelimitedOutput(string);
134 void SocketOutput(void);
135 void SocketStatusOutput(string);
136 void SetFilename(string fn) {Filename = fn;}
137 void SetType(string);
138 void SetSubsystems(int tt) {SubSystems = tt;}
139 inline void Enable(void) { enabled = true; }
140 inline void Disable(void) { enabled = false; }
141 inline bool Toggle(void) {enabled = !enabled; return enabled;}
142 bool Load(FGConfigFile* AC_cfg);
144 /// Subsystem types for specifying which will be output in the FDM data logging
146 /** Subsystem: Simulation (= 1) */ ssSimulation = 1,
147 /** Subsystem: Aerosurfaces (= 2) */ ssAerosurfaces = 2,
148 /** Subsystem: Body rates (= 4) */ ssRates = 4,
149 /** Subsystem: Velocities (= 8) */ ssVelocities = 8,
150 /** Subsystem: Forces (= 16) */ ssForces = 16,
151 /** Subsystem: Moments (= 32) */ ssMoments = 32,
152 /** Subsystem: Atmosphere (= 64) */ ssAtmosphere = 64,
153 /** Subsystem: Mass Properties (= 128) */ ssMassProps = 128,
154 /** Subsystem: Coefficients (= 256) */ ssCoefficients = 256,
155 /** Subsystem: Propagate (= 512) */ ssPropagate = 512,
156 /** Subsystem: Ground Reactions (= 1024) */ ssGroundReactions = 1024,
157 /** Subsystem: FCS (= 2048) */ ssFCS = 2048,
158 /** Subsystem: Propulsion (= 4096) */ ssPropulsion = 4096
162 bool sFirstPass, dFirstPass, enabled;
164 string Filename, outputInFileName;
165 enum {otNone, otCSV, otTab, otSocket, otTerminal, otUnknown} Type;
168 vector <FGPropertyManager*> OutputProperties;
169 void Debug(int from);
172 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%