]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/propulsion/FGPiston.h
Andreas Gaeb: fix #222 (JSBSIm reset problems)
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGPiston.h
index 554ece8293d25b6a04ff6792b1c027cf92d310a5..510c6e6f2c185a15a531221f5abfc645086256cf 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Jon S. Berndt
  Date started: 09/12/2000
 
- ------------- Copyright (C) 2000  Jon S. Berndt (jsb@hal-pc.org) --------------
+ ------------- Copyright (C) 2000  Jon S. Berndt (jon@jsbsim.org) --------------
 
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the Free Software
@@ -27,7 +27,7 @@ HISTORY
 --------------------------------------------------------------------------------
 09/12/2000  JSB  Created
 10/01/2001  DPM  Modified to use equations from Dave Luff's piston model.
-
+11/01/2008  RKJ  Modified piston engine model for more general use.
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -40,14 +40,13 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGEngine.h"
-#include <math/FGTable.h>
-#include <input_output/FGXMLElement.h>
+#include "math/FGTable.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PISTON "$Id$";
+#define ID_PISTON "$Id: FGPiston.h,v 1.25 2010/11/30 12:17:10 jberndt Exp $";
 #define FG_MAX_BOOST_SPEEDS 3
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -69,13 +68,25 @@ CLASS DOCUMENTATION
   <minmp unit="{INHG | PA | ATM}"> {number} </minmp>
   <maxmp unit="{INHG | PA | ATM}"> {number} </maxmp>
   <displacement unit="{IN3 | LTR | CC}"> {number} </displacement>
+  <bore unit="{IN | M}"> {number} </bore>
+  <stroke unit="{IN | M}"> {number} </stroke>
+  <cylinders> {number} </cylinders>
+  <cylinder-head-mass unit="{KG | LBS}"> {number} </cylinder-head-mass>
+  <compression-ratio> {number} </compression-ratio>
+  <sparkfaildrop> {number} </sparkfaildrop>
   <maxhp unit="{HP | WATTS}"> {number} </maxhp>
   <cycles> {number} </cycles>
   <idlerpm> {number} </idlerpm>
+  <maxrpm> {number} </maxrpm>
   <maxthrottle> {number} </maxthrottle>
   <minthrottle> {number} </minthrottle>
+  <bsfc unit="{LBS/HP*HR | "KG/KW*HR"}"> {number} </bsfc>
+  <volumetric-efficiency> {number} </volumetric-efficiency>
+  <dynamic-fmep unit="{INHG | PA | ATM}"> {number} </dynamic-fmep>
+  <static-fmep unit="{INHG | PA | ATM}"> {number} </static-fmep>
   <numboostspeeds> {number} </numboostspeeds>
   <boostoverride> {0 | 1} </boostoverride>
+  <boostmanual> {0 | 1} </boostmanual>
   <ratedboost1 unit="{INHG | PA | ATM}"> {number} </ratedboost1>
   <ratedpower1 unit="{HP | WATTS}"> {number} </ratedpower1>
   <ratedrpm1> {number} </ratedrpm1>
@@ -89,6 +100,9 @@ CLASS DOCUMENTATION
   <ratedrpm3> {number} </ratedrpm3>
   <ratedaltitude3 unit="{FT | M}"> {number} </ratedaltitude3>
   <takeoffboost unit="{INHG | PA | ATM}"> {number} </takeoffboost>
+  <air-intake-impedance-factor> {number} </air-intake-impedance-factor>
+  <ram-air-factor> {number} </ram-air-factor>
+  <cooling-factor> {number} </cooling-factor>
 </piston_engine>
 @endcode
 
@@ -112,6 +126,10 @@ CLASS DOCUMENTATION
       some way of getting the boost control cutout lever position (on or off)
       from FlightGear first.
 
+    - BOOSTMANUAL - whether a multispeed supercharger will manually or
+      automatically shift boost speeds.  On manual shifting the boost speeds
+      is accomplished by controling propulsion/engine/boostspeed
+
     - The next items are all appended with either 1, 2 or 3 depending on which
       boost speed they refer to, eg RATEDBOOST1.  The rated values seems to have
       been a common convention at the time to express the maximum continuously
@@ -144,8 +162,7 @@ CLASS DOCUMENTATION
       config file (and is above RATEDBOOST1), then the throttle position is
       interpreted as:
 
-    - 0 to 0.95 : idle manifold pressure to rated boost (where attainable)
-    - 0.96, 0.97, 0.98 : rated boost (where attainable).
+    - 0 to 0.98 : idle manifold pressure to rated boost (where attainable)
     - 0.99, 1.0 : takeoff boost (where attainable).
 
     A typical takeoff boost for an earlyish Merlin was about 12psi, compared
@@ -164,7 +181,8 @@ CLASS DOCUMENTATION
     @author Jon S. Berndt (Engine framework code and framework-related mods)
     @author Dave Luff (engine operational code)
     @author David Megginson (initial porting and additional code)
-    @version $Id$
+    @author Ron Jensen (additional engine code)
+    @version $Id: FGPiston.h,v 1.25 2010/11/30 12:17:10 jberndt Exp $
   */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -179,33 +197,36 @@ public:
   /// Destructor
   ~FGPiston();
 
-  string GetEngineLabels(string delimeter);
-  string GetEngineValues(string delimeter);
+  std::string GetEngineLabels(const std::string& delimiter);
+  std::string GetEngineValues(const std::string& delimiter);
 
-  double Calculate(void);
-  double GetPowerAvailable(void) {return PowerAvailable;}
+  void Calculate(void);
+  double GetPowerAvailable(void) const {return PowerAvailable;}
   double CalcFuelNeed(void);
 
   void ResetToIC(void);
   void SetMagnetos(int magnetos) {Magnetos = magnetos;}
 
-  double  GetEGT(void) { return EGT_degC; }
-  int     GetMagnetos(void) {return Magnetos;}
+  double  GetEGT(void) const { return EGT_degC; }
+  int     GetMagnetos(void) const {return Magnetos;}
 
-  double getExhaustGasTemp_degF(void) {return KelvinToFahrenheit(ExhaustGasTemp_degK);}
+  double getExhaustGasTemp_degF(void) const {return KelvinToFahrenheit(ExhaustGasTemp_degK);}
   double getManifoldPressure_inHg(void) const {return ManifoldPressure_inHg;}
-  double getCylinderHeadTemp_degF(void) {return KelvinToFahrenheit(CylinderHeadTemp_degK);}
+  double getCylinderHeadTemp_degF(void) const {return KelvinToFahrenheit(CylinderHeadTemp_degK);}
   double getOilPressure_psi(void) const {return OilPressure_psi;}
-  double getOilTemp_degF (void) {return KelvinToFahrenheit(OilTemp_degK);}
-  double getRPM(void) {return RPM;}
+  double getOilTemp_degF (void) const {return KelvinToFahrenheit(OilTemp_degK);}
+  double getRPM(void) const {return RPM;}
+
+protected:
 
 private:
   int crank_counter;
 
-  double BrakeHorsePower;
-  double SpeedSlope;
-  double SpeedIntercept;
-  double AltitudeSlope;
+  double IndicatedHorsePower;
+  double PMEP;
+  double FMEP;
+  double FMEPDynamic;
+  double FMEPStatic;
   double PowerAvailable;
 
   // timestep
@@ -233,24 +254,42 @@ private:
   const double calorific_value_fuel;  // W/Kg (approximate)
   const double Cp_air;      // J/KgK
   const double Cp_fuel;     // J/KgK
+  const double standard_pressure; //Pa
+
 
   FGTable *Lookup_Combustion_Efficiency;
-  FGTable *Power_Mixture_Correlation;
+  FGTable *Mixture_Efficiency_Correlation;
 
   //
   // Configuration
   //
   double MinManifoldPressure_inHg; // Inches Hg
   double MaxManifoldPressure_inHg; // Inches Hg
+  double MaxManifoldPressure_Percent; // MaxManifoldPressure / 29.92
   double Displacement;             // cubic inches
+  double displacement_SI;          // cubic meters
   double MaxHP;                    // horsepower
   double SparkFailDrop;            // drop of power due to spark failure
   double Cycles;                   // cycles/power stroke
   double IdleRPM;                  // revolutions per minute
-  double StarterHP;                // initial horsepower of starter motor 
+  double MaxRPM;                   // revolutions per minute
+  double Bore;                     // inches
+  double Stroke;                   // inches
+  double Cylinders;                // number
+  double CylinderHeadMass;         // kilograms
+  double CompressionRatio;         // number
+  double Z_airbox; // number representing intake impediance before the throttle
+  double Z_throttle; // number representing slope of throttle impediance
+  double PeakMeanPistonSpeed_fps; // ft/sec speed where intake valves begin to choke. Typically 33-50 fps
+  double RatedMeanPistonSpeed_fps; // ft/sec derived from MaxRPM and stroke.
+  double Ram_Air_Factor;           // number
+
+  double StarterHP;                // initial horsepower of starter motor
   int BoostSpeeds;     // Number of super/turbocharger boost speeds - zero implies no turbo/supercharging.
   int BoostSpeed;      // The current boost-speed (zero-based).
   bool Boosted;                // Set true for boosted engine.
+  int BoostManual;     // The raw value read in from the config file - should be 1 or 0 - see description below.
+  bool bBoostManual;   // Set true if pilot must manually control the boost speed.
   int BoostOverride;   // The raw value read in from the config file - should be 1 or 0 - see description below.
   bool bBoostOverride; // Set true if pilot override of the boost regulator was fitted.
               // (Typically called 'war emergency power').
@@ -273,15 +312,18 @@ private:
   double minMAP;  // Pa
   double maxMAP;  // Pa
   double MAP;     // Pa
+  double TMAP;    // Pa - throttle manifold pressure e.g. before the supercharger boost
+  double ISFC;    // Indicated specific fuel consumption [lbs/horsepower*hour
 
   //
   // Inputs (in addition to those in FGEngine).
   //
   double p_amb;              // Pascals
-  double p_amb_sea_level;    // Pascals
+  double p_ram;              // Pascals
   double T_amb;              // degrees Kelvin
   double RPM;                // revolutions per minute
   double IAS;                // knots
+  double Cooling_Factor;     // normal
   bool Magneto_Left;
   bool Magneto_Right;
   int Magnetos;
@@ -291,10 +333,10 @@ private:
   //
   double rho_air;
   double volumetric_efficiency;
+  double map_coefficient;
   double m_dot_air;
   double equivalence_ratio;
   double m_dot_fuel;
-  double Percentage_Power;
   double HP;
   double combustion_efficiency;
   double ExhaustGasTemp_degK;
@@ -303,6 +345,7 @@ private:
   double CylinderHeadTemp_degK;
   double OilPressure_psi;
   double OilTemp_degK;
+  double MeanPistonSpeed_fps;
 
   void Debug(int from);
 };