コード例 #1
0
        /// <summary>
        /// 设置comboBox的默认索引
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox_boardNum.SelectedIndex = 0;
            SampleRateCombo.SelectedIndex   = 7;
            stripChart_position.YAutoEnable = false;
            stripChart_position.AxisYMax    = 10;
            stripChart_position.AxisYMin    = 0;

            stripChart_weight.YAutoEnable = true;
            this._loadCell           = new LoadCell(1.5, 1000, 5);
            this._displacementsensor = new DisplacementSensor(5000, 10, 0);
            this._thermistor         = new Thermistor(100000, 3950);
            //stripChart_weight.AxisYMax = 1000;
            //stripChart_weight.AxisYMin = 0;
        }
コード例 #2
0
        private void easyButton1_Click(object sender, EventArgs e)
        {
            value = (double)numericUpDown_value.Value;
            for (int i = 0; i < values.Length; i++)
            {
                values[i] = value;
            }
            double[] res;

            switch (comboBox1.SelectedItem.ToString())
            {
            case "位移传感器":
                numericUpDown_result.Value = (decimal)DisplacementSensor.Convert(value, (double)numericUpDown_maxDisp.Value, (double)numericUpDown_maxR.Value, (double)numericUpDown_minR.Value);
                res = DisplacementSensor.Convert(values, (double)numericUpDown_maxDisp.Value, (double)numericUpDown_maxR.Value, (double)numericUpDown_minR.Value);
                easyChartX1.Plot(res);
                break;

            case "荷重传感器":
                numericUpDown_result.Value = (decimal)LoadCell.Convert(value, (double)numericUpDown_sensitivity.Value, (double)numericUpDown_maxLoad.Value, (double)numericUpDown_excitationVolt.Value);
                res = LoadCell.Convert(values, (double)numericUpDown_sensitivity.Value, (double)numericUpDown_maxLoad.Value, (double)numericUpDown_excitationVolt.Value);
                easyChartX1.Plot(res);
                break;

            case "热电阻RTD_PT100":
                numericUpDown_result.Value = (decimal)RTD.Convert(value);
                res = RTD.Convert(values);
                easyChartX1.Plot(res);
                break;

            case "热敏电阻Thermistor":
                numericUpDown_result.Value = (decimal)Thermistor.Convert(value, (double)numericUpDown_resistorRT.Value, (double)numericUpDown_beta.Value);
                res = Thermistor.Convert(values, (double)numericUpDown_resistorRT.Value, (double)numericUpDown_beta.Value);
                easyChartX1.Plot(res);
                break;

            case "热电偶Thermocouple":
                numericUpDown_result.Value = (decimal)Thermocouple.Convert((ThermocoupleType)Enum.Parse(typeof(ThermocoupleType), comboBox2.Text), value, checkBox_cjcEnable.Checked, (double)numericUpDown_cjcTemperature.Value);
                res = Thermocouple.Convert((ThermocoupleType)Enum.Parse(typeof(ThermocoupleType), comboBox2.Text), values, checkBox_cjcEnable.Checked, (double)numericUpDown_cjcTemperature.Value);
                easyChartX1.Plot(res);
                break;

            default:
                break;
            }
        }