diff --git a/config_mgr.cpp b/config_mgr.cpp index 8d10ac2..424491b 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -686,6 +686,8 @@ void ConfigMgr::Load(QString filename) { vib_data->card_type_ = static_cast(card_type_[i]); vib_data->slot_ = slot; vib_data->relative_number = temp_obj["relative_number"].toInt(); + vib_data->group = temp_obj["group"].toInt(); + // dc_output QJsonObject dc_output_obj = temp_obj["dc_output"].toObject(); if(!dc_output_obj.isEmpty()){ @@ -1062,6 +1064,8 @@ void ConfigMgr::Load(QString filename) { speed_data->card_type_ = static_cast(card_type_[i]); speed_data->version_ = temp_obj["version"].toInt(); speed_data->relative_number = temp_obj["relative_number"].toInt(); + speed_data->group = temp_obj["group"].toInt(); + for (int j = 0; j < CHANNEL_COUNT_SPEED; ++j) { channel = temp_obj[QString::number(j + 1)].toObject(); speed_data->variables_[j].active = channel["active"].toBool(); @@ -1100,6 +1104,7 @@ void ConfigMgr::Load(QString filename) { keyphase_data->slot_ = slot; keyphase_data->card_type_ = static_cast(card_type_[i]); keyphase_data->version_ = temp_obj["version"].toInt(); + keyphase_data->group = temp_obj["group"].toInt(); for (int j = 0; j < CHANNEL_COUNT_SPEED; ++j) { channel = temp_obj[QString::number(j + 1)].toObject(); keyphase_data->variables_[j].active = channel["active"].toBool(); diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index 4330adc..c2e3f4c 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -63,7 +63,10 @@ void Seismic_monitor::Init() { ui->checkBox_standby_1->setChecked(vib_data->base_config_[i].standby); 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)); - + if(vib_data->base_config_[i].power) + ui->comboBox_power_supply_1->setCurrentIndex(0); + else + ui->comboBox_power_supply_1->setCurrentIndex(1); ui->checkBox_enable_1->setChecked(vib_data->base_config_[i].active); 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); @@ -80,7 +83,10 @@ void Seismic_monitor::Init() { 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); - + if(vib_data->base_config_[i].power) + ui->comboBox_power_supply_2->setCurrentIndex(0); + else + ui->comboBox_power_supply_2->setCurrentIndex(1); 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)); @@ -90,7 +96,10 @@ void Seismic_monitor::Init() { ui->comboBox_chan_type_3->setCurrentIndex(vib_data->base_config_[i].channel_type); 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)); - + if(vib_data->base_config_[i].power) + ui->comboBox_power_supply_3->setCurrentIndex(0); + else + ui->comboBox_power_supply_3->setCurrentIndex(1); 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)); @@ -107,7 +116,10 @@ void Seismic_monitor::Init() { 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)); - + if(vib_data->base_config_[i].power) + ui->comboBox_power_supply_4->setCurrentIndex(0); + else + ui->comboBox_power_supply_4->setCurrentIndex(1); ui->checkBox_enable_4->setChecked(vib_data->base_config_[i].active); 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); @@ -115,7 +127,8 @@ void Seismic_monitor::Init() { } } ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number); - ui->comboBox_group->setCurrentIndex(base_ptr->group + 1); + qDebug() << "group" << base_ptr->group; + ui->comboBox_group->setCurrentIndex(base_ptr->group - 1); } void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { @@ -127,7 +140,10 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_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(); - + if(ui->comboBox_power_supply_1->currentIndex() == 0) + vib_data->base_config_[var].power = true; + else if(ui->comboBox_power_supply_1->currentIndex() == 1) + vib_data->base_config_[var].power = false; 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].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); @@ -141,9 +157,12 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_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(); + if(ui->comboBox_power_supply_1->currentIndex() == 0) + vib_data->base_config_[var].power = true; + else if(ui->comboBox_power_supply_1->currentIndex() == 1) + vib_data->base_config_[var].power = false; 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].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(); @@ -155,7 +174,10 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_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(); - + if(ui->comboBox_power_supply_1->currentIndex() == 0) + vib_data->base_config_[var].power = true; + else if(ui->comboBox_power_supply_1->currentIndex() == 1) + vib_data->base_config_[var].power = false; 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(); @@ -170,6 +192,10 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { vib_data->base_config_[var].channel_type = ui->comboBox_chan_type_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(); + if(ui->comboBox_power_supply_1->currentIndex() == 0) + vib_data->base_config_[var].power = true; + else if(ui->comboBox_power_supply_1->currentIndex() == 1) + vib_data->base_config_[var].power = false; 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].chan_id = QString("S%1C%2").arg(QString::number(slot_no, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0')); diff --git a/tachometer.cpp b/tachometer.cpp index 7858c29..ec9323b 100644 --- a/tachometer.cpp +++ b/tachometer.cpp @@ -429,7 +429,7 @@ void Tachometer::Init() { } } ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number); - ui->comboBox_group->setCurrentIndex(base_ptr->group + 1); + ui->comboBox_group->setCurrentIndex(base_ptr->group - 1); } void Tachometer::on_pushButton_confirm_clicked() { diff --git a/tmrrelayassociation.cpp b/tmrrelayassociation.cpp index 88f1bbe..ba55396 100644 --- a/tmrrelayassociation.cpp +++ b/tmrrelayassociation.cpp @@ -112,7 +112,20 @@ void TMRRelayAssociation::Init(){ relay_data_backup2->card_type_ = kCardRelayTMRBackup; relay_data_backup2->slot_ = slot_no + 2; ConfigMgr::Instance()->AddCard(relay_data_backup2); - + if(relay_data->sgcc_enable){ + treeView_relay->setEnabled(false); + list_widget_available->setEnabled(false); + ui->comboBox_relay_ch->setEnabled(false); + ui->pushButton_logic->setEnabled(false); + ui->textEdit_logic->setEnabled(false); + model_Relay->clear(); + }else { + treeView_relay->setEnabled(true); + list_widget_available->setEnabled(true); + ui->comboBox_relay_ch->setEnabled(true); + ui->pushButton_logic->setEnabled(true); + ui->textEdit_logic->setEnabled(true); + } return; } relay_data = std::dynamic_pointer_cast(base_ptr); @@ -148,6 +161,20 @@ void TMRRelayAssociation::Init(){ if(!relay_data->tmr_relay[current_index].logic_expression.isEmpty()){ setExpressionToTreeView(treeView_relay, relay_data->tmr_relay[current_index].logic_expression); } + if(relay_data->sgcc_enable){ + treeView_relay->setEnabled(false); + list_widget_available->setEnabled(false); + ui->comboBox_relay_ch->setEnabled(false); + ui->pushButton_logic->setEnabled(false); + ui->textEdit_logic->setEnabled(false); + model_Relay->clear(); + }else { + treeView_relay->setEnabled(true); + list_widget_available->setEnabled(true); + ui->comboBox_relay_ch->setEnabled(true); + ui->pushButton_logic->setEnabled(true); + ui->textEdit_logic->setEnabled(true); + } } ExprNode* TMRRelayAssociation::parseExpression(const QString& expr, int& pos) { @@ -541,7 +568,7 @@ void TMRRelayAssociation::on_checkBox_sgcc_stateChanged(int arg1) ui->pushButton_logic->setEnabled(false); ui->textEdit_logic->setEnabled(false); model_Relay->clear(); - }else{ + }else if (!ui->checkBox_sgcc->checkState()){ treeView_relay->setEnabled(true); list_widget_available->setEnabled(true); ui->comboBox_relay_ch->setEnabled(true); diff --git a/tmrrelayassociation.ui b/tmrrelayassociation.ui index b2866e6..fbf43cd 100644 --- a/tmrrelayassociation.ui +++ b/tmrrelayassociation.ui @@ -52,6 +52,9 @@ TMR继电器关联 + + false + 20 @@ -182,6 +185,9 @@ + + false + 110 @@ -273,6 +279,9 @@ 国网组态 + + true + @@ -968,6 +977,9 @@ + + true + 230 @@ -978,6 +990,9 @@ + + true + 610 @@ -988,6 +1003,9 @@ + + false + 20 diff --git a/tmrrelayassociation_data.h b/tmrrelayassociation_data.h index c642e32..55ae9e0 100644 --- a/tmrrelayassociation_data.h +++ b/tmrrelayassociation_data.h @@ -8,7 +8,7 @@ class TmrrelayassociationData: public CardBase public: TmrrelayassociationData(); TMRRelay tmr_relay[RELAY_COUNT]; - bool sgcc_enable = false; + bool sgcc_enable = true; }; #endif // TMRRELAYASSOCIATIONDATA_H