TSI_Config/seismic_monitor.cpp

918 lines
42 KiB
C++
Raw Normal View History

2025-03-09 11:53:05 +08:00
#include "seismic_monitor.h"
#include "ui_seismic_monitor.h"
#include <QDebug>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QFile>
2025-03-11 16:42:00 +08:00
#include <QListView>
2025-03-09 11:53:05 +08:00
#include "acceleration.h"
#include "velocity.h"
#include "radial_vibration.h"
2025-04-01 15:03:59 +08:00
#include "data_config.h"
#include "config_mgr.h"
#include "vibrationdata.h"
#include "trust.h"
2025-07-09 20:24:50 +08:00
#include <QMessageBox>
#include "pressure_pulsation.h"
#include "channel_1_2.h"
#include "channel_3_4.h"
2025-09-18 11:46:35 +08:00
#include "copy_channel.h"
2025-03-09 11:53:05 +08:00
Seismic_monitor::Seismic_monitor(int slot,CardType cardtype, QWidget *parent) :
2025-03-09 11:53:05 +08:00
QWidget(parent),
2025-03-29 09:53:29 +08:00
ui(new Ui::Seismic_monitor) {
2025-03-09 11:53:05 +08:00
ui->setupUi(this);
2025-03-11 16:42:00 +08:00
ui->widget_body->setProperty("flag", "body");
ui->comboBox_chan_type_1->setView(new QListView());
ui->comboBox_chan_type_2->setView(new QListView());
ui->comboBox_chan_type_3->setView(new QListView());
ui->comboBox_chan_type_4->setView(new QListView());
2025-07-28 20:55:48 +08:00
2025-03-09 11:53:05 +08:00
slot_no = slot;
2025-11-26 21:29:20 +08:00
card_type = cardtype;
2025-03-09 11:53:05 +08:00
QString slot_no_ = QString("%1").arg(slot_no);
ui->label_slot_no->setText(slot_no_);
2025-12-14 21:47:04 +08:00
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);
2026-01-06 17:56:23 +08:00
ui->comboBox_dual_math_function->setVisible(false);
ui->comboBox_dual_math_function_2->setVisible(false);
2025-12-14 21:47:04 +08:00
ui->label_text_1->setVisible(false);
ui->label_text_2->setVisible(false);
ui->label_text_3->setVisible(false);
ui->label_text_4->setVisible(false);
2026-01-06 17:56:23 +08:00
ui->label_text_5->setVisible(false);
ui->label_text_6->setVisible(false);
2026-01-08 19:11:20 +08:00
ui->comboBox_function_1->setCurrentIndex(0);
ui->comboBox_function_2->setCurrentIndex(0);
ui->comboBox_dual_math_function->setCurrentIndex(6);
ui->comboBox_dual_math_function_2->setCurrentIndex(6);
2025-03-09 11:53:05 +08:00
Init();
}
2025-03-29 09:53:29 +08:00
Seismic_monitor::~Seismic_monitor() {
2025-03-09 11:53:05 +08:00
delete ui;
}
2025-04-01 15:03:59 +08:00
void Seismic_monitor::Init() {
2025-09-27 21:34:27 +08:00
2025-04-01 15:03:59 +08:00
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
if (base_ptr == nullptr) {
qDebug() << "base_ptr";
2025-04-01 15:03:59 +08:00
// do nothing or use template to init it.
std::shared_ptr<VibrationData> vib_data = std::make_shared<VibrationData>();
vib_data->slot_ = slot_no;
2025-11-26 21:29:20 +08:00
vib_data->card_type_ = card_type;
qDebug() << "card type" << vib_data->card_type_;
2025-04-01 15:03:59 +08:00
ConfigMgr::Instance()->AddCard(vib_data);
UpdateData(vib_data);
return;
}
2025-07-09 20:24:50 +08:00
2025-04-01 15:03:59 +08:00
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
for (int i = 0; i < CHANNEL_COUNT; i++) {
if (i + 1 == 1) {
qDebug() << vib_data->base_config_[i].channel_type ;
ui->comboBox_chan_type_1->setCurrentIndex(vib_data->base_config_[i].channel_type);
2025-04-21 20:30:12 +08:00
ui->checkBox_standby_1->setChecked(vib_data->base_config_[i].standby);
2025-12-24 19:47:35 +08:00
ui->comboBox_sensitivity_unit_1->setCurrentText(GetUnit(vib_data->base_config_[i].sensitivity_unit));
2025-07-29 10:05:11 +08:00
ui->lineEdit_signal_sensitivity_1->setText(QString::number(vib_data->base_config_[i].signal_sensitivity));
2025-11-27 20:34:26 +08:00
if(vib_data->base_config_[i].power)
ui->comboBox_power_supply_1->setCurrentIndex(0);
else
ui->comboBox_power_supply_1->setCurrentIndex(1);
ui->checkBox_enable_1->setChecked(vib_data->base_config_[i].active);
2025-04-01 15:03:59 +08:00
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);
2025-07-28 20:55:48 +08:00
2025-08-05 20:49:25 +08:00
ui->checkBox_keyphase->setChecked(vib_data->base_config_[i].keyphase);
2025-08-06 22:11:14 +08:00
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));
2025-08-05 20:49:25 +08:00
2025-04-01 15:03:59 +08:00
} else if (i + 1 == 2) {
ui->comboBox_chan_type_2->setCurrentIndex(vib_data->base_config_[i].channel_type);
2025-12-24 19:47:35 +08:00
ui->comboBox_sensitivity_unit_2->setCurrentText(GetUnit(vib_data->base_config_[i].sensitivity_unit));
2025-07-29 10:05:11 +08:00
ui->lineEdit_signal_sensitivity_2->setText(QString::number(vib_data->base_config_[i].signal_sensitivity));
2025-07-28 20:55:48 +08:00
ui->checkBox_enable_2->setChecked(vib_data->base_config_[i].active);
2025-04-01 15:03:59 +08:00
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);
2025-11-27 20:34:26 +08:00
if(vib_data->base_config_[i].power)
ui->comboBox_power_supply_2->setCurrentIndex(0);
else
ui->comboBox_power_supply_2->setCurrentIndex(1);
2025-08-05 20:49:25 +08:00
ui->checkBox_keyphase_2->setChecked(vib_data->base_config_[i].keyphase);
2025-08-06 22:11:14 +08:00
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));
2025-08-05 20:49:25 +08:00
2025-04-01 15:03:59 +08:00
} else if (i + 1 == 3) {
2025-04-21 20:30:12 +08:00
ui->checkBox_standby_2->setChecked(vib_data->base_config_[i].standby);
2025-04-01 15:03:59 +08:00
ui->comboBox_chan_type_3->setCurrentIndex(vib_data->base_config_[i].channel_type);
2025-12-24 19:47:35 +08:00
ui->comboBox_sensitivity_unit_3->setCurrentText(GetUnit(vib_data->base_config_[i].sensitivity_unit));
2025-07-29 10:05:11 +08:00
ui->lineEdit_signal_sensitivity_3->setText(QString::number(vib_data->base_config_[i].signal_sensitivity));
2025-11-27 20:34:26 +08:00
if(vib_data->base_config_[i].power)
ui->comboBox_power_supply_3->setCurrentIndex(0);
else
ui->comboBox_power_supply_3->setCurrentIndex(1);
2025-08-05 20:49:25 +08:00
ui->checkBox_keyphase_3->setChecked(vib_data->base_config_[i].keyphase);
2025-08-06 22:11:14 +08:00
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));
2025-08-05 20:49:25 +08:00
ui->checkBox_enable_3->setChecked(vib_data->base_config_[i].active);
2025-04-01 15:03:59 +08:00
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);
2025-07-28 20:55:48 +08:00
2025-04-01 15:03:59 +08:00
} else if (i + 1 == 4) {
ui->comboBox_chan_type_4->setCurrentIndex(vib_data->base_config_[i].channel_type);
2025-12-24 19:47:35 +08:00
ui->comboBox_sensitivity_unit_4->setCurrentText(GetUnit(vib_data->base_config_[i].sensitivity_unit));
2025-07-29 10:05:11 +08:00
ui->lineEdit_signal_sensitivity_4->setText(QString::number(vib_data->base_config_[i].signal_sensitivity));
2025-07-28 20:55:48 +08:00
2025-08-05 20:49:25 +08:00
ui->checkBox_keyphase_4->setChecked(vib_data->base_config_[i].keyphase);
2025-08-06 22:11:14 +08:00
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));
2025-11-27 20:34:26 +08:00
if(vib_data->base_config_[i].power)
ui->comboBox_power_supply_4->setCurrentIndex(0);
else
ui->comboBox_power_supply_4->setCurrentIndex(1);
ui->checkBox_enable_4->setChecked(vib_data->base_config_[i].active);
2025-04-01 15:03:59 +08:00
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);
2025-07-28 20:55:48 +08:00
2025-12-14 21:47:04 +08:00
}else if (i + 1 == 5) {
2026-01-06 17:56:23 +08:00
ui->comboBox_function_1->setCurrentIndex(vib_data->base_config_[i].function);
if(vib_data->base_config_[i].function == kRST){
ui->lineEdit_first_1->setVisible(true);
ui->lineEdit_second_1->setVisible(true);
ui->label_text_1->setVisible(true);
ui->label_text_2->setVisible(true);
ui->comboBox_dual_math_function->setVisible(false);
ui->label_text_5->setVisible(false);
2026-01-08 10:48:25 +08:00
ui->lineEdit_first_1->setText(QString::number(vib_data->base_config_[i].first_channel_angle));
2026-01-06 17:56:23 +08:00
ui->lineEdit_second_1->setText(QString::number(vib_data->base_config_[i].second_channel_angle));
}else if(vib_data->base_config_[i].function == kDMF){
2026-01-08 10:48:25 +08:00
ui->lineEdit_first_1->setVisible(false);
ui->lineEdit_second_1->setVisible(false);
ui->label_text_1->setVisible(false);
ui->label_text_2->setVisible(false);
2026-01-06 17:56:23 +08:00
ui->comboBox_dual_math_function->setVisible(true);
ui->label_text_5->setVisible(true);
2026-01-08 10:48:25 +08:00
ui->comboBox_dual_math_function->setCurrentIndex(vib_data->base_config_[i].dmf_function);
2025-12-14 21:47:04 +08:00
}
}else if (i + 1 == 6) {
2026-01-06 17:56:23 +08:00
ui->comboBox_function_2->setCurrentIndex(vib_data->base_config_[i].function);
if(vib_data->base_config_[i].function == kRST){
ui->lineEdit_first_2->setVisible(true);
ui->lineEdit_second_2->setVisible(true);
ui->label_text_3->setVisible(true);
ui->label_text_4->setVisible(true);
ui->comboBox_dual_math_function_2->setVisible(false);
ui->label_text_6->setVisible(false);
2026-01-08 10:48:25 +08:00
ui->lineEdit_first_2->setText(QString::number(vib_data->base_config_[i].first_channel_angle));
2026-01-06 17:56:23 +08:00
ui->lineEdit_second_2->setText(QString::number(vib_data->base_config_[i].second_channel_angle));
}else if(vib_data->base_config_[i].function == kDMF){
ui->lineEdit_first_2->setVisible(false);
ui->lineEdit_second_2->setVisible(false);
ui->label_text_3->setVisible(false);
ui->label_text_4->setVisible(false);
ui->comboBox_dual_math_function_2->setVisible(true);
ui->label_text_6->setVisible(true);
2026-01-08 10:48:25 +08:00
ui->comboBox_dual_math_function_2->setCurrentIndex(vib_data->base_config_[i].dmf_function);
2025-12-14 21:47:04 +08:00
}
2025-04-01 15:03:59 +08:00
}
}
ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number);
2025-11-27 20:34:26 +08:00
qDebug() << "group" << base_ptr->group;
ui->comboBox_group->setCurrentIndex(base_ptr->group - 1);
2025-03-09 11:53:05 +08:00
}
2025-04-01 15:03:59 +08:00
void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> vib_data,int save) {
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
2025-04-01 15:03:59 +08:00
for (int var = 0; var < CHANNEL_COUNT; ++var) {
if (var + 1 == 1) {
std::shared_ptr<VariableBase> base_channel_ptr = ptr->GetChannelPtr(var + 1);
if(base_channel_ptr == nullptr && save == 1){
QMessageBox::information(this, QStringLiteral("提示"), "通道1未配置完整");
return;
}
2025-04-01 15:03:59 +08:00
vib_data->base_config_[var].standby = ui->checkBox_standby_1->isChecked();
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();
2025-12-24 19:47:35 +08:00
vib_data->base_config_[var].sensitivity_unit = SetUnit(ui->comboBox_sensitivity_unit_1->currentText());
2025-07-29 10:05:11 +08:00
vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_1->text().toFloat();
2025-11-27 20:34:26 +08:00
if(ui->comboBox_power_supply_1->currentIndex() == 0)
vib_data->base_config_[var].power = true;
else if(ui->comboBox_power_supply_1->currentIndex() == 1)
vib_data->base_config_[var].power = false;
2025-04-01 15:03:59 +08:00
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();
2025-04-23 14:44:58 +08:00
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();
vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch->currentText().toInt();
2025-04-01 15:03:59 +08:00
} else if (var + 1 == 2) {
std::shared_ptr<VariableBase> base_channel_ptr = ptr->GetChannelPtr(var + 1);
if(base_channel_ptr == nullptr && save == 1){
QMessageBox::information(this, QStringLiteral("提示"), "通道2未配置完整");
return;
}
2025-04-01 15:03:59 +08:00
vib_data->base_config_[var].standby = ui->checkBox_standby_1->isChecked();
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();
2025-12-24 19:47:35 +08:00
vib_data->base_config_[var].sensitivity_unit = SetUnit(ui->comboBox_sensitivity_unit_2->currentText());
2025-07-29 10:05:11 +08:00
vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_2->text().toFloat();
2025-11-27 20:34:26 +08:00
if(ui->comboBox_power_supply_1->currentIndex() == 0)
vib_data->base_config_[var].power = true;
else if(ui->comboBox_power_supply_1->currentIndex() == 1)
vib_data->base_config_[var].power = false;
2025-04-01 15:03:59 +08:00
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();
2025-04-23 14:44:58 +08:00
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();
vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch_2->currentText().toInt();
2025-04-01 15:03:59 +08:00
} else if (var + 1 == 3) {
std::shared_ptr<VariableBase> base_channel_ptr = ptr->GetChannelPtr(var + 1);
if(base_channel_ptr == nullptr && save == 1){
QMessageBox::information(this, QStringLiteral("提示"), "通道3未配置完整");
return;
}
2025-04-01 15:03:59 +08:00
vib_data->base_config_[var].standby = ui->checkBox_standby_2->isChecked();
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();
2025-12-24 19:47:35 +08:00
vib_data->base_config_[var].sensitivity_unit = SetUnit(ui->comboBox_sensitivity_unit_3->currentText());
2025-07-29 10:05:11 +08:00
vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_3->text().toFloat();
2025-11-27 20:34:26 +08:00
if(ui->comboBox_power_supply_1->currentIndex() == 0)
vib_data->base_config_[var].power = true;
else if(ui->comboBox_power_supply_1->currentIndex() == 1)
vib_data->base_config_[var].power = false;
2025-04-01 15:03:59 +08:00
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();
2025-07-28 20:55:48 +08:00
2025-04-23 14:44:58 +08:00
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();
vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch_3->currentText().toInt();
2025-04-01 15:03:59 +08:00
} else if (var + 1 == 4) {
std::shared_ptr<VariableBase> base_channel_ptr = ptr->GetChannelPtr(var + 1);
if(base_channel_ptr == nullptr && save == 1){
QMessageBox::information(this, QStringLiteral("提示"), "通道4未配置完整");
return;
}
2025-04-01 15:03:59 +08:00
vib_data->base_config_[var].standby = ui->checkBox_standby_2->isChecked();
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();
2025-12-24 19:47:35 +08:00
vib_data->base_config_[var].sensitivity_unit = SetUnit(ui->comboBox_sensitivity_unit_4->currentText());
2025-07-29 10:05:11 +08:00
vib_data->base_config_[var].signal_sensitivity = ui->lineEdit_signal_sensitivity_4->text().toFloat();
2025-11-27 20:34:26 +08:00
if(ui->comboBox_power_supply_1->currentIndex() == 0)
vib_data->base_config_[var].power = true;
else if(ui->comboBox_power_supply_1->currentIndex() == 1)
vib_data->base_config_[var].power = false;
2025-04-01 15:03:59 +08:00
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();
2025-04-23 14:44:58 +08:00
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();
vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch_4->currentText().toInt();
2025-12-14 21:47:04 +08:00
}else if (var + 1 == 5) {
vib_data->base_config_[var].function = ui->comboBox_function_1->currentIndex();
if(ui->comboBox_function_1->currentIndex() == 3){
2026-01-08 10:48:25 +08:00
vib_data->base_config_[var].first_channel_angle = ui->lineEdit_first_1->text().toFloat();
2025-12-14 21:47:04 +08:00
vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_1->text().toFloat();
2026-01-06 17:56:23 +08:00
}else if(ui->comboBox_function_1->currentIndex() == 5){
vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function->currentIndex();
2025-12-14 21:47:04 +08:00
}
2026-01-06 17:56:23 +08:00
vib_data->base_config_[var].channel_type = kVib12;
2025-12-14 21:47:04 +08:00
}else if (var + 1 == 6) {
vib_data->base_config_[var].function = ui->comboBox_function_2->currentIndex();
if(ui->comboBox_function_2->currentIndex() == 3){
2026-01-08 10:48:25 +08:00
vib_data->base_config_[var].first_channel_angle = ui->lineEdit_first_2->text().toFloat();
2025-12-14 21:47:04 +08:00
vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_2->text().toFloat();
2026-01-08 10:48:25 +08:00
}else if(ui->comboBox_function_2->currentIndex() == 5){
vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function_2->currentIndex();
2025-12-14 21:47:04 +08:00
}
2026-01-06 17:56:23 +08:00
vib_data->base_config_[var].channel_type = kVib34;
2025-03-09 11:53:05 +08:00
}
}
}
2025-04-01 15:03:59 +08:00
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_pushButton_confirm_clicked() {
2025-04-01 15:03:59 +08:00
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
if (base_ptr == nullptr) {
qCritical() << " should not be here";
// std::shared_ptr<VibrationData> vib_data = std::make_shared<VibrationData>();
// ConfigMgr::Instance()->AddCard(vib_data);
// UpdateData(vib_data);
return;
2025-03-09 11:53:05 +08:00
}
2025-07-29 22:01:19 +08:00
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase->isChecked()) {
2025-07-09 20:24:50 +08:00
QMessageBox::information(this, QStringLiteral("提示"), "第一通道键相槽位选择错误!");
return;
}
2025-07-29 22:01:19 +08:00
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_2->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_2->isChecked()) {
2025-07-09 20:24:50 +08:00
QMessageBox::information(this, QStringLiteral("提示"), "第二通道键相槽位选择错误!");
return;
}
2025-07-29 22:01:19 +08:00
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_3->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_3->isChecked()) {
2025-07-09 20:24:50 +08:00
QMessageBox::information(this, QStringLiteral("提示"), "第三通道键相槽位选择错误!");
return;
}
2025-07-29 22:01:19 +08:00
if (ConfigMgr::Instance()->card_type_[ui->comboBox_keyphase_slot_4->currentIndex()] != kCardKeyphaseSingle && ui->checkBox_keyphase_4->isChecked()) {
2025-07-09 20:24:50 +08:00
QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!");
return;
}
2025-12-14 21:47:04 +08:00
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;
}
2025-08-06 22:11:14 +08:00
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;
}
2025-11-21 21:48:04 +08:00
for (int var = 1; var <= SLOT_NUM; var ++) {
if(ui->comboBox_relative_number->currentIndex() != 0){
std::shared_ptr<CardBase> slot_base_ptr = ConfigMgr::Instance()->GetSlotPtr(var);
if(slot_base_ptr == nullptr || slot_base_ptr->card_type_ != kCardVibSingle)
continue;
2025-11-21 21:48:04 +08:00
if(var == slot_no)
continue;
qDebug() << "relative_number" << var << slot_base_ptr->relative_number;
if(slot_base_ptr->relative_number == ui->comboBox_relative_number->currentIndex() &&
2025-11-21 21:48:04 +08:00
slot_base_ptr->card_type_ != kCardSpeedSingle ){
QMessageBox::information(this, QStringLiteral("提示"), "板卡相对编号重复!");
return;
}
}
}
base_ptr->relative_number = ui->comboBox_relative_number->currentIndex();
base_ptr->group = ui->comboBox_group->currentIndex() + 1;
2025-04-01 15:03:59 +08:00
std::shared_ptr<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
UpdateData(vib_data,1);
qDebug() <<"type" << base_ptr->card_type_;
this->close();
2025-03-09 11:53:05 +08:00
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_pushButton_set_default_clicked() {
2025-03-09 11:53:05 +08:00
}
void Seismic_monitor::OpenAcc(){
Acceleration *acceleration = new Acceleration(slot_no, channel, ui->checkBox_enable_1->isChecked());
// connect(acceleration, &QObject::destroyed,
// this, &Seismic_monitor::onConfigWindowClosed);
// acceleration->setAttribute(Qt::WA_DeleteOnClose);
acceleration->setWindowModality(Qt::ApplicationModal);
acceleration->show();
}
void Seismic_monitor::OpenRadial(){
Radial *radial_vibration = new Radial(slot_no, channel, ui->checkBox_enable_1->isChecked());
// connect(radial_vibration, &QObject::destroyed,
// this, &Seismic_monitor::onConfigWindowClosed);
// radial_vibration->setAttribute(Qt::WA_DeleteOnClose);
radial_vibration->setWindowModality(Qt::ApplicationModal);
radial_vibration->show();
}
void Seismic_monitor::OpenVelocity(){
Velocity *velocity = new Velocity(slot_no, channel, ui->checkBox_enable_1->isChecked());
// connect(velocity, &QObject::destroyed,
// this, &Seismic_monitor::onConfigWindowClosed);
// velocity->setAttribute(Qt::WA_DeleteOnClose);
velocity->setWindowModality(Qt::ApplicationModal);
velocity->show();
}
void Seismic_monitor::OpenTrust(){
Trust *trust = new Trust(slot_no, channel, ui->checkBox_enable_1->isChecked());
// connect(trust, &QObject::destroyed,
// this, &Seismic_monitor::onConfigWindowClosed);
// trust->setAttribute(Qt::WA_DeleteOnClose);
trust->setWindowModality(Qt::ApplicationModal);
trust->show();
}
void Seismic_monitor::OpenPressure(){
PressurePulsation *pressure_pulsation = new PressurePulsation(slot_no, channel, ui->checkBox_enable_1->isChecked());
// connect(pressure_pulsation, &QObject::destroyed,
// this, &Seismic_monitor::onConfigWindowClosed);
// pressure_pulsation->setAttribute(Qt::WA_DeleteOnClose);
pressure_pulsation->setWindowModality(Qt::ApplicationModal);
pressure_pulsation->show();
}
void Seismic_monitor::onConfigWindowClosed(QObject *)
{
// qDebug() << "onConfigWindowClosed";
// if(ui->comboBox_function_1->currentIndex() != 0 &&
// ui->comboBox_dual_math_function->currentIndex() != 6){
// on_comboBox_dual_math_function_currentIndexChanged(ui->comboBox_dual_math_function->currentIndex());
// }
// if(ui->comboBox_function_2->currentIndex() != 0 &&
// ui->comboBox_dual_math_function_2->currentIndex() != 6){
// on_comboBox_dual_math_function_2_currentIndexChanged(ui->comboBox_dual_math_function_2->currentIndex());
// }
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_pushButton_config_1_clicked() {
2025-03-25 10:47:13 +08:00
channel = 1;
2025-03-29 09:53:29 +08:00
if (ui->comboBox_chan_type_1->currentIndex() == kVibAcc) {
OpenAcc();
2025-03-29 09:53:29 +08:00
} else if (ui->comboBox_chan_type_1->currentIndex() == kVibRadial) {
OpenRadial();
2025-03-29 09:53:29 +08:00
} else if (ui->comboBox_chan_type_1->currentIndex() == kVibVelocity) {
OpenVelocity();
}else if (ui->comboBox_chan_type_1->currentIndex() == kVibThrust) {
OpenTrust();
2025-07-09 20:24:50 +08:00
}else if (ui->comboBox_chan_type_1->currentIndex() == kVibPressurePulsation) {
OpenPressure();
2025-03-11 16:42:00 +08:00
}
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_pushButton_config_2_clicked() {
2025-03-25 10:47:13 +08:00
channel = 2;
2025-03-29 09:53:29 +08:00
if (ui->comboBox_chan_type_2->currentIndex() == kVibAcc) {
OpenAcc();
2025-03-29 09:53:29 +08:00
} else if (ui->comboBox_chan_type_2->currentIndex() == kVibRadial) {
OpenRadial();
2025-03-29 09:53:29 +08:00
} else if (ui->comboBox_chan_type_2->currentIndex() == kVibVelocity) {
OpenVelocity();
}else if (ui->comboBox_chan_type_2->currentIndex() == kVibThrust) {
OpenTrust();
2025-07-09 20:24:50 +08:00
}else if (ui->comboBox_chan_type_2->currentIndex() == kVibPressurePulsation) {
OpenPressure();
2025-03-25 10:47:13 +08:00
}
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_pushButton_config_3_clicked() {
2025-03-25 10:47:13 +08:00
channel = 3;
2025-03-29 09:53:29 +08:00
if (ui->comboBox_chan_type_3->currentIndex() == kVibAcc) {
OpenAcc();
2025-03-29 09:53:29 +08:00
} else if (ui->comboBox_chan_type_3->currentIndex() == kVibRadial) {
OpenRadial();
2025-03-29 09:53:29 +08:00
} else if (ui->comboBox_chan_type_3->currentIndex() == kVibVelocity) {
OpenVelocity();
}else if (ui->comboBox_chan_type_3->currentIndex() == kVibThrust) {
OpenTrust();
2025-07-09 20:24:50 +08:00
}else if (ui->comboBox_chan_type_3->currentIndex() == kVibPressurePulsation) {
OpenPressure();
2025-03-25 10:47:13 +08:00
}
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_pushButton_config_4_clicked() {
2025-03-25 10:47:13 +08:00
channel = 4;
2025-03-29 09:53:29 +08:00
if (ui->comboBox_chan_type_4->currentIndex() == kVibAcc) {
OpenAcc();
2025-03-29 09:53:29 +08:00
} else if (ui->comboBox_chan_type_4->currentIndex() == kVibRadial) {
OpenRadial();
2025-03-29 09:53:29 +08:00
} else if (ui->comboBox_chan_type_4->currentIndex() == kVibVelocity) {
OpenVelocity();
}else if (ui->comboBox_chan_type_4->currentIndex() == kVibThrust) {
OpenTrust();
2025-07-09 20:24:50 +08:00
}else if (ui->comboBox_chan_type_4->currentIndex() == kVibPressurePulsation) {
OpenPressure();
2025-03-09 11:53:05 +08:00
}
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_comboBox_chan_type_1_currentTextChanged(const QString &arg1) {
switch (ui->comboBox_chan_type_1->currentIndex()) {
case kVibRadial:
2025-07-28 20:55:48 +08:00
2025-07-09 20:24:50 +08:00
EnableKeyphase();
2025-03-29 09:53:29 +08:00
break;
case kVibAcc:
2025-07-28 20:55:48 +08:00
2025-07-09 20:24:50 +08:00
EnableKeyphase();
2025-03-29 09:53:29 +08:00
break;
case kVibVelocity:
2025-07-28 20:55:48 +08:00
2025-07-09 20:24:50 +08:00
EnableKeyphase();
2025-03-29 09:53:29 +08:00
break;
case kVibThrust:
2025-07-28 20:55:48 +08:00
2025-07-09 20:24:50 +08:00
DisableKeyphase();
break;
case kVibPressurePulsation:
DisableKeyphase();
break;
}
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_comboBox_chan_type_2_currentTextChanged(const QString &arg1) {
2025-04-25 14:28:27 +08:00
switch (ui->comboBox_chan_type_2->currentIndex()) {
2025-03-29 09:53:29 +08:00
case kVibRadial:
2025-07-09 20:24:50 +08:00
EnableKeyphase();
2025-03-29 09:53:29 +08:00
break;
case kVibAcc:
2025-07-09 20:24:50 +08:00
EnableKeyphase2();
2025-03-29 09:53:29 +08:00
break;
case kVibVelocity:
2025-07-09 20:24:50 +08:00
EnableKeyphase2();
2025-03-29 09:53:29 +08:00
break;
case kVibThrust:
2025-07-09 20:24:50 +08:00
DisableKeyphase2();
break;
case kVibPressurePulsation:
DisableKeyphase2();
break;
}
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_comboBox_chan_type_3_currentTextChanged(const QString &arg1) {
2025-04-25 14:28:27 +08:00
switch (ui->comboBox_chan_type_3->currentIndex()) {
2025-03-29 09:53:29 +08:00
case kVibRadial:
2025-07-09 20:24:50 +08:00
EnableKeyphase();
2025-03-29 09:53:29 +08:00
break;
case kVibAcc:
2025-07-09 20:24:50 +08:00
EnableKeyphase3();
2025-03-29 09:53:29 +08:00
break;
case kVibVelocity:
2025-07-09 20:24:50 +08:00
EnableKeyphase3();
2025-03-29 09:53:29 +08:00
break;
case kVibThrust:
2025-07-09 20:24:50 +08:00
DisableKeyphase3();
break;
case kVibPressurePulsation:
DisableKeyphase3();
break;
}
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_comboBox_chan_type_4_currentTextChanged(const QString &arg1) {
2025-04-25 14:28:27 +08:00
switch (ui->comboBox_chan_type_4->currentIndex()) {
2025-03-29 09:53:29 +08:00
case kVibRadial:
2025-07-09 20:24:50 +08:00
EnableKeyphase4();
2025-03-29 09:53:29 +08:00
break;
case kVibAcc:
2025-07-09 20:24:50 +08:00
EnableKeyphase4();
2025-03-29 09:53:29 +08:00
break;
case kVibVelocity:
2025-07-09 20:24:50 +08:00
EnableKeyphase4();
2025-03-29 09:53:29 +08:00
break;
case kVibThrust:
2025-07-09 20:24:50 +08:00
DisableKeyphase4();
break;
case kVibPressurePulsation:
DisableKeyphase4();
break;
}
}
2025-03-29 09:53:29 +08:00
void Seismic_monitor::on_pushButton_cancel_clicked() {
this->close();
}
void Seismic_monitor::EnableKeyphase(){
ui->checkBox_keyphase->setCheckable(true);
ui->checkBox_keyphase->setEnabled(true);
ui->comboBox_keyphase_ch->setEnabled(true);
ui->comboBox_keyphase_slot->setEnabled(true);
2025-07-09 20:24:50 +08:00
}
void Seismic_monitor::EnableKeyphase2(){
ui->checkBox_keyphase_2->setCheckable(true);
ui->checkBox_keyphase_2->setEnabled(true);
ui->comboBox_keyphase_ch_2->setEnabled(true);
ui->comboBox_keyphase_slot_2->setEnabled(true);
2025-07-09 20:24:50 +08:00
}
void Seismic_monitor::EnableKeyphase3(){
ui->checkBox_keyphase_3->setCheckable(true);
ui->checkBox_keyphase_3->setEnabled(true);
ui->comboBox_keyphase_ch_3->setEnabled(true);
ui->comboBox_keyphase_slot_3->setEnabled(true);
2025-07-09 20:24:50 +08:00
}
void Seismic_monitor::EnableKeyphase4(){
ui->checkBox_keyphase_4->setCheckable(true);
ui->checkBox_keyphase_4->setEnabled(true);
ui->comboBox_keyphase_ch_4->setEnabled(true);
ui->comboBox_keyphase_slot_4->setEnabled(true);
}
void Seismic_monitor::DisableKeyphase(){
ui->checkBox_keyphase->setCheckable(false);
ui->checkBox_keyphase->setEnabled(false);
ui->comboBox_keyphase_ch->setEnabled(false);
ui->comboBox_keyphase_slot->setEnabled(false);
2025-07-09 20:24:50 +08:00
}
void Seismic_monitor::DisableKeyphase2(){
ui->checkBox_keyphase_2->setCheckable(false);
ui->checkBox_keyphase_2->setEnabled(false);
ui->comboBox_keyphase_ch_2->setEnabled(false);
ui->comboBox_keyphase_slot_2->setEnabled(false);
2025-07-09 20:24:50 +08:00
}
void Seismic_monitor::DisableKeyphase3(){
ui->checkBox_keyphase_3->setCheckable(false);
ui->checkBox_keyphase_3->setEnabled(false);
ui->comboBox_keyphase_ch_3->setEnabled(false);
ui->comboBox_keyphase_slot_3->setEnabled(false);
2025-07-09 20:24:50 +08:00
}
void Seismic_monitor::DisableKeyphase4(){
ui->checkBox_keyphase_4->setCheckable(false);
ui->checkBox_keyphase_4->setEnabled(false);
ui->comboBox_keyphase_ch_4->setEnabled(false);
ui->comboBox_keyphase_slot_4->setEnabled(false);
}
2025-08-07 19:35:59 +08:00
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);
}
void Seismic_monitor::on_pushButton_config_1_2_clicked()
{
2025-12-14 21:47:04 +08:00
Channel_1_2 *ch1_2 = new Channel_1_2(slot_no, 5,current_config_1_2);
ch1_2->setWindowModality(Qt::ApplicationModal);
ch1_2->show();
}
void Seismic_monitor::on_pushButton_config_3_4_clicked()
{
2025-12-14 21:47:04 +08:00
Channel_3_4 *ch3_4 = new Channel_3_4(slot_no, 6,current_config_3_4);
ch3_4->setWindowModality(Qt::ApplicationModal);
ch3_4->show();
}
2025-09-27 21:34:27 +08:00
void Seismic_monitor::copy_end_slot(){
Init();
}
2025-09-18 11:46:35 +08:00
void Seismic_monitor::on_pushButton_copy_channel_clicked()
{
2025-09-27 21:34:27 +08:00
CopyChannel *copy_channel = new CopyChannel(slot_no);
connect(copy_channel,SIGNAL(copy_end_sg()),this,SLOT(copy_end_slot()));
2025-09-18 11:46:35 +08:00
copy_channel->setWindowModality(Qt::ApplicationModal);
copy_channel->show();
}
2025-12-14 21:47:04 +08:00
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)){
2026-01-08 19:11:20 +08:00
QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 必须为径向位移!");
ui->comboBox_function_2->setCurrentIndex(0);
return;
}
if((index == 2||index == 3||index == 4)
&& (ui->comboBox_chan_type_3->currentIndex() != 3 || ui->comboBox_chan_type_4->currentIndex() != 3)){
QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 必须为轴向位移!");
2025-12-14 21:47:04 +08:00
ui->comboBox_function_2->setCurrentIndex(0);
return;
}
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);
2026-01-06 17:56:23 +08:00
ui->comboBox_dual_math_function_2->setVisible(false);
ui->label_text_6->setVisible(false);
}else if(index == 5){
ui->lineEdit_first_2->setVisible(false);
ui->lineEdit_second_2->setVisible(false);
ui->label_text_3->setVisible(false);
ui->label_text_4->setVisible(false);
ui->comboBox_dual_math_function_2->setVisible(true);
ui->comboBox_dual_math_function_2->setCurrentIndex(6);
2026-01-06 17:56:23 +08:00
ui->label_text_6->setVisible(true);
2025-12-14 21:47:04 +08:00
}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);
2026-01-06 17:56:23 +08:00
ui->comboBox_dual_math_function_2->setVisible(false);
ui->label_text_6->setVisible(false);
2025-12-14 21:47:04 +08:00
}
current_config_3_4 = index;
2026-01-08 19:11:20 +08:00
if(index != 0){
on_comboBox_dual_math_function_2_currentIndexChanged(0);
}
2025-12-14 21:47:04 +08:00
}
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;
}
2026-01-08 19:11:20 +08:00
if((index == 2||index == 3||index == 4)
2026-01-09 11:50:35 +08:00
&& (ui->comboBox_chan_type_1->currentIndex() != 3 || ui->comboBox_chan_type_2->currentIndex() != 3)){
2026-01-08 19:11:20 +08:00
QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 必须为轴向位移!");
ui->comboBox_function_1->setCurrentIndex(0);
return;
}
2025-12-14 21:47:04 +08:00
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);
2026-01-06 17:56:23 +08:00
ui->comboBox_dual_math_function->setVisible(false);
ui->label_text_5->setVisible(false);
}else if(index == 5){
ui->lineEdit_first_1->setVisible(false);
ui->lineEdit_second_1->setVisible(false);
ui->label_text_1->setVisible(false);
ui->label_text_2->setVisible(false);
ui->comboBox_dual_math_function->setVisible(true);
ui->comboBox_dual_math_function->setCurrentIndex(6);
2026-01-06 17:56:23 +08:00
ui->label_text_5->setVisible(true);
2025-12-14 21:47:04 +08:00
}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);
2026-01-06 17:56:23 +08:00
ui->comboBox_dual_math_function->setVisible(false);
ui->label_text_5->setVisible(false);
2025-12-14 21:47:04 +08:00
}
current_config_1_2 = index;
2026-01-08 19:11:20 +08:00
if(index != 0){
on_comboBox_dual_math_function_currentIndexChanged(0);
}
2025-12-14 21:47:04 +08:00
}
2025-12-24 19:47:35 +08:00
QString Seismic_monitor::GetUnit(int unit_num){
QString unit_str = "";
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;
}
}
return unit_str;
}
int Seismic_monitor::SetUnit(QString unit_str){
int unit_num = -1;
if (unit_str == "g") {
unit_num = 0;
}
else if(unit_str == "m/s**2"){
unit_num = 1;
}else if(unit_str == "mm/s"){
unit_num = 2;
}else if(unit_str == "inch/s"){
unit_num = 3;
}else if(unit_str == "um"){
unit_num = 4;
}else if(unit_str == "mm"){
unit_num = 5;
}else if(unit_str == "mils"){
unit_num = 6;
}else if(unit_str == "inch/s**2"){
unit_num = 7;
}else if(unit_str == "mbar"){
unit_num = 9;
}else if(unit_str == "bar"){
unit_num = 10;
}
return unit_num;
}
2026-01-08 19:11:20 +08:00
void Seismic_monitor::on_comboBox_dual_math_function_currentIndexChanged(int index)
{
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
if(base_ptr == nullptr){
QMessageBox::warning(this, QStringLiteral("警告"), "请先配置通道1 和 通道2");
ui->comboBox_function_1->setCurrentIndex(0);
return;
}
2026-01-08 19:11:20 +08:00
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
if(ptr == nullptr){
QMessageBox::warning(this, QStringLiteral("警告"), "请先配置通道1 和 通道2");
ui->comboBox_function_1->setCurrentIndex(0);
return;
}
2026-01-08 19:11:20 +08:00
std::shared_ptr<VariableBase> variable_base1 = ptr->GetChannelPtr(1);
std::shared_ptr<VariableBase> variable_base2 = ptr->GetChannelPtr(2);
if(variable_base1 == nullptr || variable_base2 == nullptr){
QMessageBox::warning(this, QStringLiteral("警告"), "请先配置通道1 和 通道2");
ui->comboBox_function_1->setCurrentIndex(0);
return;
}
qDebug() << "comboBox_function_1" << ui->comboBox_function_1->currentIndex() << ui->comboBox_dual_math_function->currentIndex() << index;
index = ui->comboBox_dual_math_function->currentIndex();
2026-01-08 19:11:20 +08:00
if(ui->comboBox_function_1->currentIndex() == kDMF && (index == kRMSSum || index == kRMSSubtraction)
&& variable_base1->general.rectifier_function != 6
&& variable_base2->general.rectifier_function != 6){
QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 整流器必须为RMS");
ui->comboBox_function_1->setCurrentIndex(0);
return;
}
if((index == kSUM || index == kSUBTRACTION || index == kXYMin || index == kXYMax)
&& variable_base1->general.rectifier_function !=
variable_base2->general.rectifier_function){
QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 整流器必须配置相同!");
ui->comboBox_function_1->setCurrentIndex(0);
return;
}
}
void Seismic_monitor::on_comboBox_dual_math_function_2_currentIndexChanged(int index)
{
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
if(base_ptr == nullptr){
QMessageBox::warning(this, QStringLiteral("警告"), "请先配置通道3 和 通道4");
ui->comboBox_function_2->setCurrentIndex(0);
return;
}
2026-01-08 19:11:20 +08:00
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
if(ptr == nullptr){
QMessageBox::warning(this, QStringLiteral("警告"), "请先配置通道3 和 通道4");
ui->comboBox_function_2->setCurrentIndex(0);
return;
}
2026-01-08 19:11:20 +08:00
std::shared_ptr<VariableBase> variable_base1 = ptr->GetChannelPtr(3);
std::shared_ptr<VariableBase> variable_base2 = ptr->GetChannelPtr(4);
if(variable_base1 == nullptr || variable_base2 == nullptr){
QMessageBox::warning(this, QStringLiteral("警告"), "请先配置通道3 和 通道4");
ui->comboBox_function_2->setCurrentIndex(0);
return;
}
2026-01-08 19:11:20 +08:00
qDebug() << "comboBox_function_2" << ui->comboBox_function_2->currentIndex();
if(ui->comboBox_function_2->currentIndex() == kDMF && (index == kRMSSum || index == kRMSSubtraction)
&& variable_base1->general.rectifier_function != 6
&& variable_base2->general.rectifier_function != 6){
QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 整流器必须为RMS");
ui->comboBox_function_2->setCurrentIndex(0);
return;
}
if((index == kSUM || index == kSUBTRACTION || index == kXYMin || index == kXYMax)
&& variable_base1->general.rectifier_function !=
variable_base2->general.rectifier_function){
QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 整流器必须配置相同!");
ui->comboBox_function_2->setCurrentIndex(0);
return;
}
}