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