1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 2000 Jon S. Berndt (jsb@hal-pc.org) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU 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 General Public License for more
19 You should have received a copy of the GNU 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 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"
43 #include "FGTranslation.h"
44 #include "FGRotation.h"
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50 #define ID_PROPELLER "$Id$"
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
64 /** Propeller modeling class.
65 FGPropeller models a propeller given the tabular data for Ct and Cp
66 indexed by advance ratio "J". The data for the propeller is
67 stored in a config file named "prop_name.xml". The propeller config file
68 is referenced from the main aircraft config file in the "Propulsion" section.
69 See the constructor for FGPropeller to see what is read in and what should
70 be stored in the config file.<br>
71 Several references were helpful, here:<ul>
72 <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
73 Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
74 <li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of
75 Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6
76 Airfoil Sections", NACA Report TN-640, 1938 (?)</li>
77 <li>Various NACA Technical Notes and Reports</li>
84 @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropeller.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
86 @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropeller.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
90 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
96 class FGPropeller : public FGThruster {
99 /** Constructor for FGPropeller.
100 @param exec a pointer to the main executive object
101 @param AC_cfg a pointer to the main aircraft config file object */
102 FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg);
104 /// Destructor for FGPropeller - deletes the FGTable objects
107 /** Sets the Revolutions Per Minute for the propeller. Normally the propeller
108 instance will calculate its own rotational velocity, given the Torque
109 produced by the engine and integrating over time using the standard
110 equation for rotational acceleration "a": a = Q/I , where Q is Torque and
111 I is moment of inertia for the propeller.
112 @param rpm the rotational velocity of the propeller */
113 void SetRPM(double rpm) {RPM = rpm;}
115 /// Returns true of this propeller is variable pitch
116 bool IsVPitch(void) {return MaxPitch != MinPitch;}
118 /** This commands the pitch of the blade to change to the value supplied.
119 This call is meant to be issued either from the cockpit or by the flight
120 control system (perhaps to maintain constant RPM for a constant-speed
121 propeller). This value will be limited to be within whatever is specified
122 in the config file for Max and Min pitch. It is also one of the lookup
123 indices to the power and thrust tables for variable-pitch propellers.
124 @param pitch the pitch of the blade in degrees. */
125 void SetPitch(double pitch) {Pitch = pitch;}
127 /// Sets the P-Factor constant
128 void SetPFactor(double pf) {P_Factor = pf;}
130 /** Sets the rotation sense of the propeller.
131 @param s this value should be +/- 1 ONLY. +1 indicates clockwise rotation as
132 viewed by someone standing behind the engine looking forward into
133 the direction of flight. */
134 void SetSense(double s) { Sense = s;}
136 /// Retrieves the pitch of the propeller in degrees.
137 double GetPitch(void) { return Pitch; }
139 /// Retrieves the RPMs of the propeller
140 double GetRPM(void) { return RPM; }
142 /// Retrieves the propeller moment of inertia
143 double GetIxx(void) { return Ixx; }
145 /// Retrieves the Torque in foot-pounds (Don't you love the English system?)
146 double GetTorque(void) { return vTorque(eX); }
148 /** Retrieves the power required (or "absorbed") by the propeller -
149 i.e. the power required to keep spinning the propeller at the current
150 velocity, air density, and rotational rate. */
151 double GetPowerRequired(void);
153 /** Calculates and returns the thrust produced by this propeller.
154 Given the excess power available from the engine (in foot-pounds), the thrust is
155 calculated, as well as the current RPM. The RPM is calculated by integrating
156 the torque provided by the engine over what the propeller "absorbs"
157 (essentially the "drag" of the propeller).
158 @param PowerAvailable this is the excess power provided by the engine to
159 accelerate the prop. It could be negative, dictating that the propeller
161 @return the thrust in pounds */
162 double Calculate(double PowerAvailable);
163 FGColumnVector3 GetPFactor(void);
178 FGColumnVector3 vTorque;
181 void Debug(int from);
184 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%