Beispiel #1
0
 private void bw_Horizon_Calculate_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     if (e.ProgressPercentage < 0)
     {
         tsl_Main.Text = (string)e.UserState;
     }
     else if ((e.ProgressPercentage >= 0) && (e.ProgressPercentage <= 359))
     {
         // draw single horizon point when new calculation is running
         HorizonPoint hp = (HorizonPoint)e.UserState;
         DrawHorizonPoint(e.ProgressPercentage, hp);
     }
     else if (e.ProgressPercentage == 360)
     {
         // store complete horizon
         Horizon = (PropagationHorizonDesignator)e.UserState;
     }
 }
Beispiel #2
0
        private void DrawHorizonPoint(int azimuth, HorizonPoint hp, bool closing = false)
        {
            Elevation_Polar_Series.Points.Add(new DataPoint(hp.Epsmin / Math.PI * 180.0, azimuth));
            pm_Elevation_Polar.InvalidatePlot(true);
            if (!closing)
            {
                Elevation_Cartesian_Series.Points.Add(new DataPoint(azimuth, hp.Epsmin / Math.PI * 180.0));
            }
            pm_Elevation_Cartesian.InvalidatePlot(true);
            Distance_Polar_Series.Points.Add(new DataPoint(hp.Dist, azimuth));
            pm_Distance_Polar.InvalidatePlot(true);
            if (!closing)
            {
                Distance_Cartesian_Series.Points.Add(new DataPoint(azimuth, hp.Dist));
            }
            pm_Distance_Cartesian.InvalidatePlot(true);
            LatLon.GPoint gp = LatLon.DestinationPoint(Location.Lat, Location.Lon, azimuth, hp.Dist);
            PointLatLng   p  = new PointLatLng(gp.Lat, gp.Lon);

            horizon.Points.Add(p);
            if (p.Lng < Map_Left)
            {
                Map_Left = p.Lng;
            }
            if (p.Lng > Map_Right)
            {
                Map_Right = p.Lng;
            }
            if (p.Lat < Map_Bottom)
            {
                Map_Bottom = p.Lat;
            }
            if (p.Lat > Map_Top)
            {
                Map_Top = p.Lat;
            }
            // toggle visible to redraw
            horizon.IsVisible = false;
            horizon.IsVisible = true;
            gm_Horizon.SetZoomToFitRect(RectLatLng.FromLTRB(Map_Left, Map_Top, Map_Right, Map_Bottom));
        }
Beispiel #3
0
        private void CalculateHorizons()
        {
            List <LocationDesignator> lds = StationData.Database.LocationGetAll();

            foreach (LocationDesignator ld in lds)
            {
                Stopwatch st = new Stopwatch();
                try
                {
                    //                short max = ElevationModel.Database.ElevationTilesMaxElevation(ELEVATIONMODEL.SRTM1, Properties.Settings.Default.MinLat, Properties.Settings.Default.MinLon, Properties.Settings.Default.MaxLat, Properties.Settings.Default.MaxLon);
                    short          max            = 4797;
                    ELEVATIONMODEL model          = ELEVATIONMODEL.SRTM1;
                    BAND           band           = BAND.B1_2G;
                    short          antenna_height = 40;
                    short          h1             = (short)(ElevationData.Database[ld.Lat, ld.Lon, model] + antenna_height);
                    double         dist           = 500.0;
                    double         stepwidth      = ElevationData.Database.GetDefaultStepWidth(model);
                    int            count          = (int)(dist / stepwidth / 1000.0);
                    HorizonPoint   hp             = new HorizonPoint();
                    st.Start();
                    List <HorizonPoint>[] l = new List <HorizonPoint> [360];
                    for (int j = 0; j < 360; j++)
                    {
                        Say("Calculation horizon of " + ld.Call + ": " + j + " of 360...");
                        l[j] = new List <HorizonPoint>();
                        ElevationPathDesignator path = new ElevationPathDesignator();
                        path = ElevationData.Database.ElevationPathCreateFromBearing(this, ld.Lat, ld.Lon, j, dist, stepwidth, model);
                        short[] elv = path.Path;
                        // iterate through frequencies
                        foreach (int f in Enum.GetValues(typeof(BAND)))
                        {
                            double f1_clearance = 0.6;
                            if (f <= 144)
                            {
                                f1_clearance = 0.2;
                            }
                            else if (f <= 432)
                            {
                                f1_clearance = 0.4;
                            }
                            hp = PropagationHorizonDesignator.EpsilonMaxFromPath(h1, ref elv, dist, stepwidth, f / 1000.0, f1_clearance, max, LatLon.Earth.Radius * 1.33);
                            l[j].Add(hp);
                        }
                        hp = l[j].ElementAt(0);
                        Application.DoEvents();
                    }
                    st.Stop();
                    using (StreamWriter sw = new StreamWriter("Horizon.csv"))
                    {
                        sw.WriteLine("bearing[deg];eps_50M[deg];eps_70M[deg];eps[144M[deg];eps_432M[deg];eps_1.2G[deg];eps_2.3G[deg];eps_3.4G[deg];eps_5.7G[deg];eps_10G[deg];eps_24G[deg];eps_47G[deg];eps_76G[deg]");
                        for (int j = 0; j < l.Length; j++)
                        {
                            sw.Write(j + ";");
                            for (int k = 0; k < l[0].Count; k++)
                            {
                                sw.Write((l[j].ElementAt(k).Epsmin / Math.PI * 180.0).ToString("F8"));
                                if (k < l[0].Count - 1)
                                {
                                    sw.Write(";");
                                }
                            }

                            sw.WriteLine();
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }