Beispiel #1
0
 ///<summary>
 ///Adds a point to the error chart, supports multithreading so
 ///we can add a point to the chart without lag when the training is
 ///fully using a CPU core
 ///</summary>
 private void addPoint(int index, double error, int series)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.errorChart.InvokeRequired)
     {
         AddPointCallback d = new AddPointCallback(addPoint);
         this.Invoke(d, new object[] { index, error, series });
     }
     else
     {
         errorChart.Series[series].Points.AddXY(index, error);
     }
 }
 //Add a point to the chart
 private void AddPoint(double point, double target, bool relayOn)
 {
     if (chart.InvokeRequired)
     {
         AddPointCallback d = new AddPointCallback(AddPoint);
         this.Invoke(d, new object[] { point, target, relayOn });
     }
     else
     {
         if (chart.Series[0].Points.Count > 10000)
             chart.Series[0].Points.RemoveAt(0);
         int relayPoint = relayOn?1:0;
         chart.Series[0].Points.AddY(point);
         chart.Series[1].Points.AddY(target);
         chart.Series[2].Points.AddY(relayPoint);
         writer = new StreamWriter(filename,true);
         writer.WriteLine(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "\t" + point + "\t" + target + "\t" + relayPoint);
         writer.Close();
     }
 }