添加高速电流配置
This commit is contained in:
parent
1704ae9aa0
commit
76c8206037
@ -24,6 +24,8 @@ SOURCES += \
|
||||
dc_outputs.cpp \
|
||||
ethconfig.cpp \
|
||||
headerView.cpp \
|
||||
high_speed_current.cpp \
|
||||
high_speed_current_data.cpp \
|
||||
keyphase.cpp \
|
||||
keyphase_data.cpp \
|
||||
macconfig.cpp \
|
||||
@ -68,6 +70,8 @@ HEADERS += \
|
||||
displacement_ds.h \
|
||||
ethconfig.h \
|
||||
headerView.h \
|
||||
high_speed_current.h \
|
||||
high_speed_current_data.h \
|
||||
keyphase.h \
|
||||
keyphase_data.h \
|
||||
macconfig.h \
|
||||
@ -104,6 +108,7 @@ FORMS += \
|
||||
dc_output_channel.ui \
|
||||
dc_outputs.ui \
|
||||
ethconfig.ui \
|
||||
high_speed_current.ui \
|
||||
keyphase.ui \
|
||||
macconfig.ui \
|
||||
mainwindow.ui \
|
||||
|
||||
@ -57,17 +57,14 @@ void ChannelCRC::on_pushButton_get_clicked()
|
||||
rows ++ ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void ChannelCRC::readData(const QByteArray &data) {
|
||||
qDebug() << "Received from server111:" << data;
|
||||
|
||||
uint8_t cmd = data[3];
|
||||
if (cmd == kGetChannelCRCValue) {
|
||||
GetChannelCRCCountRsp get_ch_crc_rsp;
|
||||
memcpy(&get_ch_crc_rsp, data.data(), sizeof(GetChannelCRCCountRsp));
|
||||
qDebug() << "get_ch_crc_rsp code" << get_ch_crc_rsp.code << get_ch_crc_rsp.card_id << get_ch_crc_rsp.channel_id << get_ch_crc_rsp.count << rows_slot[(int)get_ch_crc_rsp.card_id] ;
|
||||
model->setData(model->index(rows_slot[(int)get_ch_crc_rsp.card_id],((int)get_ch_crc_rsp.channel_id),QModelIndex()),get_ch_crc_rsp.count);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include "keyphase_data.h"
|
||||
#include "singlerelay_data.h"
|
||||
#include "tmrrelayassociation_data.h"
|
||||
#include "high_speed_current_data.h"
|
||||
#include <QCoreApplication>
|
||||
|
||||
|
||||
@ -38,7 +39,8 @@ int ConfigMgr::Save(QString & file_path) {
|
||||
card_type_[i] != kCardKeyphaseSingle &&
|
||||
card_type_[i] != kCardRelaySingle &&
|
||||
card_type_[i] != kCardRelayTMRPrimary &&
|
||||
card_type_[i] != kCardRelaySingleNOK) {
|
||||
card_type_[i] != kCardRelaySingleNOK &&
|
||||
card_type_[i] != kCardHighSpeedCurrent) {
|
||||
continue;
|
||||
}
|
||||
// process slot
|
||||
@ -500,6 +502,41 @@ int ConfigMgr::Save(QString & file_path) {
|
||||
alarm["alert_high_latch"] = ptr->alert_high[cid].latch;
|
||||
channel_item.insert("alarm" , alarm);
|
||||
|
||||
}else if(card_type_[i] == kCardHighSpeedCurrent){
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
|
||||
if (base_ptr == nullptr || cid > 3) {
|
||||
continue;
|
||||
}
|
||||
std::shared_ptr<HighSpeedCurrentData> ptr = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
|
||||
// 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;
|
||||
}
|
||||
channel_item.insert("active", ptr->variables_[cid].active);
|
||||
channel_item.insert("point_name", ptr->variables_[cid].point_name);
|
||||
channel_item.insert("engineering_unit", ptr->variables_[cid].engineering_unit);
|
||||
channel_item.insert("fullScalePosition", ptr->variables_[cid].fullScalePosition);
|
||||
channel_item.insert("xfullScalePosition", ptr->variables_[cid].xfullScalePosition);
|
||||
channel_item.insert("zeroScalePosition", ptr->variables_[cid].zeroScalePosition);
|
||||
channel_item.insert("xzeroScalePosition", ptr->variables_[cid].xzeroScalePosition);
|
||||
channel_item.insert("rectifier_funtion", ptr->variables_[cid].rectifier_funtion);
|
||||
|
||||
QJsonObject alarm;
|
||||
alarm["danger_high_level"] = ptr->danger_high[cid].level;
|
||||
alarm["danger_high_hysteresis"] = ptr->danger_high[cid].hysteresis;
|
||||
alarm["danger_high_delay"] = ptr->danger_high[cid].delay;
|
||||
alarm["danger_high_enable"] = ptr->danger_high[cid].enable;
|
||||
alarm["danger_high_latch"] = ptr->danger_high[cid].latch;
|
||||
alarm["alert_high_level"] = ptr->alert_high[cid].level;
|
||||
alarm["alert_high_hysteresis"] = ptr->alert_high[cid].hysteresis;
|
||||
alarm["alert_high_delay"] = ptr->alert_high[cid].delay;
|
||||
alarm["alert_high_enable"] = ptr->alert_high[cid].enable;
|
||||
alarm["alert_high_latch"] = ptr->alert_high[cid].latch;
|
||||
channel_item.insert("alarm" , alarm);
|
||||
} else if (card_type_[i] == kCardKeyphaseSingle) {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot);
|
||||
if (base_ptr == nullptr || cid > 3) {
|
||||
@ -1082,6 +1119,52 @@ void ConfigMgr::Load(QString filename) {
|
||||
|
||||
}
|
||||
cards_.push_back(keyphase_data);
|
||||
}else if(card_type_[i] == kCardHighSpeedCurrent){
|
||||
std::shared_ptr<HighSpeedCurrentData> current_data = std::make_shared<HighSpeedCurrentData>();
|
||||
current_data->slot_ = slot;
|
||||
current_data->card_type_ = static_cast<CardType>(card_type_[i]);
|
||||
current_data->version_ = temp_obj["version"].toInt();
|
||||
current_data->relative_number = temp_obj["relative_number"].toInt();
|
||||
current_data->group = temp_obj["group"].toInt();
|
||||
for (int j = 0; j < CHANNEL_COUNT_SPEED; ++j) {
|
||||
channel = temp_obj[QString::number(j + 1)].toObject();
|
||||
current_data->variables_[j].active = channel["active"].toBool();
|
||||
current_data->variables_[j].point_name = channel["point_name"].toString();
|
||||
current_data->variables_[j].engineering_unit = channel["engineering_unit"].toString();
|
||||
current_data->variables_[j].fullScalePosition = channel["fullScalePosition"].toDouble();
|
||||
current_data->variables_[j].xfullScalePosition = channel["xfullScalePosition"].toDouble();
|
||||
current_data->variables_[j].zeroScalePosition = channel["zeroScalePosition"].toDouble();
|
||||
current_data->variables_[j].xzeroScalePosition = channel["xzeroScalePosition"].toDouble();
|
||||
current_data->variables_[j].rectifier_funtion = channel["rectifier_funtion"].toInt();
|
||||
if(channel.contains("alarm")){
|
||||
QJsonObject alarm = channel["alarm"].toObject();
|
||||
current_data->danger_high[j].level = alarm["danger_high_level"].toDouble();
|
||||
current_data->danger_high[j].hysteresis = alarm["danger_high_hysteresis"].toDouble();
|
||||
current_data->danger_high[j].delay = alarm["danger_high_delay"].toInt();
|
||||
current_data->danger_high[j].enable = alarm["danger_high_enable"].toBool();
|
||||
current_data->danger_high[j].latch = alarm["danger_high_latch"].toBool();
|
||||
current_data->alert_high[j].level = alarm["alert_high_level"].toDouble();
|
||||
current_data->alert_high[j].hysteresis = alarm["alert_high_hysteresis"].toDouble();
|
||||
current_data->alert_high[j].delay = alarm["alert_high_delay"].toInt();
|
||||
current_data->alert_high[j].enable = alarm["alert_high_enable"].toBool();
|
||||
current_data->alert_high[j].latch = alarm["alert_high_latch"].toBool();
|
||||
}
|
||||
}
|
||||
// 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;
|
||||
current_data->dc_output[var].output_channel = output_obj["output_channel"].toInt();
|
||||
current_data->dc_output[var].minmum = output_obj["minmum"].toDouble();
|
||||
current_data->dc_output[var].maxmum = output_obj["maxmum"].toDouble();
|
||||
}
|
||||
|
||||
}
|
||||
cards_.push_back(current_data);
|
||||
}else if (card_type_[i] == kCardRelaySingle ){
|
||||
std::shared_ptr<SingleRelayData> singlerelay_data = std::make_shared<SingleRelayData>();
|
||||
singlerelay_data->slot_ = slot;
|
||||
|
||||
@ -52,6 +52,8 @@ typedef enum {
|
||||
kCardRelayTMRBackup = 34,
|
||||
kCardRelaySingleNOK = 35,
|
||||
|
||||
kCardHighSpeedCurrent = 36,
|
||||
|
||||
} CardType;
|
||||
|
||||
// 振动板通道类型
|
||||
@ -63,6 +65,7 @@ typedef enum {
|
||||
kVibPressurePulsation = 4, //动态压力脉动
|
||||
kVib12 = 5, // 通道1&2
|
||||
kVib34 = 6, // 通道3&4
|
||||
kHighSpeedCurrent = 7 // 高速电流
|
||||
} VibChannelType;
|
||||
enum TotalCalcValueType {
|
||||
// 转速
|
||||
@ -133,7 +136,8 @@ typedef enum{
|
||||
kRMSScalePeakToPeak = 3,
|
||||
kAVG = 4,
|
||||
kRMSScaleAVG = 5,
|
||||
kRMS = 6
|
||||
kRMS = 6,
|
||||
kMin = 7
|
||||
} RectifierFuntion;
|
||||
|
||||
typedef enum{
|
||||
@ -484,6 +488,20 @@ typedef struct {
|
||||
bool fail;
|
||||
} KeyphaseVariables;
|
||||
|
||||
typedef struct HighSpeedCurrentVariables_
|
||||
{
|
||||
int id;
|
||||
QString point_name;
|
||||
bool active;
|
||||
QString engineering_unit;
|
||||
float fullScalePosition;
|
||||
float xfullScalePosition;
|
||||
float zeroScalePosition;
|
||||
float xzeroScalePosition;
|
||||
int rectifier_funtion;
|
||||
HighSpeedCurrentVariables_() {}
|
||||
}HighSpeedCurrentVariables;
|
||||
|
||||
typedef struct {
|
||||
QString transducer_name;
|
||||
double scale_factor;
|
||||
|
||||
169
dc_outputs.cpp
169
dc_outputs.cpp
@ -6,6 +6,7 @@
|
||||
#include "config_mgr.h"
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include <QStandardItemModel>
|
||||
|
||||
ChannelUsed ch_used[SLOT_NUM][22];
|
||||
|
||||
@ -57,50 +58,82 @@ void DC_Outputs::Init(){
|
||||
qCritical() << "[DC_Outputs::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
vib_dc_output_ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
if (car_type == kCardHighSpeedCurrent) {
|
||||
hsc_dc_output_ptr = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
|
||||
if (hsc_dc_output_ptr == nullptr) {
|
||||
qCritical() << "[DC_Outputs::Init] high speed current data is null";
|
||||
return;
|
||||
}
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(ui->comboBox_ch_output->model());
|
||||
if (model != nullptr) {
|
||||
for (int i = 6; i < ui->comboBox_ch_output->count(); ++i) {
|
||||
model->item(i)->setEnabled(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
DCOutput *dc_output = GetDcOutputArray();
|
||||
if (dc_output == nullptr) {
|
||||
qCritical() << "[DC_Outputs::Init] dc_output is null";
|
||||
return;
|
||||
}
|
||||
if(dc_output[0].output_channel != -1){
|
||||
unit_str = GetUnit(dc_output[0].output_channel);
|
||||
ui->label_ch_1->setText(ui->comboBox_ch_output->itemText(dc_output[0].output_channel));
|
||||
ui->label_ch_1_min->setText(QString::number(dc_output[0].minmum));
|
||||
ui->label_ch_1_max->setText(QString::number(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][dc_output[0].output_channel].used[0] = true;
|
||||
}
|
||||
if(dc_output[1].output_channel != -1){
|
||||
unit_str = GetUnit(dc_output[1].output_channel);
|
||||
ui->label_ch_2->setText(ui->comboBox_ch_output->itemText(dc_output[1].output_channel));
|
||||
ui->label_ch_2_min->setText(QString::number(dc_output[1].minmum));
|
||||
ui->label_ch_2_max->setText(QString::number(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][dc_output[1].output_channel].used[1] = true;
|
||||
}
|
||||
if(dc_output[2].output_channel != -1){
|
||||
unit_str = GetUnit(dc_output[2].output_channel);
|
||||
ui->label_ch_3->setText(ui->comboBox_ch_output->itemText(dc_output[2].output_channel));
|
||||
ui->label_ch_3_min->setText(QString::number(dc_output[2].minmum));
|
||||
ui->label_ch_3_max->setText(QString::number(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][dc_output[2].output_channel].used[2] = true;
|
||||
}
|
||||
if(dc_output[3].output_channel != -1){
|
||||
unit_str = GetUnit(dc_output[3].output_channel);
|
||||
ui->label_ch_4->setText(ui->comboBox_ch_output->itemText(dc_output[3].output_channel));
|
||||
ui->label_ch_4_min->setText(QString::number(dc_output[3].minmum));
|
||||
ui->label_ch_4_max->setText(QString::number(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][dc_output[3].output_channel].used[3] = true;
|
||||
}
|
||||
}
|
||||
|
||||
QString DC_Outputs::GetUnit(int com_index){
|
||||
if (car_type == kCardHighSpeedCurrent) {
|
||||
if (hsc_dc_output_ptr == nullptr) {
|
||||
return "";
|
||||
}
|
||||
int channel_num = com_index;
|
||||
if (com_index == 4) {
|
||||
channel_num = 0;
|
||||
} else if (com_index == 5) {
|
||||
channel_num = 2;
|
||||
}
|
||||
if (channel_num < 0 || channel_num >= CHANNEL_COUNT_SPEED) {
|
||||
return "";
|
||||
}
|
||||
return hsc_dc_output_ptr->variables_[channel_num].engineering_unit;
|
||||
}
|
||||
int unit_num = -1,channel_num = 0;
|
||||
QString unit_str = "";
|
||||
channel_num = com_index;
|
||||
@ -191,6 +224,19 @@ QString DC_Outputs::GetUnit(int com_index){
|
||||
}
|
||||
return unit_str;
|
||||
}
|
||||
|
||||
DCOutput *DC_Outputs::GetDcOutputArray(){
|
||||
if (car_type == kCardHighSpeedCurrent) {
|
||||
if (hsc_dc_output_ptr == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return hsc_dc_output_ptr->dc_output;
|
||||
}
|
||||
if (vib_dc_output_ptr == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
return vib_dc_output_ptr->dc_output;
|
||||
}
|
||||
void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
||||
{
|
||||
current_index = index;
|
||||
@ -204,6 +250,11 @@ void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
||||
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);
|
||||
DCOutput *dc_output = GetDcOutputArray();
|
||||
if (dc_output == nullptr) {
|
||||
qCritical() << "[DC_Outputs::output_channel_data] dc_output is null";
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < CHANNEL_COUNT; i++) {
|
||||
if(ch_used[slot_no][current_index].used[i] && i != (channel - 1)){
|
||||
if(i == 0){
|
||||
@ -213,7 +264,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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;
|
||||
dc_output[0].output_channel = -1;
|
||||
}else if(i == 1){
|
||||
label_ch2[0]->setText("未使用");
|
||||
label_ch2[1]->setText("-----");
|
||||
@ -221,7 +272,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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;
|
||||
dc_output[1].output_channel = -1;
|
||||
}else if(i == 2){
|
||||
label_ch3[0]->setText("未使用");
|
||||
label_ch3[1]->setText("-----");
|
||||
@ -229,7 +280,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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;
|
||||
dc_output[2].output_channel = -1;
|
||||
}else if(i == 3){
|
||||
label_ch4[0]->setText("未使用");
|
||||
label_ch4[1]->setText("-----");
|
||||
@ -237,7 +288,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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;
|
||||
dc_output[3].output_channel = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -248,9 +299,9 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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();
|
||||
dc_output[0].output_channel = current_index;
|
||||
dc_output[0].minmum = ui->label_ch_1_min->text().toFloat();
|
||||
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));
|
||||
@ -258,9 +309,9 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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();
|
||||
dc_output[1].output_channel = current_index;
|
||||
dc_output[1].minmum = ui->label_ch_2_min->text().toFloat();
|
||||
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));
|
||||
@ -268,9 +319,9 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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();
|
||||
dc_output[2].output_channel = current_index;
|
||||
dc_output[2].minmum = ui->label_ch_3_min->text().toFloat();
|
||||
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));
|
||||
@ -278,9 +329,9 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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();
|
||||
dc_output[3].output_channel = current_index;
|
||||
dc_output[3].minmum = ui->label_ch_4_min->text().toFloat();
|
||||
dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat();
|
||||
}else if(channel == 5){
|
||||
if(not_used == 0){
|
||||
label_ch1[0]->setText("未使用");
|
||||
@ -289,7 +340,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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;
|
||||
dc_output[0].output_channel = -1;
|
||||
}else if(not_used == 1){
|
||||
label_ch2[0]->setText("未使用");
|
||||
label_ch2[1]->setText("-----");
|
||||
@ -297,7 +348,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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;
|
||||
dc_output[1].output_channel = -1;
|
||||
}else if(not_used == 2){
|
||||
label_ch3[0]->setText("未使用");
|
||||
label_ch3[1]->setText("-----");
|
||||
@ -305,7 +356,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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;
|
||||
dc_output[2].output_channel = -1;
|
||||
}else if(not_used == 3){
|
||||
label_ch4[0]->setText("未使用");
|
||||
label_ch4[1]->setText("-----");
|
||||
@ -313,7 +364,7 @@ void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int n
|
||||
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;
|
||||
dc_output[3].output_channel = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include <QWidget>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
#include "high_speed_current_data.h"
|
||||
|
||||
namespace Ui {
|
||||
class DC_Outputs;
|
||||
@ -32,8 +33,10 @@ private slots:
|
||||
private:
|
||||
Ui::DC_Outputs *ui;
|
||||
std::shared_ptr<VibrationData> vib_dc_output_ptr = nullptr;
|
||||
std::shared_ptr<HighSpeedCurrentData> hsc_dc_output_ptr = nullptr;
|
||||
void Init();
|
||||
QString GetUnit(int com_index);
|
||||
DCOutput *GetDcOutputArray();
|
||||
QLabel *label_ch1[5];
|
||||
QLabel *label_ch2[5];
|
||||
QLabel *label_ch3[5];
|
||||
|
||||
288
high_speed_current.cpp
Normal file
288
high_speed_current.cpp
Normal file
@ -0,0 +1,288 @@
|
||||
#include "high_speed_current.h"
|
||||
#include "ui_high_speed_current.h"
|
||||
#include "config_mgr.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
HighSpeedCurrent::HighSpeedCurrent(int slot_no_,CardType cardtype,QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::HighSpeedCurrent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
slot_no = slot_no_;
|
||||
card_type = cardtype;
|
||||
QString slot = QString("%1").arg(slot_no);
|
||||
ui->label_slot->setText(slot);
|
||||
Init();
|
||||
}
|
||||
|
||||
HighSpeedCurrent::~HighSpeedCurrent()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void HighSpeedCurrent::UpdateData(std::shared_ptr<HighSpeedCurrentData> ¤t_data){
|
||||
|
||||
current_data->card_type_ = kCardHighSpeedCurrent;
|
||||
current_data->slot_ = slot_no;
|
||||
current_data->version_ = 1;
|
||||
for (int i = 0; i < CHANNEL_COUNT_SPEED; i++){
|
||||
if (i + 1 == 1) {
|
||||
current_data->variables_[i].active = ui->checkBox_chan_1->isChecked();
|
||||
current_data->variables_[i].engineering_unit = ui->lineEdit_engineeringUnit->text();
|
||||
current_data->variables_[i].fullScalePosition = ui->lineEdit_fullScalePosition->text().toFloat();
|
||||
current_data->variables_[i].xfullScalePosition = ui->lineEdit_xfullScalePosition->text().toFloat();
|
||||
current_data->variables_[i].zeroScalePosition = ui->lineEdit_zeroScalePosition->text().toFloat();
|
||||
current_data->variables_[i].xzeroScalePosition = ui->lineEdit_xzeroScalePosition->text().toFloat();
|
||||
current_data->variables_[i].rectifier_funtion = ui->comboBox_rectifier_funtion->currentIndex();
|
||||
// -alarm
|
||||
current_data->danger_high[i].level = ui->lineEdit_danger_high_level->text().toDouble();
|
||||
current_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis->text().toDouble();
|
||||
current_data->danger_high[i].delay = ui->lineEdit_danger_high_delay->text().toDouble();
|
||||
current_data->danger_high[i].enable = ui->checkBox_danger_high_enable->isChecked();
|
||||
current_data->danger_high[i].latch = ui->checkBox_danger_high_latch->isChecked();
|
||||
current_data->alert_high[i].level = ui->lineEdit_alert_high_level->text().toDouble();
|
||||
current_data->alert_high[i].hysteresis = ui->lineEdit_alert_high_hysteresis->text().toDouble();
|
||||
current_data->alert_high[i].delay = ui->lineEdit_alert_high_delay->text().toDouble();
|
||||
current_data->alert_high[i].enable = ui->checkBox_alert_high_enable->isChecked();
|
||||
current_data->alert_high[i].latch = ui->checkBox_alert_high_latch->isChecked();
|
||||
|
||||
}else if(i + 1 == 2){
|
||||
current_data->variables_[i].active = ui->checkBox_chan_2->isChecked();
|
||||
current_data->variables_[i].engineering_unit = ui->lineEdit_engineeringUnit_2->text();
|
||||
current_data->variables_[i].fullScalePosition = ui->lineEdit_fullScalePosition_2->text().toFloat();
|
||||
current_data->variables_[i].xfullScalePosition = ui->lineEdit_xfullScalePosition_2->text().toFloat();
|
||||
current_data->variables_[i].zeroScalePosition = ui->lineEdit_zeroScalePosition_2->text().toFloat();
|
||||
current_data->variables_[i].xzeroScalePosition = ui->lineEdit_xzeroScalePosition_2->text().toFloat();
|
||||
current_data->variables_[i].rectifier_funtion = ui->comboBox_rectifier_funtion_2->currentIndex();
|
||||
// -alarm
|
||||
current_data->danger_high[i].level = ui->lineEdit_danger_high_level_2->text().toDouble();
|
||||
current_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_2->text().toDouble();
|
||||
current_data->danger_high[i].delay = ui->lineEdit_danger_high_delay_2->text().toDouble();
|
||||
current_data->danger_high[i].enable = ui->checkBox_danger_high_enable_2->isChecked();
|
||||
current_data->danger_high[i].latch = ui->checkBox_danger_high_latch_2->isChecked();
|
||||
current_data->alert_high[i].level = ui->lineEdit_alert_high_level_2->text().toDouble();
|
||||
current_data->alert_high[i].hysteresis = ui->lineEdit_alert_high_hysteresis_2->text().toDouble();
|
||||
current_data->alert_high[i].delay = ui->lineEdit_alert_high_delay_2->text().toDouble();
|
||||
current_data->alert_high[i].enable = ui->checkBox_alert_high_enable_2->isChecked();
|
||||
current_data->alert_high[i].latch = ui->checkBox_alert_high_latch_2->isChecked();
|
||||
}else if(i + 1 == 3){
|
||||
current_data->variables_[i].active = ui->checkBox_chan_3->isChecked();
|
||||
current_data->variables_[i].engineering_unit = ui->lineEdit_engineeringUnit_3->text();
|
||||
current_data->variables_[i].fullScalePosition = ui->lineEdit_fullScalePosition_3->text().toFloat();
|
||||
current_data->variables_[i].xfullScalePosition = ui->lineEdit_xfullScalePosition_3->text().toFloat();
|
||||
current_data->variables_[i].zeroScalePosition = ui->lineEdit_zeroScalePosition_3->text().toFloat();
|
||||
current_data->variables_[i].xzeroScalePosition = ui->lineEdit_xzeroScalePosition_3->text().toFloat();
|
||||
current_data->variables_[i].rectifier_funtion = ui->comboBox_rectifier_funtion_3->currentIndex();
|
||||
// -alarm
|
||||
current_data->danger_high[i].level = ui->lineEdit_danger_high_level_3->text().toDouble();
|
||||
current_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_3->text().toDouble();
|
||||
current_data->danger_high[i].delay = ui->lineEdit_danger_high_delay_3->text().toDouble();
|
||||
current_data->danger_high[i].enable = ui->checkBox_danger_high_enable_3->isChecked();
|
||||
current_data->danger_high[i].latch = ui->checkBox_danger_high_latch_3->isChecked();
|
||||
current_data->alert_high[i].level = ui->lineEdit_alert_high_level_3->text().toDouble();
|
||||
current_data->alert_high[i].hysteresis = ui->lineEdit_alert_high_hysteresis_3->text().toDouble();
|
||||
current_data->alert_high[i].delay = ui->lineEdit_alert_high_delay_3->text().toDouble();
|
||||
current_data->alert_high[i].enable = ui->checkBox_alert_high_enable_3->isChecked();
|
||||
current_data->alert_high[i].latch = ui->checkBox_alert_high_latch_3->isChecked();
|
||||
}else if(i + 1 == 4){
|
||||
current_data->variables_[i].active = ui->checkBox_chan_4->isChecked();
|
||||
current_data->variables_[i].engineering_unit = ui->lineEdit_engineeringUnit_4->text();
|
||||
current_data->variables_[i].fullScalePosition = ui->lineEdit_fullScalePosition_4->text().toFloat();
|
||||
current_data->variables_[i].xfullScalePosition = ui->lineEdit_xfullScalePosition_4->text().toFloat();
|
||||
current_data->variables_[i].zeroScalePosition = ui->lineEdit_zeroScalePosition_4->text().toFloat();
|
||||
current_data->variables_[i].xzeroScalePosition = ui->lineEdit_xzeroScalePosition_4->text().toFloat();
|
||||
current_data->variables_[i].rectifier_funtion = ui->comboBox_rectifier_funtion_4->currentIndex();
|
||||
// -alarm
|
||||
current_data->danger_high[i].level = ui->lineEdit_danger_high_level_4->text().toDouble();
|
||||
current_data->danger_high[i].hysteresis = ui->lineEdit_danger_high_hysteresis_4->text().toDouble();
|
||||
current_data->danger_high[i].delay = ui->lineEdit_danger_high_delay_4->text().toDouble();
|
||||
current_data->danger_high[i].enable = ui->checkBox_danger_high_enable_4->isChecked();
|
||||
current_data->danger_high[i].latch = ui->checkBox_danger_high_latch_4->isChecked();
|
||||
current_data->alert_high[i].level = ui->lineEdit_alert_high_level_4->text().toDouble();
|
||||
current_data->alert_high[i].hysteresis = ui->lineEdit_alert_high_hysteresis_4->text().toDouble();
|
||||
current_data->alert_high[i].delay = ui->lineEdit_alert_high_delay_4->text().toDouble();
|
||||
current_data->alert_high[i].enable = ui->checkBox_alert_high_enable_4->isChecked();
|
||||
current_data->alert_high[i].latch = ui->checkBox_alert_high_latch_4->isChecked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HighSpeedCurrent::Init() {
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
// do nothing or use template to init it.
|
||||
std::shared_ptr<HighSpeedCurrentData> current_data = std::make_shared<HighSpeedCurrentData>();
|
||||
current_data->card_type_ = card_type;
|
||||
current_data->slot_ = slot_no;
|
||||
ConfigMgr::Instance()->AddCard(current_data);
|
||||
UpdateData(current_data);
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<HighSpeedCurrentData> current_data = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
|
||||
for (int i = 0; i < CHANNEL_COUNT_SPEED; i++) {
|
||||
if (i + 1 == 1) {
|
||||
ui->checkBox_chan_1->setChecked(current_data->variables_[i].active);
|
||||
ui->lineEdit_engineeringUnit->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->lineEdit_fullScalePosition->setText(QString::number(current_data->variables_[i].fullScalePosition));
|
||||
ui->lineEdit_xfullScalePosition->setText(QString::number(current_data->variables_[i].xfullScalePosition));
|
||||
ui->lineEdit_zeroScalePosition->setText(QString::number(current_data->variables_[i].zeroScalePosition));
|
||||
ui->lineEdit_xzeroScalePosition->setText(QString::number(current_data->variables_[i].xzeroScalePosition));
|
||||
ui->comboBox_rectifier_funtion->setCurrentIndex(current_data->variables_[i].rectifier_funtion);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level->setText(QString::number(current_data->danger_high[i].level));
|
||||
ui->lineEdit_danger_high_hysteresis->setText(QString::number(current_data->danger_high[i].hysteresis));
|
||||
ui->lineEdit_danger_high_delay->setText(QString::number(current_data->danger_high[i].delay));
|
||||
ui->checkBox_danger_high_enable->setChecked(current_data->danger_high[i].enable);
|
||||
ui->checkBox_danger_high_latch->setChecked(current_data->danger_high[i].latch);
|
||||
|
||||
ui->lineEdit_alert_high_level->setText(QString::number(current_data->alert_high[i].level));
|
||||
ui->lineEdit_alert_high_hysteresis->setText(QString::number(current_data->alert_high[i].hysteresis));
|
||||
ui->lineEdit_alert_high_delay->setText(QString::number(current_data->alert_high[i].delay));
|
||||
ui->checkBox_alert_high_enable->setChecked(current_data->alert_high[i].enable);
|
||||
ui->checkBox_alert_high_latch->setChecked(current_data->alert_high[i].latch);
|
||||
}else if(i + 1 == 2){
|
||||
ui->checkBox_chan_2->setChecked(current_data->variables_[i].active);
|
||||
ui->lineEdit_engineeringUnit_2->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->lineEdit_fullScalePosition_2->setText(QString::number(current_data->variables_[i].fullScalePosition));
|
||||
ui->lineEdit_xfullScalePosition_2->setText(QString::number(current_data->variables_[i].xfullScalePosition));
|
||||
ui->lineEdit_zeroScalePosition_2->setText(QString::number(current_data->variables_[i].zeroScalePosition));
|
||||
ui->lineEdit_xzeroScalePosition_2->setText(QString::number(current_data->variables_[i].xzeroScalePosition));
|
||||
ui->comboBox_rectifier_funtion_2->setCurrentIndex(current_data->variables_[i].rectifier_funtion);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level_2->setText(QString::number(current_data->danger_high[i].level));
|
||||
ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(current_data->danger_high[i].hysteresis));
|
||||
ui->lineEdit_danger_high_delay_2->setText(QString::number(current_data->danger_high[i].delay));
|
||||
ui->checkBox_danger_high_enable_2->setChecked(current_data->danger_high[i].enable);
|
||||
ui->checkBox_danger_high_latch_2->setChecked(current_data->danger_high[i].latch);
|
||||
|
||||
ui->lineEdit_alert_high_level_2->setText(QString::number(current_data->alert_high[i].level));
|
||||
ui->lineEdit_alert_high_hysteresis_2->setText(QString::number(current_data->alert_high[i].hysteresis));
|
||||
ui->lineEdit_alert_high_delay_2->setText(QString::number(current_data->alert_high[i].delay));
|
||||
ui->checkBox_alert_high_enable_2->setChecked(current_data->alert_high[i].enable);
|
||||
ui->checkBox_alert_high_latch_2->setChecked(current_data->alert_high[i].latch);
|
||||
}else if(i + 1 == 3){
|
||||
ui->checkBox_chan_3->setChecked(current_data->variables_[i].active);
|
||||
ui->lineEdit_engineeringUnit_3->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->lineEdit_fullScalePosition_3->setText(QString::number(current_data->variables_[i].fullScalePosition));
|
||||
ui->lineEdit_xfullScalePosition_3->setText(QString::number(current_data->variables_[i].xfullScalePosition));
|
||||
ui->lineEdit_zeroScalePosition_3->setText(QString::number(current_data->variables_[i].zeroScalePosition));
|
||||
ui->lineEdit_xzeroScalePosition_3->setText(QString::number(current_data->variables_[i].xzeroScalePosition));
|
||||
ui->comboBox_rectifier_funtion_3->setCurrentIndex(current_data->variables_[i].rectifier_funtion);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level_3->setText(QString::number(current_data->danger_high[i].level));
|
||||
ui->lineEdit_danger_high_hysteresis_3->setText(QString::number(current_data->danger_high[i].hysteresis));
|
||||
ui->lineEdit_danger_high_delay_3->setText(QString::number(current_data->danger_high[i].delay));
|
||||
ui->checkBox_danger_high_enable_3->setChecked(current_data->danger_high[i].enable);
|
||||
ui->checkBox_danger_high_latch_3->setChecked(current_data->danger_high[i].latch);
|
||||
|
||||
ui->lineEdit_alert_high_level_3->setText(QString::number(current_data->alert_high[i].level));
|
||||
ui->lineEdit_alert_high_hysteresis_3->setText(QString::number(current_data->alert_high[i].hysteresis));
|
||||
ui->lineEdit_alert_high_delay_3->setText(QString::number(current_data->alert_high[i].delay));
|
||||
ui->checkBox_alert_high_enable_3->setChecked(current_data->alert_high[i].enable);
|
||||
ui->checkBox_alert_high_latch_3->setChecked(current_data->alert_high[i].latch);
|
||||
}else if(i + 1 == 4){
|
||||
ui->checkBox_chan_4->setChecked(current_data->variables_[i].active);
|
||||
ui->lineEdit_engineeringUnit_4->setText(current_data->variables_[i].engineering_unit);
|
||||
ui->lineEdit_fullScalePosition_4->setText(QString::number(current_data->variables_[i].fullScalePosition));
|
||||
ui->lineEdit_xfullScalePosition_4->setText(QString::number(current_data->variables_[i].xfullScalePosition));
|
||||
ui->lineEdit_zeroScalePosition_4->setText(QString::number(current_data->variables_[i].zeroScalePosition));
|
||||
ui->lineEdit_xzeroScalePosition_4->setText(QString::number(current_data->variables_[i].xzeroScalePosition));
|
||||
ui->comboBox_rectifier_funtion_4->setCurrentIndex(current_data->variables_[i].rectifier_funtion);
|
||||
// -alarm
|
||||
ui->lineEdit_danger_high_level_4->setText(QString::number(current_data->danger_high[i].level));
|
||||
ui->lineEdit_danger_high_hysteresis_4->setText(QString::number(current_data->danger_high[i].hysteresis));
|
||||
ui->lineEdit_danger_high_delay_4->setText(QString::number(current_data->danger_high[i].delay));
|
||||
ui->checkBox_danger_high_enable_4->setChecked(current_data->danger_high[i].enable);
|
||||
ui->checkBox_danger_high_latch_4->setChecked(current_data->danger_high[i].latch);
|
||||
|
||||
ui->lineEdit_alert_high_level_4->setText(QString::number(current_data->alert_high[i].level));
|
||||
ui->lineEdit_alert_high_hysteresis_4->setText(QString::number(current_data->alert_high[i].hysteresis));
|
||||
ui->lineEdit_alert_high_delay_4->setText(QString::number(current_data->alert_high[i].delay));
|
||||
ui->checkBox_alert_high_enable_4->setChecked(current_data->alert_high[i].enable);
|
||||
ui->checkBox_alert_high_latch_4->setChecked(current_data->alert_high[i].latch);
|
||||
}
|
||||
}
|
||||
ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number);
|
||||
ui->comboBox_group->setCurrentIndex(base_ptr->group - 1);
|
||||
}
|
||||
void HighSpeedCurrent::on_lineEdit_engineeringUnit_editingFinished()
|
||||
{
|
||||
QString str = ui->lineEdit_engineeringUnit->text();
|
||||
ui->label_unit1->setText(str);
|
||||
ui->label_unit2->setText(str);
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_lineEdit_engineeringUnit_2_editingFinished()
|
||||
{
|
||||
QString str = ui->lineEdit_engineeringUnit_2->text();
|
||||
ui->label_unit1_2->setText(str);
|
||||
ui->label_unit2_2->setText(str);
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_lineEdit_engineeringUnit_3_editingFinished()
|
||||
{
|
||||
QString str = ui->lineEdit_engineeringUnit_3->text();
|
||||
ui->label_unit1_3->setText(str);
|
||||
ui->label_unit2_3->setText(str);
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_lineEdit_engineeringUnit_4_editingFinished()
|
||||
{
|
||||
QString str = ui->lineEdit_engineeringUnit_4->text();
|
||||
ui->label_unit1_4->setText(str);
|
||||
ui->label_unit2_4->setText(str);
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_pushButton_confirm_clicked()
|
||||
{
|
||||
if(ui->lineEdit_fullScalePosition->text() == "" ||
|
||||
ui->lineEdit_xfullScalePosition->text() == "" ||
|
||||
ui->lineEdit_zeroScalePosition->text() == "" ||
|
||||
ui->lineEdit_xzeroScalePosition->text() == ""){
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "请填写测量上下限数据!");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << " should not be here";
|
||||
return;
|
||||
}
|
||||
for (int var = 1; var < SLOT_NUM; var ++) {
|
||||
if(ui->comboBox_relative_number->currentIndex() != 0){
|
||||
std::shared_ptr<CardBase> slot_base_ptr = ConfigMgr::Instance()->GetSlotPtr(var);
|
||||
if(slot_base_ptr == nullptr || slot_base_ptr->card_type_ != kCardHighSpeedCurrent)
|
||||
continue;
|
||||
if(var == slot_no)
|
||||
continue;
|
||||
qDebug() << "relative_number" << var << slot_base_ptr->relative_number;
|
||||
if(slot_base_ptr->relative_number == ui->comboBox_relative_number->currentIndex() &&
|
||||
slot_base_ptr->card_type_ != kCardHighSpeedCurrent){
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "板卡相对编号重复!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
base_ptr->relative_number = ui->comboBox_relative_number->currentIndex();
|
||||
base_ptr->group = ui->comboBox_group->currentIndex() + 1;
|
||||
|
||||
std::shared_ptr<HighSpeedCurrentData> current_data = std::dynamic_pointer_cast<HighSpeedCurrentData>(base_ptr);
|
||||
UpdateData(current_data);
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_pushButton_cancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void HighSpeedCurrent::on_pushButton_copy_channel_clicked()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
43
high_speed_current.h
Normal file
43
high_speed_current.h
Normal file
@ -0,0 +1,43 @@
|
||||
#ifndef HIGH_SPEED_CURRENT_H
|
||||
#define HIGH_SPEED_CURRENT_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "data_config.h"
|
||||
#include "high_speed_current_data.h"
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class HighSpeedCurrent;
|
||||
}
|
||||
|
||||
class HighSpeedCurrent : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HighSpeedCurrent(int slot_no_,CardType cardtype,QWidget *parent = nullptr);
|
||||
~HighSpeedCurrent();
|
||||
int slot_no;
|
||||
CardType card_type;
|
||||
private slots:
|
||||
void on_lineEdit_engineeringUnit_editingFinished();
|
||||
|
||||
void on_lineEdit_engineeringUnit_2_editingFinished();
|
||||
|
||||
void on_lineEdit_engineeringUnit_3_editingFinished();
|
||||
|
||||
void on_lineEdit_engineeringUnit_4_editingFinished();
|
||||
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void on_pushButton_copy_channel_clicked();
|
||||
|
||||
private:
|
||||
Ui::HighSpeedCurrent *ui;
|
||||
void UpdateData(std::shared_ptr<HighSpeedCurrentData> ¤t_data);
|
||||
void Init();
|
||||
};
|
||||
|
||||
#endif // HIGH_SPEED_CURRENT_H
|
||||
3451
high_speed_current.ui
Normal file
3451
high_speed_current.ui
Normal file
File diff suppressed because it is too large
Load Diff
3
high_speed_current_data.cpp
Normal file
3
high_speed_current_data.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include "high_speed_current_data.h"
|
||||
|
||||
HighSpeedCurrentData::HighSpeedCurrentData() {}
|
||||
16
high_speed_current_data.h
Normal file
16
high_speed_current_data.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef HIGH_SPEED_CURRENT_DATA_H
|
||||
#define HIGH_SPEED_CURRENT_DATA_H
|
||||
|
||||
#include "cardbase.h"
|
||||
|
||||
class HighSpeedCurrentData : public CardBase
|
||||
{
|
||||
public:
|
||||
HighSpeedCurrentData();
|
||||
HighSpeedCurrentVariables variables_[4];
|
||||
AlarmDangerHigh danger_high[CHANNEL_COUNT_SPEED];
|
||||
AlarmAlertHigh alert_high[CHANNEL_COUNT_SPEED];
|
||||
DCOutput dc_output[CHANNEL_COUNT];
|
||||
};
|
||||
|
||||
#endif // HIGH_SPEED_CURRENT_DATA_H
|
||||
@ -21,7 +21,6 @@
|
||||
#include "vibrationdata.h"
|
||||
#include "connect.h"
|
||||
#include "tmrrelayassociation.h"
|
||||
#include "setpoint_tachometer.h"
|
||||
#include "pointname.h"
|
||||
#include "ethconfig.h"
|
||||
#include "macconfig.h"
|
||||
@ -33,6 +32,7 @@
|
||||
#include <QUrl>
|
||||
#include <QFileInfo>
|
||||
#include "channel_crc.h"
|
||||
#include "high_speed_current.h"
|
||||
|
||||
QString g_strServerIp;
|
||||
QString g_version;
|
||||
@ -124,7 +124,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
//qInstallMessageHandler(messageHandler);
|
||||
#endif
|
||||
QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy");
|
||||
QString Version = "V1.0_" + buildDate.toString("yyyyMMdd") + "_129d";
|
||||
QString Version = "V1.0_" + buildDate.toString("yyyyMMdd") + "_1704";
|
||||
ui->label_version->setText(Version);
|
||||
}
|
||||
|
||||
@ -196,6 +196,7 @@ void MainWindow::createMenu(const QString &rootTitle, QPushButton *parent) {
|
||||
QMenu *monitors = new QMenu("监视器", mainMenu);
|
||||
QMenu *relays = new QMenu("/DOM810 继电器模块", mainMenu);
|
||||
QMenu *keyphasor = new QMenu("/KPM834 键相模块", mainMenu);
|
||||
|
||||
// 创建第二层子菜单:/HAM824 振动板卡
|
||||
QMenu *proximitor_menu = new QMenu("/HAM824 振动板卡", monitors);
|
||||
QMenu *rpm_menu = new QMenu("/OPM844 转速板卡", monitors);
|
||||
@ -224,6 +225,8 @@ void MainWindow::createMenu(const QString &rootTitle, QPushButton *parent) {
|
||||
mainMenu->addMenu(monitors); // 将第一层加入主菜单
|
||||
mainMenu->addMenu(relays);
|
||||
mainMenu->addMenu(keyphasor);
|
||||
QAction *high_speed_current = monitors->addAction("/HAM851 高速电流卡");
|
||||
high_speed_current->setData(kCardHighSpeedCurrent);
|
||||
QAction *reset = mainMenu->addAction("重置模块");
|
||||
mainMenu->addSeparator();
|
||||
QAction *upgrade = mainMenu->addAction("升级固件");
|
||||
@ -267,7 +270,7 @@ void MainWindow::createMenu(const QString &rootTitle, QPushButton *parent) {
|
||||
QObject::connect(get_card_processID, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
|
||||
QObject::connect(copy_sub_card, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
|
||||
QObject::connect(move_sub_card, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
|
||||
|
||||
QObject::connect(high_speed_current, &QAction::triggered, this, &MainWindow::onMenuActionTriggered);
|
||||
}
|
||||
|
||||
void MainWindow::createMenuSet(const QString &rootTitle, QPushButton *parent) {
|
||||
@ -329,6 +332,8 @@ void MainWindow::onMenuActionTriggered() {
|
||||
chan_display = "振动";
|
||||
} else if (slot_type == "OPM844") {
|
||||
chan_display = "转速";
|
||||
} else if (slot_type == "HAM851") {
|
||||
chan_display = "高速\n电流";
|
||||
}
|
||||
if (card_type == kCardRelayTMRPrimary &&
|
||||
(ConfigMgr::Instance()->card_type_[button_id - 1] != kCardNone ||
|
||||
@ -376,11 +381,16 @@ void MainWindow::onMenuActionTriggered() {
|
||||
ConfigMgr::Instance()->LaodTemplate(":/config/template_vib.json",button_id);
|
||||
}
|
||||
|
||||
}else if ((card_type == kCardVibSingle || card_type == kCardSpeedSingle ||
|
||||
}else if ((card_type == kCardVibSingle || card_type == kCardSpeedSingle || card_type == kCardHighSpeedCurrent ||
|
||||
card_type == kCardKeyphaseSingle || card_type == kCardRelaySingle ||
|
||||
card_type == kCardRelaySingleNOK) && ConfigMgr::Instance()->card_type_[button_id - 1] != kCardNone) {
|
||||
QMessageBox::information(this, QStringLiteral("提示"), "不要重叠单板卡配置,请在创建新配置之前移除现有的配置!");
|
||||
return;
|
||||
}else if(card_type == kCardHighSpeedCurrent){
|
||||
map_slot_config[button_id].slot_type = slot_type;
|
||||
map_slot_config[button_id].card_type = card_type;
|
||||
button->setText(chan_display);
|
||||
ConfigMgr::Instance()->card_type_[button_id - 1] = card_type;
|
||||
}
|
||||
if (action->text() == "重置模块") {
|
||||
QMessageBox *box = new QMessageBox(QMessageBox::Question, "提示", "是否重置板卡?", QMessageBox::Yes | QMessageBox::No, this);
|
||||
@ -423,7 +433,8 @@ void MainWindow::onMenuActionTriggered() {
|
||||
|
||||
}else if (ConfigMgr::Instance()->card_type_[button_id - 1] == kCardVibSingle ||
|
||||
ConfigMgr::Instance()->card_type_[button_id - 1] == kCardSpeedSingle ||
|
||||
ConfigMgr::Instance()->card_type_[button_id - 1] == kCardKeyphaseSingle) {
|
||||
ConfigMgr::Instance()->card_type_[button_id - 1] == kCardKeyphaseSingle ||
|
||||
ConfigMgr::Instance()->card_type_[button_id - 1] == kCardHighSpeedCurrent ) {
|
||||
ConfigMgr::Instance()->card_type_[button_id - 1] = kCardNone;
|
||||
map_slot_config[button_id].slot_btn->setText("");
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
|
||||
@ -511,6 +522,10 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
|
||||
Tachometer *tachometer = new Tachometer(button_id,map_slot_config[button_id].card_type);
|
||||
tachometer->setWindowModality(Qt::ApplicationModal);
|
||||
tachometer->show();
|
||||
} else if (slot_config.slot_type == "HAM851") { // 高速电流模块
|
||||
HighSpeedCurrent *high_speed_current = new HighSpeedCurrent(button_id,map_slot_config[button_id].card_type);
|
||||
high_speed_current->setWindowModality(Qt::ApplicationModal);
|
||||
high_speed_current->show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -540,6 +555,11 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
|
||||
single_relay->show();
|
||||
break;
|
||||
}
|
||||
case kCardHighSpeedCurrent:{
|
||||
HighSpeedCurrent *high_speed_current = new HighSpeedCurrent(button_id,map_slot_config[button_id].card_type);
|
||||
high_speed_current->setWindowModality(Qt::ApplicationModal);
|
||||
high_speed_current->show();
|
||||
}break;
|
||||
case kCardRelayTMRPrimary:{
|
||||
TMRRelayAssociation *single_tmr_relay = new TMRRelayAssociation(button_id,map_slot_config[button_id].card_type);
|
||||
single_tmr_relay->setWindowModality(Qt::ApplicationModal);
|
||||
@ -559,23 +579,14 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
|
||||
if(base_ptr == nullptr)
|
||||
return;
|
||||
switch(base_ptr->card_type_){
|
||||
case kCardVibSingle:{
|
||||
case kCardVibSingle:
|
||||
case kCardHighSpeedCurrent:
|
||||
{
|
||||
QString object_name = slot_btn->objectName();
|
||||
int button_id = object_name.right(object_name.length() - 15).toInt();
|
||||
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:{
|
||||
QString object_name = slot_btn->objectName();
|
||||
int button_id = object_name.right(object_name.length() - 15).toInt();
|
||||
Setpoint_Tachometer *setpoint_tachometer = new Setpoint_Tachometer(button_id,ConfigMgr::Instance()->card_type_[button_id - 1]);
|
||||
setpoint_tachometer->setWindowModality(Qt::ApplicationModal);
|
||||
setpoint_tachometer->show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -744,6 +755,10 @@ void MainWindow::on_pushButton_open_clicked() {
|
||||
buttonList[i + 1]->setText("转速");
|
||||
break;
|
||||
}
|
||||
case kCardHighSpeedCurrent:{
|
||||
buttonList[i + 1]->setText("高速\n电流");
|
||||
break;
|
||||
}
|
||||
case kCardRelaySingle:
|
||||
case kCardRelaySingleNOK:
|
||||
case kCardRelayTMRBackup:
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1129</width>
|
||||
<height>561</height>
|
||||
<height>564</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -367,7 +367,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
@ -723,25 +723,62 @@
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
<height>280</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
<height>280</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>140</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>电源1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>140</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>电源2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -1090,7 +1127,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1129</width>
|
||||
<height>23</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_start">
|
||||
|
||||
@ -32,9 +32,6 @@ class Tachometer : public QDialog {
|
||||
private:
|
||||
Ui::Tachometer *ui;
|
||||
void UpdateData(std::shared_ptr<TachometerData> &speed_data);
|
||||
// Tachometer_Variables tachometer_variables[4];
|
||||
|
||||
// void readJsonFile(const QString &filePath);
|
||||
void Init();
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user