]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGPropeller.h
Syncing with most recent JSBSim.
[flightgear.git] / src / FDM / JSBSim / FGPropeller.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
2 \r
3  Header:       FGPropeller.h\r
4  Author:       Jon S. Berndt\r
5  Date started: 08/24/00\r
6 \r
7  ------------- Copyright (C) 2000  Jon S. Berndt (jsb@hal-pc.org) -------------\r
8 \r
9  This program is free software; you can redistribute it and/or modify it under\r
10  the terms of the GNU General Public License as published by the Free Software\r
11  Foundation; either version 2 of the License, or (at your option) any later\r
12  version.\r
13 \r
14  This program is distributed in the hope that it will be useful, but WITHOUT\r
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
16  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
17  details.\r
18 \r
19  You should have received a copy of the GNU General Public License along with\r
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple\r
21  Place - Suite 330, Boston, MA  02111-1307, USA.\r
22 \r
23  Further information about the GNU General Public License can also be found on\r
24  the world wide web at http://www.gnu.org.\r
25 \r
26 HISTORY\r
27 --------------------------------------------------------------------------------\r
28 08/24/00  JSB  Created\r
29 \r
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
31 SENTRY\r
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
33 \r
34 #ifndef FGPROPELLER_H\r
35 #define FGPROPELLER_H\r
36 \r
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
38 INCLUDES\r
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
40 \r
41 #include "FGThruster.h"\r
42 #include "FGTable.h"\r
43 #include "FGTranslation.h"\r
44 #include "FGRotation.h"\r
45 \r
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
47 DEFINITIONS\r
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
49 \r
50 #define ID_PROPELLER "$Id$"\r
51 \r
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
53 FORWARD DECLARATIONS\r
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
55 \r
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
57 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]\r
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
59 \r
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
61 CLASS DOCUMENTATION\r
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
63 \r
64 /** Propeller modeling class.\r
65     FGPropeller models a propeller given the tabular data for Ct and Cp\r
66     indexed by advance ratio "J". The data for the propeller is\r
67     stored in a config file named "prop_name.xml". The propeller config file\r
68     is referenced from the main aircraft config file in the "Propulsion" section.\r
69     See the constructor for FGPropeller to see what is read in and what should\r
70     be stored in the config file.<br>\r
71     Several references were helpful, here:<ul>\r
72     <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",\r
73      Wiley & Sons, 1979 ISBN 0-471-03032-5</li>\r
74     <li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of\r
75     Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6\r
76     Airfoil Sections", NACA Report TN-640, 1938 (?)</li>\r
77     <li>Various NACA Technical Notes and Reports</li>\r
78     <ul>\r
79     @author Jon S. Berndt\r
80     @version $Id$\r
81     @see FGEngine\r
82     @see FGThruster\r
83     @see FGTable\r
84 */\r
85 \r
86 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
87 CLASS DECLARATION\r
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
89 \r
90 class FGPropeller : public FGThruster {\r
91 \r
92 public:\r
93   /** Constructor for FGPropeller.\r
94       @param exec a pointer to the main executive object\r
95       @param AC_cfg a pointer to the main aircraft config file object */\r
96   FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg);\r
97 \r
98   /// Destructor for FGPropeller - deletes the FGTable objects\r
99   ~FGPropeller();\r
100 \r
101   /** Sets the Revolutions Per Minute for the propeller. Normally the propeller\r
102       instance will calculate its own rotational velocity, given the Torque\r
103       produced by the engine and integrating over time using the standard\r
104       equation for rotational acceleration "a": a = Q/I , where Q is Torque and\r
105       I is moment of inertia for the propeller.\r
106       @param rpm the rotational velocity of the propeller */\r
107   void SetRPM(double rpm) {RPM = rpm;}\r
108 \r
109   /** This commands the pitch of the blade to change to the value supplied.\r
110       This call is meant to be issued either from the cockpit or by the flight\r
111       control system (perhaps to maintain constant RPM for a constant-speed\r
112       propeller). This value will be limited to be within whatever is specified\r
113       in the config file for Max and Min pitch. It is also one of the lookup\r
114       indices to the power and thrust tables for variable-pitch propellers.\r
115       @param pitch the pitch of the blade in degrees. */\r
116   void SetPitch(double pitch) {Pitch = pitch;}\r
117   \r
118   void SetPFactor(double pf) {P_Factor = pf;}\r
119   \r
120   void SetSense(double s) { Sense = s;}\r
121 \r
122   /// Retrieves the pitch of the propeller in degrees.\r
123   double GetPitch(void)         { return Pitch;         }\r
124   \r
125   /// Retrieves the RPMs of the propeller\r
126   double GetRPM(void)           { return RPM;           }\r
127   \r
128   /// Retrieves the propeller moment of inertia\r
129   double GetIxx(void)           { return Ixx;           }\r
130   \r
131   /// Retrieves the Torque in foot-pounds (Don't you love the English system?)\r
132   double GetTorque(void)        { return vTorque(eX);    }\r
133   \r
134   /** Retrieves the power required (or "absorbed") by the propeller -\r
135       i.e. the power required to keep spinning the propeller at the current\r
136       velocity, air density,  and rotational rate. */\r
137   double GetPowerRequired(void);\r
138   \r
139   /** Calculates and returns the thrust produced by this propeller.\r
140       Given the excess power available from the engine (in foot-pounds), the thrust is\r
141       calculated, as well as the current RPM. The RPM is calculated by integrating\r
142       the torque provided by the engine over what the propeller "absorbs"\r
143       (essentially the "drag" of the propeller).\r
144       @param PowerAvailable this is the excess power provided by the engine to\r
145       accelerate the prop. It could be negative, dictating that the propeller\r
146       would be slowed.\r
147       @return the thrust in pounds */\r
148   double Calculate(double PowerAvailable);\r
149 \r
150 private:\r
151   int   numBlades;\r
152   double RPM;\r
153   double Ixx;\r
154   double Diameter;\r
155   double MaxPitch;\r
156   double MinPitch;\r
157   double MinRPM;\r
158   double MaxRPM;\r
159   double P_Factor;\r
160   double Sense;\r
161   double Pitch;\r
162   double ExcessTorque;\r
163   FGColumnVector3 vTorque;\r
164   FGTable *cThrust;\r
165   FGTable *cPower;\r
166   void Debug(void);\r
167 };\r
168 \r
169 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
170 #endif\r
171 \r