From 27d45de8a1855711352114ce50cb1f65f7a0880d Mon Sep 17 00:00:00 2001 From: "DESKTOP-7I8SUIC\\zhang" Date: Mon, 21 Jul 2025 19:45:30 +0800 Subject: [PATCH 01/14] modify bugs --- trust.ui | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trust.ui b/trust.ui index 2342452..a087018 100644 --- a/trust.ui +++ b/trust.ui @@ -571,10 +571,10 @@ 2 - 1.000000000000000 + -50.000000000000000 - 99.900000000000006 + 50.000000000000000 @@ -587,7 +587,7 @@ - 0 - 13.99 V + -50 - 50 V From ec2d25398c17e9f45f8a893894b3299c712afe8f Mon Sep 17 00:00:00 2001 From: "DESKTOP-7I8SUIC\\zhang" Date: Mon, 28 Jul 2025 20:55:48 +0800 Subject: [PATCH 02/14] add temp code --- TSI_Config.pro | 3 + acceleration.cpp | 275 +---- acceleration.h | 4 - acceleration.ui | 1567 ++++++++++++----------- cardbase.h | 12 +- data_config.h | 19 + dc_outputs.cpp | 14 + dc_outputs.h | 22 + dc_outputs.ui | 293 +++++ mainwindow.ui | 2 +- pressure_pulsation.ui | 2 +- radial_vibration.cpp | 92 +- radial_vibration.ui | 1668 ++++++++++++++----------- seismic_monitor.cpp | 98 +- seismic_monitor.ui | 2733 ++++++++++++++++++----------------------- trust.cpp | 39 +- trust.ui | 1228 ++++++++++++------ velocity.cpp | 153 +-- velocity.ui | 1172 ++++++++---------- 19 files changed, 4852 insertions(+), 4544 deletions(-) create mode 100644 dc_outputs.cpp create mode 100644 dc_outputs.h create mode 100644 dc_outputs.ui diff --git a/TSI_Config.pro b/TSI_Config.pro index bb7c02a..49a74a5 100644 --- a/TSI_Config.pro +++ b/TSI_Config.pro @@ -15,6 +15,7 @@ SOURCES += \ common.cpp \ config_mgr.cpp \ connect.cpp \ + dc_outputs.cpp \ ethconfig.cpp \ keyphase.cpp \ keyphase_data.cpp \ @@ -48,6 +49,7 @@ HEADERS += \ config_mgr.h \ connect.h \ data_config.h \ + dc_outputs.h \ displacement_ds.h \ ethconfig.h \ keyphase.h \ @@ -77,6 +79,7 @@ HEADERS += \ FORMS += \ acceleration.ui \ connect.ui \ + dc_outputs.ui \ ethconfig.ui \ keyphase.ui \ macconfig.ui \ diff --git a/acceleration.cpp b/acceleration.cpp index db4d62b..cc1c94d 100644 --- a/acceleration.cpp +++ b/acceleration.cpp @@ -32,136 +32,6 @@ Acceleration::~Acceleration() { delete ui; } -void Acceleration::on_checkBox_rms_toggled(bool checked) { - // TODO: 自定义的回调 - if (checked) { - if (ui->checkBox_integrate->isChecked()) { - QStringList items = {"0-25 mm/s rms", "0-50 mm/s rms", "自定义"}; - ui->comboBox_direct_value_range->clear(); - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(0); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(0); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(0); - } else { - QStringList items = {"0-20 m/s^2 rms", "0-50 m/s^2 rms", "0-100 m/s^2 rms", "0-200 m/s^2 rms", "自定义"}; - ui->comboBox_direct_value_range->clear(); - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(0); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(0); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(0); - } - return; - } - if (ui->checkBox_integrate->isChecked()) { - QStringList items = {"0-25 mm/s pk", "0-50 mm/s pk", "0-100 mm/s pk", "自定义"}; - ui->comboBox_direct_value_range->clear(); - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(0); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(0); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(0); - } else { - QStringList items = {"0-20 m/s^2 pk", "0-50 m/s^2 pk", "0-100 m/s^2 pk", "0-200 m/s^2 pk", "0-250 m/s^2 pk", "0-400 m/s^2 pk", "自定义"}; - ui->comboBox_direct_value_range->clear(); - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(0); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(0); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(0); - } -} - -void Acceleration::on_checkBox_integrate_toggled(bool checked) { - // TODO: 自定义的回调 - if (checked) { - if (ui->checkBox_rms->isChecked()) { - QStringList items = {"0-25 mm/s rms", "0-50 mm/s rms", "自定义"}; - ui->comboBox_direct_value_range->clear(); - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(0); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(0); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(0); - } else { - QStringList items = {"0-25 mm/s pk", "0-50 mm/s pk", "0-100 mm/s pk", "自定义"}; - ui->comboBox_direct_value_range->clear(); - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(0); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(0); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(0); - } - return; - } - if (ui->checkBox_rms->isChecked()) { - QStringList items = {"0-20 m/s^2 rms", "0-50 m/s^2 rms", "0-100 m/s^2 rms", "0-200 m/s^2 rms", "自定义"}; - ui->comboBox_direct_value_range->clear(); - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(0); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(0); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(0); - } else { - QStringList items = {"0-20 m/s^2 pk", "0-50 m/s^2 pk", "0-100 m/s^2 pk", "0-200 m/s^2 pk", "0-250 m/s^2 pk", "0-400 m/s^2 pk", "自定义"}; - ui->comboBox_direct_value_range->clear(); - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(0); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(0); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(0); - } -} - -void Acceleration::on_checkBox_1x_ampl_toggled(bool checked) { - if (checked) { - ui->comboBox_1x_value_range->setEnabled(true); - ui->doubleSpinBox_1x_ampl_clamp->setEnabled(true); - ui->doubleSpinBox_1x_phase_lag_clamp->setEnabled(true); - return; - } - ui->comboBox_1x_value_range->setEnabled(false); - ui->doubleSpinBox_1x_ampl_clamp->setEnabled(false); - ui->doubleSpinBox_1x_phase_lag_clamp->setEnabled(false); -} - -void Acceleration::on_checkBox_2x_ampl_toggled(bool checked) { - if (checked) { - ui->comboBox_2x_value_range->setEnabled(true); - ui->doubleSpinBox_2x_ampl_clamp->setEnabled(true); - ui->doubleSpinBox_2x_phase_lag_clamp->setEnabled(true); - return; - } - ui->comboBox_2x_value_range->setEnabled(false); - ui->doubleSpinBox_2x_ampl_clamp->setEnabled(false); - ui->doubleSpinBox_2x_phase_lag_clamp->setEnabled(false); -} - void Acceleration::Init() { std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); if (base_ptr == nullptr) { @@ -188,32 +58,70 @@ void Acceleration::Init() { ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked); ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low); ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high); - ui->comboBox_direct_value_range->setCurrentIndex(variable_ptr->direct_.full_scale_range); - ui->doubleSpinBox_direct_clamp->setValue(variable_ptr->direct_.clamp_value); -// ui->label_bias_voltage->setText(QString::number(variable_ptr->direct_.bias_voltage)); -// ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value); -// ui->comboBox_bias_volt_range->setCurrentIndex(); - ui->checkBox_1x_ampl->setChecked(variable_ptr->x1_.checked); - ui->comboBox_1x_value_range->setCurrentIndex(variable_ptr->x1_.full_scale_range); - ui->doubleSpinBox_1x_ampl_clamp->setValue(variable_ptr->x1_.clamp_value); - ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variable_ptr->x1_.phase_lag); - ui->checkBox_2x_ampl->setChecked(variable_ptr->x2_.checked); - ui->comboBox_2x_value_range->setCurrentIndex(variable_ptr->x2_.full_scale_range); - ui->doubleSpinBox_2x_ampl_clamp->setValue(variable_ptr->x2_.clamp_value); - ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variable_ptr->x2_.phase_lag); - ui->spinBox_alert->setValue(variable_ptr->delay_.alert); - ui->doubleSpinBox_danger->setValue(variable_ptr->delay_.danger); - ui->checkBox_100ms->setChecked(variable_ptr->delay_.active_100ms); - ui->checkBox_rms->setChecked(variable_ptr->rms_active_); - ui->checkBox_integrate->setChecked(variable_ptr->integrate_active_); - ui->checkBox_alert_latching->setChecked(variable_ptr->alert_latching_); - ui->checkBox_danger_latching->setChecked(variable_ptr->danger_latching_); - ui->checkBox_timed_ok->setChecked(variable_ptr->timed_ok_); - ui->comboBox_recorder_output->setCurrentIndex(variable_ptr->recorder_out_.recorder_output); - ui->checkBox_two_ma_clamp->setChecked(variable_ptr->recorder_out_.two_ma_clamp); - ui->doubleSpinBox_trip_multiply->setValue(variable_ptr->recorder_out_.trip_multiply); - ui->comboBox_comparision->setCurrentIndex(variable_ptr->recorder_out_.comparision); - ui->spinBox_comparision_percentage->setValue(variable_ptr->recorder_out_.percentage); + + // processed output + // -general + if(variable_ptr->general.output_used) + ui->comboBox_output_used->setCurrentIndex(0); + else + ui->comboBox_output_used->setCurrentIndex(1); + // -alarm + ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.level)); + ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable); + ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch); + + ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.level)); + ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable); + ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch); + + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + // + ui->checkBox_enable->setChecked(variable_ptr->freband_output[0].enable); + ui->lineEdit_start->setText(QString::number(variable_ptr->freband_output[0].start)); + ui->lineEdit_end->setText(QString::number(variable_ptr->freband_output[0].end)); + ui->checkBox_enable_2->setChecked(variable_ptr->freband_output[1].enable); + ui->lineEdit_start_2->setText(QString::number(variable_ptr->freband_output[1].start)); + ui->lineEdit_end_2->setText(QString::number(variable_ptr->freband_output[1].end)); + ui->checkBox_enable_3->setChecked(variable_ptr->freband_output[2].enable); + ui->lineEdit_start_3->setText(QString::number(variable_ptr->freband_output[2].start)); + ui->lineEdit_end_3->setText(QString::number(variable_ptr->freband_output[2].end)); + ui->checkBox_enable_4->setChecked(variable_ptr->freband_output[3].enable); + ui->lineEdit_start_4->setText(QString::number(variable_ptr->freband_output[3].start)); + ui->lineEdit_end_4->setText(QString::number(variable_ptr->freband_output[3].end)); + ui->checkBox_enable_5->setChecked(variable_ptr->freband_output[4].enable); + ui->lineEdit_start_5->setText(QString::number(variable_ptr->freband_output[4].start)); + ui->lineEdit_end_5->setText(QString::number(variable_ptr->freband_output[4].end)); + ui->checkBox_enable_6->setChecked(variable_ptr->freband_output[5].enable); + ui->lineEdit_start_6->setText(QString::number(variable_ptr->freband_output[5].start)); + ui->lineEdit_end_6->setText(QString::number(variable_ptr->freband_output[5].end)); + ui->checkBox_enable_7->setChecked(variable_ptr->freband_output[6].enable); + ui->lineEdit_start_7->setText(QString::number(variable_ptr->freband_output[6].start)); + ui->lineEdit_end_7->setText(QString::number(variable_ptr->freband_output[6].end)); + ui->checkBox_enable_8->setChecked(variable_ptr->freband_output[7].enable); + ui->lineEdit_start_8->setText(QString::number(variable_ptr->freband_output[7].start)); + ui->lineEdit_end_8->setText(QString::number(variable_ptr->freband_output[7].end)); + ui->checkBox_enable_9->setChecked(variable_ptr->freband_output[8].enable); + ui->lineEdit_start_9->setText(QString::number(variable_ptr->freband_output[8].start)); + ui->lineEdit_end_9->setText(QString::number(variable_ptr->freband_output[8].end)); + ui->checkBox_enable_10->setChecked(variable_ptr->freband_output[9].enable); + ui->lineEdit_start_10->setText(QString::number(variable_ptr->freband_output[9].start)); + ui->lineEdit_end_10->setText(QString::number(variable_ptr->freband_output[9].end)); + + } void Acceleration::on_pushButton_confirm_clicked() { @@ -243,32 +151,8 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex(); - variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value(); - variable->direct_.custom = 0; // TODO: - variable->x1_.checked = ui->checkBox_1x_ampl->isChecked(); - variable->x1_.full_scale_range = ui->comboBox_1x_value_range->currentIndex(); - variable->x1_.clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value(); - variable->x1_.custom = 0; // TODO: - variable->x1_.phase_lag = ui->doubleSpinBox_1x_phase_lag_clamp->value(); - variable->x2_.checked = ui->checkBox_2x_ampl->isChecked(); - variable->x2_.full_scale_range = ui->comboBox_2x_value_range->currentIndex(); - variable->x2_.clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value(); - variable->x2_.custom = 0; // TODO: - variable->x2_.phase_lag = ui->doubleSpinBox_2x_phase_lag_clamp->value(); - variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex(); - variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked(); - variable->recorder_out_.trip_multiply = ui->doubleSpinBox_trip_multiply->value(); - variable->recorder_out_.comparision = ui->comboBox_comparision->currentIndex(); - variable->recorder_out_.percentage = ui->spinBox_comparision_percentage->value(); - variable->delay_.alert = ui->spinBox_alert->value(); - variable->delay_.danger = ui->doubleSpinBox_danger->value(); - variable->delay_.active_100ms = ui->checkBox_100ms->isChecked(); - variable->rms_active_ = ui->checkBox_rms->isChecked(); - variable->integrate_active_ = ui->checkBox_integrate->isChecked(); - variable->alert_latching_ = ui->checkBox_alert_latching->isChecked(); - variable->danger_latching_ = ui->checkBox_danger_latching->isChecked(); - variable->timed_ok_ = ui->checkBox_timed_ok->isChecked(); + + ptr->variables_.push_back(variable); this->close(); return; @@ -283,32 +167,7 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex(); - variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value(); - variable->direct_.custom = 0; // TODO: - variable->x1_.checked = ui->checkBox_1x_ampl->isChecked(); - variable->x1_.full_scale_range = ui->comboBox_1x_value_range->currentIndex(); - variable->x1_.clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value(); - variable->x1_.custom = 0; // TODO: - variable->x1_.phase_lag = ui->doubleSpinBox_1x_phase_lag_clamp->value(); - variable->x2_.checked = ui->checkBox_2x_ampl->isChecked(); - variable->x2_.full_scale_range = ui->comboBox_2x_value_range->currentIndex(); - variable->x2_.clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value(); - variable->x2_.custom = 0; // TODO: - variable->x2_.phase_lag = ui->doubleSpinBox_2x_phase_lag_clamp->value(); - variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex(); - variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked(); - variable->recorder_out_.trip_multiply = ui->doubleSpinBox_trip_multiply->value(); - variable->recorder_out_.comparision = ui->comboBox_comparision->currentIndex(); - variable->recorder_out_.percentage = ui->spinBox_comparision_percentage->value(); - variable->delay_.alert = ui->spinBox_alert->value(); - variable->delay_.danger = ui->doubleSpinBox_danger->value(); - variable->delay_.active_100ms = ui->checkBox_100ms->isChecked(); - variable->rms_active_ = ui->checkBox_rms->isChecked(); - variable->integrate_active_ = ui->checkBox_integrate->isChecked(); - variable->alert_latching_ = ui->checkBox_alert_latching->isChecked(); - variable->danger_latching_ = ui->checkBox_danger_latching->isChecked(); - variable->timed_ok_ = ui->checkBox_timed_ok->isChecked(); + this->close(); } diff --git a/acceleration.h b/acceleration.h index 21ce04c..b28459e 100644 --- a/acceleration.h +++ b/acceleration.h @@ -23,10 +23,6 @@ class Acceleration : public QWidget { void on_pushButton_set_default_clicked(); void on_pushButton_cancel_clicked(); - void on_checkBox_1x_ampl_toggled(bool checked); - void on_checkBox_2x_ampl_toggled(bool checked); - void on_checkBox_rms_toggled(bool checked); - void on_checkBox_integrate_toggled(bool checked); private: Ui::Acceleration *ui; diff --git a/acceleration.ui b/acceleration.ui index e0dbe0e..3397641 100644 --- a/acceleration.ui +++ b/acceleration.ui @@ -11,7 +11,7 @@ - 加速度配置 + 处理后输出 @@ -107,11 +107,11 @@ - 1 + 2 - 滤波配置 + 滤波 @@ -378,714 +378,8 @@ - 特征值和警报配置 + 处理后输出 - - - - 20 - 10 - 431 - 351 - - - - 特征值 - - - - - 20 - 50 - 54 - 12 - - - - 直接值 - - - - - - 10 - 80 - 81 - 16 - - - - 偏置电压 - - - - - - 20 - 110 - 81 - 16 - - - - 1倍频幅值 - - - - - - 20 - 180 - 81 - 16 - - - - 2倍频幅值 - - - - - - 141 - 31 - 48 - 16 - - - - 取值范围 - - - - - - 269 - 31 - 48 - 16 - - - - 默认值 - - - - - - 130 - 50 - 111 - 22 - - - - - 16777215 - 16777215 - - - - - 0-20 m/s^2 pk - - - - - 0-50 m/s^2 pk - - - - - 0-100 m/s^2 pk - - - - - 0-200 m/s^2 pk - - - - - 0-250 m/s^2 pk - - - - - 0-400 m/s^2 pk - - - - - 自定义 - - - - - - - 260 - 50 - 62 - 22 - - - - - 80 - 16777215 - - - - - - - 130 - 80 - 54 - 12 - - - - -24 - - - - - - 260 - 80 - 62 - 22 - - - - 1 - - - - - false - - - - 130 - 110 - 111 - 22 - - - - - 0-20 m/s^2 pk - - - - - 0-50 m/s^2 pk - - - - - 0-100 m/s^2 pk - - - - - 0-200 m/s^2 pk - - - - - 0-250 m/s^2 pk - - - - - 0-400 m/s^2 pk - - - - - 自定义 - - - - - - false - - - - 260 - 110 - 62 - 22 - - - - - - - 20 - 150 - 91 - 16 - - - - 1倍频相位 - - - - - - 20 - 210 - 91 - 16 - - - - 2倍频相位 - - - - - false - - - - 260 - 150 - 62 - 22 - - - - 0 - - - 100.000000000000000 - - - - - false - - - - 260 - 180 - 62 - 22 - - - - - - false - - - - 260 - 210 - 62 - 22 - - - - 0 - - - - - false - - - - 130 - 180 - 111 - 22 - - - - - 0-20 m/s^2 pk - - - - - 0-50 m/s^2 pk - - - - - 0-100 m/s^2 pk - - - - - 0-200 m/s^2 pk - - - - - 0-250 m/s^2 pk - - - - - 0-400 m/s^2 pk - - - - - 自定义 - - - - - - - 20 - 250 - 71 - 16 - - - - 有效值 - - - - - - 130 - 250 - 61 - 16 - - - - 积分 - - - - - - 200 - 240 - 221 - 101 - - - - 延时 - - - - - 20 - 20 - 54 - 12 - - - - 告警 - - - - - - 20 - 50 - 54 - 12 - - - - 危险 - - - - - - 60 - 50 - 61 - 21 - - - - 1 - - - 1.000000000000000 - - - - - - 60 - 80 - 71 - 16 - - - - 100 ms - - - - - - 130 - 20 - 54 - 12 - - - - 1 - 60s - - - - - - 130 - 50 - 71 - 16 - - - - 1.0 - 60.0s - - - - - - 60 - 20 - 61 - 21 - - - - 1 - - - - - - - 190 - 80 - 53 - 15 - - - - Vdc - - - - - - - 460 - 20 - 131 - 16 - - - - 告警锁定 - - - - - - 460 - 40 - 131 - 16 - - - - 危险锁定 - - - - - - 460 - 170 - 121 - 16 - - - - 倍增 - - - - - - 460 - 190 - 62 - 16 - - - - 1.000000000000000 - - - - - - 460 - 210 - 141 - 16 - - - - 1.00 - 3.00 (步进0.25) - - - - - - 460 - 90 - 54 - 12 - - - - 记录输出 - - - - - - 460 - 110 - 141 - 22 - - - - - - - - - - 直接幅值 - - - - - 1倍频幅值 - - - - - 2倍频幅值 - - - - - - - 460 - 140 - 91 - 16 - - - - 2 mA 默认值 - - - - - - 460 - 60 - 181 - 16 - - - - Timed OK channel Defeat - - - - - - 460 - 250 - 121 - 16 - - - - 比较 - - - - - false - - - - 460 - 310 - 61 - 22 - - - - - - false - - - - 460 - 270 - 141 - 22 - - - - - - - - - - 直接幅值 - - - - - 1倍频幅值 - - - - - 2倍频幅值 - - - @@ -1099,6 +393,859 @@ % + + + + 10 + 40 + 621 + 321 + + + + 1 + + + + 常规 + + + + + 170 + 150 + 54 + 12 + + + + 整流器 + + + + + + 10 + 140 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + RMS + + + + + + + 170 + 50 + 54 + 12 + + + + 输出使用 + + + + + + 10 + 90 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + um + + + + + + + 170 + 100 + 54 + 12 + + + + 工程单位 + + + + + + 10 + 40 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + + + + + + + + + + + + + 警报 + + + + + 10 + 60 + 71 + 16 + + + + 危险 + 高 + + + + + + 10 + 100 + 71 + 16 + + + + 警报 + 高 + + + + + + 10 + 140 + 71 + 16 + + + + 警报 + 低 + + + + + + 10 + 180 + 71 + 16 + + + + 危险 + 低 + + + + + + 90 + 30 + 31 + 31 + + + + 等级 + (um) + + + + + + 170 + 30 + 31 + 31 + + + + 回差 +(um) + + + + + + 230 + 30 + 31 + 31 + + + + 延时 +(um) + + + + + + 280 + 40 + 31 + 16 + + + + 使能 + + + + + + 340 + 40 + 31 + 16 + + + + 锁存 + + + + + + 80 + 60 + 51 + 20 + + + + + + + 150 + 60 + 51 + 20 + + + + + + + 220 + 60 + 51 + 20 + + + + + + + 220 + 100 + 51 + 20 + + + + + + + 80 + 100 + 51 + 20 + + + + + + + 150 + 100 + 51 + 20 + + + + + + + 220 + 140 + 51 + 20 + + + + + + + 150 + 180 + 51 + 20 + + + + + + + 80 + 140 + 51 + 20 + + + + + + + 220 + 180 + 51 + 20 + + + + + + + 80 + 180 + 51 + 20 + + + + + + + 150 + 140 + 51 + 20 + + + + + + + 290 + 60 + 16 + 16 + + + + + + + + + + 290 + 100 + 16 + 16 + + + + + + + + + + 290 + 140 + 16 + 16 + + + + + + + + + + 290 + 180 + 16 + 16 + + + + + + + + + + 350 + 100 + 16 + 16 + + + + + + + + + + 350 + 180 + 16 + 16 + + + + + + + + + + 350 + 60 + 16 + 16 + + + + + + + + + + 350 + 140 + 16 + 16 + + + + + + + + + + + + 分频段选择 + + + + + 50 + 90 + 71 + 16 + + + + 使能 + + + + + + 170 + 50 + 91 + 16 + + + + 频率开始(Hz) + + + + + + 320 + 50 + 91 + 16 + + + + 频率结束(Hz) + + + + + + 150 + 90 + 113 + 20 + + + + + + + 300 + 90 + 113 + 20 + + + + + + + 150 + 120 + 113 + 20 + + + + + + + 50 + 120 + 71 + 16 + + + + 使能 + + + + + + 300 + 120 + 113 + 20 + + + + + + + 50 + 150 + 71 + 16 + + + + 使能 + + + + + + 300 + 150 + 113 + 20 + + + + + + + 150 + 150 + 113 + 20 + + + + + + + 50 + 180 + 71 + 16 + + + + 使能 + + + + + + 300 + 180 + 113 + 20 + + + + + + + 150 + 180 + 113 + 20 + + + + + + + 50 + 210 + 71 + 16 + + + + 使能 + + + + + + 300 + 210 + 113 + 20 + + + + + + + 150 + 210 + 113 + 20 + + + + + + + 50 + 240 + 71 + 16 + + + + 使能 + + + + + + 300 + 240 + 113 + 20 + + + + + + + 150 + 240 + 113 + 20 + + + + + + + 50 + 270 + 71 + 16 + + + + 使能 + + + + + + 300 + 270 + 113 + 20 + + + + + + + 150 + 270 + 113 + 20 + + + + + + + 50 + 300 + 71 + 16 + + + + 使能 + + + + + + 300 + 300 + 113 + 20 + + + + + + + 150 + 300 + 113 + 20 + + + + + + + 50 + 330 + 71 + 16 + + + + 使能 + + + + + + 300 + 330 + 113 + 20 + + + + + + + 150 + 330 + 113 + 20 + + + + + + + 50 + 360 + 71 + 16 + + + + 使能 + + + + + + 300 + 360 + 113 + 20 + + + + + + + 150 + 360 + 113 + 20 + + + diff --git a/cardbase.h b/cardbase.h index 8523d52..9dee64d 100644 --- a/cardbase.h +++ b/cardbase.h @@ -24,12 +24,12 @@ class VariableBase { int id_; VibChannelType type_; Filter filter_[3]; - DirectImpl direct_; - GapRange gap_range; - XImpl x1_; - XImpl x2_; - RecorderOut recorder_out_; - Delay delay_; + General general; + AlarmDangerHigh danger_high; + AlarmAlertHigh alert_high; + AlarmDangerLow danger_low; + AlarmAlertLow alert_low; + FrequencybandOutput freband_output[10]; }; // 位移 diff --git a/data_config.h b/data_config.h index d8ecaef..09a54dc 100644 --- a/data_config.h +++ b/data_config.h @@ -149,6 +149,25 @@ typedef struct { bool checked; } Filter; +typedef struct{ + bool output_used; + QString engineering_unit; + QString rectifier_function; +}General; + +typedef struct{ + float level; + float hysteresis; + float delay; + bool enable; + bool latch; +}AlarmDangerHigh,AlarmAlertHigh,AlarmDangerLow,AlarmAlertLow ; + +typedef struct{ + bool enable; + int start; + int end; +}FrequencybandOutput ; //typedef struct { // Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass //} AllFilter; diff --git a/dc_outputs.cpp b/dc_outputs.cpp new file mode 100644 index 0000000..e292240 --- /dev/null +++ b/dc_outputs.cpp @@ -0,0 +1,14 @@ +#include "dc_outputs.h" +#include "ui_dc_outputs.h" + +DC_Outputs::DC_Outputs(QWidget *parent) : + QWidget(parent), + ui(new Ui::DC_Outputs) +{ + ui->setupUi(this); +} + +DC_Outputs::~DC_Outputs() +{ + delete ui; +} diff --git a/dc_outputs.h b/dc_outputs.h new file mode 100644 index 0000000..6f155f8 --- /dev/null +++ b/dc_outputs.h @@ -0,0 +1,22 @@ +#ifndef DC_OUTPUTS_H +#define DC_OUTPUTS_H + +#include + +namespace Ui { +class DC_Outputs; +} + +class DC_Outputs : public QWidget +{ + Q_OBJECT + +public: + explicit DC_Outputs(QWidget *parent = nullptr); + ~DC_Outputs(); + +private: + Ui::DC_Outputs *ui; +}; + +#endif // DC_OUTPUTS_H diff --git a/dc_outputs.ui b/dc_outputs.ui new file mode 100644 index 0000000..98711df --- /dev/null +++ b/dc_outputs.ui @@ -0,0 +1,293 @@ + + + DC_Outputs + + + + 0 + 0 + 727 + 450 + + + + Form + + + + + 60 + 40 + 150 + 25 + + + + + 150 + 25 + + + + + 150 + 25 + + + + + 通道1 输出1 + + + + + + + 50 + 150 + 54 + 12 + + + + 1 + + + + + + 50 + 200 + 54 + 12 + + + + 2 + + + + + + 50 + 240 + 54 + 12 + + + + 3 + + + + + + 50 + 280 + 54 + 12 + + + + 4 + + + + + + 160 + 100 + 101 + 16 + + + + IOC 直流 输出 + + + + + + 310 + 100 + 101 + 16 + + + + 最小值 + + + + + + 440 + 100 + 101 + 16 + + + + 最大值 + + + + + + 160 + 150 + 81 + 16 + + + + 通道1 输出1 + + + + + + 160 + 200 + 81 + 16 + + + + 通道1 输出2 + + + + + + 160 + 240 + 81 + 16 + + + + 未使用 + + + + + + 160 + 280 + 81 + 16 + + + + 未使用 + + + + + + 300 + 140 + 101 + 16 + + + + 0.0 m/s**2_RMSpk + + + + + + 300 + 200 + 101 + 16 + + + + 0.000 g_RMS + + + + + + 420 + 140 + 121 + 16 + + + + 200.0 m/s**2_RMSpk + + + + + + 420 + 200 + 101 + 16 + + + + 666.667 g_RMS + + + + + + 300 + 240 + 71 + 16 + + + + ----- ----- + + + + + + 300 + 280 + 71 + 16 + + + + ----- ----- + + + + + + 430 + 240 + 71 + 16 + + + + ----- ----- + + + + + + 430 + 280 + 71 + 16 + + + + ----- ----- + + + + + + diff --git a/mainwindow.ui b/mainwindow.ui index c2fe78a..843a923 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -254,7 +254,7 @@ - 触发配置 + 直流输出 true diff --git a/pressure_pulsation.ui b/pressure_pulsation.ui index c196bd0..5b943e5 100644 --- a/pressure_pulsation.ui +++ b/pressure_pulsation.ui @@ -168,7 +168,7 @@ - 1 + 0 diff --git a/radial_vibration.cpp b/radial_vibration.cpp index e82e43d..dd48fcd 100644 --- a/radial_vibration.cpp +++ b/radial_vibration.cpp @@ -37,27 +37,11 @@ void Radial::on_pushButton_cancel_clicked() { } void Radial::on_checkBox_1x_ampl_toggled(bool checked) { - if (checked) { - ui->comboBox_1x_value_range->setEnabled(true); - ui->doubleSpinBox_1x_ampl_clamp->setEnabled(true); - ui->doubleSpinBox_1x_phase_lag_clamp->setEnabled(true); - return; - } - ui->comboBox_1x_value_range->setEnabled(false); - ui->doubleSpinBox_1x_ampl_clamp->setEnabled(false); - ui->doubleSpinBox_1x_phase_lag_clamp->setEnabled(false); + } void Radial::on_checkBox_2x_ampl_toggled(bool checked) { - if (checked) { - ui->comboBox_2x_value_range->setEnabled(true); - ui->doubleSpinBox_2x_ampl_clamp->setEnabled(true); - ui->doubleSpinBox_2x_phase_lag_clamp->setEnabled(true); - return; - } - ui->comboBox_2x_value_range->setEnabled(false); - ui->doubleSpinBox_2x_ampl_clamp->setEnabled(false); - ui->doubleSpinBox_2x_phase_lag_clamp->setEnabled(false); + } void Radial::Init() { @@ -86,29 +70,7 @@ void Radial::Init() { ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked); ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low); ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high); - ui->comboBox_direct_value_range->setCurrentIndex(variable_ptr->direct_.full_scale_range); - ui->doubleSpinBox_direct_clamp->setValue(variable_ptr->direct_.clamp_value); -// ui->label_bias_voltage->setText(QString::number(variable_ptr->direct_.bias_voltage)); -// ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value); -// ui->comboBox_bias_volt_range->setCurrentIndex(); - ui->checkBox_1x_ampl->setChecked(variable_ptr->x1_.checked); - ui->comboBox_1x_value_range->setCurrentIndex(variable_ptr->x1_.full_scale_range); - ui->doubleSpinBox_1x_ampl_clamp->setValue(variable_ptr->x1_.clamp_value); - ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variable_ptr->x1_.phase_lag); - ui->checkBox_2x_ampl->setChecked(variable_ptr->x2_.checked); - ui->comboBox_2x_value_range->setCurrentIndex(variable_ptr->x2_.full_scale_range); - ui->doubleSpinBox_2x_ampl_clamp->setValue(variable_ptr->x2_.clamp_value); - ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variable_ptr->x2_.phase_lag); - ui->spinBox_alert->setValue(variable_ptr->delay_.alert); - ui->doubleSpinBox_danger->setValue(variable_ptr->delay_.danger); - ui->checkBox_100ms->setChecked(variable_ptr->delay_.active_100ms); - ui->checkBox_alert_latching->setChecked(variable_ptr->alert_latching_); - ui->checkBox_danger_latching->setChecked(variable_ptr->danger_latching_); - ui->comboBox_recorder_output->setCurrentIndex(variable_ptr->recorder_out_.recorder_output); - ui->checkBox_two_ma_clamp->setChecked(variable_ptr->recorder_out_.two_ma_clamp); - ui->doubleSpinBox_trip_multiply->setValue(variable_ptr->recorder_out_.trip_multiply); - ui->comboBox_comparision->setCurrentIndex(variable_ptr->recorder_out_.comparision); - ui->spinBox_comparision_percentage->setValue(variable_ptr->recorder_out_.percentage); + } void Radial::on_pushButton_confirm_clicked() { @@ -138,29 +100,7 @@ void Radial::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex(); - variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value(); - variable->direct_.custom = 0; // TODO: - variable->x1_.checked = ui->checkBox_1x_ampl->isChecked(); - variable->x1_.full_scale_range = ui->comboBox_1x_value_range->currentIndex(); - variable->x1_.clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value(); - variable->x1_.custom = 0; // TODO: - variable->x1_.phase_lag = ui->doubleSpinBox_1x_phase_lag_clamp->value(); - variable->x2_.checked = ui->checkBox_2x_ampl->isChecked(); - variable->x2_.full_scale_range = ui->comboBox_2x_value_range->currentIndex(); - variable->x2_.clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value(); - variable->x2_.custom = 0; // TODO: - variable->x2_.phase_lag = ui->doubleSpinBox_2x_phase_lag_clamp->value(); - variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex(); - variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked(); - variable->recorder_out_.trip_multiply = ui->doubleSpinBox_trip_multiply->value(); - variable->recorder_out_.comparision = ui->comboBox_comparision->currentIndex(); - variable->recorder_out_.percentage = ui->spinBox_comparision_percentage->value(); - variable->delay_.alert = ui->spinBox_alert->value(); - variable->delay_.danger = ui->doubleSpinBox_danger->value(); - variable->delay_.active_100ms = ui->checkBox_100ms->isChecked(); - variable->alert_latching_ = ui->checkBox_alert_latching->isChecked(); - variable->danger_latching_ = ui->checkBox_danger_latching->isChecked(); + ptr->variables_.push_back(variable); this->close(); return; @@ -175,29 +115,7 @@ void Radial::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex(); - variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value(); - variable->direct_.custom = 0; // TODO: - variable->x1_.checked = ui->checkBox_1x_ampl->isChecked(); - variable->x1_.full_scale_range = ui->comboBox_1x_value_range->currentIndex(); - variable->x1_.clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value(); - variable->x1_.custom = 0; // TODO: - variable->x1_.phase_lag = ui->doubleSpinBox_1x_phase_lag_clamp->value(); - variable->x2_.checked = ui->checkBox_2x_ampl->isChecked(); - variable->x2_.full_scale_range = ui->comboBox_2x_value_range->currentIndex(); - variable->x2_.clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value(); - variable->x2_.custom = 0; // TODO: - variable->x2_.phase_lag = ui->doubleSpinBox_2x_phase_lag_clamp->value(); - variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex(); - variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked(); - variable->recorder_out_.trip_multiply = ui->doubleSpinBox_trip_multiply->value(); - variable->recorder_out_.comparision = ui->comboBox_comparision->currentIndex(); - variable->recorder_out_.percentage = ui->spinBox_comparision_percentage->value(); - variable->delay_.alert = ui->spinBox_alert->value(); - variable->delay_.danger = ui->doubleSpinBox_danger->value(); - variable->delay_.active_100ms = ui->checkBox_100ms->isChecked(); - variable->alert_latching_ = ui->checkBox_alert_latching->isChecked(); - variable->danger_latching_ = ui->checkBox_danger_latching->isChecked(); + this->close(); } diff --git a/radial_vibration.ui b/radial_vibration.ui index ce15039..51513c9 100644 --- a/radial_vibration.ui +++ b/radial_vibration.ui @@ -27,7 +27,7 @@ - 传感器和滤波配置 + 滤波 @@ -275,657 +275,8 @@ - 特征值和警报配置 + 测量 - - - - 20 - 10 - 411 - 411 - - - - 特征值 - - - - - 20 - 50 - 54 - 12 - - - - 直接值 - - - - - - 20 - 80 - 81 - 16 - - - - 间隙 - - - - - - 20 - 110 - 81 - 16 - - - - 1倍频幅值 - - - - - - 20 - 180 - 81 - 16 - - - - 2倍频幅值 - - - - - - 141 - 31 - 48 - 16 - - - - 取值范围 - - - - - - 260 - 31 - 61 - 16 - - - - 默认值 - - - - - - 130 - 50 - 111 - 22 - - - - 4 - - - - 0-100 um - - - - - 0-150 um - - - - - 0-200 um - - - - - 0-400 um - - - - - 0-500 um - - - - - 自定义 - - - - - - - 260 - 50 - 62 - 22 - - - - 0 - - - 1000.000000000000000 - - - - - - 260 - 80 - 62 - 22 - - - - 1 - - - - - false - - - - 130 - 110 - 111 - 22 - - - - 4 - - - - 0-100 um - - - - - 0-150 um - - - - - 0-200 um - - - - - 0-400 um - - - - - 0-500 um - - - - - 自定义 - - - - - - false - - - - 260 - 110 - 62 - 22 - - - - 0 - - - 1000.000000000000000 - - - - - - 20 - 150 - 91 - 16 - - - - 1倍频相位 - - - - - - 20 - 210 - 91 - 16 - - - - 2倍频相位 - - - - - false - - - - 260 - 150 - 62 - 22 - - - - 0 - - - 360.000000000000000 - - - - - false - - - - 260 - 180 - 62 - 22 - - - - 0 - - - - - false - - - - 260 - 210 - 62 - 22 - - - - 0 - - - 360.000000000000000 - - - - - false - - - - 130 - 180 - 111 - 22 - - - - 4 - - - - 0-100 um - - - - - 0-150 um - - - - - 0-200 um - - - - - 0-400 um - - - - - 0-500 um - - - - - 自定义 - - - - - - - 130 - 80 - 111 - 22 - - - - 0 - - - - -24 Vdc - - - - - 0-100 um - - - - - 0-150 um - - - - - 0-200 um - - - - - 0-400 um - - - - - 0-500 um - - - - - 自定义 - - - - - - - 10 - 300 - 221 - 101 - - - - 延时 - - - - - 20 - 20 - 54 - 12 - - - - 告警 - - - - - - 20 - 50 - 54 - 12 - - - - 危险 - - - - - - 60 - 50 - 61 - 21 - - - - 1 - - - 1.000000000000000 - - - 99.900000000000006 - - - - - - 60 - 80 - 71 - 16 - - - - 100 ms - - - - - - 130 - 20 - 54 - 12 - - - - 1 - 60s - - - - - - 130 - 50 - 71 - 16 - - - - 1.0 - 60.0s - - - - - - 60 - 20 - 61 - 21 - - - - 1 - - - - - - - - 470 - 20 - 131 - 16 - - - - 告警锁定 - - - - - - 470 - 40 - 131 - 16 - - - - 危险锁定 - - - - - - 460 - 220 - 121 - 16 - - - - 倍增 - - - - - - 460 - 240 - 62 - 16 - - - - 1.000000000000000 - - - - - - 460 - 260 - 141 - 16 - - - - 1.00 - 3.00 (步进0.25) - - - - - - 460 - 130 - 54 - 12 - - - - 记录输出 - - - - - - 460 - 150 - 141 - 22 - - - - - - - - - - 直接幅值 - - - - - 1倍频幅值 - - - - - 2倍频幅值 - - - - - - - 460 - 180 - 91 - 16 - - - - 2 mA 默认值 - - - true - - - - - - 460 - 290 - 121 - 16 - - - - 比较 - - @@ -939,51 +290,994 @@ % - - - false - + - 460 - 310 - 141 - 22 + 10 + 40 + 621 + 321 - - - - - - - - 直接幅值 - - - - - 1倍频幅值 - - - - - 2倍频幅值 - - + + 0 + + + + 常规 + + + + + 170 + 150 + 54 + 12 + + + + 整流器 + + + + + + 10 + 140 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + RMS + + + + + + + 170 + 50 + 54 + 12 + + + + 输出使用 + + + + + + 10 + 90 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + um + + + + + + + 170 + 100 + 54 + 12 + + + + 工程单位 + + + + + + 10 + 40 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + + + + + + + + + + + + + 警报 + + + + + 10 + 60 + 71 + 16 + + + + 危险 + 高 + + + + + + 10 + 100 + 71 + 16 + + + + 警报 + 高 + + + + + + 10 + 140 + 71 + 16 + + + + 警报 + 低 + + + + + + 10 + 180 + 71 + 16 + + + + 危险 + 低 + + + + + + 90 + 30 + 31 + 31 + + + + 等级 + (um) + + + + + + 170 + 30 + 31 + 31 + + + + 回差 +(um) + + + + + + 230 + 30 + 31 + 31 + + + + 延时 +(um) + + + + + + 280 + 40 + 31 + 16 + + + + 使能 + + + + + + 340 + 40 + 31 + 16 + + + + 锁存 + + + + + + 80 + 60 + 51 + 20 + + + + + + + 150 + 60 + 51 + 20 + + + + + + + 220 + 60 + 51 + 20 + + + + + + + 220 + 100 + 51 + 20 + + + + + + + 80 + 100 + 51 + 20 + + + + + + + 150 + 100 + 51 + 20 + + + + + + + 220 + 140 + 51 + 20 + + + + + + + 150 + 180 + 51 + 20 + + + + + + + 80 + 140 + 51 + 20 + + + + + + + 220 + 180 + 51 + 20 + + + + + + + 80 + 180 + 51 + 20 + + + + + + + 150 + 140 + 51 + 20 + + + + + + + 290 + 60 + 16 + 16 + + + + + + + + + + 290 + 100 + 16 + 16 + + + + + + + + + + 290 + 140 + 16 + 16 + + + + + + + + + + 290 + 180 + 16 + 16 + + + + + + + + + + 350 + 100 + 16 + 16 + + + + + + + + + + 350 + 180 + 16 + 16 + + + + + + + + + + 350 + 60 + 16 + 16 + + + + + + + + + + 350 + 140 + 16 + 16 + + + + + + + - - - false - + + + + 间隙 + + - 460 - 350 - 61 - 22 + 20 + 40 + 621 + 321 + + 0 + + + + 常规 + + + + + 170 + 150 + 54 + 12 + + + + 整流器 + + + + + + 10 + 140 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + RMS + + + + + + + 170 + 50 + 54 + 12 + + + + 输出使用 + + + + + + 10 + 90 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + um + + + + + + + 170 + 100 + 54 + 12 + + + + 工程单位 + + + + + + 10 + 40 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + + + + + + + + + + + + + 警报 + + + + + 10 + 60 + 71 + 16 + + + + 危险 + 高 + + + + + + 10 + 100 + 71 + 16 + + + + 警报 + 高 + + + + + + 10 + 140 + 71 + 16 + + + + 警报 + 低 + + + + + + 10 + 180 + 71 + 16 + + + + 危险 + 低 + + + + + + 90 + 30 + 31 + 31 + + + + 等级 + (um) + + + + + + 170 + 30 + 31 + 31 + + + + 回差 +(um) + + + + + + 230 + 30 + 31 + 31 + + + + 延时 +(um) + + + + + + 280 + 40 + 31 + 16 + + + + 使能 + + + + + + 340 + 40 + 31 + 16 + + + + 锁存 + + + + + + 80 + 60 + 51 + 20 + + + + + + + 150 + 60 + 51 + 20 + + + + + + + 220 + 60 + 51 + 20 + + + + + + + 220 + 100 + 51 + 20 + + + + + + + 80 + 100 + 51 + 20 + + + + + + + 150 + 100 + 51 + 20 + + + + + + + 220 + 140 + 51 + 20 + + + + + + + 150 + 180 + 51 + 20 + + + + + + + 80 + 140 + 51 + 20 + + + + + + + 220 + 180 + 51 + 20 + + + + + + + 80 + 180 + 51 + 20 + + + + + + + 150 + 140 + 51 + 20 + + + + + + + 290 + 60 + 16 + 16 + + + + + + + + + + 290 + 100 + 16 + 16 + + + + + + + + + + 290 + 140 + 16 + 16 + + + + + + + + + + 290 + 180 + 16 + 16 + + + + + + + + + + 350 + 100 + 16 + 16 + + + + + + + + + + 350 + 180 + 16 + 16 + + + + + + + + + + 350 + 60 + 16 + 16 + + + + + + + + + + 350 + 140 + 16 + 16 + + + + + + + diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index 68302e8..48f81aa 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -25,14 +25,7 @@ Seismic_monitor::Seismic_monitor(int slot,int cardtype, QWidget *parent) : ui->comboBox_chan_type_2->setView(new QListView()); ui->comboBox_chan_type_3->setView(new QListView()); ui->comboBox_chan_type_4->setView(new QListView()); - ui->comboBox_transducer_name_1->setView(new QListView()); - ui->comboBox_transducer_name_2->setView(new QListView()); - ui->comboBox_transducer_name_3->setView(new QListView()); - ui->comboBox_transducer_name_4->setView(new QListView()); - ui->comboBox_sample_rate_1->setView(new QListView()); - ui->comboBox_sample_rate_2->setView(new QListView()); - ui->comboBox_sample_rate_3->setView(new QListView()); - ui->comboBox_sample_rate_4->setView(new QListView()); + slot_no = slot; car_type = static_cast(cardtype); QString slot_no_ = QString("%1").arg(slot_no); @@ -69,41 +62,33 @@ void Seismic_monitor::Init() { qDebug() << vib_data->base_config_[i].channel_type ; ui->comboBox_chan_type_1->setCurrentIndex(vib_data->base_config_[i].channel_type); ui->checkBox_standby_1->setChecked(vib_data->base_config_[i].standby); - ui->comboBox_transducer_name_1->setCurrentIndex(vib_data->base_config_[i].transducer_id); - ui->doubleSpinBox_scale_factor_1->setValue(vib_data->base_config_[i].scale_factor); + ui->checkBox_enable_1->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_1->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_1->setValue(vib_data->base_config_[i].normal_voltage_high); - ui->comboBox_sample_rate_1->setCurrentIndex(vib_data->base_config_[i].sampling_rate); - ui->checkBox_power_1->setChecked(vib_data->base_config_[i].power); + } else if (i + 1 == 2) { ui->comboBox_chan_type_2->setCurrentIndex(vib_data->base_config_[i].channel_type); - ui->comboBox_transducer_name_2->setCurrentIndex(vib_data->base_config_[i].transducer_id); - ui->doubleSpinBox_scale_factor_2->setValue(vib_data->base_config_[i].scale_factor); + ui->checkBox_enable_2->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_2->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_2->setValue(vib_data->base_config_[i].normal_voltage_high); - ui->comboBox_sample_rate_2->setCurrentIndex(vib_data->base_config_[i].sampling_rate); - ui->checkBox_power_2->setChecked(vib_data->base_config_[i].power); + } else if (i + 1 == 3) { ui->checkBox_standby_2->setChecked(vib_data->base_config_[i].standby); ui->comboBox_chan_type_3->setCurrentIndex(vib_data->base_config_[i].channel_type); - ui->comboBox_transducer_name_3->setCurrentIndex(vib_data->base_config_[i].transducer_id); - ui->doubleSpinBox_scale_factor_3->setValue(vib_data->base_config_[i].scale_factor); + ui->checkBox_enable_3->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_3->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_3->setValue(vib_data->base_config_[i].normal_voltage_high); - ui->comboBox_sample_rate_3->setCurrentIndex(vib_data->base_config_[i].sampling_rate); - ui->checkBox_power_3->setChecked(vib_data->base_config_[i].power); + } else if (i + 1 == 4) { ui->comboBox_chan_type_4->setCurrentIndex(vib_data->base_config_[i].channel_type); - ui->comboBox_transducer_name_4->setCurrentIndex(vib_data->base_config_[i].transducer_id); - ui->doubleSpinBox_scale_factor_4->setValue(vib_data->base_config_[i].scale_factor); + ui->checkBox_enable_4->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_4->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_4->setValue(vib_data->base_config_[i].normal_voltage_high); - ui->comboBox_sample_rate_4->setCurrentIndex(vib_data->base_config_[i].sampling_rate); - ui->checkBox_power_4->setChecked(vib_data->base_config_[i].power); + } } } @@ -115,12 +100,9 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].active = ui->checkBox_enable_1->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_1->currentIndex(); - vib_data->base_config_[var].transducer_id = ui->comboBox_transducer_name_1->currentIndex(); - vib_data->base_config_[var].scale_factor = ui->doubleSpinBox_scale_factor_1->value(); - vib_data->base_config_[var].sampling_rate = ui->comboBox_sample_rate_1->currentIndex(); + vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_1->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_1->value(); - vib_data->base_config_[var].power = ui->checkBox_power_1->isChecked(); vib_data->base_config_[var].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); vib_data->base_config_[var].keyphase = ui->checkBox_keyphase->isChecked(); vib_data->base_config_[var].keyphase_slot = ui->comboBox_keyphase_slot->currentText().toInt(); @@ -130,12 +112,10 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].active = ui->checkBox_enable_2->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_2->currentIndex(); - vib_data->base_config_[var].transducer_id = ui->comboBox_transducer_name_2->currentIndex(); - vib_data->base_config_[var].scale_factor = ui->doubleSpinBox_scale_factor_2->value(); - vib_data->base_config_[var].sampling_rate = ui->comboBox_sample_rate_2->currentIndex(); + vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_2->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_2->value(); - vib_data->base_config_[var].power = ui->checkBox_power_2->isChecked(); + vib_data->base_config_[var].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); vib_data->base_config_[var].keyphase = ui->checkBox_keyphase_2->isChecked(); vib_data->base_config_[var].keyphase_slot = ui->comboBox_keyphase_slot_2->currentText().toInt(); @@ -145,12 +125,10 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].active = ui->checkBox_enable_3->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_3->currentIndex(); - vib_data->base_config_[var].transducer_id = ui->comboBox_transducer_name_3->currentIndex(); - vib_data->base_config_[var].scale_factor = ui->doubleSpinBox_scale_factor_3->value(); - vib_data->base_config_[var].sampling_rate = ui->comboBox_sample_rate_3->currentIndex(); + vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_3->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_3->value(); - vib_data->base_config_[var].power = ui->checkBox_power_3->isChecked(); + vib_data->base_config_[var].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); vib_data->base_config_[var].keyphase = ui->checkBox_keyphase_3->isChecked(); vib_data->base_config_[var].keyphase_slot = ui->comboBox_keyphase_slot_3->currentText().toInt(); @@ -160,12 +138,8 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].active = ui->checkBox_enable_4->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_4->currentIndex(); - vib_data->base_config_[var].transducer_id = ui->comboBox_transducer_name_4->currentIndex(); - vib_data->base_config_[var].scale_factor = ui->doubleSpinBox_scale_factor_4->value(); - vib_data->base_config_[var].sampling_rate = ui->comboBox_sample_rate_4->currentIndex(); vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_4->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_4->value(); - vib_data->base_config_[var].power = ui->checkBox_power_4->isChecked(); vib_data->base_config_[var].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); vib_data->base_config_[var].keyphase = ui->checkBox_keyphase_4->isChecked(); vib_data->base_config_[var].keyphase_slot = ui->comboBox_keyphase_slot_4->currentText().toInt(); @@ -313,19 +287,19 @@ void Seismic_monitor::on_pushButton_config_4_clicked() { void Seismic_monitor::on_comboBox_chan_type_1_currentTextChanged(const QString &arg1) { switch (ui->comboBox_chan_type_1->currentIndex()) { case kVibRadial: - ui->label_unit_1->setText("mV / mm"); + EnableKeyphase(); break; case kVibAcc: - ui->label_unit_1->setText("mV / m/s^2"); + EnableKeyphase(); break; case kVibVelocity: - ui->label_unit_1->setText("mV / mm/s"); + EnableKeyphase(); break; case kVibThrust: - ui->label_unit_1->setText("mV / mil"); + DisableKeyphase(); break; case kVibPressurePulsation: @@ -337,19 +311,15 @@ void Seismic_monitor::on_comboBox_chan_type_1_currentTextChanged(const QString & void Seismic_monitor::on_comboBox_chan_type_2_currentTextChanged(const QString &arg1) { switch (ui->comboBox_chan_type_2->currentIndex()) { case kVibRadial: - ui->label_unit_2->setText("mV / mm"); EnableKeyphase(); break; case kVibAcc: - ui->label_unit_2->setText("mV / m/s^2"); EnableKeyphase2(); break; case kVibVelocity: - ui->label_unit_2->setText("mV / mm/s"); EnableKeyphase2(); break; case kVibThrust: - ui->label_unit_2->setText("mV / mil"); DisableKeyphase2(); break; case kVibPressurePulsation: @@ -361,19 +331,15 @@ void Seismic_monitor::on_comboBox_chan_type_2_currentTextChanged(const QString & void Seismic_monitor::on_comboBox_chan_type_3_currentTextChanged(const QString &arg1) { switch (ui->comboBox_chan_type_3->currentIndex()) { case kVibRadial: - ui->label_unit_3->setText("mV / mm"); EnableKeyphase(); break; case kVibAcc: - ui->label_unit_3->setText("mV / m/s^2"); EnableKeyphase3(); break; case kVibVelocity: - ui->label_unit_3->setText("mV / mm/s"); EnableKeyphase3(); break; case kVibThrust: - ui->label_unit_3->setText("mV / mil"); DisableKeyphase3(); break; case kVibPressurePulsation: @@ -385,19 +351,15 @@ void Seismic_monitor::on_comboBox_chan_type_3_currentTextChanged(const QString & void Seismic_monitor::on_comboBox_chan_type_4_currentTextChanged(const QString &arg1) { switch (ui->comboBox_chan_type_4->currentIndex()) { case kVibRadial: - ui->label_unit_4->setText("mV / mm"); EnableKeyphase4(); break; case kVibAcc: - ui->label_unit_4->setText("mV / m/s^2"); EnableKeyphase4(); break; case kVibVelocity: - ui->label_unit_4->setText("mV / mm/s"); EnableKeyphase4(); break; case kVibThrust: - ui->label_unit_4->setText("mV / mil"); DisableKeyphase4(); break; case kVibPressurePulsation: @@ -411,35 +373,19 @@ void Seismic_monitor::on_pushButton_cancel_clicked() { } void Seismic_monitor::on_comboBox_transducer_name_1_currentTextChanged(const QString &arg1) { - for (int var = 0; var < vec_transducer.size(); ++var) { - if (ui->comboBox_transducer_name_1->currentText() == vec_transducer[var].transducer_name) { - ui->doubleSpinBox_scale_factor_1->setValue(vec_transducer[var].scale_factor); - } - } + } void Seismic_monitor::on_comboBox_transducer_name_2_currentTextChanged(const QString &arg1) { - for (int var = 0; var < vec_transducer.size(); ++var) { - if (ui->comboBox_transducer_name_2->currentText() == vec_transducer[var].transducer_name) { - ui->doubleSpinBox_scale_factor_2->setValue(vec_transducer[var].scale_factor); - } - } + } void Seismic_monitor::on_comboBox_transducer_name_3_currentTextChanged(const QString &arg1) { - for (int var = 0; var < vec_transducer.size(); ++var) { - if (ui->comboBox_transducer_name_3->currentText() == vec_transducer[var].transducer_name) { - ui->doubleSpinBox_scale_factor_3->setValue(vec_transducer[var].scale_factor); - } - } + } void Seismic_monitor::on_comboBox_transducer_name_4_currentTextChanged(const QString &arg1) { - for (int var = 0; var < vec_transducer.size(); ++var) { - if (ui->comboBox_transducer_name_4->currentText() == vec_transducer[var].transducer_name) { - ui->doubleSpinBox_scale_factor_4->setValue(vec_transducer[var].scale_factor); - } - } + } void Seismic_monitor::EnableKeyphase(){ ui->checkBox_keyphase->setCheckable(true); diff --git a/seismic_monitor.ui b/seismic_monitor.ui index c67cddc..e299192 100644 --- a/seismic_monitor.ui +++ b/seismic_monitor.ui @@ -7,7 +7,7 @@ 0 0 862 - 580 + 632 @@ -324,8 +324,8 @@ 10 50 - 333 - 328 + 311 + 321 @@ -347,296 +347,295 @@ 通道1 - + - + - + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 类 型: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + 加速度 + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - - 径向位移 - - - - - 加速度 - - - - - 速度 - - - - - 轴向位移 - - - - - 动态压力脉动 - - - + + 速度 + - - - Qt::Horizontal - - - - 40 - 20 - - - + + 压力脉动 + - + + + 轴振 + + + + + 轴位移 + + + + + DC + + + - + + + + 90 + 0 + + + + 传感器类型 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 传感器名称: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + g + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - xxx - - - - xxx - - - - - yyy - - - + + m/s^2 + - - - Qt::Horizontal - - - - 20 - 20 - - - + + mm/s + - + + + um + + + + + mm + + + + + mbar + + + + + bar + + + - - - - - - 90 - 0 - - - - 灵敏度: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 10000.000000000000000 - - - 8.000000000000000 - - - - - - - v/mm - - - - + + + + 90 + 0 + + + + 传感器灵敏度单位 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + - + + + + 90 + 0 + + + + 信号灵敏度(mV/um) + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 采样率: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - - 16 k - - - - - 32 k - - - - - 64 k - - - - - 128 k - - - + + + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + - - - - - Qt::Horizontal - - - - 90 - 20 - - - - - - - - Qt::LeftToRight - - - 是否供电 - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 90 + 0 + + + + 传感器IEPE供电 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + 1 + + + -100.000000000000000 + + + 25.000000000000000 + + + + + + + 电压上限(V) + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + 1 + + + -100.000000000000000 + + + -25.000000000000000 + + + + + + + 电压下限(V) + + @@ -777,418 +776,301 @@ - - - - - 220 - 80 - - - - 电压范围 - - - - - - - - - 80 - 0 - - - - 上限: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - -100.000000000000000 - - - 25.000000000000000 - - - - - - - V - - - - - - - - - - - - 80 - 0 - - - - 下限: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - -100.000000000000000 - - - -25.000000000000000 - - - - - - - V - - - - - - - - 通道2 - + - + - + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 类 型: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + 加速度 + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - - 径向位移 - - - - - 加速度 - - - - - 速度 - - - - - 轴向位移 - - - - - 动态压力脉动 - - - + + 速度 + - - - Qt::Horizontal - - - - 40 - 20 - - - + + 压力脉动 + - + + + 轴振 + + + + + 轴位移 + + + + + DC + + + - + + + + 90 + 0 + + + + 传感器类型 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 传感器名称: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + g + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - - xxx - - - - - yyy - - - + + m/s^2 + - - - Qt::Horizontal - - - - 20 - 20 - - - + + mm/s + - + + + um + + + + + mm + + + + + mbar + + + + + bar + + + - - - - - - 90 - 0 - - - - 灵敏度: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 10000.000000000000000 - - - 8.000000000000000 - - - - - - - v/mm - - - - + + + + 90 + 0 + + + + 传感器灵敏度单位 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + - + + + + 90 + 0 + + + + 信号灵敏度(mV/um) + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 采样率: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - - 16 k - - - - - 32 k - - - - - 64 k - - - - - 128 k - - - + + + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + - - - - - Qt::Horizontal - - - - 90 - 20 - - - - - - - - Qt::LeftToRight - - - 是否供电 - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 90 + 0 + + + + 传感器IEPE供电 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + 1 + + + -100.000000000000000 + + + 25.000000000000000 + + + + + + + 电压上限(V) + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + 1 + + + -100.000000000000000 + + + -25.000000000000000 + + + + + + + 电压下限(V) + + @@ -1329,139 +1211,78 @@ - - - - - 220 - 80 - - - - 电压范围 - - - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - 上限: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - -100.000000000000000 - - - 25.000000000000000 - - - - - - - V - - - - - - - - - - - - 80 - 0 - - - - - 80 - 16777215 - - - - 下限: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - -100.000000000000000 - - - -25.000000000000000 - - - - - - - V - - - - - - - - + + + 通道1-通道2 + + + + + 20 + 50 + 180 + 22 + + + + + 180 + 0 + + + + + 120 + 16777215 + + + + + No Processing + + + + + (SMAX) Smax + + + + + (DHE) Differential Housing Expansion + + + + + (RST) Relative Shaft Expansion (Shaft taper) + + + + + (RSC) Relative Shaft Expansion (Shaft collar) + + + + + (DMF) Dual Mathematical Function + + + + + + + 220 + 60 + 54 + 12 + + + + 函数 + + + @@ -1631,8 +1452,8 @@ 10 50 - 333 - 328 + 321 + 321 @@ -1648,296 +1469,301 @@ - 0 + 1 通道3 - + - + - + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 类 型: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + 加速度 + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - - 径向位移 - - - - - 加速度 - - - - - 速度 - - - - - 轴向位移 - - - - - 动态压力脉动 - - - + + 速度 + - - - Qt::Horizontal - - - - 40 - 20 - - - + + 压力脉动 + - + + + 轴振 + + + + + 轴位移 + + + + + DC + + + - + + + + 90 + 0 + + + + 传感器类型 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 传感器名称: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + g + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - - xxx - - - - - yyy - - - + + m/s^2 + - - - Qt::Horizontal - - - - 20 - 20 - - - + + mm/s + - + + + um + + + + + mm + + + + + mbar + + + + + bar + + + - - - - - - 90 - 0 - - - - 灵敏度: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 10000.000000000000000 - - - 8.000000000000000 - - - - - - - v/mm - - - - + + + + 90 + 0 + + + + 传感器灵敏度单位 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + - + + + + 90 + 0 + + + + 信号灵敏度(mV/um) + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 采样率: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - - 16 k - - - - - 32 k - - - - - 64 k - - - - - 128 k - - - + + + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + - - - - - Qt::Horizontal - - - - 90 - 20 - - - - - - - - Qt::LeftToRight - - - 是否供电 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 90 + 0 + + + + 传感器IEPE供电 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + 1 + + + -100.000000000000000 + + + 25.000000000000000 + + + + + + + 电压上限(V) + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + 1 + + + -100.000000000000000 + + + -25.000000000000000 + + + + + + + 电压下限(V) + + @@ -2078,415 +1904,301 @@ - - - - - 220 - 80 - - - - 电压范围 - - - - - - - - - 80 - 0 - - - - 上限: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - -100.000000000000000 - - - 25.000000000000000 - - - - - - - V - - - - - - - - - - - - 80 - 0 - - - - 下限: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - -100.000000000000000 - - - -25.000000000000000 - - - - - - - V - - - - - - - - 通道4 - + - + - + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 类 型: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + 加速度 + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - - 径向位移 - - - - - 加速度 - - - - - 速度 - - - - - 轴向位移 - - - - - 动态压力脉动 - - - + + 速度 + - - - Qt::Horizontal - - - - 40 - 20 - - - + + 压力脉动 + - + + + 轴振 + + + + + 轴位移 + + + + + DC + + + - + + + + 90 + 0 + + + + 传感器类型 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 传感器名称: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + g + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - - xxx - - - - - yyy - - - + + m/s^2 + - - - Qt::Horizontal - - - - 20 - 20 - - - + + mm/s + - + + + um + + + + + mm + + + + + mbar + + + + + bar + + + - - - - - - 90 - 0 - - - - 灵敏度: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 10000.000000000000000 - - - 8.000000000000000 - - - - - - - v/mm - - - - + + + + 90 + 0 + + + + 传感器灵敏度单位 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + - + + + + 90 + 0 + + + + 信号灵敏度(mV/um) + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + - - - - 90 - 0 - - - - 采样率: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - - 16 k - - - - - 32 k - - - - - 64 k - - - - - 128 k - - - + + + - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + - - - - - Qt::Horizontal - - - - 90 - 20 - - - - - - - - Qt::LeftToRight - - - 是否供电 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + 90 + 0 + + + + 传感器IEPE供电 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + 1 + + + -100.000000000000000 + + + 25.000000000000000 + + + + + + + 电压上限(V) + + + + + + + + + + + + 120 + 0 + + + + + 120 + 16777215 + + + + 1 + + + -100.000000000000000 + + + -25.000000000000000 + + + + + + + 电压下限(V) + + @@ -2627,127 +2339,78 @@ - - - - - 220 - 80 - - - - 电压范围 - - - - - - - - - 80 - 0 - - - - 上限: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - -100.000000000000000 - - - 25.000000000000000 - - - - - - - V - - - - - - - - - - - - 80 - 0 - - - - 下限: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 120 - 0 - - - - - 120 - 16777215 - - - - 1 - - - -100.000000000000000 - - - -25.000000000000000 - - - - - - - V - - - - - - - - + + + 通道3-通道4 + + + + + 20 + 50 + 180 + 22 + + + + + 180 + 0 + + + + + 120 + 16777215 + + + + + No Processing + + + + + (SMAX) Smax + + + + + (DHE) Differential Housing Expansion + + + + + (RST) Relative Shaft Expansion (Shaft taper) + + + + + (RSC) Relative Shaft Expansion (Shaft collar) + + + + + (DMF) Dual Mathematical Function + + + + + + + 220 + 60 + 54 + 12 + + + + 函数 + + + diff --git a/trust.cpp b/trust.cpp index 8d7faed..f4c192e 100644 --- a/trust.cpp +++ b/trust.cpp @@ -59,19 +59,7 @@ void Trust::Init() { ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked); ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low); ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high); - ui->comboBox_direct_value_range->setCurrentIndex(variable_ptr->direct_.full_scale_range); - ui->comboBox_gap_range->setCurrentIndex(variable_ptr->gap_range.full_scale_range); - ui->doubleSpinBox_direct_clamp->setValue(variable_ptr->direct_.clamp_value); - // ui->label_bias_voltage->setText(QString::number(variable_ptr->direct_.bias_voltage)); - // ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value); - // ui->comboBox_bias_volt_range->setCurrentIndex(); - ui->spinBox_alert->setValue(variable_ptr->delay_.alert); - ui->doubleSpinBox_danger->setValue(variable_ptr->delay_.danger); - ui->checkBox_100ms->setChecked(variable_ptr->delay_.active_100ms); - ui->checkBox_alert_latching->setChecked(variable_ptr->alert_latching_); - ui->checkBox_danger_latching->setChecked(variable_ptr->danger_latching_); - ui->comboBox_recorder_output->setCurrentIndex(variable_ptr->recorder_out_.recorder_output); - ui->checkBox_two_ma_clamp->setChecked(variable_ptr->recorder_out_.two_ma_clamp); + ui->doubleSpinBox_zero_position->setValue(variable_ptr->zero_position.value); ui->checkBox_negation->setChecked(variable_ptr->zero_position.negation); } @@ -103,17 +91,7 @@ void Trust::on_pushButton_confirm_clicked() variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex(); - variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value(); - variable->direct_.custom = 0; // TODO: - variable->gap_range.full_scale_range = ui->comboBox_gap_range->currentIndex(); - variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex(); - variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked(); - variable->delay_.alert = ui->spinBox_alert->value(); - variable->delay_.danger = ui->doubleSpinBox_danger->value(); - variable->delay_.active_100ms = ui->checkBox_100ms->isChecked(); - variable->alert_latching_ = ui->checkBox_alert_latching->isChecked(); - variable->danger_latching_ = ui->checkBox_danger_latching->isChecked(); + variable->zero_position.value = ui->doubleSpinBox_zero_position->value(); variable->zero_position.negation = ui->checkBox_negation->isChecked(); ptr->variables_.push_back(variable); @@ -130,18 +108,7 @@ void Trust::on_pushButton_confirm_clicked() variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex(); - variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value(); - variable->direct_.custom = 0; // TODO: - variable->gap_range.full_scale_range = ui->comboBox_gap_range->currentIndex(); - variable->gap_range.custom = 0; - variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex(); - variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked(); - variable->delay_.alert = ui->spinBox_alert->value(); - variable->delay_.danger = ui->doubleSpinBox_danger->value(); - variable->delay_.active_100ms = ui->checkBox_100ms->isChecked(); - variable->alert_latching_ = ui->checkBox_alert_latching->isChecked(); - variable->danger_latching_ = ui->checkBox_danger_latching->isChecked(); + variable->zero_position.value = ui->doubleSpinBox_zero_position->value(); variable->zero_position.negation = ui->checkBox_negation->isChecked(); this->close(); diff --git a/trust.ui b/trust.ui index a087018..5734bec 100644 --- a/trust.ui +++ b/trust.ui @@ -7,7 +7,7 @@ 0 0 691 - 505 + 525 @@ -19,7 +19,7 @@ 10 60 651 - 381 + 391 @@ -27,7 +27,7 @@ - 传感器和滤波配置 + 滤波 @@ -273,429 +273,919 @@ - + - 特征值和警报配置 + 间隙 - + - 20 - 10 - 411 + 10 + 20 + 621 321 - - 特征值 + + 1 - - - - 20 - 50 - 54 - 12 - - - - 直接值 - - - - - - 20 - 80 - 81 - 16 - - - - 间隙 - - - - - - 141 - 31 - 48 - 16 - - - - 取值范围 - - - - - - 260 - 31 - 61 - 16 - - - - 默认值 - - - - - - 130 - 50 - 111 - 22 - - - - 0 - - - - 25-0-25 mil - - - - - 30-0-30 mil - - - - - 40-0-40 mil - - - - - 0.5-0-0.5 mm - - - - - 1.0-0-1.0 mm - - - - - 自定义 - - - - - - - 260 - 50 - 62 - 22 - - - - 0 - - - 1000.000000000000000 - - - - - - 260 - 80 - 62 - 22 - - - - 1 - - - - - - 130 - 80 - 111 - 22 - - - - 0 - - - - -24 Vdc - - - - - 自定义 - - - - - - - 10 - 190 - 201 - 101 - - - - 延时 - - + + + 常规 + + - 20 - 20 + 170 + 150 54 12 - 告警 + 整流器 - - - - 20 - 50 - 54 - 12 - - - - 危险 - - - - - - 60 - 50 - 61 - 21 - - - - 1 - - - 1.000000000000000 - - - 99.900000000000006 - - - - - - 60 - 80 - 71 - 16 - - - - 100 ms - - - - - - 130 - 20 - 54 - 12 - - - - 1 - 60s - - - - - - 130 - 50 - 71 - 16 - - - - 1.0 - 60.0s - - - - - - 60 - 20 - 61 - 21 - - - - 1 - - - - - - - 220 - 190 - 171 - 101 - - - - 初始位置 - - + 10 - 30 - 61 - 21 + 140 + 125 + 25 - - 2 + + + 125 + 25 + - - -50.000000000000000 + + + 125 + 25 + - - 50.000000000000000 + + + RMS + + + + + + + 170 + 50 + 54 + 12 + + + + 输出使用 - + + + + 10 + 90 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + um + + + + + + + 170 + 100 + 54 + 12 + + + + 工程单位 + + + + + + 10 + 40 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + + + + + + + + + + + + + 10 + 180 + 171 + 101 + + + + 初始位置 + + + + + 10 + 30 + 61 + 21 + + + + 2 + + + -50.000000000000000 + + + 50.000000000000000 + + + + + + 80 + 30 + 91 + 16 + + + + -50 - 50 V + + + + + + 10 + 70 + 71 + 16 + + + + 取反 + + + + + + + 警报 + + + + + 10 + 60 + 71 + 16 + + + + 危险 + 高 + + + + + + 10 + 100 + 71 + 16 + + + + 警报 + 高 + + + + + + 10 + 140 + 71 + 16 + + + + 警报 + 低 + + + + + + 10 + 180 + 71 + 16 + + + + 危险 + 低 + + + + + + 90 + 30 + 31 + 31 + + + + 等级 + (um) + + + + + + 170 + 30 + 31 + 31 + + + + 回差 +(um) + + + + + + 230 + 30 + 31 + 31 + + + + 延时 +(um) + + + + + + 280 + 40 + 31 + 16 + + + + 使能 + + + + + + 340 + 40 + 31 + 16 + + + + 锁存 + + + 80 - 30 - 91 - 16 + 60 + 51 + 20 - - -50 - 50 V - - + - 10 - 70 - 71 + 150 + 60 + 51 + 20 + + + + + + + 220 + 60 + 51 + 20 + + + + + + + 220 + 100 + 51 + 20 + + + + + + + 80 + 100 + 51 + 20 + + + + + + + 150 + 100 + 51 + 20 + + + + + + + 220 + 140 + 51 + 20 + + + + + + + 150 + 180 + 51 + 20 + + + + + + + 80 + 140 + 51 + 20 + + + + + + + 220 + 180 + 51 + 20 + + + + + + + 80 + 180 + 51 + 20 + + + + + + + 150 + 140 + 51 + 20 + + + + + + + 290 + 60 + 16 16 - 取反 + + + + + + + 290 + 100 + 16 + 16 + + + + + + + + + + 290 + 140 + 16 + 16 + + + + + + + + + + 290 + 180 + 16 + 16 + + + + + + + + + + 350 + 100 + 16 + 16 + + + + + + + + + + 350 + 180 + 16 + 16 + + + + + + + + + + 350 + 60 + 16 + 16 + + + + + + + + + + 350 + 140 + 16 + 16 + + + + - + + + + 分频段选择 + + - 470 + 120 + 210 + 113 + 20 + + + + + + + 20 + 90 + 71 + 16 + + + + 使能 + + + + + + 270 + 270 + 113 + 20 + + + + + + + 20 + 300 + 71 + 16 + + + + 使能 + + + + + + 20 + 60 + 71 + 16 + + + + 使能 + + + + + + 140 20 - 131 - 16 - - - - 告警锁定 - - - - - - 470 - 40 - 131 - 16 - - - - 危险锁定 - - - - - - 460 - 130 - 54 - 12 - - - - 记录输出 - - - - - - 460 - 150 - 141 - 22 - - - - - - - - - - 直接幅值 - - - - - 间隙 - - - - - - - 460 - 180 91 16 - 2 mA 默认值 - - - true + 频率开始(Hz) - + - 470 - 60 - 181 + 270 + 300 + 113 + 20 + + + + + + + 270 + 240 + 113 + 20 + + + + + + + 20 + 330 + 71 16 - Timed OK channel Defeat + 使能 + + + + + + 120 + 60 + 113 + 20 + + + + + + + 20 + 270 + 71 + 16 + + + + 使能 + + + + + + 120 + 270 + 113 + 20 + + + + + + + 270 + 60 + 113 + 20 + + + + + + + 120 + 150 + 113 + 20 + + + + + + + 120 + 120 + 113 + 20 + + + + + + + 20 + 150 + 71 + 16 + + + + 使能 + + + + + + 290 + 20 + 91 + 16 + + + + 频率结束(Hz) + + + + + + 270 + 180 + 113 + 20 + + + + + + + 120 + 330 + 113 + 20 + + + + + + + 270 + 120 + 113 + 20 + + + + + + + 270 + 210 + 113 + 20 + + + + + + + 20 + 120 + 71 + 16 + + + + 使能 + + + + + + 120 + 180 + 113 + 20 + + + + + + + 270 + 150 + 113 + 20 + + + + + + + 120 + 240 + 113 + 20 + + + + + + + 120 + 300 + 113 + 20 + + + + + + + 270 + 90 + 113 + 20 + + + + + + + 20 + 240 + 71 + 16 + + + + 使能 + + + + + + 120 + 90 + 113 + 20 + + + + + + + 20 + 180 + 71 + 16 + + + + 使能 + + + + + + 20 + 210 + 71 + 16 + + + + 使能 + + + + + + 270 + 330 + 113 + 20 + @@ -737,7 +1227,7 @@ 20 - 450 + 470 632 37 diff --git a/velocity.cpp b/velocity.cpp index 45ea98b..aa54834 100644 --- a/velocity.cpp +++ b/velocity.cpp @@ -34,60 +34,12 @@ Velocity::~Velocity() { void Velocity::on_checkBox_rms_toggled(bool checked) { // TODO: 自定义的回调 - if (checked) { - ui->checkBox_integrate->setEnabled(false); - QStringList items = {"0-10 mm/s rms", "0-20 mm/s rms", "0-50 mm/s rms", "自定义"}; - ui->comboBox_direct_value_range->clear(); - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(1); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(1); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(1); - return; - } - ui->checkBox_integrate->setEnabled(true); - ui->comboBox_direct_value_range->clear(); - QStringList items = {"0-10 mm/s pk", "0-20 mm/s pk", "0-50 mm/s pk", "自定义"}; - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(1); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(1); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(1); + } void Velocity::on_checkBox_integrate_toggled(bool checked) { // TODO: 自定义的回调 - if (checked) { - ui->checkBox_rms->setEnabled(false); - ui->comboBox_direct_value_range->clear(); - QStringList items = {"0-100 um pp", "0-200 um pp", "0-500 um pp", "自定义"}; - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(1); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(1); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(1); - return; - } - ui->checkBox_rms->setEnabled(true); - ui->comboBox_direct_value_range->clear(); - QStringList items = {"0-10 mm/s pk", "0-20 mm/s pk", "0-50 mm/s pk", "自定义"}; - ui->comboBox_direct_value_range->addItems(items); - ui->comboBox_direct_value_range->setCurrentIndex(1); - ui->comboBox_1x_value_range->clear(); - ui->comboBox_1x_value_range->addItems(items); - ui->comboBox_1x_value_range->setCurrentIndex(1); - ui->comboBox_2x_value_range->clear(); - ui->comboBox_2x_value_range->addItems(items); - ui->comboBox_2x_value_range->setCurrentIndex(1); + } void Velocity::on_pushButton_cancel_clicked() { @@ -95,27 +47,11 @@ void Velocity::on_pushButton_cancel_clicked() { } void Velocity::on_checkBox_1x_ampl_toggled(bool checked) { - if (checked) { - ui->comboBox_1x_value_range->setEnabled(true); - ui->doubleSpinBox_1x_ampl_clamp->setEnabled(true); - ui->doubleSpinBox_1x_phase_lag_clamp->setEnabled(true); - return; - } - ui->comboBox_1x_value_range->setEnabled(false); - ui->doubleSpinBox_1x_ampl_clamp->setEnabled(false); - ui->doubleSpinBox_1x_phase_lag_clamp->setEnabled(false); + } void Velocity::on_checkBox_2x_ampl_toggled(bool checked) { - if (checked) { - ui->comboBox_2x_value_range->setEnabled(true); - ui->doubleSpinBox_2x_ampl_clamp->setEnabled(true); - ui->doubleSpinBox_2x_phase_lag_clamp->setEnabled(true); - return; - } - ui->comboBox_2x_value_range->setEnabled(false); - ui->doubleSpinBox_2x_ampl_clamp->setEnabled(false); - ui->doubleSpinBox_2x_phase_lag_clamp->setEnabled(false); + } void Velocity::Init() { @@ -144,32 +80,7 @@ void Velocity::Init() { ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked); ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low); ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high); - ui->comboBox_direct_value_range->setCurrentIndex(variable_ptr->direct_.full_scale_range); - ui->doubleSpinBox_direct_clamp->setValue(variable_ptr->direct_.clamp_value); -// ui->label_bias_voltage->setText(QString::number(variable_ptr->direct_.bias_voltage)); -// ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value); -// ui->comboBox_bias_volt_range->setCurrentIndex(); - ui->checkBox_1x_ampl->setChecked(variable_ptr->x1_.checked); - ui->comboBox_1x_value_range->setCurrentIndex(variable_ptr->x1_.full_scale_range); - ui->doubleSpinBox_1x_ampl_clamp->setValue(variable_ptr->x1_.clamp_value); - ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variable_ptr->x1_.phase_lag); - ui->checkBox_2x_ampl->setChecked(variable_ptr->x2_.checked); - ui->comboBox_2x_value_range->setCurrentIndex(variable_ptr->x2_.full_scale_range); - ui->doubleSpinBox_2x_ampl_clamp->setValue(variable_ptr->x2_.clamp_value); - ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variable_ptr->x2_.phase_lag); - ui->spinBox_alert->setValue(variable_ptr->delay_.alert); - ui->doubleSpinBox_danger->setValue(variable_ptr->delay_.danger); - ui->checkBox_100ms->setChecked(variable_ptr->delay_.active_100ms); - ui->checkBox_rms->setChecked(variable_ptr->rms_active_); - ui->checkBox_integrate->setChecked(variable_ptr->integrate_active_); - ui->checkBox_alert_latching->setChecked(variable_ptr->alert_latching_); - ui->checkBox_danger_latching->setChecked(variable_ptr->danger_latching_); - ui->checkBox_timed_ok->setChecked(variable_ptr->timed_ok_); - ui->comboBox_recorder_output->setCurrentIndex(variable_ptr->recorder_out_.recorder_output); - ui->checkBox_two_ma_clamp->setChecked(variable_ptr->recorder_out_.two_ma_clamp); - ui->doubleSpinBox_trip_multiply->setValue(variable_ptr->recorder_out_.trip_multiply); - ui->comboBox_comparision->setCurrentIndex(variable_ptr->recorder_out_.comparision); - ui->spinBox_comparision_percentage->setValue(variable_ptr->recorder_out_.percentage); + } void Velocity::on_pushButton_confirm_clicked() { @@ -199,32 +110,7 @@ void Velocity::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex(); - variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value(); - variable->direct_.custom = 0; // TODO: - variable->x1_.checked = ui->checkBox_1x_ampl->isChecked(); - variable->x1_.full_scale_range = ui->comboBox_1x_value_range->currentIndex(); - variable->x1_.clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value(); - variable->x1_.custom = 0; // TODO: - variable->x1_.phase_lag = ui->doubleSpinBox_1x_phase_lag_clamp->value(); - variable->x2_.checked = ui->checkBox_2x_ampl->isChecked(); - variable->x2_.full_scale_range = ui->comboBox_2x_value_range->currentIndex(); - variable->x2_.clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value(); - variable->x2_.custom = 0; // TODO: - variable->x2_.phase_lag = ui->doubleSpinBox_2x_phase_lag_clamp->value(); - variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex(); - variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked(); - variable->recorder_out_.trip_multiply = ui->doubleSpinBox_trip_multiply->value(); - variable->recorder_out_.comparision = ui->comboBox_comparision->currentIndex(); - variable->recorder_out_.percentage = ui->spinBox_comparision_percentage->value(); - variable->delay_.alert = ui->spinBox_alert->value(); - variable->delay_.danger = ui->doubleSpinBox_danger->value(); - variable->delay_.active_100ms = ui->checkBox_100ms->isChecked(); - variable->rms_active_ = ui->checkBox_rms->isChecked(); - variable->integrate_active_ = ui->checkBox_integrate->isChecked(); - variable->alert_latching_ = ui->checkBox_alert_latching->isChecked(); - variable->danger_latching_ = ui->checkBox_danger_latching->isChecked(); - variable->timed_ok_ = ui->checkBox_timed_ok->isChecked(); + ptr->variables_.push_back(variable); this->close(); return; @@ -239,31 +125,6 @@ void Velocity::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->direct_.full_scale_range = ui->comboBox_direct_value_range->currentIndex(); - variable->direct_.clamp_value = ui->doubleSpinBox_direct_clamp->value(); - variable->direct_.custom = 0; // TODO: - variable->x1_.checked = ui->checkBox_1x_ampl->isChecked(); - variable->x1_.full_scale_range = ui->comboBox_1x_value_range->currentIndex(); - variable->x1_.clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value(); - variable->x1_.custom = 0; // TODO: - variable->x1_.phase_lag = ui->doubleSpinBox_1x_phase_lag_clamp->value(); - variable->x2_.checked = ui->checkBox_2x_ampl->isChecked(); - variable->x2_.full_scale_range = ui->comboBox_2x_value_range->currentIndex(); - variable->x2_.clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value(); - variable->x2_.custom = 0; // TODO: - variable->x2_.phase_lag = ui->doubleSpinBox_2x_phase_lag_clamp->value(); - variable->recorder_out_.recorder_output = ui->comboBox_recorder_output->currentIndex(); - variable->recorder_out_.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked(); - variable->recorder_out_.trip_multiply = ui->doubleSpinBox_trip_multiply->value(); - variable->recorder_out_.comparision = ui->comboBox_comparision->currentIndex(); - variable->recorder_out_.percentage = ui->spinBox_comparision_percentage->value(); - variable->delay_.alert = ui->spinBox_alert->value(); - variable->delay_.danger = ui->doubleSpinBox_danger->value(); - variable->delay_.active_100ms = ui->checkBox_100ms->isChecked(); - variable->rms_active_ = ui->checkBox_rms->isChecked(); - variable->integrate_active_ = ui->checkBox_integrate->isChecked(); - variable->alert_latching_ = ui->checkBox_alert_latching->isChecked(); - variable->danger_latching_ = ui->checkBox_danger_latching->isChecked(); - variable->timed_ok_ = ui->checkBox_timed_ok->isChecked(); + this->close(); } diff --git a/velocity.ui b/velocity.ui index 4783dd6..ba9bd1f 100644 --- a/velocity.ui +++ b/velocity.ui @@ -27,7 +27,7 @@ - 滤波配置 + 滤波 @@ -275,684 +275,8 @@ - 特征值和警报配置 + 处理后输出 - - - - 10 - 10 - 431 - 351 - - - - 特征值 - - - - - 20 - 50 - 54 - 12 - - - - 直接值 - - - - - - 10 - 80 - 81 - 16 - - - - 偏置电压 - - - - - - 20 - 110 - 81 - 16 - - - - 1倍频幅值 - - - - - - 20 - 180 - 81 - 16 - - - - 2倍频幅值 - - - - - - 141 - 31 - 48 - 16 - - - - 取值范围 - - - - - - 269 - 31 - 48 - 16 - - - - 默认值 - - - - - - 130 - 50 - 111 - 22 - - - - 0-20 mm/s pk - - - 1 - - - - 0-10 mm/s pk - - - - - 0-20 mm/s pk - - - - - 0-50 mm/s pk - - - - - 自定义 - - - - - - - 260 - 50 - 62 - 22 - - - - 1 - - - - - - 130 - 80 - 54 - 12 - - - - -24 - - - - - - 260 - 80 - 62 - 22 - - - - 1 - - - - - false - - - - 130 - 110 - 111 - 22 - - - - 1 - - - - 0-10 mm/s pk - - - - - 0-20 mm/s pk - - - - - 0-50 mm/s pk - - - - - 自定义 - - - - - - false - - - - 260 - 110 - 62 - 22 - - - - 1 - - - - - - 20 - 150 - 91 - 16 - - - - 1倍频相位 - - - - - - 20 - 210 - 91 - 16 - - - - 2倍频相位 - - - - - false - - - - 260 - 150 - 62 - 22 - - - - 0 - - - - - false - - - - 260 - 180 - 62 - 22 - - - - 1 - - - - - false - - - - 260 - 210 - 62 - 22 - - - - 0 - - - - - false - - - - 130 - 180 - 111 - 22 - - - - 1 - - - - 0-10 mm/s pk - - - - - 0-20 mm/s pk - - - - - 0-50 mm/s pk - - - - - 自定义 - - - - - - - 20 - 250 - 71 - 16 - - - - 有效值 - - - - - - 130 - 250 - 71 - 16 - - - - 积分 - - - - - - 200 - 240 - 221 - 101 - - - - 延时 - - - - - 20 - 20 - 54 - 12 - - - - 告警 - - - - - - 20 - 50 - 54 - 12 - - - - 危险 - - - - - - 60 - 50 - 61 - 21 - - - - 1 - - - 1.000000000000000 - - - - - - 60 - 80 - 71 - 16 - - - - 100 ms - - - - - - 130 - 20 - 54 - 12 - - - - 1 - 60s - - - - - - 130 - 50 - 71 - 16 - - - - 1.0 - 60.0s - - - - - - 60 - 20 - 61 - 21 - - - - 1 - - - - - - - 170 - 80 - 53 - 15 - - - - Vdc - - - - - - - 460 - 20 - 131 - 16 - - - - 告警锁定 - - - true - - - - - - 460 - 40 - 131 - 16 - - - - 危险锁定 - - - true - - - - - - 460 - 190 - 121 - 16 - - - - 倍增 - - - - - - 460 - 210 - 62 - 16 - - - - 1.000000000000000 - - - - - - 460 - 230 - 141 - 16 - - - - 1.00 - 3.00 (步进0.25) - - - - - - 460 - 110 - 54 - 12 - - - - 记录输出 - - - - - - 460 - 130 - 141 - 22 - - - - - - - - - - 直接幅值 - - - - - 1倍频幅值 - - - - - 2倍频幅值 - - - - - - - 460 - 160 - 101 - 16 - - - - 2 mA 默认值 - - - true - - - - - - 460 - 60 - 181 - 16 - - - - Timed OK channel Defeat - - - - - - 460 - 260 - 121 - 16 - - - - 比较 - - - - - false - - - - 460 - 280 - 141 - 22 - - - - - - - - - - 直接幅值 - - - - - 1倍频幅值 - - - - - 2倍频幅值 - - - - - - false - - - - 460 - 320 - 61 - 22 - - - @@ -966,6 +290,498 @@ % + + + + 10 + 20 + 621 + 321 + + + + 0 + + + + 常规 + + + + + 170 + 150 + 54 + 12 + + + + 整流器 + + + + + + 10 + 140 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + RMS + + + + + + + 170 + 50 + 54 + 12 + + + + 输出使用 + + + + + + 10 + 90 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + um + + + + + + + 170 + 100 + 54 + 12 + + + + 工程单位 + + + + + + 10 + 40 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + + + + + + + + + + + + + 警报 + + + + + 10 + 60 + 71 + 16 + + + + 危险 + 高 + + + + + + 10 + 100 + 71 + 16 + + + + 警报 + 高 + + + + + + 10 + 140 + 71 + 16 + + + + 警报 + 低 + + + + + + 10 + 180 + 71 + 16 + + + + 危险 + 低 + + + + + + 90 + 30 + 31 + 31 + + + + 等级 + (um) + + + + + + 170 + 30 + 31 + 31 + + + + 回差 +(um) + + + + + + 230 + 30 + 31 + 31 + + + + 延时 +(um) + + + + + + 280 + 40 + 31 + 16 + + + + 使能 + + + + + + 340 + 40 + 31 + 16 + + + + 锁存 + + + + + + 80 + 60 + 51 + 20 + + + + + + + 150 + 60 + 51 + 20 + + + + + + + 220 + 60 + 51 + 20 + + + + + + + 220 + 100 + 51 + 20 + + + + + + + 80 + 100 + 51 + 20 + + + + + + + 150 + 100 + 51 + 20 + + + + + + + 220 + 140 + 51 + 20 + + + + + + + 150 + 180 + 51 + 20 + + + + + + + 80 + 140 + 51 + 20 + + + + + + + 220 + 180 + 51 + 20 + + + + + + + 80 + 180 + 51 + 20 + + + + + + + 150 + 140 + 51 + 20 + + + + + + + 290 + 60 + 16 + 16 + + + + + + + + + + 290 + 100 + 16 + 16 + + + + + + + + + + 290 + 140 + 16 + 16 + + + + + + + + + + 290 + 180 + 16 + 16 + + + + + + + + + + 350 + 100 + 16 + 16 + + + + + + + + + + 350 + 180 + 16 + 16 + + + + + + + + + + 350 + 60 + 16 + 16 + + + + + + + + + + 350 + 140 + 16 + 16 + + + + + + + + From b1a776bfda11d0d90235f0f3c784382d92a0f20b Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Mon, 28 Jul 2025 22:05:26 +0800 Subject: [PATCH 03/14] add temp code --- acceleration.cpp | 109 +++++++++++- cardbase.h | 7 + config_mgr.cpp | 221 ++++++++++++----------- pressure_pulsation.cpp | 94 ++++++++++ pressure_pulsation.ui | 381 ++++++++++++++++++++++++++++++++++++++-- radial_vibration.cpp | 151 +++++++++++++++- radial_vibration.ui | 42 ++--- trust.cpp | 77 +++++++++ trust.ui | 385 ++--------------------------------------- velocity.cpp | 95 +++++++--- velocity.h | 4 - velocity.ui | 22 +-- 12 files changed, 1043 insertions(+), 545 deletions(-) diff --git a/acceleration.cpp b/acceleration.cpp index cc1c94d..ac9ad99 100644 --- a/acceleration.cpp +++ b/acceleration.cpp @@ -151,8 +151,59 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - - + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + // -freband output + variable->freband_output[0].enable = ui->checkBox_enable->isChecked(); + variable->freband_output[0].start = ui->lineEdit_start->text().toDouble(); + variable->freband_output[0].end = ui->lineEdit_end->text().toDouble(); + variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked(); + variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble(); + variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble(); + variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked(); + variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble(); + variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble(); + variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked(); + variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble(); + variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble(); + variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked(); + variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble(); + variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble(); + variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked(); + variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble(); + variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble(); + variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked(); + variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble(); + variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble(); + variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked(); + variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble(); + variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble(); + variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked(); + variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble(); + variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble(); + variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked(); + variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble(); + variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble(); ptr->variables_.push_back(variable); this->close(); return; @@ -167,7 +218,59 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + // -freband output + variable->freband_output[0].enable = ui->checkBox_enable->isChecked(); + variable->freband_output[0].start = ui->lineEdit_start->text().toDouble(); + variable->freband_output[0].end = ui->lineEdit_end->text().toDouble(); + variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked(); + variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble(); + variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble(); + variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked(); + variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble(); + variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble(); + variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked(); + variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble(); + variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble(); + variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked(); + variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble(); + variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble(); + variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked(); + variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble(); + variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble(); + variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked(); + variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble(); + variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble(); + variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked(); + variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble(); + variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble(); + variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked(); + variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble(); + variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble(); + variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked(); + variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble(); + variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble(); this->close(); } diff --git a/cardbase.h b/cardbase.h index 9dee64d..fdf2398 100644 --- a/cardbase.h +++ b/cardbase.h @@ -29,6 +29,13 @@ class VariableBase { AlarmAlertHigh alert_high; AlarmDangerLow danger_low; AlarmAlertLow alert_low; + + General gap_general; + AlarmDangerHigh gap_danger_high; + AlarmAlertHigh gap_alert_high; + AlarmDangerLow gap_danger_low; + AlarmAlertLow gap_alert_low; + FrequencybandOutput freband_output[10]; }; diff --git a/config_mgr.cpp b/config_mgr.cpp index e68e418..f711058 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -133,41 +133,56 @@ void ConfigMgr::Save(QString & file_path) { band_pass["checked"] = radial_ptr->filter_[2].checked; filter.append(band_pass); variables["filter"] = filter; - QJsonObject direct; - QJsonObject x1; - QJsonObject x2; - QJsonObject recorder_out; - QJsonObject delay; - QJsonArray latching; - direct["full_scale_range"] = radial_ptr->direct_.full_scale_range; - direct["clamp_value"] = radial_ptr->direct_.clamp_value; - direct["custom"] = radial_ptr->direct_.custom; - variables["direct"] = direct; - x1["checked"] = radial_ptr->x1_.checked; - x1["full_scale_range"] = radial_ptr->x1_.full_scale_range; - x1["clamp_value"] = radial_ptr->x1_.clamp_value; - x1["custom"] = radial_ptr->x1_.custom; - x1["phase_lag"] = radial_ptr->x1_.phase_lag; - variables["x1"] = x1; - x2["checked"] = radial_ptr->x2_.checked; - x2["full_scale_range"] = radial_ptr->x2_.full_scale_range; - x2["clamp_value"] = radial_ptr->x2_.clamp_value; - x2["custom"] = radial_ptr->x2_.custom; - x2["phase_lag"] = radial_ptr->x2_.phase_lag; - variables["x2"] = x2; - recorder_out["recorder_output"] = radial_ptr->recorder_out_.recorder_output; - recorder_out["two_ma_clamp"] = radial_ptr->recorder_out_.two_ma_clamp; - recorder_out["trip_multiply"] = radial_ptr->recorder_out_.trip_multiply; - recorder_out["comparision"] = radial_ptr->recorder_out_.comparision; - recorder_out["percentage"] = radial_ptr->recorder_out_.percentage; - variables["recorder_out"] = recorder_out; - delay["alert"] = radial_ptr->delay_.alert; - delay["danger"] = radial_ptr->delay_.danger; - delay["active_100ms"] = radial_ptr->delay_.active_100ms; - variables["delay"] = delay; - latching.append(radial_ptr->alert_latching_); - latching.append(radial_ptr->danger_latching_); - variables["latching"] = latching; + // measurement + QJsonObject measurement,general,alarm; + general["output_used"] = radial_ptr->general.output_used; + general["engieneering_unit"] = radial_ptr->general.engineering_unit; + general["rectifier_function"] = radial_ptr->general.rectifier_function; + + alarm["danger_high_level"] = radial_ptr->danger_high.level; + alarm["danger_high_hysteresis"] = radial_ptr->danger_high.hysteresis; + alarm["danger_high_delay"] = radial_ptr->danger_high.delay; + alarm["danger_high_enable"] = radial_ptr->danger_high.enable; + alarm["danger_high_latch"] = radial_ptr->danger_high.latch; + alarm["alert_high_level"] = radial_ptr->alert_high.level; + alarm["alert_high_hysteresis"] = radial_ptr->alert_high.hysteresis; + alarm["alert_high_delay"] = radial_ptr->alert_high.delay; + alarm["alert_high_enable"] = radial_ptr->alert_high.enable; + alarm["alert_high_latch"] = radial_ptr->alert_high.latch; + alarm["danger_low_level"] = radial_ptr->danger_low.level; + alarm["danger_low_hysteresis"] = radial_ptr->danger_low.hysteresis; + alarm["danger_low_delay"] = radial_ptr->danger_low.delay; + alarm["danger_low_enable"] = radial_ptr->danger_low.enable; + alarm["danger_low_latch"] = radial_ptr->danger_low.latch; + measurement["general"] = general; + measurement["alarm"] = alarm; + variables["measurement"] = measurement; + // gap + QJsonObject gap,gap_general,gap_alarm; + gap_general["output_used"] = radial_ptr->gap_general.output_used; + gap_general["engieneering_unit"] = radial_ptr->gap_general.engineering_unit; + gap_general["rectifier_function"] = radial_ptr->gap_general.rectifier_function; + + gap_alarm["danger_high_level"] = radial_ptr->gap_danger_high.level; + gap_alarm["danger_high_hysteresis"] = radial_ptr->gap_danger_high.hysteresis; + gap_alarm["danger_high_delay"] = radial_ptr->gap_danger_high.delay; + gap_alarm["danger_high_enable"] = radial_ptr->gap_danger_high.enable; + gap_alarm["danger_high_latch"] = radial_ptr->gap_danger_high.latch; + gap_alarm["alert_high_level"] = radial_ptr->gap_alert_high.level; + gap_alarm["alert_high_hysteresis"] = radial_ptr->gap_alert_high.hysteresis; + gap_alarm["alert_high_delay"] = radial_ptr->gap_alert_high.delay; + gap_alarm["alert_high_enable"] = radial_ptr->gap_alert_high.enable; + gap_alarm["alert_high_latch"] = radial_ptr->gap_alert_high.latch; + gap_alarm["danger_low_level"] = radial_ptr->gap_danger_low.level; + gap_alarm["danger_low_hysteresis"] = radial_ptr->gap_danger_low.hysteresis; + gap_alarm["danger_low_delay"] = radial_ptr->gap_danger_low.delay; + gap_alarm["danger_low_enable"] = radial_ptr->gap_danger_low.enable; + gap_alarm["danger_low_latch"] = radial_ptr->gap_danger_low.latch; + gap["general"] = gap_general; + gap["alarm"] = gap_alarm; + variables["gap"] = gap; + + }else if(ptr->base_config_[cid].channel_type == kVibThrust){ std::shared_ptr thrust_ptr = std::dynamic_pointer_cast(base_channel_ptr); if(thrust_ptr == nullptr){ @@ -191,33 +206,33 @@ void ConfigMgr::Save(QString & file_path) { band_pass["checked"] = thrust_ptr->filter_[2].checked; filter.append(band_pass); variables["filter"] = filter; - QJsonObject direct,gap; - QJsonObject recorder_out; - QJsonObject delay; - QJsonArray latching; - direct["full_scale_range"] = thrust_ptr->direct_.full_scale_range; - direct["clamp_value"] = thrust_ptr->direct_.clamp_value; - direct["custom"] = thrust_ptr->direct_.custom; - variables["direct"] = direct; - gap["full_scale_range"] = thrust_ptr->gap_range.full_scale_range; - gap["custom"] = thrust_ptr->gap_range.custom; + // gap + QJsonObject gap,gap_general,gap_alarm; + gap_general["output_used"] = thrust_ptr->gap_general.output_used; + gap_general["engieneering_unit"] = thrust_ptr->gap_general.engineering_unit; + gap_general["rectifier_function"] = thrust_ptr->gap_general.rectifier_function; + + gap_alarm["danger_high_level"] = thrust_ptr->gap_danger_high.level; + gap_alarm["danger_high_hysteresis"] = thrust_ptr->gap_danger_high.hysteresis; + gap_alarm["danger_high_delay"] = thrust_ptr->gap_danger_high.delay; + gap_alarm["danger_high_enable"] = thrust_ptr->gap_danger_high.enable; + gap_alarm["danger_high_latch"] = thrust_ptr->gap_danger_high.latch; + gap_alarm["alert_high_level"] = thrust_ptr->gap_alert_high.level; + gap_alarm["alert_high_hysteresis"] = thrust_ptr->gap_alert_high.hysteresis; + gap_alarm["alert_high_delay"] = thrust_ptr->gap_alert_high.delay; + gap_alarm["alert_high_enable"] = thrust_ptr->gap_alert_high.enable; + gap_alarm["alert_high_latch"] = thrust_ptr->gap_alert_high.latch; + gap_alarm["danger_low_level"] = thrust_ptr->gap_danger_low.level; + gap_alarm["danger_low_hysteresis"] = thrust_ptr->gap_danger_low.hysteresis; + gap_alarm["danger_low_delay"] = thrust_ptr->gap_danger_low.delay; + gap_alarm["danger_low_enable"] = thrust_ptr->gap_danger_low.enable; + gap_alarm["danger_low_latch"] = thrust_ptr->gap_danger_low.latch; + gap["general"] = gap_general; + gap["alarm"] = gap_alarm; variables["gap"] = gap; - recorder_out["recorder_output"] = thrust_ptr->recorder_out_.recorder_output; - recorder_out["two_ma_clamp"] = thrust_ptr->recorder_out_.two_ma_clamp; - recorder_out["trip_multiply"] = thrust_ptr->recorder_out_.trip_multiply; - recorder_out["comparision"] = thrust_ptr->recorder_out_.comparision; - recorder_out["percentage"] = thrust_ptr->recorder_out_.percentage; - variables["recorder_out"] = recorder_out; - delay["alert"] = thrust_ptr->delay_.alert; - delay["danger"] = thrust_ptr->delay_.danger; - delay["active_100ms"] = thrust_ptr->delay_.active_100ms; - variables["delay"] = delay; - latching.append(thrust_ptr->alert_latching_); - latching.append(thrust_ptr->danger_latching_); - latching.append(thrust_ptr->timed_ok_); - variables["zero_position"] = thrust_ptr->zero_position.value; variables["negation"] = thrust_ptr->zero_position.negation; - variables["latching"] = latching; + variables["zero_position"] = thrust_ptr->zero_position.value; + }else if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){ std::shared_ptr pressure_ptr = std::dynamic_pointer_cast(base_channel_ptr); if(pressure_ptr == nullptr){ @@ -254,7 +269,17 @@ void ConfigMgr::Save(QString & file_path) { variables["sampling"] = sampling; variables["scaling"] = scaling; - } else { + QJsonArray freband_output_array; + QJsonObject freband_output; + for (int var = 0; var < 10; ++var) { + freband_output["enable"] = pressure_ptr->freband_output[var].enable; + freband_output["start"] = pressure_ptr->freband_output[var].start; + freband_output["end"] = pressure_ptr->freband_output[var].end; + freband_output_array.append(freband_output); + } + variables["freband_output"] = freband_output_array; + + } else if(ptr->base_config_[cid].channel_type == kVibAcc){ std::shared_ptr av_ptr = std::dynamic_pointer_cast(base_channel_ptr); if(av_ptr == nullptr){ continue; @@ -277,46 +302,40 @@ void ConfigMgr::Save(QString & file_path) { band_pass["checked"] = av_ptr->filter_[2].checked; filter.append(band_pass); variables["filter"] = filter; - QJsonObject direct; - QJsonObject x1; - QJsonObject x2; - QJsonObject recorder_out; - QJsonObject delay; - QJsonArray latching; - direct["full_scale_range"] = av_ptr->direct_.full_scale_range; - direct["clamp_value"] = av_ptr->direct_.clamp_value; - direct["custom"] = av_ptr->direct_.custom; - variables["direct"] = direct; - x1["checked"] = av_ptr->x1_.checked; - x1["full_scale_range"] = av_ptr->x1_.full_scale_range; - x1["clamp_value"] = av_ptr->x1_.clamp_value; - x1["custom"] = av_ptr->x1_.custom; - x1["phase_lag"] = av_ptr->x1_.phase_lag; - variables["x1"] = x1; - x2["checked"] = av_ptr->x2_.checked; - x2["full_scale_range"] = av_ptr->x2_.full_scale_range; - x2["clamp_value"] = av_ptr->x2_.clamp_value; - x2["custom"] = av_ptr->x2_.custom; - x2["phase_lag"] = av_ptr->x2_.phase_lag; - variables["x2"] = x2; - QJsonObject rms_integrate; - rms_integrate["rms_active"] = av_ptr->rms_active_; - rms_integrate["integrate_active"] = av_ptr->integrate_active_; - variables["rms_integrate"] = rms_integrate; - recorder_out["recorder_output"] = av_ptr->recorder_out_.recorder_output; - recorder_out["two_ma_clamp"] = av_ptr->recorder_out_.two_ma_clamp; - recorder_out["trip_multiply"] = av_ptr->recorder_out_.trip_multiply; - recorder_out["comparision"] = av_ptr->recorder_out_.comparision; - recorder_out["percentage"] = av_ptr->recorder_out_.percentage; - variables["recorder_out"] = recorder_out; - delay["alert"] = av_ptr->delay_.alert; - delay["danger"] = av_ptr->delay_.danger; - delay["active_100ms"] = av_ptr->delay_.active_100ms; - variables["delay"] = delay; - latching.append(av_ptr->alert_latching_); - latching.append(av_ptr->danger_latching_); - latching.append(av_ptr->timed_ok_); - variables["latching"] = latching; + // processed output + QJsonObject processed_output,general,alarm; + general["output_used"] = av_ptr->general.output_used; + general["engieneering_unit"] = av_ptr->general.engineering_unit; + general["rectifier_function"] = av_ptr->general.rectifier_function; + + alarm["danger_high_level"] = av_ptr->danger_high.level; + alarm["danger_high_hysteresis"] = av_ptr->danger_high.hysteresis; + alarm["danger_high_delay"] = av_ptr->danger_high.delay; + alarm["danger_high_enable"] = av_ptr->danger_high.enable; + alarm["danger_high_latch"] = av_ptr->danger_high.latch; + alarm["alert_high_level"] = av_ptr->alert_high.level; + alarm["alert_high_hysteresis"] = av_ptr->alert_high.hysteresis; + alarm["alert_high_delay"] = av_ptr->alert_high.delay; + alarm["alert_high_enable"] = av_ptr->alert_high.enable; + alarm["alert_high_latch"] = av_ptr->alert_high.latch; + alarm["danger_low_level"] = av_ptr->danger_low.level; + alarm["danger_low_hysteresis"] = av_ptr->danger_low.hysteresis; + alarm["danger_low_delay"] = av_ptr->danger_low.delay; + alarm["danger_low_enable"] = av_ptr->danger_low.enable; + alarm["danger_low_latch"] = av_ptr->danger_low.latch; + processed_output["general"] = general; + processed_output["alarm"] = alarm; + variables["processed_output"] = processed_output; + QJsonArray freband_output_array; + QJsonObject freband_output; + for (int var = 0; var < 10; ++var) { + freband_output["enable"] = av_ptr->freband_output[var].enable; + freband_output["start"] = av_ptr->freband_output[var].start; + freband_output["end"] = av_ptr->freband_output[var].end; + freband_output_array.append(freband_output); + } + variables["freband_output"] = freband_output_array; + } channel_item["variable"] = variables; } else if (card_type_[i] == kCardSpeedSingle || card_type_[i] == kCardSpeedTMRPrimary) { diff --git a/pressure_pulsation.cpp b/pressure_pulsation.cpp index 7f685a1..5ede225 100644 --- a/pressure_pulsation.cpp +++ b/pressure_pulsation.cpp @@ -66,6 +66,37 @@ void PressurePulsation::Init() { ui->lineEdit_measuring_value_max->setText(QString::number(variable_ptr->measuring_max)); ui->lineEdit_scale_value_min->setText(QString::number(variable_ptr->scale_min)); ui->lineEdit_scale_value_max->setText(QString::number(variable_ptr->scale_max)); + + ui->checkBox_enable->setChecked(variable_ptr->freband_output[0].enable); + ui->lineEdit_start->setText(QString::number(variable_ptr->freband_output[0].start)); + ui->lineEdit_end->setText(QString::number(variable_ptr->freband_output[0].end)); + ui->checkBox_enable_2->setChecked(variable_ptr->freband_output[1].enable); + ui->lineEdit_start_2->setText(QString::number(variable_ptr->freband_output[1].start)); + ui->lineEdit_end_2->setText(QString::number(variable_ptr->freband_output[1].end)); + ui->checkBox_enable_3->setChecked(variable_ptr->freband_output[2].enable); + ui->lineEdit_start_3->setText(QString::number(variable_ptr->freband_output[2].start)); + ui->lineEdit_end_3->setText(QString::number(variable_ptr->freband_output[2].end)); + ui->checkBox_enable_4->setChecked(variable_ptr->freband_output[3].enable); + ui->lineEdit_start_4->setText(QString::number(variable_ptr->freband_output[3].start)); + ui->lineEdit_end_4->setText(QString::number(variable_ptr->freband_output[3].end)); + ui->checkBox_enable_5->setChecked(variable_ptr->freband_output[4].enable); + ui->lineEdit_start_5->setText(QString::number(variable_ptr->freband_output[4].start)); + ui->lineEdit_end_5->setText(QString::number(variable_ptr->freband_output[4].end)); + ui->checkBox_enable_6->setChecked(variable_ptr->freband_output[5].enable); + ui->lineEdit_start_6->setText(QString::number(variable_ptr->freband_output[5].start)); + ui->lineEdit_end_6->setText(QString::number(variable_ptr->freband_output[5].end)); + ui->checkBox_enable_7->setChecked(variable_ptr->freband_output[6].enable); + ui->lineEdit_start_7->setText(QString::number(variable_ptr->freband_output[6].start)); + ui->lineEdit_end_7->setText(QString::number(variable_ptr->freband_output[6].end)); + ui->checkBox_enable_8->setChecked(variable_ptr->freband_output[7].enable); + ui->lineEdit_start_8->setText(QString::number(variable_ptr->freband_output[7].start)); + ui->lineEdit_end_8->setText(QString::number(variable_ptr->freband_output[7].end)); + ui->checkBox_enable_9->setChecked(variable_ptr->freband_output[8].enable); + ui->lineEdit_start_9->setText(QString::number(variable_ptr->freband_output[8].start)); + ui->lineEdit_end_9->setText(QString::number(variable_ptr->freband_output[8].end)); + ui->checkBox_enable_10->setChecked(variable_ptr->freband_output[9].enable); + ui->lineEdit_start_10->setText(QString::number(variable_ptr->freband_output[9].start)); + ui->lineEdit_end_10->setText(QString::number(variable_ptr->freband_output[9].end)); } void PressurePulsation::on_pushButton_confirm_clicked() { @@ -103,6 +134,37 @@ void PressurePulsation::on_pushButton_confirm_clicked() variable->measuring_max = ui->lineEdit_measuring_value_max->text().toInt(); variable->scale_min = ui->lineEdit_scale_value_min->text().toInt(); variable->scale_max = ui->lineEdit_scale_value_max->text().toInt(); + // -freband output + variable->freband_output[0].enable = ui->checkBox_enable->isChecked(); + variable->freband_output[0].start = ui->lineEdit_start->text().toDouble(); + variable->freband_output[0].end = ui->lineEdit_end->text().toDouble(); + variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked(); + variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble(); + variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble(); + variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked(); + variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble(); + variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble(); + variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked(); + variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble(); + variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble(); + variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked(); + variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble(); + variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble(); + variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked(); + variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble(); + variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble(); + variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked(); + variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble(); + variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble(); + variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked(); + variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble(); + variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble(); + variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked(); + variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble(); + variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble(); + variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked(); + variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble(); + variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble(); ptr->variables_.push_back(variable); this->close(); @@ -127,6 +189,38 @@ void PressurePulsation::on_pushButton_confirm_clicked() variable->scale_min = ui->lineEdit_scale_value_min->text().toInt(); variable->scale_max = ui->lineEdit_scale_value_max->text().toInt(); + // -freband output + variable->freband_output[0].enable = ui->checkBox_enable->isChecked(); + variable->freband_output[0].start = ui->lineEdit_start->text().toDouble(); + variable->freband_output[0].end = ui->lineEdit_end->text().toDouble(); + variable->freband_output[1].enable = ui->checkBox_enable_2->isChecked(); + variable->freband_output[1].start = ui->lineEdit_start_2->text().toDouble(); + variable->freband_output[1].end = ui->lineEdit_end_2->text().toDouble(); + variable->freband_output[2].enable = ui->checkBox_enable_3->isChecked(); + variable->freband_output[2].start = ui->lineEdit_start_3->text().toDouble(); + variable->freband_output[2].end = ui->lineEdit_end_3->text().toDouble(); + variable->freband_output[3].enable = ui->checkBox_enable_4->isChecked(); + variable->freband_output[3].start = ui->lineEdit_start_4->text().toDouble(); + variable->freband_output[3].end = ui->lineEdit_end_4->text().toDouble(); + variable->freband_output[4].enable = ui->checkBox_enable_5->isChecked(); + variable->freband_output[4].start = ui->lineEdit_start_5->text().toDouble(); + variable->freband_output[4].end = ui->lineEdit_end_5->text().toDouble(); + variable->freband_output[5].enable = ui->checkBox_enable_6->isChecked(); + variable->freband_output[5].start = ui->lineEdit_start_6->text().toDouble(); + variable->freband_output[5].end = ui->lineEdit_end_6->text().toDouble(); + variable->freband_output[6].enable = ui->checkBox_enable_7->isChecked(); + variable->freband_output[6].start = ui->lineEdit_start_7->text().toDouble(); + variable->freband_output[6].end = ui->lineEdit_end_7->text().toDouble(); + variable->freband_output[7].enable = ui->checkBox_enable_8->isChecked(); + variable->freband_output[7].start = ui->lineEdit_start_8->text().toDouble(); + variable->freband_output[7].end = ui->lineEdit_end_8->text().toDouble(); + variable->freband_output[8].enable = ui->checkBox_enable_9->isChecked(); + variable->freband_output[8].start = ui->lineEdit_start_9->text().toDouble(); + variable->freband_output[8].end = ui->lineEdit_end_9->text().toDouble(); + variable->freband_output[9].enable = ui->checkBox_enable_10->isChecked(); + variable->freband_output[9].start = ui->lineEdit_start_10->text().toDouble(); + variable->freband_output[9].end = ui->lineEdit_end_10->text().toDouble(); + this->close(); } diff --git a/pressure_pulsation.ui b/pressure_pulsation.ui index 5b943e5..bd0e8cb 100644 --- a/pressure_pulsation.ui +++ b/pressure_pulsation.ui @@ -7,7 +7,7 @@ 0 0 701 - 519 + 572 @@ -76,7 +76,7 @@ 30 - 450 + 500 632 37 @@ -164,11 +164,11 @@ 20 60 651 - 381 + 421 - 0 + 2 @@ -514,8 +514,8 @@ 20 70 - 118 - 22 + 121 + 23 @@ -543,7 +543,7 @@ 20 100 122 - 14 + 17 @@ -569,7 +569,7 @@ 20 130 92 - 14 + 17 @@ -594,8 +594,8 @@ 20 160 - 104 - 14 + 106 + 17 @@ -774,6 +774,367 @@ + + + 分频段选择 + + + + + 40 + 230 + 71 + 16 + + + + 使能 + + + + + + 140 + 80 + 113 + 20 + + + + + + + 40 + 170 + 71 + 16 + + + + 使能 + + + + + + 140 + 110 + 113 + 20 + + + + + + + 40 + 140 + 71 + 16 + + + + 使能 + + + + + + 140 + 170 + 113 + 20 + + + + + + + 290 + 140 + 113 + 20 + + + + + + + 290 + 200 + 113 + 20 + + + + + + + 160 + 40 + 91 + 16 + + + + 频率开始(Hz) + + + + + + 290 + 230 + 113 + 20 + + + + + + + 40 + 80 + 71 + 16 + + + + 使能 + + + + + + 140 + 140 + 113 + 20 + + + + + + + 140 + 200 + 113 + 20 + + + + + + + 40 + 200 + 71 + 16 + + + + 使能 + + + + + + 290 + 110 + 113 + 20 + + + + + + + 310 + 40 + 91 + 16 + + + + 频率结束(Hz) + + + + + + 140 + 230 + 113 + 20 + + + + + + + 40 + 110 + 71 + 16 + + + + 使能 + + + + + + 290 + 80 + 113 + 20 + + + + + + + 290 + 170 + 113 + 20 + + + + + + + 40 + 350 + 71 + 16 + + + + 使能 + + + + + + 140 + 320 + 113 + 20 + + + + + + + 40 + 290 + 71 + 16 + + + + 使能 + + + + + + 140 + 350 + 113 + 20 + + + + + + + 290 + 320 + 113 + 20 + + + + + + + 40 + 260 + 71 + 16 + + + + 使能 + + + + + + 290 + 260 + 113 + 20 + + + + + + + 140 + 290 + 113 + 20 + + + + + + + 290 + 290 + 113 + 20 + + + + + + + 140 + 260 + 113 + 20 + + + + + + + 40 + 320 + 71 + 16 + + + + 使能 + + + + + + 290 + 350 + 113 + 20 + + + + diff --git a/radial_vibration.cpp b/radial_vibration.cpp index dd48fcd..c528a0a 100644 --- a/radial_vibration.cpp +++ b/radial_vibration.cpp @@ -70,7 +70,67 @@ void Radial::Init() { ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked); ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low); ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high); + // processed output + // -general + if(variable_ptr->general.output_used) + ui->comboBox_output_used->setCurrentIndex(0); + else + ui->comboBox_output_used->setCurrentIndex(1); + // -alarm + ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.level)); + ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable); + ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch); + ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.level)); + ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable); + ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch); + + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + + // Gap + // -general + if(variable_ptr->gap_general.output_used) + ui->comboBox_output_used_2->setCurrentIndex(0); + else + ui->comboBox_output_used_2->setCurrentIndex(1); + // -alarm + ui->lineEdit_danger_high_level_2->setText(QString::number(variable_ptr->gap_danger_high.level)); + ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_high.level)); + ui->lineEdit_danger_high_delay_2->setText(QString::number(variable_ptr->gap_danger_high.level)); + ui->checkBox_danger_high_enable_2->setChecked(variable_ptr->gap_danger_high.enable); + ui->checkBox_danger_high_latch_2->setChecked(variable_ptr->gap_danger_high.latch); + + ui->lineEdit_alert_high_level_2->setText(QString::number(variable_ptr->gap_alert_high.level)); + ui->lineEdit_alert_high_hysteresis_2->setText(QString::number(variable_ptr->gap_alert_high.level)); + ui->lineEdit_alert_high_delay_2->setText(QString::number(variable_ptr->gap_alert_high.level)); + ui->checkBox_alert_high_enable_2->setChecked(variable_ptr->gap_alert_high.enable); + ui->checkBox_alert_high_latch_2->setChecked(variable_ptr->gap_alert_high.latch); + + ui->lineEdit_danger_low_level_2->setText(QString::number(variable_ptr->gap_danger_low.level)); + ui->lineEdit_danger_low_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_low.level)); + ui->lineEdit_danger_low_delay_2->setText(QString::number(variable_ptr->gap_danger_low.level)); + ui->checkBox_danger_low_enable_2->setChecked(variable_ptr->gap_danger_low.enable); + ui->checkBox_danger_low_latch_2->setChecked(variable_ptr->gap_danger_low.latch); + + ui->lineEdit_danger_low_level_2->setText(QString::number(variable_ptr->gap_danger_low.level)); + ui->lineEdit_danger_low_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_low.level)); + ui->lineEdit_danger_low_delay_2->setText(QString::number(variable_ptr->gap_danger_low.level)); + ui->checkBox_danger_low_enable_2->setChecked(variable_ptr->gap_danger_low.enable); + ui->checkBox_danger_low_latch_2->setChecked(variable_ptr->gap_danger_low.latch); } void Radial::on_pushButton_confirm_clicked() { @@ -100,7 +160,51 @@ void Radial::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + // Gap + // -general + if(ui->comboBox_output_used_2->currentIndex() == 0) + variable->gap_general.output_used = true; + else + variable->gap_general.output_used = false; + // -alarm + variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble(); + variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble(); + variable->gap_danger_high.delay = ui->lineEdit_danger_high_delay_2->text().toDouble(); + variable->gap_danger_high.enable = ui->checkBox_danger_high_enable_2->isChecked(); + variable->gap_danger_high.latch = ui->checkBox_danger_high_latch_2->isChecked(); + variable->gap_alert_high.level = ui->lineEdit_alert_high_level_2->text().toDouble(); + variable->gap_alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis_2->text().toDouble(); + variable->gap_alert_high.delay = ui->lineEdit_alert_high_delay_2->text().toDouble(); + variable->gap_alert_high.enable = ui->checkBox_alert_high_enable_2->isChecked(); + variable->gap_alert_high.latch = ui->checkBox_alert_high_latch_2->isChecked(); + variable->gap_danger_low.level = ui->lineEdit_danger_low_level_2->text().toDouble(); + variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis_2->text().toDouble(); + variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble(); + variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked(); + variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked(); + // add to ptr ptr->variables_.push_back(variable); this->close(); return; @@ -115,7 +219,50 @@ void Radial::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + // Gap + // -general + if(ui->comboBox_output_used_2->currentIndex() == 0) + variable->gap_general.output_used = true; + else + variable->gap_general.output_used = false; + // -alarm + variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble(); + variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble(); + variable->gap_danger_high.delay = ui->lineEdit_danger_high_delay_2->text().toDouble(); + variable->gap_danger_high.enable = ui->checkBox_danger_high_enable_2->isChecked(); + variable->gap_danger_high.latch = ui->checkBox_danger_high_latch_2->isChecked(); + variable->gap_alert_high.level = ui->lineEdit_alert_high_level_2->text().toDouble(); + variable->gap_alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis_2->text().toDouble(); + variable->gap_alert_high.delay = ui->lineEdit_alert_high_delay_2->text().toDouble(); + variable->gap_alert_high.enable = ui->checkBox_alert_high_enable_2->isChecked(); + variable->gap_alert_high.latch = ui->checkBox_alert_high_latch_2->isChecked(); + variable->gap_danger_low.level = ui->lineEdit_danger_low_level_2->text().toDouble(); + variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis_2->text().toDouble(); + variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble(); + variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked(); + variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked(); this->close(); } diff --git a/radial_vibration.ui b/radial_vibration.ui index 51513c9..6cb64dc 100644 --- a/radial_vibration.ui +++ b/radial_vibration.ui @@ -23,7 +23,7 @@ - 1 + 2 @@ -293,14 +293,14 @@ - 10 - 40 + 20 + 50 621 321 - 0 + 1 @@ -566,7 +566,7 @@ - + 150 @@ -676,7 +676,7 @@ - + 290 @@ -689,7 +689,7 @@ - + 290 @@ -702,7 +702,7 @@ - + 290 @@ -728,7 +728,7 @@ - + 350 @@ -741,7 +741,7 @@ - + 350 @@ -754,7 +754,7 @@ - + 350 @@ -767,7 +767,7 @@ - + 350 @@ -797,7 +797,7 @@ - 0 + 1 @@ -1063,7 +1063,7 @@ - + 150 @@ -1173,7 +1173,7 @@ - + 290 @@ -1186,7 +1186,7 @@ - + 290 @@ -1199,7 +1199,7 @@ - + 290 @@ -1225,7 +1225,7 @@ - + 350 @@ -1238,7 +1238,7 @@ - + 350 @@ -1251,7 +1251,7 @@ - + 350 @@ -1264,7 +1264,7 @@ - + 350 diff --git a/trust.cpp b/trust.cpp index f4c192e..67dc28f 100644 --- a/trust.cpp +++ b/trust.cpp @@ -62,6 +62,37 @@ void Trust::Init() { ui->doubleSpinBox_zero_position->setValue(variable_ptr->zero_position.value); ui->checkBox_negation->setChecked(variable_ptr->zero_position.negation); + + // processed output + // -general + if(variable_ptr->general.output_used) + ui->comboBox_output_used->setCurrentIndex(0); + else + ui->comboBox_output_used->setCurrentIndex(1); + // -alarm + ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.level)); + ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable); + ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch); + + ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.level)); + ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable); + ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch); + + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); } void Trust::on_pushButton_confirm_clicked() { @@ -94,6 +125,29 @@ void Trust::on_pushButton_confirm_clicked() variable->zero_position.value = ui->doubleSpinBox_zero_position->value(); variable->zero_position.negation = ui->checkBox_negation->isChecked(); + + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); ptr->variables_.push_back(variable); this->close(); return; @@ -111,6 +165,29 @@ void Trust::on_pushButton_confirm_clicked() variable->zero_position.value = ui->doubleSpinBox_zero_position->value(); variable->zero_position.negation = ui->checkBox_negation->isChecked(); + + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); this->close(); } diff --git a/trust.ui b/trust.ui index 5734bec..b95bd22 100644 --- a/trust.ui +++ b/trust.ui @@ -281,13 +281,13 @@ 10 - 20 + 30 621 321 - 1 + 0 @@ -430,7 +430,7 @@ 初始位置 - + 10 @@ -462,7 +462,7 @@ -50 - 50 V - + 10 @@ -611,7 +611,7 @@ - + 150 @@ -721,7 +721,7 @@ - + 290 @@ -734,7 +734,7 @@ - + 290 @@ -747,7 +747,7 @@ - + 290 @@ -773,7 +773,7 @@ - + 350 @@ -786,7 +786,7 @@ - + 350 @@ -799,7 +799,7 @@ - + 350 @@ -812,7 +812,7 @@ - + 350 @@ -828,367 +828,6 @@ - - - 分频段选择 - - - - - 120 - 210 - 113 - 20 - - - - - - - 20 - 90 - 71 - 16 - - - - 使能 - - - - - - 270 - 270 - 113 - 20 - - - - - - - 20 - 300 - 71 - 16 - - - - 使能 - - - - - - 20 - 60 - 71 - 16 - - - - 使能 - - - - - - 140 - 20 - 91 - 16 - - - - 频率开始(Hz) - - - - - - 270 - 300 - 113 - 20 - - - - - - - 270 - 240 - 113 - 20 - - - - - - - 20 - 330 - 71 - 16 - - - - 使能 - - - - - - 120 - 60 - 113 - 20 - - - - - - - 20 - 270 - 71 - 16 - - - - 使能 - - - - - - 120 - 270 - 113 - 20 - - - - - - - 270 - 60 - 113 - 20 - - - - - - - 120 - 150 - 113 - 20 - - - - - - - 120 - 120 - 113 - 20 - - - - - - - 20 - 150 - 71 - 16 - - - - 使能 - - - - - - 290 - 20 - 91 - 16 - - - - 频率结束(Hz) - - - - - - 270 - 180 - 113 - 20 - - - - - - - 120 - 330 - 113 - 20 - - - - - - - 270 - 120 - 113 - 20 - - - - - - - 270 - 210 - 113 - 20 - - - - - - - 20 - 120 - 71 - 16 - - - - 使能 - - - - - - 120 - 180 - 113 - 20 - - - - - - - 270 - 150 - 113 - 20 - - - - - - - 120 - 240 - 113 - 20 - - - - - - - 120 - 300 - 113 - 20 - - - - - - - 270 - 90 - 113 - 20 - - - - - - - 20 - 240 - 71 - 16 - - - - 使能 - - - - - - 120 - 90 - 113 - 20 - - - - - - - 20 - 180 - 71 - 16 - - - - 使能 - - - - - - 20 - 210 - 71 - 16 - - - - 使能 - - - - - - 270 - 330 - 113 - 20 - - - - diff --git a/velocity.cpp b/velocity.cpp index aa54834..9ee0a41 100644 --- a/velocity.cpp +++ b/velocity.cpp @@ -32,28 +32,10 @@ Velocity::~Velocity() { delete ui; } -void Velocity::on_checkBox_rms_toggled(bool checked) { - // TODO: 自定义的回调 - -} - -void Velocity::on_checkBox_integrate_toggled(bool checked) { - // TODO: 自定义的回调 - -} - void Velocity::on_pushButton_cancel_clicked() { this->close(); } -void Velocity::on_checkBox_1x_ampl_toggled(bool checked) { - -} - -void Velocity::on_checkBox_2x_ampl_toggled(bool checked) { - -} - void Velocity::Init() { std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); if (base_ptr == nullptr) { @@ -81,6 +63,37 @@ void Velocity::Init() { ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low); ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high); + // processed output + // -general + if(variable_ptr->general.output_used) + ui->comboBox_output_used->setCurrentIndex(0); + else + ui->comboBox_output_used->setCurrentIndex(1); + // -alarm + ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.level)); + ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable); + ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch); + + ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.level)); + ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable); + ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch); + + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + } void Velocity::on_pushButton_confirm_clicked() { @@ -110,7 +123,28 @@ void Velocity::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); ptr->variables_.push_back(variable); this->close(); return; @@ -125,6 +159,27 @@ void Velocity::on_pushButton_confirm_clicked() { variable->filter_[2].checked = ui->checkBox_band_pass->isChecked(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); this->close(); } diff --git a/velocity.h b/velocity.h index af40b1b..1c0a31e 100644 --- a/velocity.h +++ b/velocity.h @@ -20,10 +20,6 @@ class Velocity : public QWidget { private slots: void on_pushButton_confirm_clicked(); void on_pushButton_cancel_clicked(); - void on_checkBox_1x_ampl_toggled(bool checked); - void on_checkBox_2x_ampl_toggled(bool checked); - void on_checkBox_rms_toggled(bool checked); - void on_checkBox_integrate_toggled(bool checked); private: Ui::Velocity *ui; diff --git a/velocity.ui b/velocity.ui index ba9bd1f..b24891c 100644 --- a/velocity.ui +++ b/velocity.ui @@ -293,14 +293,14 @@ - 10 - 20 + 20 + 30 621 321 - 0 + 1 @@ -566,7 +566,7 @@ - + 150 @@ -676,7 +676,7 @@ - + 290 @@ -689,7 +689,7 @@ - + 290 @@ -702,7 +702,7 @@ - + 290 @@ -728,7 +728,7 @@ - + 350 @@ -741,7 +741,7 @@ - + 350 @@ -754,7 +754,7 @@ - + 350 @@ -767,7 +767,7 @@ - + 350 From 87549b312f862d77ace02126a5ba3a80a782deae Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Mon, 28 Jul 2025 22:41:24 +0800 Subject: [PATCH 04/14] add temp code --- TSI_Config.pro | 3 - config_mgr.cpp | 240 ++++++++++++------- mainwindow.cpp | 7 +- setpoint.cpp | 482 -------------------------------------- setpoint.h | 45 ---- setpoint.ui | 620 ------------------------------------------------- 6 files changed, 160 insertions(+), 1237 deletions(-) delete mode 100644 setpoint.cpp delete mode 100644 setpoint.h delete mode 100644 setpoint.ui diff --git a/TSI_Config.pro b/TSI_Config.pro index 49a74a5..4b5bb4f 100644 --- a/TSI_Config.pro +++ b/TSI_Config.pro @@ -28,7 +28,6 @@ SOURCES += \ rangeslider.cpp \ relaysetting.cpp \ seismic_monitor.cpp \ - setpoint.cpp \ setpoint_tachometer.cpp \ singlerelay.cpp \ singlerelay_data.cpp \ @@ -62,7 +61,6 @@ HEADERS += \ rangeslider.h \ relaysetting.h \ seismic_monitor.h \ - setpoint.h \ setpoint_tachometer.h \ singlerelay.h \ singlerelay_data.h \ @@ -89,7 +87,6 @@ FORMS += \ radial_vibration.ui \ relaysetting.ui \ seismic_monitor.ui \ - setpoint.ui \ setpoint_tachometer.ui \ singlerelay.ui \ tachometer.ui \ diff --git a/config_mgr.cpp b/config_mgr.cpp index f711058..c33a65d 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -535,35 +535,54 @@ void ConfigMgr::Load(QString filename) { variable->filter_[k].checked = filter_ele["checked"].toBool(); } variable->id_ = j + 1; - QJsonObject direct = tmp_variable["direct"].toObject(); - variable->direct_.full_scale_range = direct["full_scale_range"].toInt(); - variable->direct_.clamp_value = direct["clamp_value"].toDouble(); - variable->direct_.custom = direct["custom"].toDouble(); - QJsonObject x1 = tmp_variable["x1"].toObject(); - variable->x1_.checked = x1["checked"].toBool(); - variable->x1_.full_scale_range = x1["full_scale_range"].toInt(); - variable->x1_.clamp_value = x1["clamp_value"].toDouble(); - variable->x1_.custom = x1["custom"].toDouble(); - variable->x1_.phase_lag = x1["phase_lag"].toInt(); - QJsonObject x2 = tmp_variable["x2"].toObject(); - variable->x2_.checked = x2["checked"].toBool(); - variable->x2_.full_scale_range = x2["full_scale_range"].toInt(); - variable->x2_.clamp_value = x2["clamp_value"].toDouble(); - variable->x2_.custom = x2["custom"].toDouble(); - variable->x2_.phase_lag = x2["phase_lag"].toInt(); - QJsonObject recorder_out = tmp_variable["recorder_out"].toObject(); - variable->recorder_out_.recorder_output = recorder_out["recorder_output"].toInt(); - variable->recorder_out_.two_ma_clamp = recorder_out["two_ma_clamp"].toBool(); - variable->recorder_out_.trip_multiply = recorder_out["trip_multiply"].toDouble(); - variable->recorder_out_.comparision = recorder_out["comparision"].toInt(); - variable->recorder_out_.percentage = recorder_out["percentage"].toInt(); - QJsonObject delay = tmp_variable["delay"].toObject(); - variable->delay_.alert = delay["alert"].toInt(); - variable->delay_.danger = delay["danger"].toDouble(); - variable->delay_.active_100ms = delay["active_100ms"].toBool(); - QJsonObject latching = tmp_variable["latching"].toObject(); - variable->alert_latching_ = latching["alert"].toBool(); - variable->danger_latching_ = latching["danger"].toBool(); + QJsonObject measurement, gap; + measurement = tmp_variable["measurement"].toObject(); + gap = tmp_variable["gap"].toObject(); + variable->general.output_used = measurement["output_used"].toBool(); + variable->general.engineering_unit = measurement["engieneering_unit"].toString(); + variable->general.rectifier_function = measurement["rectifier_function"].toString(); + variable->danger_high.level = measurement["danger_high_level"].toDouble(); + variable->danger_high.hysteresis = measurement["danger_high_hysteresis"].toDouble(); + variable->danger_high.delay = measurement["danger_high_delay"].toInt(); + variable->danger_high.enable = measurement["danger_high_enable"].toBool(); + variable->danger_high.latch = measurement["danger_high_latch"].toBool(); + variable->alert_high.level = measurement["alert_high_level"].toDouble(); + variable->alert_high.hysteresis = measurement["alert_high_hysteresis"].toDouble(); + variable->alert_high.delay = measurement["alert_high_delay"].toInt(); + variable->alert_high.enable = measurement["alert_high_enable"].toBool(); + variable->alert_high.latch = measurement["alert_high_latch"].toBool(); + variable->danger_low.level = measurement["danger_low_level"].toDouble(); + variable->danger_low.hysteresis = measurement["danger_low_hysteresis"].toDouble(); + variable->danger_low.delay = measurement["danger_low_delay"].toInt(); + variable->danger_low.enable = measurement["danger_low_enable"].toBool(); + variable->danger_low.latch = measurement["danger_low_latch"].toBool(); + variable->alert_low.level = measurement["alert_low_level"].toDouble(); + variable->alert_low.hysteresis = measurement["alert_low_hysteresis"].toDouble(); + variable->alert_low.delay = measurement["alert_low_delay"].toInt(); + variable->alert_low.enable = measurement["alert_low_enable"].toBool(); + variable->alert_low.latch = measurement["alert_low_latch"].toBool(); + + variable->gap_danger_high.level = gap["danger_high_level"].toDouble(); + variable->gap_danger_high.hysteresis = gap["danger_high_hysteresis"].toDouble(); + variable->gap_danger_high.delay = gap["danger_high_delay"].toInt(); + variable->gap_danger_high.enable = gap["danger_high_enable"].toBool(); + variable->gap_danger_high.latch = gap["danger_high_latch"].toBool(); + variable->gap_alert_high.level = gap["alert_high_level"].toDouble(); + variable->gap_alert_high.hysteresis = gap["alert_high_hysteresis"].toDouble(); + variable->gap_alert_high.delay = gap["alert_high_delay"].toInt(); + variable->gap_alert_high.enable = gap["alert_high_enable"].toBool(); + variable->gap_alert_high.latch = gap["alert_high_latch"].toBool(); + variable->gap_danger_low.level = gap["danger_low_level"].toDouble(); + variable->gap_danger_low.hysteresis = gap["danger_low_hysteresis"].toDouble(); + variable->gap_danger_low.delay = gap["danger_low_delay"].toInt(); + variable->gap_danger_low.enable = gap["danger_low_enable"].toBool(); + variable->gap_danger_low.latch = gap["danger_low_latch"].toBool(); + variable->gap_alert_low.level = gap["alert_low_level"].toDouble(); + variable->gap_alert_low.hysteresis = gap["alert_low_hysteresis"].toDouble(); + variable->gap_alert_low.delay = gap["alert_low_delay"].toInt(); + variable->gap_alert_low.enable = gap["alert_low_enable"].toBool(); + variable->gap_alert_low.latch = gap["alert_low_latch"].toBool(); + vib_data->variables_.push_back(variable); break; } @@ -578,26 +597,28 @@ void ConfigMgr::Load(QString filename) { variable->filter_[k].checked = filter_ele["checked"].toBool(); } variable->id_ = j + 1; - QJsonObject direct = tmp_variable["direct"].toObject(); - variable->direct_.full_scale_range = direct["full_scale_range"].toInt(); - variable->direct_.clamp_value = direct["clamp_value"].toDouble(); - variable->direct_.custom = direct["custom"].toDouble(); - - QJsonObject gap = tmp_variable["gap"].toObject(); - variable->gap_range.full_scale_range = direct["full_scale_range"].toInt(); - variable->gap_range.custom = direct["custom"].toDouble(); - - QJsonObject recorder_out = tmp_variable["recorder_out"].toObject(); - variable->recorder_out_.recorder_output = recorder_out["recorder_output"].toInt(); - variable->recorder_out_.two_ma_clamp = recorder_out["two_ma_clamp"].toBool(); - QJsonObject delay = tmp_variable["delay"].toObject(); - variable->delay_.alert = delay["alert"].toInt(); - variable->delay_.danger = delay["danger"].toDouble(); - variable->delay_.active_100ms = delay["active_100ms"].toBool(); - QJsonObject latching = tmp_variable["latching"].toObject(); - variable->alert_latching_ = latching["alert"].toBool(); - variable->danger_latching_ = latching["danger"].toBool(); - variable->timed_ok_ = latching["timed_ok"].toBool(); + QJsonObject gap; + gap = tmp_variable["gap"].toObject(); + variable->gap_danger_high.level = gap["danger_high_level"].toDouble(); + variable->gap_danger_high.hysteresis = gap["danger_high_hysteresis"].toDouble(); + variable->gap_danger_high.delay = gap["danger_high_delay"].toInt(); + variable->gap_danger_high.enable = gap["danger_high_enable"].toBool(); + variable->gap_danger_high.latch = gap["danger_high_latch"].toBool(); + variable->gap_alert_high.level = gap["alert_high_level"].toDouble(); + variable->gap_alert_high.hysteresis = gap["alert_high_hysteresis"].toDouble(); + variable->gap_alert_high.delay = gap["alert_high_delay"].toInt(); + variable->gap_alert_high.enable = gap["alert_high_enable"].toBool(); + variable->gap_alert_high.latch = gap["alert_high_latch"].toBool(); + variable->gap_danger_low.level = gap["danger_low_level"].toDouble(); + variable->gap_danger_low.hysteresis = gap["danger_low_hysteresis"].toDouble(); + variable->gap_danger_low.delay = gap["danger_low_delay"].toInt(); + variable->gap_danger_low.enable = gap["danger_low_enable"].toBool(); + variable->gap_danger_low.latch = gap["danger_low_latch"].toBool(); + variable->gap_alert_low.level = gap["alert_low_level"].toDouble(); + variable->gap_alert_low.hysteresis = gap["alert_low_hysteresis"].toDouble(); + variable->gap_alert_low.delay = gap["alert_low_delay"].toInt(); + variable->gap_alert_low.enable = gap["alert_low_enable"].toBool(); + variable->gap_alert_low.latch = gap["alert_low_latch"].toBool(); variable->zero_position.value = tmp_variable["zero_position"].toDouble(); variable->zero_position.negation = tmp_variable["negation"].toBool(); vib_data->variables_.push_back(variable); @@ -625,10 +646,59 @@ void ConfigMgr::Load(QString filename) { variable->measuring_max = scaling["measuring_max"].toInt(); variable->scale_min = scaling["scale_min"].toInt(); variable->scale_max = scaling["scale_max"].toInt(); + QJsonArray freband_output_array = tmp_variable["freband_output"].toArray(); + for (int k = 0; k < freband_output_array.size(); ++k) { + QJsonObject freband_output = freband_output_array[k].toObject(); + FrequencybandOutput output; + output.enable = freband_output["enable"].toBool(); + output.start = freband_output["start"].toInt(); + output.end = freband_output["end"].toInt(); + variable->freband_output[k] = output; + } + vib_data->variables_.push_back(variable); + break; + } + case kVibVelocity:{ + std::shared_ptr variable = std::make_shared(); + // filter + QJsonArray filter_array = tmp_variable["filter"].toArray(); + for (int k = 0; k < filter_array.size(); k++) { + QJsonObject filter_ele = filter_array[k].toObject(); + variable->filter_[k].low = filter_ele["low"].toInt(); + variable->filter_[k].high = filter_ele["high"].toInt(); + variable->filter_[k].checked = filter_ele["checked"].toBool(); + } + variable->id_ = j + 1; + QJsonObject processed_output, general, alarm; + processed_output = tmp_variable["processed_output"].toObject(); + general = processed_output["general"].toObject(); + alarm = processed_output["alarm"].toObject(); + variable->general.output_used = general["output_used"].toBool(); + variable->general.engineering_unit = general["engieneering_unit"].toString(); + variable->general.rectifier_function = general["rectifier_function"].toString(); + variable->danger_high.level = alarm["danger_high_level"].toDouble(); + variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble(); + variable->danger_high.delay = alarm["danger_high_delay"].toInt(); + variable->danger_high.enable = alarm["danger_high_enable"].toBool(); + variable->danger_high.latch = alarm["danger_high_latch"].toBool(); + variable->alert_high.level = alarm["alert_high_level"].toDouble(); + variable->alert_high.hysteresis = alarm["alert_high_hysteresis"].toDouble(); + variable->alert_high.delay = alarm["alert_high_delay"].toInt(); + variable->alert_high.enable = alarm["alert_high_enable"].toBool(); + variable->alert_high.latch = alarm["alert_high_latch"].toBool(); + variable->danger_low.level = alarm["danger_low_level"].toDouble(); + variable->danger_low.hysteresis = alarm["danger_low_hysteresis"].toDouble(); + variable->danger_low.delay = alarm["danger_low_delay"].toInt(); + variable->danger_low.enable = alarm["danger_low_enable"].toBool(); + variable->danger_low.latch = alarm["danger_low_latch"].toBool(); + variable->alert_low.level = alarm["alert_low_level"].toDouble(); + variable->alert_low.hysteresis = alarm["alert_low_hysteresis"].toDouble(); + variable->alert_low.delay = alarm["alert_low_delay"].toInt(); + variable->alert_low.enable = alarm["alert_low_enable"].toBool(); + variable->alert_low.latch = alarm["alert_low_latch"].toBool(); vib_data->variables_.push_back(variable); break; } - case kVibVelocity: case kVibAcc: { std::shared_ptr variable = std::make_shared(); // filter @@ -640,39 +710,43 @@ void ConfigMgr::Load(QString filename) { variable->filter_[k].checked = filter_ele["checked"].toBool(); } variable->id_ = j + 1; - QJsonObject direct = tmp_variable["direct"].toObject(); - variable->direct_.full_scale_range = direct["full_scale_range"].toInt(); - variable->direct_.clamp_value = direct["clamp_value"].toDouble(); - variable->direct_.custom = direct["custom"].toDouble(); - QJsonObject x1 = tmp_variable["x1"].toObject(); - variable->x1_.checked = x1["checked"].toBool(); - variable->x1_.full_scale_range = x1["full_scale_range"].toInt(); - variable->x1_.clamp_value = x1["clamp_value"].toDouble(); - variable->x1_.custom = x1["custom"].toDouble(); - variable->x1_.phase_lag = x1["phase_lag"].toInt(); - QJsonObject x2 = tmp_variable["x2"].toObject(); - variable->x2_.checked = x2["checked"].toBool(); - variable->x2_.full_scale_range = x2["full_scale_range"].toInt(); - variable->x2_.clamp_value = x2["clamp_value"].toDouble(); - variable->x2_.custom = x2["custom"].toDouble(); - variable->x2_.phase_lag = x2["phase_lag"].toInt(); - QJsonObject rms_integrate = tmp_variable["rms_integrate"].toObject(); - variable->rms_active_ = rms_integrate["rms_active"].toBool(); - variable->integrate_active_ = rms_integrate["integrate_active"].toBool(); - QJsonObject recorder_out = tmp_variable["recorder_out"].toObject(); - variable->recorder_out_.recorder_output = recorder_out["recorder_output"].toInt(); - variable->recorder_out_.two_ma_clamp = recorder_out["two_ma_clamp"].toBool(); - variable->recorder_out_.trip_multiply = recorder_out["trip_multiply"].toDouble(); - variable->recorder_out_.comparision = recorder_out["comparision"].toInt(); - variable->recorder_out_.percentage = recorder_out["percentage"].toInt(); - QJsonObject delay = tmp_variable["delay"].toObject(); - variable->delay_.alert = delay["alert"].toInt(); - variable->delay_.danger = delay["danger"].toDouble(); - variable->delay_.active_100ms = delay["active_100ms"].toBool(); - QJsonObject latching = tmp_variable["latching"].toObject(); - variable->alert_latching_ = latching["alert"].toBool(); - variable->danger_latching_ = latching["danger"].toBool(); - variable->timed_ok_ = latching["timed_ok"].toBool(); + QJsonObject processed_output, general, alarm; + processed_output = tmp_variable["processed_output"].toObject(); + general = processed_output["general"].toObject(); + alarm = processed_output["alarm"].toObject(); + variable->general.output_used = general["output_used"].toBool(); + variable->general.engineering_unit = general["engieneering_unit"].toString(); + variable->general.rectifier_function = general["rectifier_function"].toString(); + variable->danger_high.level = alarm["danger_high_level"].toDouble(); + variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble(); + variable->danger_high.delay = alarm["danger_high_delay"].toInt(); + variable->danger_high.enable = alarm["danger_high_enable"].toBool(); + variable->danger_high.latch = alarm["danger_high_latch"].toBool(); + variable->alert_high.level = alarm["alert_high_level"].toDouble(); + variable->alert_high.hysteresis = alarm["alert_high_hysteresis"].toDouble(); + variable->alert_high.delay = alarm["alert_high_delay"].toInt(); + variable->alert_high.enable = alarm["alert_high_enable"].toBool(); + variable->alert_high.latch = alarm["alert_high_latch"].toBool(); + variable->danger_low.level = alarm["danger_low_level"].toDouble(); + variable->danger_low.hysteresis = alarm["danger_low_hysteresis"].toDouble(); + variable->danger_low.delay = alarm["danger_low_delay"].toInt(); + variable->danger_low.enable = alarm["danger_low_enable"].toBool(); + variable->danger_low.latch = alarm["danger_low_latch"].toBool(); + variable->alert_low.level = alarm["alert_low_level"].toDouble(); + variable->alert_low.hysteresis = alarm["alert_low_hysteresis"].toDouble(); + variable->alert_low.delay = alarm["alert_low_delay"].toInt(); + variable->alert_low.enable = alarm["alert_low_enable"].toBool(); + variable->alert_low.latch = alarm["alert_low_latch"].toBool(); + + QJsonArray freband_output_array = tmp_variable["freband_output"].toArray(); + for (int k = 0; k < freband_output_array.size(); ++k) { + QJsonObject freband_output = freband_output_array[k].toObject(); + FrequencybandOutput output; + output.enable = freband_output["enable"].toBool(); + output.start = freband_output["start"].toInt(); + output.end = freband_output["end"].toInt(); + variable->freband_output[k] = output; + } vib_data->variables_.push_back(variable); break; } diff --git a/mainwindow.cpp b/mainwindow.cpp index 0820363..e71af28 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -10,7 +10,6 @@ #include "singlerelay.h" #include "tachometer.h" #include "seismic_monitor.h" -#include "setpoint.h" #include #include #include @@ -476,9 +475,9 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) { case kCardVibSingle:{ QString object_name = slot_btn->objectName(); int button_id = object_name.right(object_name.length() - 15).toInt(); - Setpoint *setpoint = new Setpoint(button_id,ConfigMgr::Instance()->card_type_[button_id - 1]); - setpoint->setWindowModality(Qt::ApplicationModal); - setpoint->show(); + // Setpoint *setpoint = new Setpoint(button_id,ConfigMgr::Instance()->card_type_[button_id - 1]); + // setpoint->setWindowModality(Qt::ApplicationModal); + // setpoint->show(); break; } case kCardSpeedSingle:{ diff --git a/setpoint.cpp b/setpoint.cpp deleted file mode 100644 index a9cdd04..0000000 --- a/setpoint.cpp +++ /dev/null @@ -1,482 +0,0 @@ -#include "setpoint.h" -#include "ui_setpoint.h" -#include "config_mgr.h" -#include -#include "displacement_ds.h" -#include "acceleration_ds.h" -#include "velocity_ds.h" -#include -#include - -Setpoint::Setpoint(int slot_no_,int cardtype,QWidget *parent) : - QWidget(parent), - ui(new Ui::Setpoint) -{ - ui->setupUi(this); - slot_no = slot_no_; - car_type = static_cast(cardtype); - ui->label_slot->setText(QString::number(slot_no)); - ui->comboBox_chan->setView(new QListView()); - ui->comboBox_danger->setView(new QListView()); - Init(); - connect(ui->comboBox_chan, QOverload::of(&QComboBox::currentIndexChanged), - this, &Setpoint::onComboBoxIndexChanged); - current_index = ui->comboBox_chan->currentIndex(); -} - -Setpoint::~Setpoint() -{ - if(slider_1st != nullptr) - delete slider_1st; - if(slider_2nd != nullptr) - delete slider_2nd; - if(slider_3rd != nullptr) - delete slider_3rd; - if(slider_danger != nullptr) - delete slider_danger; - delete ui; -} -void Setpoint::Init(){ - - QVBoxLayout *layout_direct = new QVBoxLayout(ui->widget_direct); - slider_1st = new RangeSlider; - layout_direct->addWidget(slider_1st); - - QVBoxLayout *layout_1x_ampl = new QVBoxLayout(ui->widget_1x_ampl); - slider_2nd = new RangeSlider; - layout_1x_ampl->addWidget(slider_2nd); - - QVBoxLayout *layout_2x_ampl = new QVBoxLayout(ui->widget_2x_ampl); - slider_3rd = new RangeSlider; - layout_2x_ampl->addWidget(slider_3rd); - - QVBoxLayout *layout_danger = new QVBoxLayout(ui->widget_danger); - slider_danger = new RangeSlider(1); - layout_danger->addWidget(slider_danger); - - std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); - - switch (car_type) { - case kCardVibSingle:{ - update(); - }break; - } - QObject::connect(ui->lineEdit_1st_upper, &QLineEdit::editingFinished, [&]() { - slider_1st->setUpperValue(ui->lineEdit_1st_upper->text().toFloat()); - }); - QObject::connect(slider_1st, &RangeSlider::rangeChanged, [&](float low,float high) { - ui->lineEdit_1st_upper->setText(QString::number(high)); - }); - - QObject::connect(slider_2nd, &RangeSlider::rangeChanged, [&](float low, float high) { - ui->lineEdit_2nd_upper->setText(QString::number(high)); - ui->lineEdit_2nd_lower->setText(QString::number(low)); - }); - QObject::connect(ui->lineEdit_2nd_upper, &QLineEdit::editingFinished, [&]() { - slider_2nd->setUpperValue(ui->lineEdit_2nd_upper->text().toFloat()); - }); - QObject::connect(ui->lineEdit_2nd_lower, &QLineEdit::editingFinished, [&]() { - slider_2nd->setLowerValue(ui->lineEdit_2nd_lower->text().toFloat()); - }); - - QObject::connect(slider_3rd, &RangeSlider::rangeChanged, [&](float low, float high) { - ui->lineEdit_3rd_upper->setText(QString::number(high)); - ui->lineEdit_3rd_lower->setText(QString::number(low)); - }); - QObject::connect(ui->lineEdit_3rd_upper, &QLineEdit::editingFinished, [&]() { - slider_2nd->setUpperValue(ui->lineEdit_3rd_upper->text().toFloat()); - }); - QObject::connect(ui->lineEdit_3rd_lower, &QLineEdit::editingFinished, [&]() { - slider_2nd->setLowerValue(ui->lineEdit_3rd_lower->text().toFloat()); - }); - - QObject::connect(slider_danger, &RangeSlider::rangeChanged, [&](float low,float high) { - ui->lineEdit_danger_upper->setText(QString::number(high)); - }); - QObject::connect(ui->lineEdit_danger_upper, &QLineEdit::editingFinished, [&]() { - slider_danger->setUpperValue(ui->lineEdit_danger_upper->text().toFloat()); - }); -} - -void Setpoint::on_pushButton_confirm_clicked() -{ - - std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); - std::shared_ptr setpoint_data = std::dynamic_pointer_cast(base_ptr); - if(setpoint_data->base_config_[current_index].channel_type == kVibPressurePulsation){ - setpoint_data->alert_danger_press[current_index].low_upper = ui->lineEdit_1st_upper->text().toFloat(); - setpoint_data->alert_danger_press[current_index].low_enable = ui->checkBox_1st->checkState(); - setpoint_data->alert_danger_press[current_index].mid1_upper = ui->lineEdit_2nd_upper->text().toFloat(); - setpoint_data->alert_danger_press[current_index].mid1_enable = ui->checkBox_2nd->checkState(); - setpoint_data->alert_danger_press[current_index].mid2_upper = ui->lineEdit_3rd_upper->text().toFloat(); - setpoint_data->alert_danger_press[current_index].mid2_enable = ui->checkBox_3rd->checkState(); - setpoint_data->alert_danger_press[current_index].danger_param = ui->comboBox_danger->currentIndex(); - setpoint_data->alert_danger_press[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat(); - setpoint_data->alert_danger_press[current_index].danger_enable = ui->checkBox_danger->checkState(); - }else{ - setpoint_data->alert_danger[current_index].direct_upper = ui->lineEdit_1st_upper->text().toFloat(); - setpoint_data->alert_danger[current_index].direct_enable = ui->checkBox_1st->checkState(); - setpoint_data->alert_danger[current_index].x1_ampl_upper = ui->lineEdit_2nd_upper->text().toFloat(); - setpoint_data->alert_danger[current_index].x1_ampl_lower = ui->lineEdit_2nd_lower->text().toFloat(); - setpoint_data->alert_danger[current_index].x1_ampl_enable = ui->checkBox_2nd->checkState(); - setpoint_data->alert_danger[current_index].x2_ampl_upper = ui->lineEdit_3rd_upper->text().toFloat(); - setpoint_data->alert_danger[current_index].x2_ampl_lower = ui->lineEdit_3rd_lower->text().toFloat(); - setpoint_data->alert_danger[current_index].x2_ampl_enable = ui->checkBox_3rd->checkState(); - setpoint_data->alert_danger[current_index].danger_param = ui->comboBox_danger->currentIndex(); - setpoint_data->alert_danger[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat(); - setpoint_data->alert_danger[current_index].danger_enable = ui->checkBox_danger->checkState(); - } - this->close(); -} - - -void Setpoint::on_pushButton_cancel_clicked() -{ - this->close(); -} - - -void Setpoint::on_pushButton_set_default_clicked() -{ - -} -void Setpoint::onComboBoxIndexChanged(int index){ - - std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); - std::shared_ptr setpoint_data = std::dynamic_pointer_cast(base_ptr); - if(setpoint_data->base_config_[current_index].channel_type == kVibPressurePulsation){ - setpoint_data->alert_danger_press[current_index].low_upper = ui->lineEdit_1st_upper->text().toFloat(); - setpoint_data->alert_danger_press[current_index].low_enable = ui->checkBox_1st->checkState(); - setpoint_data->alert_danger_press[current_index].mid1_upper = ui->lineEdit_2nd_upper->text().toFloat(); - setpoint_data->alert_danger_press[current_index].mid1_enable = ui->checkBox_2nd->checkState(); - setpoint_data->alert_danger_press[current_index].mid2_upper = ui->lineEdit_3rd_upper->text().toFloat(); - setpoint_data->alert_danger_press[current_index].mid2_enable = ui->checkBox_3rd->checkState(); - setpoint_data->alert_danger_press[current_index].danger_param = ui->comboBox_danger->currentIndex(); - setpoint_data->alert_danger_press[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat(); - setpoint_data->alert_danger_press[current_index].danger_enable = ui->checkBox_danger->checkState(); - }else{ - setpoint_data->alert_danger[current_index].direct_upper = ui->lineEdit_1st_upper->text().toFloat(); - setpoint_data->alert_danger[current_index].direct_enable = ui->checkBox_1st->checkState(); - setpoint_data->alert_danger[current_index].x1_ampl_upper = ui->lineEdit_2nd_upper->text().toFloat(); - setpoint_data->alert_danger[current_index].x1_ampl_lower = ui->lineEdit_2nd_lower->text().toFloat(); - setpoint_data->alert_danger[current_index].x1_ampl_enable = ui->checkBox_2nd->checkState(); - setpoint_data->alert_danger[current_index].x2_ampl_upper = ui->lineEdit_3rd_upper->text().toFloat(); - setpoint_data->alert_danger[current_index].x2_ampl_lower = ui->lineEdit_3rd_lower->text().toFloat(); - setpoint_data->alert_danger[current_index].x2_ampl_enable = ui->checkBox_3rd->checkState(); - setpoint_data->alert_danger[current_index].danger_param = ui->comboBox_danger->currentIndex(); - setpoint_data->alert_danger[current_index].danger_upper = ui->lineEdit_danger_upper->text().toFloat(); - setpoint_data->alert_danger[current_index].danger_enable = ui->checkBox_danger->checkState(); - } - current_index = index; - update(); - -} -void Setpoint::update() -{ - int chan = ui->comboBox_chan->currentIndex(); - std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); - std::shared_ptr setpoint_data = std::dynamic_pointer_cast(base_ptr); - std::vector> variable_ = setpoint_data->variables_; - if(variable_.size() <= 0 ) - { - QMessageBox::information(this, QStringLiteral("提示"), "请先配置完通道参数!"); - return; - } - if(!variable_[chan]->x1_.checked){ - ui->checkBox_1st->setEnabled(false); - ui->lineEdit_2nd_lower->setEnabled(false); - ui->lineEdit_2nd_upper->setEnabled(false); - } - if(!variable_[chan]->x2_.checked){ - ui->checkBox_2nd->setEnabled(false); - ui->lineEdit_3rd_upper->setEnabled(false); - ui->lineEdit_3rd_lower->setEnabled(false); - } - if(setpoint_data->base_config_[chan].channel_type == kVibRadial){ - EnableNormal(); - ShowSlider(); - if(variable_[chan]->direct_.full_scale_range == 0){ - slider_1st->setRange(0,100); - slider_danger->setRange(0,100); - }else if(variable_[chan]->direct_.full_scale_range == 1){ - slider_1st->setRange(0,150); - slider_danger->setRange(0,150); - }else if(variable_[chan]->direct_.full_scale_range == 2){ - slider_1st->setRange(0,200); - slider_danger->setRange(0,200); - }else if(variable_[chan]->direct_.full_scale_range == 3){ - slider_1st->setRange(0,400); - slider_danger->setRange(0,400); - }else if(variable_[chan]->direct_.full_scale_range == 4){ - slider_1st->setRange(0,500); - slider_danger->setRange(0,500); - } - ui->label_unit_1st->setText("um"); - ui->label_danger->setText("um"); - - } - if(setpoint_data->base_config_[chan].channel_type == kVibThrust){ - EnableNormal(); - ui->label_2nd->hide(); - ui->label_unit_2nd->hide(); - ui->lineEdit_2nd_upper->hide(); - ui->widget_1x_ampl->hide(); - ui->lineEdit_2nd_lower->hide(); - ui->checkBox_2nd->hide(); - ui->label_3rd->hide(); - ui->label_unit_3rd->hide(); - ui->lineEdit_3rd_upper->hide(); - ui->widget_2x_ampl->hide(); - ui->lineEdit_3rd_lower->hide(); - ui->checkBox_3rd->hide(); - ui->label_unit_1st->setText("mil"); - ui->label_danger->setText("mil"); - if(variable_[chan]->direct_.full_scale_range == 0){ - slider_1st->setRange(-25,25); - slider_danger->setRange(-25,25); - }else if(variable_[chan]->direct_.full_scale_range == 1){ - slider_1st->setRange(-30,30); - slider_danger->setRange(-30,30); - }else if(variable_[chan]->direct_.full_scale_range == 2){ - slider_1st->setRange(-40,40); - slider_danger->setRange(-40,40); - }else if(variable_[chan]->direct_.full_scale_range == 3){ - ui->label_unit_1st->setText("mm"); - ui->label_danger->setText("mm"); - slider_1st->setRange(-0.5,0.5); - slider_danger->setRange(-0.5,0.5); - }else if(variable_[chan]->direct_.full_scale_range == 4){ - ui->label_unit_1st->setText("mm"); - ui->label_danger->setText("mm"); - slider_1st->setRange(-1,1); - slider_danger->setRange(-1,1); - } - } - if(setpoint_data->base_config_[chan].channel_type == kVibAcc){ - EnableNormal(); - ShowSlider(); - std::shared_ptr base_channel_ptr = setpoint_data->GetChannelPtr(chan + 1); - std::shared_ptr av_ptr = std::dynamic_pointer_cast(base_channel_ptr); - if(variable_[chan]->direct_.full_scale_range == 0){ - slider_1st->setRange(0,20); - slider_danger->setRange(0,20); - }else if(variable_[chan]->direct_.full_scale_range == 1){ - slider_1st->setRange(0,50); - slider_danger->setRange(0,50); - }else if(variable_[chan]->direct_.full_scale_range == 2){ - slider_1st->setRange(0,100); - slider_danger->setRange(0,100); - }else if(variable_[chan]->direct_.full_scale_range == 3){ - slider_1st->setRange(0,200); - slider_danger->setRange(0,200); - }else if(variable_[chan]->direct_.full_scale_range == 4){ - slider_1st->setRange(0,250); - slider_danger->setRange(0,250); - }else if(variable_[chan]->direct_.full_scale_range == 5){ - slider_1st->setRange(0,400); - slider_danger->setRange(0,400); - } - ui->label_unit_1st->setText("m/s^2 pk"); - ui->label_danger->setText("m/s^2 pk"); - - if(av_ptr->rms_active_){ - if(variable_[chan]->direct_.full_scale_range == 0){ - slider_1st->setRange(0,20); - slider_danger->setRange(0,20); - }else if(variable_[chan]->direct_.full_scale_range == 1){ - slider_1st->setRange(0,50); - slider_danger->setRange(0,50); - }else if(variable_[chan]->direct_.full_scale_range == 2){ - slider_1st->setRange(0,100); - slider_danger->setRange(0,100); - }else if(variable_[chan]->direct_.full_scale_range == 3){ - slider_1st->setRange(0,200); - slider_danger->setRange(0,200); - } - ui->label_unit_1st->setText("m/s^2 rms"); - ui->label_danger->setText("m/s^2 rms"); - } - - if(av_ptr->integrate_active_){ - if(variable_[chan]->direct_.full_scale_range == 0){ - slider_1st->setRange(0,25); - slider_danger->setRange(0,25); - }else if(variable_[chan]->direct_.full_scale_range == 1){ - slider_1st->setRange(0,50); - slider_danger->setRange(0,50); - }else if(variable_[chan]->direct_.full_scale_range == 2){ - slider_1st->setRange(0,100); - slider_danger->setRange(0,100); - } - ui->label_unit_1st->setText("mm/s pk"); - ui->label_danger->setText("mm/s pk"); - } - - if(av_ptr->rms_active_ && av_ptr->integrate_active_){ - if(variable_[chan]->direct_.full_scale_range == 0){ - slider_1st->setRange(0,25); - slider_danger->setRange(0,25); - }else if(variable_[chan]->direct_.full_scale_range == 1){ - slider_1st->setRange(0,50); - slider_danger->setRange(0,50); - } - ui->label_unit_1st->setText("mm/s rms"); - ui->label_danger->setText("mm/s rms"); - } - - } - if(setpoint_data->base_config_[chan].channel_type == kVibVelocity){ - EnableNormal(); - ShowSlider(); - std::shared_ptr base_channel_ptr = setpoint_data->GetChannelPtr(chan + 1); - std::shared_ptr av_ptr = std::dynamic_pointer_cast(base_channel_ptr); - - if(variable_[chan]->direct_.full_scale_range == 0){ - slider_1st->setRange(0,10); - slider_danger->setRange(0,10); - }else if(variable_[chan]->direct_.full_scale_range == 1){ - slider_1st->setRange(0,20); - slider_danger->setRange(0,20); - }else if(variable_[chan]->direct_.full_scale_range == 2){ - slider_1st->setRange(0,50); - slider_danger->setRange(0,50); - } - ui->label_unit_1st->setText("mm/s pk"); - ui->label_danger->setText("mm/s pk"); - - if(av_ptr->rms_active_){ - if(variable_[chan]->direct_.full_scale_range == 0){ - slider_1st->setRange(0,10); - slider_danger->setRange(0,10); - }else if(variable_[chan]->direct_.full_scale_range == 1){ - slider_1st->setRange(0,20); - slider_danger->setRange(0,20); - }else if(variable_[chan]->direct_.full_scale_range == 2){ - slider_1st->setRange(0,50); - slider_danger->setRange(0,50); - } - ui->label_unit_1st->setText("mm/s rms"); - ui->label_danger->setText("mm/s rms"); - } - - if(av_ptr->integrate_active_){ - if(variable_[chan]->direct_.full_scale_range == 0){ - slider_1st->setRange(0,100); - slider_danger->setRange(0,100); - }else if(variable_[chan]->direct_.full_scale_range == 1){ - slider_1st->setRange(0,200); - slider_danger->setRange(0,200); - }else if(variable_[chan]->direct_.full_scale_range == 2){ - slider_1st->setRange(0,500); - slider_danger->setRange(0,500); - } - ui->label_unit_1st->setText("um pp"); - ui->label_danger->setText("um pp"); - } - } - if(setpoint_data->base_config_[chan].channel_type == kVibPressurePulsation){ - ShowSlider(); - ui->label_1st->setText("低频段"); - ui->label_2nd->setText("中1频段"); - ui->label_3rd->setText("中2频段"); - ui->comboBox_danger->clear(); - ui->comboBox_danger->addItem("全频段"); - ui->checkBox_1st->setEnabled(true); - ui->checkBox_2nd->setEnabled(true); - ui->checkBox_3rd->setEnabled(true); - ui->lineEdit_2nd_lower->hide(); - ui->lineEdit_2nd_upper->setEnabled(true); - ui->lineEdit_3rd_lower->hide(); - ui->lineEdit_3rd_upper->setEnabled(true); - ui->label_unit_1st->setText("kPa"); - ui->label_unit_2nd->setText("kPa"); - ui->label_unit_3rd->setText("kPa"); - ui->label_danger->setText("kPa"); - slider_1st->setRange(0,10); - slider_2nd->setRange(0,10); - slider_3rd->setRange(0,10); - slider_danger->setRange(0,40); - ui->lineEdit_1st_upper->setText(QString::number(setpoint_data->alert_danger_press[chan].low_upper)); - ui->checkBox_1st->setChecked(setpoint_data->alert_danger_press[chan].low_enable); - if(setpoint_data->alert_danger_press[chan].low_upper > 0){ - slider_1st->m_upper = setpoint_data->alert_danger_press[chan].low_upper; - slider_1st->m_lower = 0; - } - - ui->lineEdit_2nd_upper->setText(QString::number(setpoint_data->alert_danger_press[chan].mid1_upper)); - ui->checkBox_2nd->setChecked(setpoint_data->alert_danger_press[chan].mid1_enable); - if(setpoint_data->alert_danger_press[chan].mid1_upper > 0){ - slider_2nd->m_upper = setpoint_data->alert_danger_press[chan].mid1_upper; - slider_2nd->m_lower = 0; - } - ui->lineEdit_3rd_upper->setText(QString::number(setpoint_data->alert_danger_press[chan].mid2_upper)); - ui->checkBox_3rd->setChecked(setpoint_data->alert_danger_press[chan].mid2_enable); - if(setpoint_data->alert_danger_press[chan].mid2_upper > 0){ - slider_3rd->m_upper = setpoint_data->alert_danger_press[chan].mid2_upper; - slider_3rd->m_lower = 0; - } - ui->lineEdit_danger_upper->setText(QString::number(setpoint_data->alert_danger_press[chan].danger_upper)); - ui->checkBox_danger->setChecked(setpoint_data->alert_danger_press[chan].danger_enable); - if(setpoint_data->alert_danger_press[chan].danger_upper > 0){ - slider_danger->m_upper = setpoint_data->alert_danger_press[chan].danger_upper; - slider_danger->m_lower = 0; - } - }else{ - ui->lineEdit_1st_upper->setText(QString::number(setpoint_data->alert_danger[chan].direct_upper)); - ui->checkBox_1st->setChecked(setpoint_data->alert_danger[chan].direct_enable); - if(setpoint_data->alert_danger[chan].direct_upper > 0){ - slider_1st->m_upper = setpoint_data->alert_danger[chan].direct_upper; - slider_1st->m_lower = 0; - } - ui->lineEdit_2nd_upper->setText(QString::number(setpoint_data->alert_danger[chan].x1_ampl_upper)); - ui->lineEdit_2nd_lower->setText(QString::number(setpoint_data->alert_danger[chan].x1_ampl_lower)); - ui->checkBox_2nd->setChecked(setpoint_data->alert_danger[chan].x1_ampl_enable); - if(setpoint_data->alert_danger[chan].x1_ampl_upper > 0 && setpoint_data->alert_danger[chan].x1_ampl_lower > 0){ - slider_2nd->m_upper = setpoint_data->alert_danger[chan].x1_ampl_upper; - slider_2nd->m_lower = setpoint_data->alert_danger[chan].x1_ampl_lower; - } - ui->lineEdit_3rd_upper->setText(QString::number(setpoint_data->alert_danger[chan].x2_ampl_upper)); - ui->lineEdit_3rd_lower->setText(QString::number(setpoint_data->alert_danger[chan].x2_ampl_lower)); - ui->checkBox_3rd->setChecked(setpoint_data->alert_danger[chan].x2_ampl_enable); - if(setpoint_data->alert_danger[chan].x2_ampl_upper > 0 && setpoint_data->alert_danger[chan].x2_ampl_lower > 0){ - slider_3rd->m_upper = setpoint_data->alert_danger[chan].x2_ampl_upper; - slider_3rd->m_lower = setpoint_data->alert_danger[chan].x2_ampl_lower; - } - ui->lineEdit_danger_upper->setText(QString::number(setpoint_data->alert_danger[chan].danger_upper)); - ui->checkBox_danger->setChecked(setpoint_data->alert_danger[chan].danger_enable); - if(setpoint_data->alert_danger[chan].danger_upper > 0){ - slider_danger->m_upper = setpoint_data->alert_danger[chan].danger_upper; - slider_danger->m_lower = 0; - } - } -} - - -void Setpoint::EnableNormal(){ - ui->label_1st->setText("直接值"); - ui->label_2nd->setText("1倍频幅值"); - ui->label_3rd->setText("2倍频幅值"); - ui->comboBox_danger->clear(); - QStringList items = {"直接值", "1倍频幅值", "2倍频幅值"}; - ui->comboBox_danger->addItems(items); - ui->checkBox_2nd->setChecked(false); - ui->checkBox_3rd->setChecked(false); - ui->label_unit_2nd->setText("- -"); - ui->label_unit_3rd->setText("- -"); -} - -void Setpoint::ShowSlider(){ - ui->label_2nd->show(); - ui->label_unit_2nd->show(); - ui->lineEdit_2nd_upper->show(); - ui->widget_1x_ampl->show(); - ui->lineEdit_2nd_lower->show(); - ui->checkBox_1st->show(); - - ui->label_3rd->show(); - ui->label_unit_3rd->show(); - ui->lineEdit_3rd_upper->show(); - ui->widget_2x_ampl->show(); - ui->lineEdit_3rd_lower->show(); - ui->checkBox_2nd->show(); -} diff --git a/setpoint.h b/setpoint.h deleted file mode 100644 index b83af7d..0000000 --- a/setpoint.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef SETPOINT_H -#define SETPOINT_H - -#include -#include "data_config.h" -#include "rangeslider.h" -#include "vibrationdata.h" - -namespace Ui { -class Setpoint; -} - -class Setpoint : public QWidget -{ - Q_OBJECT - -public: - explicit Setpoint(int slot_no_,int cardtype,QWidget *parent = nullptr); - ~Setpoint(); - int slot_no; - CardType car_type; -private slots: - void on_pushButton_confirm_clicked(); - - void on_pushButton_cancel_clicked(); - - void on_pushButton_set_default_clicked(); - - void onComboBoxIndexChanged(int index); - -private: - Ui::Setpoint *ui; - RangeSlider *slider_1st; - RangeSlider *slider_2nd; - RangeSlider *slider_3rd; - RangeSlider *slider_danger; - int current_index; - void Init(); - void update(); - void EnbalePressurePulsation(); - void EnableNormal(); - void ShowSlider(); -}; - -#endif // SETPOINT_H diff --git a/setpoint.ui b/setpoint.ui deleted file mode 100644 index 359ecac..0000000 --- a/setpoint.ui +++ /dev/null @@ -1,620 +0,0 @@ - - - Setpoint - - - - 0 - 0 - 734 - 528 - - - - 触发配置 - - - - - 540 - 10 - 161 - 451 - - - - 危险 / 警报 2 - - - - - 20 - 30 - 69 - 22 - - - - - 直接值 - - - - - 1倍频幅值 - - - - - 2倍频幅值 - - - - - - - 30 - 60 - 50 - 20 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - - - - - - Qt::AlignCenter - - - - - - 30 - 415 - 47 - 16 - - - - 启用 - - - false - - - - - - 30 - 90 - 50 - 20 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - - - - 10 - 116 - 100 - 260 - - - - - 100 - 260 - - - - - 100 - 260 - - - - - - - - 20 - 480 - 666 - 37 - - - - - - - 槽位号 - - - - - - - slot - - - - - - - - 通道 1 - - - - - 通道 2 - - - - - 通道 3 - - - - - 通道 4 - - - - - - - - - 100 - 35 - - - - 确定 - - - - - - - false - - - - 100 - 35 - - - - 设置为默认值 - - - - - - - - 100 - 35 - - - - 取消 - - - - - - - false - - - - 100 - 35 - - - - 打印 - - - - - - - false - - - - 100 - 35 - - - - 帮助 - - - - - - - - - 10 - 10 - 521 - 451 - - - - 告警 / 警报 1 - - - - - 100 - 110 - 100 - 260 - - - - - 100 - 260 - - - - - 100 - 260 - - - - - - - 121 - 41 - 54 - 16 - - - - 1倍频幅值 - - - - - - 121 - 77 - 50 - 20 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - - - - 130 - 59 - 50 - 16 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - - - - - - - - - 120 - 380 - 50 - 20 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - - - - 121 - 420 - 47 - 16 - - - - 启用 - - - - - - 221 - 420 - 47 - 16 - - - - 启用 - - - - - - 221 - 41 - 54 - 16 - - - - 2倍频幅值 - - - - - - 230 - 59 - 50 - 16 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - - - - - - - - - 221 - 77 - 50 - 20 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - - - - 200 - 110 - 100 - 260 - - - - - 100 - 260 - - - - - 100 - 260 - - - - - - - 220 - 380 - 50 - 20 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - - - - 30 - 80 - 50 - 20 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - Qt::AlignCenter - - - - - - 10 - 107 - 100 - 260 - - - - - 100 - 260 - - - - - 100 - 260 - - - - - - - 40 - 40 - 36 - 16 - - - - 直接值 - - - Qt::AlignCenter - - - - - - 25 - 60 - 50 - 20 - - - - - 50 - 0 - - - - - 50 - 16777215 - - - - - - - - - Qt::AlignCenter - - - - - - 30 - 420 - 65 - 16 - - - - 启用 - - - - - - - From 3af645f080afbabba3512b8059c745848d64b669 Mon Sep 17 00:00:00 2001 From: "DESKTOP-7I8SUIC\\zhang" Date: Tue, 29 Jul 2025 10:05:11 +0800 Subject: [PATCH 05/14] add codes --- acceleration.cpp | 39 +++-- acceleration.ui | 6 +- config_mgr.cpp | 375 ++++++++++++++++++++++++++---------------- data_config.h | 2 + pressure_pulsation.ui | 2 +- radial_vibration.cpp | 72 +++++--- radial_vibration.ui | 8 +- seismic_monitor.cpp | 16 ++ seismic_monitor.ui | 82 ++++----- trust.cpp | 133 ++++++++------- trust.ui | 8 +- velocity.cpp | 39 +++-- velocity.ui | 4 +- 13 files changed, 488 insertions(+), 298 deletions(-) diff --git a/acceleration.cpp b/acceleration.cpp index ac9ad99..76c8bc3 100644 --- a/acceleration.cpp +++ b/acceleration.cpp @@ -65,30 +65,33 @@ void Acceleration::Init() { ui->comboBox_output_used->setCurrentIndex(0); else ui->comboBox_output_used->setCurrentIndex(1); + ui->comboBox_engineering_unit->setCurrentText(variable_ptr->general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->general.rectifier_function); // -alarm ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); - ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.level)); - ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); + ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.delay)); ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable); ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch); ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level)); - ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.level)); - ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.hysteresis)); + ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.delay)); ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable); ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch); ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.hysteresis)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.delay)); ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); - ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); - ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); - ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->alert_low.level)); + ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->alert_low.hysteresis)); + ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->alert_low.delay)); + ui->checkBox_alert_low_enable->setChecked(variable_ptr->alert_low.enable); + ui->checkBox_alert_low_latch->setChecked(variable_ptr->alert_low.latch); + // ui->checkBox_enable->setChecked(variable_ptr->freband_output[0].enable); ui->lineEdit_start->setText(QString::number(variable_ptr->freband_output[0].start)); @@ -157,6 +160,8 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -173,6 +178,11 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); // -freband output variable->freband_output[0].enable = ui->checkBox_enable->isChecked(); variable->freband_output[0].start = ui->lineEdit_start->text().toDouble(); @@ -224,6 +234,8 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -240,6 +252,11 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); // -freband output variable->freband_output[0].enable = ui->checkBox_enable->isChecked(); variable->freband_output[0].start = ui->lineEdit_start->text().toDouble(); diff --git a/acceleration.ui b/acceleration.ui index 3397641..fab8d3e 100644 --- a/acceleration.ui +++ b/acceleration.ui @@ -107,7 +107,7 @@ - 2 + 1 @@ -739,7 +739,7 @@ - + 80 @@ -759,7 +759,7 @@ - + 80 diff --git a/config_mgr.cpp b/config_mgr.cpp index c33a65d..61b6a31 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -58,52 +58,55 @@ void ConfigMgr::Save(QString & file_path) { std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); channel_item["standby"] = ptr->base_config_[cid].standby; channel_item["active"] = ptr->base_config_[cid].active; - channel_item["rack_type"] = 0; // TODO: +// channel_item["rack_type"] = 0; // TODO: channel_item["channel_type"] = ptr->base_config_[cid].channel_type; - channel_item["transducer_id"] = ptr->base_config_[cid].transducer_id; - channel_item["scale_factor"] = ptr->base_config_[cid].scale_factor; - channel_item["sampling_rate"] = ptr->base_config_[cid].sampling_rate; +// channel_item["transducer_id"] = ptr->base_config_[cid].transducer_id; +// channel_item["scale_factor"] = ptr->base_config_[cid].scale_factor; +// channel_item["sampling_rate"] = ptr->base_config_[cid].sampling_rate; channel_item["power"] = ptr->base_config_[cid].power; channel_item["point_name"] = ptr->base_config_[cid].point_name; channel_item["chan_id"] = ptr->base_config_[cid].chan_id; + channel_item["sensitivity_unit"] = ptr->base_config_[cid].sensitivity_unit; + channel_item["signal_sensitivity"] = ptr->base_config_[cid].signal_sensitivity; + QJsonArray voltage_range; voltage_range.append(ptr->base_config_[cid].normal_voltage_low); voltage_range.append(ptr->base_config_[cid].normal_voltage_high); channel_item["normal_voltage_range"] = voltage_range; - QJsonObject setpoint_data; - if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust || - ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){ - if(ptr->base_config_[cid].channel_type != kVibThrust){ - setpoint_data["1x_ampl_upper"] = qRound(ptr->alert_danger[cid].x1_ampl_upper * 10)/10.0; - setpoint_data["1x_ampl_lower"] = qRound(ptr->alert_danger[cid].x1_ampl_lower * 10)/10.0; - setpoint_data["1x_ampl_enable"] = ptr->alert_danger[cid].x1_ampl_enable; - setpoint_data["2x_ampl_upper"] = qRound(ptr->alert_danger[cid].x2_ampl_upper * 10)/10.0; - setpoint_data["2x_ampl_lower"] = qRound(ptr->alert_danger[cid].x2_ampl_lower * 10)/10.0; - setpoint_data["2x_ampl_enable"] = ptr->alert_danger[cid].x2_ampl_enable; - channel_item["keyphase"] = ptr->base_config_[cid].keyphase; - channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot; - channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch; - } - setpoint_data["direct_upper"] = qRound(ptr->alert_danger[cid].direct_upper * 10)/10.0; - setpoint_data["direct_enable"] = ptr->alert_danger[cid].direct_enable; - setpoint_data["danger_param"] = ptr->alert_danger[cid].danger_param; - setpoint_data["danger_upper"] = qRound(ptr->alert_danger[cid].danger_upper * 10)/10.0; - setpoint_data["danger_enable"] = ptr->alert_danger[cid].danger_enable; +// QJsonObject setpoint_data; +// if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust || +// ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){ +// if(ptr->base_config_[cid].channel_type != kVibThrust){ +// setpoint_data["1x_ampl_upper"] = qRound(ptr->alert_danger[cid].x1_ampl_upper * 10)/10.0; +// setpoint_data["1x_ampl_lower"] = qRound(ptr->alert_danger[cid].x1_ampl_lower * 10)/10.0; +// setpoint_data["1x_ampl_enable"] = ptr->alert_danger[cid].x1_ampl_enable; +// setpoint_data["2x_ampl_upper"] = qRound(ptr->alert_danger[cid].x2_ampl_upper * 10)/10.0; +// setpoint_data["2x_ampl_lower"] = qRound(ptr->alert_danger[cid].x2_ampl_lower * 10)/10.0; +// setpoint_data["2x_ampl_enable"] = ptr->alert_danger[cid].x2_ampl_enable; +// channel_item["keyphase"] = ptr->base_config_[cid].keyphase; +// channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot; +// channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch; +// } +// setpoint_data["direct_upper"] = qRound(ptr->alert_danger[cid].direct_upper * 10)/10.0; +// setpoint_data["direct_enable"] = ptr->alert_danger[cid].direct_enable; +// setpoint_data["danger_param"] = ptr->alert_danger[cid].danger_param; +// setpoint_data["danger_upper"] = qRound(ptr->alert_danger[cid].danger_upper * 10)/10.0; +// setpoint_data["danger_enable"] = ptr->alert_danger[cid].danger_enable; - } - if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){ - setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0; - setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable; - setpoint_data["mid1_upper"] = qRound(ptr->alert_danger_press[cid].mid1_upper * 10)/10.0; - setpoint_data["mid1_enable"] = ptr->alert_danger_press[cid].mid1_enable; - setpoint_data["mid2_upper"] = qRound(ptr->alert_danger_press[cid].mid2_upper * 10)/10.0; - setpoint_data["mid2_enable"] = ptr->alert_danger_press[cid].mid2_enable; - setpoint_data["danger_param"] = ptr->alert_danger_press[cid].danger_param; - setpoint_data["danger_upper"] = qRound(ptr->alert_danger_press[cid].danger_upper * 10)/10.0; - setpoint_data["danger_enable"] = ptr->alert_danger_press[cid].danger_enable; - } - channel_item["setpoint"] = setpoint_data; +// } +// if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){ +// setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0; +// setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable; +// setpoint_data["mid1_upper"] = qRound(ptr->alert_danger_press[cid].mid1_upper * 10)/10.0; +// setpoint_data["mid1_enable"] = ptr->alert_danger_press[cid].mid1_enable; +// setpoint_data["mid2_upper"] = qRound(ptr->alert_danger_press[cid].mid2_upper * 10)/10.0; +// setpoint_data["mid2_enable"] = ptr->alert_danger_press[cid].mid2_enable; +// setpoint_data["danger_param"] = ptr->alert_danger_press[cid].danger_param; +// setpoint_data["danger_upper"] = qRound(ptr->alert_danger_press[cid].danger_upper * 10)/10.0; +// setpoint_data["danger_enable"] = ptr->alert_danger_press[cid].danger_enable; +// } +// channel_item["setpoint"] = setpoint_data; // variables QJsonObject variables; std::shared_ptr base_channel_ptr = ptr->GetChannelPtr(cid + 1); @@ -154,6 +157,11 @@ void ConfigMgr::Save(QString & file_path) { alarm["danger_low_delay"] = radial_ptr->danger_low.delay; alarm["danger_low_enable"] = radial_ptr->danger_low.enable; alarm["danger_low_latch"] = radial_ptr->danger_low.latch; + alarm["alert_low_level"] = radial_ptr->alert_low.level; + alarm["alert_low_hysteresis"] = radial_ptr->alert_low.hysteresis; + alarm["alert_low_delay"] = radial_ptr->alert_low.delay; + alarm["alert_low_enable"] = radial_ptr->alert_low.enable; + alarm["alert_low_latch"] = radial_ptr->alert_low.latch; measurement["general"] = general; measurement["alarm"] = alarm; variables["measurement"] = measurement; @@ -178,6 +186,11 @@ void ConfigMgr::Save(QString & file_path) { gap_alarm["danger_low_delay"] = radial_ptr->gap_danger_low.delay; gap_alarm["danger_low_enable"] = radial_ptr->gap_danger_low.enable; gap_alarm["danger_low_latch"] = radial_ptr->gap_danger_low.latch; + gap_alarm["alert_low_level"] = radial_ptr->gap_alert_low.level; + gap_alarm["alert_low_hysteresis"] = radial_ptr->gap_alert_low.hysteresis; + gap_alarm["alert_low_delay"] = radial_ptr->gap_alert_low.delay; + gap_alarm["alert_low_enable"] = radial_ptr->gap_alert_low.enable; + gap_alarm["alert_low_latch"] = radial_ptr->gap_alert_low.latch; gap["general"] = gap_general; gap["alarm"] = gap_alarm; variables["gap"] = gap; @@ -227,6 +240,11 @@ void ConfigMgr::Save(QString & file_path) { gap_alarm["danger_low_delay"] = thrust_ptr->gap_danger_low.delay; gap_alarm["danger_low_enable"] = thrust_ptr->gap_danger_low.enable; gap_alarm["danger_low_latch"] = thrust_ptr->gap_danger_low.latch; + gap_alarm["alert_low_level"] = thrust_ptr->gap_alert_low.level; + gap_alarm["alert_low_hysteresis"] = thrust_ptr->gap_alert_low.hysteresis; + gap_alarm["alert_low_delay"] = thrust_ptr->gap_alert_low.delay; + gap_alarm["alert_low_enable"] = thrust_ptr->gap_alert_low.enable; + gap_alarm["alert_low_latch"] = thrust_ptr->gap_alert_low.latch; gap["general"] = gap_general; gap["alarm"] = gap_alarm; variables["gap"] = gap; @@ -272,10 +290,12 @@ void ConfigMgr::Save(QString & file_path) { QJsonArray freband_output_array; QJsonObject freband_output; for (int var = 0; var < 10; ++var) { - freband_output["enable"] = pressure_ptr->freband_output[var].enable; - freband_output["start"] = pressure_ptr->freband_output[var].start; - freband_output["end"] = pressure_ptr->freband_output[var].end; - freband_output_array.append(freband_output); + if(pressure_ptr->freband_output[var].enable){ + freband_output["enable"] = pressure_ptr->freband_output[var].enable; + freband_output["start"] = pressure_ptr->freband_output[var].start; + freband_output["end"] = pressure_ptr->freband_output[var].end; + freband_output_array.append(freband_output); + } } variables["freband_output"] = freband_output_array; @@ -323,19 +343,78 @@ void ConfigMgr::Save(QString & file_path) { alarm["danger_low_delay"] = av_ptr->danger_low.delay; alarm["danger_low_enable"] = av_ptr->danger_low.enable; alarm["danger_low_latch"] = av_ptr->danger_low.latch; + alarm["alert_low_level"] = av_ptr->alert_low.level; + alarm["alert_low_hysteresis"] = av_ptr->alert_low.hysteresis; + alarm["alert_low_delay"] = av_ptr->alert_low.delay; + alarm["alert_low_enable"] = av_ptr->alert_low.enable; + alarm["alert_low_latch"] = av_ptr->alert_low.latch; processed_output["general"] = general; processed_output["alarm"] = alarm; variables["processed_output"] = processed_output; QJsonArray freband_output_array; QJsonObject freband_output; for (int var = 0; var < 10; ++var) { - freband_output["enable"] = av_ptr->freband_output[var].enable; - freband_output["start"] = av_ptr->freband_output[var].start; - freband_output["end"] = av_ptr->freband_output[var].end; - freband_output_array.append(freband_output); + if(av_ptr->freband_output[var].enable){ + freband_output["enable"] = av_ptr->freband_output[var].enable; + freband_output["start"] = av_ptr->freband_output[var].start; + freband_output["end"] = av_ptr->freband_output[var].end; + freband_output_array.append(freband_output); + } } variables["freband_output"] = freband_output_array; + }else if(ptr->base_config_[cid].channel_type == kVibVelocity){ + std::shared_ptr vel_ptr = std::dynamic_pointer_cast(base_channel_ptr); + if(vel_ptr == nullptr){ + continue; + } + // filter + QJsonArray filter; + QJsonObject low_pass; + low_pass["low"] = vel_ptr->filter_[0].low; + low_pass["high"] = vel_ptr->filter_[0].high; + low_pass["checked"] = vel_ptr->filter_[0].checked; + filter.append(low_pass); + QJsonObject high_pass; + high_pass["low"] = vel_ptr->filter_[1].low; + high_pass["high"] = vel_ptr->filter_[1].high; + high_pass["checked"] = vel_ptr->filter_[1].checked; + filter.append(high_pass); + QJsonObject band_pass; + band_pass["low"] = vel_ptr->filter_[2].low; + band_pass["high"] = vel_ptr->filter_[2].high; + band_pass["checked"] = vel_ptr->filter_[2].checked; + filter.append(band_pass); + variables["filter"] = filter; + // processed output + QJsonObject processed_output,general,alarm; + general["output_used"] = vel_ptr->general.output_used; + general["engieneering_unit"] = vel_ptr->general.engineering_unit; + general["rectifier_function"] = vel_ptr->general.rectifier_function; + + alarm["danger_high_level"] = vel_ptr->danger_high.level; + alarm["danger_high_hysteresis"] = vel_ptr->danger_high.hysteresis; + alarm["danger_high_delay"] = vel_ptr->danger_high.delay; + alarm["danger_high_enable"] = vel_ptr->danger_high.enable; + alarm["danger_high_latch"] = vel_ptr->danger_high.latch; + alarm["alert_high_level"] = vel_ptr->alert_high.level; + alarm["alert_high_hysteresis"] = vel_ptr->alert_high.hysteresis; + alarm["alert_high_delay"] = vel_ptr->alert_high.delay; + alarm["alert_high_enable"] = vel_ptr->alert_high.enable; + alarm["alert_high_latch"] = vel_ptr->alert_high.latch; + alarm["danger_low_level"] = vel_ptr->danger_low.level; + alarm["danger_low_hysteresis"] = vel_ptr->danger_low.hysteresis; + alarm["danger_low_delay"] = vel_ptr->danger_low.delay; + alarm["danger_low_enable"] = vel_ptr->danger_low.enable; + alarm["danger_low_latch"] = vel_ptr->danger_low.latch; + alarm["alert_low_level"] = vel_ptr->alert_low.level; + alarm["alert_low_hysteresis"] = vel_ptr->alert_low.hysteresis; + alarm["alert_low_delay"] = vel_ptr->alert_low.delay; + alarm["alert_low_enable"] = vel_ptr->alert_low.enable; + alarm["alert_low_latch"] = vel_ptr->alert_low.latch; + processed_output["general"] = general; + processed_output["alarm"] = alarm; + variables["processed_output"] = processed_output; } channel_item["variable"] = variables; } else if (card_type_[i] == kCardSpeedSingle || card_type_[i] == kCardSpeedTMRPrimary) { @@ -478,49 +557,51 @@ void ConfigMgr::Load(QString filename) { // base info vib_data->base_config_[j].standby = channel["standby"].toBool(); vib_data->base_config_[j].active = channel["active"].toBool(); - vib_data->base_config_[j].rack_type = channel["rack_type"].toInt(); +// vib_data->base_config_[j].rack_type = channel["rack_type"].toInt(); // vib_data->base_config_[j].tmr_group = channel["tmr_group"].toString(); vib_data->base_config_[j].channel_type = channel["channel_type"].toInt(); vib_data->base_config_[j].transducer_id = channel["transducer_id"].toInt(); - vib_data->base_config_[j].scale_factor = channel["scale_factor"].toDouble(); - vib_data->base_config_[j].sampling_rate = channel["sampling_rate"].toInt(); +// vib_data->base_config_[j].scale_factor = channel["scale_factor"].toDouble(); +// vib_data->base_config_[j].sampling_rate = channel["sampling_rate"].toInt(); QJsonArray voltage_range_array = channel["normal_voltage_range"].toArray(); vib_data->base_config_[j].normal_voltage_low = voltage_range_array[0].toDouble(); vib_data->base_config_[j].normal_voltage_high = voltage_range_array[1].toDouble(); vib_data->base_config_[j].power = channel["power"].toBool(); vib_data->base_config_[j].point_name = channel["point_name"].toString(); vib_data->base_config_[j].chan_id = channel["chan_id"].toString(); + vib_data->base_config_[j].sensitivity_unit = channel["sensitivity_unit"].toInt(); + vib_data->base_config_[j].signal_sensitivity = channel["signal_sensitivity"].toDouble(); //setpoint - QJsonObject setpoint_data = channel["setpoint"].toObject(); - if(vib_data->base_config_[j].channel_type == kVibRadial || vib_data->base_config_[j].channel_type == kVibThrust || - vib_data->base_config_[j].channel_type == kVibAcc ||vib_data->base_config_[j].channel_type == kVibVelocity ){ - vib_data->alert_danger[j].direct_upper = setpoint_data["direct_upper"].toDouble(); - vib_data->alert_danger[j].direct_enable = setpoint_data["direct_enable"].toBool(); - vib_data->alert_danger[j].x1_ampl_upper = setpoint_data["1x_ampl_upper"].toDouble(); - vib_data->alert_danger[j].x1_ampl_lower = setpoint_data["1x_ampl_lower"].toDouble(); - vib_data->alert_danger[j].x1_ampl_enable = setpoint_data["1x_ampl_enable"].toBool(); - vib_data->alert_danger[j].x2_ampl_upper = setpoint_data["2x_ampl_upper"].toDouble(); - vib_data->alert_danger[j].x2_ampl_lower = setpoint_data["2x_ampl_lower"].toDouble(); - vib_data->alert_danger[j].x2_ampl_enable = setpoint_data["2x_ampl_enable"].toBool(); - vib_data->alert_danger[j].danger_param = setpoint_data["danger_param"].toInt(); - vib_data->alert_danger[j].danger_upper = setpoint_data["danger_upper"].toDouble(); - vib_data->alert_danger[j].danger_enable = setpoint_data["danger_enable"].toBool(); - vib_data->base_config_[j].keyphase = channel["keyphase"].toBool(); - vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt(); - vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt(); - } - if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){ - vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble(); - vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool(); - vib_data->alert_danger_press[j].mid1_upper = setpoint_data["mid1_upper"].toDouble(); - vib_data->alert_danger_press[j].mid1_enable = setpoint_data["mid1_enable"].toBool(); - vib_data->alert_danger_press[j].mid2_upper = setpoint_data["mid2_upper"].toDouble(); - vib_data->alert_danger_press[j].mid2_enable = setpoint_data["mid2_enable"].toBool(); - vib_data->alert_danger_press[j].danger_param = setpoint_data["danger_param"].toInt(); - vib_data->alert_danger_press[j].danger_upper = setpoint_data["danger_upper"].toDouble(); - vib_data->alert_danger_press[j].danger_enable = setpoint_data["danger_enable"].toBool(); - } +// QJsonObject setpoint_data = channel["setpoint"].toObject(); +// if(vib_data->base_config_[j].channel_type == kVibRadial || vib_data->base_config_[j].channel_type == kVibThrust || +// vib_data->base_config_[j].channel_type == kVibAcc ||vib_data->base_config_[j].channel_type == kVibVelocity ){ +// vib_data->alert_danger[j].direct_upper = setpoint_data["direct_upper"].toDouble(); +// vib_data->alert_danger[j].direct_enable = setpoint_data["direct_enable"].toBool(); +// vib_data->alert_danger[j].x1_ampl_upper = setpoint_data["1x_ampl_upper"].toDouble(); +// vib_data->alert_danger[j].x1_ampl_lower = setpoint_data["1x_ampl_lower"].toDouble(); +// vib_data->alert_danger[j].x1_ampl_enable = setpoint_data["1x_ampl_enable"].toBool(); +// vib_data->alert_danger[j].x2_ampl_upper = setpoint_data["2x_ampl_upper"].toDouble(); +// vib_data->alert_danger[j].x2_ampl_lower = setpoint_data["2x_ampl_lower"].toDouble(); +// vib_data->alert_danger[j].x2_ampl_enable = setpoint_data["2x_ampl_enable"].toBool(); +// vib_data->alert_danger[j].danger_param = setpoint_data["danger_param"].toInt(); +// vib_data->alert_danger[j].danger_upper = setpoint_data["danger_upper"].toDouble(); +// vib_data->alert_danger[j].danger_enable = setpoint_data["danger_enable"].toBool(); +// vib_data->base_config_[j].keyphase = channel["keyphase"].toBool(); +// vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt(); +// vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt(); +// } +// if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){ +// vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble(); +// vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool(); +// vib_data->alert_danger_press[j].mid1_upper = setpoint_data["mid1_upper"].toDouble(); +// vib_data->alert_danger_press[j].mid1_enable = setpoint_data["mid1_enable"].toBool(); +// vib_data->alert_danger_press[j].mid2_upper = setpoint_data["mid2_upper"].toDouble(); +// vib_data->alert_danger_press[j].mid2_enable = setpoint_data["mid2_enable"].toBool(); +// vib_data->alert_danger_press[j].danger_param = setpoint_data["danger_param"].toInt(); +// vib_data->alert_danger_press[j].danger_upper = setpoint_data["danger_upper"].toDouble(); +// vib_data->alert_danger_press[j].danger_enable = setpoint_data["danger_enable"].toBool(); +// } // variables QJsonObject tmp_variable = channel["variable"].toObject(); switch (vib_data->base_config_[j].channel_type) { @@ -535,53 +616,60 @@ void ConfigMgr::Load(QString filename) { variable->filter_[k].checked = filter_ele["checked"].toBool(); } variable->id_ = j + 1; - QJsonObject measurement, gap; + QJsonObject measurement, gap,m_general,m_alarm,g_general,g_alarm; measurement = tmp_variable["measurement"].toObject(); gap = tmp_variable["gap"].toObject(); - variable->general.output_used = measurement["output_used"].toBool(); - variable->general.engineering_unit = measurement["engieneering_unit"].toString(); - variable->general.rectifier_function = measurement["rectifier_function"].toString(); - variable->danger_high.level = measurement["danger_high_level"].toDouble(); - variable->danger_high.hysteresis = measurement["danger_high_hysteresis"].toDouble(); - variable->danger_high.delay = measurement["danger_high_delay"].toInt(); - variable->danger_high.enable = measurement["danger_high_enable"].toBool(); - variable->danger_high.latch = measurement["danger_high_latch"].toBool(); - variable->alert_high.level = measurement["alert_high_level"].toDouble(); - variable->alert_high.hysteresis = measurement["alert_high_hysteresis"].toDouble(); - variable->alert_high.delay = measurement["alert_high_delay"].toInt(); - variable->alert_high.enable = measurement["alert_high_enable"].toBool(); - variable->alert_high.latch = measurement["alert_high_latch"].toBool(); - variable->danger_low.level = measurement["danger_low_level"].toDouble(); - variable->danger_low.hysteresis = measurement["danger_low_hysteresis"].toDouble(); - variable->danger_low.delay = measurement["danger_low_delay"].toInt(); - variable->danger_low.enable = measurement["danger_low_enable"].toBool(); - variable->danger_low.latch = measurement["danger_low_latch"].toBool(); - variable->alert_low.level = measurement["alert_low_level"].toDouble(); - variable->alert_low.hysteresis = measurement["alert_low_hysteresis"].toDouble(); - variable->alert_low.delay = measurement["alert_low_delay"].toInt(); - variable->alert_low.enable = measurement["alert_low_enable"].toBool(); - variable->alert_low.latch = measurement["alert_low_latch"].toBool(); + m_general = measurement["general"].toObject(); + m_alarm = measurement["alarm"].toObject(); + g_general = gap["general"].toObject(); + g_alarm = gap["alarm"].toObject(); + variable->general.output_used = m_general["output_used"].toBool(); + variable->general.engineering_unit = m_general["engieneering_unit"].toString(); + variable->general.rectifier_function = m_general["rectifier_function"].toString(); + variable->danger_high.level = m_alarm["danger_high_level"].toDouble(); + variable->danger_high.hysteresis = m_alarm["danger_high_hysteresis"].toDouble(); + variable->danger_high.delay = m_alarm["danger_high_delay"].toInt(); + variable->danger_high.enable = m_alarm["danger_high_enable"].toBool(); + variable->danger_high.latch = m_alarm["danger_high_latch"].toBool(); + variable->alert_high.level = m_alarm["alert_high_level"].toDouble(); + variable->alert_high.hysteresis = m_alarm["alert_high_hysteresis"].toDouble(); + variable->alert_high.delay = m_alarm["alert_high_delay"].toInt(); + variable->alert_high.enable = m_alarm["alert_high_enable"].toBool(); + variable->alert_high.latch = m_alarm["alert_high_latch"].toBool(); + variable->danger_low.level = m_alarm["danger_low_level"].toDouble(); + variable->danger_low.hysteresis = m_alarm["danger_low_hysteresis"].toDouble(); + variable->danger_low.delay = m_alarm["danger_low_delay"].toInt(); + variable->danger_low.enable = m_alarm["danger_low_enable"].toBool(); + variable->danger_low.latch = m_alarm["danger_low_latch"].toBool(); + variable->alert_low.level = m_alarm["alert_low_level"].toDouble(); + variable->alert_low.hysteresis = m_alarm["alert_low_hysteresis"].toDouble(); + variable->alert_low.delay = m_alarm["alert_low_delay"].toInt(); + variable->alert_low.enable = m_alarm["alert_low_enable"].toBool(); + variable->alert_low.latch = m_alarm["alert_low_latch"].toBool(); - variable->gap_danger_high.level = gap["danger_high_level"].toDouble(); - variable->gap_danger_high.hysteresis = gap["danger_high_hysteresis"].toDouble(); - variable->gap_danger_high.delay = gap["danger_high_delay"].toInt(); - variable->gap_danger_high.enable = gap["danger_high_enable"].toBool(); - variable->gap_danger_high.latch = gap["danger_high_latch"].toBool(); - variable->gap_alert_high.level = gap["alert_high_level"].toDouble(); - variable->gap_alert_high.hysteresis = gap["alert_high_hysteresis"].toDouble(); - variable->gap_alert_high.delay = gap["alert_high_delay"].toInt(); - variable->gap_alert_high.enable = gap["alert_high_enable"].toBool(); - variable->gap_alert_high.latch = gap["alert_high_latch"].toBool(); - variable->gap_danger_low.level = gap["danger_low_level"].toDouble(); - variable->gap_danger_low.hysteresis = gap["danger_low_hysteresis"].toDouble(); - variable->gap_danger_low.delay = gap["danger_low_delay"].toInt(); - variable->gap_danger_low.enable = gap["danger_low_enable"].toBool(); - variable->gap_danger_low.latch = gap["danger_low_latch"].toBool(); - variable->gap_alert_low.level = gap["alert_low_level"].toDouble(); - variable->gap_alert_low.hysteresis = gap["alert_low_hysteresis"].toDouble(); - variable->gap_alert_low.delay = gap["alert_low_delay"].toInt(); - variable->gap_alert_low.enable = gap["alert_low_enable"].toBool(); - variable->gap_alert_low.latch = gap["alert_low_latch"].toBool(); + variable->gap_general.output_used = g_general["output_used"].toBool(); + variable->gap_general.engineering_unit = g_general["engieneering_unit"].toString(); + variable->gap_general.rectifier_function = g_general["rectifier_function"].toString(); + variable->gap_danger_high.level = g_alarm["danger_high_level"].toDouble(); + variable->gap_danger_high.hysteresis = g_alarm["danger_high_hysteresis"].toDouble(); + variable->gap_danger_high.delay = g_alarm["danger_high_delay"].toInt(); + variable->gap_danger_high.enable = g_alarm["danger_high_enable"].toBool(); + variable->gap_danger_high.latch = g_alarm["danger_high_latch"].toBool(); + variable->gap_alert_high.level = g_alarm["alert_high_level"].toDouble(); + variable->gap_alert_high.hysteresis = g_alarm["alert_high_hysteresis"].toDouble(); + variable->gap_alert_high.delay = g_alarm["alert_high_delay"].toInt(); + variable->gap_alert_high.enable = g_alarm["alert_high_enable"].toBool(); + variable->gap_alert_high.latch = g_alarm["alert_high_latch"].toBool(); + variable->gap_danger_low.level = g_alarm["danger_low_level"].toDouble(); + variable->gap_danger_low.hysteresis = g_alarm["danger_low_hysteresis"].toDouble(); + variable->gap_danger_low.delay = g_alarm["danger_low_delay"].toInt(); + variable->gap_danger_low.enable = g_alarm["danger_low_enable"].toBool(); + variable->gap_danger_low.latch = g_alarm["danger_low_latch"].toBool(); + variable->gap_alert_low.level = g_alarm["alert_low_level"].toDouble(); + variable->gap_alert_low.hysteresis = g_alarm["alert_low_hysteresis"].toDouble(); + variable->gap_alert_low.delay = g_alarm["alert_low_delay"].toInt(); + variable->gap_alert_low.enable = g_alarm["alert_low_enable"].toBool(); + variable->gap_alert_low.latch = g_alarm["alert_low_latch"].toBool(); vib_data->variables_.push_back(variable); break; @@ -597,28 +685,33 @@ void ConfigMgr::Load(QString filename) { variable->filter_[k].checked = filter_ele["checked"].toBool(); } variable->id_ = j + 1; - QJsonObject gap; + QJsonObject gap,g_general,g_alarm; gap = tmp_variable["gap"].toObject(); - variable->gap_danger_high.level = gap["danger_high_level"].toDouble(); - variable->gap_danger_high.hysteresis = gap["danger_high_hysteresis"].toDouble(); - variable->gap_danger_high.delay = gap["danger_high_delay"].toInt(); - variable->gap_danger_high.enable = gap["danger_high_enable"].toBool(); - variable->gap_danger_high.latch = gap["danger_high_latch"].toBool(); - variable->gap_alert_high.level = gap["alert_high_level"].toDouble(); - variable->gap_alert_high.hysteresis = gap["alert_high_hysteresis"].toDouble(); - variable->gap_alert_high.delay = gap["alert_high_delay"].toInt(); - variable->gap_alert_high.enable = gap["alert_high_enable"].toBool(); - variable->gap_alert_high.latch = gap["alert_high_latch"].toBool(); - variable->gap_danger_low.level = gap["danger_low_level"].toDouble(); - variable->gap_danger_low.hysteresis = gap["danger_low_hysteresis"].toDouble(); - variable->gap_danger_low.delay = gap["danger_low_delay"].toInt(); - variable->gap_danger_low.enable = gap["danger_low_enable"].toBool(); - variable->gap_danger_low.latch = gap["danger_low_latch"].toBool(); - variable->gap_alert_low.level = gap["alert_low_level"].toDouble(); - variable->gap_alert_low.hysteresis = gap["alert_low_hysteresis"].toDouble(); - variable->gap_alert_low.delay = gap["alert_low_delay"].toInt(); - variable->gap_alert_low.enable = gap["alert_low_enable"].toBool(); - variable->gap_alert_low.latch = gap["alert_low_latch"].toBool(); + g_general = gap["general"].toObject(); + g_alarm = gap["alarm"].toObject(); + variable->gap_general.output_used = g_general["output_used"].toBool(); + variable->gap_general.engineering_unit = g_general["engieneering_unit"].toString(); + variable->gap_general.rectifier_function = g_general["rectifier_function"].toString(); + variable->gap_danger_high.level = g_alarm["danger_high_level"].toDouble(); + variable->gap_danger_high.hysteresis = g_alarm["danger_high_hysteresis"].toDouble(); + variable->gap_danger_high.delay = g_alarm["danger_high_delay"].toInt(); + variable->gap_danger_high.enable = g_alarm["danger_high_enable"].toBool(); + variable->gap_danger_high.latch = g_alarm["danger_high_latch"].toBool(); + variable->gap_alert_high.level = g_alarm["alert_high_level"].toDouble(); + variable->gap_alert_high.hysteresis = g_alarm["alert_high_hysteresis"].toDouble(); + variable->gap_alert_high.delay = g_alarm["alert_high_delay"].toInt(); + variable->gap_alert_high.enable = g_alarm["alert_high_enable"].toBool(); + variable->gap_alert_high.latch = g_alarm["alert_high_latch"].toBool(); + variable->gap_danger_low.level = g_alarm["danger_low_level"].toDouble(); + variable->gap_danger_low.hysteresis = g_alarm["danger_low_hysteresis"].toDouble(); + variable->gap_danger_low.delay = g_alarm["danger_low_delay"].toInt(); + variable->gap_danger_low.enable = g_alarm["danger_low_enable"].toBool(); + variable->gap_danger_low.latch = g_alarm["danger_low_latch"].toBool(); + variable->gap_alert_low.level = g_alarm["alert_low_level"].toDouble(); + variable->gap_alert_low.hysteresis = g_alarm["alert_low_hysteresis"].toDouble(); + variable->gap_alert_low.delay = g_alarm["alert_low_delay"].toInt(); + variable->gap_alert_low.enable = g_alarm["alert_low_enable"].toBool(); + variable->gap_alert_low.latch = g_alarm["alert_low_latch"].toBool(); variable->zero_position.value = tmp_variable["zero_position"].toDouble(); variable->zero_position.negation = tmp_variable["negation"].toBool(); vib_data->variables_.push_back(variable); diff --git a/data_config.h b/data_config.h index 09a54dc..69132e7 100644 --- a/data_config.h +++ b/data_config.h @@ -135,6 +135,8 @@ typedef struct { bool keyphase; int keyphase_slot; int keyphase_ch; + int sensitivity_unit; + float signal_sensitivity; } SeismicMonitor; typedef enum { diff --git a/pressure_pulsation.ui b/pressure_pulsation.ui index bd0e8cb..0a008a4 100644 --- a/pressure_pulsation.ui +++ b/pressure_pulsation.ui @@ -11,7 +11,7 @@ - Form + 压力脉动 diff --git a/radial_vibration.cpp b/radial_vibration.cpp index c528a0a..927c452 100644 --- a/radial_vibration.cpp +++ b/radial_vibration.cpp @@ -76,30 +76,32 @@ void Radial::Init() { ui->comboBox_output_used->setCurrentIndex(0); else ui->comboBox_output_used->setCurrentIndex(1); + ui->comboBox_engineering_unit->setCurrentText(variable_ptr->general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->general.rectifier_function); // -alarm ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); - ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.level)); - ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); + ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.delay)); ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable); ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch); ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level)); - ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.level)); - ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.hysteresis)); + ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.delay)); ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable); ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch); ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.hysteresis)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.delay)); ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); - ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); - ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); - ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->alert_low.level)); + ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->alert_low.hysteresis)); + ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->alert_low.delay)); + ui->checkBox_alert_low_enable->setChecked(variable_ptr->alert_low.enable); + ui->checkBox_alert_low_latch->setChecked(variable_ptr->alert_low.latch); // Gap // -general @@ -107,30 +109,32 @@ void Radial::Init() { ui->comboBox_output_used_2->setCurrentIndex(0); else ui->comboBox_output_used_2->setCurrentIndex(1); + ui->comboBox_engineering_unit_2->setCurrentText(variable_ptr->general.engineering_unit); + ui->comboBox_rectifier_funtion_2->setCurrentText(variable_ptr->general.rectifier_function); // -alarm ui->lineEdit_danger_high_level_2->setText(QString::number(variable_ptr->gap_danger_high.level)); - ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_high.level)); - ui->lineEdit_danger_high_delay_2->setText(QString::number(variable_ptr->gap_danger_high.level)); + ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_high.hysteresis)); + ui->lineEdit_danger_high_delay_2->setText(QString::number(variable_ptr->gap_danger_high.delay)); ui->checkBox_danger_high_enable_2->setChecked(variable_ptr->gap_danger_high.enable); ui->checkBox_danger_high_latch_2->setChecked(variable_ptr->gap_danger_high.latch); ui->lineEdit_alert_high_level_2->setText(QString::number(variable_ptr->gap_alert_high.level)); - ui->lineEdit_alert_high_hysteresis_2->setText(QString::number(variable_ptr->gap_alert_high.level)); - ui->lineEdit_alert_high_delay_2->setText(QString::number(variable_ptr->gap_alert_high.level)); + ui->lineEdit_alert_high_hysteresis_2->setText(QString::number(variable_ptr->gap_alert_high.hysteresis)); + ui->lineEdit_alert_high_delay_2->setText(QString::number(variable_ptr->gap_alert_high.delay)); ui->checkBox_alert_high_enable_2->setChecked(variable_ptr->gap_alert_high.enable); ui->checkBox_alert_high_latch_2->setChecked(variable_ptr->gap_alert_high.latch); ui->lineEdit_danger_low_level_2->setText(QString::number(variable_ptr->gap_danger_low.level)); - ui->lineEdit_danger_low_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_low.level)); - ui->lineEdit_danger_low_delay_2->setText(QString::number(variable_ptr->gap_danger_low.level)); + ui->lineEdit_danger_low_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_low.hysteresis)); + ui->lineEdit_danger_low_delay_2->setText(QString::number(variable_ptr->gap_danger_low.delay)); ui->checkBox_danger_low_enable_2->setChecked(variable_ptr->gap_danger_low.enable); ui->checkBox_danger_low_latch_2->setChecked(variable_ptr->gap_danger_low.latch); - ui->lineEdit_danger_low_level_2->setText(QString::number(variable_ptr->gap_danger_low.level)); - ui->lineEdit_danger_low_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_low.level)); - ui->lineEdit_danger_low_delay_2->setText(QString::number(variable_ptr->gap_danger_low.level)); - ui->checkBox_danger_low_enable_2->setChecked(variable_ptr->gap_danger_low.enable); - ui->checkBox_danger_low_latch_2->setChecked(variable_ptr->gap_danger_low.latch); + ui->lineEdit_alert_low_level_2->setText(QString::number(variable_ptr->gap_alert_low.level)); + ui->lineEdit_alert_low_hysteresis_2->setText(QString::number(variable_ptr->gap_alert_low.hysteresis)); + ui->lineEdit_alert_low_delay_2->setText(QString::number(variable_ptr->gap_alert_low.delay)); + ui->checkBox_alert_low_enable_2->setChecked(variable_ptr->gap_alert_low.enable); + ui->checkBox_alert_low_latch_2->setChecked(variable_ptr->gap_alert_low.latch); } void Radial::on_pushButton_confirm_clicked() { @@ -166,6 +170,8 @@ void Radial::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -182,12 +188,19 @@ void Radial::on_pushButton_confirm_clicked() { variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); // Gap // -general if(ui->comboBox_output_used_2->currentIndex() == 0) variable->gap_general.output_used = true; else variable->gap_general.output_used = false; + variable->gap_general.engineering_unit = ui->comboBox_engineering_unit_2->currentText(); + variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion_2->currentText(); // -alarm variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble(); @@ -204,6 +217,11 @@ void Radial::on_pushButton_confirm_clicked() { variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble(); variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked(); variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked(); + variable->gap_alert_low.level = ui->lineEdit_alert_low_level_2->text().toDouble(); + variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis_2->text().toDouble(); + variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay_2->text().toDouble(); + variable->gap_alert_low.enable = ui->checkBox_alert_low_enable_2->isChecked(); + variable->gap_alert_low.latch = ui->checkBox_alert_low_latch_2->isChecked(); // add to ptr ptr->variables_.push_back(variable); this->close(); @@ -241,6 +259,11 @@ void Radial::on_pushButton_confirm_clicked() { variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); // Gap // -general if(ui->comboBox_output_used_2->currentIndex() == 0) @@ -263,6 +286,11 @@ void Radial::on_pushButton_confirm_clicked() { variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble(); variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked(); variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked(); + variable->gap_alert_low.level = ui->lineEdit_alert_low_level_2->text().toDouble(); + variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis_2->text().toDouble(); + variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay_2->text().toDouble(); + variable->gap_alert_low.enable = ui->checkBox_alert_low_enable_2->isChecked(); + variable->gap_alert_low.latch = ui->checkBox_alert_low_latch_2->isChecked(); this->close(); } diff --git a/radial_vibration.ui b/radial_vibration.ui index 6cb64dc..c305bbb 100644 --- a/radial_vibration.ui +++ b/radial_vibration.ui @@ -636,7 +636,7 @@ - + 80 @@ -656,7 +656,7 @@ - + 80 @@ -1133,7 +1133,7 @@ - + 80 @@ -1153,7 +1153,7 @@ - + 80 diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index 48f81aa..bcfc301 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -62,6 +62,8 @@ void Seismic_monitor::Init() { qDebug() << vib_data->base_config_[i].channel_type ; ui->comboBox_chan_type_1->setCurrentIndex(vib_data->base_config_[i].channel_type); ui->checkBox_standby_1->setChecked(vib_data->base_config_[i].standby); + ui->comboBox_sensitivity_unit_1->setCurrentIndex(vib_data->base_config_[i].sensitivity_unit); + ui->lineEdit_signal_sensitivity_1->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); ui->checkBox_enable_1->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_1->setValue(vib_data->base_config_[i].normal_voltage_low); @@ -69,6 +71,8 @@ void Seismic_monitor::Init() { } else if (i + 1 == 2) { ui->comboBox_chan_type_2->setCurrentIndex(vib_data->base_config_[i].channel_type); + ui->comboBox_sensitivity_unit_2->setCurrentIndex(vib_data->base_config_[i].sensitivity_unit); + ui->lineEdit_signal_sensitivity_2->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); ui->checkBox_enable_2->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_2->setValue(vib_data->base_config_[i].normal_voltage_low); @@ -77,6 +81,8 @@ void Seismic_monitor::Init() { } else if (i + 1 == 3) { ui->checkBox_standby_2->setChecked(vib_data->base_config_[i].standby); ui->comboBox_chan_type_3->setCurrentIndex(vib_data->base_config_[i].channel_type); + ui->comboBox_sensitivity_unit_3->setCurrentIndex(vib_data->base_config_[i].sensitivity_unit); + ui->lineEdit_signal_sensitivity_3->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); ui->checkBox_enable_3->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_3->setValue(vib_data->base_config_[i].normal_voltage_low); @@ -84,6 +90,8 @@ void Seismic_monitor::Init() { } else if (i + 1 == 4) { ui->comboBox_chan_type_4->setCurrentIndex(vib_data->base_config_[i].channel_type); + ui->comboBox_sensitivity_unit_4->setCurrentIndex(vib_data->base_config_[i].sensitivity_unit); + ui->lineEdit_signal_sensitivity_4->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); ui->checkBox_enable_4->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_4->setValue(vib_data->base_config_[i].normal_voltage_low); @@ -100,6 +108,8 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].active = ui->checkBox_enable_1->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_1->currentIndex(); + vib_data->base_config_[var].sensitivity_unit = ui->comboBox_sensitivity_unit_1->currentIndex(); + vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_1->text().toFloat(); vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_1->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_1->value(); @@ -112,6 +122,8 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].active = ui->checkBox_enable_2->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_2->currentIndex(); + vib_data->base_config_[var].sensitivity_unit = ui->comboBox_sensitivity_unit_2->currentIndex(); + vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_2->text().toFloat(); vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_2->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_2->value(); @@ -125,6 +137,8 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].active = ui->checkBox_enable_3->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_3->currentIndex(); + vib_data->base_config_[var].sensitivity_unit = ui->comboBox_sensitivity_unit_3->currentIndex(); + vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_3->text().toFloat(); vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_3->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_3->value(); @@ -138,6 +152,8 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].active = ui->checkBox_enable_4->isChecked(); vib_data->base_config_[var].rack_type = 0; vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_4->currentIndex(); + vib_data->base_config_[var].sensitivity_unit = ui->comboBox_sensitivity_unit_4->currentIndex(); + vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_4->text().toFloat(); vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_4->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_4->value(); vib_data->base_config_[var].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); diff --git a/seismic_monitor.ui b/seismic_monitor.ui index e299192..b5aa93b 100644 --- a/seismic_monitor.ui +++ b/seismic_monitor.ui @@ -364,6 +364,11 @@ 16777215 + + + 轴振 + + 加速度 @@ -374,21 +379,16 @@ 速度 - - - 压力脉动 - - - - - 轴振 - - 轴位移 + + + 压力脉动 + + DC @@ -799,6 +799,11 @@ 16777215 + + + 轴振 + + 加速度 @@ -809,21 +814,16 @@ 速度 - - - 压力脉动 - - - - - 轴振 - - 轴位移 + + + 压力脉动 + + DC @@ -1469,7 +1469,7 @@ - 1 + 0 @@ -1492,6 +1492,11 @@ 16777215 + + + 轴振 + + 加速度 @@ -1502,21 +1507,16 @@ 速度 - - - 压力脉动 - - - - - 轴振 - - 轴位移 + + + 压力脉动 + + DC @@ -1927,6 +1927,11 @@ 16777215 + + + 轴振 + + 加速度 @@ -1937,21 +1942,16 @@ 速度 - - - 压力脉动 - - - - - 轴振 - - 轴位移 + + + 压力脉动 + + DC diff --git a/trust.cpp b/trust.cpp index 67dc28f..0d5a54b 100644 --- a/trust.cpp +++ b/trust.cpp @@ -63,36 +63,39 @@ void Trust::Init() { ui->doubleSpinBox_zero_position->setValue(variable_ptr->zero_position.value); ui->checkBox_negation->setChecked(variable_ptr->zero_position.negation); - // processed output + // gap // -general - if(variable_ptr->general.output_used) + if(variable_ptr->gap_general.output_used) ui->comboBox_output_used->setCurrentIndex(0); else ui->comboBox_output_used->setCurrentIndex(1); + ui->comboBox_engineering_unit->setCurrentText(variable_ptr->gap_general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->gap_general.rectifier_function); // -alarm - ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); - ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.level)); - ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.level)); - ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable); - ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch); + ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->gap_danger_high.level)); + ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->gap_danger_high.hysteresis)); + ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->gap_danger_high.delay)); + ui->checkBox_danger_high_enable->setChecked(variable_ptr->gap_danger_high.enable); + ui->checkBox_danger_high_latch->setChecked(variable_ptr->gap_danger_high.latch); - ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level)); - ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.level)); - ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.level)); - ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable); - ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch); + ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->gap_alert_high.level)); + ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->gap_alert_high.hysteresis)); + ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->gap_alert_high.delay)); + ui->checkBox_alert_high_enable->setChecked(variable_ptr->gap_alert_high.enable); + ui->checkBox_alert_high_latch->setChecked(variable_ptr->gap_alert_high.latch); - ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); - ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); - ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->gap_danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->gap_danger_low.hysteresis)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->gap_danger_low.delay)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->gap_danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->gap_danger_low.latch); + + ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->gap_alert_low.level)); + ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->gap_alert_low.hysteresis)); + ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->gap_alert_low.delay)); + ui->checkBox_alert_low_enable->setChecked(variable_ptr->gap_alert_low.enable); + ui->checkBox_alert_low_latch->setChecked(variable_ptr->gap_alert_low.latch); - ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); - ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); - ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); } void Trust::on_pushButton_confirm_clicked() { @@ -126,28 +129,35 @@ void Trust::on_pushButton_confirm_clicked() variable->zero_position.value = ui->doubleSpinBox_zero_position->value(); variable->zero_position.negation = ui->checkBox_negation->isChecked(); - // processed output + // gap // -general if(ui->comboBox_output_used->currentIndex() == 0) - variable->general.output_used = true; + variable->gap_general.output_used = true; else - variable->general.output_used = false; + variable->gap_general.output_used = false; + variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentText(); + variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); // -alarm - variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); - variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); - variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); - variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); - variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); - variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); - variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); - variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); - variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); - variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); - variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); - variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); - variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); - variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); - variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->gap_danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->gap_danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->gap_danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->gap_alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->gap_alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->gap_alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->gap_alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->gap_alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->gap_danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->gap_danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->gap_danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->gap_alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->gap_alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->gap_alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); ptr->variables_.push_back(variable); this->close(); return; @@ -166,28 +176,35 @@ void Trust::on_pushButton_confirm_clicked() variable->zero_position.value = ui->doubleSpinBox_zero_position->value(); variable->zero_position.negation = ui->checkBox_negation->isChecked(); - // processed output + // gap // -general if(ui->comboBox_output_used->currentIndex() == 0) - variable->general.output_used = true; + variable->gap_general.output_used = true; else - variable->general.output_used = false; + variable->gap_general.output_used = false; + variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentText(); + variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); // -alarm - variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); - variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); - variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); - variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); - variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); - variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); - variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); - variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); - variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); - variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); - variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); - variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); - variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); - variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); - variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->gap_danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->gap_danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->gap_danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->gap_alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->gap_alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->gap_alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->gap_alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->gap_alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->gap_danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->gap_danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->gap_danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->gap_alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->gap_alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->gap_alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); this->close(); } diff --git a/trust.ui b/trust.ui index b95bd22..4f70b64 100644 --- a/trust.ui +++ b/trust.ui @@ -11,7 +11,7 @@ - Form + 轴向位移 @@ -287,7 +287,7 @@ - 0 + 1 @@ -681,7 +681,7 @@ - + 80 @@ -701,7 +701,7 @@ - + 80 diff --git a/velocity.cpp b/velocity.cpp index 9ee0a41..6a7b904 100644 --- a/velocity.cpp +++ b/velocity.cpp @@ -69,30 +69,33 @@ void Velocity::Init() { ui->comboBox_output_used->setCurrentIndex(0); else ui->comboBox_output_used->setCurrentIndex(1); + ui->comboBox_engineering_unit->setCurrentText(variable_ptr->general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->general.rectifier_function); // -alarm ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); - ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.level)); - ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); + ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.delay)); ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable); ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch); ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level)); - ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.level)); - ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.hysteresis)); + ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.delay)); ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable); ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch); ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.hysteresis)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.delay)); ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); - ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.level)); - ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.level)); - ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); - ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->alert_low.level)); + ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->alert_low.hysteresis)); + ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->alert_low.delay)); + ui->checkBox_alert_low_enable->setChecked(variable_ptr->alert_low.enable); + ui->checkBox_alert_low_latch->setChecked(variable_ptr->alert_low.latch); + } @@ -129,6 +132,8 @@ void Velocity::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -145,6 +150,11 @@ void Velocity::on_pushButton_confirm_clicked() { variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); ptr->variables_.push_back(variable); this->close(); return; @@ -165,6 +175,8 @@ void Velocity::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -181,5 +193,10 @@ void Velocity::on_pushButton_confirm_clicked() { variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); this->close(); } diff --git a/velocity.ui b/velocity.ui index b24891c..6e24a2b 100644 --- a/velocity.ui +++ b/velocity.ui @@ -636,7 +636,7 @@ - + 80 @@ -656,7 +656,7 @@ - + 80 From fe33514c40aaa2fe2fddf1adaaea5c28c2146716 Mon Sep 17 00:00:00 2001 From: "DESKTOP-7I8SUIC\\zhang" Date: Tue, 29 Jul 2025 22:01:19 +0800 Subject: [PATCH 06/14] add codes,modify config file --- acceleration.cpp | 12 ++-- acceleration.ui | 2 +- config_mgr.cpp | 131 +++++++++++++++++++------------------------ data_config.h | 12 +++- radial_vibration.cpp | 20 ++++--- seismic_monitor.cpp | 9 ++- trust.cpp | 12 ++-- velocity.cpp | 12 ++-- 8 files changed, 102 insertions(+), 108 deletions(-) diff --git a/acceleration.cpp b/acceleration.cpp index 76c8bc3..3e25a1a 100644 --- a/acceleration.cpp +++ b/acceleration.cpp @@ -65,8 +65,8 @@ void Acceleration::Init() { ui->comboBox_output_used->setCurrentIndex(0); else ui->comboBox_output_used->setCurrentIndex(1); - ui->comboBox_engineering_unit->setCurrentText(variable_ptr->general.engineering_unit); - ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->general.rectifier_function); + ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function); // -alarm ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); @@ -160,8 +160,8 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; - variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); - variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -234,8 +234,8 @@ void Acceleration::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; - variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); - variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); diff --git a/acceleration.ui b/acceleration.ui index fab8d3e..90138e4 100644 --- a/acceleration.ui +++ b/acceleration.ui @@ -403,7 +403,7 @@ - 1 + 0 diff --git a/config_mgr.cpp b/config_mgr.cpp index 61b6a31..cc6d81a 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -74,27 +74,15 @@ void ConfigMgr::Save(QString & file_path) { voltage_range.append(ptr->base_config_[cid].normal_voltage_low); voltage_range.append(ptr->base_config_[cid].normal_voltage_high); channel_item["normal_voltage_range"] = voltage_range; -// QJsonObject setpoint_data; -// if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust || -// ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){ -// if(ptr->base_config_[cid].channel_type != kVibThrust){ -// setpoint_data["1x_ampl_upper"] = qRound(ptr->alert_danger[cid].x1_ampl_upper * 10)/10.0; -// setpoint_data["1x_ampl_lower"] = qRound(ptr->alert_danger[cid].x1_ampl_lower * 10)/10.0; -// setpoint_data["1x_ampl_enable"] = ptr->alert_danger[cid].x1_ampl_enable; -// setpoint_data["2x_ampl_upper"] = qRound(ptr->alert_danger[cid].x2_ampl_upper * 10)/10.0; -// setpoint_data["2x_ampl_lower"] = qRound(ptr->alert_danger[cid].x2_ampl_lower * 10)/10.0; -// setpoint_data["2x_ampl_enable"] = ptr->alert_danger[cid].x2_ampl_enable; -// channel_item["keyphase"] = ptr->base_config_[cid].keyphase; -// channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot; -// channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch; -// } -// setpoint_data["direct_upper"] = qRound(ptr->alert_danger[cid].direct_upper * 10)/10.0; -// setpoint_data["direct_enable"] = ptr->alert_danger[cid].direct_enable; -// setpoint_data["danger_param"] = ptr->alert_danger[cid].danger_param; -// setpoint_data["danger_upper"] = qRound(ptr->alert_danger[cid].danger_upper * 10)/10.0; -// setpoint_data["danger_enable"] = ptr->alert_danger[cid].danger_enable; - -// } + QJsonObject setpoint_data; + if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust || + ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){ + if(ptr->base_config_[cid].channel_type != kVibThrust){ + channel_item["keyphase"] = ptr->base_config_[cid].keyphase; + channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot; + channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch; + } + } // if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){ // setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0; // setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable; @@ -287,17 +275,17 @@ void ConfigMgr::Save(QString & file_path) { variables["sampling"] = sampling; variables["scaling"] = scaling; - QJsonArray freband_output_array; - QJsonObject freband_output; + QJsonObject freband_output,number; for (int var = 0; var < 10; ++var) { - if(pressure_ptr->freband_output[var].enable){ + if(pressure_ptr->freband_output[var].start != 0 || pressure_ptr->freband_output[var].end != 0){ freband_output["enable"] = pressure_ptr->freband_output[var].enable; freband_output["start"] = pressure_ptr->freband_output[var].start; freband_output["end"] = pressure_ptr->freband_output[var].end; - freband_output_array.append(freband_output); + number[QString::number(var + 1)] = freband_output; + //freband_output_array.append(freband_output); } } - variables["freband_output"] = freband_output_array; + variables["freband_output"] = number; } else if(ptr->base_config_[cid].channel_type == kVibAcc){ std::shared_ptr av_ptr = std::dynamic_pointer_cast(base_channel_ptr); @@ -351,17 +339,18 @@ void ConfigMgr::Save(QString & file_path) { processed_output["general"] = general; processed_output["alarm"] = alarm; variables["processed_output"] = processed_output; - QJsonArray freband_output_array; - QJsonObject freband_output; + //QJsonArray freband_output_array; + QJsonObject freband_output,number; for (int var = 0; var < 10; ++var) { - if(av_ptr->freband_output[var].enable){ + if(av_ptr->freband_output[var].start != 0 || av_ptr->freband_output[var].end != 0){ freband_output["enable"] = av_ptr->freband_output[var].enable; freband_output["start"] = av_ptr->freband_output[var].start; freband_output["end"] = av_ptr->freband_output[var].end; - freband_output_array.append(freband_output); + number[QString::number(var + 1)] = freband_output; + //freband_output_array.append(freband_output); } } - variables["freband_output"] = freband_output_array; + variables["freband_output"] = number; }else if(ptr->base_config_[cid].channel_type == kVibVelocity){ std::shared_ptr vel_ptr = std::dynamic_pointer_cast(base_channel_ptr); @@ -571,26 +560,17 @@ void ConfigMgr::Load(QString filename) { vib_data->base_config_[j].chan_id = channel["chan_id"].toString(); vib_data->base_config_[j].sensitivity_unit = channel["sensitivity_unit"].toInt(); vib_data->base_config_[j].signal_sensitivity = channel["signal_sensitivity"].toDouble(); - + vib_data->base_config_[j].keyphase = channel["keyphase"].toBool(); + vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt(); + vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt(); //setpoint -// QJsonObject setpoint_data = channel["setpoint"].toObject(); -// if(vib_data->base_config_[j].channel_type == kVibRadial || vib_data->base_config_[j].channel_type == kVibThrust || -// vib_data->base_config_[j].channel_type == kVibAcc ||vib_data->base_config_[j].channel_type == kVibVelocity ){ -// vib_data->alert_danger[j].direct_upper = setpoint_data["direct_upper"].toDouble(); -// vib_data->alert_danger[j].direct_enable = setpoint_data["direct_enable"].toBool(); -// vib_data->alert_danger[j].x1_ampl_upper = setpoint_data["1x_ampl_upper"].toDouble(); -// vib_data->alert_danger[j].x1_ampl_lower = setpoint_data["1x_ampl_lower"].toDouble(); -// vib_data->alert_danger[j].x1_ampl_enable = setpoint_data["1x_ampl_enable"].toBool(); -// vib_data->alert_danger[j].x2_ampl_upper = setpoint_data["2x_ampl_upper"].toDouble(); -// vib_data->alert_danger[j].x2_ampl_lower = setpoint_data["2x_ampl_lower"].toDouble(); -// vib_data->alert_danger[j].x2_ampl_enable = setpoint_data["2x_ampl_enable"].toBool(); -// vib_data->alert_danger[j].danger_param = setpoint_data["danger_param"].toInt(); -// vib_data->alert_danger[j].danger_upper = setpoint_data["danger_upper"].toDouble(); -// vib_data->alert_danger[j].danger_enable = setpoint_data["danger_enable"].toBool(); -// vib_data->base_config_[j].keyphase = channel["keyphase"].toBool(); -// vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt(); -// vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt(); -// } + QJsonObject setpoint_data = channel["setpoint"].toObject(); + if(vib_data->base_config_[j].channel_type == kVibRadial || vib_data->base_config_[j].channel_type == kVibThrust || + vib_data->base_config_[j].channel_type == kVibAcc ||vib_data->base_config_[j].channel_type == kVibVelocity ){ + vib_data->base_config_[j].keyphase = channel["keyphase"].toBool(); + vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt(); + vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt(); + } // if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){ // vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble(); // vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool(); @@ -624,8 +604,8 @@ void ConfigMgr::Load(QString filename) { g_general = gap["general"].toObject(); g_alarm = gap["alarm"].toObject(); variable->general.output_used = m_general["output_used"].toBool(); - variable->general.engineering_unit = m_general["engieneering_unit"].toString(); - variable->general.rectifier_function = m_general["rectifier_function"].toString(); + variable->general.engineering_unit = m_general["engieneering_unit"].toInt(); + variable->general.rectifier_function = m_general["rectifier_function"].toInt(); variable->danger_high.level = m_alarm["danger_high_level"].toDouble(); variable->danger_high.hysteresis = m_alarm["danger_high_hysteresis"].toDouble(); variable->danger_high.delay = m_alarm["danger_high_delay"].toInt(); @@ -648,8 +628,8 @@ void ConfigMgr::Load(QString filename) { variable->alert_low.latch = m_alarm["alert_low_latch"].toBool(); variable->gap_general.output_used = g_general["output_used"].toBool(); - variable->gap_general.engineering_unit = g_general["engieneering_unit"].toString(); - variable->gap_general.rectifier_function = g_general["rectifier_function"].toString(); + variable->gap_general.engineering_unit = g_general["engieneering_unit"].toInt(); + variable->gap_general.rectifier_function = g_general["rectifier_function"].toInt(); variable->gap_danger_high.level = g_alarm["danger_high_level"].toDouble(); variable->gap_danger_high.hysteresis = g_alarm["danger_high_hysteresis"].toDouble(); variable->gap_danger_high.delay = g_alarm["danger_high_delay"].toInt(); @@ -690,8 +670,8 @@ void ConfigMgr::Load(QString filename) { g_general = gap["general"].toObject(); g_alarm = gap["alarm"].toObject(); variable->gap_general.output_used = g_general["output_used"].toBool(); - variable->gap_general.engineering_unit = g_general["engieneering_unit"].toString(); - variable->gap_general.rectifier_function = g_general["rectifier_function"].toString(); + variable->gap_general.engineering_unit = g_general["engieneering_unit"].toInt(); + variable->gap_general.rectifier_function = g_general["rectifier_function"].toInt(); variable->gap_danger_high.level = g_alarm["danger_high_level"].toDouble(); variable->gap_danger_high.hysteresis = g_alarm["danger_high_hysteresis"].toDouble(); variable->gap_danger_high.delay = g_alarm["danger_high_delay"].toInt(); @@ -739,13 +719,16 @@ void ConfigMgr::Load(QString filename) { variable->measuring_max = scaling["measuring_max"].toInt(); variable->scale_min = scaling["scale_min"].toInt(); variable->scale_max = scaling["scale_max"].toInt(); - QJsonArray freband_output_array = tmp_variable["freband_output"].toArray(); - for (int k = 0; k < freband_output_array.size(); ++k) { - QJsonObject freband_output = freband_output_array[k].toObject(); + QJsonObject freband_output_obj = tmp_variable["freband_output"].toObject(); + QJsonObject number_obj; + for (int k = 0; k < 10; ++k) { + number_obj = freband_output_obj[QString::number(k + 1)].toObject(); + if(number_obj.isEmpty()) + continue; FrequencybandOutput output; - output.enable = freband_output["enable"].toBool(); - output.start = freband_output["start"].toInt(); - output.end = freband_output["end"].toInt(); + output.enable = number_obj["enable"].toBool(); + output.start = number_obj["start"].toInt(); + output.end = number_obj["end"].toInt(); variable->freband_output[k] = output; } vib_data->variables_.push_back(variable); @@ -767,8 +750,8 @@ void ConfigMgr::Load(QString filename) { general = processed_output["general"].toObject(); alarm = processed_output["alarm"].toObject(); variable->general.output_used = general["output_used"].toBool(); - variable->general.engineering_unit = general["engieneering_unit"].toString(); - variable->general.rectifier_function = general["rectifier_function"].toString(); + variable->general.engineering_unit = general["engieneering_unit"].toInt(); + variable->general.rectifier_function = general["rectifier_function"].toInt(); variable->danger_high.level = alarm["danger_high_level"].toDouble(); variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble(); variable->danger_high.delay = alarm["danger_high_delay"].toInt(); @@ -808,8 +791,8 @@ void ConfigMgr::Load(QString filename) { general = processed_output["general"].toObject(); alarm = processed_output["alarm"].toObject(); variable->general.output_used = general["output_used"].toBool(); - variable->general.engineering_unit = general["engieneering_unit"].toString(); - variable->general.rectifier_function = general["rectifier_function"].toString(); + variable->general.engineering_unit = general["engieneering_unit"].toInt(); + variable->general.rectifier_function = general["rectifier_function"].toInt(); variable->danger_high.level = alarm["danger_high_level"].toDouble(); variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble(); variable->danger_high.delay = alarm["danger_high_delay"].toInt(); @@ -830,14 +813,16 @@ void ConfigMgr::Load(QString filename) { variable->alert_low.delay = alarm["alert_low_delay"].toInt(); variable->alert_low.enable = alarm["alert_low_enable"].toBool(); variable->alert_low.latch = alarm["alert_low_latch"].toBool(); - - QJsonArray freband_output_array = tmp_variable["freband_output"].toArray(); - for (int k = 0; k < freband_output_array.size(); ++k) { - QJsonObject freband_output = freband_output_array[k].toObject(); + QJsonObject freband_output_obj = tmp_variable["freband_output"].toObject(); + QJsonObject number_obj; + for (int k = 0; k < 10; ++k) { + number_obj = freband_output_obj[QString::number(k + 1)].toObject(); + if(number_obj.isEmpty()) + continue; FrequencybandOutput output; - output.enable = freband_output["enable"].toBool(); - output.start = freband_output["start"].toInt(); - output.end = freband_output["end"].toInt(); + output.enable = number_obj["enable"].toBool(); + output.start = number_obj["start"].toInt(); + output.end = number_obj["end"].toInt(); variable->freband_output[k] = output; } vib_data->variables_.push_back(variable); diff --git a/data_config.h b/data_config.h index 69132e7..03390b8 100644 --- a/data_config.h +++ b/data_config.h @@ -153,8 +153,8 @@ typedef struct { typedef struct{ bool output_used; - QString engineering_unit; - QString rectifier_function; + int engineering_unit; + int rectifier_function; }General; typedef struct{ @@ -165,10 +165,16 @@ typedef struct{ bool latch; }AlarmDangerHigh,AlarmAlertHigh,AlarmDangerLow,AlarmAlertLow ; -typedef struct{ +typedef struct FrequencybandOutput_{ bool enable; int start; int end; + FrequencybandOutput_() + { + enable = false; + start = 0; + end = 0; + } }FrequencybandOutput ; //typedef struct { // Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass diff --git a/radial_vibration.cpp b/radial_vibration.cpp index 927c452..8181658 100644 --- a/radial_vibration.cpp +++ b/radial_vibration.cpp @@ -76,8 +76,8 @@ void Radial::Init() { ui->comboBox_output_used->setCurrentIndex(0); else ui->comboBox_output_used->setCurrentIndex(1); - ui->comboBox_engineering_unit->setCurrentText(variable_ptr->general.engineering_unit); - ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->general.rectifier_function); + ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function); // -alarm ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); @@ -109,8 +109,8 @@ void Radial::Init() { ui->comboBox_output_used_2->setCurrentIndex(0); else ui->comboBox_output_used_2->setCurrentIndex(1); - ui->comboBox_engineering_unit_2->setCurrentText(variable_ptr->general.engineering_unit); - ui->comboBox_rectifier_funtion_2->setCurrentText(variable_ptr->general.rectifier_function); + ui->comboBox_engineering_unit_2->setCurrentIndex(variable_ptr->general.engineering_unit); + ui->comboBox_rectifier_funtion_2->setCurrentIndex(variable_ptr->general.rectifier_function); // -alarm ui->lineEdit_danger_high_level_2->setText(QString::number(variable_ptr->gap_danger_high.level)); ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(variable_ptr->gap_danger_high.hysteresis)); @@ -170,8 +170,8 @@ void Radial::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; - variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); - variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -199,8 +199,8 @@ void Radial::on_pushButton_confirm_clicked() { variable->gap_general.output_used = true; else variable->gap_general.output_used = false; - variable->gap_general.engineering_unit = ui->comboBox_engineering_unit_2->currentText(); - variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion_2->currentText(); + variable->gap_general.engineering_unit = ui->comboBox_engineering_unit_2->currentIndex(); + variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion_2->currentIndex(); // -alarm variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble(); @@ -243,6 +243,8 @@ void Radial::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -270,6 +272,8 @@ void Radial::on_pushButton_confirm_clicked() { variable->gap_general.output_used = true; else variable->gap_general.output_used = false; + variable->gap_general.engineering_unit = ui->comboBox_engineering_unit_2->currentIndex(); + variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion_2->currentIndex(); // -alarm variable->gap_danger_high.level = ui->lineEdit_danger_high_level_2->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble(); diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index bcfc301..8651773 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -173,20 +173,19 @@ void Seismic_monitor::on_pushButton_confirm_clicked() { // UpdateData(vib_data); return; } - - if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase->isChecked()) { + if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase->isChecked()) { QMessageBox::information(this, QStringLiteral("提示"), "第一通道键相槽位选择错误!"); return; } - if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_2->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase_2->isChecked()) { + if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_2->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_2->isChecked()) { QMessageBox::information(this, QStringLiteral("提示"), "第二通道键相槽位选择错误!"); return; } - if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_3->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase_3->isChecked()) { + if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_3->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_3->isChecked()) { QMessageBox::information(this, QStringLiteral("提示"), "第三通道键相槽位选择错误!"); return; } - if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_4->currentText().toInt()] != kCardKeyphaseSingle && ui->checkBox_keyphase_4->isChecked()) { + if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_4->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_4->isChecked()) { QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!"); return; } diff --git a/trust.cpp b/trust.cpp index 0d5a54b..8f31fe2 100644 --- a/trust.cpp +++ b/trust.cpp @@ -69,8 +69,8 @@ void Trust::Init() { ui->comboBox_output_used->setCurrentIndex(0); else ui->comboBox_output_used->setCurrentIndex(1); - ui->comboBox_engineering_unit->setCurrentText(variable_ptr->gap_general.engineering_unit); - ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->gap_general.rectifier_function); + ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->gap_general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->gap_general.rectifier_function); // -alarm ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->gap_danger_high.level)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->gap_danger_high.hysteresis)); @@ -135,8 +135,8 @@ void Trust::on_pushButton_confirm_clicked() variable->gap_general.output_used = true; else variable->gap_general.output_used = false; - variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentText(); - variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); + variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -182,8 +182,8 @@ void Trust::on_pushButton_confirm_clicked() variable->gap_general.output_used = true; else variable->gap_general.output_used = false; - variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentText(); - variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); + variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); diff --git a/velocity.cpp b/velocity.cpp index 6a7b904..7ac8283 100644 --- a/velocity.cpp +++ b/velocity.cpp @@ -69,8 +69,8 @@ void Velocity::Init() { ui->comboBox_output_used->setCurrentIndex(0); else ui->comboBox_output_used->setCurrentIndex(1); - ui->comboBox_engineering_unit->setCurrentText(variable_ptr->general.engineering_unit); - ui->comboBox_rectifier_funtion->setCurrentText(variable_ptr->general.rectifier_function); + ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function); // -alarm ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); @@ -132,8 +132,8 @@ void Velocity::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; - variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); - variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -175,8 +175,8 @@ void Velocity::on_pushButton_confirm_clicked() { variable->general.output_used = true; else variable->general.output_used = false; - variable->general.engineering_unit = ui->comboBox_engineering_unit->currentText(); - variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentText(); + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); From c96ed16d0961239990e5b071978c91c5ff4c7332 Mon Sep 17 00:00:00 2001 From: "DESKTOP-7I8SUIC\\zhang" Date: Mon, 4 Aug 2025 12:25:12 +0800 Subject: [PATCH 07/14] add codes --- TSI_Config.pro | 3 + cardbase.h | 2 + config_mgr.cpp | 2 - data_config.h | 33 +++++++ dc_output_channel.cpp | 46 ++++++++++ dc_output_channel.h | 28 ++++++ dc_output_channel.ui | 209 ++++++++++++++++++++++++++++++++++++++++++ dc_outputs.cpp | 54 ++++++++++- dc_outputs.h | 12 ++- dc_outputs.ui | 115 ++++++++++++++++------- mainwindow.cpp | 4 + seismic_monitor.cpp | 2 + trust.cpp | 3 - trust.ui | 42 +-------- 14 files changed, 475 insertions(+), 80 deletions(-) create mode 100644 dc_output_channel.cpp create mode 100644 dc_output_channel.h create mode 100644 dc_output_channel.ui diff --git a/TSI_Config.pro b/TSI_Config.pro index 4b5bb4f..f612b0c 100644 --- a/TSI_Config.pro +++ b/TSI_Config.pro @@ -15,6 +15,7 @@ SOURCES += \ common.cpp \ config_mgr.cpp \ connect.cpp \ + dc_output_channel.cpp \ dc_outputs.cpp \ ethconfig.cpp \ keyphase.cpp \ @@ -48,6 +49,7 @@ HEADERS += \ config_mgr.h \ connect.h \ data_config.h \ + dc_output_channel.h \ dc_outputs.h \ displacement_ds.h \ ethconfig.h \ @@ -77,6 +79,7 @@ HEADERS += \ FORMS += \ acceleration.ui \ connect.ui \ + dc_output_channel.ui \ dc_outputs.ui \ ethconfig.ui \ keyphase.ui \ diff --git a/cardbase.h b/cardbase.h index fdf2398..e6761ea 100644 --- a/cardbase.h +++ b/cardbase.h @@ -37,6 +37,8 @@ class VariableBase { AlarmAlertLow gap_alert_low; FrequencybandOutput freband_output[10]; + + DCOutput dc_output[4]; }; // 位移 diff --git a/config_mgr.cpp b/config_mgr.cpp index cc6d81a..152f374 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -211,7 +211,6 @@ void ConfigMgr::Save(QString & file_path) { QJsonObject gap,gap_general,gap_alarm; gap_general["output_used"] = thrust_ptr->gap_general.output_used; gap_general["engieneering_unit"] = thrust_ptr->gap_general.engineering_unit; - gap_general["rectifier_function"] = thrust_ptr->gap_general.rectifier_function; gap_alarm["danger_high_level"] = thrust_ptr->gap_danger_high.level; gap_alarm["danger_high_hysteresis"] = thrust_ptr->gap_danger_high.hysteresis; @@ -671,7 +670,6 @@ void ConfigMgr::Load(QString filename) { g_alarm = gap["alarm"].toObject(); variable->gap_general.output_used = g_general["output_used"].toBool(); variable->gap_general.engineering_unit = g_general["engieneering_unit"].toInt(); - variable->gap_general.rectifier_function = g_general["rectifier_function"].toInt(); variable->gap_danger_high.level = g_alarm["danger_high_level"].toDouble(); variable->gap_danger_high.hysteresis = g_alarm["danger_high_hysteresis"].toDouble(); variable->gap_danger_high.delay = g_alarm["danger_high_delay"].toInt(); diff --git a/data_config.h b/data_config.h index 03390b8..39386a8 100644 --- a/data_config.h +++ b/data_config.h @@ -55,6 +55,28 @@ typedef enum { kVibPressurePulsation = 4 //动态压力脉动 } VibChannelType; +typedef enum{ + kTruePeak = 0, + kTruePeakToPeak = 1, + kRMSScalePeak = 2, + kRMSScalePeakToPeak = 3, + kAVG = 4, + kRMSScaleAVG = 5, + kRMS = 6 +} RectifierFuntion; + +typedef enum{ + kUnit1 = 0, // g + kUnit2 = 1, // m/s**2 + kUnit3 = 2, // mm/s + kUnit4 = 3, // inch/s + kUnit5 = 4, // um + kUnit6 = 5, // mm + kUnit7 = 6, // mils + kUnit8 = 7, // inch/s**2 + kUnit9 = 8 // user defined +} EngineeringUnit; + typedef struct SlotConfig_{ int slot; QString slot_type; @@ -176,6 +198,17 @@ typedef struct FrequencybandOutput_{ end = 0; } }FrequencybandOutput ; + +typedef struct DCOutput_{ + int output_channel; + float minmum; + float maxmum; + DCOutput_(){ + output_channel = 0; + minmum = 0; + maxmum = 0; + } +} DCOutput; //typedef struct { // Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass //} AllFilter; diff --git a/dc_output_channel.cpp b/dc_output_channel.cpp new file mode 100644 index 0000000..39e925e --- /dev/null +++ b/dc_output_channel.cpp @@ -0,0 +1,46 @@ +#include "dc_output_channel.h" +#include "ui_dc_output_channel.h" +#include + +DC_Output_Channel::DC_Output_Channel(QWidget *parent) : + QWidget(parent), + ui(new Ui::DC_Output_Channel) +{ + ui->setupUi(this); +} + +DC_Output_Channel::~DC_Output_Channel() +{ + delete ui; +} + +void DC_Output_Channel::on_pushButton_confirm_clicked() +{ + int channel = 0; + if((ui->lineEdit_minmum->text().toFloat() >= ui->lineEdit_maxmum->text().toFloat()) || + (ui->lineEdit_minmum->text().toFloat() == 0 && ui->lineEdit_maxmum->text().toFloat() == 0)){ + QMessageBox::information(this, QStringLiteral("提示"), "请填写正确的最小值和最大值"); + return; + } + if(ui->radioButton->isChecked()){ + channel = 1; + }else if(ui->radioButton_2->isChecked()){ + channel = 2; + }else if(ui->radioButton_3->isChecked()){ + channel = 3; + }else if(ui->radioButton_4->isChecked()){ + channel = 4; + }else { + QMessageBox::information(this, QStringLiteral("提示"), "请选择正确的通道"); + return; + } + emit output_channel_data_sg(channel,ui->lineEdit_minmum->text().toFloat(),ui->lineEdit_maxmum->text().toFloat()); + this->close(); +} + + +void DC_Output_Channel::on_pushButton_cancel_clicked() +{ + this->close(); +} + diff --git a/dc_output_channel.h b/dc_output_channel.h new file mode 100644 index 0000000..54555a8 --- /dev/null +++ b/dc_output_channel.h @@ -0,0 +1,28 @@ +#ifndef DC_OUTPUT_CHANNEL_H +#define DC_OUTPUT_CHANNEL_H + +#include + +namespace Ui { +class DC_Output_Channel; +} + +class DC_Output_Channel : public QWidget +{ + Q_OBJECT + +public: + explicit DC_Output_Channel(QWidget *parent = nullptr); + ~DC_Output_Channel(); +signals: + void output_channel_data_sg(int channel,float minmun,float maxmum); +private slots: + void on_pushButton_confirm_clicked(); + + void on_pushButton_cancel_clicked(); + +private: + Ui::DC_Output_Channel *ui; +}; + +#endif // DC_OUTPUT_CHANNEL_H diff --git a/dc_output_channel.ui b/dc_output_channel.ui new file mode 100644 index 0000000..404219a --- /dev/null +++ b/dc_output_channel.ui @@ -0,0 +1,209 @@ + + + DC_Output_Channel + + + + 0 + 0 + 527 + 416 + + + + 输出通道 + + + + + 30 + 50 + 391 + 181 + + + + 4 - 20 mA 输出 + + + + + 40 + 30 + 89 + 16 + + + + 通道1 + + + buttonGroup + + + + + + 40 + 60 + 89 + 16 + + + + 通道2 + + + buttonGroup + + + + + + 40 + 90 + 89 + 16 + + + + 通道3 + + + buttonGroup + + + + + + 40 + 120 + 89 + 16 + + + + 通道4 + + + buttonGroup + + + + + + + 50 + 260 + 113 + 25 + + + + + 0 + 25 + + + + + + + 50 + 300 + 113 + 25 + + + + + 0 + 25 + + + + + + + 190 + 270 + 54 + 12 + + + + - - + + + + + + 190 + 310 + 54 + 12 + + + + - - + + + + + + 280 + 270 + 54 + 12 + + + + 最小值 + + + + + + 280 + 310 + 54 + 12 + + + + 最大值 + + + + + + 90 + 360 + 75 + 23 + + + + 确认 + + + + + + 240 + 360 + 75 + 23 + + + + 取消 + + + + + + + + + diff --git a/dc_outputs.cpp b/dc_outputs.cpp index e292240..3f68c9a 100644 --- a/dc_outputs.cpp +++ b/dc_outputs.cpp @@ -1,14 +1,66 @@ #include "dc_outputs.h" #include "ui_dc_outputs.h" +#include +#include "dc_output_channel.h" +#include +#include "config_mgr.h" +#include "data_config.h" +#include "vibrationdata.h" -DC_Outputs::DC_Outputs(QWidget *parent) : +DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) : QWidget(parent), ui(new Ui::DC_Outputs) { ui->setupUi(this); + ui->comboBox_ch_output->setView(new QListView()); + slot_no = slot_no_; + car_type = static_cast(cardtype); + memset(channel_used,0,sizeof(channel_used)); + current_index = ui->comboBox_ch_output->currentIndex(); + Init(); } DC_Outputs::~DC_Outputs() { delete ui; } + +void DC_Outputs::Init(){ + std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); + if (base_ptr == nullptr) { + qCritical() << "[Acceleration::Init] should not be here"; + return; + } + std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); + std::shared_ptr variable_base = ptr->GetChannelPtr(current_index + 1); + if (variable_base == nullptr) { + qDebug() << "[Acceleration::Init] no channel ptr"; + return; + } + if(variable_base->dc_output[0].output_channel == 1){ + ui->label_ch_1->setText("通道1"); + ui->label_ch_1_min->setText(QString::number(variable_base->dc_output[0].minmum)); + ui->label_ch_1_max->setText(QString::number(variable_base->dc_output[0].maxmum)); + } +} + +void DC_Outputs::on_comboBox_ch_output_activated(int index) +{ + DC_Output_Channel *dc_output_channel = new DC_Output_Channel(); + dc_output_channel->setWindowModality(Qt::ApplicationModal); + connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float)),this,SLOT(output_channel_data(int,float,float))); + dc_output_channel->show(); +} + +void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum){ + qDebug() << channel << minmun << maxmum ; + if(channel == 1){ + + }else if(channel == 2){ + + }else if(channel == 3){ + + }else if(channel == 4){ + + } +} diff --git a/dc_outputs.h b/dc_outputs.h index 6f155f8..fa5496a 100644 --- a/dc_outputs.h +++ b/dc_outputs.h @@ -2,6 +2,7 @@ #define DC_OUTPUTS_H #include +#include "data_config.h" namespace Ui { class DC_Outputs; @@ -12,11 +13,20 @@ class DC_Outputs : public QWidget Q_OBJECT public: - explicit DC_Outputs(QWidget *parent = nullptr); + explicit DC_Outputs(int slot_no_,int cardtype,QWidget *parent = nullptr); ~DC_Outputs(); + int slot_no; + CardType car_type; +private slots: + void on_comboBox_ch_output_activated(int index); + + void output_channel_data(int channel,float minmun,float maxmum); private: Ui::DC_Outputs *ui; + void Init(); + bool channel_used[4]; + int current_index; }; #endif // DC_OUTPUTS_H diff --git a/dc_outputs.ui b/dc_outputs.ui index 98711df..d29c893 100644 --- a/dc_outputs.ui +++ b/dc_outputs.ui @@ -11,9 +11,9 @@ - Form + 直流输出 - + 60 @@ -39,12 +39,37 @@ 通道1 输出1 + + + 通道2 输出1 + + + + + 通道3 输出1 + + + + + 通道4 输出1 + + + + + 通道1 & 通道4 + + + + + 通道3 & 通道4 + + 50 - 150 + 160 54 12 @@ -95,8 +120,8 @@ - 160 - 100 + 140 + 110 101 16 @@ -109,8 +134,8 @@ 310 - 100 - 101 + 110 + 41 16 @@ -122,8 +147,8 @@ 440 - 100 - 101 + 110 + 41 16 @@ -131,20 +156,20 @@ 最大值 - + 160 - 150 + 160 81 16 - 通道1 输出1 + 未使用 - + 160 @@ -154,10 +179,10 @@ - 通道1 输出2 + 未使用 - + 160 @@ -170,7 +195,7 @@ 未使用 - + 160 @@ -183,20 +208,20 @@ 未使用 - + 300 - 140 + 160 101 16 - 0.0 m/s**2_RMSpk + ----- ----- - + 300 @@ -206,23 +231,23 @@ - 0.000 g_RMS + ----- ----- - + 420 - 140 + 160 121 16 - 200.0 m/s**2_RMSpk + ----- ----- - + 420 @@ -232,10 +257,10 @@ - 666.667 g_RMS + ----- ----- - + 300 @@ -248,7 +273,7 @@ ----- ----- - + 300 @@ -261,10 +286,10 @@ ----- ----- - + - 430 + 420 240 71 16 @@ -274,10 +299,10 @@ ----- ----- - + - 430 + 420 280 71 16 @@ -287,6 +312,32 @@ ----- ----- + + + + 160 + 380 + 75 + 23 + + + + 确认 + + + + + + 340 + 380 + 75 + 23 + + + + 取消 + + diff --git a/mainwindow.cpp b/mainwindow.cpp index e71af28..bbc4e02 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -26,6 +26,7 @@ #include "ethconfig.h" #include "macconfig.h" #include +#include "dc_outputs.h" QString g_strServerIp; QString g_version; @@ -475,6 +476,9 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) { case kCardVibSingle:{ QString object_name = slot_btn->objectName(); int button_id = object_name.right(object_name.length() - 15).toInt(); + DC_Outputs *dc_output = new DC_Outputs(button_id,ConfigMgr::Instance()->card_type_[button_id - 1]); + dc_output->setWindowModality(Qt::ApplicationModal); + dc_output->show(); // Setpoint *setpoint = new Setpoint(button_id,ConfigMgr::Instance()->card_type_[button_id - 1]); // setpoint->setWindowModality(Qt::ApplicationModal); // setpoint->show(); diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index 8651773..a2ac7a8 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -30,6 +30,8 @@ Seismic_monitor::Seismic_monitor(int slot,int cardtype, QWidget *parent) : car_type = static_cast(cardtype); QString slot_no_ = QString("%1").arg(slot_no); ui->label_slot_no->setText(slot_no_); + ui->checkBox_standby_1->hide(); + ui->checkBox_standby_2->hide(); Init(); } diff --git a/trust.cpp b/trust.cpp index 8f31fe2..2d8f104 100644 --- a/trust.cpp +++ b/trust.cpp @@ -70,7 +70,6 @@ void Trust::Init() { else ui->comboBox_output_used->setCurrentIndex(1); ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->gap_general.engineering_unit); - ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->gap_general.rectifier_function); // -alarm ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->gap_danger_high.level)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->gap_danger_high.hysteresis)); @@ -136,7 +135,6 @@ void Trust::on_pushButton_confirm_clicked() else variable->gap_general.output_used = false; variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); - variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -183,7 +181,6 @@ void Trust::on_pushButton_confirm_clicked() else variable->gap_general.output_used = false; variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); - variable->gap_general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); // -alarm variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); diff --git a/trust.ui b/trust.ui index 4f70b64..fb7f077 100644 --- a/trust.ui +++ b/trust.ui @@ -287,52 +287,12 @@ - 1 + 0 常规 - - - - 170 - 150 - 54 - 12 - - - - 整流器 - - - - - - 10 - 140 - 125 - 25 - - - - - 125 - 25 - - - - - 125 - 25 - - - - - RMS - - - From 1f780ef25b148f65522c4830ef476e6f22f59523 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Mon, 4 Aug 2025 16:29:14 +0800 Subject: [PATCH 08/14] temp code --- dc_outputs.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/dc_outputs.cpp b/dc_outputs.cpp index 3f68c9a..4adb94c 100644 --- a/dc_outputs.cpp +++ b/dc_outputs.cpp @@ -34,7 +34,7 @@ void DC_Outputs::Init(){ std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); std::shared_ptr variable_base = ptr->GetChannelPtr(current_index + 1); if (variable_base == nullptr) { - qDebug() << "[Acceleration::Init] no channel ptr"; + qDebug() << "[DC_Outputs::Init] no channel ptr"; return; } if(variable_base->dc_output[0].output_channel == 1){ @@ -42,6 +42,21 @@ void DC_Outputs::Init(){ ui->label_ch_1_min->setText(QString::number(variable_base->dc_output[0].minmum)); ui->label_ch_1_max->setText(QString::number(variable_base->dc_output[0].maxmum)); } + if(variable_base->dc_output[0].output_channel == 2){ + ui->label_ch_2->setText("通道2"); + ui->label_ch_2_min->setText(QString::number(variable_base->dc_output[1].minmum)); + ui->label_ch_2_max->setText(QString::number(variable_base->dc_output[1].maxmum)); + } + if(variable_base->dc_output[0].output_channel == 3){ + ui->label_ch_3->setText("通道3"); + ui->label_ch_3_min->setText(QString::number(variable_base->dc_output[2].minmum)); + ui->label_ch_3_max->setText(QString::number(variable_base->dc_output[2].maxmum)); + } + if(variable_base->dc_output[0].output_channel == 4){ + ui->label_ch_4->setText("通道4"); + ui->label_ch_4_min->setText(QString::number(variable_base->dc_output[3].minmum)); + ui->label_ch_4_max->setText(QString::number(variable_base->dc_output[3].maxmum)); + } } void DC_Outputs::on_comboBox_ch_output_activated(int index) @@ -55,12 +70,63 @@ void DC_Outputs::on_comboBox_ch_output_activated(int index) void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum){ qDebug() << channel << minmun << maxmum ; if(channel == 1){ - + ui->label_ch_1->setText("通道1"); + ui->label_ch_1_min->setText(QString::number(minmun)); + ui->label_ch_1_max->setText(QString::number(maxmum)); }else if(channel == 2){ - + ui->label_ch_2->setText("通道2"); + ui->label_ch_2_min->setText(QString::number(minmun)); + ui->label_ch_2_max->setText(QString::number(maxmum)); }else if(channel == 3){ - + ui->label_ch_3->setText("通道3"); + ui->label_ch_3_min->setText(QString::number(minmun)); + ui->label_ch_3_max->setText(QString::number(maxmum)); }else if(channel == 4){ - + ui->label_ch_4->setText("通道4"); + ui->label_ch_4_min->setText(QString::number(minmun)); + ui->label_ch_4_max->setText(QString::number(maxmum)); } } + +void DC_Outputs::on_pushButton_confirm_clicked() +{ + std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); + if (base_ptr == nullptr) { + qCritical() << "[Acceleration::Init] should not be here"; + return; + } + std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); + std::shared_ptr variable_base = ptr->GetChannelPtr(current_index); + if (variable_base == nullptr ) { + return ; + } + if(ui->label_ch_1->text() != "未使用"){ + variable_base->dc_output[0].output_channel = 1; + variable_base->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat(); + variable_base->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat(); + } + if(ui->label_ch_2->text() != "未使用"){ + variable_base->dc_output[1].output_channel = 2; + variable_base->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat(); + variable_base->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat(); + } + if(ui->label_ch_3->text() != "未使用"){ + variable_base->dc_output[2].output_channel = 3; + variable_base->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat(); + variable_base->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat(); + } + if(ui->label_ch_4->text() != "未使用"){ + variable_base->dc_output[3].output_channel = 4; + variable_base->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat(); + variable_base->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat(); + } + ptr->variables_.push_back(variable_base); + this->close(); +} + + +void DC_Outputs::on_pushButton_cancel_clicked() +{ + this->close(); +} + From 648b8b0f709732eb6183ae2b8ccffbbc7c7a4dda Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Mon, 4 Aug 2025 20:13:21 +0800 Subject: [PATCH 09/14] add dc output --- cardbase.h | 2 - config_mgr.cpp | 26 +++++- data_config.h | 75 +++++++++++++++- dc_output_channel.cpp | 16 +++- dc_output_channel.h | 6 +- dc_outputs.cpp | 197 ++++++++++++++++++++++++++++++++---------- dc_outputs.h | 12 ++- dc_outputs.ui | 136 +++++++++++++++++++++++++---- vibrationdata.h | 1 + 9 files changed, 402 insertions(+), 69 deletions(-) diff --git a/cardbase.h b/cardbase.h index e6761ea..fdf2398 100644 --- a/cardbase.h +++ b/cardbase.h @@ -37,8 +37,6 @@ class VariableBase { AlarmAlertLow gap_alert_low; FrequencybandOutput freband_output[10]; - - DCOutput dc_output[4]; }; // 位移 diff --git a/config_mgr.cpp b/config_mgr.cpp index 152f374..d00abe2 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -41,6 +41,7 @@ void ConfigMgr::Save(QString & file_path) { card_type_[i] != kCardRelaySingleNOK) { continue; } + qDebug() << "i" << i ; // process slot QJsonObject slot_item; if (card_type_[i] != kCardRelaySingle && @@ -74,15 +75,26 @@ void ConfigMgr::Save(QString & file_path) { voltage_range.append(ptr->base_config_[cid].normal_voltage_low); voltage_range.append(ptr->base_config_[cid].normal_voltage_high); channel_item["normal_voltage_range"] = voltage_range; - QJsonObject setpoint_data; + QJsonObject dc_output; + QJsonArray dc_output_array; if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust || ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){ if(ptr->base_config_[cid].channel_type != kVibThrust){ channel_item["keyphase"] = ptr->base_config_[cid].keyphase; channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot; channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch; - } + } } + for(int var = 0 ; var < CHANNEL_COUNT; ++ var ){ + if(ptr->dc_output[cid][var].output_channel > 0){ + dc_output["output_channel"] = ptr->dc_output[cid][var].output_channel; + dc_output["minmum"] = ptr->dc_output[cid][var].minmum; + dc_output["maxmum"] = ptr->dc_output[cid][var].maxmum; + dc_output_array.append(dc_output); + } + + } + channel_item["dc_output"] = dc_output_array; // if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){ // setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0; // setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable; @@ -570,6 +582,16 @@ void ConfigMgr::Load(QString filename) { vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt(); vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt(); } + // dc_output + QJsonArray dc_output_array = channel["dc_output"].toArray(); + if(!dc_output_array.isEmpty()){ + for(int var = 0 ; var < CHANNEL_COUNT; ++var){ + QJsonObject dc_output_obj = dc_output_array[var].toObject(); + vib_data->dc_output[j][var].output_channel = dc_output_obj["output_channel"].toInt(); + vib_data->dc_output[j][var].minmum = dc_output_obj["minmum"].toInt(); + vib_data->dc_output[j][var].maxmum = dc_output_obj["maxmum"].toInt(); + } + } // if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){ // vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble(); // vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool(); diff --git a/data_config.h b/data_config.h index 39386a8..be4489e 100644 --- a/data_config.h +++ b/data_config.h @@ -8,9 +8,13 @@ typedef unsigned char uint8_t; typedef unsigned short uint16_t; +typedef struct { + bool used[4]; // 是否已配置 +}ChannelUsed; + extern QString g_strServerIp; // 服务端IP extern QString g_version; - +extern ChannelUsed ch_used; #define SLOT_NUM 15 #define CHANNEL_COUNT 4 #define RELAY_COUNT 16 @@ -54,7 +58,68 @@ typedef enum { kVibThrust = 3, //轴向位移 kVibPressurePulsation = 4 //动态压力脉动 } VibChannelType; +enum TotalCalcValueType { + // 转速 + kSpeedRpm = 0, + // 轴向位移 + kThrustGap = 2, + + // 径向位移 + kRadialPk = 4, + kRadialPk2Pk = 5, + kRadialRmsScaledPeak = 6, + kRadialRmsScaledPk2Pk = 7, + + // 速度 + kVelPeak = 11, + kVelRmsScaledPeak = 12, + kVelRms = 13, + + kVelDisPeak = 17, + kVelDisPk2Pk = 18, + kVelDisRmsScaledPeak = 19, + kVelDisRmsScaledPk2Pk = 20, + + // 加速度 + kAccPeak = 21, + kAccRmsScaledPeak = 22, + kAccRms = 23, + + kAccVelPeak = 26, + kAccVelRmsScaledPeak = 27, + kAccVelRms = 28, + + kAccDisPeak = 31, + kAccDisPk2Pk = 32, + kAccDisRmsScaledPeak = 33, + kAccDisRmsScaledPk2Pk = 34, + + // 压力脉动 + kPressPulsationPeak = 41, + kPressPulsationRmsScaledPeak = 42, + kPressPulsationRms = 43, + + // kTriggerPressurePulsationLow = 11, // [10, 40] + // kTriggerPressurePulsationMID1 = 12, // (40, 120] + // kTriggerPressurePulsationMID2 = 13, // (120, 190] + // kTriggerPressurePulsationHIGH1 = 14, // (190, 290] + // kTriggerPressurePulsationHIGH2 = 15, // (290, 500] + // kTriggerPressurePulsationHH1 = 16, // (500, 2000] + // kTriggerPressurePulsationHH2 = 17, // (2000, 3200] + // kTriggerPressurePulsationHH3 = 18, // (3200, 4200] + // kTriggerPressurePulsationHH4 = 19, // (4200, 4600] + // kTriggerPressurePulsationOA = 20, // [5, 500] + + // 复合运算 + kSmax = 81, // 径向位移运算 + kDifferentialHousingExpansion = 82, // 差胀,针对轴向位移,做减法 + kRelativeShaftTaper = 83, // 径向位移,根据公式进行计算 + kRelativeShaftCollar = 84, // 径向位移,根据公式进行计算 + kDualMathematicalFunction = 85, // 公式计算 + + kDCValue = 100, +}; typedef enum{ kTruePeak = 0, kTruePeakToPeak = 1, @@ -74,7 +139,11 @@ typedef enum{ kUnit6 = 5, // mm kUnit7 = 6, // mils kUnit8 = 7, // inch/s**2 - kUnit9 = 8 // user defined + kUnit9 = 9, // mbar + kUnit10 = 10, // bar + kUnit11 = 11, // psi + kUnit12 = 12, // pa + kUnit13 = 13 // user defined } EngineeringUnit; typedef struct SlotConfig_{ @@ -209,6 +278,8 @@ typedef struct DCOutput_{ maxmum = 0; } } DCOutput; + + //typedef struct { // Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass //} AllFilter; diff --git a/dc_output_channel.cpp b/dc_output_channel.cpp index 39e925e..acd163f 100644 --- a/dc_output_channel.cpp +++ b/dc_output_channel.cpp @@ -1,12 +1,26 @@ #include "dc_output_channel.h" #include "ui_dc_output_channel.h" #include +#include "data_config.h" -DC_Output_Channel::DC_Output_Channel(QWidget *parent) : + + +DC_Output_Channel::DC_Output_Channel(QString unit_str_,QWidget *parent) : QWidget(parent), ui(new Ui::DC_Output_Channel) { ui->setupUi(this); + unit_str = unit_str_; + ui->label_min_unit->setText(unit_str); + ui->label_max_unit->setText(unit_str); + radiobtn[0] = ui->radioButton; + radiobtn[1] = ui->radioButton_2; + radiobtn[2] = ui->radioButton_3; + radiobtn[3] = ui->radioButton_4; + for (int i = 0; i < 4; i++) { + if(ch_used.used[i]) + radiobtn[i]->setEnabled(false); + } } DC_Output_Channel::~DC_Output_Channel() diff --git a/dc_output_channel.h b/dc_output_channel.h index 54555a8..5a24dfa 100644 --- a/dc_output_channel.h +++ b/dc_output_channel.h @@ -2,6 +2,7 @@ #define DC_OUTPUT_CHANNEL_H #include +#include namespace Ui { class DC_Output_Channel; @@ -12,7 +13,7 @@ class DC_Output_Channel : public QWidget Q_OBJECT public: - explicit DC_Output_Channel(QWidget *parent = nullptr); + explicit DC_Output_Channel(QString unit_str_,QWidget *parent = nullptr); ~DC_Output_Channel(); signals: void output_channel_data_sg(int channel,float minmun,float maxmum); @@ -23,6 +24,9 @@ private slots: private: Ui::DC_Output_Channel *ui; + QString unit_str; + QRadioButton *radiobtn[4]; + bool channel_used[4] = {false,false,false,false}; }; #endif // DC_OUTPUT_CHANNEL_H diff --git a/dc_outputs.cpp b/dc_outputs.cpp index 4adb94c..61cf5c8 100644 --- a/dc_outputs.cpp +++ b/dc_outputs.cpp @@ -7,6 +7,8 @@ #include "data_config.h" #include "vibrationdata.h" +ChannelUsed ch_used; + DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) : QWidget(parent), ui(new Ui::DC_Outputs) @@ -15,7 +17,7 @@ DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) : ui->comboBox_ch_output->setView(new QListView()); slot_no = slot_no_; car_type = static_cast(cardtype); - memset(channel_used,0,sizeof(channel_used)); + unit = ""; current_index = ui->comboBox_ch_output->currentIndex(); Init(); } @@ -28,40 +30,120 @@ DC_Outputs::~DC_Outputs() void DC_Outputs::Init(){ std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); if (base_ptr == nullptr) { - qCritical() << "[Acceleration::Init] should not be here"; + qCritical() << "[DC_Outputs" +"::Init] should not be here"; return; } - std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); - std::shared_ptr variable_base = ptr->GetChannelPtr(current_index + 1); - if (variable_base == nullptr) { - qDebug() << "[DC_Outputs::Init] no channel ptr"; - return; - } - if(variable_base->dc_output[0].output_channel == 1){ + vib_dc_output_ptr = std::dynamic_pointer_cast(base_ptr); + QString unit_str = GetUnit(); + if(vib_dc_output_ptr->dc_output[current_index][0].output_channel == 1){ ui->label_ch_1->setText("通道1"); - ui->label_ch_1_min->setText(QString::number(variable_base->dc_output[0].minmum)); - ui->label_ch_1_max->setText(QString::number(variable_base->dc_output[0].maxmum)); + ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].minmum)); + ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].maxmum)); + ch_used.used[0] = true; } - if(variable_base->dc_output[0].output_channel == 2){ + if(vib_dc_output_ptr->dc_output[current_index][1].output_channel == 2){ ui->label_ch_2->setText("通道2"); - ui->label_ch_2_min->setText(QString::number(variable_base->dc_output[1].minmum)); - ui->label_ch_2_max->setText(QString::number(variable_base->dc_output[1].maxmum)); + ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].minmum)); + ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].maxmum)); + ch_used.used[1] = true; } - if(variable_base->dc_output[0].output_channel == 3){ + if(vib_dc_output_ptr->dc_output[current_index][2].output_channel == 3){ ui->label_ch_3->setText("通道3"); - ui->label_ch_3_min->setText(QString::number(variable_base->dc_output[2].minmum)); - ui->label_ch_3_max->setText(QString::number(variable_base->dc_output[2].maxmum)); + ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].minmum)); + ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].maxmum)); + ch_used.used[2] = true; } - if(variable_base->dc_output[0].output_channel == 4){ + if(vib_dc_output_ptr->dc_output[current_index][3].output_channel == 4){ ui->label_ch_4->setText("通道4"); - ui->label_ch_4_min->setText(QString::number(variable_base->dc_output[3].minmum)); - ui->label_ch_4_max->setText(QString::number(variable_base->dc_output[3].maxmum)); + ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].minmum)); + ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].maxmum)); + ch_used.used[3] = true; } + } +QString DC_Outputs::GetUnit(){ + int unit_num = -1; + QString unit_str = ""; + std::shared_ptr variable_base = vib_dc_output_ptr->GetChannelPtr(current_index + 1); + if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibRadial) { + std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); + unit_num = variable_ptr->general.engineering_unit; + } + if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibAcc) { + std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); + unit_num = variable_ptr->general.engineering_unit; + } + if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibVelocity) { + std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); + unit_num = variable_ptr->general.engineering_unit; + } + if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibThrust) { + std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); + unit_num = variable_ptr->general.engineering_unit; + } + if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibPressurePulsation) { + std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); + unit_num = variable_ptr->general.engineering_unit; + } + switch (unit_num) { + case kUnit1:{ + unit_str = "g"; + break; + } + case kUnit2:{ + unit_str = "m/s**2"; + break; + } + case kUnit3:{ + unit_str = "mm/s"; + break; + } + case kUnit4:{ + unit_str = "inch/s"; + break; + } + case kUnit5:{ + unit_str = "um"; + break; + } + case kUnit6:{ + unit_str = "mm"; + break; + } + case kUnit7:{ + unit_str = "mils"; + break; + } + case kUnit8:{ + unit_str = "inch/s**2"; + break; + } + case kUnit9:{ + unit_str = "mbar"; + break; + } + case kUnit10:{ + unit_str = "bar"; + break; + } + case kUnit11:{ + unit_str = "psi"; + break; + } + case kUnit12:{ + unit_str = "pa"; + break; + } + } + return unit_str; +} void DC_Outputs::on_comboBox_ch_output_activated(int index) { - DC_Output_Channel *dc_output_channel = new DC_Output_Channel(); + current_index = index; + QString unit_str = GetUnit(); + DC_Output_Channel *dc_output_channel = new DC_Output_Channel(unit_str); dc_output_channel->setWindowModality(Qt::ApplicationModal); connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float)),this,SLOT(output_channel_data(int,float,float))); dc_output_channel->show(); @@ -69,58 +151,54 @@ void DC_Outputs::on_comboBox_ch_output_activated(int index) void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum){ qDebug() << channel << minmun << maxmum ; + QString unit_str = GetUnit(); if(channel == 1){ ui->label_ch_1->setText("通道1"); ui->label_ch_1_min->setText(QString::number(minmun)); ui->label_ch_1_max->setText(QString::number(maxmum)); + ch_used.used[0] = true; }else if(channel == 2){ ui->label_ch_2->setText("通道2"); ui->label_ch_2_min->setText(QString::number(minmun)); ui->label_ch_2_max->setText(QString::number(maxmum)); + ch_used.used[1] = true; }else if(channel == 3){ ui->label_ch_3->setText("通道3"); ui->label_ch_3_min->setText(QString::number(minmun)); ui->label_ch_3_max->setText(QString::number(maxmum)); + ch_used.used[2] = true; }else if(channel == 4){ ui->label_ch_4->setText("通道4"); ui->label_ch_4_min->setText(QString::number(minmun)); ui->label_ch_4_max->setText(QString::number(maxmum)); + ch_used.used[3] = true; } } void DC_Outputs::on_pushButton_confirm_clicked() { - std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); - if (base_ptr == nullptr) { - qCritical() << "[Acceleration::Init] should not be here"; - return; - } - std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); - std::shared_ptr variable_base = ptr->GetChannelPtr(current_index); - if (variable_base == nullptr ) { - return ; - } + if(ui->label_ch_1->text() != "未使用"){ - variable_base->dc_output[0].output_channel = 1; - variable_base->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat(); - variable_base->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat(); + vib_dc_output_ptr->dc_output[current_index][0].output_channel = 1; + vib_dc_output_ptr->dc_output[current_index][0].minmum = ui->label_ch_1_min->text().toFloat(); + vib_dc_output_ptr->dc_output[current_index][0].maxmum = ui->label_ch_1_max->text().toFloat(); } if(ui->label_ch_2->text() != "未使用"){ - variable_base->dc_output[1].output_channel = 2; - variable_base->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat(); - variable_base->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat(); + vib_dc_output_ptr->dc_output[current_index][1].output_channel = 2; + vib_dc_output_ptr->dc_output[current_index][1].minmum = ui->label_ch_2_min->text().toFloat(); + vib_dc_output_ptr->dc_output[current_index][1].maxmum = ui->label_ch_2_max->text().toFloat(); } if(ui->label_ch_3->text() != "未使用"){ - variable_base->dc_output[2].output_channel = 3; - variable_base->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat(); - variable_base->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat(); + vib_dc_output_ptr->dc_output[current_index][2].output_channel = 3; + vib_dc_output_ptr->dc_output[current_index][2].minmum = ui->label_ch_3_min->text().toFloat(); + vib_dc_output_ptr->dc_output[current_index][2].maxmum = ui->label_ch_3_max->text().toFloat(); } if(ui->label_ch_4->text() != "未使用"){ - variable_base->dc_output[3].output_channel = 4; - variable_base->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat(); - variable_base->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat(); + vib_dc_output_ptr->dc_output[current_index][3].output_channel = 4; + vib_dc_output_ptr->dc_output[current_index][3].minmum = ui->label_ch_4_min->text().toFloat(); + vib_dc_output_ptr->dc_output[current_index][3].maxmum = ui->label_ch_4_max->text().toFloat(); } - ptr->variables_.push_back(variable_base); + this->close(); } @@ -130,3 +208,34 @@ void DC_Outputs::on_pushButton_cancel_clicked() this->close(); } + +void DC_Outputs::on_comboBox_ch_output_currentIndexChanged(int index) +{ + current_index = index; + QString unit_str = GetUnit(); + if(vib_dc_output_ptr->dc_output[current_index][0].output_channel == 1){ + ui->label_ch_1->setText("通道1"); + ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].minmum)); + ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].maxmum)); + ch_used.used[0] = true; + } + if(vib_dc_output_ptr->dc_output[current_index][1].output_channel == 2){ + ui->label_ch_2->setText("通道2"); + ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].minmum)); + ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].maxmum)); + ch_used.used[1] = true; + } + if(vib_dc_output_ptr->dc_output[current_index][2].output_channel == 3){ + ui->label_ch_3->setText("通道3"); + ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].minmum)); + ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].maxmum)); + ch_used.used[2] = true; + } + if(vib_dc_output_ptr->dc_output[current_index][3].output_channel == 4){ + ui->label_ch_4->setText("通道4"); + ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].minmum)); + ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].maxmum)); + ch_used.used[3] = true; + } +} + diff --git a/dc_outputs.h b/dc_outputs.h index fa5496a..ef64ce3 100644 --- a/dc_outputs.h +++ b/dc_outputs.h @@ -3,6 +3,7 @@ #include #include "data_config.h" +#include "vibrationdata.h" namespace Ui { class DC_Outputs; @@ -20,13 +21,22 @@ public: private slots: void on_comboBox_ch_output_activated(int index); + void on_pushButton_confirm_clicked(); + + void on_pushButton_cancel_clicked(); + void output_channel_data(int channel,float minmun,float maxmum); + void on_comboBox_ch_output_currentIndexChanged(int index); + private: Ui::DC_Outputs *ui; + std::shared_ptr vib_dc_output_ptr = nullptr; void Init(); - bool channel_used[4]; + QString GetUnit(); + int current_index; + QString unit; }; #endif // DC_OUTPUTS_H diff --git a/dc_outputs.ui b/dc_outputs.ui index d29c893..4d30069 100644 --- a/dc_outputs.ui +++ b/dc_outputs.ui @@ -213,12 +213,12 @@ 300 160 - 101 + 41 16 - ----- ----- + ----- @@ -226,12 +226,12 @@ 300 200 - 101 + 31 16 - ----- ----- + ----- @@ -239,12 +239,12 @@ 420 160 - 121 + 31 16 - ----- ----- + ----- @@ -252,12 +252,12 @@ 420 200 - 101 + 31 16 - ----- ----- + ----- @@ -265,12 +265,12 @@ 300 240 - 71 + 31 16 - ----- ----- + ----- @@ -278,12 +278,12 @@ 300 280 - 71 + 31 16 - ----- ----- + ----- @@ -291,12 +291,12 @@ 420 240 - 71 + 31 16 - ----- ----- + ----- @@ -304,12 +304,12 @@ 420 280 - 71 + 31 16 - ----- ----- + ----- @@ -338,6 +338,110 @@ 取消 + + + + 340 + 160 + 41 + 16 + + + + ----- + + + + + + 460 + 160 + 41 + 16 + + + + ----- + + + + + + 340 + 200 + 41 + 16 + + + + ----- + + + + + + 460 + 200 + 41 + 16 + + + + ----- + + + + + + 340 + 240 + 41 + 16 + + + + ----- + + + + + + 460 + 240 + 41 + 16 + + + + ----- + + + + + + 340 + 280 + 41 + 16 + + + + ----- + + + + + + 460 + 280 + 31 + 16 + + + + ----- + + diff --git a/vibrationdata.h b/vibrationdata.h index fccb69f..14ce487 100644 --- a/vibrationdata.h +++ b/vibrationdata.h @@ -14,6 +14,7 @@ class VibrationData : public CardBase { std::vector> variables_; VibAlertDanger alert_danger[CHANNEL_COUNT]; VibAlertDangerPress alert_danger_press[CHANNEL_COUNT]; + DCOutput dc_output[CHANNEL_COUNT][CHANNEL_COUNT]; }; #endif // VIBRATIONDATA_H From 340f9316ee8e9d907cdfad6eb53691a530b5cfe2 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Tue, 5 Aug 2025 20:49:25 +0800 Subject: [PATCH 10/14] modify code --- acceleration.ui | 55 ++ config_mgr.cpp | 259 +++--- data_config.h | 5 +- dc_output_channel.cpp | 34 +- dc_output_channel.h | 9 +- dc_output_channel.ui | 16 + dc_outputs.cpp | 335 +++++--- dc_outputs.h | 9 +- dc_outputs.ui | 80 ++ pressure_pulsation.cpp | 117 ++- pressure_pulsation.ui | 1814 ++++++++++++++++++++++------------------ radial_vibration.cpp | 80 +- radial_vibration.ui | 420 +++++++--- seismic_monitor.cpp | 17 +- seismic_monitor.ui | 28 +- trust.ui | 94 ++- velocity.ui | 100 +++ vibrationdata.h | 2 +- 18 files changed, 2237 insertions(+), 1237 deletions(-) diff --git a/acceleration.ui b/acceleration.ui index 90138e4..10182ec 100644 --- a/acceleration.ui +++ b/acceleration.ui @@ -483,11 +483,36 @@ 25 + + + g + + + + + m/s**2 + + + + + mm/s + + + + + inch/s + + um + + + mm + + @@ -720,6 +745,9 @@ + + false + 220 @@ -730,6 +758,9 @@ + + false + 150 @@ -740,6 +771,9 @@ + + false + 80 @@ -750,6 +784,9 @@ + + false + 220 @@ -760,6 +797,9 @@ + + false + 80 @@ -770,6 +810,9 @@ + + false + 150 @@ -806,6 +849,9 @@ + + false + 290 @@ -819,6 +865,9 @@ + + false + 290 @@ -845,6 +894,9 @@ + + false + 350 @@ -871,6 +923,9 @@ + + false + 350 diff --git a/config_mgr.cpp b/config_mgr.cpp index d00abe2..27a309d 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -41,13 +41,13 @@ void ConfigMgr::Save(QString & file_path) { card_type_[i] != kCardRelaySingleNOK) { continue; } - qDebug() << "i" << i ; // process slot QJsonObject slot_item; if (card_type_[i] != kCardRelaySingle && card_type_[i] != kCardRelayTMRPrimary && card_type_[i] != kCardRelaySingleNOK && card_type_[i] != kCardRelayTMRBackup) { + QJsonObject dc_output; for (int cid = 0; cid < CHANNEL_COUNT; ++cid) { QJsonObject channel_item; if (card_type_[i] == kCardVibSingle || @@ -75,8 +75,14 @@ void ConfigMgr::Save(QString & file_path) { voltage_range.append(ptr->base_config_[cid].normal_voltage_low); voltage_range.append(ptr->base_config_[cid].normal_voltage_high); channel_item["normal_voltage_range"] = voltage_range; - QJsonObject dc_output; - QJsonArray dc_output_array; + // output channel + QJsonObject dc_output_item; + if(ptr->dc_output[cid].output_channel != -1){ + dc_output_item["output_channel"] = ptr->dc_output[cid].output_channel; + dc_output_item["minmum"] = ptr->dc_output[cid].minmum; + dc_output_item["maxmum"] = ptr->dc_output[cid].maxmum; + dc_output[QString::number(cid + 1)] = dc_output_item; + } if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust || ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){ if(ptr->base_config_[cid].channel_type != kVibThrust){ @@ -85,16 +91,6 @@ void ConfigMgr::Save(QString & file_path) { channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch; } } - for(int var = 0 ; var < CHANNEL_COUNT; ++ var ){ - if(ptr->dc_output[cid][var].output_channel > 0){ - dc_output["output_channel"] = ptr->dc_output[cid][var].output_channel; - dc_output["minmum"] = ptr->dc_output[cid][var].minmum; - dc_output["maxmum"] = ptr->dc_output[cid][var].maxmum; - dc_output_array.append(dc_output); - } - - } - channel_item["dc_output"] = dc_output_array; // if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){ // setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0; // setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable; @@ -152,16 +148,16 @@ void ConfigMgr::Save(QString & file_path) { alarm["alert_high_delay"] = radial_ptr->alert_high.delay; alarm["alert_high_enable"] = radial_ptr->alert_high.enable; alarm["alert_high_latch"] = radial_ptr->alert_high.latch; - alarm["danger_low_level"] = radial_ptr->danger_low.level; - alarm["danger_low_hysteresis"] = radial_ptr->danger_low.hysteresis; - alarm["danger_low_delay"] = radial_ptr->danger_low.delay; - alarm["danger_low_enable"] = radial_ptr->danger_low.enable; - alarm["danger_low_latch"] = radial_ptr->danger_low.latch; - alarm["alert_low_level"] = radial_ptr->alert_low.level; - alarm["alert_low_hysteresis"] = radial_ptr->alert_low.hysteresis; - alarm["alert_low_delay"] = radial_ptr->alert_low.delay; - alarm["alert_low_enable"] = radial_ptr->alert_low.enable; - alarm["alert_low_latch"] = radial_ptr->alert_low.latch; +// alarm["danger_low_level"] = radial_ptr->danger_low.level; +// alarm["danger_low_hysteresis"] = radial_ptr->danger_low.hysteresis; +// alarm["danger_low_delay"] = radial_ptr->danger_low.delay; +// alarm["danger_low_enable"] = radial_ptr->danger_low.enable; +// alarm["danger_low_latch"] = radial_ptr->danger_low.latch; +// alarm["alert_low_level"] = radial_ptr->alert_low.level; +// alarm["alert_low_hysteresis"] = radial_ptr->alert_low.hysteresis; +// alarm["alert_low_delay"] = radial_ptr->alert_low.delay; +// alarm["alert_low_enable"] = radial_ptr->alert_low.enable; +// alarm["alert_low_latch"] = radial_ptr->alert_low.latch; measurement["general"] = general; measurement["alarm"] = alarm; variables["measurement"] = measurement; @@ -181,16 +177,16 @@ void ConfigMgr::Save(QString & file_path) { gap_alarm["alert_high_delay"] = radial_ptr->gap_alert_high.delay; gap_alarm["alert_high_enable"] = radial_ptr->gap_alert_high.enable; gap_alarm["alert_high_latch"] = radial_ptr->gap_alert_high.latch; - gap_alarm["danger_low_level"] = radial_ptr->gap_danger_low.level; - gap_alarm["danger_low_hysteresis"] = radial_ptr->gap_danger_low.hysteresis; - gap_alarm["danger_low_delay"] = radial_ptr->gap_danger_low.delay; - gap_alarm["danger_low_enable"] = radial_ptr->gap_danger_low.enable; - gap_alarm["danger_low_latch"] = radial_ptr->gap_danger_low.latch; - gap_alarm["alert_low_level"] = radial_ptr->gap_alert_low.level; - gap_alarm["alert_low_hysteresis"] = radial_ptr->gap_alert_low.hysteresis; - gap_alarm["alert_low_delay"] = radial_ptr->gap_alert_low.delay; - gap_alarm["alert_low_enable"] = radial_ptr->gap_alert_low.enable; - gap_alarm["alert_low_latch"] = radial_ptr->gap_alert_low.latch; +// gap_alarm["danger_low_level"] = radial_ptr->gap_danger_low.level; +// gap_alarm["danger_low_hysteresis"] = radial_ptr->gap_danger_low.hysteresis; +// gap_alarm["danger_low_delay"] = radial_ptr->gap_danger_low.delay; +// gap_alarm["danger_low_enable"] = radial_ptr->gap_danger_low.enable; +// gap_alarm["danger_low_latch"] = radial_ptr->gap_danger_low.latch; +// gap_alarm["alert_low_level"] = radial_ptr->gap_alert_low.level; +// gap_alarm["alert_low_hysteresis"] = radial_ptr->gap_alert_low.hysteresis; +// gap_alarm["alert_low_delay"] = radial_ptr->gap_alert_low.delay; +// gap_alarm["alert_low_enable"] = radial_ptr->gap_alert_low.enable; +// gap_alarm["alert_low_latch"] = radial_ptr->gap_alert_low.latch; gap["general"] = gap_general; gap["alarm"] = gap_alarm; variables["gap"] = gap; @@ -285,7 +281,9 @@ void ConfigMgr::Save(QString & file_path) { scaling["scale_max"] = pressure_ptr->scale_max; variables["sampling"] = sampling; variables["scaling"] = scaling; - + QJsonObject general; + general["engieneering_unit"] = pressure_ptr->general.engineering_unit; + variables["general"] = general; QJsonObject freband_output,number; for (int var = 0; var < 10; ++var) { if(pressure_ptr->freband_output[var].start != 0 || pressure_ptr->freband_output[var].end != 0){ @@ -293,7 +291,6 @@ void ConfigMgr::Save(QString & file_path) { freband_output["start"] = pressure_ptr->freband_output[var].start; freband_output["end"] = pressure_ptr->freband_output[var].end; number[QString::number(var + 1)] = freband_output; - //freband_output_array.append(freband_output); } } variables["freband_output"] = number; @@ -337,20 +334,19 @@ void ConfigMgr::Save(QString & file_path) { alarm["alert_high_delay"] = av_ptr->alert_high.delay; alarm["alert_high_enable"] = av_ptr->alert_high.enable; alarm["alert_high_latch"] = av_ptr->alert_high.latch; - alarm["danger_low_level"] = av_ptr->danger_low.level; - alarm["danger_low_hysteresis"] = av_ptr->danger_low.hysteresis; - alarm["danger_low_delay"] = av_ptr->danger_low.delay; - alarm["danger_low_enable"] = av_ptr->danger_low.enable; - alarm["danger_low_latch"] = av_ptr->danger_low.latch; - alarm["alert_low_level"] = av_ptr->alert_low.level; - alarm["alert_low_hysteresis"] = av_ptr->alert_low.hysteresis; - alarm["alert_low_delay"] = av_ptr->alert_low.delay; - alarm["alert_low_enable"] = av_ptr->alert_low.enable; - alarm["alert_low_latch"] = av_ptr->alert_low.latch; +// alarm["danger_low_level"] = av_ptr->danger_low.level; +// alarm["danger_low_hysteresis"] = av_ptr->danger_low.hysteresis; +// alarm["danger_low_delay"] = av_ptr->danger_low.delay; +// alarm["danger_low_enable"] = av_ptr->danger_low.enable; +// alarm["danger_low_latch"] = av_ptr->danger_low.latch; +// alarm["alert_low_level"] = av_ptr->alert_low.level; +// alarm["alert_low_hysteresis"] = av_ptr->alert_low.hysteresis; +// alarm["alert_low_delay"] = av_ptr->alert_low.delay; +// alarm["alert_low_enable"] = av_ptr->alert_low.enable; +// alarm["alert_low_latch"] = av_ptr->alert_low.latch; processed_output["general"] = general; processed_output["alarm"] = alarm; variables["processed_output"] = processed_output; - //QJsonArray freband_output_array; QJsonObject freband_output,number; for (int var = 0; var < 10; ++var) { if(av_ptr->freband_output[var].start != 0 || av_ptr->freband_output[var].end != 0){ @@ -358,7 +354,6 @@ void ConfigMgr::Save(QString & file_path) { freband_output["start"] = av_ptr->freband_output[var].start; freband_output["end"] = av_ptr->freband_output[var].end; number[QString::number(var + 1)] = freband_output; - //freband_output_array.append(freband_output); } } variables["freband_output"] = number; @@ -402,16 +397,16 @@ void ConfigMgr::Save(QString & file_path) { alarm["alert_high_delay"] = vel_ptr->alert_high.delay; alarm["alert_high_enable"] = vel_ptr->alert_high.enable; alarm["alert_high_latch"] = vel_ptr->alert_high.latch; - alarm["danger_low_level"] = vel_ptr->danger_low.level; - alarm["danger_low_hysteresis"] = vel_ptr->danger_low.hysteresis; - alarm["danger_low_delay"] = vel_ptr->danger_low.delay; - alarm["danger_low_enable"] = vel_ptr->danger_low.enable; - alarm["danger_low_latch"] = vel_ptr->danger_low.latch; - alarm["alert_low_level"] = vel_ptr->alert_low.level; - alarm["alert_low_hysteresis"] = vel_ptr->alert_low.hysteresis; - alarm["alert_low_delay"] = vel_ptr->alert_low.delay; - alarm["alert_low_enable"] = vel_ptr->alert_low.enable; - alarm["alert_low_latch"] = vel_ptr->alert_low.latch; +// alarm["danger_low_level"] = vel_ptr->danger_low.level; +// alarm["danger_low_hysteresis"] = vel_ptr->danger_low.hysteresis; +// alarm["danger_low_delay"] = vel_ptr->danger_low.delay; +// alarm["danger_low_enable"] = vel_ptr->danger_low.enable; +// alarm["danger_low_latch"] = vel_ptr->danger_low.latch; +// alarm["alert_low_level"] = vel_ptr->alert_low.level; +// alarm["alert_low_hysteresis"] = vel_ptr->alert_low.hysteresis; +// alarm["alert_low_delay"] = vel_ptr->alert_low.delay; +// alarm["alert_low_enable"] = vel_ptr->alert_low.enable; +// alarm["alert_low_latch"] = vel_ptr->alert_low.latch; processed_output["general"] = general; processed_output["alarm"] = alarm; variables["processed_output"] = processed_output; @@ -465,6 +460,7 @@ void ConfigMgr::Save(QString & file_path) { channel_item.insert("automatic_threshold",ptr->variables_[cid].automatic_threshold); } slot_item[QString::number(cid + 1)] = channel_item; + slot_item["dc_output"] = dc_output; } slot_item["version"] = 1; }else{ @@ -549,6 +545,20 @@ void ConfigMgr::Load(QString filename) { vib_data->version_ = temp_obj["version"].toInt(); vib_data->card_type_ = static_cast(card_type_[i]); vib_data->slot_ = slot; + // dc_output + QJsonObject dc_output_obj = temp_obj["dc_output"].toObject(); + if(!dc_output_obj.isEmpty()){ + QJsonObject output_obj; + for (int var = 0; var < CHANNEL_COUNT; ++var) { + output_obj = dc_output_obj[QString::number(var + 1)].toObject(); + if(output_obj.isEmpty()) + continue; + vib_data->dc_output[var].output_channel = output_obj["output_channel"].toInt(); + vib_data->dc_output[var].minmum = output_obj["minmum"].toDouble(); + vib_data->dc_output[var].maxmum = output_obj["maxmum"].toDouble(); + } + + } for (int j = 0; j < CHANNEL_COUNT; ++j) { std::shared_ptr base_channel_ptr = vib_data->GetChannelPtr(j + 1); channel = temp_obj[QString::number(j + 1)].toObject(); @@ -582,16 +592,7 @@ void ConfigMgr::Load(QString filename) { vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt(); vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt(); } - // dc_output - QJsonArray dc_output_array = channel["dc_output"].toArray(); - if(!dc_output_array.isEmpty()){ - for(int var = 0 ; var < CHANNEL_COUNT; ++var){ - QJsonObject dc_output_obj = dc_output_array[var].toObject(); - vib_data->dc_output[j][var].output_channel = dc_output_obj["output_channel"].toInt(); - vib_data->dc_output[j][var].minmum = dc_output_obj["minmum"].toInt(); - vib_data->dc_output[j][var].maxmum = dc_output_obj["maxmum"].toInt(); - } - } + // if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){ // vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble(); // vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool(); @@ -637,16 +638,16 @@ void ConfigMgr::Load(QString filename) { variable->alert_high.delay = m_alarm["alert_high_delay"].toInt(); variable->alert_high.enable = m_alarm["alert_high_enable"].toBool(); variable->alert_high.latch = m_alarm["alert_high_latch"].toBool(); - variable->danger_low.level = m_alarm["danger_low_level"].toDouble(); - variable->danger_low.hysteresis = m_alarm["danger_low_hysteresis"].toDouble(); - variable->danger_low.delay = m_alarm["danger_low_delay"].toInt(); - variable->danger_low.enable = m_alarm["danger_low_enable"].toBool(); - variable->danger_low.latch = m_alarm["danger_low_latch"].toBool(); - variable->alert_low.level = m_alarm["alert_low_level"].toDouble(); - variable->alert_low.hysteresis = m_alarm["alert_low_hysteresis"].toDouble(); - variable->alert_low.delay = m_alarm["alert_low_delay"].toInt(); - variable->alert_low.enable = m_alarm["alert_low_enable"].toBool(); - variable->alert_low.latch = m_alarm["alert_low_latch"].toBool(); +// variable->danger_low.level = m_alarm["danger_low_level"].toDouble(); +// variable->danger_low.hysteresis = m_alarm["danger_low_hysteresis"].toDouble(); +// variable->danger_low.delay = m_alarm["danger_low_delay"].toInt(); +// variable->danger_low.enable = m_alarm["danger_low_enable"].toBool(); +// variable->danger_low.latch = m_alarm["danger_low_latch"].toBool(); +// variable->alert_low.level = m_alarm["alert_low_level"].toDouble(); +// variable->alert_low.hysteresis = m_alarm["alert_low_hysteresis"].toDouble(); +// variable->alert_low.delay = m_alarm["alert_low_delay"].toInt(); +// variable->alert_low.enable = m_alarm["alert_low_enable"].toBool(); +// variable->alert_low.latch = m_alarm["alert_low_latch"].toBool(); variable->gap_general.output_used = g_general["output_used"].toBool(); variable->gap_general.engineering_unit = g_general["engieneering_unit"].toInt(); @@ -661,16 +662,16 @@ void ConfigMgr::Load(QString filename) { variable->gap_alert_high.delay = g_alarm["alert_high_delay"].toInt(); variable->gap_alert_high.enable = g_alarm["alert_high_enable"].toBool(); variable->gap_alert_high.latch = g_alarm["alert_high_latch"].toBool(); - variable->gap_danger_low.level = g_alarm["danger_low_level"].toDouble(); - variable->gap_danger_low.hysteresis = g_alarm["danger_low_hysteresis"].toDouble(); - variable->gap_danger_low.delay = g_alarm["danger_low_delay"].toInt(); - variable->gap_danger_low.enable = g_alarm["danger_low_enable"].toBool(); - variable->gap_danger_low.latch = g_alarm["danger_low_latch"].toBool(); - variable->gap_alert_low.level = g_alarm["alert_low_level"].toDouble(); - variable->gap_alert_low.hysteresis = g_alarm["alert_low_hysteresis"].toDouble(); - variable->gap_alert_low.delay = g_alarm["alert_low_delay"].toInt(); - variable->gap_alert_low.enable = g_alarm["alert_low_enable"].toBool(); - variable->gap_alert_low.latch = g_alarm["alert_low_latch"].toBool(); +// variable->gap_danger_low.level = g_alarm["danger_low_level"].toDouble(); +// variable->gap_danger_low.hysteresis = g_alarm["danger_low_hysteresis"].toDouble(); +// variable->gap_danger_low.delay = g_alarm["danger_low_delay"].toInt(); +// variable->gap_danger_low.enable = g_alarm["danger_low_enable"].toBool(); +// variable->gap_danger_low.latch = g_alarm["danger_low_latch"].toBool(); +// variable->gap_alert_low.level = g_alarm["alert_low_level"].toDouble(); +// variable->gap_alert_low.hysteresis = g_alarm["alert_low_hysteresis"].toDouble(); +// variable->gap_alert_low.delay = g_alarm["alert_low_delay"].toInt(); +// variable->gap_alert_low.enable = g_alarm["alert_low_enable"].toBool(); +// variable->gap_alert_low.latch = g_alarm["alert_low_latch"].toBool(); vib_data->variables_.push_back(variable); break; @@ -728,17 +729,33 @@ void ConfigMgr::Load(QString filename) { variable->filter_[k].checked = filter_ele["checked"].toBool(); } variable->id_ = j + 1; - QJsonObject sampling,scaling; - sampling = tmp_variable["sampling"].toObject(); - scaling = tmp_variable["scaling"].toObject(); - variable->fixed = sampling["fixed"].toBool(); - variable->sample_rate = sampling["sample_rate"].toInt(); - variable->bandwidth = sampling["band_width"].toInt(); - variable->fft_points = sampling["fft_points"].toInt(); - variable->measuring_min = scaling["measuring_min"].toInt(); - variable->measuring_max = scaling["measuring_max"].toInt(); - variable->scale_min = scaling["scale_min"].toInt(); - variable->scale_max = scaling["scale_max"].toInt(); + QJsonObject processed_output, general, alarm; + processed_output = tmp_variable["processed_output"].toObject(); + general = processed_output["general"].toObject(); + alarm = processed_output["alarm"].toObject(); + variable->general.output_used = general["output_used"].toBool(); + variable->general.engineering_unit = general["engieneering_unit"].toInt(); + variable->general.rectifier_function = general["rectifier_function"].toInt(); + variable->danger_high.level = alarm["danger_high_level"].toDouble(); + variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble(); + variable->danger_high.delay = alarm["danger_high_delay"].toInt(); + variable->danger_high.enable = alarm["danger_high_enable"].toBool(); + variable->danger_high.latch = alarm["danger_high_latch"].toBool(); + variable->alert_high.level = alarm["alert_high_level"].toDouble(); + variable->alert_high.hysteresis = alarm["alert_high_hysteresis"].toDouble(); + variable->alert_high.delay = alarm["alert_high_delay"].toInt(); + variable->alert_high.enable = alarm["alert_high_enable"].toBool(); + variable->alert_high.latch = alarm["alert_high_latch"].toBool(); +// variable->danger_low.level = alarm["danger_low_level"].toDouble(); +// variable->danger_low.hysteresis = alarm["danger_low_hysteresis"].toDouble(); +// variable->danger_low.delay = alarm["danger_low_delay"].toInt(); +// variable->danger_low.enable = alarm["danger_low_enable"].toBool(); +// variable->danger_low.latch = alarm["danger_low_latch"].toBool(); +// variable->alert_low.level = alarm["alert_low_level"].toDouble(); +// variable->alert_low.hysteresis = alarm["alert_low_hysteresis"].toDouble(); +// variable->alert_low.delay = alarm["alert_low_delay"].toInt(); +// variable->alert_low.enable = alarm["alert_low_enable"].toBool(); +// variable->alert_low.latch = alarm["alert_low_latch"].toBool(); QJsonObject freband_output_obj = tmp_variable["freband_output"].toObject(); QJsonObject number_obj; for (int k = 0; k < 10; ++k) { @@ -782,16 +799,16 @@ void ConfigMgr::Load(QString filename) { variable->alert_high.delay = alarm["alert_high_delay"].toInt(); variable->alert_high.enable = alarm["alert_high_enable"].toBool(); variable->alert_high.latch = alarm["alert_high_latch"].toBool(); - variable->danger_low.level = alarm["danger_low_level"].toDouble(); - variable->danger_low.hysteresis = alarm["danger_low_hysteresis"].toDouble(); - variable->danger_low.delay = alarm["danger_low_delay"].toInt(); - variable->danger_low.enable = alarm["danger_low_enable"].toBool(); - variable->danger_low.latch = alarm["danger_low_latch"].toBool(); - variable->alert_low.level = alarm["alert_low_level"].toDouble(); - variable->alert_low.hysteresis = alarm["alert_low_hysteresis"].toDouble(); - variable->alert_low.delay = alarm["alert_low_delay"].toInt(); - variable->alert_low.enable = alarm["alert_low_enable"].toBool(); - variable->alert_low.latch = alarm["alert_low_latch"].toBool(); +// variable->danger_low.level = alarm["danger_low_level"].toDouble(); +// variable->danger_low.hysteresis = alarm["danger_low_hysteresis"].toDouble(); +// variable->danger_low.delay = alarm["danger_low_delay"].toInt(); +// variable->danger_low.enable = alarm["danger_low_enable"].toBool(); +// variable->danger_low.latch = alarm["danger_low_latch"].toBool(); +// variable->alert_low.level = alarm["alert_low_level"].toDouble(); +// variable->alert_low.hysteresis = alarm["alert_low_hysteresis"].toDouble(); +// variable->alert_low.delay = alarm["alert_low_delay"].toInt(); +// variable->alert_low.enable = alarm["alert_low_enable"].toBool(); +// variable->alert_low.latch = alarm["alert_low_latch"].toBool(); vib_data->variables_.push_back(variable); break; } @@ -823,16 +840,16 @@ void ConfigMgr::Load(QString filename) { variable->alert_high.delay = alarm["alert_high_delay"].toInt(); variable->alert_high.enable = alarm["alert_high_enable"].toBool(); variable->alert_high.latch = alarm["alert_high_latch"].toBool(); - variable->danger_low.level = alarm["danger_low_level"].toDouble(); - variable->danger_low.hysteresis = alarm["danger_low_hysteresis"].toDouble(); - variable->danger_low.delay = alarm["danger_low_delay"].toInt(); - variable->danger_low.enable = alarm["danger_low_enable"].toBool(); - variable->danger_low.latch = alarm["danger_low_latch"].toBool(); - variable->alert_low.level = alarm["alert_low_level"].toDouble(); - variable->alert_low.hysteresis = alarm["alert_low_hysteresis"].toDouble(); - variable->alert_low.delay = alarm["alert_low_delay"].toInt(); - variable->alert_low.enable = alarm["alert_low_enable"].toBool(); - variable->alert_low.latch = alarm["alert_low_latch"].toBool(); +// variable->danger_low.level = alarm["danger_low_level"].toDouble(); +// variable->danger_low.hysteresis = alarm["danger_low_hysteresis"].toDouble(); +// variable->danger_low.delay = alarm["danger_low_delay"].toInt(); +// variable->danger_low.enable = alarm["danger_low_enable"].toBool(); +// variable->danger_low.latch = alarm["danger_low_latch"].toBool(); +// variable->alert_low.level = alarm["alert_low_level"].toDouble(); +// variable->alert_low.hysteresis = alarm["alert_low_hysteresis"].toDouble(); +// variable->alert_low.delay = alarm["alert_low_delay"].toInt(); +// variable->alert_low.enable = alarm["alert_low_enable"].toBool(); +// variable->alert_low.latch = alarm["alert_low_latch"].toBool(); QJsonObject freband_output_obj = tmp_variable["freband_output"].toObject(); QJsonObject number_obj; for (int k = 0; k < 10; ++k) { @@ -894,8 +911,10 @@ void ConfigMgr::Load(QString filename) { channel = temp_obj[QString::number(j + 1)].toObject(); keyphase_data->variables_[j].active = channel["active"].toBool(); QJsonArray voltage_range_array = channel["normal_voltage_range"].toArray(); - keyphase_data->variables_[j].normal_voltage_high = voltage_range_array[1].toDouble(); - keyphase_data->variables_[j].normal_voltage_low = voltage_range_array[0].toDouble(); + if(voltage_range_array.size() > 0){ + keyphase_data->variables_[j].normal_voltage_high = voltage_range_array[1].toDouble(); + keyphase_data->variables_[j].normal_voltage_low = voltage_range_array[0].toDouble(); + } keyphase_data->variables_[j].threshold = channel["threshold"].toDouble(); keyphase_data->variables_[j].hysteresis = channel["hysteresis"].toDouble(); keyphase_data->variables_[j].events_per_revolution = channel["events_per_revolution"].toInt(); diff --git a/data_config.h b/data_config.h index be4489e..654c441 100644 --- a/data_config.h +++ b/data_config.h @@ -10,11 +10,12 @@ typedef unsigned short uint16_t; typedef struct { bool used[4]; // 是否已配置 + int channel; }ChannelUsed; extern QString g_strServerIp; // 服务端IP extern QString g_version; -extern ChannelUsed ch_used; +extern ChannelUsed ch_used[22]; #define SLOT_NUM 15 #define CHANNEL_COUNT 4 #define RELAY_COUNT 16 @@ -273,7 +274,7 @@ typedef struct DCOutput_{ float minmum; float maxmum; DCOutput_(){ - output_channel = 0; + output_channel = -1; minmum = 0; maxmum = 0; } diff --git a/dc_output_channel.cpp b/dc_output_channel.cpp index acd163f..7ecc3bd 100644 --- a/dc_output_channel.cpp +++ b/dc_output_channel.cpp @@ -2,24 +2,39 @@ #include "ui_dc_output_channel.h" #include #include "data_config.h" +#include - -DC_Output_Channel::DC_Output_Channel(QString unit_str_,QWidget *parent) : +DC_Output_Channel::DC_Output_Channel(QString unit_str_,int current_index_,QWidget *parent) : QWidget(parent), ui(new Ui::DC_Output_Channel) { ui->setupUi(this); unit_str = unit_str_; + current_index = current_index_; ui->label_min_unit->setText(unit_str); ui->label_max_unit->setText(unit_str); radiobtn[0] = ui->radioButton; radiobtn[1] = ui->radioButton_2; radiobtn[2] = ui->radioButton_3; radiobtn[3] = ui->radioButton_4; - for (int i = 0; i < 4; i++) { - if(ch_used.used[i]) - radiobtn[i]->setEnabled(false); + radiobtn[4] = ui->radioButton_5; + int not_used = 0; + for (int i = 0; i < 22; i++) { + for (int j = 0; j < 4; j++){ + if(ch_used[i].used[j] && current_index == i){ + radiobtn[j]->setEnabled(true); + radiobtn[j]->setChecked(true); + first_used = j; + }else if(ch_used[i].used[j] && current_index != i){ + radiobtn[j]->setEnabled(false); + }else if(!ch_used[i].used[j] && current_index == i){ + not_used ++; + } + } + } + if(not_used == 4){ + ui->radioButton_5->setChecked(true); } } @@ -31,8 +46,8 @@ DC_Output_Channel::~DC_Output_Channel() void DC_Output_Channel::on_pushButton_confirm_clicked() { int channel = 0; - if((ui->lineEdit_minmum->text().toFloat() >= ui->lineEdit_maxmum->text().toFloat()) || - (ui->lineEdit_minmum->text().toFloat() == 0 && ui->lineEdit_maxmum->text().toFloat() == 0)){ + if(!ui->radioButton_5->isChecked() && ((ui->lineEdit_minmum->text().toFloat() >= ui->lineEdit_maxmum->text().toFloat()) || + (ui->lineEdit_minmum->text().toFloat() == 0 && ui->lineEdit_maxmum->text().toFloat() == 0))){ QMessageBox::information(this, QStringLiteral("提示"), "请填写正确的最小值和最大值"); return; } @@ -44,11 +59,14 @@ void DC_Output_Channel::on_pushButton_confirm_clicked() channel = 3; }else if(ui->radioButton_4->isChecked()){ channel = 4; + }else if(ui->radioButton_5->isChecked()){ + ch_used[current_index].used[first_used] = false; + channel = 5; }else { QMessageBox::information(this, QStringLiteral("提示"), "请选择正确的通道"); return; } - emit output_channel_data_sg(channel,ui->lineEdit_minmum->text().toFloat(),ui->lineEdit_maxmum->text().toFloat()); + emit output_channel_data_sg(channel,ui->lineEdit_minmum->text().toFloat(),ui->lineEdit_maxmum->text().toFloat(),first_used); this->close(); } diff --git a/dc_output_channel.h b/dc_output_channel.h index 5a24dfa..89098e0 100644 --- a/dc_output_channel.h +++ b/dc_output_channel.h @@ -13,10 +13,10 @@ class DC_Output_Channel : public QWidget Q_OBJECT public: - explicit DC_Output_Channel(QString unit_str_,QWidget *parent = nullptr); + explicit DC_Output_Channel(QString unit_str_,int current_index_,QWidget *parent = nullptr); ~DC_Output_Channel(); signals: - void output_channel_data_sg(int channel,float minmun,float maxmum); + void output_channel_data_sg(int channel,float minmun,float maxmum,int not_used); private slots: void on_pushButton_confirm_clicked(); @@ -25,8 +25,9 @@ private slots: private: Ui::DC_Output_Channel *ui; QString unit_str; - QRadioButton *radiobtn[4]; - bool channel_used[4] = {false,false,false,false}; + int current_index; + int first_used; + QRadioButton *radiobtn[5]; }; #endif // DC_OUTPUT_CHANNEL_H diff --git a/dc_output_channel.ui b/dc_output_channel.ui index 404219a..cc9b19a 100644 --- a/dc_output_channel.ui +++ b/dc_output_channel.ui @@ -89,6 +89,22 @@ buttonGroup + + + + 40 + 150 + 89 + 16 + + + + 不使用 + + + buttonGroup + + diff --git a/dc_outputs.cpp b/dc_outputs.cpp index 61cf5c8..7459b0e 100644 --- a/dc_outputs.cpp +++ b/dc_outputs.cpp @@ -7,7 +7,7 @@ #include "data_config.h" #include "vibrationdata.h" -ChannelUsed ch_used; +ChannelUsed ch_used[22]; DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) : QWidget(parent), @@ -19,6 +19,30 @@ DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) : car_type = static_cast(cardtype); unit = ""; current_index = ui->comboBox_ch_output->currentIndex(); + label_ch1[0] = ui->label_ch_1; + label_ch1[1] = ui->label_ch_1_min; + label_ch1[2] = ui->label_ch_1_min_unit; + label_ch1[3] = ui->label_ch_1_max; + label_ch1[4] = ui->label_ch_1_max_unit; + + label_ch2[0] = ui->label_ch_2; + label_ch2[1] = ui->label_ch_2_min; + label_ch2[2] = ui->label_ch_2_min_unit; + label_ch2[3] = ui->label_ch_2_max; + label_ch2[4] = ui->label_ch_2_max_unit; + + label_ch3[0] = ui->label_ch_3; + label_ch3[1] = ui->label_ch_3_min; + label_ch3[2] = ui->label_ch_3_min_unit; + label_ch3[3] = ui->label_ch_3_max; + label_ch3[4] = ui->label_ch_3_max_unit; + + label_ch4[0] = ui->label_ch_4; + label_ch4[1] = ui->label_ch_4_min; + label_ch4[2] = ui->label_ch_4_min_unit; + label_ch4[3] = ui->label_ch_4_max; + label_ch4[4] = ui->label_ch_4_max_unit; + Init(); } @@ -30,62 +54,98 @@ DC_Outputs::~DC_Outputs() void DC_Outputs::Init(){ std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); if (base_ptr == nullptr) { - qCritical() << "[DC_Outputs" -"::Init] should not be here"; + qCritical() << "[DC_Outputs::Init] should not be here"; return; } vib_dc_output_ptr = std::dynamic_pointer_cast(base_ptr); - QString unit_str = GetUnit(); - if(vib_dc_output_ptr->dc_output[current_index][0].output_channel == 1){ - ui->label_ch_1->setText("通道1"); - ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].minmum)); - ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].maxmum)); - ch_used.used[0] = true; - } - if(vib_dc_output_ptr->dc_output[current_index][1].output_channel == 2){ - ui->label_ch_2->setText("通道2"); - ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].minmum)); - ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].maxmum)); - ch_used.used[1] = true; - } - if(vib_dc_output_ptr->dc_output[current_index][2].output_channel == 3){ - ui->label_ch_3->setText("通道3"); - ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].minmum)); - ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].maxmum)); - ch_used.used[2] = true; - } - if(vib_dc_output_ptr->dc_output[current_index][3].output_channel == 4){ - ui->label_ch_4->setText("通道4"); - ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].minmum)); - ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].maxmum)); - ch_used.used[3] = true; - } + QString unit_str = ""; + + if(vib_dc_output_ptr->dc_output[0].output_channel != -1){ + unit_str = GetUnit(vib_dc_output_ptr->dc_output[0].output_channel); + ui->label_ch_1->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[0].output_channel)); + ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[0].minmum)); + ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[0].maxmum)); + ui->label_ch_1_min_unit->setText(unit_str); + ui->label_ch_1_max_unit->setText(unit_str); + ch_used[vib_dc_output_ptr->dc_output[0].output_channel].used[0] = true; + } + if(vib_dc_output_ptr->dc_output[1].output_channel != -1){ + unit_str = GetUnit(vib_dc_output_ptr->dc_output[1].output_channel); + ui->label_ch_2->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[1].output_channel)); + ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[1].minmum)); + ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[1].maxmum)); + ui->label_ch_2_min_unit->setText(unit_str); + ui->label_ch_2_max_unit->setText(unit_str); + ch_used[vib_dc_output_ptr->dc_output[1].output_channel].used[1] = true; + } + if(vib_dc_output_ptr->dc_output[2].output_channel != -1){ + unit_str = GetUnit(vib_dc_output_ptr->dc_output[2].output_channel); + ui->label_ch_3->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[2].output_channel)); + ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[2].minmum)); + ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[2].maxmum)); + ui->label_ch_3_min_unit->setText(unit_str); + ui->label_ch_3_max_unit->setText(unit_str); + ch_used[vib_dc_output_ptr->dc_output[2].output_channel].used[2] = true; + } + if(vib_dc_output_ptr->dc_output[3].output_channel != -1){ + unit_str = GetUnit(vib_dc_output_ptr->dc_output[3].output_channel); + ui->label_ch_4->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[3].output_channel)); + ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[3].minmum)); + ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[3].maxmum)); + ui->label_ch_4_min_unit->setText(unit_str); + ui->label_ch_4_max_unit->setText(unit_str); + ch_used[vib_dc_output_ptr->dc_output[3].output_channel].used[3] = true; + } + } -QString DC_Outputs::GetUnit(){ - int unit_num = -1; +QString DC_Outputs::GetUnit(int com_index){ + int unit_num = -1,channel_num = 0; QString unit_str = ""; - std::shared_ptr variable_base = vib_dc_output_ptr->GetChannelPtr(current_index + 1); - if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibRadial) { + channel_num = com_index; + if(com_index > 5 && com_index < 9){ + channel_num = 0; + } + if(com_index > 9 && com_index < 13){ + channel_num = 1; + } + if(com_index > 13 && com_index < 17){ + channel_num = 2; + } + if(com_index > 17 && com_index < 21){ + channel_num = 3; + } + if(com_index == 4) { + channel_num = 0; + }else if(com_index == 5){ + channel_num = 2; + } + std::shared_ptr variable_base = vib_dc_output_ptr->GetChannelPtr(channel_num + 1); + if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibRadial) { std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); unit_num = variable_ptr->general.engineering_unit; + qDebug() << "unit_num1" << unit_num ; } - if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibAcc) { + if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibAcc) { std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); unit_num = variable_ptr->general.engineering_unit; + qDebug() << "unit_num2" << unit_num ; } - if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibVelocity) { + if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibVelocity) { std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); unit_num = variable_ptr->general.engineering_unit; + qDebug() << "unit_num3" << unit_num ; } - if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibThrust) { + if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibThrust) { std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); unit_num = variable_ptr->general.engineering_unit; + qDebug() << "unit_num4" << unit_num ; } - if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibPressurePulsation) { + if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibPressurePulsation) { std::shared_ptr variable_ptr = std::dynamic_pointer_cast(variable_base); unit_num = variable_ptr->general.engineering_unit; + qDebug() << "unit_num5" << unit_num ; } switch (unit_num) { case kUnit1:{ @@ -142,62 +202,121 @@ QString DC_Outputs::GetUnit(){ void DC_Outputs::on_comboBox_ch_output_activated(int index) { current_index = index; - QString unit_str = GetUnit(); - DC_Output_Channel *dc_output_channel = new DC_Output_Channel(unit_str); + QString unit_str = GetUnit(current_index); + DC_Output_Channel *dc_output_channel = new DC_Output_Channel(unit_str,current_index); dc_output_channel->setWindowModality(Qt::ApplicationModal); - connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float)),this,SLOT(output_channel_data(int,float,float))); + connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float,int)),this,SLOT(output_channel_data(int,float,float,int))); dc_output_channel->show(); } -void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum){ +void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int not_used){ qDebug() << channel << minmun << maxmum ; - QString unit_str = GetUnit(); + QString unit_str = GetUnit(current_index); + if(channel == 1){ - ui->label_ch_1->setText("通道1"); + ui->label_ch_1->setText(ui->comboBox_ch_output->currentText()); ui->label_ch_1_min->setText(QString::number(minmun)); ui->label_ch_1_max->setText(QString::number(maxmum)); - ch_used.used[0] = true; + ui->label_ch_1_min_unit->setText(unit_str); + ui->label_ch_1_max_unit->setText(unit_str); + ch_used[ui->comboBox_ch_output->currentIndex()].used[0] = true; + vib_dc_output_ptr->dc_output[0].output_channel = current_index; + vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat(); + vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat(); }else if(channel == 2){ - ui->label_ch_2->setText("通道2"); + ui->label_ch_2->setText(ui->comboBox_ch_output->currentText()); ui->label_ch_2_min->setText(QString::number(minmun)); ui->label_ch_2_max->setText(QString::number(maxmum)); - ch_used.used[1] = true; + ui->label_ch_2_min_unit->setText(unit_str); + ui->label_ch_2_max_unit->setText(unit_str); + ch_used[ui->comboBox_ch_output->currentIndex()].used[1] = true; + vib_dc_output_ptr->dc_output[1].output_channel = current_index; + vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat(); + vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat(); }else if(channel == 3){ - ui->label_ch_3->setText("通道3"); + ui->label_ch_3->setText(ui->comboBox_ch_output->currentText()); ui->label_ch_3_min->setText(QString::number(minmun)); ui->label_ch_3_max->setText(QString::number(maxmum)); - ch_used.used[2] = true; + ui->label_ch_3_min_unit->setText(unit_str); + ui->label_ch_3_max_unit->setText(unit_str); + ch_used[ui->comboBox_ch_output->currentIndex()].used[2] = true; + vib_dc_output_ptr->dc_output[2].output_channel = current_index; + vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat(); + vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat(); }else if(channel == 4){ - ui->label_ch_4->setText("通道4"); + ui->label_ch_4->setText(ui->comboBox_ch_output->currentText()); ui->label_ch_4_min->setText(QString::number(minmun)); ui->label_ch_4_max->setText(QString::number(maxmum)); - ch_used.used[3] = true; + ui->label_ch_4_min_unit->setText(unit_str); + ui->label_ch_4_max_unit->setText(unit_str); + ch_used[ui->comboBox_ch_output->currentIndex()].used[3] = true; + vib_dc_output_ptr->dc_output[3].output_channel = current_index; + vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat(); + vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat(); + }else if(channel == 5){ + if(not_used == 0){ + label_ch1[0]->setText("未使用"); + label_ch1[1]->setText("-----"); + label_ch1[2]->setText("-----"); + label_ch1[3]->setText("-----"); + label_ch1[4]->setText("-----"); + ch_used[ui->comboBox_ch_output->currentIndex()].used[0] = false; + vib_dc_output_ptr->dc_output[0].output_channel = -1; + }else if(not_used == 1){ + label_ch1[0]->setText("未使用"); + label_ch1[1]->setText("-----"); + label_ch1[2]->setText("-----"); + label_ch1[3]->setText("-----"); + label_ch1[4]->setText("-----"); + ch_used[ui->comboBox_ch_output->currentIndex()].used[1] = false; + vib_dc_output_ptr->dc_output[1].output_channel = -1; + }else if(not_used == 2){ + label_ch1[0]->setText("未使用"); + label_ch1[1]->setText("-----"); + label_ch1[2]->setText("-----"); + label_ch1[3]->setText("-----"); + label_ch1[4]->setText("-----"); + ch_used[ui->comboBox_ch_output->currentIndex()].used[2] = false; + vib_dc_output_ptr->dc_output[2].output_channel = -1; + }else if(not_used == 3){ + label_ch1[0]->setText("未使用"); + label_ch1[1]->setText("-----"); + label_ch1[2]->setText("-----"); + label_ch1[3]->setText("-----"); + label_ch1[4]->setText("-----"); + ch_used[ui->comboBox_ch_output->currentIndex()].used[3] = false; + vib_dc_output_ptr->dc_output[3].output_channel = -1; + } } } void DC_Outputs::on_pushButton_confirm_clicked() { - if(ui->label_ch_1->text() != "未使用"){ - vib_dc_output_ptr->dc_output[current_index][0].output_channel = 1; - vib_dc_output_ptr->dc_output[current_index][0].minmum = ui->label_ch_1_min->text().toFloat(); - vib_dc_output_ptr->dc_output[current_index][0].maxmum = ui->label_ch_1_max->text().toFloat(); - } - if(ui->label_ch_2->text() != "未使用"){ - vib_dc_output_ptr->dc_output[current_index][1].output_channel = 2; - vib_dc_output_ptr->dc_output[current_index][1].minmum = ui->label_ch_2_min->text().toFloat(); - vib_dc_output_ptr->dc_output[current_index][1].maxmum = ui->label_ch_2_max->text().toFloat(); - } - if(ui->label_ch_3->text() != "未使用"){ - vib_dc_output_ptr->dc_output[current_index][2].output_channel = 3; - vib_dc_output_ptr->dc_output[current_index][2].minmum = ui->label_ch_3_min->text().toFloat(); - vib_dc_output_ptr->dc_output[current_index][2].maxmum = ui->label_ch_3_max->text().toFloat(); - } - if(ui->label_ch_4->text() != "未使用"){ - vib_dc_output_ptr->dc_output[current_index][3].output_channel = 4; - vib_dc_output_ptr->dc_output[current_index][3].minmum = ui->label_ch_4_min->text().toFloat(); - vib_dc_output_ptr->dc_output[current_index][3].maxmum = ui->label_ch_4_max->text().toFloat(); - } +// if(ui->label_ch_1->text() != "未使用" && current_index){ +// vib_dc_output_ptr->dc_output[0].output_channel = current_index; +// vib_dc_output_ptr->dc_output[0].dc_output_channel = 1; +// vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat(); +// vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat(); +// } +// if(ui->label_ch_2->text() != "未使用"){ +// vib_dc_output_ptr->dc_output[1].output_channel = current_index; +// vib_dc_output_ptr->dc_output[1].dc_output_channel = 2; +// vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat(); +// vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat(); +// } +// if(ui->label_ch_3->text() != "未使用"){ +// vib_dc_output_ptr->dc_output[2].output_channel = current_index; +// vib_dc_output_ptr->dc_output[2].dc_output_channel = 3; +// vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat(); +// vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat(); +// } +// if(ui->label_ch_4->text() != "未使用"){ +// vib_dc_output_ptr->dc_output[3].output_channel = current_index; +// vib_dc_output_ptr->dc_output[3].dc_output_channel = 4; +// vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat(); +// vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat(); +// } this->close(); } @@ -211,31 +330,57 @@ void DC_Outputs::on_pushButton_cancel_clicked() void DC_Outputs::on_comboBox_ch_output_currentIndexChanged(int index) { - current_index = index; - QString unit_str = GetUnit(); - if(vib_dc_output_ptr->dc_output[current_index][0].output_channel == 1){ - ui->label_ch_1->setText("通道1"); - ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].minmum)); - ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].maxmum)); - ch_used.used[0] = true; - } - if(vib_dc_output_ptr->dc_output[current_index][1].output_channel == 2){ - ui->label_ch_2->setText("通道2"); - ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].minmum)); - ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].maxmum)); - ch_used.used[1] = true; - } - if(vib_dc_output_ptr->dc_output[current_index][2].output_channel == 3){ - ui->label_ch_3->setText("通道3"); - ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].minmum)); - ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].maxmum)); - ch_used.used[2] = true; - } - if(vib_dc_output_ptr->dc_output[current_index][3].output_channel == 4){ - ui->label_ch_4->setText("通道4"); - ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].minmum)); - ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].maxmum)); - ch_used.used[3] = true; - } + qDebug() << "on_comboBox_ch_output_currentIndexChanged" ; +// if(ui->label_ch_1->text() != "未使用"){ +// vib_dc_output_ptr->dc_output[0].output_channel = current_index; +// vib_dc_output_ptr->dc_output[0].dc_output_channel = 1; +// vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat(); +// vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat(); +// } +// if(ui->label_ch_2->text() != "未使用"){ +// vib_dc_output_ptr->dc_output[1].output_channel = current_index; +// vib_dc_output_ptr->dc_output[1].dc_output_channel = 2; +// vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat(); +// vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat(); +// } +// if(ui->label_ch_3->text() != "未使用"){ +// vib_dc_output_ptr->dc_output[2].output_channel = current_index; +// vib_dc_output_ptr->dc_output[2].dc_output_channel = 3; +// vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat(); +// vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat(); +// } +// if(ui->label_ch_4->text() != "未使用"){ +// vib_dc_output_ptr->dc_output[3].output_channel = current_index; +// vib_dc_output_ptr->dc_output[3].dc_output_channel = 4; +// vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat(); +// vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat(); +// } + +// current_index = index; +// QString unit_str = GetUnit(); +// if(vib_dc_output_ptr->dc_output[0].dc_output_channel == 1 && current_index == vib_dc_output_ptr->dc_output[0].output_channel){ +// ui->label_ch_1->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[0].output_channel)); +// ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[0].minmum)); +// ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[0].maxmum)); +// ch_used[current_index].used[0] = true; +// } +// if(vib_dc_output_ptr->dc_output[1].dc_output_channel == 2 && current_index == vib_dc_output_ptr->dc_output[1].output_channel){ +// ui->label_ch_2->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[1].output_channel)); +// ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[1].minmum)); +// ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[1].maxmum)); +// ch_used[current_index].used[1] = true; +// } +// if(vib_dc_output_ptr->dc_output[2].dc_output_channel == 3 && current_index == vib_dc_output_ptr->dc_output[2].output_channel){ +// ui->label_ch_3->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[2].output_channel)); +// ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[2].minmum)); +// ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[2].maxmum)); +// ch_used[current_index].used[2] = true; +// } +// if(vib_dc_output_ptr->dc_output[3].dc_output_channel == 4 && current_index == vib_dc_output_ptr->dc_output[3].output_channel){ +// ui->label_ch_4->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[3].output_channel)); +// ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[3].minmum)); +// ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[3].maxmum)); +// ch_used[current_index].used[3] = true; +// } } diff --git a/dc_outputs.h b/dc_outputs.h index ef64ce3..e502964 100644 --- a/dc_outputs.h +++ b/dc_outputs.h @@ -25,7 +25,7 @@ private slots: void on_pushButton_cancel_clicked(); - void output_channel_data(int channel,float minmun,float maxmum); + void output_channel_data(int channel,float minmun,float maxmum,int not_used); void on_comboBox_ch_output_currentIndexChanged(int index); @@ -33,8 +33,11 @@ private: Ui::DC_Outputs *ui; std::shared_ptr vib_dc_output_ptr = nullptr; void Init(); - QString GetUnit(); - + QString GetUnit(int com_index); + QLabel *label_ch1[5]; + QLabel *label_ch2[5]; + QLabel *label_ch3[5]; + QLabel *label_ch4[5]; int current_index; QString unit; }; diff --git a/dc_outputs.ui b/dc_outputs.ui index 4d30069..61b8ec5 100644 --- a/dc_outputs.ui +++ b/dc_outputs.ui @@ -64,6 +64,86 @@ 通道3 & 通道4 + + + 通道1 分频段1 + + + + + 通道1 分频段2 + + + + + 通道1 分频段3 + + + + + 通道1 分频段4 + + + + + 通道2 分频段1 + + + + + 通道2 分频段2 + + + + + 通道2 分频段3 + + + + + 通道2 分频段4 + + + + + 通道3 分频段1 + + + + + 通道3 分频段2 + + + + + 通道3 分频段3 + + + + + 通道3 分频段4 + + + + + 通道4 分频段1 + + + + + 通道4 分频段2 + + + + + 通道4 分频段3 + + + + + 通道4 分频段4 + + diff --git a/pressure_pulsation.cpp b/pressure_pulsation.cpp index 5ede225..0a24df8 100644 --- a/pressure_pulsation.cpp +++ b/pressure_pulsation.cpp @@ -58,15 +58,40 @@ void PressurePulsation::Init() { ui->checkBox_band_pass->setChecked(variable_ptr->filter_[2].checked); ui->spinBox_band_pass_low->setValue(variable_ptr->filter_[2].low); ui->spinBox_band_pass_high->setValue(variable_ptr->filter_[2].high); - ui->radioButton_fixed->setChecked(variable_ptr->fixed); - ui->lineEdit_sample_rate->setText(QString::number(variable_ptr->sample_rate)); - ui->lineEdit_bandwidth->setText(QString::number(variable_ptr->bandwidth)); - ui->comboBox_fft_points->setCurrentText(QString::number(variable_ptr->fft_points)); - ui->lineEdit_measuring_value_min->setText(QString::number(variable_ptr->measuring_min)); - ui->lineEdit_measuring_value_max->setText(QString::number(variable_ptr->measuring_max)); - ui->lineEdit_scale_value_min->setText(QString::number(variable_ptr->scale_min)); - ui->lineEdit_scale_value_max->setText(QString::number(variable_ptr->scale_max)); + // processed output + // -general + if(variable_ptr->general.output_used) + ui->comboBox_output_used->setCurrentIndex(0); + else + ui->comboBox_output_used->setCurrentIndex(1); + ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function); + // -alarm + ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->danger_high.level)); + ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->danger_high.hysteresis)); + ui->lineEdit_danger_high_delay->setText(QString::number(variable_ptr->danger_high.delay)); + ui->checkBox_danger_high_enable->setChecked(variable_ptr->danger_high.enable); + ui->checkBox_danger_high_latch->setChecked(variable_ptr->danger_high.latch); + ui->lineEdit_alert_high_level->setText(QString::number(variable_ptr->alert_high.level)); + ui->lineEdit_alert_high_hysteresis->setText(QString::number(variable_ptr->alert_high.hysteresis)); + ui->lineEdit_alert_high_delay->setText(QString::number(variable_ptr->alert_high.delay)); + ui->checkBox_alert_high_enable->setChecked(variable_ptr->alert_high.enable); + ui->checkBox_alert_high_latch->setChecked(variable_ptr->alert_high.latch); + + ui->lineEdit_danger_low_level->setText(QString::number(variable_ptr->danger_low.level)); + ui->lineEdit_danger_low_hysteresis->setText(QString::number(variable_ptr->danger_low.hysteresis)); + ui->lineEdit_danger_low_delay->setText(QString::number(variable_ptr->danger_low.delay)); + ui->checkBox_danger_low_enable->setChecked(variable_ptr->danger_low.enable); + ui->checkBox_danger_low_latch->setChecked(variable_ptr->danger_low.latch); + + ui->lineEdit_alert_low_level->setText(QString::number(variable_ptr->alert_low.level)); + ui->lineEdit_alert_low_hysteresis->setText(QString::number(variable_ptr->alert_low.hysteresis)); + ui->lineEdit_alert_low_delay->setText(QString::number(variable_ptr->alert_low.delay)); + ui->checkBox_alert_low_enable->setChecked(variable_ptr->alert_low.enable); + ui->checkBox_alert_low_latch->setChecked(variable_ptr->alert_low.latch); + + // ui->checkBox_enable->setChecked(variable_ptr->freband_output[0].enable); ui->lineEdit_start->setText(QString::number(variable_ptr->freband_output[0].start)); ui->lineEdit_end->setText(QString::number(variable_ptr->freband_output[0].end)); @@ -97,6 +122,7 @@ void PressurePulsation::Init() { ui->checkBox_enable_10->setChecked(variable_ptr->freband_output[9].enable); ui->lineEdit_start_10->setText(QString::number(variable_ptr->freband_output[9].start)); ui->lineEdit_end_10->setText(QString::number(variable_ptr->freband_output[9].end)); + } void PressurePulsation::on_pushButton_confirm_clicked() { @@ -126,14 +152,35 @@ void PressurePulsation::on_pushButton_confirm_clicked() variable->filter_[2].checked = ui->checkBox_band_pass->checkState(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->fixed = ui->radioButton_fixed->isChecked(); - variable->sample_rate = ui->lineEdit_sample_rate->text().toUInt(); - variable->bandwidth = ui->lineEdit_bandwidth->text().toInt(); - variable->fft_points = ui->comboBox_fft_points->currentText().toInt(); - variable->measuring_min = ui->lineEdit_measuring_value_min->text().toInt(); - variable->measuring_max = ui->lineEdit_measuring_value_max->text().toInt(); - variable->scale_min = ui->lineEdit_scale_value_min->text().toInt(); - variable->scale_max = ui->lineEdit_scale_value_max->text().toInt(); + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); // -freband output variable->freband_output[0].enable = ui->checkBox_enable->isChecked(); variable->freband_output[0].start = ui->lineEdit_start->text().toDouble(); @@ -180,15 +227,35 @@ void PressurePulsation::on_pushButton_confirm_clicked() variable->filter_[2].checked = ui->checkBox_band_pass->checkState(); variable->filter_[2].low = ui->spinBox_band_pass_low->value(); variable->filter_[2].high = ui->spinBox_band_pass_high->value(); - variable->fixed = ui->radioButton_fixed->isChecked(); - variable->sample_rate = ui->lineEdit_sample_rate->text().toUInt(); - variable->bandwidth = ui->lineEdit_bandwidth->text().toInt(); - variable->fft_points = ui->comboBox_fft_points->currentText().toInt(); - variable->measuring_min = ui->lineEdit_measuring_value_min->text().toInt(); - variable->measuring_max = ui->lineEdit_measuring_value_max->text().toInt(); - variable->scale_min = ui->lineEdit_scale_value_min->text().toInt(); - variable->scale_max = ui->lineEdit_scale_value_max->text().toInt(); - + // processed output + // -general + if(ui->comboBox_output_used->currentIndex() == 0) + variable->general.output_used = true; + else + variable->general.output_used = false; + variable->general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); + // -alarm + variable->danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); + variable->danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); + variable->danger_high.delay = ui->lineEdit_danger_high_delay->text().toDouble(); + variable->danger_high.enable = ui->checkBox_danger_high_enable->isChecked(); + variable->danger_high.latch = ui->checkBox_danger_high_latch->isChecked(); + variable->alert_high.level = ui->lineEdit_alert_high_level->text().toDouble(); + variable->alert_high.hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble(); + variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); + variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); + variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); + variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); + variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); + variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); + variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); + variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); + variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); + variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); + variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); + variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); + variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); // -freband output variable->freband_output[0].enable = ui->checkBox_enable->isChecked(); variable->freband_output[0].start = ui->lineEdit_start->text().toDouble(); diff --git a/pressure_pulsation.ui b/pressure_pulsation.ui index 0a008a4..3b64234 100644 --- a/pressure_pulsation.ui +++ b/pressure_pulsation.ui @@ -161,628 +161,856 @@ - 20 - 60 - 651 - 421 + 10 + 50 + 667 + 434 - 2 + 1 - - - 传感器和滤波配置 - - - - - 10 - 30 - 353 - 116 - - - - 滤波 - - - - - - - - 高通: - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - 3 - - - 3000 - - - - - - - - - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - 3 - - - 3000 - - - 3000 - - - - - - - 3 - 3000Hz - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 低通: - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - - - - - - - - - - 60 - 0 - - - - - 60 - 16777215 - - - - - - - - 30 - 30000Hz - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 带通: - - - - - - - - 60 - 0 - - - - 3 - - - 3000 - - - - - - - - - - - - - - - - 60 - 0 - - - - 3 - - - 3000 - - - 3000 - - - - - - - 3 - 3000Hz - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 特征值和警报配置 - - - - - 10 - 10 - 471 - 191 - - - - 采样频率 - - - - - 20 - 30 - 397 - 24 - - - - - - - 固定 - - - - - - - - - 采样率: - - - - - - - - 100 - 20 - - - - - - - - Hz - - - - - - - - - - - 带宽: - - - - - - - - 100 - 20 - - - - - - - - Hz - - - - - - - - - - - 20 - 70 - 121 - 23 - - - - - - - FFT 点数: - - - - - - - - 8192 - - - - - - - - - - 20 - 100 - 122 - 17 - - - - - - - 频率范围: - - - - - - - 5000 Hz - - - - - - - - - 20 - 130 - 92 - 17 - - - - - - - 线数: - - - - - - - 1250 Hz - - - - - - - - - 20 - 160 - 106 - 17 - - - - - - - 频率分辨率: - - - - - - - 4 Hz - - - - - - - - - - 10 - 219 - 471 - 121 - - - - 测量 - - - - - 20 - 40 - 54 - 12 - - - - 最小: - - - - - - 20 - 80 - 54 - 12 - - - - 最大: - - - - - - 90 - 20 - 54 - 12 - - - - 测量值 - - - - - - 230 - 20 - 54 - 12 - - - - 对应值 - - - - - - 70 - 40 - 81 - 20 - - - - - - - 210 - 40 - 81 - 20 - - - - - - - 70 - 80 - 81 - 20 - - - - - - - 210 - 80 - 81 - 20 - - - - - - - 310 - 40 - 54 - 12 - - - - mbar - - - - - - 310 - 80 - 54 - 12 - - - - mbar - - - - - - 160 - 40 - 31 - 16 - - - - mV - - - - - - 160 - 80 - 31 - 16 - - - - mV - - - - + + 滤波 + + + + + + 滤波 + + + + + + + + + + 高通: + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + 3 + + + 3000 + + + + + + + - + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + 3 + + + 3000 + + + 3000 + + + + + + + + 60 + 0 + + + + 3 - 3000Hz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 低通: + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + - + + + + + + + + 60 + 0 + + + + + 60 + 16777215 + + + + + + + + 30 - 30000Hz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 带通: + + + + + + + + 60 + 0 + + + + 3 + + + 3000 + + + + + + + - + + + + + + + + 60 + 0 + + + + 3 + + + 3000 + + + 3000 + + + + + + + 3 - 3000Hz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 248 + + + + + + + + + + + + 处理后输出 + + + + + 530 + 320 + 54 + 12 + + + + % + + + + + + 10 + 40 + 621 + 321 + + + + 0 + + + + 常规 + + + + + 170 + 150 + 54 + 12 + + + + 整流器 + + + + + + 10 + 140 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + RMS + + + + + + + 170 + 50 + 54 + 12 + + + + 输出使用 + + + + + + 10 + 90 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + g + + + + + m/s**2 + + + + + mm/s + + + + + inch/s + + + + + um + + + + + mm + + + + + + + 170 + 100 + 54 + 12 + + + + 工程单位 + + + + + + 10 + 40 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + + + + + + + + + + + + + 警报 + + + + + 10 + 60 + 71 + 16 + + + + 危险 + 高 + + + + + + 10 + 100 + 71 + 16 + + + + 警报 + 高 + + + + + + 10 + 140 + 71 + 16 + + + + 警报 + 低 + + + + + + 10 + 180 + 71 + 16 + + + + 危险 + 低 + + + + + + 90 + 30 + 31 + 31 + + + + 等级 + (um) + + + + + + 170 + 30 + 31 + 31 + + + + 回差 +(um) + + + + + + 230 + 30 + 31 + 31 + + + + 延时 +(um) + + + + + + 280 + 40 + 31 + 16 + + + + 使能 + + + + + + 340 + 40 + 31 + 16 + + + + 锁存 + + + + + + 80 + 60 + 51 + 20 + + + + + + + 150 + 60 + 51 + 20 + + + + + + + 220 + 60 + 51 + 20 + + + + + + + 220 + 100 + 51 + 20 + + + + + + + 80 + 100 + 51 + 20 + + + + + + + 150 + 100 + 51 + 20 + + + + + + false + + + + 220 + 140 + 51 + 20 + + + + + + false + + + + 150 + 180 + 51 + 20 + + + + + + false + + + + 80 + 140 + 51 + 20 + + + + + + false + + + + 220 + 180 + 51 + 20 + + + + + + false + + + + 80 + 180 + 51 + 20 + + + + + + false + + + + 150 + 140 + 51 + 20 + + + + + + + 290 + 60 + 16 + 16 + + + + + + + + + + 290 + 100 + 16 + 16 + + + + + + + + + false + + + + 290 + 140 + 16 + 16 + + + + + + + + + false + + + + 290 + 180 + 16 + 16 + + + + + + + + + + 350 + 100 + 16 + 16 + + + + + + + + + false + + + + 350 + 180 + 16 + 16 + + + + + + + + + + 350 + 60 + 16 + 16 + + + + + + + + + false + + + + 350 + 140 + 16 + 16 + + + + + + + + + + 分频段选择 - + - 40 - 230 + 50 + 90 71 16 @@ -791,87 +1019,11 @@ 使能 - + - 140 - 80 - 113 - 20 - - - - - - - 40 - 170 - 71 - 16 - - - - 使能 - - - - - - 140 - 110 - 113 - 20 - - - - - - - 40 - 140 - 71 - 16 - - - - 使能 - - - - - - 140 - 170 - 113 - 20 - - - - - - - 290 - 140 - 113 - 20 - - - - - - - 290 - 200 - 113 - 20 - - - - - - - 160 - 40 + 170 + 50 91 16 @@ -880,54 +1032,54 @@ 频率开始(Hz) - + - 290 - 230 - 113 - 20 - - - - - - - 40 - 80 - 71 + 320 + 50 + 91 16 - 使能 + 频率结束(Hz) - + - 140 - 140 + 150 + 90 113 20 - + - 140 - 200 + 300 + 90 113 20 - + - 40 - 200 + 150 + 120 + 113 + 20 + + + + + + + 50 + 120 71 16 @@ -939,41 +1091,18 @@ - 290 - 110 + 300 + 120 113 20 - + - 310 - 40 - 91 - 16 - - - - 频率结束(Hz) - - - - - - 140 - 230 - 113 - 20 - - - - - - - 40 - 110 + 50 + 150 71 16 @@ -982,31 +1111,64 @@ 使能 - + - 290 - 80 + 300 + 150 113 20 + + + + 150 + 150 + 113 + 20 + + + + + + + 50 + 180 + 71 + 16 + + + + 使能 + + - 290 - 170 + 300 + 180 113 20 - + - 40 - 350 + 150 + 180 + 113 + 20 + + + + + + + 50 + 210 71 16 @@ -1015,21 +1177,31 @@ 使能 - + - 140 - 320 + 300 + 210 113 20 - + - 40 - 290 + 150 + 210 + 113 + 20 + + + + + + + 50 + 240 71 16 @@ -1038,21 +1210,21 @@ 使能 - + - 140 - 350 + 300 + 240 113 20 - + - 290 - 320 + 150 + 240 113 20 @@ -1061,8 +1233,8 @@ - 40 - 260 + 50 + 270 71 16 @@ -1074,28 +1246,8 @@ - 290 - 260 - 113 - 20 - - - - - - - 140 - 290 - 113 - 20 - - - - - - - 290 - 290 + 300 + 270 113 20 @@ -1104,8 +1256,41 @@ - 140 - 260 + 150 + 270 + 113 + 20 + + + + + + + 50 + 300 + 71 + 16 + + + + 使能 + + + + + + 300 + 300 + 113 + 20 + + + + + + + 150 + 300 113 20 @@ -1114,8 +1299,41 @@ - 40 - 320 + 50 + 330 + 71 + 16 + + + + 使能 + + + + + + 300 + 330 + 113 + 20 + + + + + + + 150 + 330 + 113 + 20 + + + + + + + 50 + 360 71 16 @@ -1127,8 +1345,18 @@ - 290 - 350 + 300 + 360 + 113 + 20 + + + + + + + 150 + 360 113 20 diff --git a/radial_vibration.cpp b/radial_vibration.cpp index 8181658..3f5d8c2 100644 --- a/radial_vibration.cpp +++ b/radial_vibration.cpp @@ -183,16 +183,16 @@ void Radial::on_pushButton_confirm_clicked() { variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); - variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); - variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); - variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); - variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); - variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); - variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); - variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); - variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); - variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); - variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); +// variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); +// variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); +// variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); +// variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); +// variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); +// variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); +// variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); +// variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); +// variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); +// variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); // Gap // -general if(ui->comboBox_output_used_2->currentIndex() == 0) @@ -212,16 +212,16 @@ void Radial::on_pushButton_confirm_clicked() { variable->gap_alert_high.delay = ui->lineEdit_alert_high_delay_2->text().toDouble(); variable->gap_alert_high.enable = ui->checkBox_alert_high_enable_2->isChecked(); variable->gap_alert_high.latch = ui->checkBox_alert_high_latch_2->isChecked(); - variable->gap_danger_low.level = ui->lineEdit_danger_low_level_2->text().toDouble(); - variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis_2->text().toDouble(); - variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble(); - variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked(); - variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked(); - variable->gap_alert_low.level = ui->lineEdit_alert_low_level_2->text().toDouble(); - variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis_2->text().toDouble(); - variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay_2->text().toDouble(); - variable->gap_alert_low.enable = ui->checkBox_alert_low_enable_2->isChecked(); - variable->gap_alert_low.latch = ui->checkBox_alert_low_latch_2->isChecked(); +// variable->gap_danger_low.level = ui->lineEdit_danger_low_level_2->text().toDouble(); +// variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis_2->text().toDouble(); +// variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble(); +// variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked(); +// variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked(); +// variable->gap_alert_low.level = ui->lineEdit_alert_low_level_2->text().toDouble(); +// variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis_2->text().toDouble(); +// variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay_2->text().toDouble(); +// variable->gap_alert_low.enable = ui->checkBox_alert_low_enable_2->isChecked(); +// variable->gap_alert_low.latch = ui->checkBox_alert_low_latch_2->isChecked(); // add to ptr ptr->variables_.push_back(variable); this->close(); @@ -256,16 +256,16 @@ void Radial::on_pushButton_confirm_clicked() { variable->alert_high.delay = ui->lineEdit_alert_high_delay->text().toDouble(); variable->alert_high.enable = ui->checkBox_alert_high_enable->isChecked(); variable->alert_high.latch = ui->checkBox_alert_high_latch->isChecked(); - variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); - variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); - variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); - variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); - variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); - variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); - variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); - variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); - variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); - variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); +// variable->danger_low.level = ui->lineEdit_danger_low_level->text().toDouble(); +// variable->danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis->text().toDouble(); +// variable->danger_low.delay = ui->lineEdit_danger_low_delay->text().toDouble(); +// variable->danger_low.enable = ui->checkBox_danger_low_enable->isChecked(); +// variable->danger_low.latch = ui->checkBox_danger_low_latch->isChecked(); +// variable->alert_low.level = ui->lineEdit_alert_low_level->text().toDouble(); +// variable->alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis->text().toDouble(); +// variable->alert_low.delay = ui->lineEdit_alert_low_delay->text().toDouble(); +// variable->alert_low.enable = ui->checkBox_alert_low_enable->isChecked(); +// variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); // Gap // -general if(ui->comboBox_output_used_2->currentIndex() == 0) @@ -285,16 +285,16 @@ void Radial::on_pushButton_confirm_clicked() { variable->gap_alert_high.delay = ui->lineEdit_alert_high_delay_2->text().toDouble(); variable->gap_alert_high.enable = ui->checkBox_alert_high_enable_2->isChecked(); variable->gap_alert_high.latch = ui->checkBox_alert_high_latch_2->isChecked(); - variable->gap_danger_low.level = ui->lineEdit_danger_low_level_2->text().toDouble(); - variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis_2->text().toDouble(); - variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble(); - variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked(); - variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked(); - variable->gap_alert_low.level = ui->lineEdit_alert_low_level_2->text().toDouble(); - variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis_2->text().toDouble(); - variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay_2->text().toDouble(); - variable->gap_alert_low.enable = ui->checkBox_alert_low_enable_2->isChecked(); - variable->gap_alert_low.latch = ui->checkBox_alert_low_latch_2->isChecked(); +// variable->gap_danger_low.level = ui->lineEdit_danger_low_level_2->text().toDouble(); +// variable->gap_danger_low.hysteresis = ui->lineEdit_danger_low_hysteresis_2->text().toDouble(); +// variable->gap_danger_low.delay = ui->lineEdit_danger_low_delay_2->text().toDouble(); +// variable->gap_danger_low.enable = ui->checkBox_danger_low_enable_2->isChecked(); +// variable->gap_danger_low.latch = ui->checkBox_danger_low_latch_2->isChecked(); +// variable->gap_alert_low.level = ui->lineEdit_alert_low_level_2->text().toDouble(); +// variable->gap_alert_low.hysteresis = ui->lineEdit_alert_low_hysteresis_2->text().toDouble(); +// variable->gap_alert_low.delay = ui->lineEdit_alert_low_delay_2->text().toDouble(); +// variable->gap_alert_low.enable = ui->checkBox_alert_low_enable_2->isChecked(); +// variable->gap_alert_low.latch = ui->checkBox_alert_low_latch_2->isChecked(); this->close(); } diff --git a/radial_vibration.ui b/radial_vibration.ui index c305bbb..029ccaf 100644 --- a/radial_vibration.ui +++ b/radial_vibration.ui @@ -23,7 +23,7 @@ - 2 + 1 @@ -300,7 +300,7 @@ - 1 + 0 @@ -319,33 +319,6 @@ 整流器 - - - - 10 - 140 - 125 - 25 - - - - - 125 - 25 - - - - - 125 - 25 - - - - - RMS - - - @@ -359,33 +332,6 @@ 输出使用 - - - - 10 - 90 - 125 - 25 - - - - - 125 - 25 - - - - - 125 - 25 - - - - - um - - - @@ -431,6 +377,130 @@ + + + + 10 + 90 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + g + + + + + m/s**2 + + + + + mm/s + + + + + inch/s + + + + + um + + + + + mm + + + + + mils + + + + + inch/s**2 + + + + + + + + + + + + 10 + 140 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + True Peak + + + + + True Peak-To-Peak + + + + + RMS Scaled Peak + + + + + RMS Scaled Peak-To-Peak + + + + + AVG + + + + + RMS Scaled AVG + + + + + RMS + + + @@ -617,6 +687,9 @@ + + false + 220 @@ -627,6 +700,9 @@ + + false + 150 @@ -637,6 +713,9 @@ + + false + 80 @@ -647,6 +726,9 @@ + + false + 220 @@ -657,6 +739,9 @@ + + false + 80 @@ -667,6 +752,9 @@ + + false + 150 @@ -703,6 +791,9 @@ + + false + 290 @@ -716,6 +807,9 @@ + + false + 290 @@ -742,6 +836,9 @@ + + false + 350 @@ -768,6 +865,9 @@ + + false + 350 @@ -816,33 +916,6 @@ 整流器 - - - - 10 - 140 - 125 - 25 - - - - - 125 - 25 - - - - - 125 - 25 - - - - - RMS - - - @@ -856,33 +929,6 @@ 输出使用 - - - - 10 - 90 - 125 - 25 - - - - - 125 - 25 - - - - - 125 - 25 - - - - - um - - - @@ -928,6 +974,130 @@ + + + + 10 + 90 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + g + + + + + m/s**2 + + + + + mm/s + + + + + inch/s + + + + + um + + + + + mm + + + + + mils + + + + + inch/s**2 + + + + + + + + + + + + 10 + 140 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + True Peak + + + + + True Peak-To-Peak + + + + + RMS Scaled Peak + + + + + RMS Scaled Peak-To-Peak + + + + + AVG + + + + + RMS Scaled AVG + + + + + RMS + + + @@ -1114,6 +1284,9 @@ + + false + 220 @@ -1124,6 +1297,9 @@ + + false + 150 @@ -1134,6 +1310,9 @@ + + false + 80 @@ -1144,6 +1323,9 @@ + + false + 220 @@ -1154,6 +1336,9 @@ + + false + 80 @@ -1164,6 +1349,9 @@ + + false + 150 @@ -1200,6 +1388,9 @@ + + false + 290 @@ -1213,6 +1404,9 @@ + + false + 290 @@ -1239,6 +1433,9 @@ + + false + 350 @@ -1265,6 +1462,9 @@ + + false + 350 diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index a2ac7a8..97b2115 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -71,6 +71,10 @@ void Seismic_monitor::Init() { ui->doubleSpinBox_low_1->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_1->setValue(vib_data->base_config_[i].normal_voltage_high); + ui->checkBox_keyphase->setChecked(vib_data->base_config_[i].keyphase); + ui->comboBox_keyphase_ch->setCurrentIndex(vib_data->base_config_[i].keyphase_ch); + ui->comboBox_keyphase_slot->setCurrentIndex(vib_data->base_config_[i].keyphase_slot); + } else if (i + 1 == 2) { ui->comboBox_chan_type_2->setCurrentIndex(vib_data->base_config_[i].channel_type); ui->comboBox_sensitivity_unit_2->setCurrentIndex(vib_data->base_config_[i].sensitivity_unit); @@ -80,12 +84,20 @@ void Seismic_monitor::Init() { ui->doubleSpinBox_low_2->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_2->setValue(vib_data->base_config_[i].normal_voltage_high); + ui->checkBox_keyphase_2->setChecked(vib_data->base_config_[i].keyphase); + ui->comboBox_keyphase_ch_2->setCurrentIndex(vib_data->base_config_[i].keyphase_ch); + ui->comboBox_keyphase_slot_2->setCurrentIndex(vib_data->base_config_[i].keyphase_slot); + } else if (i + 1 == 3) { ui->checkBox_standby_2->setChecked(vib_data->base_config_[i].standby); ui->comboBox_chan_type_3->setCurrentIndex(vib_data->base_config_[i].channel_type); ui->comboBox_sensitivity_unit_3->setCurrentIndex(vib_data->base_config_[i].sensitivity_unit); ui->lineEdit_signal_sensitivity_3->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); + ui->checkBox_keyphase_3->setChecked(vib_data->base_config_[i].keyphase); + ui->comboBox_keyphase_ch_3->setCurrentIndex(vib_data->base_config_[i].keyphase_ch); + ui->comboBox_keyphase_slot_3->setCurrentIndex(vib_data->base_config_[i].keyphase_slot); + ui->checkBox_enable_3->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_3->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_3->setValue(vib_data->base_config_[i].normal_voltage_high); @@ -95,6 +107,10 @@ void Seismic_monitor::Init() { ui->comboBox_sensitivity_unit_4->setCurrentIndex(vib_data->base_config_[i].sensitivity_unit); ui->lineEdit_signal_sensitivity_4->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); + ui->checkBox_keyphase_4->setChecked(vib_data->base_config_[i].keyphase); + ui->comboBox_keyphase_ch_4->setCurrentIndex(vib_data->base_config_[i].keyphase_ch); + ui->comboBox_keyphase_slot_4->setCurrentIndex(vib_data->base_config_[i].keyphase_slot); + ui->checkBox_enable_4->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_4->setValue(vib_data->base_config_[i].normal_voltage_low); ui->doubleSpinBox_high_4->setValue(vib_data->base_config_[i].normal_voltage_high); @@ -126,7 +142,6 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_2->currentIndex(); vib_data->base_config_[var].sensitivity_unit = ui->comboBox_sensitivity_unit_2->currentIndex(); vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_2->text().toFloat(); - vib_data->base_config_[var].normal_voltage_low = ui->doubleSpinBox_low_2->value(); vib_data->base_config_[var].normal_voltage_high = ui->doubleSpinBox_high_2->value(); diff --git a/seismic_monitor.ui b/seismic_monitor.ui index b5aa93b..f45ef62 100644 --- a/seismic_monitor.ui +++ b/seismic_monitor.ui @@ -501,6 +501,9 @@ 16777215 + + 8 + @@ -590,7 +593,7 @@ -100.000000000000000 - 25.000000000000000 + 20.000000000000000 @@ -626,7 +629,7 @@ -100.000000000000000 - -25.000000000000000 + -20.000000000000000 @@ -936,6 +939,9 @@ 16777215 + + 8 + @@ -1025,7 +1031,7 @@ -100.000000000000000 - 25.000000000000000 + 20.000000000000000 @@ -1061,7 +1067,7 @@ -100.000000000000000 - -25.000000000000000 + -20.000000000000000 @@ -1629,6 +1635,9 @@ 16777215 + + 8 + @@ -1718,7 +1727,7 @@ -100.000000000000000 - 25.000000000000000 + 20.000000000000000 @@ -1754,7 +1763,7 @@ -100.000000000000000 - -25.000000000000000 + -20.000000000000000 @@ -2064,6 +2073,9 @@ 16777215 + + 8 + @@ -2153,7 +2165,7 @@ -100.000000000000000 - 25.000000000000000 + 20.000000000000000 @@ -2189,7 +2201,7 @@ -100.000000000000000 - -25.000000000000000 + -20.000000000000000 diff --git a/trust.ui b/trust.ui index fb7f077..e1193c4 100644 --- a/trust.ui +++ b/trust.ui @@ -306,33 +306,6 @@ 输出使用 - - - - 10 - 90 - 125 - 25 - - - - - 125 - 25 - - - - - 125 - 25 - - - - - um - - - @@ -436,6 +409,73 @@ + + + + 10 + 90 + 125 + 25 + + + + + 125 + 25 + + + + + 125 + 25 + + + + + g + + + + + m/s**2 + + + + + mm/s + + + + + inch/s + + + + + um + + + + + mm + + + + + mils + + + + + inch/s**2 + + + + + + + + diff --git a/velocity.ui b/velocity.ui index 6e24a2b..69990df 100644 --- a/velocity.ui +++ b/velocity.ui @@ -340,6 +340,36 @@ 25 + + + True Peak + + + + + True Peak-To-Peak + + + + + RMS Scaled Peak + + + + + RMS Scaled Peak-To-Peak + + + + + AVG + + + + + RMS Scaled AVG + + RMS @@ -380,11 +410,51 @@ 25 + + + g + + + + + m/s**2 + + + + + mm/s + + + + + inch/s + + um + + + mm + + + + + mils + + + + + inch/s**2 + + + + + + + @@ -617,6 +687,9 @@ + + false + 220 @@ -627,6 +700,9 @@ + + false + 150 @@ -637,6 +713,9 @@ + + false + 80 @@ -647,6 +726,9 @@ + + false + 220 @@ -657,6 +739,9 @@ + + false + 80 @@ -667,6 +752,9 @@ + + false + 150 @@ -703,6 +791,9 @@ + + false + 290 @@ -716,6 +807,9 @@ + + false + 290 @@ -742,6 +836,9 @@ + + false + 350 @@ -768,6 +865,9 @@ + + false + 350 diff --git a/vibrationdata.h b/vibrationdata.h index 14ce487..f6724a6 100644 --- a/vibrationdata.h +++ b/vibrationdata.h @@ -14,7 +14,7 @@ class VibrationData : public CardBase { std::vector> variables_; VibAlertDanger alert_danger[CHANNEL_COUNT]; VibAlertDangerPress alert_danger_press[CHANNEL_COUNT]; - DCOutput dc_output[CHANNEL_COUNT][CHANNEL_COUNT]; + DCOutput dc_output[CHANNEL_COUNT]; }; #endif // VIBRATIONDATA_H From 71cc0c4f1affe741498cc993e09f66a01ec1400d Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Wed, 6 Aug 2025 22:11:14 +0800 Subject: [PATCH 11/14] modify dc output --- TSI_Config.pro | 3 ++ acceleration.cpp | 27 ++++++++-- acceleration.h | 6 ++- acceleration.ui | 102 +++++++++++++++++++++++------------- data_config.h | 75 +++++++++++++++++++++++--- dc_output_channel.cpp | 11 ++-- dc_output_channel.h | 3 +- dc_outputs.cpp | 104 ++++++++++++++++++++++++------------ mainwindow.cpp | 9 +++- mainwindow.h | 1 + mainwindow.ui | 6 +++ mqtt_config.cpp | 53 +++++++++++++++++++ mqtt_config.h | 28 ++++++++++ mqtt_config.ui | 116 +++++++++++++++++++++++++++++++++++++++++ pressure_pulsation.cpp | 21 ++++++-- pressure_pulsation.h | 2 + pressure_pulsation.ui | 24 ++++----- radial_vibration.cpp | 21 ++++++-- radial_vibration.h | 4 +- radial_vibration.ui | 52 +++++++++--------- seismic_monitor.cpp | 24 +++++---- singlerelay.cpp | 2 + trust.cpp | 42 +++++++++++++-- trust.h | 4 ++ trust.ui | 86 +++++++++++++++++++++++++++--- velocity.cpp | 20 ++++++- velocity.h | 4 +- velocity.ui | 26 ++++----- 28 files changed, 706 insertions(+), 170 deletions(-) create mode 100644 mqtt_config.cpp create mode 100644 mqtt_config.h create mode 100644 mqtt_config.ui diff --git a/TSI_Config.pro b/TSI_Config.pro index f612b0c..ca9dfcb 100644 --- a/TSI_Config.pro +++ b/TSI_Config.pro @@ -23,6 +23,7 @@ SOURCES += \ macconfig.cpp \ main.cpp \ mainwindow.cpp \ + mqtt_config.cpp \ pointname.cpp \ pressure_pulsation.cpp \ radial_vibration.cpp \ @@ -57,6 +58,7 @@ HEADERS += \ keyphase_data.h \ macconfig.h \ mainwindow.h \ + mqtt_config.h \ pointname.h \ pressure_pulsation.h \ radial_vibration.h \ @@ -85,6 +87,7 @@ FORMS += \ keyphase.ui \ macconfig.ui \ mainwindow.ui \ + mqtt_config.ui \ pointname.ui \ pressure_pulsation.ui \ radial_vibration.ui \ diff --git a/acceleration.cpp b/acceleration.cpp index 3e25a1a..d75502f 100644 --- a/acceleration.cpp +++ b/acceleration.cpp @@ -5,7 +5,7 @@ #include #include #include - +#include #include "data_config.h" #include "vibrationdata.h" #include "config_mgr.h" @@ -133,9 +133,16 @@ void Acceleration::on_pushButton_confirm_clicked() { qCritical() << "[Acceleration::Init] should not be here"; return; } + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高"); + return; + } std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); + ptr->base_config_[channel - 1].channel_type = kVibAcc; std::shared_ptr variable_base = ptr->GetChannelPtr(channel); - if (variable_base == nullptr || variable_base->type_ != kVibAcc) { + std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); + + if (variable_base == nullptr || variable_base->type_ != kVibAcc || variable == nullptr) { if (variable_base == nullptr) { qDebug() << "no channel ptr"; } else { @@ -218,7 +225,7 @@ void Acceleration::on_pushButton_confirm_clicked() { this->close(); return; } - std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); + variable->filter_[0].checked = ui->checkBox_low_pass->isChecked(); variable->filter_[0].low = ui->spinBox_low_pass_low->value(); variable->filter_[0].high = ui->spinBox_low_pass_high->value(); @@ -298,3 +305,17 @@ void Acceleration::on_pushButton_cancel_clicked() { this->close(); } + +void Acceleration::on_lineEdit_alert_high_level_editingFinished() +{ + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text()); + } +} + + +void Acceleration::on_lineEdit_danger_high_level_editingFinished() +{ + +} + diff --git a/acceleration.h b/acceleration.h index b28459e..1be0827 100644 --- a/acceleration.h +++ b/acceleration.h @@ -24,7 +24,11 @@ class Acceleration : public QWidget { void on_pushButton_cancel_clicked(); - private: + void on_lineEdit_alert_high_level_editingFinished(); + + void on_lineEdit_danger_high_level_editingFinished(); + +private: Ui::Acceleration *ui; void Init(); diff --git a/acceleration.ui b/acceleration.ui index 10182ec..bb2504a 100644 --- a/acceleration.ui +++ b/acceleration.ui @@ -412,7 +412,7 @@ - 170 + 200 150 54 12 @@ -422,37 +422,10 @@ 整流器 - - - - 10 - 140 - 125 - 25 - - - - - 125 - 25 - - - - - 125 - 25 - - - - - RMS - - - - 170 + 200 50 54 12 @@ -467,19 +440,19 @@ 10 90 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -517,7 +490,7 @@ - 170 + 200 100 54 12 @@ -532,19 +505,19 @@ 10 40 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -559,6 +532,63 @@ + + + + 10 + 140 + 150 + 25 + + + + + 150 + 25 + + + + + 150 + 25 + + + + + True Peak + + + + + True Peak-To-Peak + + + + + RMS Scaled Peak + + + + + RMS Scaled Peak-To-Peak + + + + + AVG + + + + + RMS Scaled AVG + + + + + RMS + + + diff --git a/data_config.h b/data_config.h index 654c441..d9a8707 100644 --- a/data_config.h +++ b/data_config.h @@ -8,6 +8,10 @@ typedef unsigned char uint8_t; typedef unsigned short uint16_t; +#define SLOT_NUM 15 +#define CHANNEL_COUNT 4 +#define RELAY_COUNT 16 + typedef struct { bool used[4]; // 是否已配置 int channel; @@ -15,10 +19,8 @@ typedef struct { extern QString g_strServerIp; // 服务端IP extern QString g_version; -extern ChannelUsed ch_used[22]; -#define SLOT_NUM 15 -#define CHANNEL_COUNT 4 -#define RELAY_COUNT 16 +extern ChannelUsed ch_used[SLOT_NUM][22]; + struct ExprNode { QString value; QList children; @@ -147,6 +149,31 @@ typedef enum{ kUnit13 = 13 // user defined } EngineeringUnit; +typedef enum{ + kCh1Output1 = 0, // 通道1 输出1 + kCh2Output2 = 1, // 通道2 输出1 + kCh3Output3 = 2, // 通道3 输出1 + kCh4Output4 = 3, // 通道4 输出1 + kCh1Ch2 = 4, // 通道1 & 通道2 + kCh3Ch4 = 5, // 通道3 & 通道4 + kCh1FreBand1 = 6, // 通道1 分频段1 + kCh1FreBand2 = 7, // 通道1 分频段2 + kCh1FreBand3 = 8, // 通道1 分频段3 + kCh1FreBand4 = 9, // 通道1 分频段4 + kCh2FreBand1 = 10, // 通道2 分频段1 + kCh2FreBand2 = 11, // 通道2 分频段2 + kCh2FreBand3 = 12, // 通道2 分频段3 + kCh2FreBand4 = 13, // 通道2 分频段4 + kCh3FreBand1 = 14, // 通道3 分频段1 + kCh3FreBand2 = 15, // 通道3 分频段2 + kCh3FreBand3 = 16, // 通道3 分频段3 + kCh3FreBand4 = 17, // 通道3 分频段4 + kCh4FreBand1 = 18, // 通道4 分频段1 + kCh4FreBand2 = 19, // 通道4 分频段2 + kCh4FreBand3 = 20, // 通道4 分频段3 + kCh4FreBand4 = 21 // 通道4 分频段4 +} DCOutputChannel; + typedef struct SlotConfig_{ int slot; QString slot_type; @@ -181,10 +208,14 @@ enum CMTCommand { kRebootCard = 21, // 重启板卡 kGetCardDcValue = 22, // 获取子板平均值 kGetRelayStatus = 23, // 获取继电器状态 - KConfigProgress = 25, - kTimingCmd = 26, - kGetTimeInfo = 27, - kGetLogInfo = 28 + kGetKeyphaseInfo = 24, // 获取键相信息 + kConfigProgress = 25, // 配置进度 + kTimingCmd = 26, // 校时 + kGetTimeInfo = 27, // 获取时间信息 + kGetLogInfo = 28, // 获取子板日志信息 + kCleanSubCardCfg = 29, // 清理子板配置 + kCleanSubCardLatch = 30, // 清理子板特定通道的Latch状态 + kConfigMQTTBrokerInfo = 31, // 配置与获取MQTT broker信息 }; enum RS485Baudrate { kBaudrate2400 = 0, @@ -719,6 +750,34 @@ typedef struct { uint32_t ts; // 时间戳 } GetTimeInfoRsp; +typedef struct { + uint8_t head[3]; // 固定值:0xAA55AA + uint8_t cmd; // kConfigMQTTBrokerInfo + uint8_t version; // 版本号,默认为1 + uint8_t sub_cmd; // 0: get, 1: set + char ip[16]; // mqtt broker地址 + uint16_t port; +} MQTTBrokerConfigInfoReq; + +typedef struct { + uint8_t head[3]; // 固定值:0xAA55AA + uint8_t cmd; // kConfigMQTTBrokerInfo + uint8_t version; // 版本号,默认为1 + uint8_t code; // success:0, failure: others + uint8_t sub_cmd; // 0: get, 1: set + char ip[16]; // mqtt broker地址 + uint16_t port; +} MQTTBrokerConfigInfoRsp; + +// 子命令无响应,可观察灯板变化 +typedef struct { + uint8_t head[3]; // 固定值:0xAA55AA + uint8_t cmd; // kCleanSubCardLatch + uint8_t version; // 版本号,默认为1 + uint8_t card_id; // 子板编号,1-15 + uint8_t sid; // 通道编号,1-4 +} CleanLatchStatusReq; + struct BaseHeader { uint8_t head[3]; // 固定 0xAA 0x55 0xAA uint8_t cmd; diff --git a/dc_output_channel.cpp b/dc_output_channel.cpp index 7ecc3bd..05529b1 100644 --- a/dc_output_channel.cpp +++ b/dc_output_channel.cpp @@ -5,13 +5,14 @@ #include -DC_Output_Channel::DC_Output_Channel(QString unit_str_,int current_index_,QWidget *parent) : +DC_Output_Channel::DC_Output_Channel(int slot_no_,QString unit_str_,int current_index_,QWidget *parent) : QWidget(parent), ui(new Ui::DC_Output_Channel) { ui->setupUi(this); unit_str = unit_str_; current_index = current_index_; + slot_no = slot_no_; ui->label_min_unit->setText(unit_str); ui->label_max_unit->setText(unit_str); radiobtn[0] = ui->radioButton; @@ -22,13 +23,13 @@ DC_Output_Channel::DC_Output_Channel(QString unit_str_,int current_index_,QWidge int not_used = 0; for (int i = 0; i < 22; i++) { for (int j = 0; j < 4; j++){ - if(ch_used[i].used[j] && current_index == i){ + if(ch_used[slot_no][i].used[j] && current_index == i){ radiobtn[j]->setEnabled(true); radiobtn[j]->setChecked(true); first_used = j; - }else if(ch_used[i].used[j] && current_index != i){ + }else if(ch_used[slot_no][i].used[j] && current_index != i){ radiobtn[j]->setEnabled(false); - }else if(!ch_used[i].used[j] && current_index == i){ + }else if(!ch_used[slot_no][i].used[j] && current_index == i){ not_used ++; } } @@ -60,7 +61,7 @@ void DC_Output_Channel::on_pushButton_confirm_clicked() }else if(ui->radioButton_4->isChecked()){ channel = 4; }else if(ui->radioButton_5->isChecked()){ - ch_used[current_index].used[first_used] = false; + ch_used[slot_no][current_index].used[first_used] = false; channel = 5; }else { QMessageBox::information(this, QStringLiteral("提示"), "请选择正确的通道"); diff --git a/dc_output_channel.h b/dc_output_channel.h index 89098e0..91cbb9c 100644 --- a/dc_output_channel.h +++ b/dc_output_channel.h @@ -13,7 +13,7 @@ class DC_Output_Channel : public QWidget Q_OBJECT public: - explicit DC_Output_Channel(QString unit_str_,int current_index_,QWidget *parent = nullptr); + explicit DC_Output_Channel(int slot_no_,QString unit_str_,int current_index_,QWidget *parent = nullptr); ~DC_Output_Channel(); signals: void output_channel_data_sg(int channel,float minmun,float maxmum,int not_used); @@ -27,6 +27,7 @@ private: QString unit_str; int current_index; int first_used; + int slot_no; QRadioButton *radiobtn[5]; }; diff --git a/dc_outputs.cpp b/dc_outputs.cpp index 7459b0e..3260afa 100644 --- a/dc_outputs.cpp +++ b/dc_outputs.cpp @@ -7,7 +7,7 @@ #include "data_config.h" #include "vibrationdata.h" -ChannelUsed ch_used[22]; +ChannelUsed ch_used[SLOT_NUM][22]; DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) : QWidget(parent), @@ -67,7 +67,7 @@ void DC_Outputs::Init(){ ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[0].maxmum)); ui->label_ch_1_min_unit->setText(unit_str); ui->label_ch_1_max_unit->setText(unit_str); - ch_used[vib_dc_output_ptr->dc_output[0].output_channel].used[0] = true; + ch_used[slot_no][vib_dc_output_ptr->dc_output[0].output_channel].used[0] = true; } if(vib_dc_output_ptr->dc_output[1].output_channel != -1){ unit_str = GetUnit(vib_dc_output_ptr->dc_output[1].output_channel); @@ -76,7 +76,7 @@ void DC_Outputs::Init(){ ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[1].maxmum)); ui->label_ch_2_min_unit->setText(unit_str); ui->label_ch_2_max_unit->setText(unit_str); - ch_used[vib_dc_output_ptr->dc_output[1].output_channel].used[1] = true; + ch_used[slot_no][vib_dc_output_ptr->dc_output[1].output_channel].used[1] = true; } if(vib_dc_output_ptr->dc_output[2].output_channel != -1){ unit_str = GetUnit(vib_dc_output_ptr->dc_output[2].output_channel); @@ -85,7 +85,7 @@ void DC_Outputs::Init(){ ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[2].maxmum)); ui->label_ch_3_min_unit->setText(unit_str); ui->label_ch_3_max_unit->setText(unit_str); - ch_used[vib_dc_output_ptr->dc_output[2].output_channel].used[2] = true; + ch_used[slot_no][vib_dc_output_ptr->dc_output[2].output_channel].used[2] = true; } if(vib_dc_output_ptr->dc_output[3].output_channel != -1){ unit_str = GetUnit(vib_dc_output_ptr->dc_output[3].output_channel); @@ -94,7 +94,7 @@ void DC_Outputs::Init(){ ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[3].maxmum)); ui->label_ch_4_min_unit->setText(unit_str); ui->label_ch_4_max_unit->setText(unit_str); - ch_used[vib_dc_output_ptr->dc_output[3].output_channel].used[3] = true; + ch_used[slot_no][vib_dc_output_ptr->dc_output[3].output_channel].used[3] = true; } @@ -203,7 +203,7 @@ void DC_Outputs::on_comboBox_ch_output_activated(int index) { current_index = index; QString unit_str = GetUnit(current_index); - DC_Output_Channel *dc_output_channel = new DC_Output_Channel(unit_str,current_index); + DC_Output_Channel *dc_output_channel = new DC_Output_Channel(slot_no,unit_str,current_index); dc_output_channel->setWindowModality(Qt::ApplicationModal); connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float,int)),this,SLOT(output_channel_data(int,float,float,int))); dc_output_channel->show(); @@ -212,14 +212,50 @@ void DC_Outputs::on_comboBox_ch_output_activated(int index) void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int not_used){ qDebug() << channel << minmun << maxmum ; QString unit_str = GetUnit(current_index); - + for (int i = 0; i < CHANNEL_COUNT; i++) { + if(ch_used[slot_no][current_index].used[i] && i != (channel - 1)){ + if(i == 0){ + label_ch1[0]->setText("未使用"); + label_ch1[1]->setText("-----"); + label_ch1[2]->setText("-----"); + label_ch1[3]->setText("-----"); + label_ch1[4]->setText("-----"); + ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = false; + vib_dc_output_ptr->dc_output[0].output_channel = -1; + }else if(i == 1){ + label_ch2[0]->setText("未使用"); + label_ch2[1]->setText("-----"); + label_ch2[2]->setText("-----"); + label_ch2[3]->setText("-----"); + label_ch2[4]->setText("-----"); + ch_used[slot_no][current_index].used[1] = false; + vib_dc_output_ptr->dc_output[1].output_channel = -1; + }else if(i == 2){ + label_ch3[0]->setText("未使用"); + label_ch3[1]->setText("-----"); + label_ch3[2]->setText("-----"); + label_ch3[3]->setText("-----"); + label_ch3[4]->setText("-----"); + ch_used[slot_no][current_index].used[2] = false; + vib_dc_output_ptr->dc_output[2].output_channel = -1; + }else if(i == 3){ + label_ch4[0]->setText("未使用"); + label_ch4[1]->setText("-----"); + label_ch4[2]->setText("-----"); + label_ch4[3]->setText("-----"); + label_ch4[4]->setText("-----"); + ch_used[slot_no][current_index].used[3] = false; + vib_dc_output_ptr->dc_output[3].output_channel = -1; + } + } + } if(channel == 1){ ui->label_ch_1->setText(ui->comboBox_ch_output->currentText()); ui->label_ch_1_min->setText(QString::number(minmun)); ui->label_ch_1_max->setText(QString::number(maxmum)); ui->label_ch_1_min_unit->setText(unit_str); ui->label_ch_1_max_unit->setText(unit_str); - ch_used[ui->comboBox_ch_output->currentIndex()].used[0] = true; + ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = true; vib_dc_output_ptr->dc_output[0].output_channel = current_index; vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat(); vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat(); @@ -229,7 +265,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n ui->label_ch_2_max->setText(QString::number(maxmum)); ui->label_ch_2_min_unit->setText(unit_str); ui->label_ch_2_max_unit->setText(unit_str); - ch_used[ui->comboBox_ch_output->currentIndex()].used[1] = true; + ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[1] = true; vib_dc_output_ptr->dc_output[1].output_channel = current_index; vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat(); vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat(); @@ -239,7 +275,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n ui->label_ch_3_max->setText(QString::number(maxmum)); ui->label_ch_3_min_unit->setText(unit_str); ui->label_ch_3_max_unit->setText(unit_str); - ch_used[ui->comboBox_ch_output->currentIndex()].used[2] = true; + ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[2] = true; vib_dc_output_ptr->dc_output[2].output_channel = current_index; vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat(); vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat(); @@ -249,7 +285,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n ui->label_ch_4_max->setText(QString::number(maxmum)); ui->label_ch_4_min_unit->setText(unit_str); ui->label_ch_4_max_unit->setText(unit_str); - ch_used[ui->comboBox_ch_output->currentIndex()].used[3] = true; + ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[3] = true; vib_dc_output_ptr->dc_output[3].output_channel = current_index; vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat(); vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat(); @@ -260,31 +296,31 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n label_ch1[2]->setText("-----"); label_ch1[3]->setText("-----"); label_ch1[4]->setText("-----"); - ch_used[ui->comboBox_ch_output->currentIndex()].used[0] = false; + ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = false; vib_dc_output_ptr->dc_output[0].output_channel = -1; }else if(not_used == 1){ - label_ch1[0]->setText("未使用"); - label_ch1[1]->setText("-----"); - label_ch1[2]->setText("-----"); - label_ch1[3]->setText("-----"); - label_ch1[4]->setText("-----"); - ch_used[ui->comboBox_ch_output->currentIndex()].used[1] = false; + label_ch2[0]->setText("未使用"); + label_ch2[1]->setText("-----"); + label_ch2[2]->setText("-----"); + label_ch2[3]->setText("-----"); + label_ch2[4]->setText("-----"); + ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[1] = false; vib_dc_output_ptr->dc_output[1].output_channel = -1; }else if(not_used == 2){ - label_ch1[0]->setText("未使用"); - label_ch1[1]->setText("-----"); - label_ch1[2]->setText("-----"); - label_ch1[3]->setText("-----"); - label_ch1[4]->setText("-----"); - ch_used[ui->comboBox_ch_output->currentIndex()].used[2] = false; + label_ch3[0]->setText("未使用"); + label_ch3[1]->setText("-----"); + label_ch3[2]->setText("-----"); + label_ch3[3]->setText("-----"); + label_ch3[4]->setText("-----"); + ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[2] = false; vib_dc_output_ptr->dc_output[2].output_channel = -1; }else if(not_used == 3){ - label_ch1[0]->setText("未使用"); - label_ch1[1]->setText("-----"); - label_ch1[2]->setText("-----"); - label_ch1[3]->setText("-----"); - label_ch1[4]->setText("-----"); - ch_used[ui->comboBox_ch_output->currentIndex()].used[3] = false; + label_ch4[0]->setText("未使用"); + label_ch4[1]->setText("-----"); + label_ch4[2]->setText("-----"); + label_ch4[3]->setText("-----"); + label_ch4[4]->setText("-----"); + ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[3] = false; vib_dc_output_ptr->dc_output[3].output_channel = -1; } } @@ -362,25 +398,25 @@ void DC_Outputs::on_comboBox_ch_output_currentIndexChanged(int index) // ui->label_ch_1->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[0].output_channel)); // ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[0].minmum)); // ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[0].maxmum)); -// ch_used[current_index].used[0] = true; +// ch_used[slot_no][current_index].used[0] = true; // } // if(vib_dc_output_ptr->dc_output[1].dc_output_channel == 2 && current_index == vib_dc_output_ptr->dc_output[1].output_channel){ // ui->label_ch_2->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[1].output_channel)); // ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[1].minmum)); // ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[1].maxmum)); -// ch_used[current_index].used[1] = true; +// ch_used[slot_no][current_index].used[1] = true; // } // if(vib_dc_output_ptr->dc_output[2].dc_output_channel == 3 && current_index == vib_dc_output_ptr->dc_output[2].output_channel){ // ui->label_ch_3->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[2].output_channel)); // ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[2].minmum)); // ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[2].maxmum)); -// ch_used[current_index].used[2] = true; +// ch_used[slot_no][current_index].used[2] = true; // } // if(vib_dc_output_ptr->dc_output[3].dc_output_channel == 4 && current_index == vib_dc_output_ptr->dc_output[3].output_channel){ // ui->label_ch_4->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[3].output_channel)); // ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[3].minmum)); // ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[3].maxmum)); -// ch_used[current_index].used[3] = true; +// ch_used[slot_no][current_index].used[3] = true; // } } diff --git a/mainwindow.cpp b/mainwindow.cpp index bbc4e02..8cf42ef 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -27,6 +27,7 @@ #include "macconfig.h" #include #include "dc_outputs.h" +#include "mqtt_config.h" QString g_strServerIp; QString g_version; @@ -101,6 +102,7 @@ MainWindow::MainWindow(QWidget *parent) QObject::connect(ui->action_eth, &QAction::triggered, this, &MainWindow::onEthConfig); QObject::connect(ui->action_mac, &QAction::triggered, this, &MainWindow::onMACConfig); QObject::connect(ui->action_time, &QAction::triggered, this, &MainWindow::onSetTime); + QObject::connect(ui->action_mqtt, &QAction::triggered, this, &MainWindow::onMqttConfig); QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini", QSettings::IniFormat); g_strServerIp = settingsread.value("Server/IP").toString(); @@ -851,7 +853,7 @@ void MainWindow::readData(const QByteArray &data) { }else if(upload_config_rsp.code == 1){ statusBar()->showMessage("上传失败!", 2000); } - }else if(cmd == KConfigProgress){ + }else if(cmd == kConfigProgress){ ConfigSubCardProgress config_sub_card_progress; memcpy(&config_sub_card_progress, data.data(), sizeof(ConfigSubCardProgress)); QString status ; @@ -896,6 +898,11 @@ void MainWindow::onMACConfig(){ mac_config->setWindowModality(Qt::ApplicationModal); mac_config->show(); } +void MainWindow::onMqttConfig(){ + MqttConfig *mqtt_config = new MqttConfig(); + mqtt_config->setWindowModality(Qt::ApplicationModal); + mqtt_config->show(); +} void MainWindow::onSetTime(){ SetTimingReq set_time_req = { {0xAA, 0x55, 0xAA}, kTimingCmd, 1,0 }; int length = sizeof(SetTimingReq); diff --git a/mainwindow.h b/mainwindow.h index 0b104f6..4dbd335 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -76,6 +76,7 @@ private slots: void onEthConfig(); void onMACConfig(); void onSetTime(); + void onMqttConfig(); void onMenuActionTriggered(); void on_pushButton_slot_clicked(); diff --git a/mainwindow.ui b/mainwindow.ui index 843a923..c6e1788 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -1087,6 +1087,7 @@ + @@ -1138,6 +1139,11 @@ MAC配置 + + + MQTT配置 + + diff --git a/mqtt_config.cpp b/mqtt_config.cpp new file mode 100644 index 0000000..030262e --- /dev/null +++ b/mqtt_config.cpp @@ -0,0 +1,53 @@ +#include "mqtt_config.h" +#include "ui_mqtt_config.h" +#include +MqttConfig::MqttConfig(QWidget *parent) : + QWidget(parent), + ui(new Ui::MqttConfig) +{ + ui->setupUi(this); + QString exp = "\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.)" + "{3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"; + QRegExp rege(exp); + QValidator *Validator = new QRegExpValidator(rege); + ui->lineEdit_ip->setValidator(Validator); + m_tcpClient = MyTcpClient::instance(); + connect(m_tcpClient, SIGNAL(dataReceived(const QByteArray &)), this, SLOT(readData(const QByteArray &))); + +} + +MqttConfig::~MqttConfig() +{ + delete ui; +} +void MqttConfig::readData(const QByteArray &data) { + qDebug() << "Received from server:" << data; + uint8_t cmd = data[3]; + if (cmd == kConfigMQTTBrokerInfo) { + MQTTBrokerConfigInfoRsp mqtt_config_rsp; + memcpy(&mqtt_config_rsp, data.data(), sizeof(MQTTBrokerConfigInfoRsp)); + qDebug() << "mqtt_config_rsp code" << mqtt_config_rsp.code ; + } +} +void MqttConfig::on_pushButton_confirm_clicked() +{ + MQTTBrokerConfigInfoReq mqtt_config = { {0xAA, 0x55, 0xAA}, kConfigMQTTBrokerInfo, 1,1,{} }; + memcpy(mqtt_config.ip,ui->lineEdit_ip->text().toStdString().c_str(),sizeof(mqtt_config.ip)); + mqtt_config.port = ui->lineEdit_port->text().toInt(); + char send_buf[100] ={0}; + memcpy(send_buf, (char*)&mqtt_config, sizeof(MQTTBrokerConfigInfoReq)); + + int length = sizeof(MQTTBrokerConfigInfoReq); + qint64 bytesWritten = m_tcpClient->sendData(send_buf, length); + m_tcpClient->waitForRead(); + qDebug() << "bytesWritten: " << bytesWritten; + + this->close(); +} + + +void MqttConfig::on_pushButton_cancel_clicked() +{ + this->close(); +} + diff --git a/mqtt_config.h b/mqtt_config.h new file mode 100644 index 0000000..45e95db --- /dev/null +++ b/mqtt_config.h @@ -0,0 +1,28 @@ +#ifndef MQTT_CONFIG_H +#define MQTT_CONFIG_H + +#include +#include "MyTcpClient.h" +namespace Ui { +class MqttConfig; +} + +class MqttConfig : public QWidget +{ + Q_OBJECT + +public: + explicit MqttConfig(QWidget *parent = nullptr); + ~MqttConfig(); + +private slots: + void on_pushButton_confirm_clicked(); + + void on_pushButton_cancel_clicked(); + void readData(const QByteArray&); +private: + Ui::MqttConfig *ui; + MyTcpClient* m_tcpClient; +}; + +#endif // MQTT_CONFIG_H diff --git a/mqtt_config.ui b/mqtt_config.ui new file mode 100644 index 0000000..f8c039c --- /dev/null +++ b/mqtt_config.ui @@ -0,0 +1,116 @@ + + + MqttConfig + + + + 0 + 0 + 412 + 314 + + + + MQTT 配置 + + + + + 140 + 30 + 111 + 16 + + + + MQTT 服务器配置 + + + + + + 60 + 90 + 54 + 12 + + + + IP: + + + + + + 130 + 80 + 151 + 25 + + + + + 0 + 25 + + + + + + + 60 + 130 + 54 + 12 + + + + 端口: + + + + + + 130 + 120 + 151 + 25 + + + + + 0 + 25 + + + + + + + 90 + 230 + 75 + 23 + + + + 确定 + + + + + + 210 + 230 + 75 + 23 + + + + 取消 + + + + + + diff --git a/pressure_pulsation.cpp b/pressure_pulsation.cpp index 0a24df8..7d023db 100644 --- a/pressure_pulsation.cpp +++ b/pressure_pulsation.cpp @@ -4,7 +4,7 @@ #include #include #include - +#include #include "data_config.h" #include "vibrationdata.h" #include "config_mgr.h" @@ -131,9 +131,17 @@ void PressurePulsation::on_pushButton_confirm_clicked() qCritical() << "[Radial::Init] should not be here"; return; } + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高"); + return; + } std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); + ptr->base_config_[channel - 1].channel_type = kVibPressurePulsation; + std::shared_ptr variable_base = ptr->GetChannelPtr(channel); - if (variable_base == nullptr || variable_base->type_ != kVibThrust) { + std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); + + if (variable_base == nullptr || variable_base->type_ != kVibThrust || variable == nullptr) { if (variable_base == nullptr) { qDebug() << "no channel ptr"; } else { @@ -217,7 +225,6 @@ void PressurePulsation::on_pushButton_confirm_clicked() this->close(); return; } - std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); variable->filter_[0].checked = ui->checkBox_low_pass->checkState(); variable->filter_[0].low = ui->spinBox_low_pass_low->value(); variable->filter_[0].high = ui->spinBox_low_pass_high->value(); @@ -297,3 +304,11 @@ void PressurePulsation::on_pushButton_cancel_clicked() this->close(); } + +void PressurePulsation::on_lineEdit_alert_high_level_editingFinished() +{ + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text()); + } +} + diff --git a/pressure_pulsation.h b/pressure_pulsation.h index 8bdbcaa..76b4316 100644 --- a/pressure_pulsation.h +++ b/pressure_pulsation.h @@ -22,6 +22,8 @@ private slots: void on_pushButton_cancel_clicked(); + void on_lineEdit_alert_high_level_editingFinished(); + private: Ui::PressurePulsation *ui; void Init(); diff --git a/pressure_pulsation.ui b/pressure_pulsation.ui index 3b64234..51210c9 100644 --- a/pressure_pulsation.ui +++ b/pressure_pulsation.ui @@ -473,7 +473,7 @@ - 170 + 220 150 54 12 @@ -488,19 +488,19 @@ 10 140 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -513,7 +513,7 @@ - 170 + 220 50 54 12 @@ -528,19 +528,19 @@ 10 90 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -578,7 +578,7 @@ - 170 + 220 100 54 12 @@ -593,19 +593,19 @@ 10 40 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 diff --git a/radial_vibration.cpp b/radial_vibration.cpp index 3f5d8c2..3159970 100644 --- a/radial_vibration.cpp +++ b/radial_vibration.cpp @@ -5,7 +5,7 @@ #include #include #include - +#include #include "data_config.h" #include "vibrationdata.h" #include "config_mgr.h" @@ -143,9 +143,17 @@ void Radial::on_pushButton_confirm_clicked() { qCritical() << "[Radial::Init] should not be here"; return; } + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高"); + return; + } std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); + ptr->base_config_[channel - 1].channel_type = kVibRadial; + std::shared_ptr variable_base = ptr->GetChannelPtr(channel); - if (variable_base == nullptr || variable_base->type_ != kVibRadial) { + std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); + + if (variable_base == nullptr || variable_base->type_ != kVibRadial || variable == nullptr) { if (variable_base == nullptr) { qDebug() << "no channel ptr"; } else { @@ -227,7 +235,6 @@ void Radial::on_pushButton_confirm_clicked() { this->close(); return; } - std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); variable->filter_[0].checked = ui->checkBox_low_pass->isChecked(); variable->filter_[0].low = ui->spinBox_low_pass_low->value(); variable->filter_[0].high = ui->spinBox_low_pass_high->value(); @@ -302,3 +309,11 @@ void Radial::on_pushButton_confirm_clicked() { void Radial::on_pushButton_set_default_clicked() { } + +void Radial::on_lineEdit_alert_high_level_editingFinished() +{ + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text()); + } +} + diff --git a/radial_vibration.h b/radial_vibration.h index 2a94031..37b0f8a 100644 --- a/radial_vibration.h +++ b/radial_vibration.h @@ -22,7 +22,9 @@ class Radial : public QWidget { void on_checkBox_1x_ampl_toggled(bool checked); void on_checkBox_2x_ampl_toggled(bool checked); - private: + void on_lineEdit_alert_high_level_editingFinished(); + +private: Ui::Radial_vibration *ui; void Init(); diff --git a/radial_vibration.ui b/radial_vibration.ui index 029ccaf..044bad9 100644 --- a/radial_vibration.ui +++ b/radial_vibration.ui @@ -23,7 +23,7 @@ - 1 + 2 @@ -309,7 +309,7 @@ - 170 + 210 150 54 12 @@ -322,7 +322,7 @@ - 170 + 210 50 54 12 @@ -335,7 +335,7 @@ - 170 + 210 100 54 12 @@ -350,19 +350,19 @@ 10 40 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -382,19 +382,19 @@ 10 90 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -449,19 +449,19 @@ 10 140 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -897,7 +897,7 @@ - 1 + 0 @@ -906,7 +906,7 @@ - 170 + 210 150 54 12 @@ -919,7 +919,7 @@ - 170 + 210 50 54 12 @@ -932,7 +932,7 @@ - 170 + 210 100 54 12 @@ -947,19 +947,19 @@ 10 40 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -979,19 +979,19 @@ 10 90 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -1046,19 +1046,19 @@ 10 140 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index 97b2115..2ec9c72 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -72,8 +72,8 @@ void Seismic_monitor::Init() { ui->doubleSpinBox_high_1->setValue(vib_data->base_config_[i].normal_voltage_high); ui->checkBox_keyphase->setChecked(vib_data->base_config_[i].keyphase); - ui->comboBox_keyphase_ch->setCurrentIndex(vib_data->base_config_[i].keyphase_ch); - ui->comboBox_keyphase_slot->setCurrentIndex(vib_data->base_config_[i].keyphase_slot); + ui->comboBox_keyphase_ch->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch)); + ui->comboBox_keyphase_slot->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot)); } else if (i + 1 == 2) { ui->comboBox_chan_type_2->setCurrentIndex(vib_data->base_config_[i].channel_type); @@ -85,8 +85,8 @@ void Seismic_monitor::Init() { ui->doubleSpinBox_high_2->setValue(vib_data->base_config_[i].normal_voltage_high); ui->checkBox_keyphase_2->setChecked(vib_data->base_config_[i].keyphase); - ui->comboBox_keyphase_ch_2->setCurrentIndex(vib_data->base_config_[i].keyphase_ch); - ui->comboBox_keyphase_slot_2->setCurrentIndex(vib_data->base_config_[i].keyphase_slot); + ui->comboBox_keyphase_ch_2->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch)); + ui->comboBox_keyphase_slot_2->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot)); } else if (i + 1 == 3) { ui->checkBox_standby_2->setChecked(vib_data->base_config_[i].standby); @@ -95,8 +95,8 @@ void Seismic_monitor::Init() { ui->lineEdit_signal_sensitivity_3->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); ui->checkBox_keyphase_3->setChecked(vib_data->base_config_[i].keyphase); - ui->comboBox_keyphase_ch_3->setCurrentIndex(vib_data->base_config_[i].keyphase_ch); - ui->comboBox_keyphase_slot_3->setCurrentIndex(vib_data->base_config_[i].keyphase_slot); + ui->comboBox_keyphase_ch_3->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch)); + ui->comboBox_keyphase_slot_3->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot)); ui->checkBox_enable_3->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_3->setValue(vib_data->base_config_[i].normal_voltage_low); @@ -108,8 +108,8 @@ void Seismic_monitor::Init() { ui->lineEdit_signal_sensitivity_4->setText(QString::number(vib_data->base_config_[i].signal_sensitivity)); ui->checkBox_keyphase_4->setChecked(vib_data->base_config_[i].keyphase); - ui->comboBox_keyphase_ch_4->setCurrentIndex(vib_data->base_config_[i].keyphase_ch); - ui->comboBox_keyphase_slot_4->setCurrentIndex(vib_data->base_config_[i].keyphase_slot); + ui->comboBox_keyphase_ch_4->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_ch)); + ui->comboBox_keyphase_slot_4->setCurrentText(QString::number(vib_data->base_config_[i].keyphase_slot)); ui->checkBox_enable_4->setChecked(vib_data->base_config_[i].active); ui->doubleSpinBox_low_4->setValue(vib_data->base_config_[i].normal_voltage_low); @@ -206,7 +206,13 @@ void Seismic_monitor::on_pushButton_confirm_clicked() { QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!"); return; } - + if(ui->lineEdit_signal_sensitivity_1->text() == "0" || + ui->lineEdit_signal_sensitivity_2->text() == "0" || + ui->lineEdit_signal_sensitivity_3->text() == "0" || + ui->lineEdit_signal_sensitivity_4->text() == "0"){ + QMessageBox::information(this, QStringLiteral("提示"), "传感器灵敏度填写错误!"); + return; + } std::shared_ptr vib_data = std::dynamic_pointer_cast(base_ptr); UpdateData(vib_data); diff --git a/singlerelay.cpp b/singlerelay.cpp index 44d9a87..f8fa3cc 100644 --- a/singlerelay.cpp +++ b/singlerelay.cpp @@ -150,6 +150,8 @@ void SingleRelay::OnButtonGroup(QAbstractButton *slot_btn) { int button_id = object_name.right(object_name.length() - 15).toInt(); std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id); std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); + if(ptr == nullptr) + return; QListWidgetItem *item_and = new QListWidgetItem("AND"); item_and->setData(Qt::UserRole, "*"); list_widget_available->addItem(item_and); diff --git a/trust.cpp b/trust.cpp index 2d8f104..981929c 100644 --- a/trust.cpp +++ b/trust.cpp @@ -5,7 +5,7 @@ #include #include #include - +#include #include "data_config.h" #include "vibrationdata.h" #include "config_mgr.h" @@ -70,6 +70,7 @@ void Trust::Init() { else ui->comboBox_output_used->setCurrentIndex(1); ui->comboBox_engineering_unit->setCurrentIndex(variable_ptr->gap_general.engineering_unit); + ui->comboBox_rectifier_funtion->setCurrentIndex(variable_ptr->general.rectifier_function); // -alarm ui->lineEdit_danger_high_level->setText(QString::number(variable_ptr->gap_danger_high.level)); ui->lineEdit_danger_high_hysteresis->setText(QString::number(variable_ptr->gap_danger_high.hysteresis)); @@ -103,9 +104,25 @@ void Trust::on_pushButton_confirm_clicked() qCritical() << "[Radial::Init] should not be here"; return; } + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高"); + return; + } + if(ui->lineEdit_alert_low_level->text().toFloat() > ui->lineEdit_alert_high_level->text().toDouble()){ + QMessageBox::warning(this, QStringLiteral("警告"), "警报 + 高 必须大于 警报 + 低"); + return; + } + if(ui->lineEdit_danger_low_level->text().toFloat() > ui->lineEdit_alert_low_level->text().toDouble()){ + QMessageBox::warning(this, QStringLiteral("警告"), "警报 + 低 必须大于 危险 + 低"); + return; + } std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); + ptr->base_config_[channel - 1].channel_type = kVibThrust; + std::shared_ptr variable_base = ptr->GetChannelPtr(channel); - if (variable_base == nullptr || variable_base->type_ != kVibThrust) { + std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); + + if (variable_base == nullptr || variable_base->type_ != kVibThrust || variable == nullptr) { if (variable_base == nullptr) { qDebug() << "no channel ptr"; } else { @@ -135,6 +152,8 @@ void Trust::on_pushButton_confirm_clicked() else variable->gap_general.output_used = false; variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); + // -alarm variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -160,7 +179,6 @@ void Trust::on_pushButton_confirm_clicked() this->close(); return; } - std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); variable->filter_[0].checked = ui->checkBox_low_pass->isChecked(); variable->filter_[0].low = ui->spinBox_low_pass_low->value(); variable->filter_[0].high = ui->spinBox_low_pass_high->value(); @@ -181,6 +199,8 @@ void Trust::on_pushButton_confirm_clicked() else variable->gap_general.output_used = false; variable->gap_general.engineering_unit = ui->comboBox_engineering_unit->currentIndex(); + variable->general.rectifier_function = ui->comboBox_rectifier_funtion->currentIndex(); + // -alarm variable->gap_danger_high.level = ui->lineEdit_danger_high_level->text().toDouble(); variable->gap_danger_high.hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble(); @@ -211,3 +231,19 @@ void Trust::on_pushButton_cancel_clicked() this->close(); } + +void Trust::on_lineEdit_alert_high_level_editingFinished() +{ + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text()); + } +} + + +void Trust::on_lineEdit_danger_low_level_editingFinished() +{ + if(ui->lineEdit_danger_low_level->text().toFloat() > ui->lineEdit_alert_low_level->text().toDouble()){ + ui->lineEdit_alert_low_level->setText(ui->lineEdit_danger_low_level->text()); + } +} + diff --git a/trust.h b/trust.h index 8ef1319..29c4ade 100644 --- a/trust.h +++ b/trust.h @@ -22,6 +22,10 @@ private slots: void on_pushButton_cancel_clicked(); + void on_lineEdit_alert_high_level_editingFinished(); + + void on_lineEdit_danger_low_level_editingFinished(); + private: Ui::Trust *ui; void Init(); diff --git a/trust.ui b/trust.ui index e1193c4..9537ee9 100644 --- a/trust.ui +++ b/trust.ui @@ -296,7 +296,7 @@ - 170 + 230 50 54 12 @@ -309,7 +309,7 @@ - 170 + 230 100 54 12 @@ -324,19 +324,19 @@ 10 40 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -414,19 +414,19 @@ 10 90 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -476,6 +476,76 @@ + + + + 230 + 150 + 54 + 12 + + + + 整流器 + + + + + + 10 + 140 + 150 + 25 + + + + + 150 + 25 + + + + + 150 + 25 + + + + + True Peak + + + + + True Peak-To-Peak + + + + + RMS Scaled Peak + + + + + RMS Scaled Peak-To-Peak + + + + + AVG + + + + + RMS Scaled AVG + + + + + RMS + + + diff --git a/velocity.cpp b/velocity.cpp index 7ac8283..9d58f42 100644 --- a/velocity.cpp +++ b/velocity.cpp @@ -9,6 +9,7 @@ #include "data_config.h" #include "vibrationdata.h" #include "config_mgr.h" +#include Velocity::Velocity(int slot_no_, int channel_, bool active, QWidget *parent) : QWidget(parent) @@ -105,9 +106,17 @@ void Velocity::on_pushButton_confirm_clicked() { qCritical() << "[Acceleration::Init] should not be here"; return; } + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + QMessageBox::warning(this, QStringLiteral("警告"), "危险 + 高 必须大于 警报 + 高"); + return; + } std::shared_ptr ptr = std::dynamic_pointer_cast(base_ptr); + ptr->base_config_[channel - 1].channel_type = kVibVelocity; + std::shared_ptr variable_base = ptr->GetChannelPtr(channel); - if (variable_base == nullptr || variable_base->type_ != kVibVelocity) { + std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); + + if (variable_base == nullptr || variable_base->type_ != kVibVelocity || variable == nullptr) { if (variable_base == nullptr) { qDebug() << "no channel ptr"; } else { @@ -159,7 +168,6 @@ void Velocity::on_pushButton_confirm_clicked() { this->close(); return; } - std::shared_ptr variable = std::dynamic_pointer_cast(variable_base); variable->filter_[0].checked = ui->checkBox_low_pass->isChecked(); variable->filter_[0].low = ui->spinBox_low_pass_low->value(); variable->filter_[0].high = ui->spinBox_low_pass_high->value(); @@ -200,3 +208,11 @@ void Velocity::on_pushButton_confirm_clicked() { variable->alert_low.latch = ui->checkBox_alert_low_latch->isChecked(); this->close(); } + +void Velocity::on_lineEdit_alert_high_level_editingFinished() +{ + if(ui->lineEdit_alert_high_level->text().toFloat() > ui->lineEdit_danger_high_level->text().toDouble()){ + ui->lineEdit_danger_high_level->setText(ui->lineEdit_alert_high_level->text()); + } +} + diff --git a/velocity.h b/velocity.h index 1c0a31e..dfd530d 100644 --- a/velocity.h +++ b/velocity.h @@ -21,7 +21,9 @@ class Velocity : public QWidget { void on_pushButton_confirm_clicked(); void on_pushButton_cancel_clicked(); - private: + void on_lineEdit_alert_high_level_editingFinished(); + +private: Ui::Velocity *ui; void Init(); diff --git a/velocity.ui b/velocity.ui index 69990df..2f56640 100644 --- a/velocity.ui +++ b/velocity.ui @@ -300,7 +300,7 @@ - 1 + 0 @@ -309,7 +309,7 @@ - 170 + 220 150 54 12 @@ -324,19 +324,19 @@ 10 140 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -379,7 +379,7 @@ - 170 + 220 50 54 12 @@ -394,19 +394,19 @@ 10 90 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 @@ -459,7 +459,7 @@ - 170 + 220 100 54 12 @@ -474,19 +474,19 @@ 10 40 - 125 + 150 25 - 125 + 150 25 - 125 + 150 25 From 6c908697bfb2e778866ea1d683d88472527215a4 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Thu, 7 Aug 2025 19:35:59 +0800 Subject: [PATCH 12/14] fix bugs --- acceleration.cpp | 2 - acceleration.ui | 87 ++++++++++++++++++++++++++++++++++--------- data_config.h | 9 ++++- dc_outputs.ui | 2 +- keyphase.ui | 32 ++++++++-------- mainwindow.cpp | 35 +++++++++++------ mainwindow.ui | 2 +- pressure_pulsation.ui | 69 +++++++++++++++++++++++++++++----- radial_vibration.ui | 62 ++++++++++++++---------------- seismic_monitor.cpp | 28 ++++++++++++++ seismic_monitor.h | 10 ++++- seismic_monitor.ui | 64 +++++++++++++++---------------- singlerelay.cpp | 58 ++++++++++++++++++++--------- trust.ui | 27 ++++++-------- velocity.ui | 35 ++++++++--------- 15 files changed, 345 insertions(+), 177 deletions(-) diff --git a/acceleration.cpp b/acceleration.cpp index d75502f..77b6e77 100644 --- a/acceleration.cpp +++ b/acceleration.cpp @@ -123,8 +123,6 @@ void Acceleration::Init() { ui->checkBox_enable_10->setChecked(variable_ptr->freband_output[9].enable); ui->lineEdit_start_10->setText(QString::number(variable_ptr->freband_output[9].start)); ui->lineEdit_end_10->setText(QString::number(variable_ptr->freband_output[9].end)); - - } void Acceleration::on_pushButton_confirm_clicked() { diff --git a/acceleration.ui b/acceleration.ui index bb2504a..546cd48 100644 --- a/acceleration.ui +++ b/acceleration.ui @@ -403,7 +403,7 @@ - 0 + 1 @@ -414,8 +414,8 @@ 200 150 - 54 - 12 + 71 + 16 @@ -427,8 +427,8 @@ 200 50 - 54 - 12 + 81 + 16 @@ -492,8 +492,8 @@ 200 100 - 54 - 12 + 81 + 16 @@ -651,13 +651,12 @@ 90 30 - 31 + 41 31 - 等级 - (um) + 等级 @@ -665,13 +664,12 @@ 170 30 - 31 + 41 31 - 回差 -(um) + 回差 @@ -679,13 +677,12 @@ 230 30 - 31 + 41 31 - 延时 -(um) + 延时 @@ -693,7 +690,7 @@ 280 40 - 31 + 41 16 @@ -706,7 +703,7 @@ 340 40 - 31 + 41 16 @@ -1134,6 +1131,9 @@ + + false + 50 @@ -1147,6 +1147,9 @@ + + false + 300 @@ -1157,6 +1160,9 @@ + + false + 150 @@ -1167,6 +1173,9 @@ + + false + 50 @@ -1180,6 +1189,9 @@ + + false + 300 @@ -1190,6 +1202,9 @@ + + false + 150 @@ -1200,6 +1215,9 @@ + + false + 50 @@ -1213,6 +1231,9 @@ + + false + 300 @@ -1223,6 +1244,9 @@ + + false + 150 @@ -1233,6 +1257,9 @@ + + false + 50 @@ -1246,6 +1273,9 @@ + + false + 300 @@ -1256,6 +1286,9 @@ + + false + 150 @@ -1266,6 +1299,9 @@ + + false + 50 @@ -1279,6 +1315,9 @@ + + false + 300 @@ -1289,6 +1328,9 @@ + + false + 150 @@ -1299,6 +1341,9 @@ + + false + 50 @@ -1312,6 +1357,9 @@ + + false + 300 @@ -1322,6 +1370,9 @@ + + false + 150 diff --git a/data_config.h b/data_config.h index d9a8707..ca3617c 100644 --- a/data_config.h +++ b/data_config.h @@ -240,7 +240,7 @@ typedef enum { kVibRackTMR = 1 // 三冗余 } VibRackType; -typedef struct { +typedef struct SeismicMonitor_{ int id; QString point_name; QString chan_id; @@ -260,6 +260,13 @@ typedef struct { int keyphase_ch; int sensitivity_unit; float signal_sensitivity; + SeismicMonitor_(){ + standby = false; + active = false; + normal_voltage_high = 20; + normal_voltage_low = -20; + signal_sensitivity = 8; + } } SeismicMonitor; typedef enum { diff --git a/dc_outputs.ui b/dc_outputs.ui index 61b8ec5..f951cf4 100644 --- a/dc_outputs.ui +++ b/dc_outputs.ui @@ -56,7 +56,7 @@ - 通道1 & 通道4 + 通道1 & 通道2 diff --git a/keyphase.ui b/keyphase.ui index ca886fd..eb688b7 100644 --- a/keyphase.ui +++ b/keyphase.ui @@ -6,8 +6,8 @@ 0 0 - 660 - 580 + 691 + 598 @@ -76,7 +76,7 @@ - 300 + 326 310 41 16 @@ -89,7 +89,7 @@ - 296 + 322 250 51 32 @@ -104,7 +104,7 @@ 10 60 - 281 + 301 451 @@ -550,7 +550,7 @@ 10 40 - 251 + 281 71 @@ -717,7 +717,7 @@ 10 130 - 251 + 281 181 @@ -809,7 +809,7 @@ 140 90 - 111 + 131 16 @@ -822,7 +822,7 @@ 140 130 - 101 + 131 16 @@ -897,7 +897,7 @@ - 294 + 320 360 51 32 @@ -926,9 +926,9 @@ - 350 + 380 60 - 281 + 301 451 @@ -1374,7 +1374,7 @@ 10 40 - 251 + 281 71 @@ -1538,7 +1538,7 @@ 10 130 - 251 + 281 181 @@ -1630,7 +1630,7 @@ 140 90 - 111 + 131 16 @@ -1643,7 +1643,7 @@ 140 130 - 101 + 121 16 diff --git a/mainwindow.cpp b/mainwindow.cpp index 8cf42ef..0f7d0f6 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -5,7 +5,7 @@ #include #include #include - +#include #include "keyphase.h" #include "singlerelay.h" #include "tachometer.h" @@ -36,9 +36,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); -// QMenuBar *menuBar = this->menuBar(); -// this->setMenuBar(menuBar); //添加到对象树 -// menuBar->addMenu(ui->menu_start); g_version = "1.1"; current_slot = -1; tsi_config_file = ""; @@ -571,12 +568,28 @@ uint8_t calculate_crc(const QByteArray &data) { } void MainWindow::on_pushButton_save_clicked() { - QString filepath = QFileDialog::getExistingDirectory(this, tr("选择文件夹"), tr("")); - if(filepath == "") - return; - QString file_name = filepath + "\\tsi_config_file.json"; - ConfigMgr::Instance()->Save(file_name); - tsi_config_file = file_name; + QString file_name = ""; + if(tsi_config_file == ""){ + QString strTips =QString("请输入保存的文件名称"); + bool ok = false; + QString defaultInput = "tsi_config_file"; + file_name = QInputDialog::getText(this, tr("输入名称对话框"), strTips, QLineEdit::Normal, defaultInput, &ok); + if(!ok) return; + + if( file_name == ""){ + QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("请输入正确的文件名称!")); + return ; + } + QString filepath = QFileDialog::getExistingDirectory(this, tr("选择文件夹"), tr("")); + if(filepath == "") + return; + file_name = filepath + "\\"+file_name +".json"; + ConfigMgr::Instance()->Save(file_name); + tsi_config_file = file_name; + }else { + ConfigMgr::Instance()->Save(tsi_config_file); + } + return; } @@ -598,7 +611,7 @@ void MainWindow::on_pushButton_open_clicked() { return; } QList buttonList = btnGroup_slot->buttons(); - for (int i = 0; i < buttonList.count(); i++) { + for (int i = 1; i < buttonList.count(); i++) { buttonList[i]->setText(""); } for (int i = 0; i < SLOT_NUM; i++) { diff --git a/mainwindow.ui b/mainwindow.ui index c6e1788..3b4752e 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -724,7 +724,7 @@ - 电源板 + Qt::AlignCenter diff --git a/pressure_pulsation.ui b/pressure_pulsation.ui index 51210c9..4258b85 100644 --- a/pressure_pulsation.ui +++ b/pressure_pulsation.ui @@ -464,7 +464,7 @@ - 0 + 1 @@ -687,8 +687,7 @@ - 等级 - (um) + 等级 @@ -701,8 +700,7 @@ - 回差 -(um) + 回差 @@ -715,8 +713,7 @@ - 延时 -(um) + 延时 @@ -724,7 +721,7 @@ 280 40 - 31 + 41 16 @@ -737,7 +734,7 @@ 340 40 - 31 + 41 16 @@ -1165,6 +1162,9 @@ + + false + 50 @@ -1178,6 +1178,9 @@ + + false + 300 @@ -1188,6 +1191,9 @@ + + false + 150 @@ -1198,6 +1204,9 @@ + + false + 50 @@ -1211,6 +1220,9 @@ + + false + 300 @@ -1221,6 +1233,9 @@ + + false + 150 @@ -1231,6 +1246,9 @@ + + false + 50 @@ -1244,6 +1262,9 @@ + + false + 300 @@ -1254,6 +1275,9 @@ + + false + 150 @@ -1264,6 +1288,9 @@ + + false + 50 @@ -1277,6 +1304,9 @@ + + false + 300 @@ -1287,6 +1317,9 @@ + + false + 150 @@ -1297,6 +1330,9 @@ + + false + 50 @@ -1310,6 +1346,9 @@ + + false + 300 @@ -1320,6 +1359,9 @@ + + false + 150 @@ -1330,6 +1372,9 @@ + + false + 50 @@ -1343,6 +1388,9 @@ + + false + 300 @@ -1353,6 +1401,9 @@ + + false + 150 diff --git a/radial_vibration.ui b/radial_vibration.ui index 044bad9..267cb4e 100644 --- a/radial_vibration.ui +++ b/radial_vibration.ui @@ -23,7 +23,7 @@ - 2 + 1 @@ -300,7 +300,7 @@ - 0 + 1 @@ -563,27 +563,25 @@ 90 30 - 31 + 41 31 - 等级 - (um) + 等级 - 170 + 160 30 - 31 + 41 31 - 回差 -(um) + 回差 @@ -591,13 +589,12 @@ 230 30 - 31 + 41 31 - 延时 -(um) + 延时 @@ -605,7 +602,7 @@ 280 40 - 31 + 51 16 @@ -618,7 +615,7 @@ 340 40 - 31 + 41 16 @@ -897,7 +894,7 @@ - 0 + 1 @@ -908,8 +905,8 @@ 210 150 - 54 - 12 + 91 + 16 @@ -921,8 +918,8 @@ 210 50 - 54 - 12 + 71 + 16 @@ -934,8 +931,8 @@ 210 100 - 54 - 12 + 91 + 16 @@ -1160,27 +1157,25 @@ 90 30 - 31 + 41 31 - 等级 - (um) + 等级 - 170 + 160 30 - 31 + 41 31 - 回差 -(um) + 回差 @@ -1188,13 +1183,12 @@ 230 30 - 31 + 41 31 - 延时 -(um) + 延时 @@ -1202,7 +1196,7 @@ 280 40 - 31 + 51 16 @@ -1215,7 +1209,7 @@ 340 40 - 31 + 51 16 @@ -1486,7 +1480,7 @@ 21 10 - 105 + 141 17 diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index 2ec9c72..92e657a 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -474,3 +474,31 @@ void Seismic_monitor::DisableKeyphase4(){ ui->comboBox_keyphase_ch_4->setEnabled(false); ui->comboBox_keyphase_slot_4->setEnabled(false); } + +void Seismic_monitor::on_comboBox_sensitivity_unit_1_currentTextChanged(const QString &arg1) +{ + QString str = QString("信号灵敏度(mV/%1)").arg(arg1); + ui->label_signal_sensitivity_1->setText(str); +} + + +void Seismic_monitor::on_comboBox_sensitivity_unit_2_currentTextChanged(const QString &arg1) +{ + QString str = QString("信号灵敏度(mV/%1)").arg(arg1); + ui->label_signal_sensitivity_2->setText(str); +} + + +void Seismic_monitor::on_comboBox_sensitivity_unit_3_currentTextChanged(const QString &arg1) +{ + QString str = QString("信号灵敏度(mV/%1)").arg(arg1); + ui->label_signal_sensitivity_3->setText(str); +} + + +void Seismic_monitor::on_comboBox_sensitivity_unit_4_currentTextChanged(const QString &arg1) +{ + QString str = QString("信号灵敏度(mV/%1)").arg(arg1); + ui->label_signal_sensitivity_4->setText(str); +} + diff --git a/seismic_monitor.h b/seismic_monitor.h index b18441d..2953526 100644 --- a/seismic_monitor.h +++ b/seismic_monitor.h @@ -49,7 +49,15 @@ class Seismic_monitor : public QWidget { void on_comboBox_transducer_name_4_currentTextChanged(const QString &arg1); - private: + void on_comboBox_sensitivity_unit_1_currentTextChanged(const QString &arg1); + + void on_comboBox_sensitivity_unit_2_currentTextChanged(const QString &arg1); + + void on_comboBox_sensitivity_unit_3_currentTextChanged(const QString &arg1); + + void on_comboBox_sensitivity_unit_4_currentTextChanged(const QString &arg1); + +private: Ui::Seismic_monitor *ui; void UpdateData(std::shared_ptr vib_data); int card_type; diff --git a/seismic_monitor.ui b/seismic_monitor.ui index f45ef62..99a9bda 100644 --- a/seismic_monitor.ui +++ b/seismic_monitor.ui @@ -280,7 +280,7 @@ - 200 + 220 380 120 81 @@ -324,7 +324,7 @@ 10 50 - 311 + 341 321 @@ -366,32 +366,32 @@ - 轴振 + 轴振传感器 - 加速度 + 加速度传感器 - 速度 + 速度传感器 - 轴位移 + 轴位移传感器 - 压力脉动 + 压力脉动传感器 - DC + DC传感器 @@ -507,7 +507,7 @@ - + 90 @@ -804,32 +804,32 @@ - 轴振 + 轴振传感器 - 加速度 + 加速度传感器 - 速度 + 速度传感器 - 轴位移 + 轴位移传感器 - 压力脉动 + 压力脉动传感器 - DC + DC传感器 @@ -945,7 +945,7 @@ - + 90 @@ -1306,7 +1306,7 @@ - 140 + 150 390 52 75 @@ -1458,7 +1458,7 @@ 10 50 - 321 + 331 321 @@ -1500,32 +1500,32 @@ - 轴振 + 轴振传感器 - 加速度 + 加速度传感器 - 速度 + 速度传感器 - 轴位移 + 轴位移传感器 - 压力脉动 + 压力脉动传感器 - DC + DC传感器 @@ -1641,7 +1641,7 @@ - + 90 @@ -1938,32 +1938,32 @@ - 轴振 + 轴振传感器 - 加速度 + 加速度传感器 - 速度 + 速度传感器 - 轴位移 + 轴位移传感器 - 压力脉动 + 压力脉动传感器 - DC + DC传感器 @@ -2079,7 +2079,7 @@ - + 90 diff --git a/singlerelay.cpp b/singlerelay.cpp index f8fa3cc..33afeab 100644 --- a/singlerelay.cpp +++ b/singlerelay.cpp @@ -112,17 +112,29 @@ void SingleRelay::Init(){ qDebug() << "i" << i; std::shared_ptr ptr = std::dynamic_pointer_cast(cardbase_ptr); for (int var = 0; var < CHANNEL_COUNT; ++var) { + std::shared_ptr variable_base = ptr->GetChannelPtr(var + 1); QString item_data,item_str; - if(ptr->alert_danger[var].direct_enable || - ptr->alert_danger[var].x1_ampl_enable || - ptr->alert_danger[var].x2_ampl_enable){ - item_str = QString("%1 (槽位 %2 通道 %3 警报)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2)); + if(variable_base->alert_high.enable){ + item_str = QString("%1 (槽位 %2 通道 %3 警报高)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2)); + item_data = QString("%1A2").arg(ptr->base_config_[var].chan_id); + } + channelNameMap[item_data] = item_str; + if(variable_base->danger_high.enable){ + item_str = QString("%1 (槽位 %2 通道 %3 危险高)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2)); item_data = QString("%1A1").arg(ptr->base_config_[var].chan_id); } channelNameMap[item_data] = item_str; - if(ptr->alert_danger[var].danger_enable){ - item_str = QString("%1 (槽位 %2 通道 %3 危险)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2)); - item_data = QString("%1A2").arg(ptr->base_config_[var].chan_id); + if(variable_base->alert_low.enable){ + item_str = QString("%1 (槽位 %2 通道 %3 警报低)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2)); + item_data = QString("%1A3").arg(ptr->base_config_[var].chan_id); + } + channelNameMap[item_data] = item_str; + if(variable_base->danger_low.enable){ + item_str = QString("%1 (槽位 %2 通道 %3 危险低)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2)); + item_data = QString("%1A4").arg(ptr->base_config_[var].chan_id); + } + if(var == 3){ + qDebug() << "alert" << variable_base->danger_high.enable<danger_high.enable; } channelNameMap[item_data] = item_str; item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2)); @@ -162,24 +174,35 @@ void SingleRelay::OnButtonGroup(QAbstractButton *slot_btn) { for(int var = 0; var < CHANNEL_COUNT ; ++var){ std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id); + std::shared_ptr variable_base = ptr->GetChannelPtr(var + 1); if(base_ptr->card_type_ == kCardVibSingle){ QString item_data; - if(ptr->base_config_[var].standby && (var % 2)) - continue; - if(ptr->alert_danger[var].direct_enable || - ptr->alert_danger[var].x1_ampl_enable || - ptr->alert_danger[var].x2_ampl_enable){ - QString item_str = QString("%1 (槽位 %3 通道 %4 警报)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); + if(variable_base->alert_high.enable){ + QString item_str = QString("%1 (槽位 %3 通道 %4 警报高)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); + QListWidgetItem *item = new QListWidgetItem(item_str); + item_data = QString("S%1C%2A2").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); + item->setData(Qt::UserRole, item_data); + list_widget_available->addItem(item); + } + + if(variable_base->danger_high.enable){ + QString item_str = QString("%1 (槽位 %3 通道 %4 危险高)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); QListWidgetItem *item = new QListWidgetItem(item_str); item_data = QString("S%1C%2A1").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); item->setData(Qt::UserRole, item_data); list_widget_available->addItem(item); } - - if(ptr->alert_danger[var].danger_enable){ - QString item_str = QString("%1 (槽位 %3 通道 %4 危险)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); + if(variable_base->danger_low.enable){ + QString item_str = QString("%1 (槽位 %3 通道 %4 危险低)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); QListWidgetItem *item = new QListWidgetItem(item_str); - item_data = QString("S%1C%2A2").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); + item_data = QString("S%1C%2A4").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); + item->setData(Qt::UserRole, item_data); + list_widget_available->addItem(item); + } + if(variable_base->alert_low.enable){ + QString item_str = QString("%1 (槽位 %3 通道 %4 警报低)").arg(ptr->base_config_[var].point_name).arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); + QListWidgetItem *item = new QListWidgetItem(item_str); + item_data = QString("S%1C%2A3").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); item->setData(Qt::UserRole, item_data); list_widget_available->addItem(item); } @@ -425,6 +448,7 @@ ExprValidationResult SingleRelay::validateLogicExpression(const QString& expr) { void SingleRelay::setExpressionToTreeView(QTreeView* treeView, const QString& expr) { int pos = 0; model_Relay->clear(); + qDebug() << "expr" << expr; ExprNode* root = parseExpression(expr, pos); QStandardItem* rootItem = buildItemTree(root); diff --git a/trust.ui b/trust.ui index 9537ee9..7e61487 100644 --- a/trust.ui +++ b/trust.ui @@ -298,8 +298,8 @@ 230 50 - 54 - 12 + 81 + 16 @@ -311,8 +311,8 @@ 230 100 - 54 - 12 + 81 + 16 @@ -481,8 +481,8 @@ 230 150 - 54 - 12 + 81 + 16 @@ -613,8 +613,7 @@ - 等级 - (um) + 等级 @@ -627,8 +626,7 @@ - 回差 -(um) + 回差 @@ -641,8 +639,7 @@ - 延时 -(um) + 延时 @@ -650,7 +647,7 @@ 280 40 - 31 + 51 16 @@ -663,7 +660,7 @@ 340 40 - 31 + 51 16 @@ -904,7 +901,7 @@ 21 10 - 105 + 131 17 diff --git a/velocity.ui b/velocity.ui index 2f56640..cdc5634 100644 --- a/velocity.ui +++ b/velocity.ui @@ -300,7 +300,7 @@ - 0 + 1 @@ -311,8 +311,8 @@ 220 150 - 54 - 12 + 61 + 16 @@ -381,8 +381,8 @@ 220 50 - 54 - 12 + 71 + 16 @@ -461,8 +461,8 @@ 220 100 - 54 - 12 + 71 + 16 @@ -563,27 +563,25 @@ 90 30 - 31 + 41 31 - 等级 - (um) + 等级 - 170 + 160 30 - 31 + 41 31 - 回差 -(um) + 回差 @@ -591,13 +589,12 @@ 230 30 - 31 + 51 31 - 延时 -(um) + 延时 @@ -605,7 +602,7 @@ 280 40 - 31 + 41 16 @@ -618,7 +615,7 @@ 340 40 - 31 + 41 16 From f83cbfc7531c74a93fec49389cfb4421d9724725 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Fri, 8 Aug 2025 21:59:34 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- acceleration.ui | 4 ++-- connect.cpp | 1 + data_config.h | 18 ++++++++++++++++++ mainwindow.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ mainwindow.h | 2 ++ mainwindow.ui | 12 ++++++++++++ singlerelay.ui | 13 ------------- tmrrelayassociation.ui | 13 ------------- 8 files changed, 75 insertions(+), 28 deletions(-) diff --git a/acceleration.ui b/acceleration.ui index 546cd48..b2e24e1 100644 --- a/acceleration.ui +++ b/acceleration.ui @@ -107,7 +107,7 @@ - 1 + 0 @@ -403,7 +403,7 @@ - 1 + 0 diff --git a/connect.cpp b/connect.cpp index 147c518..ef9c702 100644 --- a/connect.cpp +++ b/connect.cpp @@ -14,6 +14,7 @@ Connect::Connect(QWidget *parent) : QRegularExpression ipRegex(R"(^(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$)"); QRegularExpressionValidator *ipValidator = new QRegularExpressionValidator(ipRegex, this); ui->lineEdit_IP->setValidator(ipValidator); + ui->lineEdit_IP->setText(g_strServerIp); } Connect::~Connect() diff --git a/data_config.h b/data_config.h index ca3617c..2aa5d38 100644 --- a/data_config.h +++ b/data_config.h @@ -216,6 +216,7 @@ enum CMTCommand { kCleanSubCardCfg = 29, // 清理子板配置 kCleanSubCardLatch = 30, // 清理子板特定通道的Latch状态 kConfigMQTTBrokerInfo = 31, // 配置与获取MQTT broker信息 + kConfigDeviceID = 32, // 配置设备编号,编号范围为1~99 }; enum RS485Baudrate { kBaudrate2400 = 0, @@ -785,6 +786,23 @@ typedef struct { uint8_t sid; // 通道编号,1-4 } CleanLatchStatusReq; +typedef struct { + uint8_t head[3]; // 固定值:0xAA55AA + uint8_t cmd; // kConfigDeviceID + uint8_t version; // 版本号,默认为1 + uint8_t sub_cmd; // 0: get, 1: set + uint8_t device_id; // 设备编号 0~99 +} DeviceIDConfigReq; + +typedef struct { + uint8_t head[3]; // 固定值:0xAA55AA + uint8_t cmd; // kConfigDeviceID + uint8_t version; // 版本号,默认为1 + uint8_t code; // success:0, failure: others + uint8_t sub_cmd; // 0: get, 1: set + uint8_t device_id; // 设备编号 +} DeviceIDConfigRsp; + struct BaseHeader { uint8_t head[3]; // 固定 0xAA 0x55 0xAA uint8_t cmd; diff --git a/mainwindow.cpp b/mainwindow.cpp index 0f7d0f6..3fa4c17 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -28,6 +28,7 @@ #include #include "dc_outputs.h" #include "mqtt_config.h" +#include QString g_strServerIp; QString g_version; @@ -100,6 +101,8 @@ MainWindow::MainWindow(QWidget *parent) QObject::connect(ui->action_mac, &QAction::triggered, this, &MainWindow::onMACConfig); QObject::connect(ui->action_time, &QAction::triggered, this, &MainWindow::onSetTime); QObject::connect(ui->action_mqtt, &QAction::triggered, this, &MainWindow::onMqttConfig); + QObject::connect(ui->action_deviveID, &QAction::triggered, this, &MainWindow::onConfigDeviceID); + QObject::connect(ui->action_get_deviceID, &QAction::triggered, this, &MainWindow::onGetDeviceID); QSettings settingsread(QCoreApplication::applicationDirPath() + "\\config\\config.ini", QSettings::IniFormat); g_strServerIp = settingsread.value("Server/IP").toString(); @@ -880,6 +883,18 @@ void MainWindow::readData(const QByteArray &data) { map_slot_config[config_sub_card_progress.subcard_id].slot_label->setStyleSheet("QLabel { color :#FF0000; font: bold 16px}"); statusBar()->showMessage(status, 2000); } + }else if(cmd == kConfigDeviceID){ + DeviceIDConfigRsp device_config_rsp; + memcpy(&device_config_rsp, data.data(), sizeof(DeviceIDConfigRsp)); + if(device_config_rsp.code == 0){ + statusBar()->showMessage("配置成功!", 2000); + }else if(device_config_rsp.code == 1){ + statusBar()->showMessage("配置失败!", 2000); + } + if(device_config_rsp.sub_cmd == 0){ + QString str = QString("设备ID: %1").arg(device_config_rsp.device_id); + QMessageBox::information(this, QStringLiteral("提示"), str); + } } } @@ -916,6 +931,31 @@ void MainWindow::onMqttConfig(){ mqtt_config->setWindowModality(Qt::ApplicationModal); mqtt_config->show(); } +void MainWindow::onGetDeviceID(){ + DeviceIDConfigReq config_device_id = { {0xAA, 0x55, 0xAA}, kConfigDeviceID, 1,0,{}}; + int length = sizeof(DeviceIDConfigReq); + qint64 bytesWritten = m_tcpClient->sendData((char*)&config_device_id, length); + m_tcpClient->waitForRead(); + qDebug() << "bytesWritten: " << bytesWritten; +} +void MainWindow::onConfigDeviceID(){ + QString strTips =QString("请输入0到100之间的数值"); + + bool ok = false; + int value = QInputDialog::getInt(this, tr("输入整数对话框"), strTips, 1, 1, 10, 1, &ok); + if(!ok) return; + + if(value < 1){ + QMessageBox::information(this, QStringLiteral("提示"), QStringLiteral("请输入正确的数字!")); + return ; + } + DeviceIDConfigReq config_device_id = { {0xAA, 0x55, 0xAA}, kConfigDeviceID, 1,1,{}}; + config_device_id.device_id = value; + int length = sizeof(DeviceIDConfigReq); + qint64 bytesWritten = m_tcpClient->sendData((char*)&config_device_id, length); + m_tcpClient->waitForRead(); + qDebug() << "bytesWritten: " << bytesWritten; +} void MainWindow::onSetTime(){ SetTimingReq set_time_req = { {0xAA, 0x55, 0xAA}, kTimingCmd, 1,0 }; int length = sizeof(SetTimingReq); diff --git a/mainwindow.h b/mainwindow.h index 4dbd335..bb8c80e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -77,6 +77,8 @@ private slots: void onMACConfig(); void onSetTime(); void onMqttConfig(); + void onConfigDeviceID(); + void onGetDeviceID(); void onMenuActionTriggered(); void on_pushButton_slot_clicked(); diff --git a/mainwindow.ui b/mainwindow.ui index 3b4752e..8f2ed9a 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -1088,6 +1088,8 @@ + + @@ -1144,6 +1146,16 @@ MQTT配置 + + + 设备ID配置 + + + + + 获取设备ID + + diff --git a/singlerelay.ui b/singlerelay.ui index aa8fe67..e670241 100644 --- a/singlerelay.ui +++ b/singlerelay.ui @@ -39,19 +39,6 @@ 确 定 - - - - 750 - 535 - 71 - 20 - - - - NCS6100T - - diff --git a/tmrrelayassociation.ui b/tmrrelayassociation.ui index 7f3e769..7679492 100644 --- a/tmrrelayassociation.ui +++ b/tmrrelayassociation.ui @@ -261,19 +261,6 @@ 取 消 - - - - 740 - 600 - 71 - 20 - - - - NCS6100T - - From 4f299f2fdd54291c0289da9e33db77ffb719d594 Mon Sep 17 00:00:00 2001 From: zhangsheng Date: Sat, 9 Aug 2025 15:44:30 +0800 Subject: [PATCH 14/14] modify code --- mainwindow.cpp | 4 ++-- pressure_pulsation.ui | 2 +- radial_vibration.ui | 41 +++-------------------------------------- seismic_monitor.ui | 4 ++-- trust.ui | 35 ----------------------------------- velocity.ui | 7 +------ 6 files changed, 9 insertions(+), 84 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 3fa4c17..c61d847 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -939,10 +939,10 @@ void MainWindow::onGetDeviceID(){ qDebug() << "bytesWritten: " << bytesWritten; } void MainWindow::onConfigDeviceID(){ - QString strTips =QString("请输入0到100之间的数值"); + QString strTips =QString("请输入0到99之间的数值"); bool ok = false; - int value = QInputDialog::getInt(this, tr("输入整数对话框"), strTips, 1, 1, 10, 1, &ok); + int value = QInputDialog::getInt(this, tr("输入整数对话框"), strTips, 0, 0, 99, 1, &ok); if(!ok) return; if(value < 1){ diff --git a/pressure_pulsation.ui b/pressure_pulsation.ui index 4258b85..3dcbea9 100644 --- a/pressure_pulsation.ui +++ b/pressure_pulsation.ui @@ -464,7 +464,7 @@ - 1 + 0 diff --git a/radial_vibration.ui b/radial_vibration.ui index 267cb4e..54d8bc4 100644 --- a/radial_vibration.ui +++ b/radial_vibration.ui @@ -23,7 +23,7 @@ - 1 + 2 @@ -300,7 +300,7 @@ - 1 + 0 @@ -438,11 +438,6 @@ inch/s**2 - - - - - @@ -894,7 +889,7 @@ - 1 + 0 @@ -1059,41 +1054,11 @@ 25 - - - True Peak - - - - - True Peak-To-Peak - - - - - RMS Scaled Peak - - - - - RMS Scaled Peak-To-Peak - - AVG - - - RMS Scaled AVG - - - - - RMS - - diff --git a/seismic_monitor.ui b/seismic_monitor.ui index 99a9bda..5ed3f4c 100644 --- a/seismic_monitor.ui +++ b/seismic_monitor.ui @@ -7,7 +7,7 @@ 0 0 862 - 632 + 601 @@ -178,7 +178,7 @@ - 420 + 430 203 52 75 diff --git a/trust.ui b/trust.ui index 7e61487..0cbdcb1 100644 --- a/trust.ui +++ b/trust.ui @@ -470,11 +470,6 @@ inch/s**2 - - - - - @@ -510,41 +505,11 @@ 25 - - - True Peak - - - - - True Peak-To-Peak - - - - - RMS Scaled Peak - - - - - RMS Scaled Peak-To-Peak - - AVG - - - RMS Scaled AVG - - - - - RMS - - diff --git a/velocity.ui b/velocity.ui index cdc5634..f0e8a3b 100644 --- a/velocity.ui +++ b/velocity.ui @@ -300,7 +300,7 @@ - 1 + 0 @@ -450,11 +450,6 @@ inch/s**2 - - - - -