解决DC output单位显示问题

This commit is contained in:
zhangsheng 2026-03-26 10:22:13 +08:00
parent abb9b7ccff
commit e43f61d648
6 changed files with 34 additions and 31 deletions

View File

@ -24,7 +24,7 @@ class VariableBase {
virtual ~VariableBase() {}
int id_;
VibChannelType type_;
int type_;
Filter filter_[3];
General general;
AlarmDangerHigh danger_high;

View File

@ -779,6 +779,7 @@ void ConfigMgr::Load(QString filename) {
variable->filter_[k].checked = filter_ele["checked"].toBool();
}
variable->id_ = j + 1;
variable->type_ = vib_data->base_config_[j].channel_type;
QJsonObject measurement, gap,m_general,m_alarm,g_general,g_alarm;
measurement = tmp_variable["measurement"].toObject();
gap = tmp_variable["gap"].toObject();
@ -848,6 +849,7 @@ void ConfigMgr::Load(QString filename) {
variable->filter_[k].checked = filter_ele["checked"].toBool();
}
variable->id_ = j + 1;
variable->type_ = vib_data->base_config_[j].channel_type;
QJsonObject gap,g_general,g_alarm;
gap = tmp_variable["gap"].toObject();
g_general = gap["general"].toObject();
@ -890,6 +892,7 @@ void ConfigMgr::Load(QString filename) {
variable->filter_[k].checked = filter_ele["checked"].toBool();
}
variable->id_ = j + 1;
variable->type_ = vib_data->base_config_[j].channel_type;
QJsonObject processed_output, general, alarm;
processed_output = tmp_variable["processed_output"].toObject();
general = processed_output["general"].toObject();
@ -948,6 +951,7 @@ void ConfigMgr::Load(QString filename) {
variable->filter_[k].checked = filter_ele["checked"].toBool();
}
variable->id_ = j + 1;
variable->type_ = vib_data->base_config_[j].channel_type;
QJsonObject processed_output, general, alarm;
processed_output = tmp_variable["processed_output"].toObject();
general = processed_output["general"].toObject();
@ -989,6 +993,7 @@ void ConfigMgr::Load(QString filename) {
variable->filter_[k].checked = filter_ele["checked"].toBool();
}
variable->id_ = j + 1;
variable->type_ = vib_data->base_config_[j].channel_type;
QJsonObject processed_output, general, alarm;
processed_output = tmp_variable["processed_output"].toObject();
general = processed_output["general"].toObject();

View File

@ -300,7 +300,6 @@ typedef struct SeismicMonitor_{
normal_voltage_high = 20;
normal_voltage_low = -20;
signal_sensitivity = 8;
channel_type = -1;
function = 0;
first_channel_angle = 0;
second_channel_angle = 0;

View File

@ -155,31 +155,30 @@ QString DC_Outputs::GetUnit(int com_index){
channel_num = 2;
}
std::shared_ptr<VariableBase> variable_base = vib_dc_output_ptr->GetChannelPtr(channel_num + 1);
if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibRadial) {
std::shared_ptr<RadialVariable> variable_ptr = std::dynamic_pointer_cast<RadialVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
qDebug() << "unit_num1" << unit_num ;
}
if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibAcc) {
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
qDebug() << "unit_num2" << unit_num ;
}
if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibVelocity) {
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
qDebug() << "unit_num3" << unit_num ;
}
if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibThrust) {
std::shared_ptr<ThrustVariable> variable_ptr = std::dynamic_pointer_cast<ThrustVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
qDebug() << "unit_num4" << unit_num ;
}
if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibPressurePulsation) {
std::shared_ptr<PressurePulsationVariable> variable_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
unit_num = variable_ptr->general.engineering_unit;
// if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibRadial) {
// std::shared_ptr<RadialVariable> variable_ptr = std::dynamic_pointer_cast<RadialVariable>(variable_base);
// unit_num = variable_ptr->general.engineering_unit;
// qDebug() << "unit_num1" << unit_num ;
// }
// if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibAcc) {
// std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
// unit_num = variable_ptr->general.engineering_unit;
// qDebug() << "unit_num2" << unit_num ;
// }
// if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibVelocity) {
// std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
// unit_num = variable_ptr->general.engineering_unit;
// qDebug() << "unit_num3" << unit_num ;
// }
// if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibThrust) {
// std::shared_ptr<ThrustVariable> variable_ptr = std::dynamic_pointer_cast<ThrustVariable>(variable_base);
// unit_num = vib_dc_output_ptr->base_config_[channel_num].sensitivity_unit;
// qDebug() << "unit_num4" << unit_num ;
// }
//if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibPressurePulsation) {
unit_num = vib_dc_output_ptr->base_config_[channel_num].sensitivity_unit;
qDebug() << "unit_num5" << unit_num ;
}
//}
switch (unit_num) {
case kUnit1:{
unit_str = "g";

View File

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
<string>高速电流</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_22">
<item>

View File

@ -364,7 +364,7 @@
</item>
<item>
<property name="text">
<string>m/s^2</string>
<string>m/s**2</string>
</property>
</item>
<item>
@ -805,7 +805,7 @@
</item>
<item>
<property name="text">
<string>m/s^2</string>
<string>m/s**2</string>
</property>
</item>
<item>
@ -1612,7 +1612,7 @@
</item>
<item>
<property name="text">
<string>m/s^2</string>
<string>m/s**2</string>
</property>
</item>
<item>
@ -2053,7 +2053,7 @@
</item>
<item>
<property name="text">
<string>m/s^2</string>
<string>m/s**2</string>
</property>
</item>
<item>