JSBSim Flight Dynamics Model  1.2.0 (05 Nov 2023)
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 FORWARD DECLARATIONS
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47 
48 namespace JSBSim {
49 
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 CLASS DOCUMENTATION
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
53 
165 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
166 CLASS DECLARATION
167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
168 
169 class FGPropeller : public FGThruster {
170 
171 public:
176  FGPropeller(FGFDMExec* exec, Element* el, int num = 0);
177 
179  ~FGPropeller();
180 
182  void ResetToIC(void);
183 
190  void SetRPM(double rpm) {RPM = rpm;}
191 
194  void SetEngineRPM(double rpm) {RPM = rpm/GearRatio;}
195 
197  bool IsVPitch(void) const {return MaxPitch != MinPitch;}
198 
206  void SetPitch(double pitch) {Pitch = pitch;}
207 
211  void SetAdvance(double advance) {Advance = advance;}
212 
214  void SetPFactor(double pf) {P_Factor = pf;}
215 
217  void SetConstantSpeed(int mode) {ConstantSpeed = mode;}
218 
220  void SetCtFactor(double ctf) {CtFactor = ctf;}
221 
223  void SetCpFactor(double cpf) {CpFactor = cpf;}
224 
229  void SetSense(double s) { Sense = s;}
230 
232  double GetPitch(void) const { return Pitch; }
233 
235  double GetRPM(void) const { return RPM; }
236 
238  double GetEngineRPM(void) const { return RPM * GearRatio; }
239 
241  double GetIxx(void) const { return Ixx; }
242 
244  double GetCtFactor(void) const { return CtFactor; }
245 
247  double GetCpFactor(void) const { return CpFactor; }
248 
250  double GetDiameter(void) const { return Diameter; }
251 
253  FGTable* GetCThrustTable(void) const { return cThrust;}
255  FGTable* GetCPowerTable(void) const { return cPower; }
256 
258  FGTable* GetCtMachTable(void) const { return CtMach; }
260  FGTable* GetCpMachTable(void) const { return CpMach; }
261 
263  double GetTorque(void) const { return vTorque(eX); }
264 
268  double GetPowerRequired(void);
269 
279  double Calculate(double EnginePower);
281  FGColumnVector3 GetPFactor(void) const;
283  std::string GetThrusterLabels(int id, const std::string& delimeter);
285  std::string GetThrusterValues(int id, const std::string& delimeter);
289  void SetReverseCoef (double c) { Reverse_coef = c; }
291  double GetReverseCoef (void) const { return Reverse_coef; }
293  void SetReverse (bool r) { Reversed = r; }
295  bool GetReverse (void) const { return Reversed; }
297  void SetFeather (bool f) { Feathered = f; }
299  bool GetFeather (void) const { return Feathered; }
301  double GetThrustCoefficient(void) const {return ThrustCoeff;}
303  double GetHelicalTipMach(void) const {return HelicalTipMach;}
305  int GetConstantSpeed(void) const {return ConstantSpeed;}
307  void SetInducedVelocity(double Vi) {Vinduced = Vi;}
309  double GetInducedVelocity(void) const {return Vinduced;}
310 
311 private:
312  int numBlades;
313  double J;
314  double RPM;
315  double Ixx;
316  double Diameter;
317  double MaxPitch;
318  double MinPitch;
319  double MinRPM;
320  double MaxRPM;
321  double Pitch;
322  double P_Factor;
323  double Sense, Sense_multiplier;
324  double Advance;
325  double ExcessTorque;
326  double D4;
327  double D5;
328  double HelicalTipMach;
329  double Vinduced;
330  FGColumnVector3 vTorque;
331  FGTable *cThrust;
332  FGTable *cPower;
333  FGTable *CtMach;
334  FGTable *CpMach;
335  double CtFactor;
336  double CpFactor;
337  int ConstantSpeed;
338  void Debug(int from);
339  double ReversePitch; // Pitch, when fully reversed
340  bool Reversed; // true, when propeller is reversed
341  double Reverse_coef; // 0 - 1 defines AdvancePitch (0=MIN_PITCH 1=REVERSE_PITCH)
342  bool Feathered; // true, if feather command
343 };
344 }
345 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
346 #endif
347 
This class implements a 3 element column vector.
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:184
FGPropeller models a propeller given the tabular data for Ct (thrust) and Cp (power),...
Definition: FGPropeller.h:169
void SetInducedVelocity(double Vi)
Set the propeller induced velocity.
Definition: FGPropeller.h:307
void SetEngineRPM(double rpm)
Sets the Revolutions Per Minute for the propeller using the engine gear ratio.
Definition: FGPropeller.h:194
double GetPitch(void) const
Retrieves the pitch of the propeller in degrees.
Definition: FGPropeller.h:232
~FGPropeller()
Destructor for FGPropeller - deletes the FGTable objects.
double Calculate(double EnginePower)
Calculates and returns the thrust produced by this propeller.
FGTable * GetCtMachTable(void) const
Retrieves propeller thrust Mach effects factor.
Definition: FGPropeller.h:258
void SetReverseCoef(double c)
Set the propeller reverse pitch.
Definition: FGPropeller.h:289
double GetPowerRequired(void)
Retrieves the power required (or "absorbed") by the propeller - i.e.
int GetConstantSpeed(void) const
Returns a non-zero value if the propeller is constant speed.
Definition: FGPropeller.h:305
void SetReverse(bool r)
If true, sets the propeller in reversed position.
Definition: FGPropeller.h:293
double GetRPM(void) const
Retrieves the RPMs of the propeller.
Definition: FGPropeller.h:235
void SetAdvance(double advance)
Set the propeller pitch.
Definition: FGPropeller.h:211
std::string GetThrusterValues(int id, const std::string &delimeter)
Generate the values for the thruster standard CSV output.
void ResetToIC(void)
Reset the initial conditions.
void SetCtFactor(double ctf)
Sets coefficient of thrust multiplier.
Definition: FGPropeller.h:220
void SetPitch(double pitch)
This commands the pitch of the blade to change to the value supplied.
Definition: FGPropeller.h:206
double GetIxx(void) const
Retrieves the propeller moment of inertia.
Definition: FGPropeller.h:241
void SetConstantSpeed(int mode)
Sets propeller into constant speed mode, or manual pitch mode.
Definition: FGPropeller.h:217
FGColumnVector3 GetPFactor(void) const
Retrieves the P-Factor constant.
void SetCpFactor(double cpf)
Sets coefficient of power multiplier.
Definition: FGPropeller.h:223
double GetInducedVelocity(void) const
Get the propeller induced velocity.
Definition: FGPropeller.h:309
FGTable * GetCpMachTable(void) const
Retrieves propeller power Mach effects factor.
Definition: FGPropeller.h:260
double GetCpFactor(void) const
Retrieves the coefficient of power multiplier.
Definition: FGPropeller.h:247
bool GetReverse(void) const
Returns true if the propeller is in reverse position.
Definition: FGPropeller.h:295
void SetSense(double s)
Sets the rotation sense of the propeller.
Definition: FGPropeller.h:229
double GetHelicalTipMach(void) const
Retrieves the Mach number at the propeller tips.
Definition: FGPropeller.h:303
double GetDiameter(void) const
Retrieves the propeller diameter.
Definition: FGPropeller.h:250
std::string GetThrusterLabels(int id, const std::string &delimeter)
Generate the labels for the thruster standard CSV output.
FGTable * GetCPowerTable(void) const
Retrieves propeller power table.
Definition: FGPropeller.h:255
double GetCtFactor(void) const
Retrieves the coefficient of thrust multiplier.
Definition: FGPropeller.h:244
void SetFeather(bool f)
If true, sets the propeller in feathered position.
Definition: FGPropeller.h:297
double GetTorque(void) const
Retrieves the Torque in foot-pounds (Don't you love the English system?)
Definition: FGPropeller.h:263
bool GetFeather(void) const
Returns true if the propeller is in feathered position.
Definition: FGPropeller.h:299
void SetPFactor(double pf)
Sets the P-Factor constant.
Definition: FGPropeller.h:214
double GetEngineRPM(void) const
Calculates the RPMs of the engine based on gear ratio.
Definition: FGPropeller.h:238
double GetReverseCoef(void) const
Retrieves the reverse pitch command.
Definition: FGPropeller.h:291
FGTable * GetCThrustTable(void) const
Retrieves propeller thrust table.
Definition: FGPropeller.h:253
void SetRPM(double rpm)
Sets the Revolutions Per Minute for the propeller.
Definition: FGPropeller.h:190
FGPropeller(FGFDMExec *exec, Element *el, int num=0)
Constructor for FGPropeller.
Definition: FGPropeller.cpp:53
bool IsVPitch(void) const
Returns true of this propeller is variable pitch.
Definition: FGPropeller.h:197
double GetThrustCoefficient(void) const
Retrieves the thrust coefficient.
Definition: FGPropeller.h:301
Lookup table class.
Definition: FGTable.h:234
Base class for specific thrusting devices such as propellers, nozzles, etc.
Definition: FGThruster.h:77