Exemple #1
0
        //! Update Labels

        /*!
         * \param
         * \return
         */
        private void staDataGridView_SelectionChanged_1(object sender, EventArgs e)
        {
            try
            {
                Ground.Station st = _MainDataBase.getStationFromDB(
                    staDataGridView.SelectedRows[0].Cells[0].Value.ToString());
                label20.Text = st.getName();
                label56.Text = st.getLongitude().ToString();
                label55.Text = st.getLatitude().ToString();
                label54.Text = st.getHeight().ToString() + " m";
                label53.Text = st.getNrOfAntennas().ToString();
                Pen   penSelected = new Pen(Color.Red, 4);
                Image image       = new Bitmap(imgStation);
                Point p           = st.getGeoCoordinate().toPoint(image.Width, image.Height);
                using (var graphics = Graphics.FromImage(image))
                {
                    graphics.DrawRectangle(penSelected, p.X - 10, p.Y - 10, 20, 20);
                }
                pictureBox3.Image = image;
            }
            catch
            {
                label20.Text = " -- ";
            }
        }
Exemple #2
0
        //! Delete a object from the GroundStations Database

        /*!
         *
         */
        private void deleteSelectedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Ground.Station st = _MainDataBase.getStationFromDB(
                staDataGridView.SelectedRows[0].Cells[0].Value.ToString());
            _MainDataBase.deleteStation(st.getName());
            UpdateAllLists();
        }
Exemple #3
0
        //! get the stations selected for Schedule

        /*!
         * /param string Logfile
         */
        private List <Ground.Station> getStationData(string logfile)
        {
            stationData = new List <Ground.Station>();
            //get selected GroundSTations for Calculations
            for (int i = 0; i < checkedStations.Items.Count; i++)
            {
                if (checkedStations.GetItemChecked(i))
                {
                    Ground.Station station = _MainDataBase.getStationFromDB(checkedStations.Items[i].ToString());
                    stationData.Add(station);
                    updateLog(logfile, "Adding Station: " + station.getName());
                }
            }
            return(stationData);
        }
Exemple #4
0
        //! Calculate ContactWindows for satellite and groundstations

        /*!
         *  \param Station to calcuate if satellite is in View
         *  \param TimeDate start time
         *  \param List<Sgp4Data> satellite position vector
         *  \param string name of the satellite
         *  \param double tick in witch time is increased by each step
         *  \return List<contactWindow>
         */
        public void calcContactWindows()
        {
            One_Sgp4.EpochTime starttime = new One_Sgp4.EpochTime(_time);
            bool          visible        = false;
            ContactWindow window         = null;
            double        minElevation   = _station.getMinElevation();

            for (int i = 0; i < _satPosData.Count(); i++)
            {
                double          lsr            = starttime.getLocalSiderealTime(_station.getLongitude());
                Structs.point3D groundLocation = _station.getEci(lsr);

                Structs.point3D v = new Structs.point3D();
                v.x = _satPosData[i].getX() - groundLocation.x;
                v.y = _satPosData[i].getY() - groundLocation.y;
                v.z = _satPosData[i].getZ() - groundLocation.z;

                double r_lat = _station.getLatitude() * Constants.toRadians;

                double sin_lat = Math.Sin(r_lat);
                double cos_lat = Math.Cos(r_lat);
                double sin_srt = Math.Sin(lsr);
                double cos_srt = Math.Cos(lsr);


                double rs = sin_lat * cos_srt * v.x
                            + sin_lat * sin_srt * v.y
                            - cos_lat * v.z;
                double re = -sin_srt * v.x
                            + cos_srt * v.y;
                double rz = cos_lat * cos_srt * v.x
                            + cos_lat * sin_srt * v.y + sin_lat * v.z;

                double range     = Math.Sqrt(rs * rs + re * re + rz * rz);
                double elevation = Math.Asin(rz / range);
                double azimuth   = Math.Atan(-re / rs);

                if (rs > 0.0)
                {
                    azimuth += Constants.pi;
                }
                if (azimuth < 0.0)
                {
                    azimuth += Constants.twoPi;
                }

                if (elevation >= minElevation)
                {
                    if (visible == false)
                    {
                        window = new ContactWindow(_satName, _station.getName());
                        window.setStartTime(starttime);
                    }
                    TrackingData testTrack = new TrackingData(azimuth,
                                                              elevation, range, starttime.ToString());
                    window.addTrackingData(testTrack);
                    visible = true;
                }
                else
                {
                    if (visible == true)
                    {
                        window.setStopTime(starttime);
                        results.Add(window);
                    }
                    visible = false;
                }

                azimuth = azimuth * Constants.toDegrees;
                starttime.addTick(_tick);
            }
        }