1
0
Fork 0

Sync w. JSBSim CVS

This commit is contained in:
ehofman 2004-09-15 12:19:46 +00:00
parent 2f581faf3e
commit 2836b35989
5 changed files with 39 additions and 23 deletions

View file

@ -97,7 +97,7 @@ double FGNozzle::Calculate(double CfPc)
Thrust = max((double)0.0, (CfPc * AreaT + (PE - pAtm)*Area2) * nzlEff);
vFn(1) = Thrust * cos(ReverserAngle);
ThrustCoeff = CfPc / ((pAtm - PE) * Area2);
ThrustCoeff = max((double)0.0, CfPc / ((pAtm - PE) * Area2));
return Thrust;
}

View file

@ -95,6 +95,8 @@ public:
virtual string GetThrusterLabels(int id);
virtual string GetThrusterValues(int id);
inline void SetThrustCoefficient(double ct) { ThrustCoeff = ct; }
protected:
eType Type;
string Name;

View file

@ -437,7 +437,7 @@ void FGTrimAxis::AxisReport(void) {
GetStateName().c_str(), GetState()+state_target, GetTolerance());
cout << out;
if( abs(GetState()+state_target) < abs(GetTolerance()) )
if( fabs(GetState()+state_target) < fabs(GetTolerance()) )
cout << " Passed" << endl;
else
cout << " Failed" << endl;

View file

@ -113,17 +113,20 @@ double FGTurbine::Calculate(void)
if (Stalled) phase = tpStall;
if (Seized) phase = tpSeize;
double CT = 0.0;
switch (phase) {
case tpOff: Thrust = Off(); break;
case tpRun: Thrust = Run(); break;
case tpRun: Thrust = Run(CT); break;
case tpSpinUp: Thrust = SpinUp(); break;
case tpStart: Thrust = Start(); break;
case tpStall: Thrust = Stall(); break;
case tpSeize: Thrust = Seize(); break;
case tpTrim: Thrust = Trim(); break;
case tpTrim: Thrust = Trim(CT); break;
default: Thrust = Off();
}
Thruster->SetThrustCoefficient(CT);
return Thruster->Calculate(Thrust);
}
@ -147,12 +150,13 @@ double FGTurbine::Off(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGTurbine::Run(void)
double FGTurbine::Run(double &TC)
{
double idlethrust, milthrust, thrust;
double N2norm; // 0.0 = idle N2, 1.0 = maximum N2
idlethrust = MilThrust * ThrustTables[0]->TotalValue();
milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
idlethrust = ThrustTables[0]->TotalValue();
milthrust = (1.0 - idlethrust) * ThrustTables[1]->TotalValue();
Running = true;
Starter = false;
@ -160,7 +164,8 @@ double FGTurbine::Run(void)
N2 = Seek(&N2, IdleN2 + ThrottlePos * N2_factor, delay, delay * 3.0);
N1 = Seek(&N1, IdleN1 + ThrottlePos * N1_factor, delay, delay * 2.4);
N2norm = (N2 - IdleN2) / N2_factor;
thrust = idlethrust + (milthrust * N2norm * N2norm);
TC = idlethrust + (milthrust * N2norm * N2norm);
thrust = TC * MilThrust;
EGT_degC = TAT + 363.1 + ThrottlePos * 357.1;
OilPressure_psi = N2 * 0.62;
OilTemp_degK = Seek(&OilTemp_degK, 366.0, 1.2, 0.1);
@ -170,8 +175,8 @@ double FGTurbine::Run(void)
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * correctedTSFC, 1000.0, 100000);
if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF;
NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8);
thrust = thrust * (1.0 - BleedDemand);
EPR = 1.0 + thrust/MilThrust;
TC = TC * (1.0 - BleedDemand);
EPR = 1.0 + TC;
}
if (AugMethod == 1) {
@ -180,7 +185,8 @@ double FGTurbine::Run(void)
}
if ((Augmented == 1) && Augmentation && (AugMethod < 2)) {
thrust = MaxThrust * ThrustTables[2]->TotalValue();
TC = ThrustTables[2]->TotalValue();
thrust = TC * MaxThrust;
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
}
@ -188,8 +194,9 @@ double FGTurbine::Run(void)
if (AugMethod == 2) {
if (AugmentCmd > 0.0) {
Augmentation = true;
double tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
thrust += (tdiff * AugmentCmd);
double tdiff = ThrustTables[2]->TotalValue() - TC;
TC += (tdiff * AugmentCmd);
thrust = TC * MaxThrust;
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
} else {
@ -197,8 +204,10 @@ double FGTurbine::Run(void)
}
}
if ((Injected == 1) && Injection)
if ((Injected == 1) && Injection) {
TC = TC * ThrustTables[3]->TotalValue();
thrust = thrust * ThrustTables[3]->TotalValue();
}
ConsumeFuel();
if (Cutoff) phase = tpOff;
@ -281,16 +290,21 @@ double FGTurbine::Seize(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGTurbine::Trim(void)
double FGTurbine::Trim(double &TC)
{
double idlethrust, milthrust, thrust, tdiff;
idlethrust = MilThrust * ThrustTables[0]->TotalValue();
milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
thrust = (idlethrust + (milthrust * ThrottlePos * ThrottlePos)) * (1.0 - BleedDemand);
idlethrust = ThrustTables[0]->TotalValue();;
milthrust = (1.0 - TC) * ThrustTables[1]->TotalValue();
TC = (idlethrust + (milthrust * ThrottlePos * ThrottlePos))
* (1.0 - BleedDemand);
if (AugmentCmd > 0.0) {
tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
thrust += (tdiff * AugmentCmd);
}
tdiff = ThrustTables[2]->TotalValue() - TC;
TC += (tdiff * AugmentCmd);
thrust = TC * MaxThrust;
} else
thrust = TC * MilThrust;
return thrust;
}

View file

@ -233,12 +233,12 @@ private:
double NozzlePosition;
double Off(void);
double Run(void);
double Run(double &CT);
double SpinUp(void);
double Start(void);
double Stall(void);
double Seize(void);
double Trim(void);
double Trim(double &CT);
void SetDefaults(void);
bool Load(FGConfigFile *ENG_cfg);