diff --git a/channel_1_2.cpp b/channel_1_2.cpp index 98ac18a..4b4e6c0 100644 --- a/channel_1_2.cpp +++ b/channel_1_2.cpp @@ -5,17 +5,24 @@ #include "config_mgr.h" #include -Channel_1_2::Channel_1_2(int slot_no_, int channel_,QWidget *parent) +Channel_1_2::Channel_1_2(int slot_no_, int channel_,int function_index_,QWidget *parent) : QWidget(parent) , ui(new Ui::Channel_1_2) { ui->setupUi(this); slot_no = slot_no_; channel = channel_; - QString chan = QString("%1").arg(channel); + function_index = function_index_; + QString chan = QString("%1").arg("1 & 2"); QString slot = QString("%1").arg(slot_no); ui->label_channel->setText(chan); ui->label_slot->setText(slot); + if(function_index == 5){ + ui->comboBox_rectifier_funtion->clear(); + QStringList list_funtion; + list_funtion << "RSM Sum" << "RMS Subtraction" << "SUM" << "SUBTRACTION" << "X & Y MIN" << "X & Y MAX"; + ui->comboBox_rectifier_funtion->addItems(list_funtion); + } Init(); } diff --git a/channel_1_2.h b/channel_1_2.h index 60c65a4..b942996 100644 --- a/channel_1_2.h +++ b/channel_1_2.h @@ -12,10 +12,11 @@ class Channel_1_2 : public QWidget Q_OBJECT public: - explicit Channel_1_2(int slot_no_, int channel_,QWidget *parent = nullptr); + explicit Channel_1_2(int slot_no_, int channel_,int function_index_,QWidget *parent = nullptr); ~Channel_1_2(); int slot_no; int channel; + int function_index; private slots: void on_pushButton_confirm_clicked(); diff --git a/channel_3_4.cpp b/channel_3_4.cpp index 5b85b78..d256fc3 100644 --- a/channel_3_4.cpp +++ b/channel_3_4.cpp @@ -4,17 +4,24 @@ #include "vibrationdata.h" #include "config_mgr.h" #include -Channel_3_4::Channel_3_4(int slot_no_, int channel_,QWidget *parent) +Channel_3_4::Channel_3_4(int slot_no_, int channel_,int function_index_,QWidget *parent) : QWidget(parent) , ui(new Ui::Channel_3_4) { ui->setupUi(this); slot_no = slot_no_; channel = channel_; - QString chan = QString("%1").arg(channel); + function_index = function_index_; + QString chan = QString("%1").arg("3 & 4"); QString slot = QString("%1").arg(slot_no); ui->label_channel->setText(chan); ui->label_slot->setText(slot); + if(function_index == 5){ + ui->comboBox_rectifier_funtion->clear(); + QStringList list_funtion; + list_funtion << "RSM Sum" << "RMS Subtraction" << "SUM" << "SUBTRACTION" << "X & Y MIN" << "X & Y MAX"; + ui->comboBox_rectifier_funtion->addItems(list_funtion); + } Init(); } diff --git a/channel_3_4.h b/channel_3_4.h index 838c613..a9c8c87 100644 --- a/channel_3_4.h +++ b/channel_3_4.h @@ -12,10 +12,11 @@ class Channel_3_4 : public QWidget Q_OBJECT public: - explicit Channel_3_4(int slot_no_, int channel_,QWidget *parent = nullptr); + explicit Channel_3_4(int slot_no_, int channel_,int function_index,QWidget *parent = nullptr); ~Channel_3_4(); int slot_no; int channel; + int function_index; private slots: void on_pushButton_confirm_clicked(); diff --git a/data_config.h b/data_config.h index 5c296fc..fab119e 100644 --- a/data_config.h +++ b/data_config.h @@ -136,6 +136,15 @@ typedef enum{ kRMS = 6 } RectifierFuntion; +typedef enum{ + kRMSSum = 0, + kRMSSubtraction = 1, + kSUM = 2, + kSUBTRACTION = 3, + kXYMin = 4, + kXYMax = 5 +} RectifierFuntionDMF; + typedef enum{ kUnit1 = 0, // g kUnit2 = 1, // m/s**2 @@ -267,6 +276,9 @@ typedef struct SeismicMonitor_{ int keyphase_ch; int sensitivity_unit; float signal_sensitivity; + int function; + float fisrt_channel_angle; + float second_channel_angle; SeismicMonitor_(){ standby = false; active = false; diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index c2e3f4c..b8d11a0 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -33,6 +33,16 @@ Seismic_monitor::Seismic_monitor(int slot,CardType cardtype, QWidget *parent) : card_type = cardtype; QString slot_no_ = QString("%1").arg(slot_no); ui->label_slot_no->setText(slot_no_); + current_config_1_2 = -1; + current_config_3_4 = -1; + ui->lineEdit_first_1->setVisible(false); + ui->lineEdit_first_2->setVisible(false); + ui->lineEdit_second_1->setVisible(false); + ui->lineEdit_second_2->setVisible(false); + ui->label_text_1->setVisible(false); + ui->label_text_2->setVisible(false); + ui->label_text_3->setVisible(false); + ui->label_text_4->setVisible(false); Init(); } @@ -124,6 +134,18 @@ void Seismic_monitor::Init() { 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); + }else if (i + 1 == 5) { + vib_data->base_config_[var].function = ui->comboBox_function_1->currentIndex(); + if(ui->comboBox_function_1->currentIndex() == 3){ + vib_data->base_config_[i].fisrt_channel_angle = ui->lineEdit_first_1->text().toFloat(); + vib_data->base_config_[i].second_channel_angle = ui->lineEdit_second_1->text().toFloat(); + } + }else if (i + 1 == 6) { + vib_data->base_config_[i].function = ui->comboBox_function_2->currentIndex(); + if(ui->comboBox_function_2->currentIndex() == 3){ + vib_data->base_config_[i].fisrt_channel_angle = ui->lineEdit_first_2->text().toFloat(); + vib_data->base_config_[i].second_channel_angle = ui->lineEdit_second_2->text().toFloat(); + } } } ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number); @@ -202,6 +224,18 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { 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(); vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch_4->currentText().toInt(); + }else if (var + 1 == 5) { + vib_data->base_config_[var].function = ui->comboBox_function_1->currentIndex(); + if(ui->comboBox_function_1->currentIndex() == 3){ + vib_data->base_config_[var].fisrt_channel_angle = ui->lineEdit_first_1->text().toFloat(); + vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_1->text().toFloat(); + } + }else if (var + 1 == 6) { + vib_data->base_config_[var].function = ui->comboBox_function_2->currentIndex(); + if(ui->comboBox_function_2->currentIndex() == 3){ + vib_data->base_config_[var].fisrt_channel_angle = ui->lineEdit_first_2->text().toFloat(); + vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_2->text().toFloat(); + } } } } @@ -231,6 +265,22 @@ void Seismic_monitor::on_pushButton_confirm_clicked() { QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!"); return; } + if(ui->lineEdit_first_1->text().toFloat() < -360 || ui->lineEdit_first_1->text().toFloat() > 360){ + QMessageBox::information(this, QStringLiteral("提示"), "第一通道角度必须在-360 ~ 360 之间"); + return; + } + if(ui->lineEdit_second_1->text().toFloat() < -360 || ui->lineEdit_second_1->text().toFloat() > 360){ + QMessageBox::information(this, QStringLiteral("提示"), "第二通道角度必须在-360 ~ 360 之间"); + return; + } + if(ui->lineEdit_first_2->text().toFloat() < -360 || ui->lineEdit_first_2->text().toFloat() > 360){ + QMessageBox::information(this, QStringLiteral("提示"), "第一通道角度必须在-360 ~ 360 之间"); + return; + } + if(ui->lineEdit_second_2->text().toFloat() < -360 || ui->lineEdit_second_2->text().toFloat() > 360){ + QMessageBox::information(this, QStringLiteral("提示"), "第二通道角度必须在-360 ~ 360 之间"); + return; + } if(ui->lineEdit_signal_sensitivity_1->text() == "0" || ui->lineEdit_signal_sensitivity_2->text() == "0" || ui->lineEdit_signal_sensitivity_3->text() == "0" || @@ -532,7 +582,7 @@ void Seismic_monitor::on_comboBox_sensitivity_unit_4_currentTextChanged(const QS void Seismic_monitor::on_pushButton_config_1_2_clicked() { - Channel_1_2 *ch1_2 = new Channel_1_2(slot_no, 5); + Channel_1_2 *ch1_2 = new Channel_1_2(slot_no, 5,current_config_1_2); ch1_2->setWindowModality(Qt::ApplicationModal); ch1_2->show(); } @@ -540,7 +590,7 @@ void Seismic_monitor::on_pushButton_config_1_2_clicked() void Seismic_monitor::on_pushButton_config_3_4_clicked() { - Channel_3_4 *ch3_4 = new Channel_3_4(slot_no, 6); + Channel_3_4 *ch3_4 = new Channel_3_4(slot_no, 6,current_config_3_4); ch3_4->setWindowModality(Qt::ApplicationModal); ch3_4->show(); } @@ -556,3 +606,55 @@ void Seismic_monitor::on_pushButton_copy_channel_clicked() copy_channel->show(); } +void Seismic_monitor::on_comboBox_function_2_currentIndexChanged(int index) +{ + if(index == 1 && (ui->comboBox_chan_type_3->currentIndex() != 0 || ui->comboBox_chan_type_4->currentIndex() != 0)){ + QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 必须为径向位移!"); + ui->comboBox_function_2->setCurrentIndex(0); + return; + } + if(index == 2){ + ui->pushButton_config_3_4->setEnabled(false); + }else{ + ui->pushButton_config_3_4->setEnabled(true); + } + if(index == 3){ + ui->lineEdit_first_2->setVisible(true); + ui->lineEdit_second_2->setVisible(true); + ui->label_text_3->setVisible(true); + ui->label_text_4->setVisible(true); + }else{ + ui->lineEdit_first_2->setVisible(false); + ui->lineEdit_second_2->setVisible(false); + ui->label_text_3->setVisible(false); + ui->label_text_4->setVisible(false); + } + current_config_3_4 = index; +} + +void Seismic_monitor::on_comboBox_function_1_currentIndexChanged(int index) +{ + if(index == 1 && (ui->comboBox_chan_type_1->currentIndex() != 0 || ui->comboBox_chan_type_2->currentIndex() != 0)){ + QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 必须为径向位移!"); + ui->comboBox_function_1->setCurrentIndex(0); + return; + } + if(index == 2){ + ui->pushButton_config_1_2->setEnabled(false); + }else{ + ui->pushButton_config_1_2->setEnabled(true); + } + if(index == 3){ + ui->lineEdit_first_1->setVisible(true); + ui->lineEdit_second_1->setVisible(true); + ui->label_text_1->setVisible(true); + ui->label_text_2->setVisible(true); + }else{ + ui->lineEdit_first_1->setVisible(false); + ui->lineEdit_second_1->setVisible(false); + ui->label_text_1->setVisible(false); + ui->label_text_2->setVisible(false); + } + current_config_1_2 = index; +} + diff --git a/seismic_monitor.h b/seismic_monitor.h index 47de648..5e1c2d2 100644 --- a/seismic_monitor.h +++ b/seismic_monitor.h @@ -57,12 +57,18 @@ class Seismic_monitor : public QWidget { void copy_end_slot(); + void on_comboBox_function_2_currentIndexChanged(int index); + + void on_comboBox_function_1_currentIndexChanged(int index); + private: Ui::Seismic_monitor *ui; void UpdateData(std::shared_ptr vib_data); // int card_type; // void readJsonFile(const QString &filePath); // SeismicMonitor seismic_monitor[CHANNLE_COUNT]; + int current_config_1_2; + int current_config_3_4; QVector vec_transducer; void Init(); void EnableKeyphase(); diff --git a/seismic_monitor.ui b/seismic_monitor.ui index e49715a..bc423bb 100644 --- a/seismic_monitor.ui +++ b/seismic_monitor.ui @@ -6,8 +6,8 @@ 0 0 - 928 - 623 + 938 + 653 @@ -265,7 +265,7 @@ - 0 + 2 @@ -1153,18 +1153,31 @@ 通道1-通道2 - + - 20 - 50 - 238 - 27 + 110 + 220 + 93 + 28 + + + + 配置 + + + + + + 21 + 51 + 239 + 23 - + 200 @@ -1218,18 +1231,75 @@ - + 20 - 110 - 93 - 28 + 130 + 329 + 23 - - 配置 + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + 第一通道安装角度 + + + + + + + + + 20 + 170 + 329 + 23 + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + 第二通道安装角度 + + + + @@ -1465,7 +1535,7 @@ - 0 + 2 @@ -2358,13 +2428,13 @@ 20 50 - 238 + 239 27 - + 200 @@ -2421,8 +2491,8 @@ - 20 - 100 + 100 + 220 93 28 @@ -2431,6 +2501,76 @@ 配置 + + + + 20 + 170 + 329 + 23 + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + 第二通道安装角度 + + + + + + + + + 20 + 130 + 329 + 23 + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + 第一通道安装角度 + + + + +