/// <summary> /// GetConfigurationObject /// </summary> /// <returns></returns> private CConfiguration GetConfigurationObject() { CConfiguration config = CConfiguration.GetObject(Convert.ToInt32(textNoOfTaskSets.Text), Convert.ToInt32(textNoOfTasks.Text), Convert.ToDouble(textMinimumPeriod.Text), Convert.ToDouble(textMaximumPeriod.Text), Convert.ToDouble(textMinimumExecutionTime.Text), Convert.ToDouble(textMaximumExecutionTime.Text), Convert.ToDouble(textMinimumOffset.Text), Convert.ToDouble(textMaximumOffset.Text)); if (CConfiguration.Message.Trim() != "") { MessageBox.Show(CConfiguration.Message); config = null; return(config); } config.bRunSimulation = checkRunSimulation.Checked; config.bUniqueExecutionTimes = checkUniqueExecutionTime.Checked; config.bUniquePeriods = checkUniquePeriod.Checked; return(config); }
private void CreateTaskSets() { bool bStatus; allTaskSets = new List <CTaskSet>(); //Create Configuration config = CConfiguration.GetObject(20, 3, 3, 40, 1, 7, 0, 0); config.bUniqueExecutionTimes = true; //Add Sched Tests schedTests = new List <ISchedulabilityTest>(); ISchedulabilityTest sch1 = new CHyperbolicSchedulabilityTest(); ISchedulabilityTest sch2 = new CLiuLaylandSchedulabilityTest(); ISchedulabilityTest sch3 = new CUtilizationSchedulabilityTest(); schedTests.Add(sch1); schedTests.Add(sch2); schedTests.Add(sch3); //Add Satisfiability Conditions satConditions = new List <ISatisfiabilityCondition>(); ISatisfiabilityCondition sat1 = new CPFRPSatisfiabilityCondition(); satConditions.Add(sat1); //Generate Period Sets and Execution Times List <CPeriodSet> _periodSets = GetPeriods(config); List <double> _executionTimes = GetExecutionTime(config); //Generate Release Offsets List <double> _releaseOffsets = GetReleaseOffsets(config); //Create Callbacks CCallBack cb = new CCallBack(); cb.funcReceivedTaskSet += CheckSchedulability; //Call Task Set Generator CTaskSetGenerator tsg = new CTaskSetGenerator(); tsg.GenerateTaskSets(_periodSets, _executionTimes, _releaseOffsets, config, cb); //Write Task Set Files CSimpleFileFormatter ff = new CSimpleFileFormatter(); bStatus = ff.WriteFiles(allTaskSets, Application.StartupPath + "\\Files", config); if (bStatus) { MessageBox.Show("All Files Successively Written"); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStart_Click(object sender, EventArgs e) { //Test for //List<List<double>> c; //List<double> main = new List<double>(); //main.Add(0); main.Add(1); main.Add(2); main.Add(3); main.Add(4); //CCombinationGenerator comb = new CCombinationGenerator(); //c = comb.GenerateCombinations(main, 3); //return; double maxLCM, LCM; int noOfTasks; List <CPeriodSet> periods; if (textTasksToGen.Text.Trim() != "") { noOfTasks = Convert.ToInt32(textTasksToGen.Text); } else { noOfTasks = 100; } CConfiguration oConfig = CConfiguration.GetObject(noOfTasks, Convert.ToInt32(textTasksPerSet.Text), Convert.ToDouble(textMinTaskPeriod.Text), Convert.ToDouble(textMaximumTaskPeriod.Text), 1, 10, 0, 0); IPeriodGenerator oPeriodGen = null; //Select Period Generator switch (comboPeriodMethod.SelectedIndex) { case 0: oPeriodGen = new CBoundedPeriods(); break; case 1: oPeriodGen = new CRandomPeriods(); break; case 2: oPeriodGen = new CAllPeriods(); break; default: break; } //Determine maximum possible periods UpdateStatus("Computing Number of Period Sets ..."); textNumberOfTaskSets.Text = oPeriodGen.GetMaximumUniquePeriodSets(oConfig).ToString(); textNumberOfPossibleTaskSets.Text = GetMaximumPossibleSets(oConfig).ToString(); UpdateStatus("Generating Period Sets ..."); periods = oPeriodGen.GetPeriods(oConfig, new CSieveOfEratosthenes()); listMain.Items.Clear(); listMain.Items.Add("<Periods>, LCM"); UpdateStatus("Displaying Period Sets ..."); maxLCM = 0; foreach (CPeriodSet period in periods) { Application.DoEvents(); LCM = period.GetLCM(); if (LCM > maxLCM) { maxLCM = LCM; } //listMain.Items.Add(period.GetPeriodString() + "," + LCM.ToString()); listMain.Items.Add(LCM.ToString()); if (listMain.Items.Count == oConfig.NumberOfTaskSets) { break; } } textLCM.Text = maxLCM.ToString(); UpdateStatus("Ready"); }