public static double DistanceLimitedAltitude(this FuelDataItem item, double distance, double grossWt) { var c = item.ClimbGradient(grossWt); var d = item.DescentGradient(grossWt); return(distance * NmFtRatio * c * d / (c + d)); }
public static double EstimatedCrzAlt(this FuelDataItem item, double distance, double landingWt) { var grossWt = item.EstimatedAvgWt(distance, landingWt); var lim = item.DistanceLimitedAltitude(distance, grossWt); var opt = item.OptCruiseAlt(grossWt); return(Math.Min(lim, opt)); }
public ClimbNodesCreator( AirportManager airportList, Route route, FuelDataItem fuelData, IReadOnlyList <IPlanNode> initPlan) { this.airportList = airportList; this.route = route; this.fuelData = fuelData; this.initPlan = initPlan; }
/// <summary> /// Get AvgWindCalculator to approximate the wind. /// Returns null if user disabled wind optimization. /// </summary> /// <exception cref="InvalidUserInputException"></exception> public static AvgWindCalculator GetWindCalculator( AppOptions appSettings, Locator <IWxTableCollection> windTableLocator, AirportManager airportList, FuelDataItem fuelData, double zfwTon, string orig, string dest) { if (!appSettings.EnableWindOptimizedRoute) { return(null); } if (windTableLocator.Instance is DefaultWxTableCollection) { throw new InvalidUserInputException( "Wind data has not been downloaded or loaded from file.\n" + "If you do not want to use wind-optimized route, it can be disabled " + "from Options > Route."); } if (fuelData == null) { throw new InvalidUserInputException("No aircraft is selected."); } var origin = airportList[orig.Trim().ToUpper()]; if (orig == null) { throw new InvalidUserInputException("Cannot find origin airport."); } var destination = airportList[dest.ToUpper()]; if (dest == null) { throw new InvalidUserInputException("Cannot find destination airport."); } var dis = origin.Distance(destination); var alt = fuelData.EstimatedCrzAlt(dis, zfwTon); var tas = Ktas(fuelData.CruiseKias(zfwTon), alt); return(new AvgWindCalculator(windTableLocator.Instance, tas, alt)); }
public static double EstimatedAvgWt(this FuelDataItem item, double distance, double landingWt) { double grossWt = landingWt; const int iteration = 2; for (int i = 0; i < iteration; i++) { var alt = item.OptCruiseAlt(grossWt); var ktas = Ktas(item.CruiseKias(grossWt), alt); var time = distance / ktas * 60.0; var ff = item.CruiseFuelFlow(grossWt); grossWt = landingWt + ff * time / 2.0; } return(grossWt); }
public InitialPlanCreator( AirportManager airportList, ICrzAltProvider altProvider, IWxTableCollection windTable, Route route, FuelDataItem fuelData, double zfw, double landingFuel, double maxAlt) { this.airportList = airportList; this.altProvider = altProvider; this.windTable = windTable; this.route = route; this.fuelData = fuelData; this.zfw = zfw; this.landingFuel = landingFuel; this.maxAlt = maxAlt; }
/// <summary> /// The argument 'plan' should be the return value of FuelCalculator.Create() /// method. Note that the fuel consumption depends on the weight of the aircraft, /// which depends on the vertical profile of the flight plan. Because of this, /// when FuelCalculator creates the DetailedPlan, the fuel values for /// nodes in climb segment are estimations. /// /// Use this method to compute the exact fuel amounts for each node. /// </summary> public static DetailedPlan ApplyCorrection(this DetailedPlan plan, FuelDataItem item) { if (item.FuelTable == null) { return(plan); } var nodes = plan.AllNodes; var airDis = nodes.AirDistance(); var exactFuel = item.FuelTable.FuelRequired(airDis, nodes.Last().GrossWt); var landingFuel = nodes.Last().FuelOnBoard; var factor = exactFuel / (nodes[0].FuelOnBoard - landingFuel); var zfw = nodes[0].GrossWt - nodes[0].FuelOnBoard; return(new DetailedPlan(nodes.Select(n => { var newFuel = (n.FuelOnBoard - landingFuel) * factor + landingFuel; return GetNode(n, newFuel, newFuel + zfw); }).ToList())); }
public FuelParameters( double Zfw, double ContPercent, double HoldingTime, double ExtraFuel, double ApuTime, double TaxiTime, double FinalRsvTime, double FuelBias, FuelDataItem FuelData) { this.Zfw = Zfw; this.ContPercent = ContPercent; this.HoldingTime = HoldingTime; this.ExtraFuel = ExtraFuel; this.ApuTime = ApuTime; this.TaxiTime = TaxiTime; this.FinalRsvTime = FinalRsvTime; this.FuelData = FuelData.WithBias(FuelBias); }
/// <exception cref="ArgumentException"></exception> public FuelCalculator( AirportManager airportList, ICrzAltProvider altProvider, IWxTableCollection windTable, Route route, FuelDataItem fuelData, double zfw, double landingFuel, double maxAlt) { if (route.Count < 2) { throw new ArgumentException(); } this.airportList = airportList; this.altProvider = altProvider; this.windTable = windTable; this.route = route; this.fuelData = fuelData; this.zfw = zfw; this.landingFuel = landingFuel; this.maxAlt = maxAlt; }