#include "working_page.h"
|
#include "ui_working_page.h"
|
#include "ui_working_page_fbo.h"
|
#include "ui_working_page_fbi.h"
|
#include "IMEKeyBoard/keyboard_num.h"
|
#include "Common/work_thread.h"
|
#include "Drivers/buzzerdrv.h"
|
#include "Common/classxml.h"
|
#define CHARGE_DELAY_TIME 60
|
static int readDataTimer=0;
|
static bool if_readData=false;
|
static bool if_alarm=false;
|
static bool if_exec=false;
|
#define Type_Btn 0
|
#define Type_WIFI 1
|
static bool if_useDroplabel=false;
|
static int btn_update = 0;
|
static int chargeCmd = 0;
|
static double volupplimit = 0;
|
static double vollowlimit = 0;
|
static double minPower = 0;
|
|
Working_Page::Working_Page(QWidget *parent, Work_Thread *thread) :
|
customDialog(parent),
|
#if PageType == IDCE48CT
|
ui(new Ui::Working_Page)
|
#elif PageType == FBO48CT
|
ui(new Ui::Working_Page_FBO)
|
#elif PageType == FBI48CT
|
ui(new Ui::Working_Page_FBI)
|
#endif
|
{
|
ui->setupUi(this);
|
this->setGeometry(QRect(0,0,800,480));
|
BD = new BuzzerDrv();
|
work_thread = thread;
|
if_update = true;
|
|
initPage();
|
ClassXML::ReadNewestPNameXml(batteryName);
|
if(false == ClassXML::ReadTestParamXml(batteryName, test_param_xml))
|
{
|
batteryName = Default_Battery;
|
ClassXML::ModifyNewestPNameXml(batteryName);
|
ClassXML::ReadTestParamXml(batteryName, test_param_xml);
|
}
|
if(PageType == FBI48CT){
|
test_param_xml.test_mode = ONline_working;
|
if(!TYPE_FBI_10480 && !TYPE_FBI_4548 && !TYPE_FBI_20240)
|
test_param_xml.onlinevol_lowlimit = onlinevollow;
|
}
|
else if(PageType == IDCE48CT)
|
test_param_xml.test_mode = OFFline_working;
|
|
ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
ui->tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
|
ui->tableWidget_2->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
ui->tableWidget_2->setSelectionMode(QAbstractItemView::NoSelection);
|
#ifdef SOFT_ARM_QT4
|
ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
ui->tableWidget->verticalHeader()->setResizeMode(QHeaderView::Stretch);
|
ui->tableWidget_2->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
|
ui->tableWidget_2->verticalHeader()->setResizeMode(QHeaderView::Stretch);
|
#else
|
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
ui->tableWidget_2->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
ui->tableWidget_2->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
#endif
|
//*************关联设置参数和放电信号******************
|
connect(this,SIGNAL(sendParam(TEST_PARAM_XML)),
|
work_thread,SLOT(RecvTestParam(TEST_PARAM_XML)));
|
connect(this,SIGNAL(sendStart(int,QString)),
|
work_thread,SLOT(RecvSysCtrlCMD(int,QString)));
|
connect(work_thread,SIGNAL(sendMgBox(quint8)),
|
this,SLOT(popBoxAlarm(quint8)));
|
//读取数据定时器
|
setIconTime();
|
// vector_second.clear();
|
IF_READCUR = 0;
|
getDataTimer = new QTimer(this);
|
connect(getDataTimer,SIGNAL(timeout()),this,SLOT(GetDataSlot()));
|
getDataTimer->setInterval(500);
|
|
CurrentBox = new MessageBox( this, QMessageBox::Question,MB_Caption, "",
|
QMessageBox::Ok,
|
QMessageBox::Ok,
|
work_thread);
|
ui->edit_mon_id->setAlignment(Qt::AlignCenter);
|
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->label_reserve_1->setVisible(false);
|
ui->label_reserve_2->setVisible(false);
|
ui->label_reserve_3->setVisible(false);
|
ui->label_reserve_4->setVisible(false);
|
ui->edit_reserve_1->setVisible(false);
|
ui->edit_reserve_2->setVisible(false);
|
ui->label_onlinevol_lowlimit->setVisible(false);
|
ui->edit_onlinevol_lowlimit->setVisible(false);
|
ui->label_2->setVisible(false);
|
if(TYPE_FBI_10480 || TYPE_FBI_4548 || TYPE_FBI_20240){
|
ui->label_onlinevol_lowlimit->setVisible(true);
|
ui->edit_onlinevol_lowlimit->setVisible(true);
|
ui->label_2->setVisible(true);
|
ui->edit_reserve_1->setVisible(true);
|
ui->label_reserve_1->setVisible(true);
|
ui->label_reserve_3->setVisible(true);
|
}
|
#endif
|
}
|
|
Working_Page::~Working_Page()
|
{
|
delete getDataTimer;
|
delete BD;
|
delete CurrentBox;
|
|
delete ui;
|
}
|
|
void Working_Page::CustomEditSlot()
|
{
|
if(work_thread->iconState.wifiState)
|
return;
|
if((!work_thread->IF_J9Close)&&JT_VALUE)
|
{
|
QString msg = tr("设备处于紧急停止状态,请检查并断电重启!");
|
popBox(msg);
|
return;
|
}
|
Custom_LineEdit *le = dynamic_cast<Custom_LineEdit*>(sender());
|
|
if(ui->edit_SetCur == le)
|
{
|
if(test_param_xml.discharge_mode == DISCHARGE_CURRENT)
|
{
|
if(setEditInput(le,0,(double)MinCur/10,999.9,1))
|
{
|
int cur = ui->edit_SetCur->text().toFloat()*10+0.5;
|
int hourRate = ClassXML::GetHourRate(nominalCap,cur/10)+0.5;
|
ui->edit_HourRate->setText(QString::number(hourRate));
|
|
test_param_xml.hourly_rate = hourRate;
|
test_param_xml.preset_cur = cur;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
else
|
{
|
if(setEditInput(le,0,minPower/1000,999.9,1))
|
{
|
int power = ui->edit_SetCur->text().toFloat()*10+0.5;
|
test_param_xml.preset_power = power;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
}
|
else if(ui->edit_SetGroupLow == le)
|
{
|
if(setEditInput(le,1,0,999.9,1))
|
{
|
test_param_xml.group_lower = le->text().toFloat()*10+0.5;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
else if(ui->edit_SetMonLow == le)
|
{
|
if(setEditInput(le,1,0,MONUPLIMIT,2))
|
{
|
test_param_xml.mon_lower = le->text().toFloat()*100+0.5;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
else if(ui->edit_SetLowNum == le)
|
{
|
if(setEditInput(le,1,MONOMER_NUM_MIN,(test_param_xml.group_number * test_param_xml.mon_number),0))
|
{
|
test_param_xml.lower_number = le->text().toInt();
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
else if(ui->edit_SetTime == le)
|
{
|
if(setTimeInput(le,0))
|
{
|
QString time = le->text();
|
int hour = time.section(":",0,0).trimmed().toInt();
|
int minute = time.section(":",1,1).trimmed().toInt();
|
test_param_xml.preset_time = hour*60+minute;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
else if(ui->edit_SetCap == le)
|
{
|
if(setEditInput(le,0,1,9999,0))
|
{
|
test_param_xml.preset_cap = le->text().toInt();
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
else if(ui->edit_HourRate == le)
|
{
|
if(setEditInput(le,1,1,20,0))
|
{
|
int hourRate = ui->edit_HourRate->text().toInt();
|
int cur = ClassXML::GetFDCurrent(nominalCap,hourRate);
|
ui->edit_SetCur->setText(QString::number((float)cur/10,'f',1));
|
|
test_param_xml.preset_cur = cur+0.5;
|
test_param_xml.hourly_rate = hourRate;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
else if(ui->edit_Setmode == le)
|
{
|
if(test_param_xml.discharge_mode == DISCHARGE_CURRENT)
|
{
|
test_param_xml.discharge_mode = DISCHARGE_POWER;
|
ui->edit_Setmode->setText(tr("恒功率"));
|
|
ui->label_SetCur->setText(tr("预放功率"));
|
ui->label_001->setText("KW");
|
ui->edit_SetCur->setText(QString::number((float)test_param_xml.preset_power/10,'f',1));
|
ui->edit_HourRate->setEnabled(false);ui->edit_HourRate->setStyleSheet("color:gray");
|
}
|
else
|
{
|
test_param_xml.discharge_mode = DISCHARGE_CURRENT;
|
ui->edit_Setmode->setText(tr("恒 流"));
|
|
ui->label_SetCur->setText(tr("预放电流"));
|
ui->label_001->setText("A");
|
ui->edit_SetCur->setText(QString::number((float)test_param_xml.preset_cur/10,'f',1));
|
ui->edit_HourRate->setEnabled(true);ui->edit_HourRate->setStyleSheet("color:black");
|
}
|
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
// else if(ui->edit_reserve_1 == le){
|
// if(le->text() == tr("开启"))
|
// le->setText(tr("关闭"));
|
// else
|
// le->setText(tr("开启"));
|
// }
|
#if PageType == FBO48CT
|
else if(ui->edit_workmode == le)
|
{
|
if(test_param_xml.test_mode == ONline_working)
|
{
|
ui->edit_workmode->setText(tr("离线放电"));
|
test_param_xml.test_mode = OFFline_working;
|
// #if TYPE_FBO_2210
|
ui->label_onlinevol_lowlimit->setVisible(false);
|
ui->edit_onlinevol_lowlimit->setVisible(false);
|
ui->label_2->setVisible(false);
|
// #endif
|
}
|
else
|
{
|
ui->edit_workmode->setText(tr("在线放电"));
|
test_param_xml.test_mode = ONline_working;
|
// #if TYPE_FBO_2210
|
ui->label_onlinevol_lowlimit->setVisible(true);
|
ui->edit_onlinevol_lowlimit->setVisible(true);
|
ui->label_2->setVisible(true);
|
// #endif
|
if(test_param_xml.acstop_op == ACOFF_STOP)
|
{
|
ui->edit_acstop->setText(tr("停止放电"));
|
}
|
else
|
{
|
ui->edit_acstop->setText(tr("继续放电"));
|
}
|
}
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
else if(ui->edit_onlinevol_lowlimit == le)
|
{
|
if(setEditInput(le,0,0,999.9,1))//vollowlimit+2
|
{
|
test_param_xml.onlinevol_lowlimit = le->text().toFloat()*10+0.5;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
else if(ui->edit_reserve_1 == le) //充电限流
|
{
|
if(setEditInput(le,0,(double)MinCur/10,999.9,1))
|
{
|
test_param_xml.charge_limit = le->text().toFloat()*10+0.5;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
#endif
|
#if PageType == FBI48CT
|
else if(ui->edit_SetBoosterCeiling == le){
|
if(setEditInput(le,1,volupplimit,volupplimit*1.08,1))
|
{
|
test_param_xml.booster_ceiling = le->text().toFloat()*10+0.5;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
}
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
else if(ui->edit_acstop == le)
|
{
|
if(test_param_xml.acstop_op == ACOFF_STOP)
|
{
|
ui->edit_acstop->setText(tr("继续放电"));
|
test_param_xml.acstop_op = ACOFF_CONTINUE;
|
}
|
else
|
{
|
test_param_xml.acstop_op = ACOFF_STOP;
|
ui->edit_acstop->setText(tr("停止放电"));
|
}
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
}
|
#endif
|
}
|
|
void Working_Page::ChartMonEditSlot()
|
{
|
setChartEditInput(ui->edit_mon_id,1,GmonNum);
|
updateMonChart(chartMonID-1);
|
}
|
|
bool Working_Page::AutoStartChargeTest()
|
{
|
// qDebug()<<"进入自动充电测试";
|
ui->comboBox_Type->setCurrentIndex(1);
|
setParamEnabled(false);
|
work_thread->initWorkPageShow();
|
|
if((work_thread->localData.RLY_OK & IGBT_VALUE)&& (work_thread->fboData.SumVoltage>F0VOL))
|
{
|
if(work_thread->iconState.wifiState)
|
{
|
;
|
}
|
else
|
{
|
popBox(tr("FO未闭合!"));
|
}
|
return false;
|
}
|
// qDebug()<<"AutoStartChargeTest:RLY_OK:"<<work_thread->localData.RLY_OK;
|
emit sendStart(work_thread->CMD_PowerSwithOn,0);
|
if(work_thread->localData.RLY_OK & TKQ_VALUE)
|
{
|
if(work_thread->iconState.wifiState)
|
{
|
;
|
}
|
else
|
{
|
popBox(tr("请合上F1!"));
|
}
|
BD->BuzzerBeep(50);
|
if(work_thread->localData.RLY_OK & TKQ_VALUE)
|
{
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if(work_thread->iconState.wifiState)
|
{
|
;
|
}
|
else
|
{
|
popBox(tr("F1未闭合!"));
|
}
|
return false;
|
}
|
}
|
if(work_thread->localData.GroupVol<VolTooLow ||
|
work_thread->localData.GroupVol>VolTooHigh )
|
{
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if(work_thread->iconState.wifiState)
|
{
|
;
|
}
|
else
|
{
|
popBox(tr("电压过高或过低!"));
|
}
|
return false;
|
}
|
memcpy(SingleVolBeforeTest,work_thread->fboData.SingleVol,sizeof(SingleVolBeforeTest));
|
emit sendStart(work_thread->CMD_StartCharge,batteryName+"/");
|
if_readData = true;readDataTimer = 1;
|
// qDebug()<<"sendStart after";
|
return true;
|
}
|
|
void Working_Page::WorkBtnSlot()
|
{
|
QPushButton *pb = dynamic_cast<QPushButton*>(sender());
|
if(ui->pushButton_Exit == pb)
|
{
|
if(!work_thread->localData.SysWorkState)
|
{
|
toHide();
|
if_useDroplabel=false;
|
emit senddeleteSocket();
|
return;
|
}
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("正在测试中,确定退出吗?"),
|
QMessageBox::Ok|QMessageBox::Cancel,
|
QMessageBox::Ok,
|
work_thread );
|
if(box.exec() != QMessageBox::Ok)
|
{
|
return;
|
}
|
if(work_thread->localData.SysWorkState == Discharging)
|
{
|
emit sendStart(work_thread->CMD_StopDischarge,batteryName+"/");
|
}
|
else if(work_thread->localData.SysWorkState == Charging)
|
{
|
emit sendStart(work_thread->CMD_StopCharge,batteryName+"/");
|
}
|
else if(work_thread->localData.SysWorkState == Paused_Dischg)
|
{
|
emit sendStart(work_thread->CMD_StopDischarge,batteryName+"/");
|
}
|
else if(work_thread->localData.SysWorkState == Paused_charge)
|
{
|
emit sendStart(work_thread->CMD_StopCharge,batteryName+"/");
|
}
|
else if(work_thread->localData.SysWorkState == WaitForCharging)
|
{
|
emit sendStart(work_thread->CMD_StopCharge,"");//CMD_PowerSwithOff 倒计时中退出,等到倒计时结束按下“是”需要停止充电
|
}
|
toHide();
|
emit senddeleteSocket();
|
}
|
else if(ui->pushButton_Start == pb)
|
{
|
toStart(Type_Btn);
|
}
|
else if(ui->pushButton_Stop == pb)
|
{
|
toStop(Type_Btn);
|
}
|
else if(ui->pushButton_MonLast == pb || ui->pushButton_MonChartLast == pb)
|
{
|
mon_table.pageIndex--;
|
setMonomerTable();
|
setMonomerChart();
|
setMonomerBtnState();
|
}
|
else if(ui->pushButton_MonNext == pb || ui->pushButton_MonChartNext == pb)
|
{
|
mon_table.pageIndex++;
|
setMonomerTable();
|
setMonomerChart();
|
setMonomerBtnState();
|
}
|
else if(ui->pushButton_MonLast_Test == pb)
|
{
|
chartMonID--;
|
if(chartMonID < 1)
|
chartMonID = GmonNum;
|
ui->edit_mon_id->setText(QString::number(chartMonID)+"/"+
|
QString::number(GmonNum));
|
updateMonChart(chartMonID-1);
|
}
|
else if(ui->pushButton_MonNext_Test == pb)
|
{
|
chartMonID++;
|
if(chartMonID > GmonNum)
|
chartMonID = 1;
|
ui->edit_mon_id->setText(QString::number(chartMonID)+"/"+
|
QString::number(GmonNum));
|
updateMonChart(chartMonID-1);
|
}
|
#if (PageType == FBO48CT || PageType == FBI48CT)&&CONTROL_ZC
|
else if(ui->pushButton_zch == pb)
|
{
|
toStartZCH(Type_Btn);
|
}
|
#endif
|
}
|
|
void Working_Page::SendParamSlot()
|
{
|
emit sendParam(test_param_xml);
|
}
|
|
void Working_Page::GetDataSlot()
|
{
|
if(if_update){
|
fbodata = work_thread->fboData;
|
lcldata = work_thread->localData;
|
}
|
if(btn_update>0)
|
{
|
btn_update--;
|
}
|
setIconTime();
|
setTestPage(); //tab1,参数/测试
|
setMonomerTable(); //tab2,单体列表
|
setMonomerChart(); //tab3,单体图表
|
setMonomerBtnState(); //单体界面按钮状态
|
setEachGroupInfo(test_param_xml.group_number);//tab5分组信息
|
setStateAlarmAndDrop(work_thread->localData.SysWorkState, //状态,告警,掉线单体
|
work_thread->localData.WPAlarmState,lcldata.ModuleDropIndex);
|
|
setDCdataTable();//DCDC模块
|
//-------------测试曲线--------------
|
if((readDataTimer++)>=60)
|
{
|
readDataTimer=1;
|
}
|
|
if((readDataTimer%60==0)&&if_readData && IF_READCUR)
|
{
|
ReadDataSlot();
|
}
|
//告警蜂鸣器定时器
|
if((readDataTimer%2==0)&&if_alarm)
|
{
|
alarm_beep();
|
}
|
//异常蜂鸣器定时器
|
if((readDataTimer%6==0)&&if_exec&&!if_alarm)
|
{
|
BD->BuzzerBeep(300);
|
}
|
|
}
|
|
void Working_Page::ReadDataSlot()
|
{
|
if(work_thread->testFileName == "")
|
return;
|
if(ClassXML::GetGroupVolFBO(work_thread->testFileName,vector_groupvol,
|
vector_cur,vector_cap,
|
vector_second,vector_mon))
|
{
|
switch(ui->comboBox_ChartType->currentIndex())
|
{
|
case 0:
|
updateVolChart();
|
break;
|
case 1:
|
updateCurChart();
|
break;
|
case 2:
|
updateCapChart();
|
break;
|
case 3:
|
updateMonChart(chartMonID-1);
|
break;
|
}
|
}
|
}
|
|
void Working_Page::initPage()
|
{
|
stopType<<tr("手动停止!")<<tr("放电时间到!")<<tr("放电容量到!")<<
|
tr("单体下限到!")<<tr("组端下限到!")<<tr("在线电压低!")<<tr("内存不足!")<<
|
tr("温度异常高!")<<tr("正在放电!")<<tr("手动暂停!")<<tr("暂停放电!")<<
|
tr("线缆连接异常或者内部通信异常")<<tr("电流检测错误!")<<tr("紧急停止!")<<tr("风扇异常!");
|
|
chargeType<<tr("停止充电")<<tr("暂停充电")<<tr("正在充电")<<tr("直充充电")
|
<<tr("正在充电监测")<<tr("紧急停止!")<<tr("在线电压低!")<<tr("电流检测错误!")
|
<<tr("温度异常高!")<<tr("线缆连接异常或者内部通信异常")<<tr("风扇异常!")<<tr("暂停充电监测");
|
//测试类型下拉框
|
testTypeList<<tr("放电")<<tr("充电");
|
QPixmap pixmap(1, 50);
|
pixmap.fill(Qt::transparent);
|
QIcon icon(pixmap);
|
ui->comboBox_Type->setIconSize(QSize(1, 50));
|
for(int i=0;i<testTypeList.count();i++)
|
{
|
ui->comboBox_Type->addItem(icon,testTypeList.at(i));
|
}
|
|
//实时曲线下拉框
|
chartTypeList<<tr("总电压")<<tr("总电流")<<tr("已测容量")<<tr("单体电压");
|
ui->comboBox_ChartType->setIconSize(QSize(1, 50));
|
for(int i=0;i<chartTypeList.count();i++)
|
{
|
ui->comboBox_ChartType->addItem(icon,chartTypeList.at(i));
|
}
|
ui->edit_mon_id->setVisible(false);
|
ui->pushButton_MonLast_Test->setVisible(false);
|
ui->pushButton_MonNext_Test->setVisible(false);
|
ui->comboBox_GroupM->setVisible(false);
|
|
//单体数据
|
for(int i=0;i<6;i++)
|
{
|
for(int j=0;j<4;j++)
|
{
|
tableItem = new QTableWidgetItem("");
|
tableItem->setTextAlignment(0x0084);
|
ui->tableWidget->setItem(i,j,tableItem);
|
}
|
}
|
#if PageType==FBI48CT
|
ui->tableWidget_3->setRowCount(4);
|
for(int i=0;i<4;i++)
|
{
|
for(int j=1;j<5;j++)
|
{
|
tableItem = new QTableWidgetItem("-");
|
tableItem->setTextAlignment(0x0084);
|
ui->tableWidget_3->setItem(i,j,tableItem);
|
}
|
}
|
#endif
|
//单体图表
|
initMonomerChart();
|
//输入框
|
#if PageType == FBO48CT
|
set_btn_beep(ui->edit_workmode,SIGNAL(custom_click()));
|
connect(ui->edit_workmode,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
#endif
|
#if PageType == FBI48CT
|
set_btn_beep(ui->edit_SetBoosterCeiling,SIGNAL(custom_click()));
|
connect(ui->edit_SetBoosterCeiling,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
set_btn_beep(ui->edit_acstop,SIGNAL(custom_click()));
|
connect(ui->edit_acstop,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_onlinevol_lowlimit,SIGNAL(custom_click()));
|
connect(ui->edit_onlinevol_lowlimit,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
// set_btn_beep(ui->edit_reserve_1,SIGNAL(custom_click()));
|
// connect(ui->edit_reserve_1,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_reserve_2,SIGNAL(custom_click()));
|
connect(ui->edit_reserve_2,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
#endif
|
#if (PageType == FBO48CT || PageType == FBI48CT)&&CONTROL_ZC
|
set_btn_beep(ui->pushButton_zch,SIGNAL(pressed()));
|
connect(ui->pushButton_zch,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
#endif
|
|
set_btn_beep(ui->edit_Setmode,SIGNAL(custom_click()));
|
connect(ui->edit_Setmode,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_SetCur,SIGNAL(custom_click()));
|
connect(ui->edit_SetCur,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_SetGroupLow,SIGNAL(custom_click()));
|
connect(ui->edit_SetGroupLow,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_SetMonLow,SIGNAL(custom_click()));
|
connect(ui->edit_SetMonLow,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_SetLowNum,SIGNAL(custom_click()));
|
connect(ui->edit_SetLowNum,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_SetTime,SIGNAL(custom_click()));
|
connect(ui->edit_SetTime,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_SetCap,SIGNAL(custom_click()));
|
connect(ui->edit_SetCap,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_HourRate,SIGNAL(custom_click()));
|
connect(ui->edit_HourRate,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
set_btn_beep(ui->edit_mon_id,SIGNAL(custom_click()));
|
connect(ui->edit_mon_id,SIGNAL(custom_click()),this,SLOT(ChartMonEditSlot()));
|
set_btn_beep(ui->edit_reserve_1,SIGNAL(custom_click()));
|
connect(ui->edit_reserve_1,SIGNAL(custom_click()),this,SLOT(CustomEditSlot()));
|
//按键
|
set_btn_beep(ui->pushButton_Exit,SIGNAL(pressed()));
|
connect(ui->pushButton_Exit,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
set_btn_beep(ui->pushButton_Start,SIGNAL(pressed()));
|
connect(ui->pushButton_Start,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
set_btn_beep(ui->pushButton_Stop,SIGNAL(pressed()));
|
connect(ui->pushButton_Stop,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
set_btn_beep(ui->pushButton_MonLast,SIGNAL(pressed()));
|
connect(ui->pushButton_MonLast,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
set_btn_beep(ui->pushButton_MonNext,SIGNAL(pressed()));
|
connect(ui->pushButton_MonNext,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
set_btn_beep(ui->pushButton_MonChartLast,SIGNAL(pressed()));
|
connect(ui->pushButton_MonChartLast,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
set_btn_beep(ui->pushButton_MonChartNext,SIGNAL(pressed()));
|
connect(ui->pushButton_MonChartNext,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
set_btn_beep(ui->pushButton_MonLast_Test,SIGNAL(pressed()));
|
connect(ui->pushButton_MonLast_Test,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
set_btn_beep(ui->pushButton_MonNext_Test,SIGNAL(pressed()));
|
connect(ui->pushButton_MonNext_Test,SIGNAL(released()),this,SLOT(WorkBtnSlot()));
|
|
connect(ui->tabWidget,SIGNAL(currentChanged(int)),this,SLOT(TabcurrentChangeSlot(int)));
|
connect(ui->comboBox_Type,SIGNAL(currentIndexChanged(int)),this,SLOT(TypeComboBoxChangeSlot(int)));
|
connect(ui->comboBox_ChartType,SIGNAL(currentIndexChanged(int)),this,SLOT(TestChartComboBoxChangeSlot(int)));
|
|
if(!TYPE_IDCE_4815MINI){
|
ui->label_reserve_1->setVisible(false);
|
ui->edit_reserve_1->setVisible(false);
|
}
|
else{
|
#ifdef DZBBH
|
if(DZBBH == "FGDZB202108250002DZ"){
|
ui->edit_reserve_1->setText(tr("开启"));
|
}
|
else {
|
ui->label_reserve_1->setVisible(false);
|
ui->edit_reserve_1->setVisible(false);
|
}
|
#else
|
ui->label_reserve_1->setVisible(false);
|
ui->edit_reserve_1->setVisible(false);
|
#endif
|
}
|
}
|
|
void Working_Page::initParam()
|
{
|
#if PageType == FBO48CT
|
if(test_param_xml.test_mode == OFFline_working)
|
{
|
ui->edit_workmode->setText(tr("离线放电"));
|
// #if TYPE_FBO_2210
|
ui->label_onlinevol_lowlimit->setVisible(false);
|
ui->edit_onlinevol_lowlimit->setVisible(false);
|
ui->label_2->setVisible(false);
|
// #endif
|
}
|
else
|
{
|
ui->edit_workmode->setText(tr("在线放电"));
|
// #if TYPE_FBO_2210
|
ui->label_onlinevol_lowlimit->setVisible(true);
|
ui->edit_onlinevol_lowlimit->setVisible(true);
|
ui->label_2->setVisible(true);
|
// #endif
|
}
|
#endif
|
|
#if PageType == FBI48CT
|
ui->edit_SetBoosterCeiling->setText(QString::number((float)test_param_xml.booster_ceiling/10,'f',1));
|
ui->edit_reserve_1->setText(QString::number((float)test_param_xml.charge_limit/10,'f',1));
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
if(test_param_xml.acstop_op == ACOFF_STOP)
|
{
|
ui->edit_acstop->setText(tr("停止放电"));
|
}
|
else
|
{
|
ui->edit_acstop->setText(tr("继续放电"));
|
}
|
ui->edit_onlinevol_lowlimit->setText(QString::number((float)test_param_xml.onlinevol_lowlimit/10,'f',1));
|
#endif
|
if(test_param_xml.discharge_mode == DISCHARGE_CURRENT)
|
{
|
ui->edit_Setmode->setText(tr("恒 流"));
|
|
ui->label_SetCur->setText(tr("预放电流"));
|
ui->label_001->setText("A");
|
ui->edit_SetCur->setText(QString::number((float)test_param_xml.preset_cur/10,'f',1));
|
}
|
else
|
{
|
ui->edit_Setmode->setText(tr("恒功率"));
|
|
ui->label_SetCur->setText(tr("预放功率"));
|
ui->label_001->setText("KW");
|
ui->edit_SetCur->setText(QString::number((float)test_param_xml.preset_power/10,'f',1));
|
}
|
|
ui->edit_SetGroupLow->setText(QString::number((float)test_param_xml.group_lower/10,'f',1));
|
ui->edit_SetMonLow->setText(QString::number((float)test_param_xml.mon_lower/100,'f',2));
|
|
if(test_param_xml.lower_number > test_param_xml.group_number * test_param_xml.mon_number)
|
{
|
test_param_xml.lower_number = test_param_xml.group_number * test_param_xml.mon_number;
|
ClassXML::ModifyTestParamXml(batteryName,test_param_xml);
|
emit sendParam(test_param_xml);
|
ui->edit_SetLowNum->setText(QString::number(test_param_xml.lower_number));
|
}
|
else
|
{
|
ui->edit_SetLowNum->setText(QString::number(test_param_xml.lower_number));
|
}
|
|
ui->edit_SetCap->setText(QString::number(test_param_xml.preset_cap));
|
QString time = QString("%1:%2").arg(test_param_xml.preset_time/60,2,10,QChar('0')).arg(test_param_xml.preset_time%60,2,10,QChar('0'));
|
ui->edit_SetTime->setText(time);
|
ui->edit_HourRate->setText(QString::number(test_param_xml.hourly_rate));
|
}
|
|
void Working_Page::setTestPage()
|
{
|
//------------参数/测试界面数据------------------
|
#if(PageType == FBO48CT || PageType == FBI48CT)
|
if(test_param_xml.test_mode == ONline_working
|
/*|| ui->comboBox_Type->currentIndex() == 1*/){
|
ui->label_OnlineVol->setText(tr("在线电压:")+QString::number(
|
((float)fbodata.OnlineVol/10),'f',1)+" V");
|
}else{
|
ui->label_OnlineVol->setText(tr("在线电压:---- V"));
|
}
|
#endif
|
ui->label_TestGroupVol->setText(tr("组端电压:")+QString::number(
|
((float)fbodata.SumVoltage/10),'f',1)+" V");
|
|
QString curstr;
|
|
if(ui->comboBox_Type->currentIndex() == 0){
|
if(test_param_xml.discharge_mode != DISCHARGE_CURRENT)
|
{
|
float allpower = lcldata.GroupVol*fbodata.SumCurrent;
|
allpower /= 100*1000; //KW
|
|
if((qAbs(allpower*10-test_param_xml.preset_power)>3)&&(work_thread->localData.SysWorkState == Discharging))
|
curstr = tr("<font color = red>%1</font>").arg(QString::number(((float)fbodata.SumCurrent/10),'f',1))+" A"+
|
tr("/ <font color = red>%1</font>").arg(QString::number(allpower,'f',1))+" KW";
|
else
|
curstr = QString::number(((float)fbodata.SumCurrent/10),'f',1)+" A"+
|
tr("/ %1").arg(QString::number(allpower,'f',1)+" KW");
|
}
|
else {
|
if(qAbs(fbodata.SumCurrent-test_param_xml.preset_cur)>20
|
&& work_thread->localData.SysWorkState == Discharging)
|
curstr = tr("<font color = red>%1</font>").arg(QString::number(((float)fbodata.SumCurrent/10),'f',1))+" A";
|
else
|
curstr = QString::number(((float)fbodata.SumCurrent/10),'f',1)+" A";
|
}
|
ui->label_TestCur->setText(tr("放电电流:")+curstr);
|
|
ui->label_TestCap->setText(tr("已放容量:")+QString::number(
|
fbodata.AllCap)+" AH");
|
|
ui->label_TestLowNum->setText(tr("已到下限个数:")+QString::number(
|
lcldata.monomerLowCount));
|
}
|
else {
|
// qDebug()<<"fbodata.SumCurrent:"<<fbodata.SumCurrent;
|
curstr = QString::number(((float)fbodata.SumCurrent/10),'f',1)+" A";
|
ui->label_TestCur->setText(tr("充电电流:")+curstr);
|
|
ui->label_TestCap->setText(tr("已充容量:")+QString::number(
|
fbodata.AllCap)+" AH");
|
|
ui->label_TestLowNum->setText("");
|
}
|
|
QString time = QString("%1:%2:%3")
|
.arg(fbodata.m_TestTime.hour,2,10,QChar('0'))
|
.arg(fbodata.m_TestTime.minute,2,10,QChar('0'))
|
.arg(fbodata.m_TestTime.second,2,10,QChar('0'));
|
ui->label_TestTime->setText(tr("已测时间:")+time);
|
|
}
|
|
void Working_Page::setEachGroupInfo(quint16 groupnum)
|
{
|
//---------------分组信息数据-------------------
|
for(int i=1;i<=groupnum;i++)
|
{
|
tableItem = ui->tableWidget_2->item(0,i);
|
tableItem->setText(QString::number(i));
|
tableItem->setTextAlignment(0x0084);
|
//tableWidget->setItem(0,i,tableItem);
|
|
tableItem = ui->tableWidget_2->item(1,i);
|
tableItem->setText(QString::number(
|
((float)fbodata.SubCurrent[i-1]/10),'f',1));
|
tableItem->setTextAlignment(0x0084);
|
//tableWidget->setItem(1,i,tableItem);
|
|
tableItem = ui->tableWidget_2->item(2,i);
|
tableItem->setText(QString::number(
|
fbodata.SubCap[i-1]));
|
tableItem->setTextAlignment(0x0084);
|
//tableWidget->setItem(2,i,tableItem);
|
|
tableItem = ui->tableWidget_2->item(3,i);
|
tableItem->setText(format_monomer(
|
lcldata.SMaxIndex[i-1],lcldata.SMaxVol[i-1]));
|
tableItem->setTextAlignment(0x0084);
|
tableItem->setTextColor(QColor(0,255,0));
|
//tableWidget->setItem(3,i,tableItem);
|
|
tableItem = ui->tableWidget_2->item(4,i);
|
tableItem->setText(format_monomer(
|
lcldata.SMinIndex[i-1],lcldata.SMinVol[i-1]));
|
tableItem->setTextAlignment(0x0084);
|
tableItem->setTextColor(QColor(255,56,49));
|
//tableWidget->setItem(4,i,tableItem);
|
}
|
for(int i=groupnum+1;i<5;i++)
|
{
|
ui->tableWidget_2->item(0,i)->setText("");
|
ui->tableWidget_2->item(1,i)->setText("");
|
ui->tableWidget_2->item(2,i)->setText("");
|
ui->tableWidget_2->item(3,i)->setText("");
|
ui->tableWidget_2->item(4,i)->setText("");
|
}
|
ui->label_TestGroupNum->setText(tr("测试组数:")+QString::number(test_param_xml.group_number));
|
}
|
|
void Working_Page::setStateAlarmAndDrop(quint8 state, quint8 alarm, quint16 drop)
|
{
|
//---------------按键状态----------------
|
quint8 is_start_alarm_time = 0;
|
if(!btn_update)
|
{
|
ui->pushButton_Exit->setEnabled(true);
|
switch(state)
|
{
|
case WorkStopped:
|
volupplimit = (double)work_thread->localData.OnlineVol/10;
|
vollowlimit = (double)work_thread->localData.GroupVol/10;
|
minPower = (double)work_thread->fboData.SumVoltage/100*MinCur;
|
if(minPower<MinPower*100)
|
minPower = MinPower*100;
|
ReadDataSlot(); //更新最后一笔实时数据
|
IF_READCUR = 0;
|
ui->pushButton_Start->setText(tr("启 动"));
|
ui->pushButton_Stop->setText(tr("停 止"));
|
ui->pushButton_Start->setEnabled(true);
|
ui->pushButton_Stop->setEnabled(false);
|
#if PageType == FBO48CT || PageType == FBI48CT
|
if(ui->pushButton_zch->isVisible())
|
ui->pushButton_zch->setEnabled(true);
|
#endif
|
if(ui->comboBox_Type->currentIndex() == 0)
|
{
|
ui->edit_Setmode->setEnabled(true);ui->edit_Setmode->setStyleSheet("color:black");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(true);ui->edit_workmode->setStyleSheet("color:black");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(true);ui->edit_acstop->setStyleSheet("color:black");
|
#endif
|
}
|
else
|
{
|
ui->edit_Setmode->setEnabled(false);ui->edit_Setmode->setStyleSheet("color:gray");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(false);ui->edit_workmode->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(false);ui->edit_acstop->setStyleSheet("color:gray");
|
#endif
|
}
|
break;
|
case Paused_Dischg:
|
case Paused_charge:{
|
ui->pushButton_Start->setText(tr("启 动"));
|
ui->pushButton_Stop->setText(tr("停 止"));
|
ui->pushButton_Start->setEnabled(true);
|
ui->pushButton_Stop->setEnabled(true);
|
#if PageType == FBO48CT || PageType == FBI48CT
|
if(ui->pushButton_zch->isVisible())
|
ui->pushButton_zch->setEnabled(true);
|
#endif
|
ui->edit_Setmode->setEnabled(false);ui->edit_Setmode->setStyleSheet("color:gray");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(false);ui->edit_workmode->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(false);ui->edit_acstop->setStyleSheet("color:gray");
|
#endif
|
}
|
break;
|
case Discharging:{
|
if_update = true;
|
ui->pushButton_Start->setText(tr("启 动"));
|
ui->pushButton_Stop->setText(tr("暂 停"));
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_Stop->setEnabled(true);
|
|
ui->edit_Setmode->setEnabled(false);ui->edit_Setmode->setStyleSheet("color:gray");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(false);ui->edit_workmode->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(false);ui->edit_acstop->setStyleSheet("color:gray");
|
#endif
|
}
|
break;
|
case Charging:{
|
if_update = true;
|
ui->pushButton_Start->setText(tr("启 动"));
|
ui->pushButton_Stop->setText(tr("暂 停"));
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_Stop->setEnabled(true);
|
|
ui->edit_Setmode->setEnabled(false);ui->edit_Setmode->setStyleSheet("color:gray");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(false);ui->edit_workmode->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(false);ui->edit_acstop->setStyleSheet("color:gray");
|
#endif
|
#if CONTROL_ZC
|
if(alarm == CPSmallCharging)
|
{
|
ui->pushButton_Start->setText(tr("限 流"));
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_zch->setEnabled(true);
|
}
|
else if(alarm == CPLargeCharging)
|
{
|
ui->pushButton_Start->setText(tr("限 流"));
|
ui->pushButton_Start->setEnabled(true);
|
ui->pushButton_zch->setEnabled(false);
|
}
|
else if(alarm == CPNullCharging)
|
{
|
ui->pushButton_Start->setText(tr("启 动"));
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_zch->setEnabled(false);
|
}
|
#endif
|
}
|
break;
|
case WaitForCharging:
|
ui->pushButton_Start->setText(tr("启 动"));
|
ui->pushButton_Stop->setText(tr("暂 停"));
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_Stop->setEnabled(false);
|
break;
|
}
|
}
|
if(!if_update){
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_Stop->setEnabled(false);
|
}
|
|
//---------------下限单体----------------
|
if(state == WorkStopped || state == WaitForCharging)
|
{
|
if((!isCloseBeep || state==WorkStopped)&&(!if_useDroplabel))
|
ui->label_DropIndex->setText("");
|
if(if_exec)
|
if_exec=false; //关闭异常告警
|
}
|
else
|
{
|
if(!if_useDroplabel)
|
{
|
if(drop == 0)
|
{
|
ui->label_DropIndex->setText("");
|
}
|
else
|
{
|
QString temp;
|
temp.sprintf("%03d/%d",(drop-1)%test_param_xml.mon_number + 1,(drop-1)/test_param_xml.mon_number + 1);
|
ui->label_DropIndex->setText(tr("#")+temp+tr(" 单体异常!"));
|
// ui->label_DropIndex->setText(("#")+QString::number(drop)+tr(" 单体模块异常!"));
|
is_start_alarm_time = 1;
|
}
|
}
|
if(((alarm == WPPOWERBREAKSTOP)&&(ui->comboBox_Type->currentIndex() == 0))||
|
((alarm == CPPOWERBREAKSTOP)&&(ui->comboBox_Type->currentIndex() == 1)))
|
{
|
is_start_alarm_time = 1;
|
}
|
if(is_start_alarm_time)
|
{
|
if(!if_exec)
|
if_exec=true;
|
}
|
else
|
{
|
if(if_exec)
|
if_exec=false;
|
}
|
}
|
if(ui->comboBox_Type->currentIndex() == 0)
|
{
|
if(alarm<stopType.count())
|
ui->label_AlarmState->setText(tr("当前状态:")+stopType.at(alarm));
|
else
|
ui->label_AlarmState->setText(tr("当前状态:未知"));
|
}
|
else if(ui->comboBox_Type->currentIndex() == 1)
|
{
|
if(alarm<chargeType.count())
|
ui->label_AlarmState->setText(tr("当前状态:")+chargeType.at(alarm));
|
else
|
ui->label_AlarmState->setText(tr("当前状态:未知"));
|
}
|
}
|
|
void Working_Page::setDCdataTable()
|
{
|
#if PageType==FBI48CT
|
quint8 dcdc_count = work_thread->get_DCDC_count();
|
if(dcdc_count>0 && dcdc_count<=4)
|
{
|
dcdc_count = dcdc_count+1;
|
for(int i=1;i<dcdc_count;i++)
|
{
|
ui->tableWidget_3->item(0,i)->setText(QString::number(i));
|
ui->tableWidget_3->item(1,i)->setText(QString::number((float)work_thread->localData.dcdc_data[i-1].DC_Vol/100,'f',2));
|
ui->tableWidget_3->item(2,i)->setText(QString::number((float)work_thread->localData.dcdc_data[i-1].DC_Cur/100,'f',2));
|
// ui->tableWidget_2->item(3,i)->setText("0x"+
|
// QString::number(work_thread->localData.dcdc_data[i-1].DC_Alarm,16).toUpper().rightJustified(2,QChar('0')));
|
// ui->tableWidget_2->item(4,i)->setText(QString::number(work_thread->localData.dcdc_data[i-1].TX));
|
// ui->tableWidget_2->item(5,i)->setText(QString::number(work_thread->localData.dcdc_data[i-1].RX));
|
// if(work_thread->localData.dcdc_data[i-1].DC_Alarm)
|
// qDebug("%x",work_thread->localData.dcdc_data[i-1].DC_Alarm);
|
QString msg = "";
|
int count = 0;
|
if(work_thread->localData.dcdc_data[i-1].DC_Alarm & 0x02)
|
{
|
msg+="Fan ";count++;
|
}
|
// if(work_thread->localData.dcdc_data[i-1].DC_Alarm & 0x20)
|
// {
|
// msg+="0x20 ";count++;
|
// }
|
if(work_thread->localData.dcdc_data[i-1].DC_Alarm & 0x40 &&
|
count <2)
|
{
|
msg+="HiTMP ";count++;
|
}
|
if(work_thread->localData.dcdc_data[i-1].DC_Alarm & 0x100 &&
|
count <2)
|
{
|
msg+="HVSD ";count++;
|
}
|
if(work_thread->localData.dcdc_data[i-1].DC_Alarm & 0x400 &&
|
count <2)
|
{
|
msg+="PoL ";count++;
|
}
|
if(work_thread->localData.dcdc_data[i-1].DC_Alarm & 0x4000 &&
|
count <2)
|
{
|
msg+="SD ";count++;
|
}
|
if(work_thread->localData.dcdc_data[i-1].DC_Alarm & 0x8000 &&
|
count <2)
|
{
|
msg+="TmpERR";
|
}
|
if(msg == "")
|
{
|
msg ="-";
|
}
|
ui->tableWidget_3->item(3,i)->setText(msg);
|
}
|
}
|
#endif
|
}
|
|
void Working_Page::setIconTime()
|
{
|
QDateTime time = QDateTime::currentDateTime();//获取系统现在的时间
|
QString str = time.toString("yyyy-MM-dd hh:mm:ss"); //设置显示格式
|
ui->label_Time->setText(str);
|
|
if(work_thread->iconState.monomerState){
|
if(work_thread->get_mon_source()==MONO_TYPE_WIRED)
|
{
|
ui->label_MON->setStyleSheet("image: url(:/new/prefix1/1.png);");
|
}
|
else
|
{
|
if(mon_use_type == 2)
|
ui->label_MON->setStyleSheet("border-image: url(:/new/prefix1/lora_mon.png);");
|
else
|
ui->label_MON->setStyleSheet("border-image: url(:/new/prefix1/mon.png);");
|
}
|
}
|
else
|
ui->label_MON->setStyleSheet("");
|
|
if(work_thread->iconState.usbState)
|
ui->label_USB->setPixmap(QPixmap(":new/prefix1/usb.png"));
|
else
|
ui->label_USB->setPixmap(QPixmap(""));
|
if(work_thread->iconState.wifiState)
|
{
|
ui->label_WIFI->setStyleSheet("border-image: url(:/new/prefix1/wificonnect.png);");
|
ui->pushButton_Start->setVisible(false);
|
ui->pushButton_Stop->setVisible(false);
|
#if (PageType == FBO48CT || PageType == FBI48CT)&&CONTROL_ZC
|
ui->pushButton_zch->setVisible(false);
|
#endif
|
ui->comboBox_Type->setEnabled(false);
|
}
|
else
|
{
|
if(ui->label_WIFI->styleSheet()!="" &&
|
work_thread->localData.SysWorkState == WorkStopped)
|
{
|
ui->comboBox_Type->setEnabled(true);
|
}
|
ui->label_WIFI->setStyleSheet("");
|
ui->pushButton_Start->setVisible(true);
|
ui->pushButton_Stop->setVisible(true);
|
#if (PageType == FBO48CT) || PageType == FBI48CT
|
if((test_param_xml.test_mode == ONline_working)&&
|
(ui->comboBox_Type->currentIndex() == 1)&&
|
CONTROL_ZC)
|
{
|
ui->pushButton_zch->setVisible(true);
|
}
|
else{
|
ui->pushButton_zch->setVisible(false);
|
}
|
#endif
|
}
|
}
|
|
void Working_Page::setParamEnabled(bool enabled)
|
{
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(enabled);
|
ui->edit_onlinevol_lowlimit->setEnabled(enabled);
|
#endif
|
#if PageType == FBI48CT
|
ui->edit_SetBoosterCeiling->setEnabled(enabled);
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(enabled);
|
#endif
|
ui->edit_SetCur->setEnabled(enabled);
|
ui->edit_SetGroupLow->setEnabled(enabled);
|
ui->edit_SetMonLow->setEnabled(enabled);
|
ui->edit_SetLowNum->setEnabled(enabled);
|
ui->edit_SetTime->setEnabled(enabled);
|
ui->edit_SetCap->setEnabled(enabled);
|
ui->edit_HourRate->setEnabled(enabled);
|
ui->edit_Setmode->setEnabled(enabled);
|
|
if(enabled)//放电界面
|
{
|
#if PageType == FBO48CT
|
ui->edit_workmode->setStyleSheet("color:black");
|
ui->edit_onlinevol_lowlimit->setStyleSheet("color:black");
|
#endif
|
#if PageType == FBI48CT
|
ui->edit_SetBoosterCeiling->setStyleSheet("color:black");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setStyleSheet("color:black");
|
#endif
|
ui->edit_SetCur->setStyleSheet("color:black");
|
ui->edit_SetGroupLow->setStyleSheet("color:black");
|
ui->edit_SetMonLow->setStyleSheet("color:black");
|
ui->edit_SetLowNum->setStyleSheet("color:black");
|
ui->edit_SetTime->setStyleSheet("color:black");
|
ui->edit_SetCap->setStyleSheet("color:black");
|
ui->edit_HourRate->setStyleSheet("color:black");
|
|
ui->label_TestCur->setText(tr("放电电流:"));
|
ui->label_TestCap->setText(tr("已放容量:"));
|
ui->edit_Setmode->setStyleSheet("color:black");
|
|
if(test_param_xml.discharge_mode == DISCHARGE_CURRENT){
|
ui->edit_HourRate->setEnabled(true);ui->edit_HourRate->setStyleSheet("color:black");
|
}
|
else {
|
ui->edit_HourRate->setEnabled(false);ui->edit_HourRate->setStyleSheet("color:gray");
|
}
|
}
|
else
|
{
|
#if PageType == FBO48CT
|
ui->edit_workmode->setStyleSheet("color:gray");
|
ui->edit_onlinevol_lowlimit->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBI48CT
|
ui->edit_SetBoosterCeiling->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setStyleSheet("color:gray");
|
#endif
|
ui->edit_SetCur->setStyleSheet("color:gray");
|
ui->edit_SetGroupLow->setStyleSheet("color:gray");
|
ui->edit_SetMonLow->setStyleSheet("color:gray");
|
ui->edit_SetLowNum->setStyleSheet("color:gray");
|
ui->edit_SetTime->setStyleSheet("color:gray");
|
ui->edit_SetCap->setStyleSheet("color:gray");
|
ui->edit_HourRate->setStyleSheet("color:gray");
|
ui->edit_Setmode->setStyleSheet("color:gray");
|
ui->edit_Setmode->setEnabled(false);
|
|
ui->label_TestCur->setText(tr("充电电流:"));
|
ui->label_TestCap->setText(tr("已充容量:"));
|
}
|
}
|
|
void Working_Page::cleanMonomerTable()
|
{
|
for(int i=0;i<6;i++)
|
{
|
for(int j=0;j<4;j++)
|
{
|
ui->tableWidget->item(i,j)->setText("");
|
}
|
}
|
}
|
|
void Working_Page::setMonomerTable()
|
{
|
cleanMonomerTable();
|
if(test_param_xml.mon_number != 0)
|
{
|
//每组单体数量
|
mon_table.monNum = test_param_xml.mon_number;
|
//单体组数
|
mon_table.monGroupNum = test_param_xml.group_number;
|
//每组页数
|
if(mon_table.monNum%24 == 0)
|
mon_table.monPageNum = mon_table.monNum/24;
|
else
|
mon_table.monPageNum = mon_table.monNum/24+1;
|
//当前页数和当前组数
|
if(mon_table.pageIndex%mon_table.monPageNum == 0)//当前是每组最后一页
|
{
|
mon_table.monPageIndex = mon_table.monPageNum;
|
mon_table.monGroupIndex = mon_table.pageIndex/mon_table.monPageNum;
|
if(mon_table.monNum%24 == 0) //单体数是24倍数
|
{
|
for(int i=0;i<6;i++)
|
{
|
for(int j=0;j<4;j++)
|
{
|
int current_index = (mon_table.monGroupIndex-1)*
|
mon_table.monNum+(mon_table.monPageIndex-1)*24+i*4+j;
|
tableItem = ui->tableWidget->item(i,j);
|
tableItem->setText(format_monomer((mon_table.monPageIndex-1)*24+i*4+j,
|
fbodata.SingleVol[current_index]));
|
tableItem->setTextAlignment(0x0084);
|
tableItem->setTextColor(QColor(255,255,255));
|
|
if((fbodata.SingleVol[current_index] ==
|
lcldata.SMaxVol[mon_table.monGroupIndex-1])&&
|
ClassXML::getMonomerVol(work_thread->get_mon_source(),fbodata.SingleVol[current_index])>0)
|
{
|
tableItem->setTextColor(QColor(0,255,127));
|
}
|
if(fbodata.SingleVol[current_index] ==
|
lcldata.SMinVol[mon_table.monGroupIndex-1])
|
{
|
tableItem->setTextColor(QColor(255,69,78));
|
}
|
}
|
}
|
}
|
else //单体不是24的倍数
|
{
|
for(int i=0;i<6;i++)
|
{
|
for(int j=0;j<4;j++)
|
{
|
int current_index = (mon_table.monGroupIndex-1)*
|
mon_table.monNum+(mon_table.monPageIndex-1)*24+i*4+j;
|
if(i*4+j<mon_table.monNum%24)
|
{
|
tableItem = ui->tableWidget->item(i,j);
|
tableItem->setText(format_monomer((mon_table.monPageIndex-1)*24+i*4+j,
|
fbodata.SingleVol[current_index]));
|
tableItem->setTextAlignment(0x0084);
|
tableItem->setTextColor(QColor(255,255,255));
|
if((fbodata.SingleVol[current_index] ==
|
lcldata.SMaxVol[mon_table.monGroupIndex-1])&&
|
ClassXML::getMonomerVol(work_thread->get_mon_source(),fbodata.SingleVol[current_index])>0)
|
{
|
tableItem->setTextColor(QColor(0,255,127));
|
}
|
if(fbodata.SingleVol[current_index] ==
|
lcldata.SMinVol[mon_table.monGroupIndex-1])
|
{
|
tableItem->setTextColor(QColor(255,69,78));
|
}
|
//tableWidget->setItem(i,j,tableItem);
|
}
|
}
|
}
|
}
|
|
}
|
else //当前不是最后一页
|
{
|
mon_table.monPageIndex = mon_table.pageIndex%mon_table.monPageNum;
|
mon_table.monGroupIndex = (mon_table.pageIndex/mon_table.monPageNum)+1;
|
for(int i=0;i<6;i++)
|
{
|
for(int j=0;j<4;j++)
|
{
|
int current_index = (mon_table.monGroupIndex-1)*
|
mon_table.monNum+(mon_table.monPageIndex-1)*24+i*4+j;
|
tableItem = ui->tableWidget->item(i,j);
|
tableItem->setText(format_monomer((mon_table.monPageIndex-1)*24+i*4+j,
|
fbodata.SingleVol[current_index]));
|
tableItem->setTextAlignment(0x0084);
|
tableItem->setTextColor(QColor(255,255,255));
|
if((fbodata.SingleVol[current_index] ==
|
lcldata.SMaxVol[mon_table.monGroupIndex-1])&&
|
ClassXML::getMonomerVol(work_thread->get_mon_source(),fbodata.SingleVol[current_index])>0)
|
{
|
tableItem->setTextColor(QColor(0,255,127));
|
}
|
if(fbodata.SingleVol[current_index] ==
|
lcldata.SMinVol[mon_table.monGroupIndex-1])
|
{
|
tableItem->setTextColor(QColor(255,69,78));
|
}
|
//tableWidget->setItem(i,j,tableItem);
|
}
|
}
|
}
|
ui->label_Group->setText(tr("组:")+QString::number(mon_table.monGroupIndex)+"/"+
|
QString::number(mon_table.monGroupNum));
|
ui->label_MaxMon->setText(tr("最高:")+format_monomer(
|
lcldata.SMaxIndex[mon_table.monGroupIndex-1],
|
lcldata.SMaxVol[mon_table.monGroupIndex-1]));
|
ui->label_MinMon->setText(tr("最低:")+format_monomer(
|
lcldata.SMinIndex[mon_table.monGroupIndex-1],
|
lcldata.SMinVol[mon_table.monGroupIndex-1]));
|
}
|
}
|
|
void Working_Page::initMonomerChart()
|
{
|
bars1 = new QCPBars(ui->chartWidget1->xAxis,ui->chartWidget1->yAxis);
|
bars1->setAntialiased(false);
|
bars1->setStackingGap(1);
|
bars1->setName(NULL);
|
bars1->setPen(QPen(QColor(255, 255, 255).lighter(130)));
|
bars1->setBrush(QColor(255, 255, 255));
|
|
bars2 = new QCPBars(ui->chartWidget1->xAxis,ui->chartWidget1->yAxis);
|
bars2->setAntialiased(false);
|
bars2->setStackingGap(1);
|
bars2->setName(NULL);
|
bars2->setPen(QPen(QColor(0, 255, 127).lighter(130)));
|
bars2->setBrush(QColor(0, 255, 127));
|
|
bars3 = new QCPBars(ui->chartWidget1->xAxis,ui->chartWidget1->yAxis);
|
bars3->setAntialiased(false);
|
bars3->setStackingGap(1);
|
bars3->setName(NULL);
|
bars3->setPen(QPen(QColor(255, 69, 78).lighter(130)));
|
bars3->setBrush(QColor(255, 69, 78));
|
|
bars4 = new QCPBars(ui->chartWidget1->xAxis,ui->chartWidget1->yAxis);
|
bars4->setAntialiased(false);
|
bars4->setStackingGap(1);
|
bars4->setName(NULL);
|
bars4->setPen(QPen(QColor(240, 240, 0).lighter(130)));
|
bars4->setBrush(QColor(240, 240, 0));
|
|
bars4->moveAbove(bars1);
|
// set transparent background gradient:
|
QLinearGradient gradient(0,0,0,0);
|
gradient.setColorAt(0, QColor(0,0,0,0));
|
ui->chartWidget1->setBackground(QBrush(gradient));
|
|
// create empty bar chart objects:
|
//bars4->moveBelow(bars1);
|
ui->chartWidget1->xAxis->setSubTicks(false);//是否显示小刻度
|
ui->chartWidget1->xAxis->setTickLength(0, 4);//大刻度高度(内,外)
|
ui->chartWidget1->xAxis->setRange(0, 25);//坐标轴范围
|
ui->chartWidget1->xAxis->setBasePen(QPen(Qt::white));//基础线条画笔
|
ui->chartWidget1->xAxis->setTickPen(QPen(Qt::white));//文本画笔
|
ui->chartWidget1->xAxis->grid()->setVisible(false);//网格可见
|
ui->chartWidget1->xAxis->grid()->setPen(QPen(QColor(130, 130, 130), 0, Qt::DotLine));
|
ui->chartWidget1->xAxis->setTickLabelColor(Qt::white);//文本颜色
|
ui->chartWidget1->xAxis->setLabelColor(Qt::white);//坐标轴名称颜色
|
|
// prepare y axis:
|
//ui->chartWidget1->yAxis->setRange(0, 15);
|
ui->chartWidget1->yAxis->setPadding(5);
|
//ui->chartWidget1->yAxis->setLabel("vol");
|
ui->chartWidget1->yAxis->setBasePen(QPen(Qt::white));
|
ui->chartWidget1->yAxis->setTickPen(QPen(Qt::white));
|
ui->chartWidget1->yAxis->setSubTickPen(QPen(Qt::white));
|
ui->chartWidget1->yAxis->grid()->setSubGridVisible(false);
|
ui->chartWidget1->yAxis->setTickLabelColor(Qt::white);
|
ui->chartWidget1->yAxis->setLabelColor(Qt::white);
|
ui->chartWidget1->yAxis->grid()->setPen(QPen(QColor(130, 130, 130), 0, Qt::SolidLine));
|
ui->chartWidget1->yAxis->grid()->setSubGridPen(QPen(QColor(130, 130, 130), 0, Qt::DotLine));
|
|
// setup legend:
|
ui->chartWidget1->legend->setVisible(false);//柱状图中柱状说明
|
ui->chartWidget1->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignTop|Qt::AlignHCenter);
|
ui->chartWidget1->legend->setBrush(QColor(255, 255, 255, 100));
|
ui->chartWidget1->legend->setBorderPen(Qt::NoPen);
|
QFont legendFont = font();
|
legendFont.setPointSize(18);
|
ui->chartWidget1->legend->setFont(legendFont);
|
ui->chartWidget1->yAxis->setLabelFont(legendFont);
|
ui->chartWidget1->xAxis->setTickLabelFont(legendFont);
|
ui->chartWidget1->yAxis->setTickLabelFont(legendFont);
|
//ui->chartWidget1->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);//移动缩放
|
}
|
|
void Working_Page::setMonomerChart()
|
{
|
QVector<double> index(24); //X轴索引
|
QVector<QString> labels(24); //X轴显示
|
QVector<double> value(24); //Y轴值
|
QVector<double> valuebefore(24);//测试前Y轴值
|
QVector<double> maxIndex; //最大单体索引
|
QVector<double> maxValue; //最大单体值
|
QVector<double> minIndex; //最小单体索引
|
QVector<double> minValue; //最小单体值
|
QVector<double> workValue(24); //开始测试时电压差
|
if(test_param_xml.mon_number != 0)
|
{
|
double curr_vol=0;
|
double before_vol=0;
|
if(mon_table.pageIndex%mon_table.monPageNum == 0)//当前是每组最后一页
|
{
|
if(mon_table.monNum%24 == 0) //单体数是24倍数
|
{
|
for(int i=0;i<24;i++)
|
{
|
int current_index = (mon_table.monGroupIndex-1)*
|
mon_table.monNum+(mon_table.monPageIndex-1)*24+i;
|
curr_vol = (float)ClassXML::getMonomerVol(work_thread->get_mon_source(),fbodata.SingleVol[current_index])/1000;
|
before_vol = (float)ClassXML::getMonomerVol(work_thread->get_mon_source(),SingleVolBeforeTest[current_index])/1000;
|
index[i] = i+1;
|
if((i+1)%4 == 0)
|
{
|
labels[i] = format_monID((mon_table.monPageIndex-1)*24+i+1);
|
}
|
if(lcldata.SysWorkState) //非停止状态显示压差
|
{
|
if(curr_vol >= before_vol && before_vol >= 0)//电压上升
|
{
|
value[i] = before_vol;
|
valuebefore[i] = curr_vol;
|
workValue[i] = (curr_vol-before_vol);
|
}
|
else//电压下降
|
{
|
value[i] = curr_vol;
|
valuebefore[i] = before_vol;
|
workValue[i] = (before_vol-curr_vol);
|
}
|
}
|
else //停止状态只显示当前电压
|
{
|
value[i] = curr_vol;
|
workValue[i] = 0;
|
valuebefore[i] = 0;
|
}
|
//------------找出最大最小单体------------
|
if(fbodata.SingleVol[current_index] ==
|
lcldata.SMaxVol[mon_table.monGroupIndex-1])
|
{
|
maxIndex.append(i+1);
|
maxValue.append((float)ClassXML::getMonomerVol(work_thread->get_mon_source(),lcldata.SMaxVol[mon_table.monGroupIndex-1])/1000);
|
}
|
if(fbodata.SingleVol[current_index] ==
|
lcldata.SMinVol[mon_table.monGroupIndex-1])
|
{
|
minIndex.append(i+1);
|
minValue.append((float)ClassXML::getMonomerVol(work_thread->get_mon_source(),lcldata.SMinVol[mon_table.monGroupIndex-1])/1000);
|
}
|
}
|
}
|
else
|
{
|
int lastnum = mon_table.monNum%24;
|
for(int i=0;i<lastnum;i++)
|
{
|
int current_index = (mon_table.monGroupIndex-1)*
|
mon_table.monNum+(mon_table.monPageIndex-1)*24+i;
|
curr_vol = (float)ClassXML::getMonomerVol(work_thread->get_mon_source(),fbodata.SingleVol[current_index])/1000;
|
before_vol = (float)ClassXML::getMonomerVol(work_thread->get_mon_source(),SingleVolBeforeTest[current_index])/1000;
|
index[i] = i+1;
|
if((i+1)%4 == 0)
|
{
|
labels[i] = format_monID((mon_table.monPageIndex-1)*24+i+1);
|
}
|
if(lcldata.SysWorkState) //非停止状态显示压差
|
{
|
if(curr_vol >= before_vol && before_vol >= 0)//电压上升
|
{
|
value[i] = before_vol;
|
valuebefore[i] = curr_vol;
|
workValue[i] = (curr_vol-before_vol);
|
}
|
else//电压下降
|
{
|
value[i] = curr_vol;
|
valuebefore[i] = before_vol;
|
workValue[i] = (before_vol-curr_vol);
|
}
|
}
|
else //停止状态只显示当前电压
|
{
|
value[i] = curr_vol;
|
workValue[i] = 0;
|
valuebefore[i] = 0;
|
}
|
//------------找出最大最小单体------------
|
if(fbodata.SingleVol[current_index] ==
|
lcldata.SMaxVol[mon_table.monGroupIndex-1])
|
{
|
maxIndex.append(i+1);
|
maxValue.append((float)ClassXML::getMonomerVol(work_thread->get_mon_source(),lcldata.SMaxVol[mon_table.monGroupIndex-1])/1000);
|
}
|
if(fbodata.SingleVol[current_index] ==
|
lcldata.SMinVol[mon_table.monGroupIndex-1])
|
{
|
minIndex.append(i+1);
|
minValue.append((float)ClassXML::getMonomerVol(work_thread->get_mon_source(),lcldata.SMinVol[mon_table.monGroupIndex-1])/1000);
|
}
|
}
|
if(lastnum%4!=0)
|
{
|
for(int i=lastnum;i<(4-lastnum%4)+lastnum;i++)
|
{
|
index[i] = i+1;
|
if((i+1)%4 == 0)
|
{
|
labels[i] = format_monID((mon_table.monPageIndex-1)*24+i+1);
|
}
|
}
|
}
|
}
|
}
|
else
|
{
|
for(int i=0;i<24;i++)
|
{
|
int current_index = (mon_table.monGroupIndex-1)*
|
mon_table.monNum+(mon_table.monPageIndex-1)*24+i;
|
curr_vol = (float)ClassXML::getMonomerVol(work_thread->get_mon_source(),fbodata.SingleVol[current_index])/1000;
|
before_vol = (float)ClassXML::getMonomerVol(work_thread->get_mon_source(),SingleVolBeforeTest[current_index])/1000;
|
index[i] = i+1;
|
if((i+1)%4 == 0)
|
{
|
labels[i] = format_monID((mon_table.monPageIndex-1)*24+i+1);
|
}
|
if(lcldata.SysWorkState) //非停止状态显示压差
|
{
|
if(curr_vol >= before_vol && before_vol >= 0)//电压上升
|
{
|
value[i] = before_vol;
|
valuebefore[i] = curr_vol;
|
workValue[i] = (curr_vol-before_vol);
|
}
|
else//电压下降
|
{
|
value[i] = curr_vol;
|
valuebefore[i] = before_vol;
|
workValue[i] = (before_vol-curr_vol);
|
}
|
}
|
else //停止状态只显示当前电压
|
{
|
value[i] = curr_vol;
|
workValue[i] = 0;
|
valuebefore[i] = 0;
|
}
|
|
//------------找出最大最小单体------------
|
if(fbodata.SingleVol[current_index] ==
|
lcldata.SMaxVol[mon_table.monGroupIndex-1])
|
{
|
maxIndex.append(i+1);
|
maxValue.append((float)ClassXML::getMonomerVol(work_thread->get_mon_source(),lcldata.SMaxVol[mon_table.monGroupIndex-1])/1000);
|
}
|
if(fbodata.SingleVol[current_index] ==
|
lcldata.SMinVol[mon_table.monGroupIndex-1])
|
{
|
minIndex.append(i+1);
|
minValue.append((float)ClassXML::getMonomerVol(work_thread->get_mon_source(),lcldata.SMinVol[mon_table.monGroupIndex-1])/1000);
|
}
|
}
|
}
|
//x,index
|
// QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText);
|
// textTicker->addTicks(index, labels);
|
// ui->chartWidget1->xAxis->setTicker(textTicker);
|
|
// bars1->setData(index,value);
|
// bars2->setData(maxIndex,maxValue);
|
// bars3->setData(minIndex,minValue);
|
// bars4->setData(index,workValue);
|
|
// ui->chartWidget1->yAxis->setRange(0, get_top_barmon(value,valuebefore,lcldata.SysWorkState));
|
|
// ui->chartWidget1->replot();
|
|
ui->label_GroupChart->setText(tr("组:")+QString::number(mon_table.monGroupIndex)+"/"+
|
QString::number(mon_table.monGroupNum));
|
ui->label_MaxMonChart->setText(tr("最高:")+format_monomer(
|
lcldata.SMaxIndex[mon_table.monGroupIndex-1],
|
lcldata.SMaxVol[mon_table.monGroupIndex-1]));
|
ui->label_MinMonChart->setText(tr("最低:")+format_monomer(
|
lcldata.SMinIndex[mon_table.monGroupIndex-1],
|
lcldata.SMinVol[mon_table.monGroupIndex-1]));
|
}
|
QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText);
|
textTicker->addTicks(index, labels);
|
ui->chartWidget1->xAxis->setTicker(textTicker);
|
|
bars1->setData(index,value);
|
bars2->setData(maxIndex,maxValue);
|
bars3->setData(minIndex,minValue);
|
bars4->setData(index,workValue);
|
|
ui->chartWidget1->yAxis->setRange(0, get_top_barmon(value,valuebefore,lcldata.SysWorkState));
|
|
ui->chartWidget1->replot();
|
}
|
|
void Working_Page::setMonomerBtnState(void)
|
{
|
if(mon_table.pageIndex == 1)
|
{
|
if(mon_table.monPageNum==1 && mon_table.monGroupNum==1)
|
{
|
ui->pushButton_MonLast->setEnabled(false);
|
ui->pushButton_MonNext->setEnabled(false);
|
ui->pushButton_MonChartLast->setEnabled(false);
|
ui->pushButton_MonChartNext->setEnabled(false);
|
}
|
else
|
{
|
ui->pushButton_MonLast->setEnabled(false);
|
ui->pushButton_MonNext->setEnabled(true);
|
ui->pushButton_MonChartLast->setEnabled(false);
|
ui->pushButton_MonChartNext->setEnabled(true);
|
}
|
}
|
else
|
{
|
if(mon_table.pageIndex==mon_table.monPageNum*mon_table.monGroupNum)
|
{
|
ui->pushButton_MonLast->setEnabled(true);
|
ui->pushButton_MonNext->setEnabled(false);
|
ui->pushButton_MonChartLast->setEnabled(true);
|
ui->pushButton_MonChartNext->setEnabled(false);
|
}
|
else
|
{
|
ui->pushButton_MonLast->setEnabled(true);
|
ui->pushButton_MonNext->setEnabled(true);
|
ui->pushButton_MonChartLast->setEnabled(true);
|
ui->pushButton_MonChartNext->setEnabled(true);
|
}
|
}
|
}
|
|
//********************历史曲线***********************
|
void Working_Page::initTestChart()
|
{
|
QLinearGradient gradient(0,0,0,0);
|
gradient.setColorAt(0, QColor(0,0,0,0));
|
ui->chartWidget2->setBackground(QBrush(gradient));
|
// prepare x axis:
|
ui->chartWidget2->xAxis->setSubTicks(false);//是否显示小刻度
|
ui->chartWidget2->xAxis->setBasePen(QPen(Qt::white));//基础线条画笔
|
ui->chartWidget2->xAxis->setTickPen(QPen(Qt::white));//文本画笔
|
ui->chartWidget2->xAxis->setTickLabelColor(Qt::white);//文本颜色
|
ui->chartWidget2->xAxis->setLabelColor(Qt::white);//坐标轴名称颜色
|
ui->chartWidget2->xAxis->setRange(0, 5);
|
// prepare y axis:
|
ui->chartWidget2->yAxis->setRange(0, 50);
|
ui->chartWidget2->yAxis->setLabel(" ");
|
ui->label_SetLabel->setText("V");
|
ui->chartWidget2->yAxis->setBasePen(QPen(Qt::white));
|
ui->chartWidget2->yAxis->setTickPen(QPen(Qt::white));
|
ui->chartWidget2->yAxis->setSubTickPen(QPen(Qt::white));
|
ui->chartWidget2->yAxis->setTickLabelColor(Qt::white);
|
ui->chartWidget2->yAxis->setLabelColor(Qt::white);
|
ui->chartWidget2->clearGraphs();
|
ui->chartWidget2->addGraph();
|
ui->chartWidget2->graph()->setPen(QPen(Qt::green,3));
|
|
QSharedPointer<QCPAxisTickerTime> timeTicker(new QCPAxisTickerTime);
|
timeTicker->setTimeFormat("%h:%m:%s");
|
ui->chartWidget2->xAxis->setTicker(timeTicker);
|
|
QFont legendFont = font();
|
legendFont.setPointSize(18);
|
ui->chartWidget2->yAxis->setLabelFont(legendFont);
|
ui->chartWidget2->xAxis->setTickLabelFont(legendFont);
|
ui->chartWidget2->yAxis->setTickLabelFont(legendFont);
|
ui->chartWidget2->replot();
|
}
|
|
void Working_Page::updateVolChart()
|
{
|
if(vector_groupvol.count()<=0 || vector_second.count()<=0)
|
return;
|
quint8 workstate = work_thread->localData.SysWorkState;
|
QVector<double> x,y;
|
int volcount = vector_groupvol.count();
|
int volsecond = work_thread->fboData.m_TestTime.hour*3600+
|
work_thread->fboData.m_TestTime.minute*60+
|
work_thread->fboData.m_TestTime.second;
|
if(workstate == Discharging || workstate == Charging){
|
x.resize(volcount+1);y.resize(volcount+1);
|
for(int i=0;i<volcount;i++)
|
{
|
x[i] = vector_second.at(i);
|
y[i] = (double)vector_groupvol.at(i)/10;
|
}
|
x[volcount] = volsecond;
|
y[volcount] = (double)fbodata.SumVoltage/10;
|
}
|
else {
|
x.resize(volcount);y.resize(volcount);
|
for(int i=0;i<volcount;i++)
|
{
|
x[i] = vector_second.at(i);
|
y[i] = (double)vector_groupvol.at(i)/10;
|
}
|
}
|
ui->chartWidget2->graph()->setData(x, y);
|
ui->chartWidget2->xAxis->setRange(0, volsecond*1.2);
|
ui->chartWidget2->yAxis->setRange(0, get_top_chart(y));
|
ui->chartWidget2->replot();
|
}
|
|
void Working_Page::updateCurChart()
|
{
|
if(vector_cur.count()<=0 || vector_second.count()<=0)
|
return;
|
|
//电流曲线 加入 当前电流
|
int curcount = vector_cur.count();
|
QVector<double> x(curcount+1) , y(curcount+1);
|
for(int i=0;i<curcount;i++)
|
{
|
x[i] = vector_second.at(i);
|
y[i] = (double)vector_cur.at(i)/10;
|
}
|
|
int cursecond = work_thread->fboData.m_TestTime.hour*3600+
|
work_thread->fboData.m_TestTime.minute*60+
|
work_thread->fboData.m_TestTime.second;
|
|
if(work_thread->localData.SysWorkState == Discharging ||
|
work_thread->localData.SysWorkState == Charging){
|
x[curcount] = cursecond;
|
y[curcount] = (double)work_thread->fboData.SumCurrent/10;
|
}
|
else{
|
x[curcount] = cursecond+0.0001;
|
y[curcount] = 0;
|
}
|
ui->chartWidget2->graph()->setData(x, y);
|
ui->chartWidget2->xAxis->setRange(0, cursecond*1.2);
|
ui->chartWidget2->yAxis->setRange(0, get_top_chart(y));
|
ui->chartWidget2->replot();
|
|
}
|
|
void Working_Page::updateCapChart()
|
{
|
if(vector_cap.count()<=0 || vector_second.count()<=0)
|
return;
|
quint8 workstate = work_thread->localData.SysWorkState;
|
QVector<double> x,y;
|
int capcount = vector_cap.count();
|
int capsecond = work_thread->fboData.m_TestTime.hour*3600+
|
work_thread->fboData.m_TestTime.minute*60+
|
work_thread->fboData.m_TestTime.second;
|
if(workstate == Discharging || workstate == Charging){
|
x.resize(capcount+1);y.resize(capcount+1);
|
for(int i=0;i<capcount;i++)
|
{
|
x[i] = vector_second.at(i);
|
y[i] = vector_cap.at(i);
|
}
|
x[capcount] = capsecond;
|
y[capcount] = fbodata.AllCap;
|
}
|
else {
|
x.resize(capcount);y.resize(capcount);
|
for(int i=0;i<capcount;i++)
|
{
|
x[i] = vector_second.at(i);
|
y[i] = vector_cap.at(i);
|
}
|
}
|
ui->chartWidget2->graph()->setData(x, y);
|
ui->chartWidget2->xAxis->setRange(0, capsecond*1.2);
|
ui->chartWidget2->yAxis->setRange(0, get_top_chart(y));
|
//ui->chartWidget2->yAxis->setRange(0, test_param_xml.nominal_cap);
|
ui->chartWidget2->replot();
|
}
|
|
void Working_Page::updateMonChart(int index)
|
{
|
if(index<0 || index>=GmonNum)
|
return;
|
int nowindex = (CBGroupIndex-1)*GmonNum+index;
|
if(vector_mon.count()<=0 || vector_second.count()<=0)
|
return;
|
QVector<double> x,y;
|
quint8 workstate = work_thread->localData.SysWorkState;
|
int monsecond = work_thread->fboData.m_TestTime.hour*3600+
|
work_thread->fboData.m_TestTime.minute*60+
|
work_thread->fboData.m_TestTime.second;
|
int moncount = vector_mon.at(nowindex).count();
|
if(workstate == Discharging || workstate == Charging){
|
x.resize(moncount+1);y.resize(moncount+1);
|
for(int i=0;i<moncount;i++)
|
{
|
x[i] = vector_second.at(i);
|
y[i] = (double)ClassXML::getMonomerVol(work_thread->get_mon_source(),vector_mon.at(nowindex).at(i))/1000;
|
}
|
x[moncount] = monsecond;
|
y[moncount] = (double)ClassXML::getMonomerVol(work_thread->get_mon_source(),fbodata.SingleVol[nowindex])/1000;
|
}
|
else {
|
x.resize(moncount);y.resize(moncount);
|
for(int i=0;i<moncount;i++)
|
{
|
x[i] = vector_second.at(i);
|
y[i] = (double)ClassXML::getMonomerVol(work_thread->get_mon_source(),vector_mon.at(nowindex).at(i))/1000;
|
}
|
}
|
ui->chartWidget2->graph()->setData(x, y);
|
ui->chartWidget2->xAxis->setRange(0, monsecond*1.2);
|
|
ui->chartWidget2->yAxis->setRange(0, get_top_chart(y));
|
ui->chartWidget2->replot();
|
}
|
|
void Working_Page::TypeComboBoxChangeSlot(int index)
|
{
|
work_thread->localData.Interface=index+1;
|
switch(index)
|
{
|
case 0://放电
|
{
|
setParamEnabled(true);
|
work_thread->initWorkPageShow();
|
break;
|
}
|
case 1:
|
{
|
setParamEnabled(false);
|
work_thread->initWorkPageShow();
|
break;
|
}
|
}
|
}
|
|
void Working_Page::TestChartComboBoxChangeSlot(int index)
|
{
|
switch(index)
|
{
|
case 0:
|
{
|
ui->edit_mon_id->setVisible(false);
|
ui->pushButton_MonLast_Test->setVisible(false);
|
ui->pushButton_MonNext_Test->setVisible(false);
|
ui->comboBox_GroupM->setVisible(false);
|
ui->label_SetLabel->setText("V");
|
ui->chartWidget2->graph()->setPen(QPen(Qt::green,3));
|
ui->chartWidget2->graph()->setBrush(Qt::transparent);
|
ReadDataSlot();
|
}
|
break;
|
|
case 1:
|
{
|
ui->edit_mon_id->setVisible(false);
|
ui->pushButton_MonLast_Test->setVisible(false);
|
ui->pushButton_MonNext_Test->setVisible(false);
|
ui->comboBox_GroupM->setVisible(false);
|
ui->label_SetLabel->setText("A");
|
ui->chartWidget2->graph()->setPen(QPen(Qt::red,3));
|
ui->chartWidget2->graph()->setBrush(Qt::transparent);
|
ReadDataSlot();
|
}
|
break;
|
case 2:
|
ui->edit_mon_id->setVisible(false);
|
ui->pushButton_MonLast_Test->setVisible(false);
|
ui->pushButton_MonNext_Test->setVisible(false);
|
ui->comboBox_GroupM->setVisible(false);
|
ui->label_SetLabel->setText("AH");
|
ui->chartWidget2->graph()->setPen(QPen(Qt::yellow,3));
|
ui->chartWidget2->graph()->setBrush(Qt::yellow);
|
ReadDataSlot();
|
break;
|
case 3:
|
ui->edit_mon_id->setVisible(true);
|
ui->pushButton_MonLast_Test->setVisible(true);
|
ui->pushButton_MonNext_Test->setVisible(true);
|
if(test_param_xml.group_number != 1)
|
ui->comboBox_GroupM->setVisible(true);
|
ui->label_SetLabel->setText("V");
|
ui->chartWidget2->graph()->setPen(QPen(Qt::green,3));
|
ui->chartWidget2->graph()->setBrush(Qt::transparent);
|
ReadDataSlot();
|
break;
|
}
|
}
|
|
void Working_Page::GroupMComboBoxChangeSlot(int index)
|
{
|
if(index+1<=4 && index >=0)
|
{
|
CBGroupIndex = index+1;
|
}
|
updateMonChart(chartMonID-1);
|
}
|
//**************************************************
|
bool Working_Page::setEditInput(Custom_LineEdit *edit,
|
int space, float min, float max, int floatNum)
|
{
|
edit->setStyleSheet("color:red");
|
KeyBoard_Num keyboard(this,INPUT_DATA,work_thread);
|
if(!space)
|
keyboard.setGeometry(230,130,300,350);
|
else
|
keyboard.setGeometry(485,130,300,350);
|
keyboard.execKeyboard();
|
edit->setStyleSheet("color:black");
|
DATA_KB_RTN kbdata = keyboard.get_kb_data();
|
if(kbdata.If_OK)
|
{
|
float input = kbdata.set_text.toFloat();
|
if(input>=min && input<=max)
|
{
|
edit->setText(QString::number(input,'f',floatNum));
|
}
|
else {
|
popBox(tr("当前输入范围:")+QString::number(min,'f',floatNum)+("~")+QString::number(max,'f',floatNum));
|
}
|
}
|
return kbdata.If_OK;
|
}
|
|
void Working_Page::setChartEditInput(Custom_LineEdit *edit,int min, int max)
|
{
|
edit->setStyleSheet("color:red");
|
KeyBoard_Num keyboard(this,INPUT_ALLNO,work_thread);
|
keyboard.setGeometry(490,105,300,350);
|
keyboard.execKeyboard();
|
edit->setStyleSheet("color:black");
|
DATA_KB_RTN kbdata = keyboard.get_kb_data();
|
if(kbdata.If_OK)
|
{
|
int input = kbdata.set_text.toInt();
|
if(input>=min && input<=max)
|
{
|
//edit->setText(QString::number(input,'f',floatNum));
|
chartMonID = input;
|
edit->setText(QString::number(chartMonID)+"/"+QString::number(max));
|
}
|
}
|
}
|
|
bool Working_Page::setTimeInput(Custom_LineEdit *edit, int space)
|
{
|
edit->setStyleSheet("color:red");
|
KeyBoard_Num keyboard(this,INPUT_TIME,work_thread);
|
if(space)
|
keyboard.setGeometry(215,110,300,350);
|
else
|
keyboard.setGeometry(230,130,300,350);
|
keyboard.execKeyboard();
|
edit->setStyleSheet("color:black");
|
DATA_KB_RTN kbdata = keyboard.get_kb_data();
|
if(kbdata.If_OK)
|
{
|
QString data = kbdata.set_text;
|
if(checkTimeText(data))
|
{
|
edit->setText(QString("%1:%2")
|
.arg(data.section(":",0,0).trimmed().
|
toInt(),2,10,QChar('0'))
|
.arg(data.section(":",1,1).trimmed().
|
toInt(),2,10,QChar('0')));
|
}
|
}
|
return kbdata.If_OK;
|
}
|
|
bool Working_Page::checkTimeText(QString time)
|
{
|
if(time.length()<3)
|
return false;
|
|
if(time.contains(QRegExp("[.-]")))
|
return false;
|
|
QString hour = time.section(":",0,0).trimmed();
|
QString minute = time.section(":",1,1).trimmed();
|
|
int ih = hour.toInt();
|
int im = minute.toInt();
|
|
if(ih<0 || ih>99)
|
return false;
|
|
if(im<0 || im>59)
|
return false;
|
|
if((im == 0) && (ih == 0))
|
return false;
|
|
return true;
|
}
|
|
//************格式化单体电压*****************//
|
QString Working_Page::format_monID(int index)
|
{
|
//格式化输出#001格式的单体编号
|
return QString("%1%2").arg("#").arg(index,3,10,QChar('0'));
|
}
|
|
QString Working_Page::format_monomer(int index,int vol)
|
{
|
//格式化输出#001-00.000V格式的单体电压数据
|
QString show;QString svol;
|
vol = ClassXML::getMonomerVol(work_thread->get_mon_source(),vol);
|
svol = QString::number((float)vol/1000,'f',3);
|
show = QString("%1%2-%3").arg("#").arg(index+1,3,10,QChar('0')).arg(svol,6,QChar('0'));
|
return show;
|
}
|
|
//**************实时曲线上限******************//
|
double Working_Page::get_top_chart(QVector<double> data_v){
|
double top = data_v.at(0);
|
for(int i=1;i<data_v.count();i++){
|
if(data_v.at(i) > top)
|
top = data_v.at(i);
|
}
|
top *= 1.2;
|
return (top);
|
}
|
//**************柱状图上限******************//
|
double Working_Page::get_top_barmon(QVector<double> data_v,QVector<double> data_vold,int state){
|
double top = data_v.at(0);
|
for(int i=1;i<data_v.count();i++){
|
if(data_v.at(i) > top)
|
top = data_v.at(i);
|
}
|
if(state != WorkStopped){
|
for(int i=0;i<data_vold.count();i++){
|
if(data_vold.at(i) > top)
|
top = data_vold.at(i);
|
}
|
}
|
top *= 1.5;
|
return top;
|
}
|
|
//************告警窗口*****************//
|
void Working_Page::popBox(QString msg)
|
{
|
MessageBox box( this, QMessageBox::Warning,MB_Caption, msg,
|
QMessageBox::Ok,
|
QMessageBox::Ok,
|
work_thread);
|
box.exec();
|
}
|
|
void Working_Page::popBoxAlarm(quint8 alarm)
|
{
|
if_update = false;
|
work_thread->localData.popBox = 0x80;
|
//----------------停止告警---------------
|
if(ui->comboBox_Type->currentIndex() == 0){//放电
|
if(alarm !=0 && alarm != 8 && alarm != 9&& alarm != WPPOWERBREAKSTOP)
|
{
|
if(test_param_xml.test_mode == ONline_working &&
|
alarm != WPCURRENTERROR &&
|
alarm != WPTEMPHIGHSTOP &&
|
alarm != ERRORSTOP &&
|
alarm != WPCONNECTERROR &&
|
work_thread->localData.SysWorkState != Paused_Dischg)//剔除单体下限到暂停
|
{//转充电
|
work_thread->localData.waitTimeCount = ChargeDelayTime = CHARGE_DELAY_TIME; //初始化时间//60
|
}
|
else//不转充电
|
{
|
if(!work_thread->iconState.wifiState)
|
{
|
ui->comboBox_Type->setEnabled(true);
|
ui->edit_Setmode->setEnabled(true);ui->edit_Setmode->setStyleSheet("color:black");
|
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(true);ui->edit_workmode->setStyleSheet("color:black");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(true);ui->edit_acstop->setStyleSheet("color:black");
|
#endif
|
}
|
}
|
if(alarm<stopType.count())
|
AlarmText = stopType.at(alarm);
|
else
|
AlarmText = tr("未知");
|
|
if(work_thread->iconState.wifiState)
|
{
|
if(test_param_xml.test_mode == ONline_working &&
|
work_thread->localData.SysWorkState == WaitForCharging)
|
{
|
isCloseBeep = true;
|
if_alarm=true;
|
}
|
}
|
else
|
{
|
if_alarm=true;
|
isCloseBeep = false;
|
CurrentBox->setText(AlarmText);
|
if(QMessageBox::Ok == CurrentBox->exec())//转充电
|
{
|
isCloseBeep = true;
|
if(test_param_xml.test_mode == ONline_working
|
&& work_thread->localData.SysWorkState == WaitForCharging)
|
{
|
// setParamEnabled(false);//禁止编辑参数
|
// ui->pushButton_Start->setEnabled(false);
|
}
|
else
|
if_alarm=false;
|
}
|
else//取消转充电
|
{
|
isCloseBeep = true; //////
|
if_alarm=false;
|
}
|
}
|
}
|
}
|
else {
|
|
if(!work_thread->iconState.wifiState)
|
{
|
ui->comboBox_Type->setEnabled(true);
|
}
|
if(alarm<chargeType.count())
|
AlarmText = chargeType.at(alarm);
|
else
|
AlarmText = tr("未知");
|
if(work_thread->iconState.wifiState)
|
{
|
isCloseBeep = true;
|
if_alarm=true;
|
}
|
else
|
{
|
if_alarm=true;
|
isCloseBeep = false;
|
CurrentBox->setText(AlarmText);
|
if(QMessageBox::Ok == CurrentBox->exec())
|
{
|
isCloseBeep = true;
|
if_alarm=false;
|
}
|
}
|
}
|
}
|
|
void Working_Page::alarm_beep()
|
{
|
if(!isCloseBeep)
|
BD->BuzzerBeep(500);
|
|
if(test_param_xml.test_mode == ONline_working
|
&& work_thread->localData.SysWorkState == WaitForCharging)
|
{
|
quint16 olV = work_thread->localData.OnlineVol;
|
|
if(/*work_thread->localData.OnlineVol*/olV < test_param_xml.onlinevol_lowlimit){
|
work_thread->localData.waitTimeCount = ChargeDelayTime = CHARGE_DELAY_TIME;
|
}
|
if(!isCloseBeep)
|
{
|
if(/*work_thread->localData.OnlineVol*/olV < test_param_xml.onlinevol_lowlimit)
|
CurrentBox->setText(tr("在线电压异常,等待充电!"));
|
else
|
{
|
if(work_thread->if_cn)
|
CurrentBox->setText(AlarmText+"\n"+ QString::number(ChargeDelayTime,10) +"秒后启动充电!");
|
else
|
CurrentBox->setText(AlarmText+"\n"+tr("秒后启动充电!")+QString::number(ChargeDelayTime,10));
|
}
|
}
|
else
|
{
|
if(/*work_thread->localData.OnlineVol*/olV < test_param_xml.onlinevol_lowlimit)
|
ui->label_DropIndex->setText(tr("在线电压异常,等待充电!"));
|
else
|
{
|
if(work_thread->if_cn)
|
ui->label_DropIndex->setText(QString::number(ChargeDelayTime,10)+"秒后启动充电!");
|
else
|
ui->label_DropIndex->setText(tr("秒后启动充电!")+QString::number(ChargeDelayTime,10));
|
}
|
}
|
|
if(ChargeDelayTime <= 0)
|
{
|
if(!isCloseBeep)
|
CurrentBox->accept();
|
|
isCloseBeep = true;/////
|
if_alarm=false;
|
|
//启动充电控制
|
if(AutoStartChargeTest() == false)
|
{
|
//启动充电失败
|
setStateAlarmAndDrop(work_thread->localData.SysWorkState,0,0);
|
qDebug()<<"启动充电失败";
|
}
|
return;
|
}
|
ChargeDelayTime--;
|
work_thread->localData.waitTimeCount = ChargeDelayTime;
|
}
|
}
|
|
void Working_Page::DischargeWaitF1()
|
{
|
if(work_thread->localData.RLY_OK & TKQ_VALUE)
|
{
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
popBox(tr("F1未闭合!"));
|
return;
|
}
|
else
|
{
|
memcpy(SingleVolBeforeTest,work_thread->fboData.SingleVol,sizeof(SingleVolBeforeTest));
|
emit sendStart(work_thread->CMD_StartDischarge,batteryName);
|
}
|
}
|
|
void Working_Page::ChargeWaitF1()
|
{
|
if(work_thread->localData.RLY_OK & TKQ_VALUE)
|
{
|
ui->comboBox_Type->setEnabled(true);
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
popBox(tr("F1未闭合!"));
|
return;
|
}
|
else
|
{
|
memcpy(SingleVolBeforeTest,work_thread->fboData.SingleVol,sizeof(SingleVolBeforeTest));
|
emit sendStart(chargeCmd,batteryName);
|
}
|
}
|
void Working_Page::TabcurrentChangeSlot(int index)
|
{
|
if(index == 3)
|
{
|
ReadDataSlot();
|
}
|
}
|
|
void Working_Page::toHide()
|
{
|
btn_update = 0;
|
work_thread->localData.Interface = FACE_HOME;
|
getDataTimer->stop();
|
this->hide();
|
}
|
|
void Working_Page::toShow(int type)
|
{
|
if_update = true;
|
btn_update = 0;
|
if_readData = false;
|
if_alarm = false;
|
if_exec = false;
|
IF_READCUR = 0;
|
initConnectBeep(false);
|
initPageShow();
|
ui->tabWidget->setCurrentIndex(0);
|
initConnectBeep(true);
|
setParamEnabled(true);
|
vector_groupvol.clear();
|
vector_cur.clear();
|
vector_cap.clear();
|
vector_mon.clear();
|
vector_second.clear();
|
GetDataSlot();
|
getDataTimer->start();
|
if(type == FACE_CHAR)
|
{
|
ui->comboBox_Type->setCurrentIndex(1);//充电
|
}
|
else
|
{
|
ui->comboBox_Type->setCurrentIndex(0);//放电
|
}
|
|
if(test_param_xml.mon_number==0){
|
if(ui->comboBox_ChartType->count()==4)
|
ui->comboBox_ChartType->removeItem(3);
|
}
|
else {
|
if(ui->comboBox_ChartType->count()==3){
|
QPixmap pixmap(1, 50);
|
pixmap.fill(Qt::transparent);
|
QIcon icon(pixmap);
|
ui->comboBox_ChartType->setIconSize(QSize(1, 50));
|
ui->comboBox_ChartType->addItem(icon,tr("单体电压"));
|
}
|
}
|
|
work_thread->localData.Interface=type;
|
ui->comboBox_ChartType->setCurrentIndex(0);//组端电压
|
ui->comboBox_GroupM->setCurrentIndex(0);
|
ui->comboBox_Type->setEnabled(true);
|
|
ui->label_Group->setText(tr("组:")+"-");
|
ui->label_MaxMon->setText(tr("最高:")+"-");
|
ui->label_MinMon->setText(tr("最低:")+"-");
|
ui->label_GroupChart->setText(tr("组:")+"-");
|
ui->label_MaxMonChart->setText(tr("最高:")+"-");
|
ui->label_MinMonChart->setText(tr("最低:")+"-");
|
this->show();
|
}
|
|
void Working_Page::initPageShow()
|
{
|
ClassXML::ReadNewestPNameXml(batteryName);
|
if(false == ClassXML::ReadTestParamXml(batteryName, test_param_xml))
|
{
|
batteryName = Default_Battery;
|
ClassXML::ModifyNewestPNameXml(batteryName);
|
ClassXML::ReadTestParamXml(batteryName, test_param_xml);
|
}
|
if(PageType == FBI48CT){
|
test_param_xml.test_mode = ONline_working;
|
if(!TYPE_FBI_10480 && !TYPE_FBI_4548 && !TYPE_FBI_20240)
|
test_param_xml.onlinevol_lowlimit = onlinevollow;
|
}
|
else if(PageType == IDCE48CT)
|
test_param_xml.test_mode = OFFline_working;
|
|
nominalCap = test_param_xml.nominal_cap;
|
|
work_thread->initWorkPageShow();
|
isCloseBeep = false;
|
chartMonID = 1;
|
allMonNum = test_param_xml.mon_number*test_param_xml.group_number;
|
GmonNum = test_param_xml.mon_number;
|
CBGroupIndex = 1;
|
mon_table.pageIndex = 1;
|
mon_table.monPageIndex = 1;
|
mon_table.monGroupIndex = 1;
|
//参数显示
|
initParam();
|
//实时曲线初始化
|
initTestChart();
|
// QVector<double> temp(24);
|
// bars4->setData(temp,temp);
|
ui->edit_mon_id->setText("1/"+QString::number(GmonNum));
|
vector_mon.resize(allMonNum);
|
ui->comboBox_GroupM->clear();
|
ui->comboBox_GroupM->setIconSize(QSize(1, 50));
|
QPixmap pixmap(1, 50);
|
pixmap.fill(Qt::transparent);
|
QIcon icon(pixmap);
|
if(test_param_xml.group_number != 1)
|
{
|
for(int i=0;i<test_param_xml.group_number;i++)
|
{
|
if(ui->comboBox_GroupM->findText(tr("组")+QString::number(i+1))==-1)
|
ui->comboBox_GroupM->addItem(icon,tr("组")+QString::number(i+1));
|
}
|
}
|
QTimer::singleShot(100,this,SLOT(SendParamSlot()));
|
}
|
|
void Working_Page::initConnectBeep(bool en)
|
{
|
if(en)
|
{
|
set_btn_beep(ui->tabWidget,SIGNAL(currentChanged(int)));
|
set_btn_beep(ui->comboBox_Type,SIGNAL(activated(int)));
|
set_btn_beep(ui->comboBox_ChartType,SIGNAL(activated(int)));
|
set_btn_beep(ui->comboBox_GroupM,SIGNAL(activated(int)));
|
connect(ui->comboBox_GroupM,SIGNAL(currentIndexChanged(int)),this,SLOT(GroupMComboBoxChangeSlot(int)));
|
}
|
else
|
{
|
set_btn_nobeep(ui->tabWidget,SIGNAL(currentChanged(int)));
|
set_btn_nobeep(ui->comboBox_Type,SIGNAL(activated(int)));
|
set_btn_nobeep(ui->comboBox_ChartType,SIGNAL(activated(int)));
|
set_btn_nobeep(ui->comboBox_GroupM,SIGNAL(activated(int)));
|
disconnect(ui->comboBox_GroupM,SIGNAL(currentIndexChanged(int)),this,SLOT(GroupMComboBoxChangeSlot(int)));
|
}
|
}
|
|
void Working_Page::operatorCMD_Work(int cmd)
|
{
|
if(work_thread->localData.Interface != FACE_DIS &&
|
work_thread->localData.Interface != FACE_CHAR)
|
return;
|
if(PARAM_PAGE_CMD_START_FAN == cmd)
|
{
|
if(AppStartAlarm())
|
return;
|
|
if_useDroplabel = true;
|
if(IGBT_VALUE)
|
ui->label_DropIndex->setText(tr("请确认风扇正常运转且FO闭合"));
|
else
|
ui->label_DropIndex->setText(tr("请确认风扇正常运转"));
|
|
emit sendStart(work_thread->CMD_StartFanWork,0);
|
if(work_thread->localData.Interface == FACE_DIS){
|
if(work_thread->ctrlJDQ()!=0)
|
return;
|
}
|
}
|
else if(PARAM_PAGE_CMD_PARAM == cmd)
|
{
|
ClassXML::ReadNewestPNameXml(batteryName);
|
if(false == ClassXML::ReadTestParamXml(batteryName, test_param_xml))
|
{
|
batteryName = Default_Battery;
|
ClassXML::ModifyNewestPNameXml(batteryName);
|
ClassXML::ReadTestParamXml(batteryName, test_param_xml);
|
}
|
nominalCap = test_param_xml.nominal_cap;
|
chartMonID = 1;
|
allMonNum = test_param_xml.mon_number*test_param_xml.group_number;
|
GmonNum = test_param_xml.mon_number;
|
CBGroupIndex = 1;
|
mon_table.pageIndex = 1;
|
mon_table.monPageIndex = 1;
|
mon_table.monGroupIndex = 1;
|
//参数显示
|
initParam();
|
ui->edit_mon_id->setText("1/"+QString::number(GmonNum));
|
vector_mon.resize(allMonNum);
|
//ui->comboBox_GroupM->clear();
|
ui->comboBox_GroupM->setIconSize(QSize(1, 50));
|
QPixmap pixmap(1, 50);
|
pixmap.fill(Qt::transparent);
|
QIcon icon(pixmap);
|
if(test_param_xml.mon_number==0){
|
if(ui->comboBox_ChartType->count()==4)
|
ui->comboBox_ChartType->removeItem(3);
|
}
|
else {
|
if(ui->comboBox_ChartType->count()==3){
|
ui->comboBox_ChartType->setIconSize(QSize(1, 50));
|
ui->comboBox_ChartType->addItem(icon,tr("单体电压"));
|
}
|
}
|
|
if(test_param_xml.group_number != 1)
|
{
|
if(!ui->comboBox_GroupM->isVisible()&&ui->comboBox_ChartType->currentIndex()==3 )
|
ui->comboBox_GroupM->setVisible(true);
|
if(ui->comboBox_GroupM->count()<test_param_xml.group_number)
|
{
|
for(int i=ui->comboBox_GroupM->count();i<test_param_xml.group_number;i++)
|
{
|
ui->comboBox_GroupM->addItem(icon,tr("组")+QString::number(i+1));
|
}
|
}
|
else
|
{
|
for(int i=ui->comboBox_GroupM->count();i>=test_param_xml.group_number;i--)
|
{
|
ui->comboBox_GroupM->removeItem(i);
|
}
|
}
|
}
|
else
|
{
|
if(ui->comboBox_GroupM->isVisible())
|
ui->comboBox_GroupM->setVisible(false);
|
}
|
QTimer::singleShot(100,this,SLOT(SendParamSlot()));
|
}
|
else if(PARAM_PAGE_CMD_START_PSW == cmd )//闭合F1
|
{
|
if(AppStartAlarm())
|
return;
|
if_useDroplabel=true;
|
if((work_thread->localData.RLY_OK & IGBT_VALUE)&& (work_thread->fboData.SumVoltage>F0VOL))//ROK1为1 FO未闭合
|
{
|
ui->label_DropIndex->setText(tr("F0未闭合!"));
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
return;
|
}
|
// if(TKQ_VALUE)
|
// ui->label_DropIndex->setText(tr("请确认风扇正常运转且FO闭合"));
|
// else
|
// ui->label_DropIndex->setText(tr("请确认风扇正常运转"));
|
ui->label_DropIndex->setText(tr("请合上F1!"));
|
emit sendStart(work_thread->CMD_PowerSwithOn,0);
|
}
|
else if(cmd == PARAM_PAGE_CMD_START_DIS || cmd == PARAM_PAGE_CMD_START_CHR )
|
{
|
toStart(Type_WIFI);
|
}
|
else if(cmd == PARAM_PAGE_CMD_PAUSE)
|
{
|
switch(work_thread->localData.SysWorkState)
|
{
|
case Discharging:
|
emit sendStart(work_thread->CMD_PauseDischarge,batteryName+"/");
|
break;
|
case Charging:
|
emit sendStart(work_thread->CMD_PauseCharge,batteryName+"/");
|
break;
|
}
|
}
|
else if(cmd == PARAM_PAGE_CMD_STOP)
|
{
|
toStop(Type_WIFI);
|
}
|
}
|
|
void Working_Page::toStart(int Type)
|
{
|
if_update = true;
|
if_useDroplabel=false;
|
QString msg="";
|
if(work_thread->Check_Mashine_Type){
|
msg = tr("设备类型设置错误,请重新配置!");
|
popBox(msg);
|
return;
|
}
|
if(work_thread->localData.SoftVersion == 0){
|
msg = tr("线缆连接异常或者内部通信异常!");
|
popBox(msg);
|
return;
|
}
|
if((!work_thread->IF_J9Close)&&JT_VALUE)
|
{
|
if(Type == Type_WIFI)
|
{
|
msg = tr("设备处于紧急停止状态!");
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(msg);
|
}
|
else
|
{
|
msg = tr("设备处于紧急停止状态,请检查并断电重启!");
|
popBox(msg);
|
}
|
return;
|
}
|
if(work_thread->localData.GroupVol>VolTooHigh ||
|
work_thread->localData.OnlineVol>VolTooHigh)
|
{
|
msg = tr("电压过高!");
|
}
|
if(msg!="")
|
{
|
if(Type == Type_Btn)
|
{
|
popBox(msg);
|
return;
|
}
|
else
|
{
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(msg);
|
return;
|
}
|
}
|
if(Type == Type_Btn)
|
{
|
chargeCmd = work_thread->CMD_ChargeNull;
|
if(ui->comboBox_Type->currentIndex() == 0)
|
{
|
int vol_dif = qAbs(work_thread->localData.GroupVol - work_thread->localData.OnlineVol);
|
if(work_thread->localData.GroupVol<VolTooLow)
|
{
|
popBox(tr("电压过低"));
|
return;
|
}
|
else if(test_param_xml.group_lower>=work_thread->fboData.SumVoltage)
|
{
|
popBox(tr("组端下限参数异常"));
|
return;
|
}
|
else if(test_param_xml.lower_number<=work_thread->localData.monomerLowCount && test_param_xml.mon_number!=0)
|
{
|
popBox(tr("单体下限参数异常"));
|
return;
|
}
|
else if(test_param_xml.preset_time<=0)
|
{
|
popBox(tr("预放时间参数异常"));
|
return;
|
}
|
else if(test_param_xml.preset_cap<=0)
|
{
|
popBox(tr("预放容量参数异常"));
|
return;
|
}
|
//在线阀值大于在线电压-2V视为报警
|
else if((test_param_xml.onlinevol_lowlimit>work_thread->fboData.OnlineVol-20)&&
|
(TYPE_FBI_10480||TYPE_FBI_20240))
|
{
|
popBox(tr("在线阈值参数异常"));
|
return;
|
}
|
else if( vol_dif > 50 && TYPE_IDCE_940)
|
{
|
popBox(tr("内部电压检测异常"));
|
return;
|
}
|
else if(test_param_xml.onlinevol_lowlimit>=work_thread->fboData.OnlineVol &&
|
test_param_xml.test_mode == ONline_working &&
|
(PageType == FBO48CT || TYPE_FBI_10480 || TYPE_FBI_4548 || TYPE_FBI_20240))
|
{
|
popBox(tr("在线电压低"));
|
return;
|
}
|
else if(test_param_xml.booster_ceiling<=work_thread->localData.OnlineVol &&
|
PageType == FBI48CT)
|
{
|
popBox(tr("升压上限参数异常"));
|
return;
|
}
|
else if(test_param_xml.preset_power<minPower/100 && test_param_xml.discharge_mode != DISCHARGE_CURRENT){
|
popBox(tr("功率设置过低(")+QString::number((double)minPower/1000,'f',1)+" KW)");
|
return;
|
}
|
if((work_thread->localData.RLY_OK & IGBT_VALUE))//ROK1为1 FO未闭合
|
{
|
if(work_thread->fboData.SumVoltage>F0VOL)
|
{
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请合上F0!"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes)
|
return;
|
else
|
{
|
if((work_thread->localData.RLY_OK & IGBT_VALUE)&& (work_thread->fboData.SumVoltage>F0VOL))
|
{
|
popBox(tr("F0未闭合!"));
|
return;
|
}
|
}
|
}
|
else
|
{
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请确认F0已闭合!"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes)
|
return;
|
}
|
}
|
emit sendStart(work_thread->CMD_StartFanWork,0);//开风扇有置位所有继电器
|
if(work_thread->ctrlJDQ()!=0)
|
return;
|
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请确认风扇是否正常运转?"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes){
|
emit sendStart(work_thread->CMD_StopFanWork,0);
|
return;
|
}
|
}
|
else if(ui->comboBox_Type->currentIndex() == 1
|
&& test_param_xml.test_mode == ONline_working)
|
{
|
chargeCmd = work_thread->CMD_StartCharge;
|
if(work_thread->localData.GroupVol<VolTooLow)
|
{ //组端和在线都低于10V,则充电监测
|
if(work_thread->localData.GroupVol<Vol_NullCharg &&
|
work_thread->localData.OnlineVol<Vol_NullCharg){
|
chargeCmd = work_thread->CMD_ChargeNull;
|
}
|
else {
|
popBox(tr("电压过低!"));
|
return;
|
}
|
}
|
else if(test_param_xml.group_lower>=work_thread->fboData.SumVoltage)
|
{
|
//组端和在线都低于10V,则充电监测
|
if(work_thread->localData.GroupVol<Vol_NullCharg &&
|
work_thread->localData.OnlineVol<Vol_NullCharg){
|
chargeCmd = work_thread->CMD_ChargeNull;
|
}
|
else {
|
popBox(tr("组端下限参数异常"));
|
return;
|
}
|
}
|
if(chargeCmd == work_thread->CMD_StartCharge){//充电监测不判断F0
|
if(work_thread->localData.RLY_OK & IGBT_VALUE)
|
{
|
if(work_thread->fboData.SumVoltage>F0VOL)
|
{
|
MessageBox box( this, QMessageBox::Question, tr("系统信息"), tr("请合上F0!"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes)
|
return;
|
else
|
{
|
if((work_thread->localData.RLY_OK & IGBT_VALUE)&& (work_thread->fboData.SumVoltage>F0VOL))
|
{
|
popBox(tr("F0未闭合!"));
|
return;
|
}
|
}
|
}
|
else
|
{
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请确认F0已闭合!"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes)
|
return;
|
}
|
}
|
//充电监测不开风扇!!!
|
emit sendStart(work_thread->CMD_StartFanWork,0);
|
if(!work_thread->CheckFain()){
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请确认风扇是否正常运转?"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes){
|
emit sendStart(work_thread->CMD_StopFanWork,0);
|
return;
|
}
|
}
|
}
|
}
|
emit sendParam(test_param_xml);
|
IF_READCUR = 1;
|
switch(work_thread->localData.SysWorkState)
|
{
|
case WorkStopped:
|
{
|
//保存放电前的单体电压
|
switch(ui->comboBox_Type->currentIndex())
|
{
|
case 0:
|
{
|
if(TKQ_VALUE)
|
{
|
emit sendStart(work_thread->CMD_PowerSwithOn,0);
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请合上F1!"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes){
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
return;
|
}
|
btn_update = 10;
|
ui->pushButton_Exit->setEnabled(false);
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_Stop->setEnabled(false);
|
ui->edit_Setmode->setEnabled(false);ui->edit_Setmode->setStyleSheet("color:gray");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(false);ui->edit_workmode->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(false);ui->edit_acstop->setStyleSheet("color:gray");
|
#endif
|
QTimer::singleShot(1000,this,SLOT(DischargeWaitF1()));
|
}
|
else
|
{
|
btn_update = 10;
|
ui->pushButton_Exit->setEnabled(false);
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_Stop->setEnabled(false);
|
memcpy(SingleVolBeforeTest,work_thread->fboData.SingleVol,sizeof(SingleVolBeforeTest));
|
emit sendStart(work_thread->CMD_StartDischarge,batteryName);
|
}
|
}
|
break;
|
case 1:
|
{
|
if(chargeCmd == work_thread->CMD_StartCharge)
|
{
|
if(TKQ_VALUE)
|
{
|
emit sendStart(work_thread->CMD_PowerSwithOn,0);
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请合上F1!"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes){
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
return;
|
}
|
}
|
QTimer::singleShot(1000,this,SLOT(ChargeWaitF1()));
|
}
|
else
|
{
|
memcpy(SingleVolBeforeTest,work_thread->fboData.SingleVol,sizeof(SingleVolBeforeTest));
|
emit sendStart(chargeCmd,batteryName+"/");//充电监测
|
}
|
}
|
break;
|
}
|
if_readData=true;readDataTimer=1;
|
ui->edit_Setmode->setEnabled(false);ui->edit_Setmode->setStyleSheet("color:gray");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(false);ui->edit_workmode->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(false);ui->edit_acstop->setStyleSheet("color:gray");
|
#endif
|
ui->comboBox_Type->setEnabled(false);
|
|
|
break;
|
}
|
case Paused_Dischg:
|
case Paused_charge:
|
case Charging://限流转直充
|
{
|
if(work_thread->GetSysState().TestType == TestTypeDischarge)
|
{
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_Stop->setEnabled(false);
|
btn_update = 10;
|
emit sendStart(work_thread->CMD_StartDischarge,batteryName+"/");
|
}
|
else
|
{
|
if(test_param_xml.test_mode == ONline_working)
|
emit sendStart(chargeCmd,batteryName+"/");
|
else
|
emit sendStart(chargeCmd,batteryName+"/");//充电监测
|
}
|
break;
|
}
|
}
|
}
|
else
|
{
|
chargeCmd = work_thread->CMD_StartCharge;
|
if(ui->comboBox_Type->currentIndex()==0){ //放电
|
if(work_thread->localData.GroupVol<VolTooLow)
|
{
|
if(CONTROL_TKQ)
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("电压过低!"));
|
return;
|
}
|
else if(test_param_xml.group_lower>=work_thread->fboData.SumVoltage)
|
{
|
if(CONTROL_TKQ)
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("组端下限参数异常"));
|
return;
|
}
|
else if(test_param_xml.lower_number<=work_thread->localData.monomerLowCount && test_param_xml.mon_number!=0)
|
{
|
if(CONTROL_TKQ)
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("单体下限参数异常"));
|
return;
|
}
|
else if(test_param_xml.preset_time<=0)
|
{
|
if(CONTROL_TKQ)
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("预放时间参数异常"));
|
return;
|
}
|
else if(test_param_xml.preset_cap<=0)
|
{
|
if(CONTROL_TKQ)
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("预放容量参数异常"));
|
return;
|
}
|
else if((test_param_xml.onlinevol_lowlimit<work_thread->fboData.SumVoltage+2)&&
|
(TYPE_FBI_10480||TYPE_FBI_20240))
|
{
|
if(CONTROL_TKQ)
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("在线阈值参数异常"));
|
return;
|
}
|
else if(test_param_xml.preset_power<minPower/100 && test_param_xml.discharge_mode != DISCHARGE_CURRENT){
|
if(CONTROL_TKQ)
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("功率设置过低"));
|
return;
|
}
|
}
|
else { //充电/充电监测
|
if(work_thread->localData.GroupVol<VolTooLow)
|
{ //组端和在线都低于10V,则充电监测
|
if(work_thread->localData.GroupVol<Vol_NullCharg &&
|
work_thread->localData.OnlineVol<Vol_NullCharg){
|
chargeCmd = work_thread->CMD_ChargeNull;
|
}
|
else {
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("电压过低!"));
|
return;
|
}
|
}
|
else if(test_param_xml.group_lower>=work_thread->fboData.SumVoltage)
|
{
|
//组端和在线都低于10V,则充电监测
|
if(work_thread->localData.GroupVol<Vol_NullCharg &&
|
work_thread->localData.OnlineVol<Vol_NullCharg){
|
chargeCmd = work_thread->CMD_ChargeNull;
|
}
|
else {
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("组端下限参数异常"));
|
return;
|
}
|
}
|
}
|
if(chargeCmd != work_thread->CMD_ChargeNull){
|
if((work_thread->localData.RLY_OK & IGBT_VALUE)&& (work_thread->fboData.SumVoltage>F0VOL))
|
{
|
if(CONTROL_TKQ)
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("F0未闭合!"));
|
return;
|
}
|
if(work_thread->localData.RLY_OK & TKQ_VALUE)
|
{
|
if(CONTROL_TKQ)
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(tr("F1未闭合!"));
|
return;
|
}
|
}
|
emit sendParam(test_param_xml);
|
IF_READCUR = 1;
|
switch(work_thread->localData.SysWorkState)
|
{
|
case WorkStopped:
|
{
|
//保存放电前的单体电压
|
memcpy(SingleVolBeforeTest,work_thread->fboData.SingleVol,sizeof(SingleVolBeforeTest));
|
if_useDroplabel=false;
|
if(ui->comboBox_Type->currentIndex()==0)
|
{
|
emit sendStart(work_thread->CMD_StartDischarge,batteryName+"/");
|
}
|
else
|
{
|
emit sendStart(chargeCmd,batteryName+"/");
|
}
|
if_readData=true;readDataTimer=1;
|
break;
|
}
|
case Paused_Dischg:
|
case Paused_charge:
|
{
|
if(work_thread->GetSysState().TestType == TestTypeDischarge)
|
emit sendStart(work_thread->CMD_StartDischarge,batteryName+"/");
|
else
|
{
|
emit sendStart(chargeCmd,batteryName+"/");
|
}
|
break;
|
}
|
ui->edit_Setmode->setEnabled(false);
|
ui->edit_Setmode->setStyleSheet("color:gray");
|
}
|
}
|
}
|
//直充充电 没有判断F0和F1
|
void Working_Page::toStartZCH(int Type)
|
{
|
if_useDroplabel=false;
|
QString msg="";
|
|
if((!work_thread->IF_J9Close)&&JT_VALUE)
|
{
|
if(Type == Type_WIFI)
|
{
|
msg = tr("设备处于紧急停止状态!");
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(msg);
|
}
|
else
|
{
|
msg = tr("设备处于紧急停止状态,请检查并断电重启!");
|
popBox(msg);
|
}
|
return;
|
}
|
if(work_thread->localData.GroupVol>VolTooHigh||
|
work_thread->localData.OnlineVol>VolTooHigh)
|
{
|
msg = tr("电压过高!");
|
}
|
else if(test_param_xml.onlinevol_lowlimit>=work_thread->fboData.OnlineVol &&
|
test_param_xml.test_mode == ONline_working &&
|
(PageType == FBO48CT || TYPE_FBI_10480 || TYPE_FBI_4548 || TYPE_FBI_20240))
|
{
|
msg = tr("在线电压低");
|
}
|
if(msg!="")
|
{
|
if(Type == Type_Btn)
|
{
|
popBox(msg);
|
return;
|
}
|
else
|
{
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(msg);
|
return;
|
}
|
}
|
|
if(test_param_xml.test_mode == ONline_working)
|
{
|
chargeCmd = work_thread->CMD_StartZCharge;
|
if(work_thread->localData.GroupVol<VolTooLow)
|
{ //组端和在线都低于10V,则充电监测
|
if(work_thread->localData.GroupVol<Vol_NullCharg ||
|
work_thread->localData.OnlineVol<Vol_NullCharg){
|
chargeCmd = work_thread->CMD_ChargeNull;
|
}
|
else {
|
popBox(tr("电压过低!"));
|
return;
|
}
|
}
|
else if(test_param_xml.group_lower>=work_thread->fboData.SumVoltage)
|
{
|
//组端和在线都低于10V,则充电监测
|
if(work_thread->localData.GroupVol<Vol_NullCharg ||
|
work_thread->localData.OnlineVol<Vol_NullCharg){
|
chargeCmd = work_thread->CMD_ChargeNull;
|
}
|
else {
|
popBox(tr("组端下限参数异常"));
|
return;
|
}
|
}
|
if(qAbs(work_thread->localData.OnlineVol-work_thread->localData.GroupVol)>15*test_param_xml.mon_vol/20){
|
MessageBox box( this, QMessageBox::Question, tr("系统信息"), tr("压差过大,是否继续启动?"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes)
|
return;
|
}
|
if(!work_thread->CheckFain()){
|
emit sendStart(work_thread->CMD_StartFanWork,0);
|
MessageBox box( this, QMessageBox::Question, tr("系统信息"), tr("请确认风扇是否正常运转?"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes){
|
emit sendStart(work_thread->CMD_StopFanWork,0);
|
return;
|
}
|
}
|
}
|
emit sendParam(test_param_xml);
|
if_readData=true;readDataTimer=1;
|
switch(work_thread->localData.SysWorkState)
|
{
|
case WorkStopped:
|
{
|
//保存放电前的单体电压
|
memcpy(SingleVolBeforeTest,work_thread->fboData.SingleVol,sizeof(SingleVolBeforeTest));
|
emit sendStart(chargeCmd,batteryName+"/");//充电监测
|
|
ui->comboBox_Type->setEnabled(false);
|
ui->edit_Setmode->setEnabled(false);ui->edit_Setmode->setStyleSheet("color:gray");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(false);ui->edit_workmode->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(false);ui->edit_acstop->setStyleSheet("color:gray");
|
#endif
|
break;
|
}
|
case Paused_charge:
|
case Charging:
|
{
|
if(test_param_xml.test_mode == ONline_working)
|
emit sendStart(work_thread->CMD_StartZCharge,batteryName+"/");
|
else
|
emit sendStart(work_thread->CMD_ChargeNull,batteryName+"/");//充电监测
|
break;
|
}
|
}
|
}
|
|
void Working_Page::toStop(int Type)
|
{
|
if(Type == Type_Btn)
|
{
|
ui->pushButton_Start->setEnabled(false);
|
ui->pushButton_Stop->setEnabled(false);
|
btn_update = 10;
|
switch(work_thread->localData.SysWorkState)
|
{
|
case Discharging:
|
emit sendStart(work_thread->CMD_PauseDischarge,batteryName+"/");
|
break;
|
case Paused_Dischg:
|
case Paused_charge:
|
{
|
ui->comboBox_Type->setEnabled(true);
|
if_readData=false;
|
if(work_thread->GetSysState().TestType == TestTypeDischarge)
|
{
|
ui->edit_Setmode->setEnabled(true);ui->edit_Setmode->setStyleSheet("color:black");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(true);ui->edit_workmode->setStyleSheet("color:black");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(true);ui->edit_acstop->setStyleSheet("color:black");
|
#endif
|
emit sendStart(work_thread->CMD_StopDischarge,batteryName+"/");
|
}
|
else
|
emit sendStart(work_thread->CMD_StopCharge,batteryName+"/");
|
break;
|
}
|
case Charging:
|
emit sendStart(work_thread->CMD_PauseCharge,batteryName+"/");
|
break;
|
}
|
}
|
else
|
{
|
if_readData=false;
|
if(work_thread->GetSysState().TestType == TestTypeDischarge)
|
emit sendStart(work_thread->CMD_StopDischarge,batteryName+"/");
|
else
|
emit sendStart(work_thread->CMD_StopCharge,batteryName+"/");
|
}
|
}
|
|
bool Working_Page::AppStartAlarm()
|
{
|
bool res = false;
|
if_useDroplabel=false;
|
QString msg="";
|
|
if(work_thread->localData.GroupVol<VolTooLow)
|
{
|
msg = tr("电压过低!");
|
}
|
else if(work_thread->localData.GroupVol>VolTooHigh )
|
{
|
msg = tr("电压过高!");
|
}
|
if(msg!="")
|
{
|
if_useDroplabel=true;
|
ui->label_DropIndex->setText(msg);
|
res = true;
|
}
|
return res;
|
}
|
|
void Working_Page::ContinueTest(CHECK_DATA check_data_c, FBO_DATA fbodata_c){
|
//放电 充电 充电监测 放电暂停 充电暂停 等待充电
|
// qDebug()<<"ContinueTest:check_data_c.workstate"<<check_data_c.workstate;
|
if(check_data_c.workstate == Discharging || check_data_c.workstate == Paused_Dischg ||
|
(check_data_c.workstate == Paused_charge && PageType!=IDCE48CT && check_data_c.alarmstate != CPPauseNullCharging) ||
|
check_data_c.workstate == WaitForCharging ||
|
((check_data_c.workstate == Charging) && check_data_c.alarmstate != CPNullCharging)){
|
// qDebug()<<"进入判断";
|
if(work_thread->localData.Interface != FACE_DIS &&
|
work_thread->localData.Interface != FACE_CHAR){
|
check_data_c.workstate = WorkStopped;
|
Check_Obj::MTest_Data(check_data_c,false);
|
work_thread->WriteEndFile(check_data_c.testfilename,fbodata_c);
|
return;
|
}
|
if(work_thread->localData.GroupVol>VolTooHigh ||
|
work_thread->localData.OnlineVol>VolTooHigh){
|
check_data_c.workstate = WorkStopped;
|
Check_Obj::MTest_Data(check_data_c,false);
|
work_thread->WriteEndFile(check_data_c.testfilename,fbodata_c);
|
popBox(tr("电压过高!"));
|
return;
|
}
|
if(work_thread->localData.GroupVol<VolTooLow)
|
{
|
check_data_c.workstate = WorkStopped;
|
Check_Obj::MTest_Data(check_data_c,false);
|
work_thread->WriteEndFile(check_data_c.testfilename,fbodata_c);
|
popBox(tr("电压过低"));
|
return;
|
}
|
|
if((work_thread->localData.RLY_OK & IGBT_VALUE)&& (work_thread->fboData.SumVoltage>F0VOL))//ROK1为1 FO未闭合
|
{
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请合上F0!"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes){
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
check_data_c.workstate = WorkStopped;
|
Check_Obj::MTest_Data(check_data_c,false);
|
work_thread->WriteEndFile(check_data_c.testfilename,fbodata_c);
|
return;
|
}
|
else
|
{
|
if((work_thread->localData.RLY_OK & IGBT_VALUE)&& (work_thread->fboData.SumVoltage>F0VOL))
|
{
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
check_data_c.workstate = WorkStopped;
|
Check_Obj::MTest_Data(check_data_c,false);
|
work_thread->WriteEndFile(check_data_c.testfilename,fbodata_c);
|
popBox(tr("F0未闭合!"));
|
return;
|
}
|
}
|
}
|
//F1判断,先闭合脱扣器 再判断是否闭合进入提示
|
emit sendStart(work_thread->CMD_PowerSwithOn,0);
|
// qDebug()<<"ContinueTest:RLY_OK:"<<work_thread->localData.RLY_OK;
|
if(work_thread->localData.RLY_OK & TKQ_VALUE)
|
{
|
// qDebug()<<"ContinueTest:F1-in-RLY_OK:"<<work_thread->localData.RLY_OK;
|
MessageBox box( this, QMessageBox::Question,MB_Caption, tr("请合上F1!"),
|
QMessageBox::Yes|QMessageBox::No,
|
QMessageBox::Yes,
|
work_thread );
|
if(box.exec()!=QMessageBox::Yes){
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
check_data_c.workstate = WorkStopped;
|
Check_Obj::MTest_Data(check_data_c,false);
|
work_thread->WriteEndFile(check_data_c.testfilename,fbodata_c);
|
return;
|
}
|
}
|
}
|
QTimer::singleShot(500,this,SLOT(delay_ContinueTest_Start()));
|
}
|
|
void Working_Page::delay_ContinueTest_Start(){
|
CHECK_DATA check_data_c;
|
FBO_DATA fbodata_c;
|
bool res = false;
|
res = Check_Obj::RTest_Data(check_data_c);
|
if(res){
|
res = false;
|
res = Check_Obj::Read_Fbo_Data(check_data_c.testfilename,fbodata_c);
|
}
|
if(res == false){
|
check_data_c.workstate = WorkStopped;
|
Check_Obj::MTest_Data(check_data_c,false);
|
work_thread->setPowerCtrl(POWER_CTRL_INIT);
|
work_thread->set_ifinit(true);
|
return;
|
}
|
if((work_thread->localData.RLY_OK & TKQ_VALUE) &&
|
(check_data_c.workstate == Discharging || (check_data_c.workstate == Charging && check_data_c.alarmstate != CPNullCharging)))
|
{
|
check_data_c.workstate = WorkStopped;
|
Check_Obj::MTest_Data(check_data_c,false);
|
work_thread->WriteEndFile(check_data_c.testfilename,fbodata_c);
|
emit sendStart(work_thread->CMD_PowerSwithOff,0);
|
popBox(tr("F1未闭合!"));
|
return;
|
}
|
else
|
{
|
if_readData=true;readDataTimer=1;IF_READCUR=1;
|
ui->edit_Setmode->setEnabled(false);ui->edit_Setmode->setStyleSheet("color:gray");
|
#if PageType == FBO48CT
|
ui->edit_workmode->setEnabled(false);ui->edit_workmode->setStyleSheet("color:gray");
|
#endif
|
#if PageType == FBO48CT || PageType == FBI48CT
|
ui->edit_acstop->setEnabled(false);ui->edit_acstop->setStyleSheet("color:gray");
|
#endif
|
ui->comboBox_Type->setEnabled(false);
|
memcpy(SingleVolBeforeTest,fbodata_c.SingleVol,sizeof(SingleVolBeforeTest));
|
emit sendParam(test_param_xml);//设置参数
|
if(check_data_c.workstate != WorkStopped){
|
work_thread->continuetest(check_data_c,fbodata_c);
|
if(check_data_c.workstate == WaitForCharging){
|
// qDebug()<<"delay_ContinueTest_Start等待充电";
|
work_thread->localData.waitTimeCount = ChargeDelayTime = CHARGE_DELAY_TIME;
|
isCloseBeep = true;
|
if_alarm=true;
|
}
|
}
|
}
|
}
|