internal static Tuple <int, int, int> VSPEED_LOOKUP(FlapsSetting Flaps, int Weight) { int FlapsLook = 5; switch (Flaps) { case FlapsSetting.F5: FlapsLook = 5; break; case FlapsSetting.F10: FlapsLook = 10; break; case FlapsSetting.F15: FlapsLook = 15; break; case FlapsSetting.F35: FlapsLook = 35; break; } Tuple <int, int> LookupTuple = new Tuple <int, int>(FlapsLook, Util.ClosestTo(WGT_NODES, Weight)); LANDING_VSPEEDS.TryGetValue(LookupTuple, out Tuple <int, int, int> OutputTuple); return(OutputTuple); }
public static Tuple <int, int> VR2_Lookup(FlapsSetting Flaps, int Weight, int Alt, int OAT) { Dictionary <Tuple <int, int, bool>, Tuple <int, int> > Settings = FLAP5_VR2_SETTINGS; switch (Flaps) { case FlapsSetting.F5: Settings = FLAP5_VR2_SETTINGS; break; case FlapsSetting.F10: Settings = FLAP10_VR2_SETTINGS; break; case FlapsSetting.F15: Settings = FLAP15_VR2_SETTINGS; break; } int ClosestWeight = Util.ClosestTo(WGT_NODES, Weight); int ClosestAlt = Util.ClosestTo(ALT_NODES, Alt); Tuple <int, int, bool> LookupTuple = new Tuple <int, int, bool>(ClosestWeight, ClosestAlt, OAT >= 20); Settings.TryGetValue(LookupTuple, out Tuple <int, int> VR2Settings); return(VR2Settings); }
public static Tuple <int, int> VFRICLB_Lookup(FlapsSetting Flaps, int Weight) { int ClosestWeight = Util.ClosestTo(WGT_NODES, Weight); int Flp = 5; switch (Flaps) { case FlapsSetting.F5: Flp = 5; break; case FlapsSetting.F10: Flp = 10; break; case FlapsSetting.F15: Flp = 15; break; } Tuple <int, int> LookupTuple = new Tuple <int, int>(ClosestWeight, Flp); VFRICLB_SETTINGS.TryGetValue(LookupTuple, out Tuple <int, int> VFRICLB_ADJ); return(VFRICLB_ADJ); }
private void ComputeBtn_Click(object sender, EventArgs e) { ResetFailure(); ResetOutput(); PrimaryUnits Units = DecideUnits((string)WeightUnitsChoice.SelectedValue); AltUnits AltitudeUnits = DecideAltUnits((string)AltUnitsChoice.SelectedValue); FlapsSetting Flaps = DecideFlapsSetting((string)FlapsSettingSel.SelectedValue); LandingSpeedValues BaseValues = new LandingSpeedValues { Units = Units, Flaps = Flaps, }; bool ConvertSuccess = double.TryParse(OATInput.Text, out double OAT); ConvertSuccess &= double.TryParse(WeightInput.Text, out double WeightDouble); if (!ConvertSuccess) { FailedToClean(); return; } BaseValues.OAT = (int)Math.Round(OAT); BaseValues.Weight = (int)Math.Round(WeightDouble); // Compute Landing bool CleanSuccess = InputCleaner.CleanedLandingSpeeds(BaseValues, out LandingSpeedValues CleanedLandingVals); if (!CleanSuccess) { FailedToClean(); return; } LandingComputation LandingComp = new LandingComputation(CleanedLandingVals); if (LandingComp.Failed) { FailedToCompute(); return; } // Display landing data DisplayLandingData(LandingComp.Output); TakeoffSpeedValues TakeOffValues = new TakeoffSpeedValues(); // ALT Units, AntiIce, Runway HDG, Wind HFG, Wind Speed, Elevation, RWY Conditions TakeOffValues.BasicVals = CleanedLandingVals; bool ConvertValsSuccess = double.TryParse(RwyElevationInput.Text, out double RwyElev); ConvertValsSuccess &= double.TryParse(RwyHdgInput.Text, out double RwyHdg); double WindHdg = 0; double WindSpd = 0; try { string[] WindInfo = RwyWindInput.Text.Split('/'); ConvertValsSuccess &= double.TryParse(WindInfo[0], out WindHdg); ConvertValsSuccess &= double.TryParse(WindInfo[1], out WindSpd); } catch { FailedToCleanTO(); return; } if (!ConvertValsSuccess) { FailedToCleanTO(); return; } TakeOffValues.Elevation = (int)Math.Round(RwyElev); TakeOffValues.RunwayHdg = (int)Math.Round(RwyHdg); TakeOffValues.WindHdg = (int)Math.Round(WindHdg); TakeOffValues.WindSpd = (int)Math.Round(WindSpd); TakeOffValues.Conditions = DecideRunwayConditions((string)RwyCondSel.SelectedItem); TakeOffValues.AntiIce = DeIceOnCheckbox.Checked; CleanSuccess = InputCleaner.CleanedTakeoffSpeeds(TakeOffValues, out TakeoffSpeedValues CleanedTakeOffVals); if (!CleanSuccess) { FailedTakeoffComputation(); return; } TakeoffComputation TakeoffComp = new TakeoffComputation(CleanedTakeOffVals); if (TakeoffComp.Failed) { FailedTakeoffComputation(); return; } // Display Takeoff Data DisplayTakeoffData(TakeoffComp.Output); Success(); }