private NextPlanNodeParameter GetNextPara(IPlanNode node) { // Compute verical mode. double optCrzAlt = fuelData.OptCruiseAlt(node.GrossWt); double heading = HeadingCalculation.Heading(node.PrevWaypoint, node); double atcAllowedAlt = altProvider.ClosestAlt(node, heading, optCrzAlt); double targetAlt = Min(atcAllowedAlt, maxAlt); double altDiff = node.Alt - targetAlt; VerticalMode mode = GetMode(altDiff); // Time to next waypoint. double disToNextWpt = node.Distance(node.PrevWaypoint); double timeToNextWpt = disToNextWpt / node.Gs * 60.0; // Time to target altitude. // ClimbRate is positve for climbs and negative for descents. double climbGrad = ClimbGradient(node.GrossWt, mode); double climbRate = climbGrad * node.Ktas / 60.0 * NmFtRatio; bool isCruising = Abs(altDiff) < AltDiffCriteria; double timeToTargetAlt = isCruising ? double.PositiveInfinity : altDiff / climbRate; double[] times = { timeToNextWpt, DeltaT, timeToTargetAlt }; int minIndex = times.MinIndex(); double stepTime = times[minIndex]; Type nodeType = minIndex == 0 ? typeof(RouteNode) : typeof(IntermediateNode); return(new NextPlanNodeParameter(mode, nodeType, stepTime, climbRate)); }
/// <exception cref="ArgumentException">Invalid vertical mode.</exception> private double FuelFlow(double grossWt, VerticalMode mode) { switch (mode) { case VerticalMode.Climb: return(fuelData.ClimbFuelFlow(grossWt)); case VerticalMode.Cruise: return(fuelData.CruiseFuelFlow(grossWt)); case VerticalMode.Descent: return(fuelData.DescentFuelFlow(grossWt)); default: throw new ArgumentException(); } }
/// <exception cref="ArgumentException">Invalid vertical mode.</exception> private double ClimbGradient(double grossWt, VerticalMode mode) { switch (mode) { case VerticalMode.Climb: return(fuelData.ClimbGradient(grossWt)); case VerticalMode.Cruise: return(0.0); case VerticalMode.Descent: return(-fuelData.DescentGradient(grossWt)); default: throw new ArgumentException(); } }
public NextPlanNodeParameter( VerticalMode ModeVertical, Type NodeType, double StepTime, double ClimbRate) { // Validate type. if (NodeType != typeof(RouteNode) && NodeType != typeof(IntermediateNode)) { throw new ArgumentException(); } this.ModeVertical = ModeVertical; this.NodeType = NodeType; this.StepTime = StepTime; this.ClimbRate = ClimbRate; }
private double Kias(double grossWt, double alt, VerticalMode mode) { var cruiseKias = fuelData.CruiseKias(grossWt); if (mode == VerticalMode.Cruise) { return(cruiseKias); } if (alt <= 10000.0) { return(250.0); } var optAlt = fuelData.OptCruiseAlt(grossWt); var optCruiseKtas = Ktas(cruiseKias, optAlt); var kias = mode == VerticalMode.Climb ? fuelData.ClimbKias : fuelData.DescendKias; var ktas = Ktas(kias, alt); return(ktas > optCruiseKtas?KtasToKcas(optCruiseKtas, alt) : kias); }