Re: [Flightgear-devel] Problem in FGPiston
Frederic Bouvier writes: There is an invalid float operation in FGPiston when the engine is off : in void FGPiston::doAirFlow(void) ... double swept_volume = (displacement_SI * (RPM/60)) / 2; double v_dot_air = swept_volume * volumetric_efficiency; m_dot_air = v_dot_air * rho_air_manifold; ... RPM is zero so m_dot_air is zero, and in void FGPiston::doEGT(void) ... double heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel); double delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust; ... heat_capacity_exhaust that depends on m_dot_air is zero so we should have a div by zero error but enthalpy_exhaust is also zero I think we need a special case for engine off here. Good catch. Cheers - Dave -- [EMAIL PROTECTED] ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
RE: [Flightgear-devel] Problem in FGPiston
I think we need a special case for engine off here. Good catch. I have changed some things in FGPiston (fixed) based on my limited understanding). void FGPiston::doManifoldPressure(void) { // DAVE: CHECK THIS if (Running ) { ManifoldPressure_inHg = MinManifoldPressure_inHg + (Throttle * (MaxManifoldPressure_inHg - MinManifoldPressure_inHg)); } else if (Cranking) { ManifoldPressure_inHg += (dt/2.0)*(MinManifoldPressure_inHg / 6.0 - ManifoldPressure_inHg); } else { ManifoldPressure_inHg -= (dt/2.0)*ManifoldPressure_inHg; // fade } } void FGPiston::doEGT(void) { ... ... // DAVE: CHECK THIS if (heat_capacity_exhaust = 0.001) delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust; else delta_T_exhaust -= (dt/2.0)*delta_T_exhaust; ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Problem in FGPiston
I think we need a special case for engine off here. Good catch. I have changed some things in FGPiston (fixed) based on my limited understanding). void FGPiston::doManifoldPressure(void) { // DAVE: CHECK THIS if (Running ) { ManifoldPressure_inHg = MinManifoldPressure_inHg + (Throttle * (MaxManifoldPressure_inHg - MinManifoldPressure_inHg)); } else if (Cranking) { ManifoldPressure_inHg += (dt/2.0)*(MinManifoldPressure_inHg / 6.0 - ManifoldPressure_inHg); } else { ManifoldPressure_inHg -= (dt/2.0)*ManifoldPressure_inHg; // fade } } void FGPiston::doEGT(void) { ... ... // DAVE: CHECK THIS if (heat_capacity_exhaust = 0.001) delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust; else delta_T_exhaust -= (dt/2.0)*delta_T_exhaust; Compilers complains : delta_T_exhaust used without having been initialized Why the '-=' in the else case of calculation of delta_T_exhaust ? What is its previous value ? -Fred ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
RE: [Flightgear-devel] Problem in FGPiston
Compilers complains : delta_T_exhaust used without having been initialized Why the '-=' in the else case of calculation of delta_T_exhaust ? What is its previous value ? Oy! Good catch. I screwed up. Fix to be committed shortly. ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] Problem in FGPiston
void FGPiston::doEGT(void) { ... ... // DAVE: CHECK THIS if (heat_capacity_exhaust = 0.001) delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust; else delta_T_exhaust -= (dt/2.0)*delta_T_exhaust; Do you mean : if (heat_capacity_exhaust = 0.001) because zero is less than 0.001 and it bombs anyway ! -Fred ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel