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