|
From: Jon S. B. <jb...@us...> - 2011-07-28 12:48:24
|
Update of /cvsroot/jsbsim/JSBSim/src/models/propulsion
In directory vz-cvs-3.sog:/tmp/cvs-serv15987/src/models/propulsion
Modified Files:
FGElectric.cpp FGElectric.h FGEngine.cpp FGEngine.h
FGPiston.cpp FGPiston.h FGRocket.cpp FGRocket.h FGTurbine.cpp
FGTurbine.h FGTurboProp.cpp FGTurboProp.h
Log Message:
Major modification that moves towards completely independent engine models
Index: FGElectric.cpp
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/propulsion/FGElectric.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** FGElectric.cpp 6 Jun 2011 22:35:08 -0000 1.11
--- FGElectric.cpp 28 Jul 2011 12:48:19 -0000 1.12
***************
*** 40,51 ****
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
- #include "FGElectric.h"
- #include "models/FGPropulsion.h"
- #include "models/propulsion/FGThruster.h"
- #include "FGPropeller.h"
-
#include <iostream>
#include <sstream>
using namespace std;
--- 40,49 ----
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <iostream>
#include <sstream>
+ #include "FGElectric.h"
+ #include "FGPropeller.h"
+
using namespace std;
***************
*** 59,64 ****
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
! FGElectric::FGElectric(FGFDMExec* exec, Element *el, int engine_number)
! : FGEngine(exec, el, engine_number)
{
string token;
--- 57,62 ----
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
! FGElectric::FGElectric(FGFDMExec* exec, Element *el, int engine_number, struct FGEngine::Inputs& input)
! : FGEngine(exec, el, engine_number, input)
{
string token;
***************
*** 68,73 ****
hptowatts = 745.7;
- dt = FDMExec->GetDeltaT();
-
if (el->FindElement("power"))
PowerWatts = el->FindElementValueAsNumberConvertTo("power","WATTS");
--- 66,69 ----
***************
*** 94,107 ****
RunPreFunctions();
- Throttle = FCS->GetThrottlePos(EngineNumber);
-
if (Thruster->GetType() == FGThruster::ttPropeller) {
! ((FGPropeller*)Thruster)->SetAdvance(FCS->GetPropAdvance(EngineNumber));
! ((FGPropeller*)Thruster)->SetFeather(FCS->GetPropFeather(EngineNumber));
}
RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
! HP = PowerWatts * Throttle / hptowatts;
Thruster->Calculate(HP * hptoftlbssec);
--- 90,101 ----
RunPreFunctions();
if (Thruster->GetType() == FGThruster::ttPropeller) {
! ((FGPropeller*)Thruster)->SetAdvance(in.PropAdvance[EngineNumber]);
! ((FGPropeller*)Thruster)->SetFeather(in.PropFeather[EngineNumber]);
}
RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
! HP = PowerWatts * in.ThrottlePos[EngineNumber] / hptowatts;
Thruster->Calculate(HP * hptoftlbssec);
Index: FGElectric.h
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/propulsion/FGElectric.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** FGElectric.h 10 Mar 2011 01:35:25 -0000 1.10
--- FGElectric.h 28 Jul 2011 12:48:19 -0000 1.11
***************
*** 77,81 ****
public:
/// Constructor
! FGElectric(FGFDMExec* exec, Element *el, int engine_number);
/// Destructor
~FGElectric();
--- 77,81 ----
public:
/// Constructor
! FGElectric(FGFDMExec* exec, Element *el, int engine_number, FGEngine::Inputs& input);
/// Destructor
~FGElectric();
***************
*** 93,99 ****
double BrakeHorsePower;
- // timestep
- double dt;
-
// constants
double hptowatts;
--- 93,96 ----
Index: FGEngine.cpp
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/propulsion/FGEngine.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** FGEngine.cpp 3 Mar 2011 12:16:26 -0000 1.42
--- FGEngine.cpp 28 Jul 2011 12:48:19 -0000 1.43
***************
*** 38,41 ****
--- 38,45 ----
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+ #include <iostream>
+ #include <fstream>
+ #include <cstdlib>
+
#include "FGEngine.h"
#include "FGTank.h"
***************
*** 47,54 ****
#include "math/FGColumnVector3.h"
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
-
using namespace std;
--- 51,54 ----
***************
*** 62,67 ****
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
! FGEngine::FGEngine(FGFDMExec* exec, Element* engine_element, int engine_number)
! : EngineNumber(engine_number)
{
Element* local_element;
--- 62,67 ----
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
! FGEngine::FGEngine(FGFDMExec* exec, Element* engine_element, int engine_number, const struct Inputs& input)
! : EngineNumber(engine_number), in(input)
{
Element* local_element;
***************
*** 81,90 ****
FDMExec = exec;
- Atmosphere = FDMExec->GetAtmosphere();
- FCS = FDMExec->GetFCS();
Propulsion = FDMExec->GetPropulsion();
- Aircraft = FDMExec->GetAircraft();
- Propagate = FDMExec->GetPropagate();
- Auxiliary = FDMExec->GetAuxiliary();
PropertyManager = FDMExec->GetPropertyManager();
--- 81,85 ----
***************
*** 174,179 ****
void FGEngine::ResetToIC(void)
{
- Throttle = 0.0;
- Mixture = 1.0;
Starter = false;
FuelExpended = 0.0;
--- 169,172 ----
Index: FGEngine.h
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/propulsion/FGEngine.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** FGEngine.h 3 Mar 2011 12:16:26 -0000 1.23
--- FGEngine.h 28 Jul 2011 12:48:19 -0000 1.24
***************
*** 44,54 ****
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "math/FGModelFunctions.h"
#include "input_output/FGXMLFileRead.h"
#include "input_output/FGXMLElement.h"
- #include "models/FGFCS.h"
#include "math/FGColumnVector3.h"
- #include <vector>
- #include <string>
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- 44,54 ----
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+ #include <vector>
+ #include <string>
+
#include "math/FGModelFunctions.h"
#include "input_output/FGXMLFileRead.h"
#include "input_output/FGXMLElement.h"
#include "math/FGColumnVector3.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
***************
*** 65,73 ****
class FGFDMExec;
- class FGAtmosphere;
- class FGAircraft;
- class FGPropagate;
class FGPropulsion;
- class FGAuxiliary;
class FGThruster;
class Element;
--- 65,69 ----
***************
*** 129,133 ****
{
public:
! FGEngine(FGFDMExec* exec, Element* el, int engine_number);
virtual ~FGEngine();
--- 125,155 ----
{
public:
! struct Inputs {
! double SLPressure;
! double Pressure;
! double Temperature;
! double Density;
! double DensityRatio;
! double Soundspeed;
! double TotalPressure;
! double TotalTempearture;
! double TAT_c;
! double Vt;
! double Vc;
! double qbar;
! double alpha;
! double beta;
! FGColumnVector3 AeroUVW;
! FGColumnVector3 AeroPQR;
! vector <double> ThrottleCmd;
! vector <double> MixtureCmd;
! vector <double> ThrottlePos;
! vector <double> MixturePos;
! vector <double> PropAdvance;
! vector <bool> PropFeather;
! double TotalDeltaT;
! };
!
! FGEngine(FGFDMExec* exec, Element* el, int engine_number, const struct Inputs& input);
virtual ~FGEngine();
***************
*** 140,145 ****
virtual double GetThrottleMin(void) { return MinThrottle; }
virtual double GetThrottleMax(void) { return MaxThrottle; }
- virtual double GetThrottle(void) { return Throttle; }
- virtual double GetMixture(void) { return Mixture; }
virtual bool GetStarter(void) { return Starter; }
--- 162,165 ----
***************
*** 184,187 ****
--- 204,209 ----
virtual std::string GetEngineValues(const std::string& delimiter) = 0;
+ const struct Inputs& in;
+
protected:
/** Reduces the fuel in the active tanks by the amount required.
***************
*** 209,214 ****
double MinThrottle;
- double Throttle;
- double Mixture;
double FuelExpended;
double FuelFlowRate;
--- 231,234 ----
***************
*** 226,235 ****
FGFDMExec* FDMExec;
- FGAtmosphere* Atmosphere;
- FGFCS* FCS;
FGPropulsion* Propulsion;
- FGAircraft* Aircraft;
- FGPropagate* Propagate;
- FGAuxiliary* Auxiliary;
FGThruster* Thruster;
--- 246,250 ----
Index: FGPiston.cpp
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/propulsion/FGPiston.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -r1.59 -r1.60
*** FGPiston.cpp 12 Jul 2011 23:36:35 -0000 1.59
--- FGPiston.cpp 28 Jul 2011 12:48:19 -0000 1.60
***************
*** 41,52 ****
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <sstream>
#include "FGPiston.h"
- #include "models/FGAtmosphere.h"
- #include "models/FGAuxiliary.h"
- #include "models/FGPropulsion.h"
#include "FGPropeller.h"
- #include <iostream>
using namespace std;
--- 41,49 ----
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+ #include <iostream>
#include <sstream>
#include "FGPiston.h"
#include "FGPropeller.h"
using namespace std;
***************
*** 61,66 ****
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
! FGPiston::FGPiston(FGFDMExec* exec, Element* el, int engine_number)
! : FGEngine(exec, el, engine_number),
R_air(287.3), // Gas constant for air J/Kg/K
rho_fuel(800), // estimate
--- 58,63 ----
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
! FGPiston::FGPiston(FGFDMExec* exec, Element* el, int engine_number, const struct Inputs& input)
! : FGEngine(exec, el, engine_number, input),
R_air(287.3), // Gas constant for air J/Kg/K
rho_fuel(800), // estimate
***************
*** 75,79 ****
Type = etPiston;
- dt = FDMExec->GetDeltaT();
// These items are read from the configuration file
--- 72,75 ----
***************
*** 168,172 ****
*Mixture_Efficiency_Correlation << 0.12500 << 0.00000;
-
// Read inputs from engine data file where present.
--- 164,167 ----
***************
*** 348,352 ****
BoostSwitchAltitude[i] = RatedAltitude[i] + 1000;
}
! BoostSwitchPressure[i] = Atmosphere->GetPressure(BoostSwitchAltitude[i]) * psftopa;
//cout << "BoostSwitchAlt = " << BoostSwitchAltitude[i] << ", pressure = " << BoostSwitchPressure[i] << '\n';
// Assume there is some hysteresis on the supercharger gear switch, and guess the value for now
--- 343,347 ----
BoostSwitchAltitude[i] = RatedAltitude[i] + 1000;
}
! BoostSwitchPressure[i] = GetStdPressure100K(BoostSwitchAltitude[i]) * psftopa;
//cout << "BoostSwitchAlt = " << BoostSwitchAltitude[i] << ", pressure = " << BoostSwitchPressure[i] << '\n';
// Assume there is some hysteresis on the supercharger gear switch, and guess the value for now
***************
*** 354,358 ****
}
// Now work out the supercharger pressure multiplier of this speed from the rated boost and altitude.
! RatedMAP[i] = Atmosphere->GetPressureSL() * psftopa + RatedBoost[i] * 6895; // psi*6895 = Pa.
// Sometimes a separate BCV setting for takeoff or extra power is fitted.
if (TakeoffBoost > RatedBoost[0]) {
--- 349,353 ----
}
// Now work out the supercharger pressure multiplier of this speed from the rated boost and altitude.
! RatedMAP[i] = standard_pressure + RatedBoost[i] * 6895; // psi*6895 = Pa.
// Sometimes a separate BCV setting for takeoff or extra power is fitted.
if (TakeoffBoost > RatedBoost[0]) {
***************
*** 364,368 ****
bTakeoffBoost = false;
}
! BoostMul[i] = RatedMAP[i] / (Atmosphere->GetPressure(RatedAltitude[i]) * psftopa);
}
--- 359,363 ----
bTakeoffBoost = false;
}
! BoostMul[i] = RatedMAP[i] / (GetStdPressure100K(RatedAltitude[i]) * psftopa);
}
***************
*** 392,399 ****
FGEngine::ResetToIC();
! ManifoldPressure_inHg = Atmosphere->GetPressure() * psftoinhg; // psf to in Hg
! MAP = Atmosphere->GetPressure() * psftopa;
TMAP = MAP;
! double airTemperature_degK = RankineToKelvin(Atmosphere->GetTemperature());
OilTemp_degK = airTemperature_degK;
CylinderHeadTemp_degK = airTemperature_degK;
--- 387,394 ----
FGEngine::ResetToIC();
! ManifoldPressure_inHg = in.Pressure * psftoinhg; // psf to in Hg
! MAP = in.Pressure * psftopa;
TMAP = MAP;
! double airTemperature_degK = RankineToKelvin(in.Temperature);
OilTemp_degK = airTemperature_degK;
CylinderHeadTemp_degK = airTemperature_degK;
***************
*** 410,427 ****
RunPreFunctions();
- Throttle = FCS->GetThrottlePos(EngineNumber);
- Mixture = FCS->GetMixturePos(EngineNumber);
-
// Input values.
! p_amb = Atmosphere->GetPressure() * psftopa;
! double p = Auxiliary->GetTotalPressure() * psftopa;
p_ram = (p - p_amb) * Ram_Air_Factor + p_amb;
! T_amb = RankineToKelvin(Atmosphere->GetTemperature());
RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
MeanPistonSpeed_fps = ( RPM * Stroke) / (360); // AKA 2 * (RPM/60) * ( Stroke / 12) or 2NS
! IAS = Auxiliary->GetVcalibratedKTS();
doEngineStartup();
--- 405,419 ----
RunPreFunctions();
// Input values.
! p_amb = in.Pressure * psftopa;
! double p = in.TotalPressure * psftopa;
p_ram = (p - p_amb) * Ram_Air_Factor + p_amb;
! T_amb = RankineToKelvin(in.Temperature);
RPM = Thruster->GetRPM() * Thruster->GetGearRatio();
MeanPistonSpeed_fps = ( RPM * Stroke) / (360); // AKA 2 * (RPM/60) * ( Stroke / 12) or 2NS
! IAS = in.Vc;
doEngineStartup();
***************
*** 448,453 ****
if (Thruster->GetType() == FGThruster::ttPropeller) {
! ((FGPropeller*)Thruster)->SetAdvance(FCS->GetPropAdvance(EngineNumber));
! ((FGPropeller*)Thruster)->SetFeather(FCS->GetPropFeather(EngineNumber));
}
--- 440,445 ----
if (Thruster->GetType() == FGThruster::ttPropeller) {
! ((FGPropeller*)Thruster)->SetAdvance(in.PropAdvance[EngineNumber]);
! ((FGPropeller*)Thruster)->SetFeather(in.PropFeather[EngineNumber]);
}
***************
*** 461,466 ****
double FGPiston::CalcFuelNeed(void)
{
! double dT = FDMExec->GetDeltaT() * Propulsion->GetRate();
! FuelExpended = FuelFlowRate * dT;
return FuelExpended;
}
--- 453,457 ----
double FGPiston::CalcFuelNeed(void)
{
! FuelExpended = FuelFlowRate * in.TotalDeltaT;
return FuelExpended;
}
***************
*** 468,480 ****
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! int FGPiston::InitRunning(void) {
Magnetos=3;
! p_amb = Atmosphere->GetPressure() * psftopa;
! double mix= p_amb / (101325.0*1.3);
! FCS->SetMixturePos(EngineNumber, mix);
! Thruster->SetRPM( 2.*IdleRPM/Thruster->GetGearRatio() );
! //Thruster->SetRPM( 1000 );
! Running=true;
! // cout <<"Set Running in FGPiston. RPM:" << Thruster->GetRPM()*Thruster->GetGearRatio() <<" Pressure:"<<p_amb<<" Mixture:"<< mix <<endl;
return 1;
}
--- 459,467 ----
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! int FGPiston::InitRunning(void)
! {
Magnetos=3;
! Thruster->SetRPM( 2.0*IdleRPM/Thruster->GetGearRatio() );
! Running = true;
return 1;
}
***************
*** 596,600 ****
void FGPiston::doMAP(void)
{
! double Zt = (1-Throttle)*(1-Throttle)*Z_throttle; // throttle impedence
double Ze= MeanPistonSpeed_fps > 0 ? PeakMeanPistonSpeed_fps/MeanPistonSpeed_fps : 999999; // engine impedence
--- 583,587 ----
void FGPiston::doMAP(void)
{
! double Zt = (1 - in.ThrottlePos[EngineNumber])*(1 - in.ThrottlePos[EngineNumber])*Z_throttle; // throttle impedence
double Ze= MeanPistonSpeed_fps > 0 ? PeakMeanPistonSpeed_fps/MeanPistonSpeed_fps : 999999; // engine impedence
***************
*** 602,606 ****
// Add a one second lag to manifold pressure changes
! double dMAP = (TMAP - p_ram * map_coefficient) * dt;
TMAP -=dMAP;
--- 589,598 ----
// Add a one second lag to manifold pressure changes
! double dMAP=0;
! if (in.TotalDeltaT > 0.0)
! dMAP = (TMAP - p_ram * map_coefficient) * in.TotalDeltaT;
! else
! dMAP = (TMAP - p_ram * map_coefficient) / 120;
!
TMAP -=dMAP;
***************
*** 619,623 ****
bool bTakeoffPos = false;
if (bTakeoffBoost) {
! if (Throttle > 0.98) {
bTakeoffPos = true;
}
--- 611,615 ----
bool bTakeoffPos = false;
if (bTakeoffBoost) {
! if (in.ThrottlePos[EngineNumber] > 0.98) {
bTakeoffPos = true;
}
***************
*** 660,664 ****
// Eq 6-10 from The Internal Combustion Engine - Charles Taylor Vol 1
double ve =((gamma-1)/gamma) +( CompressionRatio -(p_amb/MAP))/(gamma*( CompressionRatio - 1));
! // FGAtmosphere::GetDensity() * FGJSBBase::m3toft3 / FGJSBBase::kgtoslug;
rho_air = p_amb / (R_air * T_amb);
double swept_volume = (displacement_SI * (RPM/60)) / 2;
--- 652,656 ----
// Eq 6-10 from The Internal Combustion Engine - Charles Taylor Vol 1
double ve =((gamma-1)/gamma) +( CompressionRatio -(p_amb/MAP))/(gamma*( CompressionRatio - 1));
!
rho_air = p_amb / (R_air * T_amb);
double swept_volume = (displacement_SI * (RPM/60)) / 2;
***************
*** 681,687 ****
void FGPiston::doFuelFlow(void)
{
! double thi_sea_level = 1.3 * Mixture; // Allows an AFR of infinity:1 to 11.3075:1
equivalence_ratio = thi_sea_level * 101325.0 / p_amb;
! // double AFR = 10+(12*(1-Mixture));// mixture 10:1 to 22:1
// m_dot_fuel = m_dot_air / AFR;
m_dot_fuel = (m_dot_air * equivalence_ratio) / 14.7;
--- 673,679 ----
void FGPiston::doFuelFlow(void)
{
! double thi_sea_level = 1.3 * in.MixturePos[EngineNumber]; // Allows an AFR of infinity:1 to 11.3075:1
equivalence_ratio = thi_sea_level * 101325.0 / p_amb;
! // double AFR = 10+(12*(1-in.Mixture[EngineNumber]));// mixture 10:1 to 22:1
// m_dot_fuel = m_dot_air / AFR;
m_dot_fuel = (m_dot_air * equivalence_ratio) / 14.7;
***************
*** 781,786 ****
} else { // Drop towards ambient - guess an appropriate time constant for now
combustion_efficiency = 0;
! dEGTdt = (RankineToKelvin(Atmosphere->GetTemperature()) - ExhaustGasTemp_degK) / 100.0;
! delta_T_exhaust = dEGTdt * dt;
ExhaustGasTemp_degK += delta_T_exhaust;
}
--- 773,782 ----
} else { // Drop towards ambient - guess an appropriate time constant for now
combustion_efficiency = 0;
! dEGTdt = (RankineToKelvin(in.Temperature) - ExhaustGasTemp_degK) / 100.0;
! if (in.TotalDeltaT > 0.0)
! delta_T_exhaust = dEGTdt * in.TotalDeltaT;
! else
! delta_T_exhaust = dEGTdt / 120;
!
ExhaustGasTemp_degK += delta_T_exhaust;
}
***************
*** 820,825 ****
double HeatCapacityCylinderHead = CpCylinderHead * MassCylinderHead;
! CylinderHeadTemp_degK +=
! (dqdt_cylinder_head / HeatCapacityCylinderHead) * dt;
}
--- 816,825 ----
double HeatCapacityCylinderHead = CpCylinderHead * MassCylinderHead;
! if (in.TotalDeltaT > 0.0)
! CylinderHeadTemp_degK +=
! (dqdt_cylinder_head / HeatCapacityCylinderHead) * in.TotalDeltaT;
! else
! CylinderHeadTemp_degK +=
! (dqdt_cylinder_head / HeatCapacityCylinderHead) / 120.0;
}
***************
*** 855,859 ****
double dOilTempdt = (target_oil_temp - OilTemp_degK) / time_constant;
! OilTemp_degK += (dOilTempdt * dt);
}
--- 855,862 ----
double dOilTempdt = (target_oil_temp - OilTemp_degK) / time_constant;
! if (in.TotalDeltaT > 0.0)
! OilTemp_degK += (dOilTempdt * in.TotalDeltaT);
! else
! OilTemp_degK += (dOilTempdt / 120.0);
}
***************
*** 884,887 ****
--- 887,914 ----
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ //
+ // This is a local copy of the same function in FGStandardAtmosphere.
+
+ double FGPiston::GetStdPressure100K(double altitude) const
+ {
+ // Limit this equation to input altitudes of 100000 ft.
+ if (altitude > 100000.0) altitude = 100000.0;
+
+ double alt[5];
+ const double coef[5] = { 2116.217,
+ -7.648932746E-2,
+ 1.0925498604E-6,
+ -7.1135726027E-12,
+ 1.7470331356E-17 };
+
+ alt[0] = 1;
+ for (int pwr=1; pwr<=4; pwr++) alt[pwr] = alt[pwr-1]*altitude;
+
+ double press = 0.0;
+ for (int ctr=0; ctr<=4; ctr++) press += coef[ctr]*alt[ctr];
+ return press;
+ }
+
+ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGPiston::GetEngineLabels(const string& delimiter)
Index: FGPiston.h
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/propulsion/FGPiston.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** FGPiston.h 16 Jun 2011 16:32:10 -0000 1.29
--- FGPiston.h 28 Jul 2011 12:48:19 -0000 1.30
***************
*** 210,214 ****
public:
/// Constructor
! FGPiston(FGFDMExec* exec, Element* el, int engine_number);
/// Destructor
~FGPiston();
--- 210,214 ----
public:
/// Constructor
! FGPiston(FGFDMExec* exec, Element* el, int engine_number, const struct Inputs& input);
/// Destructor
~FGPiston();
***************
*** 245,251 ****
double FMEPStatic;
- // timestep
- double dt;
-
void doEngineStartup(void);
void doBoostControl(void);
--- 245,248 ----
***************
*** 258,261 ****
--- 255,259 ----
void doOilPressure(void);
void doOilTemperature(void);
+ double GetStdPressure100K(double altitude) const;
int InitRunning(void);
Index: FGRocket.cpp
===================================================================
RCS file: /cvsroot/jsbsim/JSBSim/src/models/propulsion/FGRocket.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** FGRocket.cpp 24 Jan 2011 13:01:56 -0000 1.23
--- FGRocket.cpp 28 Jul 2011 12:48:19 -0000 1.24
***************
*** 57,62 ****
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
! FGRocket::FGRocket(FGFDMExec* exec, Element *el, int engine_number)
! : FGEngine(exec, el, engine_number)
{
Type = etRocket;
--- 57,62 ----
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
! FGRocket::FGRocket(FGFDMExec* exec, Element *el, int engine_number, const struct Inputs& input)
! : FGEngine(exec, el, engine_number, input)
{
Type = etRocket;
***************
*** 127,138 ****
if (FDMExec->IntegrationSuspended()) return;
- double dT = FDMExec->GetDeltaT()*Propulsion->GetRate();
-
RunPreFunctions();
if (!Flameout && !Starved) ConsumeFuel();
! PropellantFlowRate = (FuelExpended + OxidizerExpended)/dT;
! Throttle = FCS->GetThrottlePos(EngineNumber);
// If there is a thrust table, it is a function of propellant burned. The
--- 127,135 ----
if (FDMExec->IntegrationSuspended()) return;
RunPreFunctions();
if (!Flameout && !Starved) ConsumeFuel();
! PropellantFlowRate = (FuelExpended + OxidizerExpended)/in.TotalDeltaT;
// If there is a thrust table, i |