Exemplo n.º 1
0
      private string ExtractBusParameters(SetupParameters setupParameters)
      {
         string result = null;

         #region Bus Interface Parsing

         setupParameters.BusInterface = (BusInterfaces)this.BusInterfaceComboBox.SelectedItem;

         #endregion

         #region Bus Rate Parsing

         string wheelSpeedString = this.BaudComboBox.Text;

         if (null != wheelSpeedString)
         {
            int interfaceRate = 0;

            if (int.TryParse(wheelSpeedString, out interfaceRate) != false)
            {
               setupParameters.BitRate = interfaceRate;
            }
            else
            {
               result = "invalid entry";
               this.BaudComboBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Consumer Heartbeat Node ID Parsing

         string consumerHeartbeatNodeIdString = this.ConsumerHeartbeatNodeIdTextBox.Text;

         if (null != consumerHeartbeatNodeIdString)
         {
            int consumerHeartbeatNodeId = 0;

            if (int.TryParse(consumerHeartbeatNodeIdString, out consumerHeartbeatNodeId) != false)
            {
               setupParameters.ConsumerHeartbeatNodeId = consumerHeartbeatNodeId;
            }
            else
            {
               result = "invalid entry";
               this.ConsumerHeartbeatNodeIdTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Consumer Heartbeat Time Parsing

         string consumerHeartbeatTimeString = this.ConsumerHeartbeatTimeTextBox.Text;

         if (null != consumerHeartbeatNodeIdString)
         {
            int consumerHeartbeatTime = 0;

            if (int.TryParse(consumerHeartbeatTimeString, out consumerHeartbeatTime) != false)
            {
               setupParameters.ConsumerHeartbeatTime = consumerHeartbeatTime;
            }
            else
            {
               result = "invalid entry";
               this.ConsumerHeartbeatTimeTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Consumer Heartbeat Time Parsing

         string producerHeartbeatTimeString = this.ProducerHeartbeatTimeTextBox.Text;

         if (null != producerHeartbeatTimeString)
         {
            int producerHeartbeatTime = 0;

            if (int.TryParse(producerHeartbeatTimeString, out producerHeartbeatTime) != false)
            {
               setupParameters.ProducerHeartbeatTime = producerHeartbeatTime;
            }
            else
            {
               result = "invalid entry";
               this.ProducerHeartbeatTimeTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region UUT ID Parsing

         string uutIdString = this.UutIdTextBox.Text;

         if (null != uutIdString)
         {
            int uutId = 0;

            if (int.TryParse(uutIdString, out uutId) != false)
            {
               setupParameters.UutId = uutId;
            }
            else
            {
               result = "invalid entry";
               this.UutIdTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Encoder ID Parsing

         string encoderIdString = this.EncoderIdTextBox.Text;

         if (null != encoderIdString)
         {
            int encoderId = 0;

            if (int.TryParse(encoderIdString, out encoderId) != false)
            {
               setupParameters.EncoderId = encoderId;
            }
            else
            {
               result = "invalid entry";
               this.EncoderIdTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Analog IO ID Parsing

         string analogIoIdString = this.AnalogIoIdTextBox.Text;

         if (null != analogIoIdString)
         {
            int analogIoId = 0;

            if (int.TryParse(analogIoIdString, out analogIoId) != false)
            {
               setupParameters.AnalogIoId = analogIoId;
            }
            else
            {
               result = "invalid entry";
               this.AnalogIoIdTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Digital IO ID Parsing

         string digitalIoIdString = this.DigitalIoIdTextBox.Text;

         if (null != digitalIoIdString)
         {
            int digitalIoId = 0;

            if (int.TryParse(digitalIoIdString, out digitalIoId) != false)
            {
               setupParameters.DigialIoId = digitalIoId;
            }
            else
            {
               result = "invalid entry";
               this.DigitalIoIdTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region UUT RPM to Speed Parsing

         string uutRpmToSpeedString = this.UutRpmToSpeedTextBox.Text;

         if (null != uutRpmToSpeedString)
         {
            double uutRpmToSpeed = 0.0;

            if ((double.TryParse(uutRpmToSpeedString, out uutRpmToSpeed) != false) &&
                (0 != uutRpmToSpeed))
            {
               setupParameters.UutRpmToSpeed = uutRpmToSpeed;
            }
            else
            {
               result = "invalid entry";
               this.UutRpmToSpeedTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Body RPM to Speed Parsing

         string bodyRpmToSpeedString = this.BodyRpmToSpeedTextBox.Text;

         if (null != bodyRpmToSpeedString)
         {
            double bodyRpmToSpeed = 0.0;

            if ((double.TryParse(bodyRpmToSpeedString, out bodyRpmToSpeed) != false) &&
                (0 != bodyRpmToSpeed))
            {
               setupParameters.BodyRpmToSpeed = bodyRpmToSpeed;
            }
            else
            {
               result = "invalid entry";
               this.BodyRpmToSpeedTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Analog IO Volts to Supply Amps Parsing

         string analogIoVoltsToSupplyAmpsSlopeString = this.AnalogIoVoltsToSupplyAmpsSlopeTextBox.Text;

         if (null != analogIoVoltsToSupplyAmpsSlopeString)
         {
            double analogIoVoltsToSupplyAmpsSlope = 0.0;

            if ((double.TryParse(analogIoVoltsToSupplyAmpsSlopeString, out analogIoVoltsToSupplyAmpsSlope) != false) &&
                (0 != analogIoVoltsToSupplyAmpsSlope))
            {
               setupParameters.AnalogIoVoltsToSupplyAmpsSlope = analogIoVoltsToSupplyAmpsSlope;
            }
            else
            {
               result = "invalid entry";
               this.AnalogIoVoltsToSupplyAmpsSlopeTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Analog IO Volts to Supply Amps Offset Parsing

         string analogIoVoltsToSupplyAmpsOffsetString = this.AnalogIoVoltsToSupplyAmpsOffsetTextBox.Text;

         if (null != analogIoVoltsToSupplyAmpsOffsetString)
         {
            double analogIoVoltsToSupplyAmpsOffset = 0.0;

            if (double.TryParse(analogIoVoltsToSupplyAmpsOffsetString, out analogIoVoltsToSupplyAmpsOffset) != false)
            {
               setupParameters.AnalogIoVoltsToSupplyAmpsOffset = analogIoVoltsToSupplyAmpsOffset;
            }
            else
            {
               result = "invalid entry";
               this.AnalogIoVoltsToSupplyAmpsOffsetTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         #region Analog IO Volts to Load Pounds Parsing

         string analogIoVoltsToLoadPoundsString = this.AnalogIoVoltsToLoadPoundsTextBox.Text;

         if (null != analogIoVoltsToLoadPoundsString)
         {
            double analogIoVoltsToLoadPounds = 0.0;

            if ((double.TryParse(analogIoVoltsToLoadPoundsString, out analogIoVoltsToLoadPounds) != false) &&
                (0 != analogIoVoltsToLoadPounds))
            {
               setupParameters.AnalogIoVoltsToLoadPounds = analogIoVoltsToLoadPounds;
            }
            else
            {
               result = "invalid entry";
               this.AnalogIoVoltsToLoadPoundsTextBox.BackColor = Color.Red;
            }
         }

         #endregion

         return (result);
      }
Exemplo n.º 2
0
      private void ActivityButton_Click(object sender, EventArgs e)
      {
         if (false == this.active)
         {
            string result = null;
            SetupParameters busParameters = new SetupParameters();
            TestParameters testParameters = new TestParameters();

            if (null == result)
            {
               result = this.ExtractBusParameters(busParameters);

               if (null != result)
               {
                  this.MainTabControl.SelectedTab = this.SetupTabPage;
               }
            }

            if (null == result)
            {
               result = this.ExtractTestParameters(testParameters);

               if (null != result)
               {
                  this.MainTabControl.SelectedTab = this.TestTabPage;
               }
            }

            if (null == result)
            {
               this.testComplete = false;
               this.dynoTest.Start(busParameters, testParameters, ref result);
            }

            if (null == result)
            {
               this.StatusLabel.Text = "test started";
   
               this.active = true;
               this.LockForRun();
            }
            else
            {
               this.StatusLabel.Text = result;
            }
         }
         else
         {
            this.dynoTest.Stop();
            this.StatusLabel.Text = "test stopped";

            this.active = false;
            this.UnlockForIdle();
         }
      }
Exemplo n.º 3
0
      public void Start(SetupParameters busParameters, TestParameters testParameters, ref string result)
      {
         if (null == result)
         {
            this.thread = new Thread(this.TestProcess);
            this.thread.IsBackground = true;
            this.thread.Name = "Test Process";

            this.setupParameters = busParameters;
            this.testParameters = testParameters;

            this.completeEarly = false;
            this.execute = true;
            this.thread.Start();
         }
      }