예제 #1
0
        //! ContactWindowsVector constructor.

        /*!
         *  \param ContactWindowsVector
         *  Creates a new object from a ContactWindowsVector
         */
        public ContactWindowsVector(ContactWindowsVector contacts)
        {
            contactsList      = new List <ContactWindow>(contacts.getAllContacts());
            satelliteNameList = new List <string>(contacts.getSatelliteNames());
            stationNameList   = new List <string>(contacts.getStationNames());
            starttime         = new One_Sgp4.EpochTime(contacts.getStartTime());
            stoptime          = new One_Sgp4.EpochTime(contacts.getStopTime());
            calcualteTimesOfAllContacst();
        }
예제 #2
0
        //! Get contact in range

        /*!
         *  \param int starting point in list
         *  \param int count number of items
         *  \return ContactWindowsVector of items in range
         */
        public ContactWindowsVector getRange(int start, int count)
        {
            ContactWindowsVector result = new ContactWindowsVector();

            for (int i = start; i <= count; i++)
            {
                result.add(contactsList[i]);
            }
            return(result);
        }
예제 #3
0
파일: Main.cs 프로젝트: mohdbilal/marrss
        //! Create new Schedule

        /*!
         * \clears old contact vectors
         */
        private void clearScheduling()
        {
            startTimePicker.Enabled   = true;
            startDatePicker.Enabled   = true;
            stopTimePicker.Enabled    = true;
            stopDatePicker.Enabled    = true;
            checkedSatellites.Enabled = true;
            checkedStations.Enabled   = true;
            contactsVector            = null;
        }
예제 #4
0
        //! add ContactWindows

        /*!
         *  \param ContactWindowsVector adds a ContactsWindowsVector
         */
        public void add(ContactWindowsVector contacts)
        {
            if (!contacts.isEmpty())
            {
                for (int i = 0; i < contacts.Count(); i++)
                {
                    contactsList.Add(contacts.getAt(i));
                }
            }
            updateNamesList();
            calcualteTimesOfAllContacst();
        }
예제 #5
0
파일: Main.cs 프로젝트: mohdbilal/marrss
        //! Calculate Contact windows

        /*!
         * /param EpochTime starting time
         * /param Epoch Time stoping time
         * /param string Logfile
         * cacluated the orbits of selected satellites and then the contact windows
         * for each station in the given time frame
         */
        private void CalculateContacts(One_Sgp4.EpochTime start, One_Sgp4.EpochTime stop, string logfile)
        {
            TimeMeasurement timeMessurmentOribt = new Performance.TimeMeasurement();

            timeMessurmentOribt.activate();

            contactsVector = MainFunctions2.calculateContactWindows(satTleData, stationData, start, stop, logfile, this);

            string perfResCalc = timeMessurmentOribt.getValueAndDeactivate();

            updateLog(logfile, "Contact Windows Calculated in: " + perfResCalc + "sec.");
        }
예제 #6
0
파일: Main.cs 프로젝트: mohdbilal/marrss
        //! Load Saved Schedule from File

        /*!
         *  opens File Dialog and will load a saved schedule from xml file
         */
        private void loadSavedSchedule()
        {
            toolStripStatusLabel3.Text = "Status: Opening File";
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Filter      = "Saved Contacts Files (.xml)|*.xml|All Files (*.*)|*.*";
            openFileDialog1.FilterIndex = 1;

            DialogResult userSelect = openFileDialog1.ShowDialog();

            if (userSelect == DialogResult.OK)
            {
                string filePath = openFileDialog1.FileName;
                toolStripStatusLabel3.Text = "Status: Loading SaveFile";
                contactsVector             = DataBase.SaveLoad.loadFile(filePath, this);
                UpdateAllLists();

                toolStripStatusLabel3.Text = "Status: Updating Data";
                //Update selected satellites and Groundstations list
                foreach (string name in contactsVector.getSatelliteNames())
                {
                    int res = checkedSatellites.Items.IndexOf(name);
                    if (res >= 0)
                    {
                        checkedSatellites.SetItemChecked(res, true);
                    }
                }
                foreach (string name in contactsVector.getStationNames())
                {
                    int res = checkedStations.Items.IndexOf(name);
                    if (res >= 0)
                    {
                        checkedStations.SetItemChecked(res, true);
                    }
                }
                startTimePicker.Value      = contactsVector.getStartTime().toDateTime();
                stopTimePicker.Value       = contactsVector.getStopTime().toDateTime();
                startDatePicker.Value      = startTimePicker.Value;
                stopDatePicker.Value       = stopTimePicker.Value;
                startTimePicker.Enabled    = false;
                startDatePicker.Enabled    = false;
                stopTimePicker.Enabled     = false;
                stopDatePicker.Enabled     = false;
                checkedSatellites.Enabled  = false;
                checkedStations.Enabled    = false;
                toolStripStatusLabel3.Text = "Status: Done";
            }
        }
예제 #7
0
파일: Main.cs 프로젝트: mohdbilal/marrss
        //! Calculate Schedule

        /*!
         *  Calculates the orbit positions of the selected Satellites for the
         *  given time period and then the contact windows for each selected
         *  ground station. The calculation of the orbits and contact windows
         *  is done in multiple threads to save time. Afterwards the selected
         *  scheduler will compute a solution.
         *  New schedulers can be added inside this function below.
         */
        private void startSchedule(bool useBruteForce = false)
        {
            string logFile = MainFunctions.getLogFileName();

            prepareStart();
            updateLog(logFile, "Starting");
            //Set Start and Stop Time
            One_Sgp4.EpochTime startTime = getStartTime();
            One_Sgp4.EpochTime stopTime  = getStopTime();
            updateLog(logFile, "StartTime: " + startTime.ToString());
            updateLog(logFile, "StartTime: " + stopTime.ToString());

            // create empty Lists and data containers for Data
            satTleData  = new List <One_Sgp4.Tle>();
            stationData = new List <Ground.Station>();
            //check if contacts vector has not been already created or loaded
            //from save file
            bool resetScenario = true;

            if (contactsVector == null || changedParameters == true)
            {
                contactsVector = new Definition.ContactWindowsVector();
                contactsVector.setStartTime(startTime);
                contactsVector.setStopTime(stopTime);
                //get selected Satellites to calculate Orbits
                satTleData  = getSatelliteData(logFile);
                stationData = getStationData(logFile);
                //starting with the orbit calculations
                updateLog(logFile, "Staring Orbit Calculations");
                //Calculate Orbits and Contact Windows
                CalculateContacts(startTime, stopTime, logFile);
            }
            else
            {
                // resuse old ContactWindows
                startTime     = contactsVector.getStartTime();
                stopTime      = contactsVector.getStopTime();
                resetScenario = false;
            }

            AutoSave(logFile);
            updateLog(logFile, "Setting Up Scheduler");
            //Set Scheduling Problem
            //set Objective Function
            setObjectiveFunction();
            string test = objectivefunct.ToString();
            //objectivefunct = new ObjectiveFunction(Global.Structs.ObjectiveEnum.DURATION,
            //    Global.Structs.ObjectiveEnum.FAIRNESSATELITE, Global.Structs.ObjectiveEnum.FAIRNESSTATION,
            //    Global.Structs.ObjectiveEnum.SCHEDULEDCONTACTS);

            SchedulingProblem problem = RunScheduler.setSchedulingProblem(contactsVector, objectivefunct);

            /* Generate the selected Scenarios
             * These are defined in the SchedulingProblem Class
             * Other Scenarios can be selected here if they are added
             */
            if (resetScenario != false)
            {
                getScenario(problem);
            }
            //enable time measurment Class
            TimeMeasurement tm = new Performance.TimeMeasurement();

            startScheduleButton.Enabled = true;
            scheduler = null;
            //create new scheduler object and set settings
            if (radioGenetic.Checked)
            {
                scheduler = RunScheduler.setScheduler(new GeneticScheduler(), this);
            }
            if (radioEFTGreedy.Checked)
            {
                scheduler = RunScheduler.setScheduler(new EftGreedyScheduler(), this);
            }
            if (radioGreedy.Checked)
            {
                scheduler = RunScheduler.setScheduler(new GreedyScheduler(), this);
            }
            if (radioHillClimber.Checked)
            {
                scheduler = RunScheduler.setScheduler(new HillClimberScheduler(), this);
            }
            //-----------------------------------------------------------------
            //---------------------------Add New SCHEDULER HERE-----------------
            //-----------------------------------------------------------------

            /*
             * if (radioNEW.Checked
             * {
             *  scheduler = RunScheduler.setScheduler(new Scheduler.ExampleScheduler(), this);
             * }
             */
            //-----------------------------------------------------------------
            //-----------------------------------------------------------------
            //-----------------------------------------------------------------
            updateLog(logFile, "starting " + scheduler.ToString());
            //start Time Meassurment
            tm.activate();
            if (!useBruteForce)
            {
                RunScheduler.startScheduler(scheduler, problem);
            }
            else
            {
                RunScheduler.startBruteForce(scheduler, problem, this);
            }
            //get Time Measurment
            updateCalculationTime(tm.getValueAndDeactivate());
            //display resulst on main Page
            RunScheduler.displayResults(this, scheduler);
            //finisch clean up and write to logs if necesarry
            finischSchedule(scheduler.ToString(), logFile);
        }