1
0
Fork 0

Sync. again

This commit is contained in:
Erik Hofman 2016-01-11 11:39:11 +01:00
parent 6e1b5e9f2e
commit 508c367c5b
14 changed files with 94 additions and 77 deletions

View file

@ -72,7 +72,7 @@ using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.185 2015/12/13 08:01:50 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.186 2016/01/10 16:32:26 bcoconni Exp $");
IDENT(IdHdr,ID_FDMEXEC);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -399,7 +399,6 @@ void FGFDMExec::LoadInputs(unsigned int idx)
Auxiliary->in.TurbPQR = Winds->GetTurbPQR();
Auxiliary->in.WindPsi = Winds->GetWindPsi();
Auxiliary->in.Vwind = Winds->GetTotalWindNED().Magnitude();
Auxiliary->in.PitotAngle = Aircraft->GetPitotAngle();
break;
case eSystems:
// Dynamic inputs come into the components that FCS manages through properties
@ -542,6 +541,7 @@ void FGFDMExec::LoadModelConstants(void)
Aerodynamics->in.Wingspan = Aircraft->GetWingSpan();
Auxiliary->in.Wingspan = Aircraft->GetWingSpan();
Auxiliary->in.Wingchord = Aircraft->Getcbar();
Auxiliary->in.PitotAngle = Aircraft->GetPitotAngle();
GroundReactions->in.vXYZcg = MassBalance->GetXYZcg();
LoadPlanetConstants();

View file

@ -46,7 +46,7 @@ using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGJSBBase.cpp,v 1.40 2015/07/12 19:34:08 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGJSBBase.cpp,v 1.41 2016/01/10 12:07:49 bcoconni Exp $");
IDENT(IdHdr,ID_JSBBASE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -84,8 +84,8 @@ const double FGJSBBase::degtorad = 0.017453292519943295769236907684886;
const double FGJSBBase::hptoftlbssec = 550.0;
const double FGJSBBase::psftoinhg = 0.014138;
const double FGJSBBase::psftopa = 47.88;
const double FGJSBBase::fpstokts = 0.592484;
const double FGJSBBase::ktstofps = 1.68781;
const double FGJSBBase::fpstokts = 1.0/ktstofps;
const double FGJSBBase::inchtoft = 0.08333333;
const double FGJSBBase::in3tom3 = 1.638706E-5;
const double FGJSBBase::m3toft3 = 1.0/(fttom*fttom*fttom);
@ -275,13 +275,11 @@ double FGJSBBase::GaussianRandomNumber(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGJSBBase::VcalibratedFromMach(double mach, double p, double psl, double rhosl)
double FGJSBBase::PitotTotalPressure(double mach, double p)
{
double pt,A;
if (mach < 0) mach=0;
if (mach < 0) return 0;
if (mach < 1) //calculate total pressure assuming isentropic flow
pt=p*pow((1 + 0.2*mach*mach),3.5);
return p*pow((1 + 0.2*mach*mach),3.5);
else {
// shock in front of pitot tube, we'll assume its normal and use
// the Rayleigh Pitot Tube Formula, i.e. the ratio of total
@ -298,10 +296,17 @@ double FGJSBBase::VcalibratedFromMach(double mach, double p, double psl, double
// The denominator below is zero for Mach ~ 0.38, for which
// we'll never be here, so we're safe
pt = p*166.92158*pow(mach,7.0)/pow(7*mach*mach-1,2.5);
return p*166.92158*pow(mach,7.0)/pow(7*mach*mach-1,2.5);
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGJSBBase::VcalibratedFromMach(double mach, double p, double psl, double rhosl)
{
double pt = PitotTotalPressure(mach, p);
double A = pow(((pt-p)/psl+1), 1./3.5);
A = pow(((pt-p)/psl+1),0.28571);
return sqrt(7*psl/rhosl*(A-1));
}
@ -312,7 +317,7 @@ double FGJSBBase::MachFromVcalibrated(double vcas, double p, double psl, double
double pt = p + psl*(pow(1+vcas*vcas*rhosl/(7.0*psl),3.5)-1);
if (pt/p < 1.89293)
return sqrt(5.0*(pow(pt/p, 0.2857143) -1)); // Mach < 1
return sqrt(5.0*(pow(pt/p, 1./3.5) -1)); // Mach < 1
else {
// Mach >= 1
double mach = sqrt(0.77666*pt/p); // Initial guess is based on a quadratic approximation of the Rayleigh formula

View file

@ -54,7 +54,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.44 2015/09/17 19:44:13 bcoconni Exp $"
#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.45 2016/01/10 12:07:49 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -70,7 +70,7 @@ CLASS DOCUMENTATION
* This class provides universal constants, utility functions, messaging
* functions, and enumerated constants to JSBSim.
@author Jon S. Berndt
@version $Id: FGJSBBase.h,v 1.44 2015/09/17 19:44:13 bcoconni Exp $
@version $Id: FGJSBBase.h,v 1.45 2016/01/10 12:07:49 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -261,6 +261,15 @@ public:
return measure*0.3048;
}
/** Compute the total pressure in front of the Pitot tube. It uses the
* Rayleigh formula for supersonic speeds (See "Introduction to Aerodynamics
* of a Compressible Fluid - H.W. Liepmann, A.E. Puckett - Wiley & sons
* (1947)" §5.4 pp 75-80)
* @param mach The Mach number
* @param p Pressure in psf
* @return The total pressure in front of the Pitot tube in psf */
static double PitotTotalPressure(double mach, double p);
/** Calculate the calibrated airspeed from the Mach number. It uses the
* Rayleigh formula for supersonic speeds (See "Introduction to Aerodynamics
* of a Compressible Fluid - H.W. Liepmann, A.E. Puckett - Wiley & sons

View file

@ -50,6 +50,7 @@ INCLUDES
#include "FGFDMExec.h"
#include "models/FGInertial.h"
#include "models/FGAtmosphere.h"
#include "models/FGAircraft.h"
#include "models/FGAccelerations.h"
#include "input_output/FGXMLFileRead.h"
@ -57,7 +58,7 @@ using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.102 2015/12/13 08:16:00 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.104 2016/01/10 16:35:28 bcoconni Exp $");
IDENT(IdHdr,ID_INITIALCONDITION);
//******************************************************************************
@ -68,6 +69,7 @@ FGInitialCondition::FGInitialCondition(FGFDMExec *FDMExec) : fdmex(FDMExec)
if(FDMExec != NULL ) {
Atmosphere=fdmex->GetAtmosphere();
Aircraft=fdmex->GetAircraft();
} else {
cout << "FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
}
@ -161,8 +163,7 @@ void FGInitialCondition::SetVequivalentKtsIC(double ve)
void FGInitialCondition::SetMachIC(double mach)
{
double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL);
double soundSpeed = sqrt(SHRatio*Reng*temperature);
double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
SetVtrueFpsIC(mach*soundSpeed);
lastSpeedSet = setmach;
}
@ -176,10 +177,10 @@ void FGInitialCondition::SetVcalibratedKtsIC(double vcas)
double pressureSL = Atmosphere->GetPressureSL();
double rhoSL = Atmosphere->GetDensitySL();
double mach = MachFromVcalibrated(fabs(vcas)*ktstofps, pressure, pressureSL, rhoSL);
double temperature = Atmosphere->GetTemperature(altitudeASL);
double soundSpeed = sqrt(SHRatio*Reng*temperature);
double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
double PitotAngle = Aircraft->GetPitotAngle();
SetVtrueFpsIC(mach*soundSpeed);
SetVtrueFpsIC(mach * soundSpeed / (cos(alpha+PitotAngle) * cos(beta)));
lastSpeedSet = setvc;
}
@ -206,8 +207,8 @@ void FGInitialCondition::calcAeroAngles(const FGColumnVector3& _vt_NED)
alpha = atan2( wa, ua );
// alpha cannot be constrained without updating other informations like the
// true speed or the Euler angles. Otherwise we might end up with an inconsistent
// state of the aircraft.
// true speed or the Euler angles. Otherwise we might end up with an
// inconsistent state of the aircraft.
/*alpha = Constrain(fdmex->GetAerodynamics()->GetAlphaCLMin(), alpha,
fdmex->GetAerodynamics()->GetAlphaCLMax());*/
@ -686,10 +687,9 @@ void FGInitialCondition::SetAltitudeAGLFtIC(double agl)
void FGInitialCondition::SetAltitudeASLFtIC(double alt)
{
double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL);
double pressure = Atmosphere->GetPressure(altitudeASL);
double pressureSL = Atmosphere->GetPressureSL();
double soundSpeed = sqrt(SHRatio*Reng*temperature);
double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
double rho = Atmosphere->GetDensity(altitudeASL);
double rhoSL = Atmosphere->GetDensitySL();
@ -700,8 +700,7 @@ void FGInitialCondition::SetAltitudeASLFtIC(double alt)
altitudeASL=alt;
position.SetAltitudeASL(alt);
temperature = Atmosphere->GetTemperature(altitudeASL);
soundSpeed = sqrt(SHRatio*Reng*temperature);
soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
rho = Atmosphere->GetDensity(altitudeASL);
pressure = Atmosphere->GetPressure(altitudeASL);
@ -813,12 +812,13 @@ double FGInitialCondition::GetBodyWindFpsIC(int idx) const
double FGInitialCondition::GetVcalibratedKtsIC(void) const
{
double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL);
double pressure = Atmosphere->GetPressure(altitudeASL);
double pressureSL = Atmosphere->GetPressureSL();
double rhoSL = Atmosphere->GetDensitySL();
double soundSpeed = sqrt(SHRatio*Reng*temperature);
double mach = vt / soundSpeed;
double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
double PitotAngle = Aircraft->GetPitotAngle();
double mach = vt * cos(alpha+PitotAngle) * cos(beta) / soundSpeed;
return fpstokts * VcalibratedFromMach(mach, pressure, pressureSL, rhoSL);
}
@ -837,8 +837,7 @@ double FGInitialCondition::GetVequivalentKtsIC(void) const
double FGInitialCondition::GetMachIC(void) const
{
double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL);
double soundSpeed = sqrt(SHRatio*Reng*temperature);
double soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
return vt / soundSpeed;
}

View file

@ -54,7 +54,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.43 2015/03/28 14:49:01 bcoconni Exp $"
#define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.44 2016/01/10 16:35:28 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -66,6 +66,7 @@ class FGFDMExec;
class FGMatrix33;
class FGColumnVector3;
class FGAtmosphere;
class FGAircraft;
class FGPropertyManager;
class Element;
@ -218,7 +219,7 @@ CLASS DOCUMENTATION
@property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second
@author Tony Peden
@version "$Id: FGInitialCondition.h,v 1.43 2015/03/28 14:49:01 bcoconni Exp $"
@version "$Id: FGInitialCondition.h,v 1.44 2016/01/10 16:35:28 bcoconni Exp $"
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -684,6 +685,7 @@ private:
FGFDMExec *fdmex;
FGAtmosphere* Atmosphere;
FGAircraft* Aircraft;
bool Load_v1(Element* document);
bool Load_v2(Element* document);
@ -701,4 +703,3 @@ private:
};
}
#endif

4
src/FDM/JSBSim/input_output/FGXMLElement.cpp Normal file → Executable file
View file

@ -45,7 +45,7 @@ FORWARD DECLARATIONS
namespace JSBSim {
IDENT(IdSrc,"$Id: FGXMLElement.cpp,v 1.54 2015/09/27 15:39:45 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGXMLElement.cpp,v 1.55 2016/01/02 15:23:50 bcoconni Exp $");
IDENT(IdHdr,ID_XMLELEMENT);
bool Element::converterIsInitialized = false;
@ -698,7 +698,7 @@ void Element::MergeAttributes(Element* el)
if (attributes.find(it->first) == attributes.end())
attributes[it->first] = it->second;
else {
if (FGJSBBase::debug_lvl > 0)
if (FGJSBBase::debug_lvl > 0 && (attributes[it->first] != it->second))
cout << el->ReadFrom() << " Attribute '" << it->first << "' is overridden in file "
<< GetFileName() << ": line " << GetLineNumber() << endl
<< " The value '" << attributes[it->first] << "' will be used instead of '"

View file

@ -50,7 +50,7 @@ INCLUDES
namespace JSBSim {
IDENT(IdSrc,"$Id: FGAtmosphere.cpp,v 1.59 2014/05/07 19:51:43 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGAtmosphere.cpp,v 1.61 2016/01/10 19:22:12 bcoconni Exp $");
IDENT(IdHdr,ID_ATMOSPHERE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -153,6 +153,13 @@ double FGAtmosphere::GetDensity(double altitude) const
{
return GetPressure(altitude)/(Reng * GetTemperature(altitude));
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Get the sound speed at a specified altitude
double FGAtmosphere::GetSoundSpeed(double altitude) const
{
return sqrt(SHRatio * Reng * GetTemperature(altitude));
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// This function sets the sea level temperature.
@ -244,7 +251,7 @@ double FGAtmosphere::ConvertFromPSF(double p, ePressure unit) const
void FGAtmosphere::bind(void)
{
// typedef double (FGAtmosphere::*PMFi)(int) const;
typedef double (FGAtmosphere::*PMFi)(int) const;
// typedef void (FGAtmosphere::*PMF)(int, double);
PropertyManager->Tie("atmosphere/T-R", this, &FGAtmosphere::GetTemperature);
PropertyManager->Tie("atmosphere/rho-slugs_ft3", this, &FGAtmosphere::GetDensity);
@ -252,8 +259,8 @@ void FGAtmosphere::bind(void)
PropertyManager->Tie("atmosphere/a-fps", this, &FGAtmosphere::GetSoundSpeed);
PropertyManager->Tie("atmosphere/T-sl-R", this, &FGAtmosphere::GetTemperatureSL);
PropertyManager->Tie("atmosphere/rho-sl-slugs_ft3", this, &FGAtmosphere::GetDensitySL);
// PropertyManager->Tie("atmosphere/P-sl-psf", this, ePSF,
// (PMFi)&FGAtmosphere::GetPressureSL,
PropertyManager->Tie("atmosphere/P-sl-psf", this, ePSF,
(PMFi)&FGAtmosphere::GetPressureSL);
// (PMF)&FGAtmosphere::SetPressureSL);
PropertyManager->Tie("atmosphere/a-sl-fps", this, &FGAtmosphere::GetSoundSpeedSL);
PropertyManager->Tie("atmosphere/theta", this, &FGAtmosphere::GetTemperatureRatio);

View file

@ -45,7 +45,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_ATMOSPHERE "$Id: FGAtmosphere.h,v 1.31 2012/08/20 12:28:50 jberndt Exp $"
#define ID_ATMOSPHERE "$Id: FGAtmosphere.h,v 1.32 2016/01/10 15:56:30 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -74,7 +74,7 @@ CLASS DOCUMENTATION
@property atmosphere/a-ratio
@author Jon Berndt
@version $Id: FGAtmosphere.h,v 1.31 2012/08/20 12:28:50 jberndt Exp $
@version $Id: FGAtmosphere.h,v 1.32 2016/01/10 15:56:30 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -190,6 +190,9 @@ public:
/// Returns the speed of sound in ft/sec.
virtual double GetSoundSpeed(void) const {return Soundspeed;}
/// Returns the speed of sound in ft/sec at a given altitude in ft.
virtual double GetSoundSpeed(double altitude) const;
/// Returns the sea level speed of sound in ft/sec.
virtual double GetSoundSpeedSL(void) const { return SLsoundspeed; }

18
src/FDM/JSBSim/models/FGAuxiliary.cpp Normal file → Executable file
View file

@ -51,7 +51,7 @@ using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGAuxiliary.cpp,v 1.70 2015/09/20 20:53:13 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGAuxiliary.cpp,v 1.71 2016/01/10 12:12:59 bcoconni Exp $");
IDENT(IdHdr,ID_AUXILIARY);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -139,8 +139,6 @@ FGAuxiliary::~FGAuxiliary()
bool FGAuxiliary::Run(bool Holding)
{
double A,B,D;
if (FGModel::Run(Holding)) return true; // return true if error returned from base class
if (Holding) return false;
@ -215,20 +213,10 @@ bool FGAuxiliary::Run(bool Holding)
Vpitot = vPitotUVW(eU);
if (Vpitot < 0.0) Vpitot = 0.0;
MachPitot = Vpitot / in.SoundSpeed;
double MachP2 = MachPitot * MachPitot;
pt = PitotTotalPressure(MachPitot, in.Pressure);
if (MachPitot < 1) { // Calculate total pressure assuming isentropic flow
pt = in.Pressure*pow((1 + 0.2*MachP2),3.5);
} else {
// Use Rayleigh pitot tube formula for normal shock in front of pitot tube
B = 5.76 * MachP2 / (5.6*MachP2 - 0.8);
D = (2.8 * MachP2 - 0.4) * 0.4167;
pt = in.Pressure*pow(B,3.5)*D;
}
A = pow(((pt-in.Pressure)/in.PressureSL + 1),0.28571);
if (abs(MachPitot) > 0.0) {
vcas = sqrt(7 * in.PressureSL / in.DensitySL * (A-1));
vcas = VcalibratedFromMach(MachPitot, in.Pressure, in.PressureSL, in.DensitySL);
veas = sqrt(2 * qbar / in.DensitySL);
vtrue = 1116.43559 * Mach * sqrt(in.Temperature / 518.67);
} else {

View file

@ -65,7 +65,7 @@ using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGPropulsion.cpp,v 1.84 2015/03/28 14:49:02 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGPropulsion.cpp,v 1.85 2016/01/02 17:42:53 bcoconni Exp $");
IDENT(IdHdr,ID_PROPULSION);
extern short debug_lvl;
@ -281,12 +281,18 @@ bool FGPropulsion::GetSteadyState(void)
int steady_count = 0, j = 0;
bool steady = false;
bool TrimMode = FDMExec->GetTrimStatus();
bool suspended = FDMExec->IntegrationSuspended();
vForces.InitMatrix();
vMoments.InitMatrix();
if (!FGModel::Run(false)) {
FDMExec->SetTrimStatus(true);
if (suspended)
FDMExec->ResumeIntegration();
// This is a time marching algorithm so it needs a non-zero time step to
// reach a steady state.
in.TotalDeltaT = 0.5;
for (unsigned int i=0; i<numEngines; i++) {
steady=false;
@ -311,6 +317,12 @@ bool FGPropulsion::GetSteadyState(void)
}
FDMExec->SetTrimStatus(TrimMode);
if (suspended) {
FDMExec->SuspendIntegration();
in.TotalDeltaT = 0.0;
}
else
in.TotalDeltaT = FDMExec->GetDeltaT() * rate;
return false;
} else {

View file

@ -51,7 +51,7 @@ using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGPiston.cpp,v 1.81 2015/09/27 09:54:21 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGPiston.cpp,v 1.82 2016/01/02 17:42:53 bcoconni Exp $");
IDENT(IdHdr,ID_PISTON);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -470,8 +470,6 @@ void FGPiston::Calculate(void)
RunPreFunctions();
TotalDeltaT = ( in.TotalDeltaT < 1e-9 ) ? 1.0 : in.TotalDeltaT;
/* The thruster controls the engine RPM because it encapsulates the gear ratio and other transmission variables */
RPM = Thruster->GetEngineRPM();
@ -644,7 +642,7 @@ void FGPiston::doMAP(void)
// Add a variable lag to manifold pressure changes
double dMAP=(TMAP - p_ram * map_coefficient);
if (ManifoldPressureLag > TotalDeltaT) dMAP *= TotalDeltaT/ManifoldPressureLag;
if (ManifoldPressureLag > in.TotalDeltaT) dMAP *= in.TotalDeltaT/ManifoldPressureLag;
TMAP -=dMAP;
@ -833,7 +831,7 @@ void FGPiston::doEGT(void)
} else { // Drop towards ambient - guess an appropriate time constant for now
combustion_efficiency = 0;
dEGTdt = (RankineToKelvin(in.Temperature) - ExhaustGasTemp_degK) / 100.0;
delta_T_exhaust = dEGTdt * TotalDeltaT;
delta_T_exhaust = dEGTdt * in.TotalDeltaT;
ExhaustGasTemp_degK += delta_T_exhaust;
}
@ -873,7 +871,7 @@ void FGPiston::doCHT(void)
double HeatCapacityCylinderHead = CpCylinderHead * MassCylinderHead;
CylinderHeadTemp_degK +=
(dqdt_cylinder_head / HeatCapacityCylinderHead) * TotalDeltaT;
(dqdt_cylinder_head / HeatCapacityCylinderHead) * in.TotalDeltaT;
}
@ -908,7 +906,7 @@ void FGPiston::doOilTemperature(void)
double dOilTempdt = (target_oil_temp - OilTemp_degK) / time_constant;
OilTemp_degK += (dOilTempdt * TotalDeltaT);
OilTemp_degK += (dOilTempdt * in.TotalDeltaT);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -46,7 +46,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_PISTON "$Id: FGPiston.h,v 1.37 2015/02/27 20:36:47 bcoconni Exp $"
#define ID_PISTON "$Id: FGPiston.h,v 1.38 2016/01/02 17:42:53 bcoconni Exp $"
#define FG_MAX_BOOST_SPEEDS 3
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -211,7 +211,7 @@ boostspeed they refer to:
@author David Megginson (initial porting and additional code)
@author Ron Jensen (additional engine code)
@see Taylor, Charles Fayette, "The Internal Combustion Engine in Theory and Practice"
@version $Id: FGPiston.h,v 1.37 2015/02/27 20:36:47 bcoconni Exp $
@version $Id: FGPiston.h,v 1.38 2016/01/02 17:42:53 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -351,7 +351,6 @@ private:
//
// Inputs (in addition to those in FGEngine).
//
double TotalDeltaT; // Time in seconds between calls.
double p_amb; // Pascals
double p_ram; // Pascals
double T_amb; // degrees Kelvin

View file

@ -45,7 +45,7 @@ using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGPropeller.cpp,v 1.56 2015/12/13 08:56:06 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGPropeller.cpp,v 1.57 2016/01/02 17:42:53 bcoconni Exp $");
IDENT(IdHdr,ID_PROPELLER);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -205,9 +205,6 @@ double FGPropeller::Calculate(double EnginePower)
double Vel = localAeroVel(eU) + Vinduced;
double rho = in.Density;
double RPS = RPM/60.0;
// The time step should not be 0 for the propeller RPM to reach a steady
// value during trimming.
deltaT = ( in.TotalDeltaT > 0.0 ) ? in.TotalDeltaT : 0.01;
// Calculate helical tip Mach
double Area = 0.25*Diameter*Diameter*M_PI;
@ -288,7 +285,7 @@ double FGPropeller::Calculate(double EnginePower)
if (omega > 0.0) ExcessTorque = PowerAvailable / omega;
else ExcessTorque = PowerAvailable / 1.0;
RPM = (RPS + ((ExcessTorque / Ixx) / (2.0 * M_PI)) * deltaT) * 60.0;
RPM = (RPS + ((ExcessTorque / Ixx) / (2.0 * M_PI)) * in.TotalDeltaT) * 60.0;
if (RPM < 0.0) RPM = 0.0; // Engine won't turn backwards
@ -329,7 +326,7 @@ double FGPropeller::GetPowerRequired(void)
double dRPM = rpmReq - RPM;
// The pitch of a variable propeller cannot be changed when the RPMs are
// too low - the oil pump does not work.
if (RPM > 200) Pitch -= dRPM * deltaT;
if (RPM > 200) Pitch -= dRPM * in.TotalDeltaT;
if (Pitch < MinPitch) Pitch = MinPitch;
else if (Pitch > MaxPitch) Pitch = MaxPitch;

View file

@ -45,7 +45,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_PROPELLER "$Id: FGPropeller.h,v 1.25 2015/12/13 08:56:06 bcoconni Exp $"
#define ID_PROPELLER "$Id: FGPropeller.h,v 1.26 2016/01/02 17:42:53 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -142,7 +142,7 @@ CLASS DOCUMENTATION
<li>Various NACA Technical Notes and Reports</li>
</ul>
@author Jon S. Berndt
@version $Id: FGPropeller.h,v 1.25 2015/12/13 08:56:06 bcoconni Exp $
@version $Id: FGPropeller.h,v 1.26 2016/01/02 17:42:53 bcoconni Exp $
@see FGEngine
@see FGThruster
*/
@ -303,7 +303,6 @@ private:
bool Reversed; // true, when propeller is reversed
double Reverse_coef; // 0 - 1 defines AdvancePitch (0=MIN_PITCH 1=REVERSE_PITCH)
bool Feathered; // true, if feather command
double deltaT; // Time step
};
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%