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