Start() public method

public Start ( ) : void
return void
示例#1
0
 private void trackBar1_MouseCaptureChanged(object sender, EventArgs e)
 {
     x = 0;
     graphics.Clear(Color.White);
     pid                    = PID.Create(Convert.ToDouble(domainUpDown1.Text), Convert.ToDouble(domainUpDown2.Text), Convert.ToDouble(domainUpDown3.Text), domainUpDown4.Text == "无限制" ? 0 : Convert.ToDouble(domainUpDown4.Text), comboBox1.Text == "增量型" ? PIDType.Increment : PIDType.Positional, Convert.ToInt32(textBox1.Text));
     pid.StepEvent         += Pid_StepEvent;
     pid.TargetAttachEvent += Pid_TargetAttachEvent;
     lastPoint              = lastIncPoint = new PointF(0, 0);
     pid.Start(Convert.ToDouble(trackBar1.Value / 10d), 0);
 }
示例#2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            // using pid
            double output = pid.Start(double.Parse(Output_label.Text));

            // using lowpass filter to simulate system
            output = system_LP.firstOrder_lowpassFilter(output, 0.3);



            // drawing image if you need
            Output_label.Text = output.ToString();

            dt_sum += dt * 5;
            list.Add(new Point((int)dt_sum + 10, pictureBox1.Height - (int)(output * 15)));

            pictureBox1.Refresh();

            if (dt_sum > 400)
            {
                timer1.Stop();
            }
        }
示例#3
0
 private static void ConsiderNewTemp(PID.PID pid, double newTargetTemp)
 {
     var diff = Math.Abs(pid.GetPreferredTemperature - newTargetTemp);
     if (diff > 0.1)
     {
         if (pid.Started())
         {
             pid.Stop();
         }
         pid.Start((float)newTargetTemp);
     }
 }