1
0
Fork 0
flightgear/src/FDM/JSBSim/FGPiston.h

160 lines
4.9 KiB
C
Raw Normal View History

2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +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.
2000-10-02 23:07:30 +00:00
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
COMMENTS, REFERENCES, and NOTES
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
SENTRY
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2000-10-02 23:07:30 +00:00
#ifndef FGPISTON_H
#define FGPISTON_H
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
INCLUDES
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2000-10-02 23:07:30 +00:00
#include "FGEngine.h"
2001-03-30 01:04:50 +00:00
#include "FGConfigFile.h"
2000-10-02 23:07:30 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2001-03-30 01:04:50 +00:00
#define ID_PISTON "$Id$";
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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$
*/
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
CLASS DECLARATION
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
2000-10-02 23:07:30 +00:00
class FGPiston : public FGEngine
{
public:
/// Constructor
2001-03-30 01:04:50 +00:00
FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg);
/// Destructor
2000-10-02 23:07:30 +00:00
~FGPiston();
2001-03-30 01:04:50 +00:00
float Calculate(float PowerRequired);
float GetPowerAvailable(void) {return PowerAvailable;}
private:
float BrakeHorsePower;
float SpeedSlope;
float SpeedIntercept;
float AltitudeSlope;
float PowerAvailable;
// timestep
float dt;
// engine state
bool running;
bool cranking;
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
//
const float CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
const float R_air;
const float rho_fuel; // kg/m^3
const float calorific_value_fuel; // W/Kg (approximate)
const float Cp_air; // J/KgK
const float Cp_fuel; // J/KgK
//
// Configuration
//
float MinManifoldPressure_inHg; // Inches Hg
float MaxManifoldPressure_inHg; // Inches Hg
float Displacement; // cubic inches
float MaxHP; // horsepower
float Cycles; // cycles/power stroke
float IdleRPM; // revolutions per minute
//
// Inputs (in addition to those in FGEngine).
//
float p_amb; // Pascals
float p_amb_sea_level; // Pascals
float T_amb; // degrees Kelvin
float RPM; // revolutions per minute
float IAS; // knots
//
// Outputs (in addition to those in FGEngine).
//
float rho_air;
float volumetric_efficiency;
float m_dot_air;
float equivalence_ratio;
float m_dot_fuel;
float Percentage_Power;
float HP;
float combustion_efficiency;
2001-03-30 01:04:50 +00:00
void Debug(void);
2000-10-02 23:07:30 +00:00
};
2000-11-03 23:02:47 +00:00
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000-10-02 23:07:30 +00:00
#endif