]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/propulsion/FGPropeller.h
Sync. w. JSB CVS as of 15/01/2007
[flightgear.git] / src / FDM / JSBSim / models / propulsion / 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 (jsb@hal-pc.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$"
49
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 FORWARD DECLARATIONS
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
53
54 namespace JSBSim {
55
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS DOCUMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59
60 /** Propeller modeling class.
61     FGPropeller models a propeller given the tabular data for Ct and Cp
62     indexed by advance ratio "J". The data for the propeller is
63     stored in a config file named "prop_name.xml". The propeller config file
64     is referenced from the main aircraft config file in the "Propulsion" section.
65     See the constructor for FGPropeller to see what is read in and what should
66     be stored in the config file.<br>
67     Several references were helpful, here:<ul>
68     <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
69      Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
70     <li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of
71     Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6
72     Airfoil Sections", NACA Report TN-640, 1938 (?)</li>
73     <li>Various NACA Technical Notes and Reports</li>
74     </ul>
75     @author Jon S. Berndt
76     @version $Id$
77     @see FGEngine
78     @see FGThruster
79 */
80
81 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 CLASS DECLARATION
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
84
85 class FGPropeller : public FGThruster {
86
87 public:
88   /** Constructor for FGPropeller.
89       @param exec a pointer to the main executive object
90       @param el a pointer to the thruster config file XML element*/
91   FGPropeller(FGFDMExec* exec, Element* el, int num = 0);
92
93   /// Destructor for FGPropeller - deletes the FGTable objects
94   ~FGPropeller();
95
96   /** Sets the Revolutions Per Minute for the propeller. Normally the propeller
97       instance will calculate its own rotational velocity, given the Torque
98       produced by the engine and integrating over time using the standard
99       equation for rotational acceleration "a": a = Q/I , where Q is Torque and
100       I is moment of inertia for the propeller.
101       @param rpm the rotational velocity of the propeller */
102   void SetRPM(double rpm) {RPM = rpm;}
103
104   /// Returns true of this propeller is variable pitch
105   bool IsVPitch(void) {return MaxPitch != MinPitch;}
106
107   /** This commands the pitch of the blade to change to the value supplied.
108       This call is meant to be issued either from the cockpit or by the flight
109       control system (perhaps to maintain constant RPM for a constant-speed
110       propeller). This value will be limited to be within whatever is specified
111       in the config file for Max and Min pitch. It is also one of the lookup
112       indices to the power and thrust tables for variable-pitch propellers.
113       @param pitch the pitch of the blade in degrees. */
114   void SetPitch(double pitch) {Pitch = pitch;}
115
116   void SetAdvance(double advance) {Advance = advance;}
117
118   /// Sets the P-Factor constant
119   void SetPFactor(double pf) {P_Factor = pf;}
120
121   /** Sets the rotation sense of the propeller.
122       @param s this value should be +/- 1 ONLY. +1 indicates clockwise rotation as
123                viewed by someone standing behind the engine looking forward into
124                the direction of flight. */
125   void SetSense(double s) { Sense = s;}
126
127   /// Retrieves the pitch of the propeller in degrees.
128   double GetPitch(void)         { return Pitch;         }
129
130   /// Retrieves the RPMs of the propeller
131   double GetRPM(void)           { return RPM;           }
132
133   /// Retrieves the propeller moment of inertia
134   double GetIxx(void)           { return Ixx;           }
135
136   /// Retrieves the Torque in foot-pounds (Don't you love the English system?)
137   double GetTorque(void)        { return vTorque(eX);    }
138
139   /** Retrieves the power required (or "absorbed") by the propeller -
140       i.e. the power required to keep spinning the propeller at the current
141       velocity, air density,  and rotational rate. */
142   double GetPowerRequired(void);
143
144   /** Calculates and returns the thrust produced by this propeller.
145       Given the excess power available from the engine (in foot-pounds), the thrust is
146       calculated, as well as the current RPM. The RPM is calculated by integrating
147       the torque provided by the engine over what the propeller "absorbs"
148       (essentially the "drag" of the propeller).
149       @param PowerAvailable this is the excess power provided by the engine to
150       accelerate the prop. It could be negative, dictating that the propeller
151       would be slowed.
152       @return the thrust in pounds */
153   double Calculate(double PowerAvailable);
154   FGColumnVector3 GetPFactor(void);
155   string GetThrusterLabels(int id, string delimeter);
156   string GetThrusterValues(int id, string delimeter);
157
158   void   SetReverseCoef (double c) { Reverse_coef = c; }
159   double GetReverseCoef (void) { return Reverse_coef; }
160   void   SetReverse (bool r) { Reversed = r; }
161   bool   GetReverse (void) { return Reversed; }
162   void   SetFeather (bool f) { Feathered = f; }
163   bool   GetFeather (void) { return Feathered; }
164   double GetThrustCoefficient(void) const {return ThrustCoeff;}
165
166 private:
167   int   numBlades;
168   double J;
169   double RPM;
170   double Ixx;
171   double Diameter;
172   double MaxPitch;
173   double MinPitch;
174   double MinRPM;
175   double MaxRPM;
176   double Pitch;
177   double P_Factor;
178   double Sense;
179   double Advance;
180   double ExcessTorque;
181   double D4;
182   double D5;
183   FGColumnVector3 vTorque;
184   FGTable *cThrust;
185   FGTable *cPower;
186   void Debug(int from);
187   double ReversePitch; // Pitch, when fully reversed
188   bool   Reversed;               // true, when propeller is reversed
189   double Reverse_coef; // 0 - 1 defines AdvancePitch (0=MIN_PITCH 1=REVERSE_PITCH)
190   bool   Feathered;    // true, if feather command
191 };
192 }
193 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
194 #endif
195