Example #1
0
 /*
  * private void updateSetPoints()
  * {
  *  if (testMode == 0)
  *  {
  *      //ctcSetSpeed = currSpeedms;
  *      // currSpeedms = 0;
  *  }
  *  else
  *  {
  *      if (!simulate)
  *      {
  *          if (speedTestTextBox.Text != "") currSpeedms = Convert.ToDouble(speedTestTextBox.Text);
  *          if (ctcSpeedTestTextBox.Text != "") ctcSetSpeed = Convert.ToDouble(ctcSpeedTestTextBox.Text);
  *          if (tempTestTextBox.Text != "") temp = Convert.ToDouble(tempTestTextBox.Text);
  *          u = 0;
  *          uk = 0;
  *          ek = 0;
  *      }
  *      else currSpeedms = currSpeed * 3600 / 1000;
  *      driverSetSpeed = (setSpeedTrackBar.Value) / Convert.ToDouble(0.44704);
  *      if (mode == 0)
  *      {
  *          setSpeedms = driverSetSpeed;
  *      }
  *      else setSpeedms = ctcSetSpeed;
  *      if (setSpeedms > 80) setSpeedms = 80;
  *      setTemp = setTempTrackBar.Value;
  *      setSpeed = setSpeedms * 1000 / 3600;
  *      currSpeed = currSpeedms * 1000 / 3600;
  *  }
  * }*/
 //when set parameters button is hit, train starts and is lodaed with kp and ki or default values
 private void uploadTrackButtonClick(object sender, EventArgs e)
 {
     if (KpTextBox.Text != "")
     {
         Kp = Convert.ToDouble(KpTextBox.Text);
         powerController.setKP(Kp);
     }
     if (KiTextBox.Text != "")
     {
         Ki = Convert.ToDouble(KiTextBox.Text);
         powerController.setKI(Ki);
     }
     setTrack(trackFileTextBox.Text);
     TM.Start();
     uploadTrackButton.Enabled = false;
 }