Esempio n. 1
0
 public static IEnumerable <Wind> Generate(IWindTableCollection windTables,
                                           double lat, double lon, IEnumerable <double> flightLevels)
 {
     return(flightLevels.Select(fl =>
     {
         var UVWind = windTables.GetWindUV(lat, lon, fl * 100.0);
         return Wind.FromUV(UVWind);
     }));
 }
Esempio n. 2
0
        public AvgWindCalculator(IWindTableCollection windData, double Ktas, double AltitudeFt)
        {
            this.windData   = windData;
            this.Ktas       = Ktas;
            this.AltitudeFt = AltitudeFt;

            v1 = DefaultLocation;
            v2 = DefaultLocation;
        }
Esempio n. 3
0
 public static InitialPlanCreator GetCreator(IWindTableCollection w)
 {
     return(new InitialPlanCreator(
                TestAirportManager(),
                new CrzAltProviderStub(),
                w,
                TestRoute(),
                FuelDataItemTest.GetItem(),
                55000.0,
                5000.0,
                41000.0));
 }
 private static FuelCalculator GetCalculator(
     IWindTableCollection w,
     Route route)
 {
     return(new FuelCalculator(
                TestAirportManager(),
                new CrzAltProviderStub(),
                w,
                route,
                FuelDataItemTest.GetItem(),
                55000.0,
                5000.0,
                41000.0));
 }
Esempio n. 5
0
 public FuelReportGenerator(
     AirportManager airportList,
     ICrzAltProvider altProvider,
     IWindTableCollection windTable,
     Route routeToDest,
     IEnumerable <Route> routesToAltn,
     FuelParameters para,
     double maxAlt = 41000.0)
 {
     this.airportList  = airportList;
     this.altProvider  = altProvider;
     this.windTable    = windTable;
     this.routeToDest  = routeToDest;
     this.routesToAltn = routesToAltn;
     this.para         = para;
     this.maxAlt       = maxAlt;
 }
 public InitialPlanCreator(
     AirportManager airportList,
     ICrzAltProvider altProvider,
     IWindTableCollection 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>
        /// Gets the wind vector in earth's coordinate at the given location.
        /// </summary>
        public static Vector3D GetWind(
            IWindTableCollection windData,
            double altitudeFt,
            double lat,
            double lon)
        {
            var w = windData.GetWindUV(lat, lon, altitudeFt);

            lat = ToRadian(lat);
            lon = ToRadian(lon);

            double sinLat = Sin(lat);
            double sinLon = Sin(lon);
            double cosLon = Cos(lon);

            var u1 = new Vector3D(-sinLon, cosLon, 0.0);
            var u2 = new Vector3D(-sinLat * cosLon, -sinLat * sinLon, Cos(lat));

            return(u1 * w.UComp + u2 * w.VComp);
        }
Esempio n. 8
0
        public PlanNode(
            object NodeValue,
            IWindTableCollection WindTable,
            LinkedListNode <RouteNode> NextRouteNode,
            ICoordinate NextPlanNodeCoordinate,
            double Alt,
            double GrossWt,
            double FuelOnBoard,
            double TimeRemaining,
            double Kias,
            double Ktas = -1.0,
            double Gs   = -1.0)
        {
            if (!IsValidType(NodeValue))
            {
                throw new ArgumentException("Type not allowed.");
            }

            this.NodeValue              = NodeValue;
            this.WindTable              = WindTable;
            this.NextRouteNode          = NextRouteNode;
            this.NextPlanNodeCoordinate = NextPlanNodeCoordinate;
            this.Alt           = Alt;
            this.GrossWt       = GrossWt;
            this.FuelOnBoard   = FuelOnBoard;
            this.TimeRemaining = TimeRemaining;
            this.Kias          = Kias;
            this.Ktas          = Ktas;
            this.Gs            = Gs;

            var c = GetCoordinate();

            this.Lat = c.Lat;
            this.Lon = c.Lon;

            if (Gs == -1.0)
            {
                ComputeParameters();
            }
        }
        /// <summary>
        /// Gets the ground speed (in knots) at v, where the route is from v1
        /// to v2. The v, v1, and v2 are unit vectors on the sphere. v1 must be
        /// different from v2 but v can be the same as v1 or v2.
        /// </summary>
        public static double GetGS(
            IWindTableCollection windData,
            double altitudeFt,
            double ktas,
            Vector3D v1,
            Vector3D v2,
            Vector3D v)
        {
            var      latLon  = v.ToLatLon();
            Vector3D wind    = GetWind(windData, altitudeFt, latLon.Lat, latLon.Lon);
            double   windSpd = wind.R;
            var      w       = v.Equals(v2) ? -GetW(v, v1) : GetW(v, v2);

            // We solve the equation:
            // | (gs) * w - wind | = tas, where |x| is the length of vector x.
            double innerProduct = wind.Dot(w);
            double a            = 1.0;
            double b            = -2.0 * innerProduct;
            double c            = windSpd * windSpd - ktas * ktas;

            return((-b + Sqrt(b * b - 4.0 * a * c)) / (2.0 * a));
        }
Esempio n. 10
0
        // May throw exception.
        public FuelCalculator(
            AirportManager airportList,
            ICrzAltProvider altProvider,
            IWindTableCollection 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;
        }