private void buttonKplot_Click(object sender, EventArgs e) { DataTable dt = GetSelectedTaskSet(); FormChart chart = new FormChart("Abstraction Bound under RM"); Series series = new Series("k space"); series.ChartArea = "ChartArea1"; series.ChartType = SeriesChartType.Line; series.Legend = "Legend1"; double p_min = Get_Pmin(dt); for (double i = 0; i < p_min; i += 1) { for (double j = 0; j < i; j += 1) { //double[] jk = new double[2]; //jk[0] = j; //jk[1] = GetK_underRM(i, j); Console.WriteLine(i + "\t" + j + "\t" + GetK_underRM(dt, i, j)); //series.Points.Add(new DataPoint(i, jk)); } } //chart.AddSeries(series); //chart.Show(); }
/* Obsolete Plot Sum with no CS overhead [Obsolete] private void PlotSumOfEmsTms() { this.Cursor = Cursors.WaitCursor; FormChart chart = new FormChart("Solution Space under RM (by Exhaustive search)"); try { chart.AxisX.Title = "Resource period (Π)"; chart.AxisY.Title = "Resource capacity (Θ/Π)";// "Resource allocation (Θ)"; chart.AxisX.Minimum = 1; chart.AxisY.Maximum = 1; DataTable dtEMS = dataGridView1.DataSource as DataTable; DataTable dtTMS = dataGridView2.DataSource as DataTable; Series seriesSum = GetExactAnalysisSeriesRM_SumOfTwo(dtEMS, dtTMS, "Sum of EMS and TMS"); if (checkBoxShowEmsTms.Checked) { Series seriesEMS = GetExactAnalysisSeriesRM(dtEMS, "EMS"); Series seriesTMS = GetExactAnalysisSeriesRM(dtTMS, "TMS"); seriesTMS.Color = Color.Green; seriesEMS.Color = Color.Blue; seriesSum.Color = Color.Red; chart.AddSeries(seriesEMS); chart.AddSeries(seriesTMS); } chart.AddSeries(seriesSum); } finally { this.Cursor = Cursors.Default; } chart.SetMinValues(_minimumPi, _minimumEmsTheta, _minimumTmsTheta); chart.Show(); } */ private void buttonEMS_TMS_Click(object sender, EventArgs e) { InputInvalidationCheck(); this.Cursor = Cursors.WaitCursor; _overhead = Math.Max(0, _overhead); FormChart chart = new FormChart("Solution Space under RM"); try { chart.AxisX.Title = "Resource period (Π)"; chart.AxisY.Title = "Resource capacity (Θ/Π)";// "Resource allocation (Θ)"; chart.AxisX.Minimum = _incrementUnit; chart.EnableLegend = true; DataTable dtEMS = dataGridView1.DataSource as DataTable; DataTable dtTMS = dataGridView2.DataSource as DataTable; Series seriesSum; seriesSum = GetExactAnalysisSeriesRM_SumOfTwo(dtEMS, dtTMS, "EMS + TMS", _overhead); if (checkBoxShowEmsTms.Checked) { Series seriesEMS = GetExactAnalysisSeriesRM(dtEMS, "EMS", _overhead); Series seriesTMS = GetExactAnalysisSeriesRM(dtTMS, "TMS", _overhead); seriesTMS.Color = Color.Green; seriesEMS.Color = Color.Blue; seriesSum.Color = Color.Red; chart.AddSeries(seriesEMS); chart.AddSeries(seriesTMS); } chart.AddSeries(seriesSum); } finally { this.Cursor = Cursors.Default; } chart.SetMinValues(_minimumPi, _minimumEmsTheta, _minimumTmsTheta); chart.ShowDialog(); }
private void buttonABunderRM_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; FormChart chart = new FormChart("Solution Space under RM"); try { DataTable dt = GetSelectedTaskSet(); double period_min = Get_Pmin(dt); Series s2 = new Series("Solution space by AB under RM"); s2.ChartArea = "ChartArea1"; s2.ChartType = SeriesChartType.Line; s2.Legend = "Legend1"; s2.Color = Color.Tomato; for (double i = _incrementUnit; i <= period_min; i += _incrementUnit) { double maxTheta = i - 1; int max_k = GetK_underRM(dt, i, maxTheta); double AB = GetAB_RM(dt, max_k); if (double.IsInfinity(AB)) continue; s2.Points.Add(new DataPoint(i, AB + 2 * _overhead / i)); } chart.AxisX.Title = "Resource period (Π)"; chart.AxisY.Title = "Resource capacity (Θ/Π)";// "Resource allocation (Θ)"; chart.AxisX.Minimum = _incrementUnit; chart.AxisY.Maximum = 1; chart.EnableLegend = false; chart.AddSeries(s2); } finally { this.Cursor = Cursors.Default; } chart.Show(); }
private void buttonPlotEDF_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; FormChart chart = new FormChart("Resource demand / supply"); chart.GetLable.Text = "Schedulable"; try { Series seriesDBF = new Series("Resource Demand"); seriesDBF.ChartArea = "ChartArea1"; seriesDBF.ChartType = SeriesChartType.StepLine; seriesDBF.Legend = "Legend1"; seriesDBF.Color = Color.Blue; Series seriesSBF = new Series("Resurce Supply"); seriesSBF.ChartArea = "ChartArea1"; seriesSBF.ChartType = SeriesChartType.Line; seriesSBF.Legend = "Legend1"; seriesSBF.Color = Color.Red; DataTable dt = GetSelectedTaskSet(); List<long> list = GetList(dt); foreach (long l in list) { double t = (double)l; double dbf = GetDBF_W(dt, t); double sbf = GetSBF_W(dt, _PI, _THETA, t); if (dbf > sbf) chart.GetLable.Text = "Not Schedulable"; seriesDBF.Points.Add(new DataPoint(t, dbf)); seriesSBF.Points.Add(new DataPoint(t, sbf)); } /* for (double t = 0; t <= _intervalLength; t += 1) { double dbf = GetDBF_W(dt, t); double sbf = GetSBF_W(dt, _PI, _THETA, t); if (dbf > sbf) chart.GetLable.Text = "Not Schedulable"; seriesDBF.Points.Add(new DataPoint(t, dbf)); seriesSBF.Points.Add(new DataPoint(t, sbf)); } */ chart.AxisX.Title = "Interval Length"; chart.AxisY.Title = "Resource demand / supply"; chart.AxisX.Minimum = 0; //chart.AxisX.Maximum = 7; //chart.AxisX.Interval = 1; //chart.AxisY.Interval = 1; //chart.AxisY.Maximum = 8; //chart.EnableLegend = false; chart.AddSeries(seriesDBF); chart.AddSeries(seriesSBF); } finally { this.Cursor = Cursors.Default; } chart.Show(); }
private void buttonCheck_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; List<Task> listTask = new List<Task>(); Task taskEms = new Task( double.Parse(textBoxEmsPi.Text), double.Parse(textBoxEmsTheta.Text), double.Parse(textBoxEmsPi.Text), // deadline = period 0); Task taskTms = new Task( double.Parse(textBoxTmsPi.Text), double.Parse(textBoxTmsTheta.Text), double.Parse(textBoxTmsPi.Text), // deadline = period 0); listTask.Add(taskEms); listTask.Add(taskTms); DataTable dtSync = dataGridViewSync.DataSource as DataTable; foreach (DataRow dr in dtSync.Rows) { Task t = new Task( double.Parse(dr["Period"].ToString()), double.Parse(dr["ExecutionTime"].ToString()) + 2 * _overhead, double.Parse(dr["ExecutionTime"].ToString()) + 2 * _overhead, // deadline = execution double.Parse(dr["Phase"].ToString()), 0); listTask.Add(t); } double interval = listTask[0].Period; foreach (Task t in listTask) { interval = (double)GetLCM((long)interval, (long)t.Period); } FormChart chart = new FormChart("Resource demand / supply"); chart.GetLable.Text = "Schedulable"; try { Series seriesDBF = new Series("Resource Demand"); seriesDBF.ChartArea = "ChartArea1"; seriesDBF.ChartType = SeriesChartType.StepLine; seriesDBF.Legend = "Legend1"; seriesDBF.Color = Color.Blue; Series seriesSBF = new Series("Resurce Supply"); seriesSBF.ChartArea = "ChartArea1"; seriesSBF.ChartType = SeriesChartType.Line; seriesSBF.Legend = "Legend1"; seriesSBF.Color = Color.Red; DataTable dt = GetSelectedTaskSet(); for (double t = 0; t <= interval; t += 1) { double dbf = GetDBF_Sporadic_EDF(listTask, t); if (dbf > t) chart.GetLable.Text = "Not Schedulable"; seriesDBF.Points.Add(new DataPoint(t, dbf)); seriesSBF.Points.Add(new DataPoint(t, t)); } chart.AxisX.Title = "Interval Length"; chart.AxisY.Title = "Resource demand / supply"; chart.AxisX.Minimum = 0; chart.AddSeries(seriesDBF); chart.AddSeries(seriesSBF); } finally { this.Cursor = Cursors.Default; } chart.Show(); }
private void DrawSoultionSpaceRM(DataTable dt) { this.Cursor = Cursors.WaitCursor; FormChart chart = new FormChart("Solution Space under RM"); try { chart.AxisX.Title = "Resource period (Π)"; chart.AxisY.Title = "Resource capacity (Θ/Π)";// "Resource allocation (Θ)"; chart.AxisY.Maximum = 1; chart.AxisX.Minimum = _incrementUnit; chart.AddSeries(GetExactAnalysisSeriesRM(dt, "Exact Analysis under RM", _overhead)); chart.EnableLegend = false; } finally { this.Cursor = Cursors.Default; } chart.Show(); }