refine codes.

This commit is contained in:
pandx 2025-03-28 15:32:39 +08:00
parent 3dd25ff15b
commit 6c6acfea62
14 changed files with 290 additions and 131 deletions

View File

@ -26,17 +26,17 @@ Acceleration::Acceleration(int slot_no_, int channel_, bool active, QWidget *par
QString filePath_variables = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\acceleration_variables_%2.json").arg(slot_no).arg(channel);
readJsonFile(filePath_variables);
Init();
connect(ui->checkBox_1x_ampl, &QCheckBox::toggled, this, &Acceleration::on_1x_ampl_toggled);
connect(ui->checkBox_2x_ampl, &QCheckBox::toggled, this, &Acceleration::on_2x_ampl_toggled);
connect(ui->checkBox_rms, &QCheckBox::toggled, this, &Acceleration::on_rms_toggled);
connect(ui->checkBox_integrate, &QCheckBox::toggled, this, &Acceleration::on_integrate_toggled);
// connect(ui->checkBox_1x_ampl, &QCheckBox::toggled, this, &Acceleration::on_1x_ampl_toggled);
// connect(ui->checkBox_2x_ampl, &QCheckBox::toggled, this, &Acceleration::on_2x_ampl_toggled);
// connect(ui->checkBox_rms, &QCheckBox::toggled, this, &Acceleration::on_rms_toggled);
// connect(ui->checkBox_integrate, &QCheckBox::toggled, this, &Acceleration::on_integrate_toggled);
}
Acceleration::~Acceleration() {
delete ui;
}
void Acceleration::on_rms_toggled(bool checked) {
void Acceleration::on_checkBox_rms_toggled(bool checked) {
// TODO: 自定义的回调
if (checked) {
if (ui->checkBox_integrate->isChecked()) {
@ -89,7 +89,7 @@ void Acceleration::on_rms_toggled(bool checked) {
}
}
void Acceleration::on_integrate_toggled(bool checked) {
void Acceleration::on_checkBox_integrate_toggled(bool checked) {
// TODO: 自定义的回调
if (checked) {
if (ui->checkBox_rms->isChecked()) {
@ -142,7 +142,7 @@ void Acceleration::on_integrate_toggled(bool checked) {
}
}
void Acceleration::on_1x_ampl_toggled(bool checked) {
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);
@ -154,7 +154,7 @@ void Acceleration::on_1x_ampl_toggled(bool checked) {
ui->doubleSpinBox_1x_phase_lag_clamp->setEnabled(false);
}
void Acceleration::on_2x_ampl_toggled(bool checked) {
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);
@ -201,19 +201,19 @@ void Acceleration::readJsonFile(const QString &filePath) {
QJsonObject temp_obj = variables_array[i].toObject();
variables[i].type = temp_obj["type"].toString();
if (variables[i].type == "direct") {
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
} else if (variables[i].type == "bias_volt") {
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].bias_voltage = temp_obj["bias_voltage"].toInt();
} else if (variables[i].type == "1x_ampl") {
variables[i].checked = temp_obj["checked"].toBool();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].phase_lag = temp_obj["phase_lag"].toDouble();
} else if (variables[i].type == "2x_ampl") {
variables[i].checked = temp_obj["checked"].toBool();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].phase_lag = temp_obj["phase_lag"].toDouble();
}
@ -227,7 +227,7 @@ void Acceleration::readJsonFile(const QString &filePath) {
alert_variables.alert_latching = json_obj["alert_latching"].toBool();
alert_variables.danger_latching = json_obj["danger_latching"].toBool();
alert_variables.timed_ok = json_obj["timed_ok"].toBool();
alert_variables.recorder_output = json_obj["recorder_output"].toString();
alert_variables.recorder_output = json_obj["recorder_output"].toInt();
alert_variables.two_ma_clamp = json_obj["two_ma_clamp"].toBool();
alert_variables.trip_multiply = json_obj["trip_multiply"].toDouble();
alert_variables.comparision = json_obj["comparision"].toString();
@ -254,17 +254,17 @@ void Acceleration::Init() {
}
for (int i = 0; i < 4; i++) {
if (variables[i].type == "direct") {
ui->comboBox_direct_value_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_direct_value_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_direct_clamp->setValue(variables[i].clamp_value);
} else if (variables[i].type == "bias_volt") {
ui->label_bias_voltage->setText(QString::number(variables[i].bias_voltage));
ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value);
} else if (variables[i].type == "1x_ampl") {
ui->comboBox_1x_value_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_1x_value_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_1x_ampl_clamp->setValue(variables[i].clamp_value);
ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variables[i].clamp_value);
} else if (variables[i].type == "2x_ampl") {
ui->comboBox_2x_value_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_2x_value_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_2x_ampl_clamp->setValue(variables[i].clamp_value);
ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variables[i].clamp_value);
}
@ -277,7 +277,7 @@ void Acceleration::Init() {
ui->checkBox_alert_latching->setChecked(alert_variables.alert_latching);
ui->checkBox_danger_latching->setChecked(alert_variables.danger_latching);
ui->checkBox_timed_ok->setChecked(alert_variables.timed_ok);
ui->comboBox_recorder_output->setCurrentText(alert_variables.recorder_output);
ui->comboBox_recorder_output->setCurrentIndex(alert_variables.recorder_output);
ui->checkBox_two_ma_clamp->setChecked(alert_variables.two_ma_clamp);
ui->doubleSpinBox_trip_multiply->setValue(alert_variables.trip_multiply);
ui->comboBox_comparision->setCurrentText(alert_variables.comparision);
@ -302,18 +302,18 @@ void Acceleration::on_pushButton_confirm_clicked() {
}
for (int i = 0; i < 4; i++) {
if (variables[i].type == "direct") {
variables[i].full_sacle_range = ui->comboBox_direct_value_range->currentText();
variables[i].full_sacle_range = ui->comboBox_direct_value_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_direct_clamp->value();
} else if (variables[i].type == "bias_volt") {
variables[i].clamp_value = ui->doubleSpinBox_bias_volt_clamp->value();
} else if (variables[i].type == "1x_ampl") {
variables[i].checked = ui->checkBox_1x_ampl->isChecked();
variables[i].full_sacle_range = ui->comboBox_1x_value_range->currentText();
variables[i].full_sacle_range = ui->comboBox_1x_value_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value();
variables[i].clamp_value = ui->doubleSpinBox_1x_phase_lag_clamp->value();
} else if (variables[i].type == "2x_ampl") {
variables[i].checked = ui->checkBox_2x_ampl->isChecked();
variables[i].full_sacle_range = ui->comboBox_2x_value_range->currentText();
variables[i].full_sacle_range = ui->comboBox_2x_value_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value();
variables[i].clamp_value = ui->doubleSpinBox_2x_phase_lag_clamp->value();
}
@ -326,7 +326,7 @@ void Acceleration::on_pushButton_confirm_clicked() {
alert_variables.alert_latching = ui->checkBox_alert_latching->isChecked();
alert_variables.danger_latching = ui->checkBox_danger_latching->isChecked();
alert_variables.timed_ok = ui->checkBox_timed_ok->isChecked();
alert_variables.recorder_output = ui->comboBox_recorder_output->currentText();
alert_variables.recorder_output = ui->comboBox_recorder_output->currentIndex();
alert_variables.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked();
alert_variables.trip_multiply = ui->doubleSpinBox_trip_multiply->value();
alert_variables.comparision = ui->comboBox_comparision->currentText();

View File

@ -23,10 +23,10 @@ class Acceleration : public QWidget {
void on_pushButton_set_default_clicked();
void on_pushButton_cancel_clicked();
void on_1x_ampl_toggled(bool checked);
void on_2x_ampl_toggled(bool checked);
void on_rms_toggled(bool checked);
void on_integrate_toggled(bool checked);
void on_checkBox_1x_ampl_toggled(bool checked);
void on_checkBox_2x_ampl_toggled(bool checked);
void on_checkBox_rms_toggled(bool checked);
void on_checkBox_integrate_toggled(bool checked);
private:
Ui::Acceleration *ui;

View File

@ -107,7 +107,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -982,17 +982,12 @@
</property>
<item>
<property name="text">
<string>None</string>
<string></string>
</property>
</item>
<item>
<property name="text">
<string>直接值</string>
</property>
</item>
<item>
<property name="text">
<string>偏置电压</string>
<string>直接幅值</string>
</property>
</item>
<item>
@ -1002,7 +997,12 @@
</item>
<item>
<property name="text">
<string>1倍频相位</string>
<string>带回滞1倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞1倍频相位</string>
</property>
</item>
<item>
@ -1012,7 +1012,12 @@
</item>
<item>
<property name="text">
<string>2倍频相位</string>
<string>带回滞2倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞2倍频相位</string>
</property>
</item>
</widget>
@ -1056,6 +1061,9 @@
</property>
</widget>
<widget class="QSpinBox" name="spinBox_comparision_percentage">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>460</x>
@ -1066,6 +1074,9 @@
</property>
</widget>
<widget class="QComboBox" name="comboBox_comparision">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>460</x>
@ -1076,17 +1087,12 @@
</property>
<item>
<property name="text">
<string>None</string>
<string></string>
</property>
</item>
<item>
<property name="text">
<string>直接值</string>
</property>
</item>
<item>
<property name="text">
<string>偏置电压</string>
<string>直接幅值</string>
</property>
</item>
<item>
@ -1096,7 +1102,12 @@
</item>
<item>
<property name="text">
<string>1倍频相位</string>
<string>带回滞1倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞1倍频相位</string>
</property>
</item>
<item>
@ -1106,7 +1117,12 @@
</item>
<item>
<property name="text">
<string>2倍频相位</string>
<string>带回滞2倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞2倍频相位</string>
</property>
</item>
</widget>

View File

@ -35,4 +35,16 @@ typedef enum {
kAccVelRMSCustom = 2 // custom
} AccVelRMSFullScaleRange;
// recorder out
typedef enum {
kAccRecorderOutNone = 0,
kAccRecorderOutDirectAmpl = 1,
kAccRecorderOut1XAmpl = 2,
kAccRecorderOut1XPhaseLagWithHysteresis = 3,
kAccRecorderOut1XPhaseLagWithoutHysteresis = 4,
kAccRecorderOut2XAmpl = 5,
kAccRecorderOut2XPhaseLagWithHysteresis = 6,
kAccRecorderOut2XPhaseLagWithoutHysteresis = 7,
} AccRecorderOut;
#endif // ACCELERATION_DS_H

View File

@ -55,11 +55,12 @@ typedef struct {
typedef struct {
QString type;
QString full_sacle_range;
int full_sacle_range;
int bias_voltage;
float clamp_value;
int phase_lag;
bool checked;
float custom;
} Variables;
typedef struct {
@ -73,7 +74,7 @@ typedef struct {
bool alert_latching;
bool danger_latching;
bool timed_ok;
QString recorder_output;
int recorder_output;
bool two_ma_clamp;
float trip_multiply;
QString comparision;

View File

@ -10,4 +10,19 @@ typedef enum {
kDisPPCustom = 5 // custom
} DisPPFullScaleRange;
// recorder out
typedef enum {
kDisRecorderOutNone = 0,
kDisRecorderOutDirectAmpl = 1,
kDisRecorderOutGap = 2,
kDisRecorderOut1XAmpl = 3,
kDisRecorderOut1XPhaseLagWithHysteresis = 4,
kDisRecorderOut1XPhaseLagWithoutHysteresis = 5,
kDisRecorderOut2XAmpl = 6,
kDisRecorderOut2XPhaseLagWithHysteresis = 7,
kDisRecorderOut2XPhaseLagWithoutHysteresis = 8,
kDisRecorderOutNot1XAmpl = 9,
kDisRecorderOutSmaxAmpl = 10
} DisRecorderOut;
#endif // DISPLACEMENT_DS_H

View File

@ -26,10 +26,10 @@ Radial_vibration::Radial_vibration(int slot_no_, int channel_, bool active, QWid
QString filePath_variables = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\radial_vibration_variables_%2.json").arg(slot_no).arg(channel);
readJsonFile(filePath_variables);
Init();
connect(ui->checkBox_1x_ampl, &QCheckBox::toggled, this, &Radial_vibration::on_1x_ampl_toggled);
connect(ui->checkBox_2x_ampl, &QCheckBox::toggled, this, &Radial_vibration::on_2x_ampl_toggled);
connect(ui->checkBox_not_1x_ampl, &QCheckBox::toggled, this, &Radial_vibration::on_not1x_ampl_toggled);
connect(ui->checkBox_smax_ampl, &QCheckBox::toggled, this, &Radial_vibration::on_smax_ampl_toggled);
// connect(ui->checkBox_1x_ampl, &QCheckBox::toggled, this, &Radial_vibration::on_1x_ampl_toggled);
// connect(ui->checkBox_2x_ampl, &QCheckBox::toggled, this, &Radial_vibration::on_2x_ampl_toggled);
// connect(ui->checkBox_not_1x_ampl, &QCheckBox::toggled, this, &Radial_vibration::on_not1x_ampl_toggled);
// connect(ui->checkBox_smax_ampl, &QCheckBox::toggled, this, &Radial_vibration::on_smax_ampl_toggled);
}
Radial_vibration::~Radial_vibration() {
@ -40,7 +40,7 @@ void Radial_vibration::on_pushButton_cancel_clicked() {
this->close();
}
void Radial_vibration::on_1x_ampl_toggled(bool checked) {
void Radial_vibration::on_checkBox_1x_ampl_toggled(bool checked) {
if (checked) {
ui->comboBox_1x_value_range->setEnabled(true);
ui->doubleSpinBox_1x_ampl_clamp->setEnabled(true);
@ -52,7 +52,7 @@ void Radial_vibration::on_1x_ampl_toggled(bool checked) {
ui->doubleSpinBox_1x_phase_lag_clamp->setEnabled(false);
}
void Radial_vibration::on_2x_ampl_toggled(bool checked) {
void Radial_vibration::on_checkBox_2x_ampl_toggled(bool checked) {
if (checked) {
ui->comboBox_2x_value_range->setEnabled(true);
ui->doubleSpinBox_2x_ampl_clamp->setEnabled(true);
@ -64,7 +64,7 @@ void Radial_vibration::on_2x_ampl_toggled(bool checked) {
ui->doubleSpinBox_2x_phase_lag_clamp->setEnabled(false);
}
void Radial_vibration::on_not1x_ampl_toggled(bool checked) {
void Radial_vibration::on_checkBox_not_1x_ampl_toggled(bool checked) {
if (checked) {
ui->comboBox_not_1x_ampl->setEnabled(true);
ui->doubleSpinBox_not_1x_ampl_clamp->setEnabled(true);
@ -74,7 +74,7 @@ void Radial_vibration::on_not1x_ampl_toggled(bool checked) {
ui->doubleSpinBox_not_1x_ampl_clamp->setEnabled(false);
}
void Radial_vibration::on_smax_ampl_toggled(bool checked) {
void Radial_vibration::on_checkBox_smax_ampl_toggled(bool checked) {
if (checked) {
ui->comboBox_smax_range->setEnabled(true);
ui->doubleSpinBox_smax_clamp->setEnabled(true);
@ -119,24 +119,24 @@ void Radial_vibration::readJsonFile(const QString &filePath) {
QJsonObject temp_obj = variables_array[i].toObject();
variables[i].type = temp_obj["type"].toString();
if (variables[i].type == "direct") {
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
} else if (variables[i].type == "bias_volt") {
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
} else if (variables[i].type == "1x_ampl" || variables[i].type == "2x_ampl") {
variables[i].checked = temp_obj["checked"].toBool();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].phase_lag = temp_obj["phase_lag"].toDouble();
} else if (variables[i].type == "not_1x_ampl") {
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].checked = temp_obj["checked"].toBool();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
} else if (variables[i].type == "smax_ampl") {
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].checked = temp_obj["checked"].toBool();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
}
}
QJsonObject delay_obj = json_obj["delay"].toObject();
@ -146,7 +146,7 @@ void Radial_vibration::readJsonFile(const QString &filePath) {
alert_variables.alert_latching = json_obj["alert_latching"].toBool();
alert_variables.danger_latching = json_obj["danger_latching"].toBool();
alert_variables.timed_ok = json_obj["timed_ok"].toBool();
alert_variables.recorder_output = json_obj["recorder_output"].toString();
alert_variables.recorder_output = json_obj["recorder_output"].toInt();
alert_variables.two_ma_clamp = json_obj["two_ma_clamp"].toBool();
alert_variables.trip_multiply = json_obj["trip_multiply"].toDouble();
alert_variables.comparision = json_obj["comparision"].toString();
@ -172,28 +172,28 @@ void Radial_vibration::Init() {
}
for (int i = 0; i < 6; i++) {
if (variables[i].type == "direct") {
ui->comboBox_direct_value_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_direct_value_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_direct_clamp->setValue(variables[i].clamp_value);
} else if (variables[i].type == "gap") {
ui->comboBox_gap_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_gap_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_gap_clamp->setValue(variables[i].clamp_value);
} else if (variables[i].type == "1x_ampl") {
ui->checkBox_1x_ampl->setChecked(variables[i].checked);
ui->comboBox_1x_value_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_1x_value_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_1x_ampl_clamp->setValue(variables[i].clamp_value);
ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variables[i].phase_lag);
} else if (variables[i].type == "2x_ampl") {
ui->checkBox_2x_ampl->setChecked(variables[i].checked);
ui->comboBox_2x_value_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_2x_value_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_2x_ampl_clamp->setValue(variables[i].clamp_value);
ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variables[i].phase_lag);
} else if (variables[i].type == "not_1x_ampl") {
ui->checkBox_not_1x_ampl->setChecked(variables[i].checked);
ui->comboBox_not_1x_ampl->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_not_1x_ampl->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_not_1x_ampl_clamp->setValue(variables[i].clamp_value);
} else if (variables[i].type == "smax_ampl") {
ui->checkBox_smax_ampl->setChecked(variables[i].checked);
ui->comboBox_smax_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_smax_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_smax_clamp->setValue(variables[i].clamp_value);
}
}
@ -202,7 +202,7 @@ void Radial_vibration::Init() {
ui->checkBox_100ms_delay->setChecked(delay.active_100ms);
ui->checkBox_alert_latching->setChecked(alert_variables.alert_latching);
ui->checkBox_danger_latching->setChecked(alert_variables.danger_latching);
ui->comboBox_recorder_output->setCurrentText(alert_variables.recorder_output);
ui->comboBox_recorder_output->setCurrentIndex(alert_variables.recorder_output);
ui->checkBox_two_ma_clamp->setChecked(alert_variables.two_ma_clamp);
ui->doubleSpinBox_trip_multiply->setValue(alert_variables.trip_multiply);
ui->comboBox_comparision->setCurrentText(alert_variables.comparision);
@ -229,28 +229,28 @@ void Radial_vibration::on_pushButton_confirm_clicked() {
}
for (int i = 0; i < 6; i++) {
if (variables[i].type == "direct") {
variables[i].full_sacle_range = ui->comboBox_direct_value_range->currentText();
variables[i].full_sacle_range = ui->comboBox_direct_value_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_direct_clamp->value();
} else if (variables[i].type == "gap") {
variables[i].full_sacle_range = ui->comboBox_gap_range->currentText();
variables[i].full_sacle_range = ui->comboBox_gap_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_gap_clamp->value();
} else if (variables[i].type == "1x_ampl") {
variables[i].checked = ui->checkBox_1x_ampl->isChecked();
variables[i].full_sacle_range = ui->comboBox_1x_value_range->currentText();
variables[i].full_sacle_range = ui->comboBox_1x_value_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value();
variables[i].phase_lag = ui->doubleSpinBox_1x_phase_lag_clamp->value();
} else if (variables[i].type == "2x_ampl") {
variables[i].checked = ui->checkBox_2x_ampl->isChecked();
variables[i].full_sacle_range = ui->comboBox_2x_value_range->currentText();
variables[i].full_sacle_range = ui->comboBox_2x_value_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value();
variables[i].phase_lag = ui->doubleSpinBox_2x_phase_lag_clamp->value();
} else if (variables[i].type == "not_1x_ampl") {
variables[i].checked = ui->checkBox_not_1x_ampl->isChecked();
variables[i].full_sacle_range = ui->comboBox_not_1x_ampl->currentText();
variables[i].full_sacle_range = ui->comboBox_not_1x_ampl->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_not_1x_ampl_clamp->value();
} else if (variables[i].type == "smax_ampl") {
variables[i].checked = ui->checkBox_smax_ampl->isChecked();
variables[i].full_sacle_range = ui->comboBox_smax_range->currentText();
variables[i].full_sacle_range = ui->comboBox_smax_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_smax_clamp->value();
}
}
@ -259,7 +259,7 @@ void Radial_vibration::on_pushButton_confirm_clicked() {
delay.active_100ms = ui->checkBox_100ms_delay->isChecked();
alert_variables.alert_latching = ui->checkBox_alert_latching->isChecked();
alert_variables.danger_latching = ui->checkBox_danger_latching->isChecked();
alert_variables.recorder_output = ui->comboBox_recorder_output->currentText();
alert_variables.recorder_output = ui->comboBox_recorder_output->currentIndex();
alert_variables.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked();
alert_variables.trip_multiply = ui->doubleSpinBox_trip_multiply->value();
alert_variables.comparision = ui->comboBox_comparision->currentText();

View File

@ -20,10 +20,10 @@ class Radial_vibration : public QWidget {
void on_pushButton_cancel_clicked();
void on_pushButton_set_default_clicked();
void on_1x_ampl_toggled(bool checked);
void on_2x_ampl_toggled(bool checked);
void on_not1x_ampl_toggled(bool checked);
void on_smax_ampl_toggled(bool checked);
void on_checkBox_1x_ampl_toggled(bool checked);
void on_checkBox_2x_ampl_toggled(bool checked);
void on_checkBox_not_1x_ampl_toggled(bool checked);
void on_checkBox_smax_ampl_toggled(bool checked);
private:
Ui::Radial_vibration *ui;

View File

@ -1034,12 +1034,12 @@
</property>
<item>
<property name="text">
<string>None</string>
<string></string>
</property>
</item>
<item>
<property name="text">
<string>直接值</string>
<string>直接值</string>
</property>
</item>
<item>
@ -1054,7 +1054,12 @@
</item>
<item>
<property name="text">
<string>1倍频相位</string>
<string>带回滞1倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞1倍频相位</string>
</property>
</item>
<item>
@ -1064,7 +1069,12 @@
</item>
<item>
<property name="text">
<string>2倍频相位</string>
<string>带回滞2倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞2倍频相位</string>
</property>
</item>
<item>
@ -1121,6 +1131,9 @@
</property>
</widget>
<widget class="QComboBox" name="comboBox_comparision">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>460</x>
@ -1131,12 +1144,12 @@
</property>
<item>
<property name="text">
<string>None</string>
<string></string>
</property>
</item>
<item>
<property name="text">
<string>直接值</string>
<string>直接值</string>
</property>
</item>
<item>
@ -1151,7 +1164,12 @@
</item>
<item>
<property name="text">
<string>1倍频相位</string>
<string>带回滞1倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞1倍频相位</string>
</property>
</item>
<item>
@ -1161,7 +1179,12 @@
</item>
<item>
<property name="text">
<string>2倍频相位</string>
<string>带回滞2倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞2倍频相位</string>
</property>
</item>
<item>
@ -1176,6 +1199,9 @@
</item>
</widget>
<widget class="QSpinBox" name="spinBox_comparision_percentage">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>460</x>

View File

@ -332,7 +332,7 @@
</size>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -436,8 +436,18 @@
</size>
</property>
<property name="currentText">
<string/>
<string>xxx</string>
</property>
<item>
<property name="text">
<string>xxx</string>
</property>
</item>
<item>
<property name="text">
<string>yyy</string>
</property>
</item>
</widget>
</item>
<item>
@ -487,6 +497,9 @@
<height>16777215</height>
</size>
</property>
<property name="text">
<string>7.87</string>
</property>
</widget>
</item>
<item>
@ -787,6 +800,16 @@
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>xxx</string>
</property>
</item>
<item>
<property name="text">
<string>yyy</string>
</property>
</item>
</widget>
</item>
<item>
@ -836,6 +859,9 @@
<height>16777215</height>
</size>
</property>
<property name="text">
<string>8</string>
</property>
</widget>
</item>
<item>
@ -1336,6 +1362,16 @@
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>xxx</string>
</property>
</item>
<item>
<property name="text">
<string>yyy</string>
</property>
</item>
</widget>
</item>
<item>
@ -1385,12 +1421,15 @@
<height>16777215</height>
</size>
</property>
<property name="text">
<string>8</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_unit_3">
<property name="text">
<string>mv/ m/s</string>
<string>mv/ m/s^2</string>
</property>
</widget>
</item>
@ -1685,6 +1724,16 @@
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>xxx</string>
</property>
</item>
<item>
<property name="text">
<string>yyy</string>
</property>
</item>
</widget>
</item>
<item>
@ -1734,6 +1783,9 @@
<height>16777215</height>
</size>
</property>
<property name="text">
<string>8</string>
</property>
</widget>
</item>
<item>

View File

@ -5,6 +5,7 @@
#include <QJsonArray>
#include <QJsonObject>
#include <QFile>
#include "velocity_ds.h"
Velocity::Velocity(int slot_no_, int channel_, bool active, QWidget *parent)
: QWidget(parent)
@ -26,17 +27,17 @@ Velocity::Velocity(int slot_no_, int channel_, bool active, QWidget *parent)
QString filePath_variables = QCoreApplication::applicationDirPath() + QString("\\config\\%1\\velocity_variables_%2.json").arg(slot_no).arg(channel);
readJsonFile(filePath_variables);
Init();
connect(ui->checkBox_1x_ampl, &QCheckBox::toggled, this, &Velocity::on_1x_ampl_toggled);
connect(ui->checkBox_2x_ampl, &QCheckBox::toggled, this, &Velocity::on_2x_ampl_toggled);
connect(ui->checkBox_rms, &QCheckBox::toggled, this, &Velocity::on_rms_toggled);
connect(ui->checkBox_integrate, &QCheckBox::toggled, this, &Velocity::on_integrate_toggled);
// connect(ui->checkBox_1x_ampl, &QCheckBox::toggled, this, &Velocity::on_1x_ampl_toggled);
// connect(ui->checkBox_2x_ampl, &QCheckBox::toggled, this, &Velocity::on_2x_ampl_toggled);
// connect(ui->checkBox_rms, &QCheckBox::toggled, this, &Velocity::on_rms_toggled);
// connect(ui->checkBox_integrate, &QCheckBox::toggled, this, &Velocity::on_integrate_toggled);
}
Velocity::~Velocity() {
delete ui;
}
void Velocity::on_rms_toggled(bool checked) {
void Velocity::on_checkBox_rms_toggled(bool checked) {
// TODO: 自定义的回调
if (checked) {
ui->checkBox_integrate->setEnabled(false);
@ -65,7 +66,7 @@ void Velocity::on_rms_toggled(bool checked) {
ui->comboBox_2x_value_range->setCurrentIndex(1);
}
void Velocity::on_integrate_toggled(bool checked) {
void Velocity::on_checkBox_integrate_toggled(bool checked) {
// TODO: 自定义的回调
if (checked) {
ui->checkBox_rms->setEnabled(false);
@ -98,7 +99,7 @@ void Velocity::on_pushButton_cancel_clicked() {
this->close();
}
void Velocity::on_1x_ampl_toggled(bool checked) {
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);
@ -110,7 +111,7 @@ void Velocity::on_1x_ampl_toggled(bool checked) {
ui->doubleSpinBox_1x_phase_lag_clamp->setEnabled(false);
}
void Velocity::on_2x_ampl_toggled(bool checked) {
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);
@ -157,21 +158,24 @@ void Velocity::readJsonFile(const QString &filePath) {
QJsonObject temp_obj = variables_array[i].toObject();
variables[i].type = temp_obj["type"].toString();
if (variables[i].type == "direct") {
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].custom = temp_obj["custom"].toDouble();
} else if (variables[i].type == "bias_volt") {
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].bias_voltage = temp_obj["bias_voltage"].toInt();
} else if (variables[i].type == "1x_ampl") {
variables[i].checked = temp_obj["checked"].toBool();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].phase_lag = temp_obj["phase_lag"].toDouble();
variables[i].custom = temp_obj["custom"].toDouble();
} else if (variables[i].type == "2x_ampl") {
variables[i].checked = temp_obj["checked"].toBool();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toString();
variables[i].full_sacle_range = temp_obj["full_sacle_range"].toInt();
variables[i].clamp_value = temp_obj["clamp_value"].toDouble();
variables[i].phase_lag = temp_obj["phase_lag"].toDouble();
variables[i].custom = temp_obj["custom"].toDouble();
}
}
QJsonObject delay_obj = json_obj["delay"].toObject();
@ -183,13 +187,14 @@ void Velocity::readJsonFile(const QString &filePath) {
alert_variables.alert_latching = json_obj["alert_latching"].toBool();
alert_variables.danger_latching = json_obj["danger_latching"].toBool();
alert_variables.timed_ok = json_obj["timed_ok"].toBool();
alert_variables.recorder_output = json_obj["recorder_output"].toString();
alert_variables.recorder_output = json_obj["recorder_output"].toInt();
alert_variables.two_ma_clamp = json_obj["two_ma_clamp"].toBool();
alert_variables.trip_multiply = json_obj["trip_multiply"].toDouble();
alert_variables.comparision = json_obj["comparision"].toString();
alert_variables.comparision_percentage = json_obj["comparision_percentage"].toInt();
}
}
void Velocity::Init() {
for (int i = 0; i < 3; i++) {
if (filter[i].checked) {
@ -210,19 +215,19 @@ void Velocity::Init() {
}
for (int i = 0; i < 4; i++) {
if (variables[i].type == "direct") {
ui->comboBox_direct_value_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_direct_value_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_direct_clamp->setValue(variables[i].clamp_value);
} else if (variables[i].type == "bias_volt") {
ui->label_bias_voltage->setText(QString::number(variables[i].bias_voltage));
ui->doubleSpinBox_bias_volt_clamp->setValue(variables[i].clamp_value);
} else if (variables[i].type == "1x_ampl") {
ui->checkBox_1x_ampl->setChecked(variables[i].checked);
ui->comboBox_1x_value_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_1x_value_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_1x_ampl_clamp->setValue(variables[i].clamp_value);
ui->doubleSpinBox_1x_phase_lag_clamp->setValue(variables[i].phase_lag);
} else if (variables[i].type == "2x_ampl") {
ui->checkBox_2x_ampl->setChecked(variables[i].checked);
ui->comboBox_2x_value_range->setCurrentText(variables[i].full_sacle_range);
ui->comboBox_2x_value_range->setCurrentIndex(variables[i].full_sacle_range);
ui->doubleSpinBox_2x_ampl_clamp->setValue(variables[i].clamp_value);
ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variables[i].phase_lag);
}
@ -233,12 +238,13 @@ void Velocity::Init() {
ui->checkBox_alert_latching->setChecked(alert_variables.alert_latching);
ui->checkBox_danger_latching->setChecked(alert_variables.danger_latching);
ui->checkBox_timed_ok->setChecked(alert_variables.timed_ok);
ui->comboBox_recorder_output->setCurrentText(alert_variables.recorder_output);
ui->comboBox_recorder_output->setCurrentIndex(alert_variables.recorder_output);
ui->checkBox_two_ma_clamp->setChecked(alert_variables.two_ma_clamp);
ui->doubleSpinBox_trip_multiply->setValue(alert_variables.trip_multiply);
ui->comboBox_comparision->setCurrentText(alert_variables.comparision);
ui->spinBox_comparision_percentage->setValue(alert_variables.comparision_percentage);
}
void Velocity::on_pushButton_confirm_clicked() {
for (int i = 0; i < 3; i++) {
if (filter[i].type == "band_pass") {
@ -257,20 +263,23 @@ void Velocity::on_pushButton_confirm_clicked() {
}
for (int i = 0; i < 4; i++) {
if (variables[i].type == "direct") {
variables[i].full_sacle_range = ui->comboBox_direct_value_range->currentText();
variables[i].full_sacle_range = ui->comboBox_direct_value_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_direct_clamp->value();
// TODO: custom
} else if (variables[i].type == "bias_volt") {
variables[i].clamp_value = ui->doubleSpinBox_bias_volt_clamp->value();
} else if (variables[i].type == "1x_ampl") {
variables[i].checked = ui->checkBox_1x_ampl->isChecked();
variables[i].full_sacle_range = ui->comboBox_1x_value_range->currentText();
variables[i].full_sacle_range = ui->comboBox_1x_value_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value();
variables[i].phase_lag = ui->doubleSpinBox_1x_phase_lag_clamp->value();
// TODO: custom
} else if (variables[i].type == "2x_ampl") {
variables[i].checked = ui->checkBox_2x_ampl->isChecked();
variables[i].full_sacle_range = ui->comboBox_2x_value_range->currentText();
variables[i].full_sacle_range = ui->comboBox_2x_value_range->currentIndex();
variables[i].clamp_value = ui->doubleSpinBox_2x_ampl_clamp->value();
variables[i].phase_lag = ui->doubleSpinBox_2x_phase_lag_clamp->value();
// TODO: custom
}
}
delay.alert = ui->spinBox_alert->value();
@ -279,7 +288,7 @@ void Velocity::on_pushButton_confirm_clicked() {
alert_variables.alert_latching = ui->checkBox_alert_latching->isChecked();
alert_variables.danger_latching = ui->checkBox_danger_latching->isChecked();
alert_variables.timed_ok = ui->checkBox_timed_ok->isChecked();
alert_variables.recorder_output = ui->comboBox_recorder_output->currentText();
alert_variables.recorder_output = ui->comboBox_recorder_output->currentIndex();
alert_variables.two_ma_clamp = ui->checkBox_two_ma_clamp->isChecked();
alert_variables.trip_multiply = ui->doubleSpinBox_trip_multiply->value();
alert_variables.comparision = ui->comboBox_comparision->currentText();

View File

@ -20,10 +20,10 @@ class Velocity : public QWidget {
private slots:
void on_pushButton_confirm_clicked();
void on_pushButton_cancel_clicked();
void on_1x_ampl_toggled(bool checked);
void on_2x_ampl_toggled(bool checked);
void on_rms_toggled(bool checked);
void on_integrate_toggled(bool checked);
void on_checkBox_1x_ampl_toggled(bool checked);
void on_checkBox_2x_ampl_toggled(bool checked);
void on_checkBox_rms_toggled(bool checked);
void on_checkBox_integrate_toggled(bool checked);
private:
Ui::Velocity *ui;

View File

@ -23,7 +23,7 @@
</rect>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_5">
<attribute name="title">
@ -846,17 +846,12 @@
</property>
<item>
<property name="text">
<string>None</string>
<string></string>
</property>
</item>
<item>
<property name="text">
<string>直接值</string>
</property>
</item>
<item>
<property name="text">
<string>偏置电压</string>
<string>直接幅值</string>
</property>
</item>
<item>
@ -866,7 +861,12 @@
</item>
<item>
<property name="text">
<string>1倍频相位</string>
<string>带回滞1倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞1倍频相位</string>
</property>
</item>
<item>
@ -876,7 +876,12 @@
</item>
<item>
<property name="text">
<string>2倍频相位</string>
<string>带回滞2倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞2倍频相位</string>
</property>
</item>
</widget>
@ -936,6 +941,9 @@
</property>
</widget>
<widget class="QComboBox" name="comboBox_comparision">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>460</x>
@ -946,17 +954,12 @@
</property>
<item>
<property name="text">
<string>None</string>
<string></string>
</property>
</item>
<item>
<property name="text">
<string>直接值</string>
</property>
</item>
<item>
<property name="text">
<string>偏置电压</string>
<string>直接幅值</string>
</property>
</item>
<item>
@ -966,7 +969,12 @@
</item>
<item>
<property name="text">
<string>1倍频相位</string>
<string>带回滞1倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞1倍频相位</string>
</property>
</item>
<item>
@ -976,11 +984,19 @@
</item>
<item>
<property name="text">
<string>2倍频相位</string>
<string>带回滞2倍频相位</string>
</property>
</item>
<item>
<property name="text">
<string>不带回滞2倍频相位</string>
</property>
</item>
</widget>
<widget class="QSpinBox" name="spinBox_comparision_percentage">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>460</x>

View File

@ -25,4 +25,16 @@ typedef enum {
kVelDisPPCustom = 3 // custom
} VelDisPPFullScaleRange;
// recorder out
typedef enum {
kVelRecorderOutNone = 0,
kVelRecorderOutDirectAmpl = 1,
kVelRecorderOut1XAmpl = 2,
kVelRecorderOut1XPhaseLagWithHysteresis = 3,
kVelRecorderOut1XPhaseLagWithoutHysteresis = 4,
kVelRecorderOut2XAmpl = 5,
kVelRecorderOut2XPhaseLagWithHysteresis = 6,
kVelRecorderOut2XPhaseLagWithoutHysteresis = 7,
} VelRecorderOut;
#endif // VELOCITY_DS_H