Ejemplo n.º 1
0
        /// <summary>
        /// Computes the required takeoff distance.
        /// </summary>
        /// <exception cref="Exception"></exception>
        public static double TakeOffDistanceMeter(AirbusPerfTable t, TOParameters p)
        {
            var tables = GetTables(t, p);

            if (tables.Count == 0)
            {
                throw new Exception("No data for selected flaps");
            }
            var pressAlt      = ConversionTools.PressureAltitudeFt(p.RwyElevationFt, p.QNH);
            var inverseTables = tables.Select(x => GetInverseTable(x, pressAlt, t, p));
            var distancesFt   = inverseTables.Select(x =>
                                                     x.ValueAt(p.WeightKg * 0.001 * Constants.KgLbRatio))
                                .ToArray();

            var d = (distancesFt.Length == 1) ?
                    distancesFt[0] :
                    Interpolate1D.Interpolate(
                tables.Select(x => x.IsaOffset).ToArray(),
                distancesFt,
                IsaOffset(p));

            // The slope and wind correction is not exactly correct according to
            // performance xml file comments. However, the table itsel is probably
            // not that precise anyways.
            return(Constants.FtMeterRatio * (d - SlopeAndWindCorrectionFt(d, t, p)));
        }
Ejemplo n.º 2
0
        private static double InterpolateHelper(FuelDataItem item,
                                                Func <DataPoint, double> getter, double grossWeight)
        {
            var p1 = item.DataPoint1;
            var p2 = item.DataPoint2;

            return(Interpolate1D.Interpolate(
                       p1.Weight, p2.Weight, getter(p1), getter(p2), grossWeight));
        }
Ejemplo n.º 3
0
        public static double Interpolate(double[] xArray, double[] yArray, double[] zArray,
                                         double[][][] f, double x, double y, double z)
        {
            int    xi = Common.GetIndex(xArray, x);
            double f0 = Interpolate2D.Interpolate(yArray, zArray, f[xi], y, z);
            double f1 = Interpolate2D.Interpolate(yArray, zArray, f[xi + 1], y, z);

            return(Interpolate1D.Interpolate(xArray[xi], xArray[xi + 1], f0, f1, x));
        }
Ejemplo n.º 4
0
        private double InterpolatePressure(double lat, double lon, double altFt,
                                           Func <WxTable, TableItem> getTable)
        {
            double press = ConversionTools.PressureMb(altFt);
            int    index = GetIndicesForInterpolation(press);

            return(Interpolate1D.Interpolate(
                       pressures[index],
                       pressures[index + 1],
                       getTable(windTables[index]).ValueAt(lat, lon),
                       getTable(windTables[index + 1]).ValueAt(lat, lon),
                       press));
        }
Ejemplo n.º 5
0
        public double CorrectedLimitWeight(double fullRatedWt, TableType para)
        {
            switch (para)
            {
            case TableType.Dry:
                return(Interpolate1D.Interpolate(FullThrustWeights, DryWeights, fullRatedWt));

            case TableType.Wet:
                return(Interpolate1D.Interpolate(FullThrustWeights, WetWeights, fullRatedWt));

            case TableType.Climb:
                return(Interpolate1D.Interpolate(FullThrustWeights, ClimbWeights, fullRatedWt));

            default:
                throw new ArgumentException();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the corresponding full thrust limit weight, for the given
        /// condition (dry/wet/climb).
        /// </summary>
        /// <param name="weight">Field limit weight for dry/wet runway,
        /// or the climb limit weight.</param>
        public double EquivalentFullThrustWeight(double weight, TableType para)
        {
            switch (para)
            {
            case TableType.Dry:
                return(Interpolate1D.Interpolate(DryWeights, FullThrustWeights, weight));

            case TableType.Wet:
                return(Interpolate1D.Interpolate(WetWeights, FullThrustWeights, weight));

            case TableType.Climb:
                return(Interpolate1D.Interpolate(ClimbWeights, FullThrustWeights, weight));

            default:
                throw new ArgumentException();
            }
        }
Ejemplo n.º 7
0
        public WindUV GetWindUV(double lat, double lon, double altitudeFt)
        {
            double press = ConversionTools.PressureMb(altitudeFt);
            int    index = GetIndicesForInterpolation(press);

            double uWind = Interpolate1D.Interpolate(
                pressures[index],
                pressures[index + 1],
                windTables[index].GetUWind(lat, lon),
                windTables[index + 1].GetUWind(lat, lon),
                press);

            double vWind = Interpolate1D.Interpolate(
                pressures[index],
                pressures[index + 1],
                windTables[index].GetVWind(lat, lon),
                windTables[index + 1].GetVWind(lat, lon),
                press);

            return(new WindUV(uWind, vWind));
        }
Ejemplo n.º 8
0
 public double ValueAt(double x)
 {
     return(Interpolate1D.Interpolate(this.x, f, x));
 }