1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 2000 Jon S. Berndt (jon@jsbsim.org) -------------
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
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
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.
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.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41 #include "FGThruster.h"
42 #include "math/FGTable.h"
44 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48 #define ID_PROPELLER "$Id: FGPropeller.h,v 1.18 2011/06/06 22:39:52 jentron Exp $"
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 /** FGPropeller models a propeller given the tabular data for Ct and Cp,
61 indexed by the advance ratio "J".
63 <h3>Configuration File Format:</h3>
65 <sense> {1 | -1} </sense>
66 <propeller name="{string}">
68 <diameter unit="IN"> {number} </diameter>
69 <numblades> {number} </numblades>
70 <gearratio> {number} </gearratio>
71 <minpitch> {number} </minpitch>
72 <maxpitch> {number} </maxpitch>
73 <minrpm> {number} </minrpm>
74 <maxrpm> {number} </maxrpm>
75 <constspeed> {number} </constspeed>
76 <reversepitch> {number} </reversepitch>
77 <p_factor> {number} </p_factor>
78 <ct_factor> {number} </ct_factor>
79 <cp_factor> {number} </cp_factor>
81 <table name="C_THRUST" type="internal">
87 <table name="C_POWER" type="internal">
93 <table name="CT_MACH" type="internal">
99 <table name="CP_MACH" type="internal">
109 <h3>Configuration Parameters:</h3>
111 \<ixx> - Propeller rotational inertia.
112 \<diameter> - Propeller disk diameter.
113 \<numblades> - Number of blades.
114 \<gearratio> - Ratio of (engine rpm) / (prop rpm).
115 \<minpitch> - Minimum blade pitch angle.
116 \<maxpitch> - Maximum blade pitch angle.
117 \<minrpm> - Minimum rpm target for constant speed propeller.
118 \<maxrpm> - Maximum rpm target for constant speed propeller.
119 \<constspeed> - 1 = constant speed mode, 0 = manual pitch mode.
120 \<reversepitch> - Blade pitch angle for reverse.
121 \<sense> - Direction of rotation (1=clockwise as viewed from cockpit,
122 -1=anti-clockwise as viewed from cockpit). Sense is
123 specified in the parent tag of the propeller.
124 \<p_factor> - P factor.
125 \<ct_factor> - A multiplier for the coefficients of thrust.
126 \<cp_factor> - A multiplier for the coefficients of power.
129 Two tables are needed. One for coefficient of thrust (Ct) and one for
130 coefficient of power (Cp).
132 Two tables are optional. They apply a factor to Ct and Cp based on the
136 Several references were helpful, here:<ul>
137 <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
138 Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
139 <li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of
140 Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6
141 Airfoil Sections", NACA Report TN-640, 1938 (?)</li>
142 <li>Various NACA Technical Notes and Reports</li>
144 @author Jon S. Berndt
145 @version $Id: FGPropeller.h,v 1.18 2011/06/06 22:39:52 jentron Exp $
150 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
154 class FGPropeller : public FGThruster {
157 /** Constructor for FGPropeller.
158 @param exec a pointer to the main executive object
159 @param el a pointer to the thruster config file XML element
160 @param num the number of this propeller */
161 FGPropeller(FGFDMExec* exec, Element* el, int num = 0);
163 /// Destructor for FGPropeller - deletes the FGTable objects
166 /** Sets the Revolutions Per Minute for the propeller. Normally the propeller
167 instance will calculate its own rotational velocity, given the Torque
168 produced by the engine and integrating over time using the standard
169 equation for rotational acceleration "a": a = Q/I , where Q is Torque and
170 I is moment of inertia for the propeller.
171 @param rpm the rotational velocity of the propeller */
172 void SetRPM(double rpm) {RPM = rpm;}
174 /// Returns true of this propeller is variable pitch
175 bool IsVPitch(void) {return MaxPitch != MinPitch;}
177 /** This commands the pitch of the blade to change to the value supplied.
178 This call is meant to be issued either from the cockpit or by the flight
179 control system (perhaps to maintain constant RPM for a constant-speed
180 propeller). This value will be limited to be within whatever is specified
181 in the config file for Max and Min pitch. It is also one of the lookup
182 indices to the power and thrust tables for variable-pitch propellers.
183 @param pitch the pitch of the blade in degrees. */
184 void SetPitch(double pitch) {Pitch = pitch;}
186 void SetAdvance(double advance) {Advance = advance;}
188 /// Sets the P-Factor constant
189 void SetPFactor(double pf) {P_Factor = pf;}
191 /// Sets propeller into constant speed mode, or manual pitch mode
192 void SetConstantSpeed(int mode) {ConstantSpeed = mode;}
194 /// Sets coefficient of thrust multiplier
195 void SetCtFactor(double ctf) {CtFactor = ctf;}
197 /// Sets coefficient of power multiplier
198 void SetCpFactor(double cpf) {CpFactor = cpf;}
200 /** Sets the rotation sense of the propeller.
201 @param s this value should be +/- 1 ONLY. +1 indicates clockwise rotation as
202 viewed by someone standing behind the engine looking forward into
203 the direction of flight. */
204 void SetSense(double s) { Sense = s;}
206 /// Retrieves the pitch of the propeller in degrees.
207 double GetPitch(void) { return Pitch; }
209 /// Retrieves the RPMs of the propeller
210 double GetRPM(void) const { return RPM; }
212 /// Retrieves the propeller moment of inertia
213 double GetIxx(void) { return Ixx; }
215 /// Retrieves the coefficient of thrust multiplier
216 double GetCtFactor(void) { return CtFactor; }
218 /// Retrieves the coefficient of power multiplier
219 double GetCpFactor(void) { return CpFactor; }
221 /// Retrieves the propeller diameter
222 double GetDiameter(void) { return Diameter; }
224 /// Retrieves propeller thrust table
225 FGTable* GetCThrustTable(void) const { return cThrust;}
226 /// Retrieves propeller power table
227 FGTable* GetCPowerTable(void) const { return cPower; }
229 /// Retrieves propeller thrust Mach effects factor
230 FGTable* GetCtMachTable(void) const { return CtMach; }
231 /// Retrieves propeller power Mach effects factor
232 FGTable* GetCpMachTable(void) const { return CpMach; }
234 /// Retrieves the Torque in foot-pounds (Don't you love the English system?)
235 double GetTorque(void) { return vTorque(eX); }
237 /** Retrieves the power required (or "absorbed") by the propeller -
238 i.e. the power required to keep spinning the propeller at the current
239 velocity, air density, and rotational rate. */
240 double GetPowerRequired(void);
242 /** Calculates and returns the thrust produced by this propeller.
243 Given the excess power available from the engine (in foot-pounds), the thrust is
244 calculated, as well as the current RPM. The RPM is calculated by integrating
245 the torque provided by the engine over what the propeller "absorbs"
246 (essentially the "drag" of the propeller).
247 @param PowerAvailable this is the excess power provided by the engine to
248 accelerate the prop. It could be negative, dictating that the propeller
250 @return the thrust in pounds */
251 double Calculate(double EnginePower);
252 FGColumnVector3 GetPFactor(void);
253 string GetThrusterLabels(int id, string delimeter);
254 string GetThrusterValues(int id, string delimeter);
256 void SetReverseCoef (double c) { Reverse_coef = c; }
257 double GetReverseCoef (void) { return Reverse_coef; }
258 void SetReverse (bool r) { Reversed = r; }
259 bool GetReverse (void) { return Reversed; }
260 void SetFeather (bool f) { Feathered = f; }
261 bool GetFeather (void) { return Feathered; }
262 double GetThrustCoefficient(void) const {return ThrustCoeff;}
263 double GetHelicalTipMach(void) const {return HelicalTipMach;}
264 int GetConstantSpeed(void) const {return ConstantSpeed;}
265 void SetInducedVelocity(double Vi) {Vinduced = Vi;}
266 double GetInducedVelocity(void) const {return Vinduced;}
285 double HelicalTipMach;
287 FGColumnVector3 vTorque;
295 void Debug(int from);
296 double ReversePitch; // Pitch, when fully reversed
297 bool Reversed; // true, when propeller is reversed
298 double Reverse_coef; // 0 - 1 defines AdvancePitch (0=MIN_PITCH 1=REVERSE_PITCH)
299 bool Feathered; // true, if feather command
302 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%