JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGPropeller.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGPropeller.h
4  Author: Jon S. Berndt
5  Date started: 08/24/00
6 
7  ------------- Copyright (C) 2000 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 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 08/24/00 JSB Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #ifndef FGPROPELLER_H
35 #define FGPROPELLER_H
36 
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 
41 #include "FGThruster.h"
42 #include "math/FGTable.h"
43 
44 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 DEFINITIONS
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47 
48 #define ID_PROPELLER "$Id: FGPropeller.h,v 1.27 2017/02/26 12:09:46 bcoconni Exp $"
49 
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 FORWARD DECLARATIONS
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
53 
54 namespace JSBSim {
55 
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS DOCUMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 
166 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
167 CLASS DECLARATION
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
169 
170 class FGPropeller : public FGThruster {
171 
172 public:
177  FGPropeller(FGFDMExec* exec, Element* el, int num = 0);
178 
180  ~FGPropeller();
181 
183  void ResetToIC(void);
184 
191  void SetRPM(double rpm) {RPM = rpm;}
192 
195  void SetEngineRPM(double rpm) {RPM = rpm/GearRatio;}
196 
198  bool IsVPitch(void) const {return MaxPitch != MinPitch;}
199 
207  void SetPitch(double pitch) {Pitch = pitch;}
208 
212  void SetAdvance(double advance) {Advance = advance;}
213 
215  void SetPFactor(double pf) {P_Factor = pf;}
216 
218  void SetConstantSpeed(int mode) {ConstantSpeed = mode;}
219 
221  void SetCtFactor(double ctf) {CtFactor = ctf;}
222 
224  void SetCpFactor(double cpf) {CpFactor = cpf;}
225 
230  void SetSense(double s) { Sense = s;}
231 
233  double GetPitch(void) const { return Pitch; }
234 
236  double GetRPM(void) const { return RPM; }
237 
239  double GetEngineRPM(void) const { return RPM * GearRatio; }
240 
242  double GetIxx(void) const { return Ixx; }
243 
245  double GetCtFactor(void) const { return CtFactor; }
246 
248  double GetCpFactor(void) const { return CpFactor; }
249 
251  double GetDiameter(void) const { return Diameter; }
252 
254  FGTable* GetCThrustTable(void) const { return cThrust;}
256  FGTable* GetCPowerTable(void) const { return cPower; }
257 
259  FGTable* GetCtMachTable(void) const { return CtMach; }
261  FGTable* GetCpMachTable(void) const { return CpMach; }
262 
264  double GetTorque(void) const { return vTorque(eX); }
265 
269  double GetPowerRequired(void);
270 
280  double Calculate(double EnginePower);
282  FGColumnVector3 GetPFactor(void) const;
284  std::string GetThrusterLabels(int id, const std::string& delimeter);
286  std::string GetThrusterValues(int id, const std::string& delimeter);
290  void SetReverseCoef (double c) { Reverse_coef = c; }
292  double GetReverseCoef (void) const { return Reverse_coef; }
294  void SetReverse (bool r) { Reversed = r; }
296  bool GetReverse (void) const { return Reversed; }
298  void SetFeather (bool f) { Feathered = f; }
300  bool GetFeather (void) const { return Feathered; }
302  double GetThrustCoefficient(void) const {return ThrustCoeff;}
304  double GetHelicalTipMach(void) const {return HelicalTipMach;}
306  int GetConstantSpeed(void) const {return ConstantSpeed;}
308  void SetInducedVelocity(double Vi) {Vinduced = Vi;}
310  double GetInducedVelocity(void) const {return Vinduced;}
311 
312 private:
313  int numBlades;
314  double J;
315  double RPM;
316  double Ixx;
317  double Diameter;
318  double MaxPitch;
319  double MinPitch;
320  double MinRPM;
321  double MaxRPM;
322  double Pitch;
323  double P_Factor;
324  double Sense, Sense_multiplier;
325  double Advance;
326  double ExcessTorque;
327  double D4;
328  double D5;
329  double HelicalTipMach;
330  double Vinduced;
331  FGColumnVector3 vTorque;
332  FGTable *cThrust;
333  FGTable *cPower;
334  FGTable *CtMach;
335  FGTable *CpMach;
336  double CtFactor;
337  double CpFactor;
338  int ConstantSpeed;
339  void Debug(int from);
340  double ReversePitch; // Pitch, when fully reversed
341  bool Reversed; // true, when propeller is reversed
342  double Reverse_coef; // 0 - 1 defines AdvancePitch (0=MIN_PITCH 1=REVERSE_PITCH)
343  bool Feathered; // true, if feather command
344 };
345 }
346 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
347 #endif
348 
~FGPropeller()
Destructor for FGPropeller - deletes the FGTable objects.
void SetAdvance(double advance)
Set the propeller pitch.
Definition: FGPropeller.h:212
double GetEngineRPM(void) const
Calculates the RPMs of the engine based on gear ratio.
Definition: FGPropeller.h:239
double GetRPM(void) const
Retrieves the RPMs of the propeller.
Definition: FGPropeller.h:236
void SetReverseCoef(double c)
Set the propeller reverse pitch.
Definition: FGPropeller.h:290
FGTable * GetCPowerTable(void) const
Retrieves propeller power table.
Definition: FGPropeller.h:256
FGTable * GetCtMachTable(void) const
Retrieves propeller thrust Mach effects factor.
Definition: FGPropeller.h:259
double GetPowerRequired(void)
Retrieves the power required (or "absorbed") by the propeller - i.e.
double GetCtFactor(void) const
Retrieves the coefficient of thrust multiplier.
Definition: FGPropeller.h:245
void SetConstantSpeed(int mode)
Sets propeller into constant speed mode, or manual pitch mode.
Definition: FGPropeller.h:218
bool GetFeather(void) const
Returns true if the propeller is in feathered position.
Definition: FGPropeller.h:300
double GetIxx(void) const
Retrieves the propeller moment of inertia.
Definition: FGPropeller.h:242
FGTable * GetCThrustTable(void) const
Retrieves propeller thrust table.
Definition: FGPropeller.h:254
void SetCpFactor(double cpf)
Sets coefficient of power multiplier.
Definition: FGPropeller.h:224
FGPropeller models a propeller given the tabular data for Ct (thrust) and Cp (power), indexed by the advance ratio "J".
Definition: FGPropeller.h:170
bool IsVPitch(void) const
Returns true of this propeller is variable pitch.
Definition: FGPropeller.h:198
Base class for specific thrusting devices such as propellers, nozzles, etc.
Definition: FGThruster.h:84
void SetPFactor(double pf)
Sets the P-Factor constant.
Definition: FGPropeller.h:215
double Calculate(double EnginePower)
Calculates and returns the thrust produced by this propeller.
double GetThrustCoefficient(void) const
Retrieves the thrust coefficient.
Definition: FGPropeller.h:302
double GetInducedVelocity(void) const
Get the propeller induced velocity.
Definition: FGPropeller.h:310
double GetReverseCoef(void) const
Retrieves the reverse pitch command.
Definition: FGPropeller.h:292
FGPropeller(FGFDMExec *exec, Element *el, int num=0)
Constructor for FGPropeller.
Definition: FGPropeller.cpp:60
std::string GetThrusterLabels(int id, const std::string &delimeter)
Generate the labels for the thruster standard CSV output.
void SetEngineRPM(double rpm)
Sets the Revolutions Per Minute for the propeller using the engine gear ratio.
Definition: FGPropeller.h:195
double GetTorque(void) const
Retrieves the Torque in foot-pounds (Don't you love the English system?)
Definition: FGPropeller.h:264
void SetSense(double s)
Sets the rotation sense of the propeller.
Definition: FGPropeller.h:230
std::string GetThrusterValues(int id, const std::string &delimeter)
Generate the values for the thruster standard CSV output.
void SetInducedVelocity(double Vi)
Set the propeller induced velocity.
Definition: FGPropeller.h:308
double GetCpFactor(void) const
Retrieves the coefficient of power multiplier.
Definition: FGPropeller.h:248
This class implements a 3 element column vector.
void SetFeather(bool f)
If true, sets the propeller in feathered position.
Definition: FGPropeller.h:298
double GetHelicalTipMach(void) const
Retrieves the Mach number at the propeller tips.
Definition: FGPropeller.h:304
void SetRPM(double rpm)
Sets the Revolutions Per Minute for the propeller.
Definition: FGPropeller.h:191
int GetConstantSpeed(void) const
Returns a non-zero value if the propeller is constant speed.
Definition: FGPropeller.h:306
double GetDiameter(void) const
Retrieves the propeller diameter.
Definition: FGPropeller.h:251
double GetPitch(void) const
Retrieves the pitch of the propeller in degrees.
Definition: FGPropeller.h:233
void SetCtFactor(double ctf)
Sets coefficient of thrust multiplier.
Definition: FGPropeller.h:221
void SetReverse(bool r)
If true, sets the propeller in reversed position.
Definition: FGPropeller.h:294
FGColumnVector3 GetPFactor(void) const
Retrieves the P-Factor constant.
FGTable * GetCpMachTable(void) const
Retrieves propeller power Mach effects factor.
Definition: FGPropeller.h:261
void ResetToIC(void)
Reset the initial conditions.
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
void SetPitch(double pitch)
This commands the pitch of the blade to change to the value supplied.
Definition: FGPropeller.h:207
Lookup table class.
Definition: FGTable.h:243
bool GetReverse(void) const
Returns true if the propeller is in reverse position.
Definition: FGPropeller.h:296