diff --git a/src/FDM/JSBSim/FGAerodynamics.h b/src/FDM/JSBSim/FGAerodynamics.h index c58356480..bd641f3b9 100644 --- a/src/FDM/JSBSim/FGAerodynamics.h +++ b/src/FDM/JSBSim/FGAerodynamics.h @@ -66,17 +66,12 @@ DEFINITIONS #define ID_AERODYNAMICS "$Id$" - /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ namespace JSBSim { -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs] -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DOCUMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -86,11 +81,8 @@ CLASS DOCUMENTATION aerodynamic properties of this aircraft. Here also, such unique phenomena as ground effect and maximum lift curve tailoff are handled. @author Jon S. Berndt + @author Tony Peden @version $Id$ - @see - Header File - @see - Source File */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -102,7 +94,7 @@ class FGAerodynamics : public FGModel { public: /** Constructor @param Executive a pointer to the parent executive object */ - FGAerodynamics(FGFDMExec*); + FGAerodynamics(FGFDMExec* Executive); /// Destructor ~FGAerodynamics(); @@ -110,18 +102,31 @@ public: @return false if no error */ bool Run(void); - /** Loads the Aerodynamics model + /** Loads the Aerodynamics model. + The Load function for this class expects the configuration file to + have found the AERODYNAMICS keyword in the configution file and to + have set that line to the current line. + @param AC_cfg pointer to the current configuration file. @return true if successful */ bool Load(FGConfigFile* AC_cfg); /** Gets the total aerodynamic force vector. @return a force vector reference. */ FGColumnVector3& GetForces(void) {return vForces;} + + /** Gets the aerodynamic force for an axis. + @param n Axis index. This could be 0, 1, or 2, or one of the + axis enums: eX, eY, eZ. + @return the force acting on an axis */ double GetForces(int n) const {return vForces(n);} /** Gets the total aerodynamic moment vector. @return a moment vector reference. */ FGColumnVector3& GetMoments(void) {return vMoments;} + + /** Gets the aerodynamic moment for an axis. + @return the moment about a single axis (as described also in the + similar call to GetForces(int n).*/ double GetMoments(int n) const {return vMoments(n);} FGColumnVector3& GetvLastFs(void) { return vLastFs; } @@ -145,7 +150,7 @@ public: inline void SetAlphaCLMax(double tt) { alphaclmax=tt; } inline void SetAlphaCLMin(double tt) { alphaclmin=tt; } - /** Gets the strings for the current set of coefficients. + /** Gets the strings for the current set of coefficients. @return a string containing the descriptive names for all coefficients */ string GetCoefficientStrings(void); diff --git a/src/FDM/JSBSim/FGAtmosphere.cpp b/src/FDM/JSBSim/FGAtmosphere.cpp index 4de422d19..bf02c1bc0 100644 --- a/src/FDM/JSBSim/FGAtmosphere.cpp +++ b/src/FDM/JSBSim/FGAtmosphere.cpp @@ -93,7 +93,7 @@ FGAtmosphere::FGAtmosphere(FGFDMExec* fdmex) : FGModel(fdmex) // turbType = ttBerndt; TurbGain = 0.0; TurbRate = 1.0; - + bind(); Debug(0); } @@ -141,7 +141,7 @@ bool FGAtmosphere::Run(void) Calculate(h); } - if (turbType != ttNone && TurbGain > 0.0) { + if (turbType != ttNone) { Turbulence(); vWindNED += vTurbulence; } @@ -278,7 +278,7 @@ void FGAtmosphere::Turbulence(void) vDirectiondAccelDt(eY) = 1 - 2.0*(double(rand())/double(RAND_MAX)); vDirectiondAccelDt(eZ) = 1 - 2.0*(double(rand())/double(RAND_MAX)); - MagnitudedAccelDt = 1 - 2.0*(double(rand())/double(RAND_MAX)); + MagnitudedAccelDt = 1 - 2.0*(double(rand())/double(RAND_MAX)) - Magnitude; // Scale the magnitude so that it moves // away from the peaks MagnitudedAccelDt = ((MagnitudedAccelDt - Magnitude) / diff --git a/src/FDM/JSBSim/FGJSBBase.h b/src/FDM/JSBSim/FGJSBBase.h index 7515b9219..b25573838 100644 --- a/src/FDM/JSBSim/FGJSBBase.h +++ b/src/FDM/JSBSim/FGJSBBase.h @@ -94,6 +94,7 @@ DEFINITIONS FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +namespace JSBSim { /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs] @@ -112,8 +113,6 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -namespace JSBSim { - class FGJSBBase { public: /// Constructor for FGJSBBase. diff --git a/src/FDM/JSBSim/FGLGear.cpp b/src/FDM/JSBSim/FGLGear.cpp index 3a9c4b86a..49d29ed0a 100644 --- a/src/FDM/JSBSim/FGLGear.cpp +++ b/src/FDM/JSBSim/FGLGear.cpp @@ -94,6 +94,7 @@ FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : Exec(fdmex) GearUp = false; GearDown = true; + Servicable = true; // Add some AI here to determine if gear is located properly according to its // brake group type ?? @@ -132,6 +133,8 @@ FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : Exec(fdmex) brakePct = 0.0; maxCompLen = 0.0; + TirePressureNorm = 1.0; + Debug(0); } @@ -188,6 +191,8 @@ FGLGear::FGLGear(const FGLGear& lgear) GearDown = lgear.GearDown; WheelSlip = lgear.WheelSlip; lastWheelSlip = lgear.lastWheelSlip; + TirePressureNorm = lgear.TirePressureNorm; + Servicable = lgear.Servicable; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -296,30 +301,30 @@ FGColumnVector3& FGLGear::Force(void) switch (eBrakeGrp) { case bgLeft: SteerGain = 0.10; - BrakeFCoeff = rollingFCoeff*(1.0 - FCS->GetBrake(bgLeft)) + - staticFCoeff*FCS->GetBrake(bgLeft); + BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgLeft)) + + staticFCoeff*FCS->GetBrake(bgLeft) ); break; case bgRight: SteerGain = 0.10; - BrakeFCoeff = rollingFCoeff*(1.0 - FCS->GetBrake(bgRight)) + - staticFCoeff*FCS->GetBrake(bgRight); + BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgRight)) + + staticFCoeff*FCS->GetBrake(bgRight) ); break; case bgCenter: SteerGain = 0.10; - BrakeFCoeff = rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) + - staticFCoeff*FCS->GetBrake(bgCenter); + BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) + + staticFCoeff*FCS->GetBrake(bgCenter) ); break; case bgNose: SteerGain = -0.50; - BrakeFCoeff = rollingFCoeff; + BrakeFCoeff = rollingFCoeff; break; case bgTail: SteerGain = -0.10; - BrakeFCoeff = rollingFCoeff; + BrakeFCoeff = rollingFCoeff; break; case bgNone: SteerGain = 0.0; - BrakeFCoeff = rollingFCoeff; + BrakeFCoeff = rollingFCoeff; break; default: cerr << "Improper brake group membership detected for this gear." << endl; @@ -400,7 +405,9 @@ FGColumnVector3& FGLGear::Force(void) RollingForce = 0; if (fabs(RollingWhlVel) > 1E-3) { - RollingForce = vLocalForce(eZ) * BrakeFCoeff * fabs(RollingWhlVel)/RollingWhlVel; + RollingForce = (1.0 - TirePressureNorm) * 30 + + vLocalForce(eZ) * BrakeFCoeff + * fabs(RollingWhlVel)/RollingWhlVel; } SideForce = vLocalForce(eZ) * FCoeff; diff --git a/src/FDM/JSBSim/FGLGear.h b/src/FDM/JSBSim/FGLGear.h index e849d229e..5e746a804 100644 --- a/src/FDM/JSBSim/FGLGear.h +++ b/src/FDM/JSBSim/FGLGear.h @@ -224,6 +224,11 @@ public: /// Gets the gear compression force in pounds inline double GetCompForce(void) {return Force()(3); } inline double GetBrakeFCoeff(void) {return BrakeFCoeff;} + + /// Gets the current normalized tire pressure + inline double GetTirePressure(void) { return TirePressureNorm; } + /// Sets the new normalized tire pressure + inline void SetTirePressure(double p) { TirePressureNorm = p; } /// Sets the brake value in percent (0 - 100) inline void SetBrake(double bp) {brakePct = bp;} @@ -278,6 +283,7 @@ private: double RollingForce, SideForce, FCoeff; double WheelSlip; double lastWheelSlip; + double TirePressureNorm; bool WOW; bool lastWOW; bool FirstContact; @@ -287,6 +293,7 @@ private: bool ReportEnable; bool isRetractable; bool GearUp, GearDown; + bool Servicable; string name; string sSteerType; string sBrakeGroup; diff --git a/src/FDM/JSBSim/FGPiston.cpp b/src/FDM/JSBSim/FGPiston.cpp index dbbc88588..e0907230a 100644 --- a/src/FDM/JSBSim/FGPiston.cpp +++ b/src/FDM/JSBSim/FGPiston.cpp @@ -137,7 +137,7 @@ FGPiston::~FGPiston() double FGPiston::Calculate(double PowerRequired) { - ConsumeFuel(); + if (FuelFlow_gph > 0.0) ConsumeFuel(); Throttle = FCS->GetThrottlePos(EngineNumber); Mixture = FCS->GetMixturePos(EngineNumber); diff --git a/src/FDM/JSBSim/FGSimTurbine.cpp b/src/FDM/JSBSim/FGSimTurbine.cpp index 83901c093..864e17b59 100644 --- a/src/FDM/JSBSim/FGSimTurbine.cpp +++ b/src/FDM/JSBSim/FGSimTurbine.cpp @@ -139,8 +139,8 @@ double FGSimTurbine::Run(void) { double idlethrust, milthrust, thrust; double N2norm; // 0.0 = idle N2, 1.0 = maximum N2 - idlethrust = MaxMilThrust * ThrustTables[0]->TotalValue(); - milthrust = (MaxMilThrust - idlethrust) * ThrustTables[1]->TotalValue(); + idlethrust = MilThrust * ThrustTables[0]->TotalValue(); + milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue(); Running = true; Starter = false; @@ -149,13 +149,13 @@ double FGSimTurbine::Run(void) N1 = Seek(&N1, IdleN1 + ThrottleCmd * N1_factor, delay, delay * 2.4); N2norm = (N2 - IdleN2) / N2_factor; thrust = idlethrust + (milthrust * N2norm * N2norm); - FuelFlow_pph = thrust * TSFC; thrust = thrust * (1.0 - BleedDemand); + FuelFlow_pph = thrust * TSFC; if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF; EGT_degC = TAT + 363.1 + ThrottleCmd * 357.1; OilPressure_psi = N2 * 0.62; OilTemp_degK = Seek(&OilTemp_degK, 366.0, 1.2, 0); - EPR = 1.0 + thrust/MaxMilThrust; + EPR = 1.0 + thrust/MilThrust; NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8); if (Reversed) thrust = thrust * -0.2; @@ -165,9 +165,9 @@ double FGSimTurbine::Run(void) } if ((Augmented == 1) && Augmentation) { - thrust = thrust * ThrustTables[2]->TotalValue(); + thrust = MaxThrust * ThrustTables[2]->TotalValue(); FuelFlow_pph = thrust * ATSFC; - NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0); + NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8); } if ((Injected == 1) && Injection) @@ -200,7 +200,7 @@ double FGSimTurbine::SpinUp(void) double FGSimTurbine::Start(void) { if ((N2 > 15.0) && !Starved) { // minimum 15% N2 needed for start - Cranking = true; + Cranking = true; // provided for sound effects signal if (N2 < IdleN2) { N2 = Seek(&N2, IdleN2, 2.0, N2/2.0); N1 = Seek(&N1, IdleN1, 1.4, N1/2.0); @@ -254,8 +254,8 @@ double FGSimTurbine::Seize(void) double FGSimTurbine::Trim(void) { double idlethrust, milthrust, thrust; - idlethrust = MaxMilThrust * ThrustTables[0]->TotalValue(); - milthrust = (MaxMilThrust - idlethrust) * ThrustTables[1]->TotalValue(); + idlethrust = MilThrust * ThrustTables[0]->TotalValue(); + milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue(); thrust = idlethrust + (milthrust * ThrottleCmd * ThrottleCmd); return thrust; } @@ -295,7 +295,8 @@ double FGSimTurbine::Seek(double *var, double target, double accel, double decel void FGSimTurbine::SetDefaults(void) { Name = "None_Defined"; - MaxMilThrust = 10000.0; + MilThrust = 10000.0; + MaxThrust = 10000.0; BypassRatio = 0.0; TSFC = 0.8; ATSFC = 1.7; @@ -329,7 +330,8 @@ bool FGSimTurbine::Load(FGConfigFile *Eng_cfg) Name = Eng_cfg->GetValue("NAME"); cout << Name << endl; Eng_cfg->GetNextConfigLine(); - *Eng_cfg >> token >> MaxMilThrust; + *Eng_cfg >> token >> MilThrust; + *Eng_cfg >> token >> MaxThrust; *Eng_cfg >> token >> BypassRatio; *Eng_cfg >> token >> TSFC; *Eng_cfg >> token >> ATSFC; @@ -352,7 +354,7 @@ bool FGSimTurbine::Load(FGConfigFile *Eng_cfg) N1_factor = MaxN1 - IdleN1; N2_factor = MaxN2 - IdleN2; OilTemp_degK = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556 + 273.0; - IdleFF = pow(MaxMilThrust, 0.2) * 107.0; // just an estimate + IdleFF = pow(MilThrust, 0.2) * 107.0; // just an estimate return true; } diff --git a/src/FDM/JSBSim/FGSimTurbine.h b/src/FDM/JSBSim/FGSimTurbine.h index 573948fae..eca4e680a 100644 --- a/src/FDM/JSBSim/FGSimTurbine.h +++ b/src/FDM/JSBSim/FGSimTurbine.h @@ -25,14 +25,14 @@ HISTORY -------------------------------------------------------------------------------- -03/11/2003 DPC Created -09/22/2003 DPC Added starting, stopping +03/11/2003 DPC Created, based on FGTurbine +09/22/2003 DPC Added starting, stopping, new framework %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% COMMENTS, REFERENCES, and NOTES -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SENTRY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -51,15 +51,56 @@ INCLUDES #define ID_SIMTURBINE "$Id$" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -CLASS DECLARATION +FORWARD DECLARATIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ namespace JSBSim { +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +CLASS DOCUMENTATION +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +/** This class models a turbine engine. Based on Jon Berndt's FGTurbine module. + Here the term "phase" signifies the engine's mode of operation. At any given + time the engine is in only one phase. At simulator startup the engine will be + placed in the Trim phase in order to provide a simplified thrust value without + throttle lag. When trimming is complete the engine will go to the Off phase, + unless the value FGEngine::Running has been previously set to true, in which + case the engine will go to the Run phase. Once an engine is in the Off phase + the full starting procedure (or airstart) must be used to get it running. +
+ -STARTING (on ground): + -# Set the control FGEngine::Starter to true. The engine will spin up to + a maximum of about %25 N2 (%5.2 N1). This simulates the action of a + pneumatic starter. + -# After reaching %15 N2 set the control FGEngine::Cutoff to false. If fuel + is available the engine will now accelerate to idle. The starter will + automatically be set to false after the start cycle. +
+ -STARTING (in air): + -# Increase speed to obtain a minimum of %15 N2. If this is not possible, + the starter may be used to assist. + -# Place the control FGEngine::Cutoff to false. +
+ Ignition is assumed to be on anytime the Cutoff control is set to false,
+ therefore a seperate ignition system is not modeled.
+
+ @author David P. Culp
+ @version $Id$
+*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
class FGSimTurbine : public FGEngine
{
public:
+ /** Constructor
+ @param exec pointer to executive structure
+ @param Eng_Cfg pointer to engine config file instance */
FGSimTurbine(FGFDMExec* exec, FGConfigFile* Eng_cfg);
+ /// Destructor
~FGSimTurbine();
enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim };
@@ -80,32 +121,31 @@ private:
typedef vector