Example #1
0
        // Calls the correct method depending on the current calibration state "State" and
        // adapts respectively the text on the button "Start".
        // The states are start, measure zero, measure calibration weight, close.
        private void button1_Click(object sender, EventArgs e)
        {
            string[] argument = new string[3];

            switch (_state)
            {
            case 0:     // start

                _strCommaDot       = textBox1.Text.Replace(".", ",");
                _calibrationWeight = double.Parse(_strCommaDot);

                textBox1.Enabled = false;
                textBox2.Text    = _calibrationWeight.ToString();


                textBox2.Text = "Unload Scale!";
                button1.Text  = "Measure Zero";
                button2.Text  = "<Back";

                _state = 1;

                break;

            case 1:      // measure zero

                textBox2.Text = "Measure zero in progess.";

                _wtxObj.MeasureZero();

                Thread.Sleep(3000);

                textBox2.Text = "Dead load measured." + Environment.NewLine + "Put weight on scale.";
                button1.Text  = "Calibrate";
                _state        = 2;

                break;

            case 2:     // start calibration

                textBox2.Text = "Calibration in progress.";

                _wtxObj.Calibrate(this.PotencyCalibrationWeight(), _calibrationWeight.ToString());

                textBox2.Text = "Calibration successful and finished.";
                button1.Text  = "Close";

                _state = 3;

                break;

            default:

                this.Close();
                _state = 0;

                break;
            }
        }
Example #2
0
        public bool CalibrationTest(Behavior behavior)
        {
            _jetTestConnection = new TestJetbusConnection(behavior, "wss://172.19.103.8:443/jet/canopen", "Administrator", "wtx", delegate { return(true); });

            _wtxObj = new WtxJet(_jetTestConnection);

            _wtxObj.Connect(this.OnConnect, 100);

            _wtxObj.Calibrate(15000, "15000");

            if (_jetTestConnection.getDataBuffer.ContainsKey("6152/00") && _jetTestConnection.getDataBuffer.ContainsValue(15000) &&       // LFT_SCALE_CALIBRATION_WEIGHT = "6152/00"
                _jetTestConnection.getDataBuffer.ContainsKey("6002/01") && _jetTestConnection.getDataBuffer.ContainsValue(1852596579) &&  // CALIBRATE_NOMINAL_WEIGHT = 1852596579 // SCALE_COMMAND = "6002/01"
                _jetTestConnection.getDataBuffer.ContainsKey("6002/02") && _jetTestConnection.getDataBuffer.ContainsValue(1801543519)
                )
            {
                return(true);
            }

            else
            {
                return(false);
            }
        }