Compare commits
2 Commits
c96ed16d09
...
648b8b0f70
Author | SHA1 | Date | |
---|---|---|---|
648b8b0f70 | |||
1f780ef25b |
@ -37,8 +37,6 @@ class VariableBase {
|
|||||||
AlarmAlertLow gap_alert_low;
|
AlarmAlertLow gap_alert_low;
|
||||||
|
|
||||||
FrequencybandOutput freband_output[10];
|
FrequencybandOutput freband_output[10];
|
||||||
|
|
||||||
DCOutput dc_output[4];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 位移
|
// 位移
|
||||||
|
@ -41,6 +41,7 @@ void ConfigMgr::Save(QString & file_path) {
|
|||||||
card_type_[i] != kCardRelaySingleNOK) {
|
card_type_[i] != kCardRelaySingleNOK) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
qDebug() << "i" << i ;
|
||||||
// process slot
|
// process slot
|
||||||
QJsonObject slot_item;
|
QJsonObject slot_item;
|
||||||
if (card_type_[i] != kCardRelaySingle &&
|
if (card_type_[i] != kCardRelaySingle &&
|
||||||
@ -74,15 +75,26 @@ void ConfigMgr::Save(QString & file_path) {
|
|||||||
voltage_range.append(ptr->base_config_[cid].normal_voltage_low);
|
voltage_range.append(ptr->base_config_[cid].normal_voltage_low);
|
||||||
voltage_range.append(ptr->base_config_[cid].normal_voltage_high);
|
voltage_range.append(ptr->base_config_[cid].normal_voltage_high);
|
||||||
channel_item["normal_voltage_range"] = voltage_range;
|
channel_item["normal_voltage_range"] = voltage_range;
|
||||||
QJsonObject setpoint_data;
|
QJsonObject dc_output;
|
||||||
|
QJsonArray dc_output_array;
|
||||||
if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust ||
|
if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust ||
|
||||||
ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){
|
ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){
|
||||||
if(ptr->base_config_[cid].channel_type != kVibThrust){
|
if(ptr->base_config_[cid].channel_type != kVibThrust){
|
||||||
channel_item["keyphase"] = ptr->base_config_[cid].keyphase;
|
channel_item["keyphase"] = ptr->base_config_[cid].keyphase;
|
||||||
channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot;
|
channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot;
|
||||||
channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch;
|
channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(int var = 0 ; var < CHANNEL_COUNT; ++ var ){
|
||||||
|
if(ptr->dc_output[cid][var].output_channel > 0){
|
||||||
|
dc_output["output_channel"] = ptr->dc_output[cid][var].output_channel;
|
||||||
|
dc_output["minmum"] = ptr->dc_output[cid][var].minmum;
|
||||||
|
dc_output["maxmum"] = ptr->dc_output[cid][var].maxmum;
|
||||||
|
dc_output_array.append(dc_output);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
channel_item["dc_output"] = dc_output_array;
|
||||||
// if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){
|
// if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){
|
||||||
// setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0;
|
// setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0;
|
||||||
// setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable;
|
// setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable;
|
||||||
@ -570,6 +582,16 @@ void ConfigMgr::Load(QString filename) {
|
|||||||
vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt();
|
vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt();
|
||||||
vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt();
|
vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt();
|
||||||
}
|
}
|
||||||
|
// dc_output
|
||||||
|
QJsonArray dc_output_array = channel["dc_output"].toArray();
|
||||||
|
if(!dc_output_array.isEmpty()){
|
||||||
|
for(int var = 0 ; var < CHANNEL_COUNT; ++var){
|
||||||
|
QJsonObject dc_output_obj = dc_output_array[var].toObject();
|
||||||
|
vib_data->dc_output[j][var].output_channel = dc_output_obj["output_channel"].toInt();
|
||||||
|
vib_data->dc_output[j][var].minmum = dc_output_obj["minmum"].toInt();
|
||||||
|
vib_data->dc_output[j][var].maxmum = dc_output_obj["maxmum"].toInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
// if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){
|
// if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){
|
||||||
// vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble();
|
// vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble();
|
||||||
// vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool();
|
// vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool();
|
||||||
|
@ -8,9 +8,13 @@
|
|||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bool used[4]; // 是否已配置
|
||||||
|
}ChannelUsed;
|
||||||
|
|
||||||
extern QString g_strServerIp; // 服务端IP
|
extern QString g_strServerIp; // 服务端IP
|
||||||
extern QString g_version;
|
extern QString g_version;
|
||||||
|
extern ChannelUsed ch_used;
|
||||||
#define SLOT_NUM 15
|
#define SLOT_NUM 15
|
||||||
#define CHANNEL_COUNT 4
|
#define CHANNEL_COUNT 4
|
||||||
#define RELAY_COUNT 16
|
#define RELAY_COUNT 16
|
||||||
@ -54,7 +58,68 @@ typedef enum {
|
|||||||
kVibThrust = 3, //轴向位移
|
kVibThrust = 3, //轴向位移
|
||||||
kVibPressurePulsation = 4 //动态压力脉动
|
kVibPressurePulsation = 4 //动态压力脉动
|
||||||
} VibChannelType;
|
} VibChannelType;
|
||||||
|
enum TotalCalcValueType {
|
||||||
|
// 转速
|
||||||
|
kSpeedRpm = 0,
|
||||||
|
|
||||||
|
// 轴向位移
|
||||||
|
kThrustGap = 2,
|
||||||
|
|
||||||
|
// 径向位移
|
||||||
|
kRadialPk = 4,
|
||||||
|
kRadialPk2Pk = 5,
|
||||||
|
kRadialRmsScaledPeak = 6,
|
||||||
|
kRadialRmsScaledPk2Pk = 7,
|
||||||
|
|
||||||
|
// 速度
|
||||||
|
kVelPeak = 11,
|
||||||
|
kVelRmsScaledPeak = 12,
|
||||||
|
kVelRms = 13,
|
||||||
|
|
||||||
|
kVelDisPeak = 17,
|
||||||
|
kVelDisPk2Pk = 18,
|
||||||
|
kVelDisRmsScaledPeak = 19,
|
||||||
|
kVelDisRmsScaledPk2Pk = 20,
|
||||||
|
|
||||||
|
// 加速度
|
||||||
|
kAccPeak = 21,
|
||||||
|
kAccRmsScaledPeak = 22,
|
||||||
|
kAccRms = 23,
|
||||||
|
|
||||||
|
kAccVelPeak = 26,
|
||||||
|
kAccVelRmsScaledPeak = 27,
|
||||||
|
kAccVelRms = 28,
|
||||||
|
|
||||||
|
kAccDisPeak = 31,
|
||||||
|
kAccDisPk2Pk = 32,
|
||||||
|
kAccDisRmsScaledPeak = 33,
|
||||||
|
kAccDisRmsScaledPk2Pk = 34,
|
||||||
|
|
||||||
|
// 压力脉动
|
||||||
|
kPressPulsationPeak = 41,
|
||||||
|
kPressPulsationRmsScaledPeak = 42,
|
||||||
|
kPressPulsationRms = 43,
|
||||||
|
|
||||||
|
// kTriggerPressurePulsationLow = 11, // [10, 40]
|
||||||
|
// kTriggerPressurePulsationMID1 = 12, // (40, 120]
|
||||||
|
// kTriggerPressurePulsationMID2 = 13, // (120, 190]
|
||||||
|
// kTriggerPressurePulsationHIGH1 = 14, // (190, 290]
|
||||||
|
// kTriggerPressurePulsationHIGH2 = 15, // (290, 500]
|
||||||
|
// kTriggerPressurePulsationHH1 = 16, // (500, 2000]
|
||||||
|
// kTriggerPressurePulsationHH2 = 17, // (2000, 3200]
|
||||||
|
// kTriggerPressurePulsationHH3 = 18, // (3200, 4200]
|
||||||
|
// kTriggerPressurePulsationHH4 = 19, // (4200, 4600]
|
||||||
|
// kTriggerPressurePulsationOA = 20, // [5, 500]
|
||||||
|
|
||||||
|
// 复合运算
|
||||||
|
kSmax = 81, // 径向位移运算
|
||||||
|
kDifferentialHousingExpansion = 82, // 差胀,针对轴向位移,做减法
|
||||||
|
kRelativeShaftTaper = 83, // 径向位移,根据公式进行计算
|
||||||
|
kRelativeShaftCollar = 84, // 径向位移,根据公式进行计算
|
||||||
|
kDualMathematicalFunction = 85, // 公式计算
|
||||||
|
|
||||||
|
kDCValue = 100,
|
||||||
|
};
|
||||||
typedef enum{
|
typedef enum{
|
||||||
kTruePeak = 0,
|
kTruePeak = 0,
|
||||||
kTruePeakToPeak = 1,
|
kTruePeakToPeak = 1,
|
||||||
@ -74,7 +139,11 @@ typedef enum{
|
|||||||
kUnit6 = 5, // mm
|
kUnit6 = 5, // mm
|
||||||
kUnit7 = 6, // mils
|
kUnit7 = 6, // mils
|
||||||
kUnit8 = 7, // inch/s**2
|
kUnit8 = 7, // inch/s**2
|
||||||
kUnit9 = 8 // user defined
|
kUnit9 = 9, // mbar
|
||||||
|
kUnit10 = 10, // bar
|
||||||
|
kUnit11 = 11, // psi
|
||||||
|
kUnit12 = 12, // pa
|
||||||
|
kUnit13 = 13 // user defined
|
||||||
} EngineeringUnit;
|
} EngineeringUnit;
|
||||||
|
|
||||||
typedef struct SlotConfig_{
|
typedef struct SlotConfig_{
|
||||||
@ -209,6 +278,8 @@ typedef struct DCOutput_{
|
|||||||
maxmum = 0;
|
maxmum = 0;
|
||||||
}
|
}
|
||||||
} DCOutput;
|
} DCOutput;
|
||||||
|
|
||||||
|
|
||||||
//typedef struct {
|
//typedef struct {
|
||||||
// Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass
|
// Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass
|
||||||
//} AllFilter;
|
//} AllFilter;
|
||||||
|
@ -1,12 +1,26 @@
|
|||||||
#include "dc_output_channel.h"
|
#include "dc_output_channel.h"
|
||||||
#include "ui_dc_output_channel.h"
|
#include "ui_dc_output_channel.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include "data_config.h"
|
||||||
|
|
||||||
DC_Output_Channel::DC_Output_Channel(QWidget *parent) :
|
|
||||||
|
|
||||||
|
DC_Output_Channel::DC_Output_Channel(QString unit_str_,QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::DC_Output_Channel)
|
ui(new Ui::DC_Output_Channel)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
unit_str = unit_str_;
|
||||||
|
ui->label_min_unit->setText(unit_str);
|
||||||
|
ui->label_max_unit->setText(unit_str);
|
||||||
|
radiobtn[0] = ui->radioButton;
|
||||||
|
radiobtn[1] = ui->radioButton_2;
|
||||||
|
radiobtn[2] = ui->radioButton_3;
|
||||||
|
radiobtn[3] = ui->radioButton_4;
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
if(ch_used.used[i])
|
||||||
|
radiobtn[i]->setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DC_Output_Channel::~DC_Output_Channel()
|
DC_Output_Channel::~DC_Output_Channel()
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define DC_OUTPUT_CHANNEL_H
|
#define DC_OUTPUT_CHANNEL_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QRadioButton>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class DC_Output_Channel;
|
class DC_Output_Channel;
|
||||||
@ -12,7 +13,7 @@ class DC_Output_Channel : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DC_Output_Channel(QWidget *parent = nullptr);
|
explicit DC_Output_Channel(QString unit_str_,QWidget *parent = nullptr);
|
||||||
~DC_Output_Channel();
|
~DC_Output_Channel();
|
||||||
signals:
|
signals:
|
||||||
void output_channel_data_sg(int channel,float minmun,float maxmum);
|
void output_channel_data_sg(int channel,float minmun,float maxmum);
|
||||||
@ -23,6 +24,9 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DC_Output_Channel *ui;
|
Ui::DC_Output_Channel *ui;
|
||||||
|
QString unit_str;
|
||||||
|
QRadioButton *radiobtn[4];
|
||||||
|
bool channel_used[4] = {false,false,false,false};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DC_OUTPUT_CHANNEL_H
|
#endif // DC_OUTPUT_CHANNEL_H
|
||||||
|
207
dc_outputs.cpp
207
dc_outputs.cpp
@ -7,6 +7,8 @@
|
|||||||
#include "data_config.h"
|
#include "data_config.h"
|
||||||
#include "vibrationdata.h"
|
#include "vibrationdata.h"
|
||||||
|
|
||||||
|
ChannelUsed ch_used;
|
||||||
|
|
||||||
DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) :
|
DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::DC_Outputs)
|
ui(new Ui::DC_Outputs)
|
||||||
@ -15,7 +17,7 @@ DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) :
|
|||||||
ui->comboBox_ch_output->setView(new QListView());
|
ui->comboBox_ch_output->setView(new QListView());
|
||||||
slot_no = slot_no_;
|
slot_no = slot_no_;
|
||||||
car_type = static_cast<CardType>(cardtype);
|
car_type = static_cast<CardType>(cardtype);
|
||||||
memset(channel_used,0,sizeof(channel_used));
|
unit = "";
|
||||||
current_index = ui->comboBox_ch_output->currentIndex();
|
current_index = ui->comboBox_ch_output->currentIndex();
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
@ -28,25 +30,120 @@ DC_Outputs::~DC_Outputs()
|
|||||||
void DC_Outputs::Init(){
|
void DC_Outputs::Init(){
|
||||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||||
if (base_ptr == nullptr) {
|
if (base_ptr == nullptr) {
|
||||||
qCritical() << "[Acceleration::Init] should not be here";
|
qCritical() << "[DC_Outputs"
|
||||||
|
"::Init] should not be here";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
vib_dc_output_ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(current_index + 1);
|
QString unit_str = GetUnit();
|
||||||
if (variable_base == nullptr) {
|
if(vib_dc_output_ptr->dc_output[current_index][0].output_channel == 1){
|
||||||
qDebug() << "[Acceleration::Init] no channel ptr";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(variable_base->dc_output[0].output_channel == 1){
|
|
||||||
ui->label_ch_1->setText("通道1");
|
ui->label_ch_1->setText("通道1");
|
||||||
ui->label_ch_1_min->setText(QString::number(variable_base->dc_output[0].minmum));
|
ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].minmum));
|
||||||
ui->label_ch_1_max->setText(QString::number(variable_base->dc_output[0].maxmum));
|
ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].maxmum));
|
||||||
|
ch_used.used[0] = true;
|
||||||
}
|
}
|
||||||
|
if(vib_dc_output_ptr->dc_output[current_index][1].output_channel == 2){
|
||||||
|
ui->label_ch_2->setText("通道2");
|
||||||
|
ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].minmum));
|
||||||
|
ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].maxmum));
|
||||||
|
ch_used.used[1] = true;
|
||||||
|
}
|
||||||
|
if(vib_dc_output_ptr->dc_output[current_index][2].output_channel == 3){
|
||||||
|
ui->label_ch_3->setText("通道3");
|
||||||
|
ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].minmum));
|
||||||
|
ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].maxmum));
|
||||||
|
ch_used.used[2] = true;
|
||||||
|
}
|
||||||
|
if(vib_dc_output_ptr->dc_output[current_index][3].output_channel == 4){
|
||||||
|
ui->label_ch_4->setText("通道4");
|
||||||
|
ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].minmum));
|
||||||
|
ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].maxmum));
|
||||||
|
ch_used.used[3] = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DC_Outputs::GetUnit(){
|
||||||
|
int unit_num = -1;
|
||||||
|
QString unit_str = "";
|
||||||
|
std::shared_ptr<VariableBase> variable_base = vib_dc_output_ptr->GetChannelPtr(current_index + 1);
|
||||||
|
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibRadial) {
|
||||||
|
std::shared_ptr<RadialVariable> variable_ptr = std::dynamic_pointer_cast<RadialVariable>(variable_base);
|
||||||
|
unit_num = variable_ptr->general.engineering_unit;
|
||||||
|
}
|
||||||
|
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibAcc) {
|
||||||
|
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||||
|
unit_num = variable_ptr->general.engineering_unit;
|
||||||
|
}
|
||||||
|
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibVelocity) {
|
||||||
|
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||||
|
unit_num = variable_ptr->general.engineering_unit;
|
||||||
|
}
|
||||||
|
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibThrust) {
|
||||||
|
std::shared_ptr<ThrustVariable> variable_ptr = std::dynamic_pointer_cast<ThrustVariable>(variable_base);
|
||||||
|
unit_num = variable_ptr->general.engineering_unit;
|
||||||
|
}
|
||||||
|
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibPressurePulsation) {
|
||||||
|
std::shared_ptr<PressurePulsationVariable> variable_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
||||||
|
unit_num = variable_ptr->general.engineering_unit;
|
||||||
|
}
|
||||||
|
switch (unit_num) {
|
||||||
|
case kUnit1:{
|
||||||
|
unit_str = "g";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit2:{
|
||||||
|
unit_str = "m/s**2";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit3:{
|
||||||
|
unit_str = "mm/s";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit4:{
|
||||||
|
unit_str = "inch/s";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit5:{
|
||||||
|
unit_str = "um";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit6:{
|
||||||
|
unit_str = "mm";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit7:{
|
||||||
|
unit_str = "mils";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit8:{
|
||||||
|
unit_str = "inch/s**2";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit9:{
|
||||||
|
unit_str = "mbar";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit10:{
|
||||||
|
unit_str = "bar";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit11:{
|
||||||
|
unit_str = "psi";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kUnit12:{
|
||||||
|
unit_str = "pa";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return unit_str;
|
||||||
|
}
|
||||||
void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
||||||
{
|
{
|
||||||
DC_Output_Channel *dc_output_channel = new DC_Output_Channel();
|
current_index = index;
|
||||||
|
QString unit_str = GetUnit();
|
||||||
|
DC_Output_Channel *dc_output_channel = new DC_Output_Channel(unit_str);
|
||||||
dc_output_channel->setWindowModality(Qt::ApplicationModal);
|
dc_output_channel->setWindowModality(Qt::ApplicationModal);
|
||||||
connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float)),this,SLOT(output_channel_data(int,float,float)));
|
connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float)),this,SLOT(output_channel_data(int,float,float)));
|
||||||
dc_output_channel->show();
|
dc_output_channel->show();
|
||||||
@ -54,13 +151,91 @@ void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
|||||||
|
|
||||||
void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum){
|
void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum){
|
||||||
qDebug() << channel << minmun << maxmum ;
|
qDebug() << channel << minmun << maxmum ;
|
||||||
|
QString unit_str = GetUnit();
|
||||||
if(channel == 1){
|
if(channel == 1){
|
||||||
|
ui->label_ch_1->setText("通道1");
|
||||||
|
ui->label_ch_1_min->setText(QString::number(minmun));
|
||||||
|
ui->label_ch_1_max->setText(QString::number(maxmum));
|
||||||
|
ch_used.used[0] = true;
|
||||||
}else if(channel == 2){
|
}else if(channel == 2){
|
||||||
|
ui->label_ch_2->setText("通道2");
|
||||||
|
ui->label_ch_2_min->setText(QString::number(minmun));
|
||||||
|
ui->label_ch_2_max->setText(QString::number(maxmum));
|
||||||
|
ch_used.used[1] = true;
|
||||||
}else if(channel == 3){
|
}else if(channel == 3){
|
||||||
|
ui->label_ch_3->setText("通道3");
|
||||||
|
ui->label_ch_3_min->setText(QString::number(minmun));
|
||||||
|
ui->label_ch_3_max->setText(QString::number(maxmum));
|
||||||
|
ch_used.used[2] = true;
|
||||||
}else if(channel == 4){
|
}else if(channel == 4){
|
||||||
|
ui->label_ch_4->setText("通道4");
|
||||||
|
ui->label_ch_4_min->setText(QString::number(minmun));
|
||||||
|
ui->label_ch_4_max->setText(QString::number(maxmum));
|
||||||
|
ch_used.used[3] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DC_Outputs::on_pushButton_confirm_clicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(ui->label_ch_1->text() != "未使用"){
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][0].output_channel = 1;
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][0].minmum = ui->label_ch_1_min->text().toFloat();
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][0].maxmum = ui->label_ch_1_max->text().toFloat();
|
||||||
|
}
|
||||||
|
if(ui->label_ch_2->text() != "未使用"){
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][1].output_channel = 2;
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][1].minmum = ui->label_ch_2_min->text().toFloat();
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][1].maxmum = ui->label_ch_2_max->text().toFloat();
|
||||||
|
}
|
||||||
|
if(ui->label_ch_3->text() != "未使用"){
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][2].output_channel = 3;
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][2].minmum = ui->label_ch_3_min->text().toFloat();
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][2].maxmum = ui->label_ch_3_max->text().toFloat();
|
||||||
|
}
|
||||||
|
if(ui->label_ch_4->text() != "未使用"){
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][3].output_channel = 4;
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][3].minmum = ui->label_ch_4_min->text().toFloat();
|
||||||
|
vib_dc_output_ptr->dc_output[current_index][3].maxmum = ui->label_ch_4_max->text().toFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DC_Outputs::on_pushButton_cancel_clicked()
|
||||||
|
{
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DC_Outputs::on_comboBox_ch_output_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
current_index = index;
|
||||||
|
QString unit_str = GetUnit();
|
||||||
|
if(vib_dc_output_ptr->dc_output[current_index][0].output_channel == 1){
|
||||||
|
ui->label_ch_1->setText("通道1");
|
||||||
|
ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].minmum));
|
||||||
|
ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].maxmum));
|
||||||
|
ch_used.used[0] = true;
|
||||||
|
}
|
||||||
|
if(vib_dc_output_ptr->dc_output[current_index][1].output_channel == 2){
|
||||||
|
ui->label_ch_2->setText("通道2");
|
||||||
|
ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].minmum));
|
||||||
|
ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].maxmum));
|
||||||
|
ch_used.used[1] = true;
|
||||||
|
}
|
||||||
|
if(vib_dc_output_ptr->dc_output[current_index][2].output_channel == 3){
|
||||||
|
ui->label_ch_3->setText("通道3");
|
||||||
|
ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].minmum));
|
||||||
|
ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].maxmum));
|
||||||
|
ch_used.used[2] = true;
|
||||||
|
}
|
||||||
|
if(vib_dc_output_ptr->dc_output[current_index][3].output_channel == 4){
|
||||||
|
ui->label_ch_4->setText("通道4");
|
||||||
|
ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].minmum));
|
||||||
|
ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].maxmum));
|
||||||
|
ch_used.used[3] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
12
dc_outputs.h
12
dc_outputs.h
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "data_config.h"
|
#include "data_config.h"
|
||||||
|
#include "vibrationdata.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class DC_Outputs;
|
class DC_Outputs;
|
||||||
@ -20,13 +21,22 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void on_comboBox_ch_output_activated(int index);
|
void on_comboBox_ch_output_activated(int index);
|
||||||
|
|
||||||
|
void on_pushButton_confirm_clicked();
|
||||||
|
|
||||||
|
void on_pushButton_cancel_clicked();
|
||||||
|
|
||||||
void output_channel_data(int channel,float minmun,float maxmum);
|
void output_channel_data(int channel,float minmun,float maxmum);
|
||||||
|
|
||||||
|
void on_comboBox_ch_output_currentIndexChanged(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::DC_Outputs *ui;
|
Ui::DC_Outputs *ui;
|
||||||
|
std::shared_ptr<VibrationData> vib_dc_output_ptr = nullptr;
|
||||||
void Init();
|
void Init();
|
||||||
bool channel_used[4];
|
QString GetUnit();
|
||||||
|
|
||||||
int current_index;
|
int current_index;
|
||||||
|
QString unit;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DC_OUTPUTS_H
|
#endif // DC_OUTPUTS_H
|
||||||
|
136
dc_outputs.ui
136
dc_outputs.ui
@ -213,12 +213,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>300</x>
|
<x>300</x>
|
||||||
<y>160</y>
|
<y>160</y>
|
||||||
<width>101</width>
|
<width>41</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>----- -----</string>
|
<string>----- </string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_ch_2_min">
|
<widget class="QLabel" name="label_ch_2_min">
|
||||||
@ -226,12 +226,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>300</x>
|
<x>300</x>
|
||||||
<y>200</y>
|
<y>200</y>
|
||||||
<width>101</width>
|
<width>31</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>----- -----</string>
|
<string>-----</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_ch_1_max">
|
<widget class="QLabel" name="label_ch_1_max">
|
||||||
@ -239,12 +239,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>420</x>
|
<x>420</x>
|
||||||
<y>160</y>
|
<y>160</y>
|
||||||
<width>121</width>
|
<width>31</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>----- -----</string>
|
<string>-----</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_ch_2_max">
|
<widget class="QLabel" name="label_ch_2_max">
|
||||||
@ -252,12 +252,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>420</x>
|
<x>420</x>
|
||||||
<y>200</y>
|
<y>200</y>
|
||||||
<width>101</width>
|
<width>31</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>----- -----</string>
|
<string>-----</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_ch_3_min">
|
<widget class="QLabel" name="label_ch_3_min">
|
||||||
@ -265,12 +265,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>300</x>
|
<x>300</x>
|
||||||
<y>240</y>
|
<y>240</y>
|
||||||
<width>71</width>
|
<width>31</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>----- -----</string>
|
<string>-----</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_ch_4_min">
|
<widget class="QLabel" name="label_ch_4_min">
|
||||||
@ -278,12 +278,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>300</x>
|
<x>300</x>
|
||||||
<y>280</y>
|
<y>280</y>
|
||||||
<width>71</width>
|
<width>31</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>----- -----</string>
|
<string>-----</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_ch_3_max">
|
<widget class="QLabel" name="label_ch_3_max">
|
||||||
@ -291,12 +291,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>420</x>
|
<x>420</x>
|
||||||
<y>240</y>
|
<y>240</y>
|
||||||
<width>71</width>
|
<width>31</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>----- -----</string>
|
<string>-----</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_ch_4_max">
|
<widget class="QLabel" name="label_ch_4_max">
|
||||||
@ -304,12 +304,12 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>420</x>
|
<x>420</x>
|
||||||
<y>280</y>
|
<y>280</y>
|
||||||
<width>71</width>
|
<width>31</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>----- -----</string>
|
<string>-----</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="pushButton_confirm">
|
<widget class="QPushButton" name="pushButton_confirm">
|
||||||
@ -338,6 +338,110 @@
|
|||||||
<string>取消</string>
|
<string>取消</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_ch_1_min_unit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>340</x>
|
||||||
|
<y>160</y>
|
||||||
|
<width>41</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>----- </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_ch_1_max_unit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>460</x>
|
||||||
|
<y>160</y>
|
||||||
|
<width>41</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>----- </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_ch_2_min_unit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>340</x>
|
||||||
|
<y>200</y>
|
||||||
|
<width>41</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>----- </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_ch_2_max_unit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>460</x>
|
||||||
|
<y>200</y>
|
||||||
|
<width>41</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>----- </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_ch_3_min_unit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>340</x>
|
||||||
|
<y>240</y>
|
||||||
|
<width>41</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>----- </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_ch_3_max_unit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>460</x>
|
||||||
|
<y>240</y>
|
||||||
|
<width>41</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>----- </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_ch_4_min_unit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>340</x>
|
||||||
|
<y>280</y>
|
||||||
|
<width>41</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>----- </string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_ch_4_max_unit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>460</x>
|
||||||
|
<y>280</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>-----</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -14,6 +14,7 @@ class VibrationData : public CardBase {
|
|||||||
std::vector<std::shared_ptr<VariableBase>> variables_;
|
std::vector<std::shared_ptr<VariableBase>> variables_;
|
||||||
VibAlertDanger alert_danger[CHANNEL_COUNT];
|
VibAlertDanger alert_danger[CHANNEL_COUNT];
|
||||||
VibAlertDangerPress alert_danger_press[CHANNEL_COUNT];
|
VibAlertDangerPress alert_danger_press[CHANNEL_COUNT];
|
||||||
|
DCOutput dc_output[CHANNEL_COUNT][CHANNEL_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VIBRATIONDATA_H
|
#endif // VIBRATIONDATA_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user