private void SetBtn_Click(object sender, EventArgs e) { try { Kp = double.Parse(Kp_textBox.Text); Ki = double.Parse(Ki_textBox.Text); Kd = double.Parse(Kd_textBox.Text); SetPoint = double.Parse(SetPoint_textBox.Text); dt = double.Parse(dt_textBox.Text); } catch { Output_label.Text = "Invalid value!\nPlease enter a double number, and try it again."; } // set pid pid.Set(Kp, Ki, Kd, SetPoint, dt); pid.Clear(); // clear image list.Clear(); list.Add(new Point(10, pictureBox1.Height - 10)); dt_sum = 0; Output_label.Text = "0"; system_LP.Clear(); // start timer and refresh image timer1.Start(); pictureBox1.Refresh(); }
private void Add_process_Click(object sender, EventArgs e) { int n = Allocation_Table.Rows.Add(); processes.Add(new segment() { id = int.Parse(PID.Text), start = -1, size = int.Parse(process_size.Text), name = "P" }); Allocation_Table.Rows[n].Cells[0].Value = PID.Text; Allocation_Table.Rows[n].Cells[1].Value = "none"; Allocation_Table.Rows[n].Cells[2].Value = process_size.Text; Add_process.Enabled = false; no_process = int.Parse(number_of_processes.Text); number_of_processes.Enabled = false; process_size.Clear(); PID.Clear(); no_process--; if (no_process == 0) { Add_process.Enabled = false; } if (Allocation_method.Text == "First fit" || Allocation_method.Text == "Best fit" || Allocation_method.Text == "Worst fit") { allocate.Enabled = true; } }
public void Clear() { pxs = 0.0; pys = 0.0; time = 0.0; ex = 0.0; ey = 0.0; pidx.Clear(); pidy.Clear(); }