1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 Date started: 09/12/2000
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 --------------------------------------------------------------------------------
28 09/12/2000 JSB Created
29 10/01/2001 DPM Modified to use equations from Dave Luff's piston model.
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 COMMENTS, REFERENCES, and NOTES
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47 #include "FGConfigFile.h"
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54 #define ID_PISTON "$Id$";
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 COMMENTS, REFERENCES, and NOTES
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
64 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
68 /** Models Dave Luff's engine model as ported into JSBSim by David Megginson.
69 @author Jon S. Berndt (Engine framework code and framework-related mods)
70 @author Dave Luff (engine operational code)
71 @author David Megginson (porting and additional code)
75 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
79 class FGPiston : public FGEngine
83 FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg);
87 double Calculate(double PowerRequired);
88 double GetPowerAvailable(void) {return PowerAvailable;}
93 double BrakeHorsePower;
95 double SpeedIntercept;
97 double PowerAvailable;
102 void doEngineStartup(void);
103 void doManifoldPressure(void);
104 void doAirFlow(void);
105 void doFuelFlow(void);
106 void doEnginePower(void);
109 void doOilPressure(void);
110 void doOilTemperature(void);
115 const double CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
118 const double rho_fuel; // kg/m^3
119 const double calorific_value_fuel; // W/Kg (approximate)
120 const double Cp_air; // J/KgK
121 const double Cp_fuel; // J/KgK
123 FGTable *Lookup_Combustion_Efficiency;
124 FGTable *Power_Mixture_Correlation;
129 double MinManifoldPressure_inHg; // Inches Hg
130 double MaxManifoldPressure_inHg; // Inches Hg
131 double Displacement; // cubic inches
132 double MaxHP; // horsepower
133 double Cycles; // cycles/power stroke
134 double IdleRPM; // revolutions per minute
137 // Inputs (in addition to those in FGEngine).
139 double p_amb; // Pascals
140 double p_amb_sea_level; // Pascals
141 double T_amb; // degrees Kelvin
142 double RPM; // revolutions per minute
146 // Outputs (in addition to those in FGEngine).
151 double volumetric_efficiency;
153 double equivalence_ratio;
155 double Percentage_Power;
157 double combustion_efficiency;
162 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%