modify channel 1&2 config

This commit is contained in:
SHENG-PC\admin 2025-12-14 21:47:04 +08:00
parent 180f70218b
commit 9328c2caad
8 changed files with 304 additions and 28 deletions

View File

@ -5,17 +5,24 @@
#include "config_mgr.h" #include "config_mgr.h"
#include <QMessageBox> #include <QMessageBox>
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) : QWidget(parent)
, ui(new Ui::Channel_1_2) , ui(new Ui::Channel_1_2)
{ {
ui->setupUi(this); ui->setupUi(this);
slot_no = slot_no_; slot_no = slot_no_;
channel = channel_; 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); QString slot = QString("%1").arg(slot_no);
ui->label_channel->setText(chan); ui->label_channel->setText(chan);
ui->label_slot->setText(slot); 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(); Init();
} }

View File

@ -12,10 +12,11 @@ class Channel_1_2 : public QWidget
Q_OBJECT Q_OBJECT
public: 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(); ~Channel_1_2();
int slot_no; int slot_no;
int channel; int channel;
int function_index;
private slots: private slots:
void on_pushButton_confirm_clicked(); void on_pushButton_confirm_clicked();

View File

@ -4,17 +4,24 @@
#include "vibrationdata.h" #include "vibrationdata.h"
#include "config_mgr.h" #include "config_mgr.h"
#include <QMessageBox> #include <QMessageBox>
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) : QWidget(parent)
, ui(new Ui::Channel_3_4) , ui(new Ui::Channel_3_4)
{ {
ui->setupUi(this); ui->setupUi(this);
slot_no = slot_no_; slot_no = slot_no_;
channel = channel_; 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); QString slot = QString("%1").arg(slot_no);
ui->label_channel->setText(chan); ui->label_channel->setText(chan);
ui->label_slot->setText(slot); 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(); Init();
} }

View File

@ -12,10 +12,11 @@ class Channel_3_4 : public QWidget
Q_OBJECT Q_OBJECT
public: 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(); ~Channel_3_4();
int slot_no; int slot_no;
int channel; int channel;
int function_index;
private slots: private slots:
void on_pushButton_confirm_clicked(); void on_pushButton_confirm_clicked();

View File

@ -136,6 +136,15 @@ typedef enum{
kRMS = 6 kRMS = 6
} RectifierFuntion; } RectifierFuntion;
typedef enum{
kRMSSum = 0,
kRMSSubtraction = 1,
kSUM = 2,
kSUBTRACTION = 3,
kXYMin = 4,
kXYMax = 5
} RectifierFuntionDMF;
typedef enum{ typedef enum{
kUnit1 = 0, // g kUnit1 = 0, // g
kUnit2 = 1, // m/s**2 kUnit2 = 1, // m/s**2
@ -267,6 +276,9 @@ typedef struct SeismicMonitor_{
int keyphase_ch; int keyphase_ch;
int sensitivity_unit; int sensitivity_unit;
float signal_sensitivity; float signal_sensitivity;
int function;
float fisrt_channel_angle;
float second_channel_angle;
SeismicMonitor_(){ SeismicMonitor_(){
standby = false; standby = false;
active = false; active = false;

View File

@ -33,6 +33,16 @@ Seismic_monitor::Seismic_monitor(int slot,CardType cardtype, QWidget *parent) :
card_type = cardtype; card_type = cardtype;
QString slot_no_ = QString("%1").arg(slot_no); QString slot_no_ = QString("%1").arg(slot_no);
ui->label_slot_no->setText(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(); Init();
} }
@ -124,6 +134,18 @@ void Seismic_monitor::Init() {
ui->doubleSpinBox_low_4->setValue(vib_data->base_config_[i].normal_voltage_low); 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->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); ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number);
@ -202,6 +224,18 @@ void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> vib_data) {
vib_data->base_config_[var].keyphase = ui->checkBox_keyphase_4->isChecked(); 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_slot = ui->comboBox_keyphase_slot_4->currentText().toInt();
vib_data->base_config_[var].keyphase_ch = ui->comboBox_keyphase_ch_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("提示"), "第四通道键相槽位选择错误!"); QMessageBox::information(this, QStringLiteral("提示"), "第四通道键相槽位选择错误!");
return; 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" || if(ui->lineEdit_signal_sensitivity_1->text() == "0" ||
ui->lineEdit_signal_sensitivity_2->text() == "0" || ui->lineEdit_signal_sensitivity_2->text() == "0" ||
ui->lineEdit_signal_sensitivity_3->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() 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->setWindowModality(Qt::ApplicationModal);
ch1_2->show(); 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() 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->setWindowModality(Qt::ApplicationModal);
ch3_4->show(); ch3_4->show();
} }
@ -556,3 +606,55 @@ void Seismic_monitor::on_pushButton_copy_channel_clicked()
copy_channel->show(); 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;
}

View File

@ -57,12 +57,18 @@ class Seismic_monitor : public QWidget {
void copy_end_slot(); void copy_end_slot();
void on_comboBox_function_2_currentIndexChanged(int index);
void on_comboBox_function_1_currentIndexChanged(int index);
private: private:
Ui::Seismic_monitor *ui; Ui::Seismic_monitor *ui;
void UpdateData(std::shared_ptr<VibrationData> vib_data); void UpdateData(std::shared_ptr<VibrationData> vib_data);
// int card_type; // int card_type;
// void readJsonFile(const QString &filePath); // void readJsonFile(const QString &filePath);
// SeismicMonitor seismic_monitor[CHANNLE_COUNT]; // SeismicMonitor seismic_monitor[CHANNLE_COUNT];
int current_config_1_2;
int current_config_3_4;
QVector<Transducer> vec_transducer; QVector<Transducer> vec_transducer;
void Init(); void Init();
void EnableKeyphase(); void EnableKeyphase();

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>928</width> <width>938</width>
<height>623</height> <height>653</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -265,7 +265,7 @@
</size> </size>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -1153,18 +1153,31 @@
<attribute name="title"> <attribute name="title">
<string>通道1-通道2</string> <string>通道1-通道2</string>
</attribute> </attribute>
<widget class="QWidget" name="layoutWidget"> <widget class="QPushButton" name="pushButton_config_1_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>110</x>
<y>50</y> <y>220</y>
<width>238</width> <width>93</width>
<height>27</height> <height>28</height>
</rect>
</property>
<property name="text">
<string>配置</string>
</property>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>21</x>
<y>51</y>
<width>239</width>
<height>23</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_20"> <layout class="QHBoxLayout" name="horizontalLayout_20">
<item> <item>
<widget class="QComboBox" name="comboBox"> <widget class="QComboBox" name="comboBox_function_1">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>200</width>
@ -1218,18 +1231,75 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QPushButton" name="pushButton_config_1_2"> <widget class="QWidget" name="">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>20</x>
<y>110</y> <y>130</y>
<width>93</width> <width>329</width>
<height>28</height> <height>23</height>
</rect> </rect>
</property> </property>
<property name="text"> <layout class="QHBoxLayout" name="horizontalLayout_44">
<string>配置</string> <item>
<widget class="QLineEdit" name="lineEdit_first_1">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_text_1">
<property name="text">
<string>第一通道安装角度</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>20</x>
<y>170</y>
<width>329</width>
<height>23</height>
</rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_45">
<item>
<widget class="QLineEdit" name="lineEdit_second_1">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_text_2">
<property name="text">
<string>第二通道安装角度</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</widget> </widget>
</widget> </widget>
@ -1465,7 +1535,7 @@
</size> </size>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tab_3">
<attribute name="title"> <attribute name="title">
@ -2358,13 +2428,13 @@
<rect> <rect>
<x>20</x> <x>20</x>
<y>50</y> <y>50</y>
<width>238</width> <width>239</width>
<height>27</height> <height>27</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_22"> <layout class="QHBoxLayout" name="horizontalLayout_22">
<item> <item>
<widget class="QComboBox" name="comboBox_2"> <widget class="QComboBox" name="comboBox_function_2">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>200</width> <width>200</width>
@ -2421,8 +2491,8 @@
<widget class="QPushButton" name="pushButton_config_3_4"> <widget class="QPushButton" name="pushButton_config_3_4">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>100</x>
<y>100</y> <y>220</y>
<width>93</width> <width>93</width>
<height>28</height> <height>28</height>
</rect> </rect>
@ -2431,6 +2501,76 @@
<string>配置</string> <string>配置</string>
</property> </property>
</widget> </widget>
<widget class="QWidget" name="layoutWidget_2">
<property name="geometry">
<rect>
<x>20</x>
<y>170</y>
<width>329</width>
<height>23</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_46">
<item>
<widget class="QLineEdit" name="lineEdit_second_2">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_text_4">
<property name="text">
<string>第二通道安装角度</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget_4">
<property name="geometry">
<rect>
<x>20</x>
<y>130</y>
<width>329</width>
<height>23</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_47">
<item>
<widget class="QLineEdit" name="lineEdit_first_2">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_text_3">
<property name="text">
<string>第一通道安装角度</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
</widget> </widget>
</item> </item>