X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGOutput.h;h=e22dc1319f80f7b40b74fa6d28180a386d553569;hb=416ba93a417c4cadde025ba4d7bbcce71d613372;hp=7126624a24ba5e9fc84c75b024bd444e56d7126e;hpb=3ec74d79c23347add2afa088b05ad29af975f65f;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGOutput.h b/src/FDM/JSBSim/models/FGOutput.h index 7126624a2..e22dc1319 100644 --- a/src/FDM/JSBSim/models/FGOutput.h +++ b/src/FDM/JSBSim/models/FGOutput.h @@ -4,7 +4,7 @@ Author: Jon Berndt Date started: 12/2/98 - ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) ------------- + ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -26,6 +26,7 @@ HISTORY -------------------------------------------------------------------------------- 12/02/98 JSB Created +11/09/07 HDW Added FlightGear Socket Interface %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SENTRY @@ -40,28 +41,17 @@ INCLUDES #include "FGModel.h" -#ifdef FGFS -# include -# include STL_IOSTREAM -# include STL_FSTREAM -#else -# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740) -# include -# include -# else -# include -# include -# endif -#endif +#include -#include -#include +#include "input_output/FGXMLFileRead.h" +#include "input_output/net_fdm.hxx" +#include "input_output/FGfdmSocket.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_OUTPUT "$Id$" +#define ID_OUTPUT "$Id: FGOutput.h,v 1.22 2011/03/11 13:02:26 jberndt Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -69,6 +59,8 @@ FORWARD DECLARATIONS namespace JSBSim { +class FGfdmSocket; + /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DOCUMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -77,23 +69,39 @@ CLASS DOCUMENTATION OUTPUT section definition The following specifies the way that JSBSim writes out data. - +
     NAME is the filename you want the output to go to
 
     TYPE can be:
-      CSV       Comma separated data. If a filename is supplied then the data
-                goes to that file. If COUT or cout is specified, the data goes
-                to stdout. If the filename is a null filename the data goes to
-                stdout, as well.
-      SOCKET    Will eventually send data to a socket output, where NAME
-                would then be the IP address of the machine the data should be
-                sent to. DON'T USE THIS YET!
-      TABULAR   Columnar data. NOT IMPLEMENTED YET!
-      TERMINAL  Output to terminal. NOT IMPLEMENTED YET!
-      NONE      Specifies to do nothing. THis setting makes it easy to turn on and
-                off the data output without having to mess with anything else.
-
-    The arguments that can be supplied, currently, are
+      CSV         Comma separated data. If a filename is supplied then the
+                  data goes to that file. If "COUT" or "cout" is specified, the
+                  data goes to stdout. If the filename is a null filename the
+                  data goes to stdout, as well.
+      SOCKET      Will eventually send data to a socket output, where NAME
+                  would then be the IP address of the machine the data should
+                  be sent to. DON'T USE THIS YET!
+      FLIGHTGEAR  A socket is created for sending binary data packets to
+                  an external instance of FlightGear for visuals.  Parameters
+                  defining the socket are given on the \ line.
+      TABULAR     Columnar data.
+      TERMINAL    Output to terminal. NOT IMPLEMENTED YET!
+      NONE        Specifies to do nothing. This setting makes it easy to turn on and
+                  off the data output without having to mess with anything else.
+
+      Examples:
+
+@code + +@endcode +@code + + velocities/vc-kts + ON + +@endcode +
+
+    The arguments that can be supplied, currently, are:
 
     RATE_IN_HZ  An integer rate in times-per-second that the data is output. This
                 value may not be *exactly* what you want, due to the dependence
@@ -101,47 +109,57 @@ CLASS DOCUMENTATION
 
     The following parameters tell which subsystems of data to output:
 
-    SIMULATION       ON|OFF
-    ATMOSPHERE       ON|OFF
-    MASSPROPS        ON|OFF
-    AEROSURFACES     ON|OFF
-    RATES            ON|OFF
-    VELOCITIES       ON|OFF
-    FORCES           ON|OFF
-    MOMENTS          ON|OFF
-    POSITION         ON|OFF
-    COEFFICIENTS     ON|OFF
-    GROUND_REACTIONS ON|OFF
-    FCS              ON|OFF
-    PROPULSION       ON|OFF
-
+    simulation       ON|OFF
+    atmosphere       ON|OFF
+    massprops        ON|OFF
+    aerosurfaces     ON|OFF
+    rates            ON|OFF
+    velocities       ON|OFF
+    forces           ON|OFF
+    moments          ON|OFF
+    position         ON|OFF
+    coefficients     ON|OFF
+    ground_reactions ON|OFF
+    fcs              ON|OFF
+    propulsion       ON|OFF
+
NOTE that Time is always output with the data. - @version $Id$ + @version $Id: FGOutput.h,v 1.22 2011/03/11 13:02:26 jberndt Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -class FGOutput : public FGModel +class FGOutput : public FGModel, public FGXMLFileRead { public: FGOutput(FGFDMExec*); ~FGOutput(); + bool InitModel(void); bool Run(void); - void DelimitedOutput(string); + void Print(void); + void DelimitedOutput(const std::string&); void SocketOutput(void); - void SocketStatusOutput(string); - void SetType(string); + void FlightGearSocketOutput(void); + void SocketStatusOutput(const std::string&); + void SocketDataFill(FGNetFDM* net); + + void SetType(const std::string& type); + void SetProtocol(const std::string& protocol); + void SetPort(const std::string& port); + void SetStartNewFile(bool tt) {StartNewFile = tt;} void SetSubsystems(int tt) {SubSystems = tt;} - inline void Enable(void) { enabled = true; } - inline void Disable(void) { enabled = false; } - inline bool Toggle(void) {enabled = !enabled; return enabled;} + void SetOutputFileName(const std::string& fname) {Filename = fname;} + void SetDirectivesFile(const std::string& fname) {DirectivesFile = fname;} + void SetRate(double rt); + void Enable(void) { enabled = true; } + void Disable(void) { enabled = false; } + bool Toggle(void) {enabled = !enabled; return enabled;} + bool Load(Element* el); - void SetOutputFileName(string fname) {Filename = fname;} - void SetDirectivesFile(string fname) {DirectivesFile = fname;} string GetOutputFileName(void) const {return Filename;} /// Subsystem types for specifying which will be output in the FDM data logging @@ -154,21 +172,27 @@ public: /** Subsystem: Moments (= 32) */ ssMoments = 32, /** Subsystem: Atmosphere (= 64) */ ssAtmosphere = 64, /** Subsystem: Mass Properties (= 128) */ ssMassProps = 128, - /** Subsystem: Coefficients (= 256) */ ssCoefficients = 256, + /** Subsystem: Coefficients (= 256) */ ssAeroFunctions = 256, /** Subsystem: Propagate (= 512) */ ssPropagate = 512, /** Subsystem: Ground Reactions (= 1024) */ ssGroundReactions = 1024, /** Subsystem: FCS (= 2048) */ ssFCS = 2048, /** Subsystem: Propulsion (= 4096) */ ssPropulsion = 4096 } subsystems; + FGNetFDM fgSockBuf; + private: - enum {otNone, otCSV, otTab, otSocket, otTerminal, otUnknown} Type; + enum {otNone, otCSV, otTab, otSocket, otTerminal, otFlightGear, otUnknown} Type; + FGfdmSocket::ProtocolType Protocol; bool sFirstPass, dFirstPass, enabled; int SubSystems; - string output_file_name, delimeter, Filename, DirectivesFile; - ofstream datafile; + int runID_postfix; + bool StartNewFile; + std::string output_file_name, delimeter, BaseFilename, Filename, DirectivesFile; + std::string Port; + std::ofstream datafile; FGfdmSocket* socket; - vector OutputProperties; + std::vector OutputProperties; void Debug(int from); };