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);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
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();
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);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-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
// 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));
}
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
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
* 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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
#include "FGFDMExec.h"
#include "models/FGInertial.h"
#include "models/FGAtmosphere.h"
+#include "models/FGAircraft.h"
#include "models/FGAccelerations.h"
#include "input_output/FGXMLFileRead.h"
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);
//******************************************************************************
if(FDMExec != NULL ) {
Atmosphere=fdmex->GetAtmosphere();
+ Aircraft=fdmex->GetAircraft();
} else {
cout << "FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
}
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;
}
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;
}
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());*/
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();
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);
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);
}
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;
}
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
class FGMatrix33;
class FGColumnVector3;
class FGAtmosphere;
+class FGAircraft;
class FGPropertyManager;
class Element;
@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 $"
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGFDMExec *fdmex;
FGAtmosphere* Atmosphere;
+ FGAircraft* Aircraft;
bool Load_v1(Element* document);
bool Load_v2(Element* document);
};
}
#endif
-
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;
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 '"
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);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
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.
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);
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);
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
@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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/// 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; }
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);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;
Vpitot = vPitotUVW(eU);
if (Vpitot < 0.0) Vpitot = 0.0;
MachPitot = Vpitot / in.SoundSpeed;
- double MachP2 = MachPitot * MachPitot;
-
- 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;
- }
+ pt = PitotTotalPressure(MachPitot, in.Pressure);
- 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 {
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;
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;
}
FDMExec->SetTrimStatus(TrimMode);
+ if (suspended) {
+ FDMExec->SuspendIntegration();
+ in.TotalDeltaT = 0.0;
+ }
+ else
+ in.TotalDeltaT = FDMExec->GetDeltaT() * rate;
return false;
} else {
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);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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();
// 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;
} 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;
}
double HeatCapacityCylinderHead = CpCylinderHead * MassCylinderHead;
CylinderHeadTemp_degK +=
- (dqdt_cylinder_head / HeatCapacityCylinderHead) * TotalDeltaT;
+ (dqdt_cylinder_head / HeatCapacityCylinderHead) * in.TotalDeltaT;
}
double dOilTempdt = (target_oil_temp - OilTemp_degK) / time_constant;
- OilTemp_degK += (dOilTempdt * TotalDeltaT);
+ OilTemp_degK += (dOilTempdt * in.TotalDeltaT);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// 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
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);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;
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
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;
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
<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
*/
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
};
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%