JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
FGOutput.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGOutput.h
4  Author: Jon Berndt
5  Date started: 12/2/98
6 
7  ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
8 
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free
11  Software Foundation; either version 2 of the License, or (at your option) any
12  later version.
13 
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 Lesser General Public License for more
17  details.
18 
19  You should have received a copy of the GNU Lesser General Public License along
20  with this program; if not, write to the Free Software Foundation, Inc., 59
21  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be
24  found on the world wide web at http://www.gnu.org.
25 
26 HISTORY
27 --------------------------------------------------------------------------------
28 12/02/98 JSB Created
29 11/09/07 HDW Added FlightGear Socket Interface
30 09/10/11 BC Broke Down the Code in Several Classes
31 
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
33 SENTRY
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
35 
36 #ifndef FGOUTPUT_H
37 #define FGOUTPUT_H
38 
39 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 INCLUDES
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42 
43 #include "FGModel.h"
44 #include "input_output/FGOutputType.h"
45 
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 FORWARD DECLARATIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49 
50 namespace JSBSim {
51 
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 CLASS DOCUMENTATION
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55 
121 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 CLASS DECLARATION
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
124 
125 class FGOutput : public FGModel
126 {
127 public:
129  ~FGOutput() override;
130 
137  bool InitModel(void) override;
146  bool Run(bool Holding) override;
152  void Print(void);
158  void ForceOutput(int idx);
164  void SetStartNewOutput(void);
172  bool SetOutputName(unsigned int idx, const std::string& name);
178  bool SetDirectivesFile(const SGPath& fname);
180  void Enable(void) { enabled = true; }
182  void Disable(void) { enabled = false; }
189  bool Toggle(int idx);
192  void SetRateHz(double rate);
198  bool Load(Element* el, const SGPath& dir = SGPath());
211  bool Load(int subSystems, std::string protocol, std::string type,
212  std::string port, std::string name, double outRate,
213  std::vector<FGPropertyNode_ptr> & outputProperties);
218  std::string GetOutputName(unsigned int idx) const;
219 
220  SGPath FindFullPathName(const SGPath& path) const override;
221 
222 private:
223  std::vector<FGOutputType*> OutputTypes;
224  bool enabled;
225  SGPath includePath;
226 
227  void Debug(int from) override;
228 };
229 }
230 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
231 #endif
JSBSim::FGFDMExec
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:185
JSBSim::FGModel
Base class for all scheduled JSBSim models.
Definition: FGModel.h:68
JSBSim::FGOutput::Print
void Print(void)
Makes all the output instances to generate their ouput.
Definition: FGOutput.cpp:109
JSBSim::FGOutput::ForceOutput
void ForceOutput(int idx)
Force an output instance to generate its output.
Definition: FGOutput.cpp:143
JSBSim::FGOutput::Load
bool Load(Element *el, const SGPath &dir=SGPath())
Load the output directives and adds a new output instance to the Output Manager list.
Definition: FGOutput.cpp:238
JSBSim::FGOutput::SetDirectivesFile
bool SetDirectivesFile(const SGPath &fname)
Adds a new output instance to the Output Manager.
Definition: FGOutput.cpp:172
JSBSim::FGOutput::GetOutputName
std::string GetOutputName(unsigned int idx) const
Get the name identifier to which the output will be directed.
Definition: FGOutput.cpp:161
JSBSim::FGOutput::SetStartNewOutput
void SetStartNewOutput(void)
Reset the output prior to a restart of the simulation.
Definition: FGOutput.cpp:117
JSBSim::FGOutput::InitModel
bool InitModel(void) override
Initializes the instance.
Definition: FGOutput.cpp:80
JSBSim::FGOutput::Disable
void Disable(void)
Disables the output generation for all output instances.
Definition: FGOutput.h:182
JSBSim::FGOutput
Handles simulation output.
Definition: FGOutput.h:125
JSBSim::FGOutput::SetOutputName
bool SetOutputName(unsigned int idx, const std::string &name)
Overwrites the name identifier under which the output will be logged.
Definition: FGOutput.cpp:151
JSBSim::FGOutput::Enable
void Enable(void)
Enables the output generation for all output instances.
Definition: FGOutput.h:180
JSBSim::FGOutput::SetRateHz
void SetRateHz(double rate)
Modifies the output rate for all output instances.
Definition: FGOutput.cpp:135
JSBSim::FGOutput::Run
bool Run(bool Holding) override
Runs the Output model; called by the Executive.
Definition: FGOutput.cpp:94
JSBSim::FGOutput::Toggle
bool Toggle(int idx)
Toggles the output generation of each ouput instance.
Definition: FGOutput.cpp:125
JSBSim::Element
Definition: FGXMLElement.h:143