This commit is contained in:
2025-10-20 22:28:37 +08:00
parent eeb5af98eb
commit 7d148d79c9
429 changed files with 13624 additions and 586480 deletions

View File

@@ -10,10 +10,10 @@ P301_PumpPage::P301_PumpPage(QWidget *parent) :
{
ui->setupUi(this);
QTimer::singleShot(10, this, &P301_PumpPage::WinInit);
// QTimer::singleShot(1000, this, &P301_PumpPage::WinInit);
// QTimer::singleShot(2000, this, &P301_PumpPage::Show3D);
qDebug()<<"P301_PumpPage 初始化完成!";
}
@@ -26,24 +26,24 @@ void P301_PumpPage::WinInit(){
for (int row = 1; row < PumpConditionConfigFile.size()-1; ++row)
{
QString TextObjName = QString("Text_SSConditions_%1").arg(row);
QString TextObjName = QString("Pump_SSConditions_%1").arg(row);
QLabel* Label = findChild<QLabel*>(TextObjName);
if (Label) {
QString Text = PumpConditionConfigFile.at(row)[1];
Text.replace("\\n","\n",Qt::CaseInsensitive);
Label->setText(Text);
}
PercentageText.append(PumpConditionConfigFile.at(row)[1]);
TrueColor.append(PumpConditionConfigFile.at(row)[2]);
FalseColor.append(PumpConditionConfigFile.at(row)[3]);
}
// 现在 ui->CPW_1 已经是一个 CurvePlotWidget*
ui->CPW_1->addSeries("电机电流U", Qt::green);
ui->CPW_1->addSeries("电机电流V", Qt::blue);
ui->CPW_1->addSeries("电机电流W", Qt::darkCyan);
// 现在 ui->CPW_1 已经是一个 CurvePlotWidget*
ui->CPW_2->addSeries("电机温度", Qt::green);
// 现在 ui->Pump_CPW_1 已经是一个 CurvePlotWidget*
ui->Pump_CPW_1->addSeries("电机电流U", Qt::green);
ui->Pump_CPW_1->addSeries("电机电流V", Qt::blue);
ui->Pump_CPW_1->addSeries("电机电流W", Qt::darkCyan);
// 现在 ui->Pump_CPW_1 已经是一个 CurvePlotWidget*
ui->Pump_CPW_2->addSeries("电机温度", Qt::green);
//所用定时器初始化
@@ -55,7 +55,7 @@ void P301_PumpPage::WinInit(){
//所用定时器初始化
QTimer* TrailRefresh_Timer = new QTimer(this);
connect(TrailRefresh_Timer, &QTimer::timeout, this, &P301_PumpPage::TrailRefreshTimeOut);
TrailRefresh_Timer->setInterval(ConfigFiles().TrailRefreshTime * 1000); // 设置定时器间隔为 1000 毫秒1 秒)
TrailRefresh_Timer->setInterval(10000); // 设置定时器间隔为 1000 毫秒1 秒)
TrailRefresh_Timer->start();
}
void P301_PumpPage::Show3D()
@@ -153,7 +153,7 @@ void P301_PumpPage::SetProgressBar(QProgressBar *PB,const uint16_t Value,const u
}
void P301_PumpPage::SetProgressBar(QProgressBar *PB,QLCDNumber *LCD,const QString NodeGroup,const QString NodeLCD,const QStringList Color){
// 从OPC节点获取油位显示组数据32位无符号整数
uint32_t PB_Group = gOPC_NodeValue["ns=6;s=::AsGlobalPV:" + NodeGroup].toUInt();
uint32_t PB_Group = getNodeValue("" + NodeGroup).toUInt();
// 从32位数据中拆分出16位油位百分比值和颜色值
uint16_t Percentage = static_cast<uint16_t>(PB_Group >> 16); // 高16位百分比
@@ -163,18 +163,18 @@ void P301_PumpPage::SetProgressBar(QProgressBar *PB,QLCDNumber *LCD,const QStrin
SetProgressBar(PB, Percentage, ColorIndex, Color);
// 在LCD上显示实际油位测量值
LCD->display(gOPC_NodeValue["ns=6;s=::AsGlobalPV:" +NodeLCD].toReal());
LCD->display(getNodeValue("" +NodeLCD).toReal());
}
void P301_PumpPage::UIRefreshTimeOut()
{
if(!gPageIndexStr.contains("P301"))
if(!gPageIndexStr.contains("P03"))
return;
/************************************* 电机基本信息 *************************************/
// 从OPC节点获取电机相关的状态数据32位无符号整数
uint32_t PB_Group1 = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PB_Curr_Pump.PageGroup1"] .toUInt(); // 电流显示组1数据
uint32_t PB_Group2 = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PB_Curr_Pump.PageGroup2"] .toUInt(); // 电流显示组2数据
uint32_t PB_MotorTemp = gOPC_NodeValue["ns=6;s=::AsGlobalPV:PB_Temp_Pump.PageGroup"] .toUInt(); // 电机温度显示数据
uint32_t SSConditions = gOPC_NodeValue["ns=6;s=::AsGlobalPV:StartStopConditions.Pump"] .toUInt(); // 启停条件状态数据
uint32_t PB_Group1 = getNodeValue("PB_Curr_Pump.PageGroup1") .toUInt(); // 电流显示组1数据
uint32_t PB_Group2 = getNodeValue("PB_Curr_Pump.PageGroup2") .toUInt(); // 电流显示组2数据
uint32_t PB_MotorTemp = getNodeValue("PB_Temp_Pump.PageGroup") .toUInt(); // 电机温度显示数据
uint32_t SSConditions = getNodeValue("StartStopConditions.Pump") .toUInt(); // 启停条件状态数据
// 从32位数据中提取16位百分比值高16位和低16位拆分
uint16_t PercentageCurU = static_cast<uint16_t>(PB_Group1 >> 16); // U相电流百分比高16位
@@ -196,16 +196,16 @@ void P301_PumpPage::UIRefreshTimeOut()
SetProgressBar(ui->PB_Temp, PercentageMotorTemp, ColorTemp, glMotorTempColor); // 电机温度进度条
// 在LCD上显示实际测量值电流和温度
ui->LCD_Cur_1->display(gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_PhasePump.Filtered30_U"] .toReal()); // U相电流实际值
ui->LCD_Cur_2->display(gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_PhasePump.Filtered30_V"] .toReal()); // V相电流实际值
ui->LCD_Cur_3->display(gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_PhasePump.Filtered30_W"] .toReal()); // W相电流实际值
ui->LCD_Temp->display( gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_PhasePump.Filtered_Temp"] .toReal()); // 电机温度实际值
ui->LCD_Cur_1->display(getNodeValue("IN_PhasePump.Filtered30_U") .toReal()); // U相电流实际值
ui->LCD_Cur_2->display(getNodeValue("IN_PhasePump.Filtered30_V") .toReal()); // V相电流实际值
ui->LCD_Cur_3->display(getNodeValue("IN_PhasePump.Filtered30_W") .toReal()); // W相电流实际值
ui->LCD_Temp->display( getNodeValue("IN_PhasePump.Filtered_Temp") .toReal()); // 电机温度实际值
// 更新32个启停条件状态标签的显示样式
for (int i = 0; i < 32; ++i)
{
// 根据索引查找对应的标签控件
QLabel* Label = findChild<QLabel*>(QString("Text_SSConditions_%1").arg(i));
QLabel* Label = findChild<QLabel*>(QString("Pump_SSConditions_%1").arg(i+1));
// 如果找到标签
if (Label){
// 基础样式:默认背景图
@@ -236,10 +236,10 @@ void P301_PumpPage::UIRefreshTimeOut()
}
void P301_PumpPage::TrailRefreshTimeOut(){
ui->CPW_1->appendPoint(0, gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_PhasePump.Filtered30_U"] .toReal());
ui->CPW_1->appendPoint(1, gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_PhasePump.Filtered30_V"] .toReal());
ui->CPW_1->appendPoint(2, gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_PhasePump.Filtered30_W"] .toReal());
ui->CPW_2->appendPoint(0, gOPC_NodeValue["ns=6;s=::AsGlobalPV:IN_PhasePump.Filtered_Temp"] .toDouble());
ui->Pump_CPW_1->appendPoint(0, getNodeValue("IN_PhasePump.Filtered30_U") .toReal());
ui->Pump_CPW_1->appendPoint(1, getNodeValue("IN_PhasePump.Filtered30_V") .toReal());
ui->Pump_CPW_1->appendPoint(2, getNodeValue("IN_PhasePump.Filtered30_W") .toReal());
ui->Pump_CPW_2->appendPoint(0, getNodeValue("IN_PhasePump.Filtered_Temp") .toDouble());
}