2001-11-09 04:38:53 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
Header: FGPiston.h
|
|
|
|
Author: Jon S. Berndt
|
|
|
|
Date started: 09/12/2000
|
|
|
|
|
|
|
|
------------- Copyright (C) 2000 Jon S. Berndt (jsb@hal-pc.org) --------------
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Further information about the GNU General Public License can also be found on
|
|
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
09/12/2000 JSB Created
|
|
|
|
10/01/2001 DPM Modified to use equations from Dave Luff's piston model.
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
COMMENTS, REFERENCES, and NOTES
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
DOCUMENTATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
/** Models Dave Luff's engine model as ported into JSBSim by David Megginson.
|
|
|
|
@author Jon S. Berndt (Engine framework code and framework-related mods)
|
|
|
|
@author Dave Luff (engine operational code)
|
|
|
|
@author David Megginson (porting and additional code)
|
|
|
|
@version $Id$
|
2002-04-06 16:03:16 +00:00
|
|
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPiston.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
|
|
|
Header File </a>
|
|
|
|
@see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPiston.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
|
|
|
|
Source File </a>
|
2001-11-09 04:38:53 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS DECLARATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
class FGPiston : public FGEngine
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// Constructor
|
|
|
|
FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg);
|
|
|
|
/// Destructor
|
|
|
|
~FGPiston();
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double Calculate(double PowerRequired);
|
|
|
|
double GetPowerAvailable(void) {return PowerAvailable;}
|
2002-01-19 05:32:28 +00:00
|
|
|
double CalcFuelNeed(void);
|
2001-11-09 04:38:53 +00:00
|
|
|
|
|
|
|
private:
|
2001-11-24 22:13:04 +00:00
|
|
|
int crank_counter;
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double BrakeHorsePower;
|
|
|
|
double SpeedSlope;
|
|
|
|
double SpeedIntercept;
|
|
|
|
double AltitudeSlope;
|
|
|
|
double PowerAvailable;
|
2001-11-09 04:38:53 +00:00
|
|
|
|
|
|
|
// timestep
|
2001-11-20 22:34:24 +00:00
|
|
|
double dt;
|
2001-11-09 04:38:53 +00:00
|
|
|
|
|
|
|
void doEngineStartup(void);
|
|
|
|
void doManifoldPressure(void);
|
|
|
|
void doAirFlow(void);
|
|
|
|
void doFuelFlow(void);
|
|
|
|
void doEnginePower(void);
|
|
|
|
void doEGT(void);
|
|
|
|
void doCHT(void);
|
|
|
|
void doOilPressure(void);
|
|
|
|
void doOilTemperature(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// constants
|
|
|
|
//
|
2001-11-20 22:34:24 +00:00
|
|
|
const double CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
|
2001-11-09 04:38:53 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
const double R_air;
|
|
|
|
const double rho_fuel; // kg/m^3
|
|
|
|
const double calorific_value_fuel; // W/Kg (approximate)
|
|
|
|
const double Cp_air; // J/KgK
|
|
|
|
const double Cp_fuel; // J/KgK
|
2001-11-09 04:38:53 +00:00
|
|
|
|
|
|
|
FGTable *Lookup_Combustion_Efficiency;
|
|
|
|
FGTable *Power_Mixture_Correlation;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Configuration
|
|
|
|
//
|
2001-11-20 22:34:24 +00:00
|
|
|
double MinManifoldPressure_inHg; // Inches Hg
|
|
|
|
double MaxManifoldPressure_inHg; // Inches Hg
|
|
|
|
double Displacement; // cubic inches
|
|
|
|
double MaxHP; // horsepower
|
|
|
|
double Cycles; // cycles/power stroke
|
|
|
|
double IdleRPM; // revolutions per minute
|
2001-11-09 04:38:53 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Inputs (in addition to those in FGEngine).
|
|
|
|
//
|
2001-11-20 22:34:24 +00:00
|
|
|
double p_amb; // Pascals
|
|
|
|
double p_amb_sea_level; // Pascals
|
|
|
|
double T_amb; // degrees Kelvin
|
|
|
|
double RPM; // revolutions per minute
|
|
|
|
double IAS; // knots
|
2001-11-09 04:38:53 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Outputs (in addition to those in FGEngine).
|
|
|
|
//
|
|
|
|
bool Magneto_Left;
|
|
|
|
bool Magneto_Right;
|
2001-11-20 22:34:24 +00:00
|
|
|
double rho_air;
|
|
|
|
double volumetric_efficiency;
|
|
|
|
double m_dot_air;
|
|
|
|
double equivalence_ratio;
|
|
|
|
double m_dot_fuel;
|
|
|
|
double Percentage_Power;
|
|
|
|
double HP;
|
|
|
|
double combustion_efficiency;
|
2001-11-09 04:38:53 +00:00
|
|
|
|
2001-12-13 04:48:34 +00:00
|
|
|
void Debug(int from);
|
2001-11-09 04:38:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
#endif
|