public double CalculateIAS() { double pressureRatio = FARAeroUtil.RayleighPitotTubeStagPressure(_vessel.mach); //stag pressure at pitot tube face / ambient pressure double velocity = pressureRatio - 1; velocity *= _vessel.staticPressurekPa * 1000 * 2; velocity /= 1.225; velocity = Math.Sqrt(velocity); return(velocity); }
public double CalculateIAS() { // Rodhern: Presumably _vessel.mach ignores FARWind, which might not be the intended behaviour. double pressureRatio = FARAeroUtil.RayleighPitotTubeStagPressure(_vessel.mach); //stag pressure at pitot tube face / ambient pressure double velocity = pressureRatio - 1; velocity *= _vessel.staticPressurekPa * 1000 * 2; velocity /= 1.225; velocity = Math.Sqrt(velocity); return(velocity); }
public double CalculateIAS() { //stag pressure at pitot tube face / ambient pressure double pressureRatio = FARAeroUtil.RayleighPitotTubeStagPressure(_vessel.mach); double velocity = pressureRatio - 1; velocity *= FARAtmosphere.GetPressure(_vessel) * 2; velocity /= 1.225; velocity = Math.Sqrt(velocity); return(velocity); }
public void ChangeSurfVelocity() { active = false; //DaMichel: Avoid conflict between multiple vessels in physics range. We only want to show the speed of the active vessel. if (FlightGlobals.ActiveVessel != _vessel) { return; } //DaMichel: Keep our fingers off of this also if there is no atmosphere (staticPressure <= 0) if (FlightGlobals.speedDisplayMode != FlightGlobals.SpeedDisplayModes.Surface || _vessel.atmDensity <= 0) { return; } if (SpeedDisplay.Instance == null) { return; } double unitConversion = 1; string unitString;// = "m/s"; string caption; if (unitMode == SurfaceVelUnit.KNOTS) { unitConversion = 1.943844492440604768413343347219; unitString = surfUnit_str[1]; } else if (unitMode == SurfaceVelUnit.KM_H) { unitConversion = 3.6; unitString = surfUnit_str[3]; } else if (unitMode == SurfaceVelUnit.MPH) { unitConversion = 2.236936; unitString = surfUnit_str[2]; } else { unitString = surfUnit_str[0]; } if (velMode == SurfaceVelMode.TAS) { caption = surfModel_str[0]; velString = (_vessel.srfSpeed * unitConversion).ToString("F1") + unitString; } else { if (velMode == SurfaceVelMode.IAS) { caption = surfModel_str[1]; //double densityRatio = (FARAeroUtil.GetCurrentDensity(_vessel) / 1.225); double pressureRatio = FARAeroUtil.RayleighPitotTubeStagPressure(_vessel.mach); //stag pressure at pitot tube face / ambient pressure double velocity = pressureRatio - 1; velocity *= _vessel.staticPressurekPa * 1000 * 2; velocity /= 1.225; velocity = Math.Sqrt(velocity); velString = (velocity * unitConversion).ToString("F1") + unitString; } else if (velMode == SurfaceVelMode.EAS) { caption = surfModel_str[2]; double densityRatio = (FARAeroUtil.GetCurrentDensity(_vessel) / 1.225); velString = (_vessel.srfSpeed * Math.Sqrt(densityRatio) * unitConversion).ToString("F1") + unitString; } else// if (velMode == SurfaceVelMode.MACH) { caption = surfModel_str[3]; velString = _vessel.mach.ToString("F3"); } } active = true; SpeedDisplay UI = SpeedDisplay.Instance; if (UI.textSpeed == null || UI.textTitle == null) { return; } UI.textTitle.text = caption; UI.textSpeed.text = velString; }