2 // Author: Phil Schubert
3 // Date started: 12/03/99
4 // Purpose: Models a Continental IO-520-M Engine
5 // Called by: FGSimExec
7 // Copyright (C) 1999 Philip L. Schubert (philings@ozemail.com.au)
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 // Further information about the GNU General Public License can also
25 // be found on the world wide web at http://www.gnu.org.
27 // FUNCTIONAL DESCRIPTION
28 // ------------------------------------------------------------------------
29 // Models a Continental IO-520-M engine. This engine is used in Cessna
30 // 210, 310, Beechcraft Bonaza and Baron C55. The equations used below
31 // were determined by a first and second order curve fits using Excel.
32 // The data is from the Cessna Aircraft Corporations Engine and Flight
33 // Computer for C310. Part Number D3500-13
36 // ------------------------------------------------------------------------
40 // ------------------------------------------------------------------------
41 // 12/03/99 PLS Created
42 // 07/03/99 PLS Added Calculation of Density, and Prop_Torque
43 // 07/03/99 PLS Restructered Variables to allow easier implementation
45 // 15/03/99 PLS Added Oil Pressure, Oil Temperature and CH Temp
46 // ------------------------------------------------------------------------
48 // ------------------------------------------------------------------------
53 #define NEVS_PROP_MODEL
55 #ifndef NEVS_PROP_MODEL
56 #define PHILS_PROP_MODEL
59 #include <simgear/compiler.h>
65 FG_USING_STD(ofstream);
73 float CONVERT_HP_TO_WATTS;
74 float CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
76 // Control and environment inputs
78 // 0 = Closed, 100 = Fully Open
79 float Throttle_Lever_Pos;
80 // 0 = Full Course 100 = Full Fine
81 float Propeller_Lever_Pos;
82 // 0 = Idle Cut Off 100 = Full Rich
83 float Mixture_Lever_Pos;
85 // Engine Specific Variables used by this program that have limits.
86 // Will be set in a parameter file to be read in to create
87 // and instance for each engine.
88 float Max_Manifold_Pressure; //will be lower than ambient pressure for a non turbo/super charged engine due to losses through the throttle. This is the sea level full throttle value.
89 float Min_Manifold_Pressure; //Closed throttle valueat idle - governed by the idle bypass valve
93 float Mag_Derate_Percent;
97 // Initialise Engine Variables used by this instance
98 float Percentage_Power; // Power output as percentage of maximum power output
99 float Manifold_Pressure; // Inches
101 float Fuel_Flow; // lbs/hour
103 float CHT; // Cylinder head temperature
104 float EGT; // Exhaust gas temperature
106 float Oil_Pressure; // PSI
107 float Oil_Temp; // Deg C
108 float HP; // Current power output in HP
109 float Power_SI; // Current power output in Watts
110 float Torque_SI; // Torque in Nm
112 float Torque_Imbalance;
113 float Desired_RPM; // The RPM that we wish the constant speed prop to maintain if possible
114 bool started; //flag to indicate the engine is running self sustaining
115 bool cranking; //flag to indicate the engine is being cranked
118 float volumetric_efficiency;
119 float combustion_efficiency;
120 float equivalence_ratio;
125 float True_Manifold_Pressure; //in Hg
126 float rho_air_manifold;
128 float p_amb_sea_level; // Pascals
129 float p_amb; // Pascals
130 float T_amb; // deg Kelvin
131 float calorific_value_fuel;
133 float delta_T_exhaust;
134 float displacement; // Engine displacement in cubic inches - to be read in from config file for each engine
135 float displacement_SI; // ditto in meters cubed
136 float Cp_air; // J/KgK
137 float Cp_fuel; // J/KgK
138 float heat_capacity_exhaust;
139 float enthalpy_exhaust;
140 float Percentage_of_best_power_mixture_power;
141 float abstract_mixture; //temporary hack
142 float engine_inertia; //kg.m^2
143 float prop_inertia; //kg.m^2
144 float angular_acceleration; //rad/s^2
147 // Initialise Propellor Variables used by this instance
148 float FGProp1_Angular_V;
149 float FGProp1_Coef_Drag;
150 float FGProp1_Torque;
151 float FGProp1_Thrust;
153 float FGProp1_Coef_Lift;
155 float FGProp1_Blade_Angle;
156 float FGProp_Fine_Pitch_Stop;
158 #ifdef NEVS_PROP_MODEL
159 //Extra Propellor variables used by Nev's prop model
160 float prop_fudge_factor;
161 float prop_torque; //Nm
164 float allowance_for_spinner;
167 float number_of_blades;
168 float forward_velocity;
169 float angular_velocity_SI;
173 float element_torque;
175 float prop_power_consumed_SI;
176 float prop_power_consumed_HP;
177 float theta[6]; //prop angle of each element
178 #endif // NEVS_PROP_MODEL
180 // Other internal values
183 // Calculate Engine RPM based on Propellor Lever Position
184 float Calc_Engine_RPM (float Position);
186 // Calculate combustion efficiency based on equivalence ratio
187 float Lookup_Combustion_Efficiency(float thi_actual);
189 // Calculate exhaust gas temperature rise
190 float Calculate_Delta_T_Exhaust(void);
198 // outfile.open("FGEngine.dat", ios::out|ios::trunc);
206 // set initial default values
207 void init(double dt);
209 // update the engine model based on current control positions
212 inline void set_IAS( float value ) { IAS = value; }
213 inline void set_Throttle_Lever_Pos( float value ) {
214 Throttle_Lever_Pos = value;
216 inline void set_Propeller_Lever_Pos( float value ) {
217 Propeller_Lever_Pos = value;
219 inline void set_Mixture_Lever_Pos( float value ) {
220 Mixture_Lever_Pos = value;
224 inline float get_RPM() const { return RPM; }
225 inline float get_Manifold_Pressure() const { return Manifold_Pressure; }
226 inline float get_FGProp1_Thrust() const { return FGProp1_Thrust; }
227 inline float get_FGProp1_Blade_Angle() const { return FGProp1_Blade_Angle; }
229 inline float get_Rho() const { return Rho; }
230 inline float get_MaxHP() const { return MaxHP; }
231 inline float get_Percentage_Power() const { return Percentage_Power; }
232 inline float get_EGT() const { return EGT; }
233 inline float get_prop_thrust_SI() const { return prop_thrust; }
237 #endif // _10520D_HXX_