JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGTrimAnalysisControl.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGTrimAnalysisControl.h
4  Author: Agostino De Marco
5  Date started: Dec/14/2006
6 
7  ------------- Copyright (C) 2006 Agostino De Marco (agodemar@unina.it) -------
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 
27  HISTORY
28 --------------------------------------------------------------------------------
29 12/14/06 ADM Created
30 
31 
32 FUNCTIONAL DESCRIPTION
33 --------------------------------------------------------------------------------
34 
35 
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 SENTRY
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39 
40 #ifndef FGTRIMANALYSISCONTROL_H
41 #define FGTRIMANALYSISCONTROL_H
42 
43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 INCLUDES
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46 
47 #include <string>
48 
49 #include "FGFDMExec.h"
50 #include "FGJSBBase.h"
51 #include "initialization/FGInitialCondition.h"
52 
53 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 DEFINITIONS
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56 
57 #define ID_TRIMANALYSISCONTROL "$Id: FGTrimAnalysisControl.h,v 1.2 2009/10/02 10:30:09 jberndt Exp $"
58 
59 #define DEFAULT_TRIM_ANALYSIS_TOLERANCE 0.00000001
60 
61 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 FORWARD DECLARATIONS
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
64 
65 namespace JSBSim {
66 
67 class FGInitialCondition;
68 
72 enum TaState { taAll,taUdot,taVdot,taWdot,taQdot,taPdot,taRdot,taHmgt,taNlf };
76 enum TaControl { taThrottle = 0,
77  taPitchTrim, taRollTrim, taYawTrim,
78  taElevator, taAileron, taRudder,
79  taPhi, taTheta, taHeading,
80  taGamma, taAltAGL, taBeta, taAlpha};
81 
82 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 CLASS DOCUMENTATION
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
85 
89 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
90 CLASS DECLARATION
91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
92 
94 {
95 public:
101  FGInitialCondition *IC,
102  //State state,
103  TaControl control );
106 
109  void Run(void);
110 
111  //double GetState(void) { getState(); return state_value; }
112  //Accels are not settable
113 
117  inline void SetControl(double value ) { control_value=value; }
118 
122  inline double GetControl(void) { return control_value; }
123 
124  //inline State GetStateType(void) { return state; }
128  inline TaControl GetControlType(void) { return control; }
129 
130  //inline string GetStateName(void) { return StateNames[state]; }
131 
135  inline string GetControlName(void) { return control_name; }
136 
140  inline double GetControlMin(void) { return control_min; }
141 inline double GetControlMax(void) { return control_max; }
145 
149  inline void SetControlStep(double value) { control_step = value; }
153  inline double GetControlStep(void) { return control_step; }
154 
158  inline void SetControlInitialValue(double value) { control_initial_value = value; }
159 
163  inline double GetControlInitialValue(void) { return control_initial_value; }
164 
167  inline void SetControlToMin(void) { control_value=control_min; }
168 
171  inline void SetControlToMax(void) { control_value=control_max; }
172 
177  inline void SetControlLimits(double min, double max) {
178  control_min=min;
179  control_max=max;
180  }
181 
185  inline void SetTolerance(double ff) { control_tolerance=ff;}
186 
190  inline double GetTolerance(void) { return control_tolerance; }
191 
195  void SetThetaOnGround(double ff);
196 
200  void SetPhiOnGround(double ff);
201 
205  inline void SetStateTarget(double target) { state_target=target; }
206 
210  inline double GetStateTarget(void) { return state_target; }
211 
215  bool initTheta(void);
216 
217 private:
218  FGFDMExec *fdmex;
219  FGInitialCondition *fgic;
220 
221  TaState state;
222  TaControl control;
223 
224  string control_name;
225 
226  double state_target;
227 
228  double state_value;
229  double control_value;
230 
231  double control_min;
232  double control_max;
233 
234  double control_initial_value;
235  double control_step;
236  double control_tolerance;
237 
238  double state_convert;
239  double control_convert;
240 
241  void setThrottlesPct(void);
242 
243  void getState(void);
244  void getControl(void);
245  void setControl(void);
246 
247  double computeHmgt(void);
248 
249  void Debug(int from);
250 };
251 }
252 #endif
double GetControlStep(void)
Get control step.
void Run(void)
This function iterates through a call to the FGFDMExec::RunIC() function until the desired trimming c...
void SetControlToMax(void)
Set control value to maximum.
void SetPhiOnGround(double ff)
Set phi value on ground for trim.
double GetTolerance(void)
Get control tolerance.
TaControl GetControlType(void)
Return the control type.
void SetControlToMin(void)
Set control value to minimum.
void SetControlInitialValue(double value)
Set control initial value.
double GetControlMax(void)
Gets the control maximum value.
double GetControlMin(void)
Gets the control minimum value.
bool initTheta(void)
Calculate steady state thetas value on ground.
JSBSim Base class.
Definition: FGJSBBase.h:80
void SetThetaOnGround(double ff)
Set theta value on ground for trim.
void SetControlLimits(double min, double max)
Set both control limits.
void SetStateTarget(double target)
Set target state value for trim.
Initializes the simulation run.
void SetControlStep(double value)
Set control step.
FGTrimAnalysisControl(FGFDMExec *fdmex, FGInitialCondition *IC, TaControl control)
Constructor for Trim Analysis Control class.
string GetControlName(void)
Gets the control name.
Models an aircraft control variables for purposes of trimming.
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
double GetControlInitialValue(void)
Get control step.
void SetTolerance(double ff)
Set control tolerance.
double GetControl(void)
Gets the control value.
void SetControl(double value)
Sets the control value.
double GetStateTarget(void)
Get target state value for trim.