X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGOutput.h;h=fe8ac1137e618010c9f3ebf7c2653c16a15a3d02;hb=1575fad886a0b18825363d41d53a287e8d36b9c8;hp=8b3d1403c74c787e3fc7f27467c00072d6e93145;hpb=cf25f69d3639c2e4c821ff7f8ed62b80e8ff495b;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGOutput.h b/src/FDM/JSBSim/models/FGOutput.h index 8b3d1403c..fe8ac1137 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 @@ -41,19 +41,17 @@ INCLUDES #include "FGModel.h" -#include #include -#include "input_output/FGfdmSocket.h" #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.25 2012/02/07 23:15:37 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -61,6 +59,8 @@ FORWARD DECLARATIONS namespace JSBSim { +class FGfdmSocket; + /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DOCUMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -83,7 +83,7 @@ CLASS DOCUMENTATION 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. NOT IMPLEMENTED YET! + 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. @@ -91,13 +91,13 @@ CLASS DOCUMENTATION Examples: @code - + @endcode @code - - velocities/vc-kts - ON - + + velocities/vc-kts + ON + @endcode
@@ -124,7 +124,7 @@ CLASS DOCUMENTATION
     propulsion       ON|OFF
 
NOTE that Time is always output with the data. - @version $Id$ + @version $Id: FGOutput.h,v 1.25 2012/02/07 23:15:37 bcoconni Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -138,25 +138,38 @@ public: ~FGOutput(); bool InitModel(void); - bool Run(void); - - void DelimitedOutput(string); + /** Runs the Output model; called by the Executive + Can pass in a value indicating if the executive is directing the simulation to Hold. + @param Holding if true, the executive has been directed to hold the sim from + advancing time. Some models may ignore this flag, such as the Input + model, which may need to be active to listen on a socket for the + "Resume" command to be given. + @return false if no error */ + bool Run(bool Holding); + + void Print(void); + void DelimitedOutput(const std::string&); void SocketOutput(void); void FlightGearSocketOutput(void); - void SocketStatusOutput(string); + void SocketStatusOutput(const std::string&); void SocketDataFill(FGNetFDM* net); - - void SetType(string); + 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;} + 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;} - void SetRate(int rt); + bool Load(int subSystems, std::string protocol, std::string type, std::string port, + std::string name, double outRate, + std::vector & outputProperties); string GetOutputFileName(void) const {return Filename;} /// Subsystem types for specifying which will be output in the FDM data logging @@ -169,27 +182,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, otFlightGear, otUnknown} Type; + FGfdmSocket::ProtocolType Protocol; bool sFirstPass, dFirstPass, enabled; int SubSystems; int runID_postfix; bool StartNewFile; - string output_file_name, delimeter, BaseFilename, Filename, DirectivesFile; - ofstream datafile; + std::string output_file_name, delimeter, BaseFilename, Filename, DirectivesFile; + std::string Port; + std::ofstream datafile; FGfdmSocket* socket; - FGfdmSocket* flightGearSocket; - vector OutputProperties; + std::vector OutputProperties; void Debug(int from); };