]> git.mxchange.org Git - flightgear.git/blob - src/FDM/10520d.hxx
First steps in a weather reorganization. Note especially that
[flightgear.git] / src / FDM / 10520d.hxx
1 // Module:        10520c.c
2 //  Author:       Phil Schubert
3 //  Date started: 12/03/99
4 //  Purpose:      Models a Continental IO-520-M Engine
5 //  Called by:    FGSimExec
6 // 
7 //  Copyright (C) 1999  Philip L. Schubert (philings@ozemail.com.au)
8 //
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.
13 //
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.
18 //
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
22 // 02111-1307, USA.
23 //
24 // Further information about the GNU General Public License can also
25 // be found on the world wide web at http://www.gnu.org.
26 //
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
34 // 
35 // ARGUMENTS
36 // ------------------------------------------------------------------------
37 // 
38 // 
39 // HISTORY
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
44 //                      of Classes
45 // 15/03/99     PLS     Added Oil Pressure, Oil Temperature and CH Temp
46 // ------------------------------------------------------------------------
47 // INCLUDES
48 // ------------------------------------------------------------------------
49
50 #ifndef _10520D_HXX_
51 #define _10520D_HXX_
52
53
54 #include <iostream>
55 #include <math.h>
56
57
58 class FGEngine {
59
60 private:
61
62     // Control and environment inputs
63     float IAS;
64     // 0 = Closed, 100 = Fully Open
65     float Throttle_Lever_Pos;
66     // 0 = Full Course 100 = Full Fine
67     float Propeller_Lever_Pos;
68     // 0 = Idle Cut Off 100 = Full Rich
69     float Mixture_Lever_Pos;
70
71     // Engine Specific Variables used by this program that have limits.
72     // Will be set in a parameter file to be read in to create
73     // and instance for each engine.
74     float Max_Manifold_Pressure;
75     float Max_RPM;
76     float Min_RPM;
77     float Max_Fuel_Flow;
78     float Mag_Derate_Percent;
79     float MaxHP;
80     float Gear_Ratio;
81
82     // Initialise Engine Variables used by this instance
83     float Percentage_Power;
84     float Manifold_Pressure;    // Inches
85     float RPM;
86     float Fuel_Flow;            // lbs/hour
87     float Torque;
88     float CHT;
89     float Mixture;
90     float Oil_Pressure;         // PSI
91     float Oil_Temp;             // Deg C
92     float HP;
93     float RPS;
94     float Torque_Imbalance;
95     float Desired_RPM;
96
97     // Initialise Propellor Variables used by this instance
98     float FGProp1_Angular_V;
99     float FGProp1_Coef_Drag;
100     float FGProp1_Torque;
101     float FGProp1_Thrust;
102     float FGProp1_RPS;
103     float FGProp1_Coef_Lift;
104     float Alpha1;
105     float FGProp1_Blade_Angle;
106     float FGProp_Fine_Pitch_Stop;
107     float FGProp_Course_Pitch_Stop;
108
109     // Other internal values
110     float Rho;
111
112     // Calculate Engine RPM based on Propellor Lever Position
113     float Calc_Engine_RPM (float Position);
114
115 public:
116
117     // set initial default values
118     void init();
119
120     // update the engine model based on current control positions
121     void update();
122
123     inline void set_IAS( float value ) { IAS = value; }
124     inline void set_Throttle_Lever_Pos( float value ) {
125         Throttle_Lever_Pos = value;
126     }
127     inline void set_Propeller_Lever_Pos( float value ) {
128         Propeller_Lever_Pos = value;
129     }
130     inline void set_Mixture_Lever_Pos( float value ) {
131         Mixture_Lever_Pos = value;
132     }
133
134     // accessors
135     inline float get_RPM() const { return RPM; }
136     inline float get_FGProp1_Thrust() const { return FGProp1_Thrust; }
137
138     inline float get_Rho() const { return Rho; }
139 };
140
141
142 #endif // _10520D_HXX_