2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
Header: FGOutput.h
|
|
|
|
Author: Jon Berndt
|
|
|
|
Date started: 12/2/98
|
|
|
|
|
|
|
|
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Further information about the GNU General Public License can also be found on
|
|
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
12/02/98 JSB Created
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
SENTRY
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
#ifndef FGOUTPUT_H
|
|
|
|
#define FGOUTPUT_H
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
INCLUDES
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
#include "FGModel.h"
|
|
|
|
|
1999-09-07 23:15:45 +00:00
|
|
|
#ifdef FGFS
|
2000-02-15 03:30:01 +00:00
|
|
|
# include <simgear/compiler.h>
|
2001-06-05 20:58:48 +00:00
|
|
|
# include STL_IOSTREAM
|
|
|
|
# include STL_FSTREAM
|
1999-09-07 23:15:45 +00:00
|
|
|
#else
|
2001-10-05 20:19:59 +00:00
|
|
|
# if defined(sgi) && !defined(__GNUC__)
|
|
|
|
# include <iostream.h>
|
|
|
|
# include <fstream.h>
|
|
|
|
# else
|
|
|
|
# include <iostream>
|
|
|
|
# include <fstream>
|
|
|
|
# endif
|
1999-09-07 23:15:45 +00:00
|
|
|
#endif
|
|
|
|
|
1999-12-20 20:24:49 +00:00
|
|
|
#include "FGfdmSocket.h"
|
1999-05-08 03:19:08 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
#define ID_OUTPUT "$Id$"
|
2000-10-14 02:10:10 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
CLASS DECLARATION
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2003-01-24 12:55:28 +00:00
|
|
|
namespace JSBSim {
|
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
class FGOutput : public FGModel
|
|
|
|
{
|
|
|
|
public:
|
1999-02-11 21:05:34 +00:00
|
|
|
FGOutput(FGFDMExec*);
|
2001-03-30 01:04:50 +00:00
|
|
|
~FGOutput();
|
1999-02-11 21:05:34 +00:00
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
bool Run(void);
|
1999-02-11 21:05:34 +00:00
|
|
|
|
1999-09-07 23:15:45 +00:00
|
|
|
void DelimitedOutput(string);
|
1999-12-20 20:24:49 +00:00
|
|
|
void SocketOutput(void);
|
|
|
|
void SocketStatusOutput(string);
|
2000-05-02 18:25:30 +00:00
|
|
|
void SetFilename(string fn) {Filename = fn;}
|
|
|
|
void SetType(string);
|
|
|
|
void SetSubsystems(int tt) {SubSystems = tt;}
|
2000-10-02 23:07:30 +00:00
|
|
|
inline void Enable(void) { enabled = true; }
|
|
|
|
inline void Disable(void) { enabled = false; }
|
2001-04-05 15:39:37 +00:00
|
|
|
inline bool Toggle(void) {enabled = !enabled; return enabled;}
|
2001-11-20 22:34:24 +00:00
|
|
|
bool Load(FGConfigFile* AC_cfg);
|
|
|
|
|
|
|
|
/// Subsystem types for specifying which will be output in the FDM data logging
|
2002-01-03 21:04:49 +00:00
|
|
|
enum eSubSystems {
|
2001-11-20 22:34:24 +00:00
|
|
|
/** Subsystem: Simulation (= 1) */ ssSimulation = 1,
|
|
|
|
/** Subsystem: Aerosurfaces (= 2) */ ssAerosurfaces = 2,
|
|
|
|
/** Subsystem: Body rates (= 4) */ ssRates = 4,
|
|
|
|
/** Subsystem: Velocities (= 8) */ ssVelocities = 8,
|
|
|
|
/** Subsystem: Forces (= 16) */ ssForces = 16,
|
|
|
|
/** Subsystem: Moments (= 32) */ ssMoments = 32,
|
|
|
|
/** Subsystem: Atmosphere (= 64) */ ssAtmosphere = 64,
|
|
|
|
/** Subsystem: Mass Properties (= 128) */ ssMassProps = 128,
|
|
|
|
/** Subsystem: Coefficients (= 256) */ ssCoefficients = 256,
|
|
|
|
/** Subsystem: Position (= 512) */ ssPosition = 512,
|
|
|
|
/** Subsystem: Ground Reactions (= 1024) */ ssGroundReactions = 1024,
|
|
|
|
/** Subsystem: FCS (= 2048) */ ssFCS = 2048,
|
|
|
|
/** Subsystem: Propulsion (= 4096) */ ssPropulsion = 4096
|
|
|
|
} subsystems;
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
private:
|
2000-10-02 23:07:30 +00:00
|
|
|
bool sFirstPass, dFirstPass, enabled;
|
2000-05-02 18:25:30 +00:00
|
|
|
int SubSystems;
|
2003-03-23 15:12:35 +00:00
|
|
|
string Filename, outputInFileName;
|
2000-05-02 18:25:30 +00:00
|
|
|
enum {otNone, otCSV, otTab, otSocket, otTerminal, otUnknown} Type;
|
1999-09-07 23:15:45 +00:00
|
|
|
ofstream datafile;
|
1999-12-20 20:24:49 +00:00
|
|
|
FGfdmSocket* socket;
|
2003-03-23 15:12:35 +00:00
|
|
|
vector <FGPropertyManager*> OutputProperties;
|
2001-12-13 04:48:34 +00:00
|
|
|
void Debug(int from);
|
1999-02-05 21:26:01 +00:00
|
|
|
};
|
2003-01-24 12:55:28 +00:00
|
|
|
}
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
#endif
|
|
|
|
|