pull codes.

Merge branch 'self_dev' of http://192.168.1.212:3000/zhangsheng/TSI_Config into self_dev
This commit is contained in:
pandx 2025-08-21 10:59:46 +08:00
commit dec66e5e7a
43 changed files with 9081 additions and 6698 deletions

View File

@ -15,19 +15,21 @@ SOURCES += \
common.cpp \
config_mgr.cpp \
connect.cpp \
dc_output_channel.cpp \
dc_outputs.cpp \
ethconfig.cpp \
keyphase.cpp \
keyphase_data.cpp \
macconfig.cpp \
main.cpp \
mainwindow.cpp \
mqtt_config.cpp \
pointname.cpp \
pressure_pulsation.cpp \
radial_vibration.cpp \
rangeslider.cpp \
relaysetting.cpp \
seismic_monitor.cpp \
setpoint.cpp \
setpoint_tachometer.cpp \
singlerelay.cpp \
singlerelay_data.cpp \
@ -48,19 +50,21 @@ HEADERS += \
config_mgr.h \
connect.h \
data_config.h \
dc_output_channel.h \
dc_outputs.h \
displacement_ds.h \
ethconfig.h \
keyphase.h \
keyphase_data.h \
macconfig.h \
mainwindow.h \
mqtt_config.h \
pointname.h \
pressure_pulsation.h \
radial_vibration.h \
rangeslider.h \
relaysetting.h \
seismic_monitor.h \
setpoint.h \
setpoint_tachometer.h \
singlerelay.h \
singlerelay_data.h \
@ -77,16 +81,18 @@ HEADERS += \
FORMS += \
acceleration.ui \
connect.ui \
dc_output_channel.ui \
dc_outputs.ui \
ethconfig.ui \
keyphase.ui \
macconfig.ui \
mainwindow.ui \
mqtt_config.ui \
pointname.ui \
pressure_pulsation.ui \
radial_vibration.ui \
relaysetting.ui \
seismic_monitor.ui \
setpoint.ui \
setpoint_tachometer.ui \
singlerelay.ui \
tachometer.ui \

View File

@ -5,7 +5,7 @@
#include <QJsonArray>
#include <QJsonObject>
#include <QFile>
#include <QMessageBox>
#include "data_config.h"
#include "vibrationdata.h"
#include "config_mgr.h"
@ -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<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
if (base_ptr == nullptr) {
@ -188,32 +58,71 @@ 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);
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));
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() {
@ -222,9 +131,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<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
ptr->base_config_[channel - 1].channel_type = kVibAcc;
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
if (variable_base == nullptr || variable_base->type_ != kVibAcc) {
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
if (variable_base == nullptr || variable_base->type_ != kVibAcc || variable == nullptr) {
if (variable_base == nullptr) {
qDebug() << "no channel ptr";
} else {
@ -243,37 +159,71 @@ 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();
// 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();
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;
}
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(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();
@ -283,32 +233,66 @@ 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();
// 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();
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();
}
@ -319,3 +303,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()
{
}

View File

@ -23,10 +23,10 @@ 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);
void on_lineEdit_alert_high_level_editingFinished();
void on_lineEdit_danger_high_level_editingFinished();
private:
Ui::Acceleration *ui;

File diff suppressed because it is too large Load Diff

View File

@ -24,12 +24,19 @@ 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;
General gap_general;
AlarmDangerHigh gap_danger_high;
AlarmAlertHigh gap_alert_high;
AlarmDangerLow gap_danger_low;
AlarmAlertLow gap_alert_low;
FrequencybandOutput freband_output[10];
};
// 位移

View File

@ -47,6 +47,7 @@ void ConfigMgr::Save(QString & file_path) {
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 ||
@ -58,52 +59,50 @@ void ConfigMgr::Save(QString & file_path) {
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(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;
// 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){
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<VariableBase> base_channel_ptr = ptr->GetChannelPtr(cid + 1);
@ -133,41 +132,66 @@ 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;
// 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;
// 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_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;
}else if(ptr->base_config_[cid].channel_type == kVibThrust){
std::shared_ptr<ThrustVariable> thrust_ptr = std::dynamic_pointer_cast<ThrustVariable>(base_channel_ptr);
if(thrust_ptr == nullptr){
@ -191,33 +215,37 @@ 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_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_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;
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<PressurePulsationVariable> pressure_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(base_channel_ptr);
if(pressure_ptr == nullptr){
@ -253,8 +281,21 @@ 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){
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;
number[QString::number(var + 1)] = freband_output;
}
}
variables["freband_output"] = number;
} else {
} else if(ptr->base_config_[cid].channel_type == kVibAcc){
std::shared_ptr<AccVelVariable> av_ptr = std::dynamic_pointer_cast<AccVelVariable>(base_channel_ptr);
if(av_ptr == nullptr){
continue;
@ -277,46 +318,98 @@ 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;
// 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;
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){
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;
number[QString::number(var + 1)] = freband_output;
}
}
variables["freband_output"] = number;
}else if(ptr->base_config_[cid].channel_type == kVibVelocity){
std::shared_ptr<AccVelVariable> vel_ptr = std::dynamic_pointer_cast<AccVelVariable>(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) {
@ -367,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{
@ -451,6 +545,20 @@ void ConfigMgr::Load(QString filename) {
vib_data->version_ = temp_obj["version"].toInt();
vib_data->card_type_ = static_cast<CardType>(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<VariableBase> base_channel_ptr = vib_data->GetChannelPtr(j + 1);
channel = temp_obj[QString::number(j + 1)].toObject();
@ -459,49 +567,43 @@ 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();
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();
}
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();
}
// 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) {
@ -516,35 +618,61 @@ 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,m_general,m_alarm,g_general,g_alarm;
measurement = tmp_variable["measurement"].toObject();
gap = tmp_variable["gap"].toObject();
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"].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();
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_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();
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;
}
@ -559,26 +687,32 @@ 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,g_general,g_alarm;
gap = tmp_variable["gap"].toObject();
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"].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();
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);
@ -595,21 +729,89 @@ 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) {
number_obj = freband_output_obj[QString::number(k + 1)].toObject();
if(number_obj.isEmpty())
continue;
FrequencybandOutput output;
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);
break;
}
case kVibVelocity:{
std::shared_ptr<AccVelVariable> variable = std::make_shared<AccVelVariable>();
// 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"].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();
vib_data->variables_.push_back(variable);
break;
}
case kVibVelocity:
case kVibAcc: {
std::shared_ptr<AccVelVariable> variable = std::make_shared<AccVelVariable>();
// filter
@ -621,39 +823,45 @@ 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"].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) {
number_obj = freband_output_obj[QString::number(k + 1)].toObject();
if(number_obj.isEmpty())
continue;
FrequencybandOutput output;
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);
break;
}
@ -703,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();
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();

View File

@ -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()

View File

@ -8,12 +8,19 @@
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
extern QString g_strServerIp; // 服务端IP
extern QString g_version;
#define SLOT_NUM 15
#define CHANNEL_COUNT 4
#define RELAY_COUNT 16
typedef struct {
bool used[4]; // 是否已配置
int channel;
}ChannelUsed;
extern QString g_strServerIp; // 服务端IP
extern QString g_version;
extern ChannelUsed ch_used[SLOT_NUM][22];
struct ExprNode {
QString value;
QList<ExprNode*> children;
@ -54,6 +61,118 @@ 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,
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 = 9, // mbar
kUnit10 = 10, // bar
kUnit11 = 11, // psi
kUnit12 = 12, // pa
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;
@ -89,10 +208,15 @@ 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信息
kConfigDeviceID = 32, // 配置设备编号编号范围为1~99
};
enum RS485Baudrate {
kBaudrate2400 = 0,
@ -117,7 +241,7 @@ typedef enum {
kVibRackTMR = 1 // 三冗余
} VibRackType;
typedef struct {
typedef struct SeismicMonitor_{
int id;
QString point_name;
QString chan_id;
@ -135,6 +259,15 @@ typedef struct {
bool keyphase;
int keyphase_slot;
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 {
@ -149,6 +282,44 @@ typedef struct {
bool checked;
} Filter;
typedef struct{
bool output_used;
int engineering_unit;
int rectifier_function;
}General;
typedef struct{
float level;
float hysteresis;
float delay;
bool enable;
bool latch;
}AlarmDangerHigh,AlarmAlertHigh,AlarmDangerLow,AlarmAlertLow ;
typedef struct FrequencybandOutput_{
bool enable;
int start;
int end;
FrequencybandOutput_()
{
enable = false;
start = 0;
end = 0;
}
}FrequencybandOutput ;
typedef struct DCOutput_{
int output_channel;
float minmum;
float maxmum;
DCOutput_(){
output_channel = -1;
minmum = 0;
maxmum = 0;
}
} DCOutput;
//typedef struct {
// Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass
//} AllFilter;
@ -587,6 +758,51 @@ 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;
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;

79
dc_output_channel.cpp Normal file
View File

@ -0,0 +1,79 @@
#include "dc_output_channel.h"
#include "ui_dc_output_channel.h"
#include <QMessageBox>
#include "data_config.h"
#include <QDebug>
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;
radiobtn[1] = ui->radioButton_2;
radiobtn[2] = ui->radioButton_3;
radiobtn[3] = ui->radioButton_4;
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[slot_no][i].used[j] && current_index == i){
radiobtn[j]->setEnabled(true);
radiobtn[j]->setChecked(true);
first_used = j;
}else if(ch_used[slot_no][i].used[j] && current_index != i){
radiobtn[j]->setEnabled(false);
}else if(!ch_used[slot_no][i].used[j] && current_index == i){
not_used ++;
}
}
}
if(not_used == 4){
ui->radioButton_5->setChecked(true);
}
}
DC_Output_Channel::~DC_Output_Channel()
{
delete ui;
}
void DC_Output_Channel::on_pushButton_confirm_clicked()
{
int channel = 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;
}
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 if(ui->radioButton_5->isChecked()){
ch_used[slot_no][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(),first_used);
this->close();
}
void DC_Output_Channel::on_pushButton_cancel_clicked()
{
this->close();
}

34
dc_output_channel.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef DC_OUTPUT_CHANNEL_H
#define DC_OUTPUT_CHANNEL_H
#include <QWidget>
#include <QRadioButton>
namespace Ui {
class DC_Output_Channel;
}
class DC_Output_Channel : public QWidget
{
Q_OBJECT
public:
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);
private slots:
void on_pushButton_confirm_clicked();
void on_pushButton_cancel_clicked();
private:
Ui::DC_Output_Channel *ui;
QString unit_str;
int current_index;
int first_used;
int slot_no;
QRadioButton *radiobtn[5];
};
#endif // DC_OUTPUT_CHANNEL_H

225
dc_output_channel.ui Normal file
View File

@ -0,0 +1,225 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DC_Output_Channel</class>
<widget class="QWidget" name="DC_Output_Channel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>527</width>
<height>416</height>
</rect>
</property>
<property name="windowTitle">
<string>输出通道</string>
</property>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>30</x>
<y>50</y>
<width>391</width>
<height>181</height>
</rect>
</property>
<property name="title">
<string>4 - 20 mA 输出</string>
</property>
<widget class="QRadioButton" name="radioButton">
<property name="geometry">
<rect>
<x>40</x>
<y>30</y>
<width>89</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>通道1</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
<widget class="QRadioButton" name="radioButton_2">
<property name="geometry">
<rect>
<x>40</x>
<y>60</y>
<width>89</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>通道2</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
<widget class="QRadioButton" name="radioButton_3">
<property name="geometry">
<rect>
<x>40</x>
<y>90</y>
<width>89</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>通道3</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
<widget class="QRadioButton" name="radioButton_4">
<property name="geometry">
<rect>
<x>40</x>
<y>120</y>
<width>89</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>通道4</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
<widget class="QRadioButton" name="radioButton_5">
<property name="geometry">
<rect>
<x>40</x>
<y>150</y>
<width>89</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>不使用</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</widget>
<widget class="QLineEdit" name="lineEdit_minmum">
<property name="geometry">
<rect>
<x>50</x>
<y>260</y>
<width>113</width>
<height>25</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_maxmum">
<property name="geometry">
<rect>
<x>50</x>
<y>300</y>
<width>113</width>
<height>25</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label_min_unit">
<property name="geometry">
<rect>
<x>190</x>
<y>270</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>- -</string>
</property>
</widget>
<widget class="QLabel" name="label_max_unit">
<property name="geometry">
<rect>
<x>190</x>
<y>310</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>- -</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>280</x>
<y>270</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>最小值</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>280</x>
<y>310</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>最大值</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_confirm">
<property name="geometry">
<rect>
<x>90</x>
<y>360</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>确认</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_cancel">
<property name="geometry">
<rect>
<x>240</x>
<y>360</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui>

422
dc_outputs.cpp Normal file
View File

@ -0,0 +1,422 @@
#include "dc_outputs.h"
#include "ui_dc_outputs.h"
#include <QListView>
#include "dc_output_channel.h"
#include <QDebug>
#include "config_mgr.h"
#include "data_config.h"
#include "vibrationdata.h"
ChannelUsed ch_used[SLOT_NUM][22];
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>(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();
}
DC_Outputs::~DC_Outputs()
{
delete ui;
}
void DC_Outputs::Init(){
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
if (base_ptr == nullptr) {
qCritical() << "[DC_Outputs::Init] should not be here";
return;
}
vib_dc_output_ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
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[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);
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[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);
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[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);
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[slot_no][vib_dc_output_ptr->dc_output[3].output_channel].used[3] = true;
}
}
QString DC_Outputs::GetUnit(int com_index){
int unit_num = -1,channel_num = 0;
QString unit_str = "";
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<VariableBase> 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<RadialVariable> variable_ptr = std::dynamic_pointer_cast<RadialVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
qDebug() << "unit_num1" << unit_num ;
}
if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibAcc) {
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
qDebug() << "unit_num2" << unit_num ;
}
if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibVelocity) {
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
qDebug() << "unit_num3" << unit_num ;
}
if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibThrust) {
std::shared_ptr<ThrustVariable> variable_ptr = std::dynamic_pointer_cast<ThrustVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
qDebug() << "unit_num4" << unit_num ;
}
if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibPressurePulsation) {
std::shared_ptr<PressurePulsationVariable> variable_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
qDebug() << "unit_num5" << unit_num ;
}
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)
{
current_index = index;
QString unit_str = GetUnit(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();
}
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[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();
}else if(channel == 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));
ui->label_ch_2_min_unit->setText(unit_str);
ui->label_ch_2_max_unit->setText(unit_str);
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();
}else if(channel == 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));
ui->label_ch_3_min_unit->setText(unit_str);
ui->label_ch_3_max_unit->setText(unit_str);
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();
}else if(channel == 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));
ui->label_ch_4_min_unit->setText(unit_str);
ui->label_ch_4_max_unit->setText(unit_str);
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();
}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[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_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_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_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;
}
}
}
void DC_Outputs::on_pushButton_confirm_clicked()
{
// 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();
}
void DC_Outputs::on_pushButton_cancel_clicked()
{
this->close();
}
void DC_Outputs::on_comboBox_ch_output_currentIndexChanged(int index)
{
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[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[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[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[slot_no][current_index].used[3] = true;
// }
}

45
dc_outputs.h Normal file
View File

@ -0,0 +1,45 @@
#ifndef DC_OUTPUTS_H
#define DC_OUTPUTS_H
#include <QWidget>
#include "data_config.h"
#include "vibrationdata.h"
namespace Ui {
class DC_Outputs;
}
class DC_Outputs : public QWidget
{
Q_OBJECT
public:
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 on_pushButton_confirm_clicked();
void on_pushButton_cancel_clicked();
void output_channel_data(int channel,float minmun,float maxmum,int not_used);
void on_comboBox_ch_output_currentIndexChanged(int index);
private:
Ui::DC_Outputs *ui;
std::shared_ptr<VibrationData> vib_dc_output_ptr = nullptr;
void Init();
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;
};
#endif // DC_OUTPUTS_H

528
dc_outputs.ui Normal file
View File

@ -0,0 +1,528 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DC_Outputs</class>
<widget class="QWidget" name="DC_Outputs">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>727</width>
<height>450</height>
</rect>
</property>
<property name="windowTitle">
<string>直流输出</string>
</property>
<widget class="QComboBox" name="comboBox_ch_output">
<property name="geometry">
<rect>
<x>60</x>
<y>40</y>
<width>150</width>
<height>25</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>25</height>
</size>
</property>
<item>
<property name="text">
<string>通道1 输出1</string>
</property>
</item>
<item>
<property name="text">
<string>通道2 输出1</string>
</property>
</item>
<item>
<property name="text">
<string>通道3 输出1</string>
</property>
</item>
<item>
<property name="text">
<string>通道4 输出1</string>
</property>
</item>
<item>
<property name="text">
<string>通道1 &amp; 通道2</string>
</property>
</item>
<item>
<property name="text">
<string>通道3 &amp; 通道4</string>
</property>
</item>
<item>
<property name="text">
<string>通道1 分频段1</string>
</property>
</item>
<item>
<property name="text">
<string>通道1 分频段2</string>
</property>
</item>
<item>
<property name="text">
<string>通道1 分频段3</string>
</property>
</item>
<item>
<property name="text">
<string>通道1 分频段4</string>
</property>
</item>
<item>
<property name="text">
<string>通道2 分频段1</string>
</property>
</item>
<item>
<property name="text">
<string>通道2 分频段2</string>
</property>
</item>
<item>
<property name="text">
<string>通道2 分频段3</string>
</property>
</item>
<item>
<property name="text">
<string>通道2 分频段4</string>
</property>
</item>
<item>
<property name="text">
<string>通道3 分频段1</string>
</property>
</item>
<item>
<property name="text">
<string>通道3 分频段2</string>
</property>
</item>
<item>
<property name="text">
<string>通道3 分频段3</string>
</property>
</item>
<item>
<property name="text">
<string>通道3 分频段4</string>
</property>
</item>
<item>
<property name="text">
<string>通道4 分频段1</string>
</property>
</item>
<item>
<property name="text">
<string>通道4 分频段2</string>
</property>
</item>
<item>
<property name="text">
<string>通道4 分频段3</string>
</property>
</item>
<item>
<property name="text">
<string>通道4 分频段4</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>50</x>
<y>160</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>1</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>50</x>
<y>200</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>2</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>50</x>
<y>240</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>3</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>50</x>
<y>280</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>4</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>140</x>
<y>110</y>
<width>101</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>IOC 直流 输出</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>310</x>
<y>110</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>最小值</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>440</x>
<y>110</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>最大值</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_1">
<property name="geometry">
<rect>
<x>160</x>
<y>160</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>未使用</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_2">
<property name="geometry">
<rect>
<x>160</x>
<y>200</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>未使用</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_3">
<property name="geometry">
<rect>
<x>160</x>
<y>240</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>未使用</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_4">
<property name="geometry">
<rect>
<x>160</x>
<y>280</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>未使用</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_1_min">
<property name="geometry">
<rect>
<x>300</x>
<y>160</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>----- </string>
</property>
</widget>
<widget class="QLabel" name="label_ch_2_min">
<property name="geometry">
<rect>
<x>300</x>
<y>200</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-----</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_1_max">
<property name="geometry">
<rect>
<x>420</x>
<y>160</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-----</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_2_max">
<property name="geometry">
<rect>
<x>420</x>
<y>200</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-----</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_3_min">
<property name="geometry">
<rect>
<x>300</x>
<y>240</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-----</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_4_min">
<property name="geometry">
<rect>
<x>300</x>
<y>280</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-----</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_3_max">
<property name="geometry">
<rect>
<x>420</x>
<y>240</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-----</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_4_max">
<property name="geometry">
<rect>
<x>420</x>
<y>280</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-----</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_confirm">
<property name="geometry">
<rect>
<x>160</x>
<y>380</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>确认</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_cancel">
<property name="geometry">
<rect>
<x>340</x>
<y>380</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
<widget class="QLabel" name="label_ch_1_min_unit">
<property name="geometry">
<rect>
<x>340</x>
<y>160</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>----- </string>
</property>
</widget>
<widget class="QLabel" name="label_ch_1_max_unit">
<property name="geometry">
<rect>
<x>460</x>
<y>160</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>----- </string>
</property>
</widget>
<widget class="QLabel" name="label_ch_2_min_unit">
<property name="geometry">
<rect>
<x>340</x>
<y>200</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>----- </string>
</property>
</widget>
<widget class="QLabel" name="label_ch_2_max_unit">
<property name="geometry">
<rect>
<x>460</x>
<y>200</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>----- </string>
</property>
</widget>
<widget class="QLabel" name="label_ch_3_min_unit">
<property name="geometry">
<rect>
<x>340</x>
<y>240</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>----- </string>
</property>
</widget>
<widget class="QLabel" name="label_ch_3_max_unit">
<property name="geometry">
<rect>
<x>460</x>
<y>240</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>----- </string>
</property>
</widget>
<widget class="QLabel" name="label_ch_4_min_unit">
<property name="geometry">
<rect>
<x>340</x>
<y>280</y>
<width>41</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>----- </string>
</property>
</widget>
<widget class="QLabel" name="label_ch_4_max_unit">
<property name="geometry">
<rect>
<x>460</x>
<y>280</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>-----</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>660</width>
<height>580</height>
<width>691</width>
<height>598</height>
</rect>
</property>
<property name="windowTitle">
@ -76,7 +76,7 @@
<widget class="QLabel" name="label_39">
<property name="geometry">
<rect>
<x>300</x>
<x>326</x>
<y>310</y>
<width>41</width>
<height>16</height>
@ -89,7 +89,7 @@
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>296</x>
<x>322</x>
<y>250</y>
<width>51</width>
<height>32</height>
@ -104,7 +104,7 @@
<rect>
<x>10</x>
<y>60</y>
<width>281</width>
<width>301</width>
<height>451</height>
</rect>
</property>
@ -550,7 +550,7 @@
<rect>
<x>10</x>
<y>40</y>
<width>251</width>
<width>281</width>
<height>71</height>
</rect>
</property>
@ -717,7 +717,7 @@
<rect>
<x>10</x>
<y>130</y>
<width>251</width>
<width>281</width>
<height>181</height>
</rect>
</property>
@ -809,7 +809,7 @@
<rect>
<x>140</x>
<y>90</y>
<width>111</width>
<width>131</width>
<height>16</height>
</rect>
</property>
@ -822,7 +822,7 @@
<rect>
<x>140</x>
<y>130</y>
<width>101</width>
<width>131</width>
<height>16</height>
</rect>
</property>
@ -897,7 +897,7 @@
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>294</x>
<x>320</x>
<y>360</y>
<width>51</width>
<height>32</height>
@ -926,9 +926,9 @@
<widget class="QTabWidget" name="tabWidget_2">
<property name="geometry">
<rect>
<x>350</x>
<x>380</x>
<y>60</y>
<width>281</width>
<width>301</width>
<height>451</height>
</rect>
</property>
@ -1374,7 +1374,7 @@
<rect>
<x>10</x>
<y>40</y>
<width>251</width>
<width>281</width>
<height>71</height>
</rect>
</property>
@ -1538,7 +1538,7 @@
<rect>
<x>10</x>
<y>130</y>
<width>251</width>
<width>281</width>
<height>181</height>
</rect>
</property>
@ -1630,7 +1630,7 @@
<rect>
<x>140</x>
<y>90</y>
<width>111</width>
<width>131</width>
<height>16</height>
</rect>
</property>
@ -1643,7 +1643,7 @@
<rect>
<x>140</x>
<y>130</y>
<width>101</width>
<width>121</width>
<height>16</height>
</rect>
</property>

View File

@ -5,12 +5,11 @@
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QInputDialog>
#include "keyphase.h"
#include "singlerelay.h"
#include "tachometer.h"
#include "seismic_monitor.h"
#include "setpoint.h"
#include <QMessageBox>
#include <QFileDialog>
#include <stdio.h>
@ -27,6 +26,9 @@
#include "ethconfig.h"
#include "macconfig.h"
#include <QDateTime>
#include "dc_outputs.h"
#include "mqtt_config.h"
#include <QInputDialog>
QString g_strServerIp;
QString g_version;
@ -35,9 +37,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 = "";
@ -101,6 +100,9 @@ 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);
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();
@ -476,9 +478,12 @@ 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();
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();
break;
}
case kCardSpeedSingle:{
@ -566,12 +571,28 @@ uint8_t calculate_crc(const QByteArray &data) {
}
void MainWindow::on_pushButton_save_clicked() {
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;
QString file_name = filepath + "\\tsi_config_file.json";
file_name = filepath + "\\"+file_name +".json";
ConfigMgr::Instance()->Save(file_name);
tsi_config_file = file_name;
}else {
ConfigMgr::Instance()->Save(tsi_config_file);
}
return;
}
@ -593,7 +614,7 @@ void MainWindow::on_pushButton_open_clicked() {
return;
}
QList<QAbstractButton *> 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++) {
@ -848,7 +869,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 ;
@ -862,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);
}
}
}
@ -893,6 +926,36 @@ 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::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到99之间的数值");
bool ok = false;
int value = QInputDialog::getInt(this, tr("输入整数对话框"), strTips, 0, 0, 99, 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);

View File

@ -76,6 +76,9 @@ private slots:
void onEthConfig();
void onMACConfig();
void onSetTime();
void onMqttConfig();
void onConfigDeviceID();
void onGetDeviceID();
void onMenuActionTriggered();
void on_pushButton_slot_clicked();

View File

@ -254,7 +254,7 @@
</size>
</property>
<property name="text">
<string>触发配置</string>
<string>直流输出</string>
</property>
<property name="checkable">
<bool>true</bool>
@ -724,7 +724,7 @@
</size>
</property>
<property name="text">
<string>电源板</string>
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -1087,6 +1087,9 @@
<addaction name="action_time"/>
<addaction name="action_eth"/>
<addaction name="action_mac"/>
<addaction name="action_mqtt"/>
<addaction name="action_deviveID"/>
<addaction name="action_get_deviceID"/>
</widget>
<addaction name="menu_start"/>
<addaction name="menu_tool"/>
@ -1138,6 +1141,21 @@
<string>MAC配置</string>
</property>
</action>
<action name="action_mqtt">
<property name="text">
<string>MQTT配置</string>
</property>
</action>
<action name="action_deviveID">
<property name="text">
<string>设备ID配置</string>
</property>
</action>
<action name="action_get_deviceID">
<property name="text">
<string>获取设备ID</string>
</property>
</action>
</widget>
<resources/>
<connections/>

53
mqtt_config.cpp Normal file
View File

@ -0,0 +1,53 @@
#include "mqtt_config.h"
#include "ui_mqtt_config.h"
#include <QRegExpValidator>
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();
}

28
mqtt_config.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef MQTT_CONFIG_H
#define MQTT_CONFIG_H
#include <QWidget>
#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

116
mqtt_config.ui Normal file
View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MqttConfig</class>
<widget class="QWidget" name="MqttConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>412</width>
<height>314</height>
</rect>
</property>
<property name="windowTitle">
<string>MQTT 配置</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>140</x>
<y>30</y>
<width>111</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>MQTT 服务器配置</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>60</x>
<y>90</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>IP</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_ip">
<property name="geometry">
<rect>
<x>130</x>
<y>80</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>60</x>
<y>130</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>端口:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_port">
<property name="geometry">
<rect>
<x>130</x>
<y>120</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
</widget>
<widget class="QPushButton" name="pushButton_confirm">
<property name="geometry">
<rect>
<x>90</x>
<y>230</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>确定</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_cancel">
<property name="geometry">
<rect>
<x>210</x>
<y>230</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -4,7 +4,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QMessageBox>
#include "data_config.h"
#include "vibrationdata.h"
#include "config_mgr.h"
@ -58,14 +58,71 @@ 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));
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()
{
@ -74,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<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
ptr->base_config_[channel - 1].channel_type = kVibPressurePulsation;
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
if (variable_base == nullptr || variable_base->type_ != kVibThrust) {
std::shared_ptr<PressurePulsationVariable> variable = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
if (variable_base == nullptr || variable_base->type_ != kVibThrust || variable == nullptr) {
if (variable_base == nullptr) {
qDebug() << "no channel ptr";
} else {
@ -95,20 +160,71 @@ 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();
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;
}
std::shared_ptr<PressurePulsationVariable> variable = std::dynamic_pointer_cast<PressurePulsationVariable>(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();
@ -118,14 +234,66 @@ 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();
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();
}
@ -136,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());
}
}

View File

@ -22,6 +22,8 @@ private slots:
void on_pushButton_cancel_clicked();
void on_lineEdit_alert_high_level_editingFinished();
private:
Ui::PressurePulsation *ui;
void Init();

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QMessageBox>
#include "data_config.h"
#include "vibrationdata.h"
#include "config_mgr.h"
@ -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,71 @@ 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);
// 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);
// Gap
// -general
if(variable_ptr->gap_general.output_used)
ui->comboBox_output_used_2->setCurrentIndex(0);
else
ui->comboBox_output_used_2->setCurrentIndex(1);
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));
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.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.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_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() {
@ -117,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<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
ptr->base_config_[channel - 1].channel_type = kVibRadial;
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
if (variable_base == nullptr || variable_base->type_ != kVibRadial) {
std::shared_ptr<RadialVariable> variable = std::dynamic_pointer_cast<RadialVariable>(variable_base);
if (variable_base == nullptr || variable_base->type_ != kVibRadial || variable == nullptr) {
if (variable_base == nullptr) {
qDebug() << "no channel ptr";
} else {
@ -138,34 +172,69 @@ 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();
// 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();
// 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->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();
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();
// 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();
return;
}
std::shared_ptr<RadialVariable> variable = std::dynamic_pointer_cast<RadialVariable>(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();
@ -175,29 +244,64 @@ 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();
// 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();
// 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->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();
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();
// 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();
}
@ -205,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());
}
}

View File

@ -22,6 +22,8 @@ class Radial : public QWidget {
void on_checkBox_1x_ampl_toggled(bool checked);
void on_checkBox_2x_ampl_toggled(bool checked);
void on_lineEdit_alert_high_level_editingFinished();
private:
Ui::Radial_vibration *ui;

File diff suppressed because it is too large Load Diff

View File

@ -25,18 +25,13 @@ 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>(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();
}
@ -69,41 +64,57 @@ 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->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);
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);
ui->checkBox_keyphase->setChecked(vib_data->base_config_[i].keyphase);
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);
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->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);
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);
ui->checkBox_keyphase_2->setChecked(vib_data->base_config_[i].keyphase);
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);
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->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->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);
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->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->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);
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 +126,11 @@ void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> 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].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();
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 +140,11 @@ void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> 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].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();
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 +154,12 @@ void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> 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].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();
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 +169,10 @@ void Seismic_monitor::UpdateData(std::shared_ptr<VibrationData> 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].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].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();
@ -183,24 +190,29 @@ 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;
}
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<VibrationData> vib_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
UpdateData(vib_data);
@ -313,19 +325,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 +349,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 +369,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 +389,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 +411,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);
@ -490,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);
}

View File

@ -49,6 +49,14 @@ class Seismic_monitor : public QWidget {
void on_comboBox_transducer_name_4_currentTextChanged(const QString &arg1);
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<VibrationData> vib_data);

File diff suppressed because it is too large Load Diff

View File

@ -1,482 +0,0 @@
#include "setpoint.h"
#include "ui_setpoint.h"
#include "config_mgr.h"
#include <QDebug>
#include "displacement_ds.h"
#include "acceleration_ds.h"
#include "velocity_ds.h"
#include <QListView>
#include <QMessageBox>
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>(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<int>::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<CardBase> 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<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
std::shared_ptr<VibrationData> setpoint_data = std::dynamic_pointer_cast<VibrationData>(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<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
std::shared_ptr<VibrationData> setpoint_data = std::dynamic_pointer_cast<VibrationData>(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<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
std::shared_ptr<VibrationData> setpoint_data = std::dynamic_pointer_cast<VibrationData>(base_ptr);
std::vector<std::shared_ptr<VariableBase>> 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<VariableBase> base_channel_ptr = setpoint_data->GetChannelPtr(chan + 1);
std::shared_ptr<AccVelVariable> av_ptr = std::dynamic_pointer_cast<AccVelVariable>(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<VariableBase> base_channel_ptr = setpoint_data->GetChannelPtr(chan + 1);
std::shared_ptr<AccVelVariable> av_ptr = std::dynamic_pointer_cast<AccVelVariable>(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();
}

View File

@ -1,45 +0,0 @@
#ifndef SETPOINT_H
#define SETPOINT_H
#include <QWidget>
#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

View File

@ -1,620 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Setpoint</class>
<widget class="QWidget" name="Setpoint">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>734</width>
<height>528</height>
</rect>
</property>
<property name="windowTitle">
<string>触发配置</string>
</property>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>540</x>
<y>10</y>
<width>161</width>
<height>451</height>
</rect>
</property>
<property name="title">
<string>危险 / 警报 2</string>
</property>
<widget class="QComboBox" name="comboBox_danger">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>69</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>直接值</string>
</property>
</item>
<item>
<property name="text">
<string>1倍频幅值</string>
</property>
</item>
<item>
<property name="text">
<string>2倍频幅值</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label_danger">
<property name="geometry">
<rect>
<x>30</x>
<y>60</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>- -</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_danger">
<property name="geometry">
<rect>
<x>30</x>
<y>415</y>
<width>47</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>启用</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_danger_upper">
<property name="geometry">
<rect>
<x>30</x>
<y>90</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
<widget class="QWidget" name="widget_danger" native="true">
<property name="geometry">
<rect>
<x>10</x>
<y>116</y>
<width>100</width>
<height>260</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>260</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>260</height>
</size>
</property>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>480</y>
<width>666</width>
<height>37</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_20">
<property name="text">
<string>槽位号</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_slot">
<property name="text">
<string>slot</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_chan">
<item>
<property name="text">
<string>通道 1</string>
</property>
</item>
<item>
<property name="text">
<string>通道 2</string>
</property>
</item>
<item>
<property name="text">
<string>通道 3</string>
</property>
</item>
<item>
<property name="text">
<string>通道 4</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_confirm">
<property name="minimumSize">
<size>
<width>100</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>确定</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_set_default">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>设置为默认值</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_cancel">
<property name="minimumSize">
<size>
<width>100</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>取消</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_print">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>打印</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_help">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>帮助</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>521</width>
<height>451</height>
</rect>
</property>
<property name="title">
<string>告警 / 警报 1</string>
</property>
<widget class="QWidget" name="widget_1x_ampl" native="true">
<property name="geometry">
<rect>
<x>100</x>
<y>110</y>
<width>100</width>
<height>260</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>260</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>260</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label_2nd">
<property name="geometry">
<rect>
<x>121</x>
<y>41</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>1倍频幅值</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2nd_upper">
<property name="geometry">
<rect>
<x>121</x>
<y>77</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label_unit_2nd">
<property name="geometry">
<rect>
<x>130</x>
<y>59</y>
<width>50</width>
<height>16</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>- -</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_2nd_lower">
<property name="geometry">
<rect>
<x>120</x>
<y>380</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_2nd">
<property name="geometry">
<rect>
<x>121</x>
<y>420</y>
<width>47</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>启用</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_3rd">
<property name="geometry">
<rect>
<x>221</x>
<y>420</y>
<width>47</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>启用</string>
</property>
</widget>
<widget class="QLabel" name="label_3rd">
<property name="geometry">
<rect>
<x>221</x>
<y>41</y>
<width>54</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>2倍频幅值</string>
</property>
</widget>
<widget class="QLabel" name="label_unit_3rd">
<property name="geometry">
<rect>
<x>230</x>
<y>59</y>
<width>50</width>
<height>16</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>- -</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_3rd_upper">
<property name="geometry">
<rect>
<x>221</x>
<y>77</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
<widget class="QWidget" name="widget_2x_ampl" native="true">
<property name="geometry">
<rect>
<x>200</x>
<y>110</y>
<width>100</width>
<height>260</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>260</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>260</height>
</size>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_3rd_lower">
<property name="geometry">
<rect>
<x>220</x>
<y>380</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_1st_upper">
<property name="geometry">
<rect>
<x>30</x>
<y>80</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QWidget" name="widget_direct" native="true">
<property name="geometry">
<rect>
<x>10</x>
<y>107</y>
<width>100</width>
<height>260</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>260</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>260</height>
</size>
</property>
</widget>
<widget class="QLabel" name="label_1st">
<property name="geometry">
<rect>
<x>40</x>
<y>40</y>
<width>36</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>直接值</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="label_unit_1st">
<property name="geometry">
<rect>
<x>25</x>
<y>60</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>- -</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_1st">
<property name="geometry">
<rect>
<x>30</x>
<y>420</y>
<width>65</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>启用</string>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -112,17 +112,29 @@ void SingleRelay::Init(){
qDebug() << "i" << i;
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(cardbase_ptr);
for (int var = 0; var < CHANNEL_COUNT; ++var) {
std::shared_ptr<VariableBase> 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<<variable_base->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));
@ -150,6 +162,8 @@ void SingleRelay::OnButtonGroup(QAbstractButton *slot_btn) {
int button_id = object_name.right(object_name.length() - 15).toInt();
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
if(ptr == nullptr)
return;
QListWidgetItem *item_and = new QListWidgetItem("AND");
item_and->setData(Qt::UserRole, "*");
list_widget_available->addItem(item_and);
@ -160,24 +174,35 @@ void SingleRelay::OnButtonGroup(QAbstractButton *slot_btn) {
for(int var = 0; var < CHANNEL_COUNT ; ++var){
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
std::shared_ptr<VariableBase> 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);
}
@ -423,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);

View File

@ -39,19 +39,6 @@
<string>确 定</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>750</x>
<y>535</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>NCS6100T</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>

View File

@ -261,19 +261,6 @@
<string>取 消</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>740</x>
<y>600</y>
<width>71</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>NCS6100T</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_sgcc">
<property name="geometry">
<rect>

172
trust.cpp
View File

@ -5,7 +5,7 @@
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QMessageBox>
#include "data_config.h"
#include "vibrationdata.h"
#include "config_mgr.h"
@ -59,21 +59,43 @@ 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);
// gap
// -general
if(variable_ptr->gap_general.output_used)
ui->comboBox_output_used->setCurrentIndex(0);
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));
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->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->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);
}
void Trust::on_pushButton_confirm_clicked()
{
@ -82,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<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
ptr->base_config_[channel - 1].channel_type = kVibThrust;
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
if (variable_base == nullptr || variable_base->type_ != kVibThrust) {
std::shared_ptr<ThrustVariable> variable = std::dynamic_pointer_cast<ThrustVariable>(variable_base);
if (variable_base == nullptr || variable_base->type_ != kVibThrust || variable == nullptr) {
if (variable_base == nullptr) {
qDebug() << "no channel ptr";
} else {
@ -103,24 +141,44 @@ 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();
// gap
// -general
if(ui->comboBox_output_used->currentIndex() == 0)
variable->gap_general.output_used = true;
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();
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;
}
std::shared_ptr<ThrustVariable> variable = std::dynamic_pointer_cast<ThrustVariable>(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();
@ -130,20 +188,40 @@ 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();
// gap
// -general
if(ui->comboBox_output_used->currentIndex() == 0)
variable->gap_general.output_used = true;
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();
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();
}
@ -153,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());
}
}

View File

@ -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();

797
trust.ui
View File

@ -7,11 +7,11 @@
<x>0</x>
<y>0</y>
<width>691</width>
<height>505</height>
<height>525</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
<string>轴向位移</string>
</property>
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
@ -19,7 +19,7 @@
<x>10</x>
<y>60</y>
<width>651</width>
<height>381</height>
<height>391</height>
</rect>
</property>
<property name="currentIndex">
@ -27,7 +27,7 @@
</property>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>传感器和滤波配置</string>
<string>滤波</string>
</attribute>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
@ -273,284 +273,89 @@
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab_6">
<widget class="QWidget" name="tab">
<attribute name="title">
<string>特征值和警报配置</string>
<string>间隙</string>
</attribute>
<widget class="QGroupBox" name="groupBox_11">
<widget class="QTabWidget" name="tabWidget_3">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>411</width>
<x>10</x>
<y>30</y>
<width>621</width>
<height>321</height>
</rect>
</property>
<property name="title">
<string> 特征值</string>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QLabel" name="label_71">
<widget class="QWidget" name="tab_8">
<attribute name="title">
<string>常规</string>
</attribute>
<widget class="QLabel" name="label_27">
<property name="geometry">
<rect>
<x>20</x>
<x>230</x>
<y>50</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>直接值</string>
</property>
</widget>
<widget class="QLabel" name="label_72">
<property name="geometry">
<rect>
<x>20</x>
<y>80</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>间隙</string>
<string>输出使用</string>
</property>
</widget>
<widget class="QLabel" name="label_73">
<widget class="QLabel" name="label_28">
<property name="geometry">
<rect>
<x>141</x>
<y>31</y>
<width>48</width>
<x>230</x>
<y>100</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>取值范围</string>
<string>工程单位</string>
</property>
</widget>
<widget class="QLabel" name="label_74">
<property name="geometry">
<rect>
<x>260</x>
<y>31</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string> 默认值</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_direct_value_range">
<property name="geometry">
<rect>
<x>130</x>
<y>50</y>
<width>111</width>
<height>22</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>25-0-25 mil</string>
</property>
</item>
<item>
<property name="text">
<string>30-0-30 mil</string>
</property>
</item>
<item>
<property name="text">
<string>40-0-40 mil</string>
</property>
</item>
<item>
<property name="text">
<string>0.5-0-0.5 mm</string>
</property>
</item>
<item>
<property name="text">
<string>1.0-0-1.0 mm</string>
</property>
</item>
<item>
<property name="text">
<string>自定义</string>
</property>
</item>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_direct_clamp">
<property name="geometry">
<rect>
<x>260</x>
<y>50</y>
<width>62</width>
<height>22</height>
</rect>
</property>
<property name="decimals">
<number>0</number>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_gap_clamp">
<property name="geometry">
<rect>
<x>260</x>
<y>80</y>
<width>62</width>
<height>22</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
</widget>
<widget class="QComboBox" name="comboBox_gap_range">
<property name="geometry">
<rect>
<x>130</x>
<y>80</y>
<width>111</width>
<height>22</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>-24 Vdc</string>
</property>
</item>
<item>
<property name="text">
<string>自定义</string>
</property>
</item>
</widget>
<widget class="QGroupBox" name="groupBox_12">
<widget class="QComboBox" name="comboBox_output_used">
<property name="geometry">
<rect>
<x>10</x>
<y>190</y>
<width>201</width>
<height>101</height>
<y>40</y>
<width>150</width>
<height>25</height>
</rect>
</property>
<property name="title">
<string> 延时</string>
<property name="minimumSize">
<size>
<width>150</width>
<height>25</height>
</size>
</property>
<widget class="QLabel" name="label_78">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>54</width>
<height>12</height>
</rect>
<property name="maximumSize">
<size>
<width>150</width>
<height>25</height>
</size>
</property>
<item>
<property name="text">
<string> 告警</string>
</property>
</widget>
<widget class="QLabel" name="label_79">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>54</width>
<height>12</height>
</rect>
<string>是</string>
</property>
</item>
<item>
<property name="text">
<string> 危险</string>
<string>否</string>
</property>
</item>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_danger">
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>60</x>
<y>50</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>99.900000000000006</double>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_100ms">
<property name="geometry">
<rect>
<x>60</x>
<y>80</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>100 ms</string>
</property>
</widget>
<widget class="QLabel" name="label_80">
<property name="geometry">
<rect>
<x>130</x>
<y>20</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>1 - 60s</string>
</property>
</widget>
<widget class="QLabel" name="label_81">
<property name="geometry">
<rect>
<x>130</x>
<y>50</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>1.0 - 60.0s</string>
</property>
</widget>
<widget class="QSpinBox" name="spinBox_alert">
<property name="geometry">
<rect>
<x>60</x>
<y>20</y>
<width>61</width>
<height>21</height>
</rect>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>220</x>
<y>190</y>
<x>10</x>
<y>180</y>
<width>171</width>
<height>101</height>
</rect>
@ -571,13 +376,13 @@
<number>2</number>
</property>
<property name="minimum">
<double>1.000000000000000</double>
<double>-50.000000000000000</double>
</property>
<property name="maximum">
<double>99.900000000000006</double>
<double>50.000000000000000</double>
</property>
</widget>
<widget class="QLabel" name="label">
<widget class="QLabel" name="label_31">
<property name="geometry">
<rect>
<x>80</x>
@ -587,7 +392,7 @@
</rect>
</property>
<property name="text">
<string>0 - 13.99 V</string>
<string>-50 - 50 V</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_negation">
@ -604,100 +409,456 @@
</property>
</widget>
</widget>
</widget>
<widget class="QCheckBox" name="checkBox_alert_latching">
<widget class="QComboBox" name="comboBox_engineering_unit">
<property name="geometry">
<rect>
<x>470</x>
<y>20</y>
<width>131</width>
<height>16</height>
<x>10</x>
<y>90</y>
<width>150</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>告警锁定</string>
<property name="minimumSize">
<size>
<width>150</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>25</height>
</size>
</property>
<item>
<property name="text">
<string>g</string>
</property>
</item>
<item>
<property name="text">
<string>m/s**2</string>
</property>
</item>
<item>
<property name="text">
<string>mm/s</string>
</property>
</item>
<item>
<property name="text">
<string>inch/s</string>
</property>
</item>
<item>
<property name="text">
<string>um</string>
</property>
</item>
<item>
<property name="text">
<string>mm</string>
</property>
</item>
<item>
<property name="text">
<string>mils</string>
</property>
</item>
<item>
<property name="text">
<string>inch/s**2</string>
</property>
</item>
</widget>
<widget class="QCheckBox" name="checkBox_danger_latching">
<widget class="QLabel" name="label_26">
<property name="geometry">
<rect>
<x>470</x>
<y>40</y>
<width>131</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>危险锁定</string>
</property>
</widget>
<widget class="QLabel" name="label_84">
<property name="geometry">
<rect>
<x>460</x>
<y>130</y>
<width>54</width>
<height>12</height>
</rect>
</property>
<property name="text">
<string>记录输出</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_recorder_output">
<property name="geometry">
<rect>
<x>460</x>
<x>230</x>
<y>150</y>
<width>141</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>无</string>
</property>
</item>
<item>
<property name="text">
<string>直接幅值</string>
</property>
</item>
<item>
<property name="text">
<string>间隙</string>
</property>
</item>
</widget>
<widget class="QCheckBox" name="checkBox_two_ma_clamp">
<property name="geometry">
<rect>
<x>460</x>
<y>180</y>
<width>91</width>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>2 mA 默认值</string>
</property>
<property name="checked">
<bool>true</bool>
<string>整流器</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_timed_ok">
<widget class="QComboBox" name="comboBox_rectifier_funtion">
<property name="geometry">
<rect>
<x>470</x>
<x>10</x>
<y>140</y>
<width>150</width>
<height>25</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>25</height>
</size>
</property>
<item>
<property name="text">
<string>AVG</string>
</property>
</item>
</widget>
</widget>
<widget class="QWidget" name="tab_9">
<attribute name="title">
<string> 警报</string>
</attribute>
<widget class="QLabel" name="label_36">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>181</width>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string> Timed OK channel Defeat</string>
<string>危险 + 高</string>
</property>
</widget>
<widget class="QLabel" name="label_37">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>警报 + 高</string>
</property>
</widget>
<widget class="QLabel" name="label_38">
<property name="geometry">
<rect>
<x>10</x>
<y>140</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>警报 + 低</string>
</property>
</widget>
<widget class="QLabel" name="label_39">
<property name="geometry">
<rect>
<x>10</x>
<y>180</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>危险 + 低</string>
</property>
</widget>
<widget class="QLabel" name="label_40">
<property name="geometry">
<rect>
<x>90</x>
<y>30</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>等级</string>
</property>
</widget>
<widget class="QLabel" name="label_41">
<property name="geometry">
<rect>
<x>170</x>
<y>30</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>回差</string>
</property>
</widget>
<widget class="QLabel" name="label_42">
<property name="geometry">
<rect>
<x>230</x>
<y>30</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>延时</string>
</property>
</widget>
<widget class="QLabel" name="label_43">
<property name="geometry">
<rect>
<x>280</x>
<y>40</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string> 使能</string>
</property>
</widget>
<widget class="QLabel" name="label_44">
<property name="geometry">
<rect>
<x>340</x>
<y>40</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string> 锁存</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_danger_high_level">
<property name="geometry">
<rect>
<x>80</x>
<y>60</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_danger_high_hysteresis">
<property name="geometry">
<rect>
<x>150</x>
<y>60</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_danger_high_delay">
<property name="geometry">
<rect>
<x>220</x>
<y>60</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_alert_high_delay">
<property name="geometry">
<rect>
<x>220</x>
<y>100</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_alert_high_level">
<property name="geometry">
<rect>
<x>80</x>
<y>100</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_alert_high_hysteresis">
<property name="geometry">
<rect>
<x>150</x>
<y>100</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_alert_low_delay">
<property name="geometry">
<rect>
<x>220</x>
<y>140</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_danger_low_hysteresis">
<property name="geometry">
<rect>
<x>150</x>
<y>180</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_alert_low_level">
<property name="geometry">
<rect>
<x>80</x>
<y>140</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_danger_low_delay">
<property name="geometry">
<rect>
<x>220</x>
<y>180</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_danger_low_level">
<property name="geometry">
<rect>
<x>80</x>
<y>180</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit_alert_low_hysteresis">
<property name="geometry">
<rect>
<x>150</x>
<y>140</y>
<width>51</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_danger_high_enable">
<property name="geometry">
<rect>
<x>290</x>
<y>60</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_alert_high_enable">
<property name="geometry">
<rect>
<x>290</x>
<y>100</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_alert_low_enable">
<property name="geometry">
<rect>
<x>290</x>
<y>140</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_danger_low_enable">
<property name="geometry">
<rect>
<x>290</x>
<y>180</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_alert_high_latch">
<property name="geometry">
<rect>
<x>350</x>
<y>100</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_danger_low_latch">
<property name="geometry">
<rect>
<x>350</x>
<y>180</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_danger_high_latch">
<property name="geometry">
<rect>
<x>350</x>
<y>60</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_alert_low_latch">
<property name="geometry">
<rect>
<x>350</x>
<y>140</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
@ -705,7 +866,7 @@
<rect>
<x>21</x>
<y>10</y>
<width>105</width>
<width>131</width>
<height>17</height>
</rect>
</property>
@ -737,7 +898,7 @@
<property name="geometry">
<rect>
<x>20</x>
<y>450</y>
<y>470</y>
<width>632</width>
<height>37</height>
</rect>

View File

@ -9,6 +9,7 @@
#include "data_config.h"
#include "vibrationdata.h"
#include "config_mgr.h"
#include <QMessageBox>
Velocity::Velocity(int slot_no_, int channel_, bool active, QWidget *parent)
: QWidget(parent)
@ -32,92 +33,10 @@ Velocity::~Velocity() {
delete ui;
}
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() {
this->close();
}
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() {
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
if (base_ptr == nullptr) {
@ -144,32 +63,41 @@ 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);
// 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);
}
void Velocity::on_pushButton_confirm_clicked() {
@ -178,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<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
ptr->base_config_[channel - 1].channel_type = kVibVelocity;
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(channel);
if (variable_base == nullptr || variable_base->type_ != kVibVelocity) {
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
if (variable_base == nullptr || variable_base->type_ != kVibVelocity || variable == nullptr) {
if (variable_base == nullptr) {
qDebug() << "no channel ptr";
} else {
@ -199,37 +135,39 @@ 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();
// 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();
ptr->variables_.push_back(variable);
this->close();
return;
}
std::shared_ptr<AccVelVariable> variable = std::dynamic_pointer_cast<AccVelVariable>(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();
@ -239,31 +177,42 @@ 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();
// 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();
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());
}
}

View File

@ -20,10 +20,8 @@ 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);
void on_lineEdit_alert_high_level_editingFinished();
private:
Ui::Velocity *ui;

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@ class VibrationData : public CardBase {
std::vector<std::shared_ptr<VariableBase>> variables_;
VibAlertDanger alert_danger[CHANNEL_COUNT];
VibAlertDangerPress alert_danger_press[CHANNEL_COUNT];
DCOutput dc_output[CHANNEL_COUNT];
};
#endif // VIBRATIONDATA_H