Beispiel #1
0
        }     // end method MenuCases()

        /*
         * This method calcutes the values for a dead load and a nominal load(span) in a ratio in mV/V and write in into the WTX registers.
         */

        private static void CalculateCalibration()
        {
            _wtxDevice.Stop();

            zero_load_nominal_load_input();

            _wtxDevice.CalculateAdjustment(_preload, _capacity);
        }
Beispiel #2
0
        /// <summary>
        /// Checks the input values of the textboxes and start the calibration calculation.
        /// If the caluclation is finished, the window can be closed with the button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCalculate_Click(object sender, EventArgs e)
        {
            if (!_finished)
            {
                label5.Visible = true;
                bool abort = false;
                try
                {
                    _strCommaDot     = textBox1.Text.Replace(".", ",");
                    _preload         = double.Parse(_strCommaDot);
                    textBox1.Enabled = false;
                }
                catch (FormatException)
                {
                    label5.Text = "wrong number format";
                    abort       = true;
                }
                catch (OverflowException)
                {
                    label5.Text = "Overflow! Number to big.";
                    abort       = true;
                }

                try
                {
                    //Capacity = Convert.ToDouble(textBox2.Text, Provider);
                    _strCommaDot     = textBox2.Text.Replace(".", ",");
                    _capacity        = double.Parse(_strCommaDot);
                    textBox2.Enabled = false;
                }
                catch (FormatException)
                {
                    label5.Text = "wrong number format";
                    abort       = true;
                }
                catch (OverflowException)
                {
                    label5.Text = "Overflow! Number to big.";
                    abort       = true;
                }
                if (abort)
                {
                    return;
                }

                _wtxDevice.CalculateAdjustment(_preload, _capacity);

                label5.Text          = "Calibration Successful!";
                _finished            = true;
                buttonCalculate.Text = "Close";
            }
            else
            {
                Close();
            }
        }