private void measure() { resetTime(); MeasureResultTera result; this.MeasureStatus = MEASURE_STATUS.IS_GOING; do { this.teraDevice.DeviceForm.updateResultField(); Thread.Sleep(700); result = new MeasureResultTera(this, this.teraDevice); this.teraDevice.DoMeasure(ref result); if (!result.IsCompleted) { TeraMeasure.measureError("Превышено время ожидания результата"); break; } result.SecondsFromStart = measSeconds; if (result.Status > 0) { break; } ResultCollectionsList.Add(result); if (StatCycleNumber < this.AveragingTimes) { StatCycleNumber++; continue; } //Если статистическое испытание, то уходим на следующий подциклa this.teraDevice.DeviceForm.updateResultField(); if (!this.IsCyclicMeasure && this.CycleNumber == this.CycleTimes) { break; } this.CycleNumber++; } while (true); if (result.Status != TERA_RESULT_STATUS.SUCC && result.Status != TERA_RESULT_STATUS.INTERRUPTED && result.Status != TERA_RESULT_STATUS.STATUS_VOLTAGE_SOURCE_IS_OFF) { string errMessage = "Неизвестная ошибка измерения"; if (result.Status == TERA_RESULT_STATUS.INTEGRATOR_IS_ON_NEGATIVE) { errMessage = "Интегратор находится в отрицательной области"; } else if (result.Status == TERA_RESULT_STATUS.LOST_CIRCUIT_CORR_ERR_CODE) { errMessage = "Не удалось произвести коррекцию токов утечки"; } else if (result.Status == TERA_RESULT_STATUS.SHORT_CIRCUIT) { errMessage = "Подключенный образец имеет слишком маленькое сопротивление."; } System.Windows.Forms.MessageBox.Show(errMessage, "Ошибка измерения", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } else if (result.Status == TERA_RESULT_STATUS.INTERRUPTED || result.Status == TERA_RESULT_STATUS.STATUS_VOLTAGE_SOURCE_IS_OFF) { this.MeasureStatus = MEASURE_STATUS.STOPED; } }
private void initPage() { this.measure = new TeraMeasure(teraDevice, MEASURE_TYPE.HAND); fillHandMeasureParameters(); buildIsolationMaterialArr(); switchBringingParams(); getCameraDiametersByCameraId(); cleanMeasInfo(); }
public MeasureResultTera(TeraMeasure m, TeraDevice d) : base() { this.Measure = m; this.TeraDevice = d; this.CycleNumber = m.CycleNumber; this.MeasureNumber = m.Number; this.StatCycleNumber = m.StatCycleNumber; this.Voltage = m.Voltage; this.Material = m.Material; this.Temperature = m.Temperature; this.BringingTypeId = m.BringingTypeId; this.BringingLengthMeasure = m.BringingLengthMeasure; }
public void updateMeasureStatus(MEASURE_STATUS status) //Для обновления поля результата из другого потока в котором проходит испытание { if (InvokeRequired) { BeginInvoke(new updateMeasureStatusDelegate(updateMeasureStatus), new object[] { status }); return; } else { bool isActive = status != MEASURE_STATUS.NOT_STARTED && status != MEASURE_STATUS.FINISHED && status != MEASURE_STATUS.STOPED; this.measureStatus.Text = TeraMeasure.StatusString(status); this.startHandMeasureBut.Enabled = !(status == MEASURE_STATUS.DISCHARGE); this.measureIsActive = isActive; this.measureSettingsGroup.Enabled = !isActive; autoCorrCb.Enabled = this.comboBoxResistance.Enabled = this.teraEtalonMapComboBox.Enabled = this.comboBoxMode.Enabled = !isActive; startHandMeasureBut.Text = !isActive ? "ПУСК ИЗМЕРЕНИЯ" : "ОСТАНОВИТЬ ИЗМЕРЕНИЯ"; } }
private void comboBoxMode_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cb = sender as ComboBox; switch (cb.SelectedIndex) { case 0: this.measure = new TeraMeasure(teraDevice, MEASURE_TYPE.HAND); verificationCalibrationPanel.Visible = false; handMeasurePanel.Visible = true; measureSettingsGroup.Enabled = true; averagingTimes.Enabled = cycleTimes.Enabled = polarizationDelay.Enabled = isCyclicMeasure.Enabled = dischargeDelay.Enabled = voltageComboBox.Enabled = normaField.Enabled = true; initPage(); break; case 1: this.measure = new TeraMeasure(teraDevice, MEASURE_TYPE.VERIFICATION); verificationCalibrationPanel.Visible = true; handMeasurePanel.Visible = false; isCyclicMeasure.Enabled = dischargeDelay.Enabled = voltageComboBox.Enabled = normaField.Enabled = false; cycleTimes.Enabled = polarizationDelay.Enabled = true; cycleTimes.Value = 10; isCyclicMeasure.Checked = false; handMeasurePanel.Visible = false; //measureSettingsGroup.Enabled = false; fillEtalonMapComboBox(); break; case 2: this.measure = new TeraMeasure(teraDevice, MEASURE_TYPE.CALIBRATION); voltageComboBox.Enabled = verificationCalibrationPanel.Visible = true; //measureSettingsGroup.Enabled = false; isCyclicMeasure.Enabled = averagingTimes.Enabled = isCyclicMeasure.Checked = dischargeDelay.Enabled = normaField.Enabled = false; setCorrField(autoCorrCb.Checked); averagingTimes.Value = 1; voltageComboBox.SelectedText = "10"; handMeasurePanel.Visible = false; fillEtalonMapComboBox(); break; } }
private void cleanMeasInfo() { this.measureStatus.Text = TeraMeasure.StatusString(MEASURE_STATUS.NOT_STARTED); this.measTimeLbl.Text = this.normaLbl.Text = this.cycleCounterLbl.Text = this.statMeasNumbOfLbl.Text = this.midStatMeasValLbl.Text = this.measTimeLbl.Text = ""; this.measureResultLbl.Text = "0.0 МОм"; }