Debian Codegraph @

src/FDM/JSBSim/input_output/FGOutputType.h

raw symbols SCIP
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGOutputType.h
4 Author: Bertrand Coconnier
5 Date started: 09/10/11
6
7 ------------- Copyright (C) 2011 Bertrand Coconnier -------------
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 Software
11 Foundation; either version 2 of the License, or (at your option) any later
12 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 with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be found on
24 the world wide web at http://www.gnu.org.
25
26 HISTORY
27 --------------------------------------------------------------------------------
28 09/10/11 BC Created
29
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGOUTPUTTYPE_H
35 #define FGOUTPUTTYPE_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #include "models/FGModel.h"
42
43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 FORWARD DECLARATIONS
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46
47 namespace JSBSim {
48
49 class FGFDMExec;
50 class Element;
51 class FGAerodynamics;
52 class FGAuxiliary;
53 class FGAircraft;
54 class FGWinds;
55 class FGPropulsion;
56 class FGMassBalance;
57 class FGPropagate;
58 class FGAccelerations;
59 class FGFCS;
60 class FGGroundReactions;
61 class FGExternalReactions;
62 class FGBuoyantForces;
63 class FGPropertyValue;
64
65 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 CLASS DOCUMENTATION
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
68
69 /** Abstract class to provide functions generic to all the output directives.
70 This class is used by the output manager FGOutput to manage a list of
71 different output classes without needing to know the details of each one of
72 them. It also provides the functions that are common to all the output
73 classes.
74
75 The class inherits from FGModelFunctions so it is possible to define
76 functions that execute before or after the output is generated. Such
77 functions need to be tagged with a "pre" or "post" type attribute to denote
78 the sequence in which they should be executed.
79
80 The class mimics some functionalities of FGModel (methods InitModel(),
81 Run() and SetRate()). However it does not inherit from FGModel since it is
82 conceptually different from the model paradigm.
83 */
84
85 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86 CLASS DECLARATION
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
88
89 class FGOutputType : public FGModel
90 {
91 public:
92 /** Constructor (implement the FGModel interface).
93 @param fdmex a pointer to the parent executive object
94 */
95 FGOutputType(FGFDMExec* fdmex);
96
97 /// Destructor
98 ~FGOutputType() override;
99
100 /** Set the idx for this output instance
101 @param idx ID of the output instance that is constructed
102 */
103 void SetIdx(unsigned int idx);
104
105 /** Set the output rate for this output instances.
106 @param rtHz new output rate in Hz */
107 void SetRateHz(double rtHz);
108
109 /// Get the output rate in Hz for this output.
110 double GetRateHz(void) const;
111
112 /** Set the activated subsystems for this output instance.
113 @param subSystems bitfield that describes the activated subsystems
114 @param outputProperties list of properties that should be output
115 */
116 void SetSubSystems(int subSystems) { SubSystems = subSystems; }
117
118 /** Set the list of properties that should be output for this output instance.
119 @param outputProperties list of properties that should be output
120 */
121 void SetOutputProperties(std::vector<FGPropertyNode_ptr> & outputProperties);
122
123 /** Overwrites the name identifier under which the output will be logged.
124 This method is taken into account if it is called before
125 FGFDMExec::RunIC() otherwise it is ignored until the next call to
126 SetStartNewOutput().
127 @param name new name */
128 virtual void SetOutputName(const std::string& name) { Name = name; }
129
130 /** Get the name identifier to which the output will be directed.
131 @result the name identifier.*/
132 virtual const std::string& GetOutputName(void) const { return Name; }
133
134 /** Init the output directives from an XML file (implement the FGModel interface).
135 @param element XML Element that is pointing to the output directives
136 */
137 bool Load(Element* el) override;
138
139 /// Init the output model according to its configitation.
140 bool InitModel(void) override;
141
142 /** Executes the output directives (implement the FGModel interface).
143 This method checks that the current time step matches the output
144 rate and calls the registered "pre" functions, the output
145 generation and finally the "post" functions.
146 @result false if no error.
147 */
148 bool Run(void);
149
150 /** Generate the output. This is a pure method so it must be implemented by
151 the classes that inherits from FGOutputType. The Print name may not be
152 relevant to all outputs but it has been kept for backward compatibility.
153 */
154 virtual void Print(void) = 0;
155
156 /** Reset the output prior to a restart of the simulation. This method should
157 be called when the simulation is restarted with, for example, new initial
158 conditions. When this method is executed the output instance can take
159 special actions such as closing the current output file and open a new
160 one with a different name. */
161
162 virtual void SetStartNewOutput(void) {}
163
164 /// Enables the output generation.
165 void Enable(void) { enabled = true; }
166 /// Disables the output generation.
167 void Disable(void) { enabled = false; }
168 /** Toggles the output generation.
169 @result the output generation status i.e. true if the output has been
170 enabled, false if the output has been disabled. */
171 bool Toggle(void) {enabled = !enabled; return enabled;}
172
173 /// Subsystem types for specifying which will be output in the FDM data logging
174 enum eSubSystems {
175 /** Subsystem: Simulation (= 1) */ ssSimulation = 1,
176 /** Subsystem: Aerosurfaces (= 2) */ ssAerosurfaces = 2,
177 /** Subsystem: Body rates (= 4) */ ssRates = 4,
178 /** Subsystem: Velocities (= 8) */ ssVelocities = 8,
179 /** Subsystem: Forces (= 16) */ ssForces = 16,
180 /** Subsystem: Moments (= 32) */ ssMoments = 32,
181 /** Subsystem: Atmosphere (= 64) */ ssAtmosphere = 64,
182 /** Subsystem: Mass Properties (= 128) */ ssMassProps = 128,
183 /** Subsystem: Coefficients (= 256) */ ssAeroFunctions = 256,
184 /** Subsystem: Propagate (= 512) */ ssPropagate = 512,
185 /** Subsystem: Ground Reactions (= 1024) */ ssGroundReactions = 1024,
186 /** Subsystem: FCS (= 2048) */ ssFCS = 2048,
187 /** Subsystem: Propulsion (= 4096) */ ssPropulsion = 4096
188 } subsystems;
189
190 protected:
191 unsigned int OutputIdx;
192 int SubSystems;
193 std::vector <FGPropertyValue*> OutputParameters;
194 std::vector <std::string> OutputCaptions;
195 bool enabled;
196
197 FGAerodynamics* Aerodynamics;
198 FGAuxiliary* Auxiliary;
199 FGAircraft* Aircraft;
200 FGWinds* Winds;
201 FGPropulsion* Propulsion;
202 FGMassBalance* MassBalance;
203 FGPropagate* Propagate;
204 FGAccelerations* Accelerations;
205 FGFCS* FCS;
206 FGGroundReactions* GroundReactions;
207 FGExternalReactions* ExternalReactions;
208 FGBuoyantForces* BuoyantForces;
209
210 void Debug(int from) override;
211 };
212 }
213 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
214 #endif