]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGPiston.h
Update JSBSim files to latest JSBSim CVS.
[flightgear.git] / src / FDM / JSBSim / FGPiston.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
2 \r
3  Header:       FGPiston.h\r
4  Author:       Jon S. Berndt\r
5  Date started: 09/12/2000\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 09/12/2000  JSB  Created\r
29 10/01/2001  DPM  Modified to use equations from Dave Luff's piston model.\r
30 \r
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
32 COMMENTS, REFERENCES,  and NOTES\r
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
34 \r
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
36 SENTRY\r
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
38 \r
39 #ifndef FGPISTON_H\r
40 #define FGPISTON_H\r
41 \r
42 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
43 INCLUDES\r
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
45 \r
46 #include "FGEngine.h"\r
47 #include "FGConfigFile.h"\r
48 #include "FGTable.h"\r
49 \r
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
51 DEFINITIONS\r
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
53 \r
54 #define ID_PISTON "$Id$";\r
55 \r
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
57 FORWARD DECLARATIONS\r
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
59 \r
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
61 COMMENTS, REFERENCES,  and NOTES\r
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
63 \r
64 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
65 DOCUMENTATION\r
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
67 \r
68 /** Models Dave Luff's engine model as ported into JSBSim by David Megginson.\r
69     @author Jon S. Berndt (Engine framework code and framework-related mods)\r
70     @author Dave Luff (engine operational code)\r
71     @author David Megginson (porting and additional code)\r
72     @version $Id$\r
73   */\r
74 \r
75 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
76 CLASS DECLARATION\r
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
78 \r
79 class FGPiston : public FGEngine\r
80 {\r
81 public:\r
82   /// Constructor\r
83   FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg);\r
84   /// Destructor\r
85   ~FGPiston();\r
86 \r
87   float Calculate(float PowerRequired);\r
88   float GetPowerAvailable(void) {return PowerAvailable;}\r
89 \r
90 private:\r
91   float BrakeHorsePower;\r
92   float SpeedSlope;\r
93   float SpeedIntercept;\r
94   float AltitudeSlope;\r
95   float PowerAvailable;\r
96 \r
97   // timestep\r
98   float dt;\r
99 \r
100   void doEngineStartup(void);\r
101   void doManifoldPressure(void);\r
102   void doAirFlow(void);\r
103   void doFuelFlow(void);\r
104   void doEnginePower(void);\r
105   void doEGT(void);\r
106   void doCHT(void);\r
107   void doOilPressure(void);\r
108   void doOilTemperature(void);\r
109 \r
110   //\r
111   // constants\r
112   //\r
113   const float CONVERT_CUBIC_INCHES_TO_METERS_CUBED;\r
114 \r
115   const float R_air;\r
116   const float rho_fuel;    // kg/m^3\r
117   const float calorific_value_fuel;  // W/Kg (approximate)\r
118   const float Cp_air;      // J/KgK\r
119   const float Cp_fuel;     // J/KgK\r
120 \r
121   FGTable *Lookup_Combustion_Efficiency;\r
122   FGTable *Power_Mixture_Correlation;\r
123 \r
124   //\r
125   // Configuration\r
126   //\r
127   float MinManifoldPressure_inHg; // Inches Hg\r
128   float MaxManifoldPressure_inHg; // Inches Hg\r
129   float Displacement;             // cubic inches\r
130   float MaxHP;                    // horsepower\r
131   float Cycles;                   // cycles/power stroke\r
132   float IdleRPM;                  // revolutions per minute\r
133 \r
134   //\r
135   // Inputs (in addition to those in FGEngine).\r
136   //\r
137   float p_amb;              // Pascals\r
138   float p_amb_sea_level;    // Pascals\r
139   float T_amb;              // degrees Kelvin\r
140   float RPM;                // revolutions per minute\r
141   float IAS;                // knots\r
142 \r
143   //\r
144   // Outputs (in addition to those in FGEngine).\r
145   //\r
146   bool Magneto_Left;\r
147   bool Magneto_Right;\r
148   float rho_air;\r
149   float volumetric_efficiency;\r
150   float m_dot_air;\r
151   float equivalence_ratio;\r
152   float m_dot_fuel;\r
153   float Percentage_Power;\r
154   float HP;\r
155   float combustion_efficiency;\r
156 \r
157   void Debug(void);\r
158 };\r
159 \r
160 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
161 #endif\r