]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGPiston.h
Updated to match changes in radiostack.[ch]xx
[flightgear.git] / src / FDM / JSBSim / FGPiston.h
index a71197c3b0dbd0081d533ee3009779ebd01c32e4..a6841faab3536f9d95348859d8a5a1cef335aa96 100644 (file)
@@ -26,6 +26,7 @@
 HISTORY
 --------------------------------------------------------------------------------
 09/12/2000  JSB  Created
+10/01/2001  DPM  Modified to use equations from Dave Luff's piston model.
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 COMMENTS, REFERENCES,  and NOTES
@@ -44,9 +45,37 @@ INCLUDES
 
 #include "FGEngine.h"
 #include "FGConfigFile.h"
+#include "FGTable.h"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #define ID_PISTON "$Id$";
 
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+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$
+    @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>
+  */
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -54,21 +83,86 @@ CLASS DECLARATION
 class FGPiston : public FGEngine
 {
 public:
+  /// Constructor
   FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg);
+  /// Destructor
   ~FGPiston();
 
-  float Calculate(float PowerRequired);
-  float GetPowerAvailable(void) {return PowerAvailable;}
+  double Calculate(double PowerRequired);
+  double GetPowerAvailable(void) {return PowerAvailable;}
+  double CalcFuelNeed(void);
 
 private:
-  float BrakeHorsePower;
-  float SpeedSlope;
-  float SpeedIntercept;
-  float AltitudeSlope;
-  float PowerAvailable;
-  void Debug(void);
+  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
-