//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% void FGPiston::Calculate(void) { RunPreFunctions(); if (FuelFlow_gph > 0.0) ConsumeFuel(); 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(); if (Boosted) doBoostControl(); doMAP(); doAirFlow(); doFuelFlow(); //Now that the fuel flow is done check if the mixture is too lean to run the engine //Assume lean limit at 22 AFR for now - thats a thi of 0.668 //This might be a bit generous, but since there's currently no audiable warning of impending //cutout in the form of misfiring and/or rough running its probably reasonable for now. // if (equivalence_ratio < 0.668) // Running = false; doEnginePower(); if (IndicatedHorsePower < 0.1250) Running = false; doEGT(); doCHT(); doOilTemperature(); doOilPressure(); if (Thruster->GetType() == FGThruster::ttPropeller) { ((FGPropeller*)Thruster)->SetAdvance(FCS->GetPropAdvance(EngineNumber)); ((FGPropeller*)Thruster)->SetFeather(FCS->GetPropFeather(EngineNumber)); } PowerAvailable = (HP * hptoftlbssec) - Thruster->GetPowerRequired(); Thruster->Calculate(PowerAvailable); RunPostFunctions(); }
void FGPiston::Calculate(void) { // 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); 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(); MeanPistonSpeed_fps = ( RPM * Stroke) / (360); // AKA 2 * (RPM/60) * ( Stroke / 12) or 2NS IAS = in.Vc; doEngineStartup(); if (Boosted) doBoostControl(); doMAP(); doAirFlow(); doFuelFlow(); //Now that the fuel flow is done check if the mixture is too lean to run the engine //Assume lean limit at 22 AFR for now - thats a thi of 0.668 //This might be a bit generous, but since there's currently no audiable warning of impending //cutout in the form of misfiring and/or rough running its probably reasonable for now. // if (equivalence_ratio < 0.668) // Running = false; doEnginePower(); if (IndicatedHorsePower < 0.1250) Running = false; doEGT(); doCHT(); doOilTemperature(); doOilPressure(); if (Thruster->GetType() == FGThruster::ttPropeller) { ((FGPropeller*)Thruster)->SetAdvance(in.PropAdvance[EngineNumber]); ((FGPropeller*)Thruster)->SetFeather(in.PropFeather[EngineNumber]); } LoadThrusterInputs(); Thruster->Calculate(HP * hptoftlbssec); RunPostFunctions(); }
void FGPiston::ResetToIC(void) { 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; ExhaustGasTemp_degK = airTemperature_degK; EGT_degC = ExhaustGasTemp_degK - 273; Thruster->SetRPM(0.0); RPM = 0.0; OilPressure_psi = 0.0; }
void FGPiston::doEGT(void) { double delta_T_exhaust; double enthalpy_exhaust; double heat_capacity_exhaust; double dEGTdt; if ((Running) && (m_dot_air > 0.0)) { // do the energy balance combustion_efficiency = Lookup_Combustion_Efficiency->GetValue(equivalence_ratio); enthalpy_exhaust = m_dot_fuel * calorific_value_fuel * combustion_efficiency * 0.30; heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel); delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust; ExhaustGasTemp_degK = T_amb + delta_T_exhaust; } 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; ExhaustGasTemp_degK += delta_T_exhaust; } }