优化高速电流未接传感器时数值显示异常问题
This commit is contained in:
parent
d3f7ad5615
commit
113acbdb29
@ -72,7 +72,11 @@ void CCharacteristicList::DisPlayCharacteristic()
|
||||
model->setData(model->index(j,0,QModelIndex()),g_Charateristic[j].ChannelName);
|
||||
model->setData(model->index(j,1,QModelIndex()),g_Charateristic[j].SensorEngineeringUnit);
|
||||
if(g_ChannelBaseInfo[i].defaultDisplay == "峰峰值"){
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].DiagnosisPk2Pk,'f',g_Charateristic[j].ChUnitDot));
|
||||
if(g_ChannelBaseInfo[i].channelType == "PULSE_CURRENT" && g_Charateristic[j].DiagnosisPk2Pk < 0.9 && g_Charateristic[j].DiagnosisPk2Pk > 0.4){
|
||||
model->setData(model->index(j,2,QModelIndex()),"0.0");
|
||||
}else{
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].DiagnosisPk2Pk,'f',g_Charateristic[j].ChUnitDot));
|
||||
}
|
||||
}else if(g_ChannelBaseInfo[i].defaultDisplay == "有效值"){
|
||||
model->setData(model->index(j,2,QModelIndex()),QString::number(g_Charateristic[j].RMSValues,'f',g_Charateristic[j].ChUnitDot));
|
||||
}else if(g_ChannelBaseInfo[i].defaultDisplay == "峰值"){
|
||||
|
||||
@ -562,3 +562,70 @@ void CRealTimeAlarm::ItemCheckStateSlot(QString strID, bool bChecked)
|
||||
{
|
||||
DateViewdialog->ViewData(strID,mapWaveData[strID]);
|
||||
}
|
||||
|
||||
void CRealTimeAlarm::on_pushButton_refresh_clicked()
|
||||
{
|
||||
model->setRowCount(0);
|
||||
qDebug() << "initTable2" << endl;
|
||||
QString strTableName = "t_AlarmStatusInfo",strSql;
|
||||
strSql = QString(" timestamp <> '' order by timestamp DESC limit 0,100");
|
||||
m_vecTriggerAlarmStatusInfo = g_SqliteDB->GetTriggerAlarmStatusInfo(strTableName,strSql);
|
||||
|
||||
if(m_vecTriggerAlarmStatusInfo.size() > 0){
|
||||
for (int i = 0; i < m_vecTriggerAlarmStatusInfo.size(); i++) {
|
||||
QVariantList strRowItem ;
|
||||
QDateTime dateTime = QDateTime::fromSecsSinceEpoch(m_vecTriggerAlarmStatusInfo[i].timestamp);
|
||||
QTimeZone timeZone("Asia/Shanghai");
|
||||
dateTime = dateTime.toTimeZone(timeZone);
|
||||
QString TStr = dateTime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
QString triggerLevel = "",triggerEventName = "";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerLevel == "1"){
|
||||
triggerLevel = "警报";
|
||||
}else if(m_vecTriggerAlarmStatusInfo[i].triggerLevel == "2"){
|
||||
triggerLevel = "危险";
|
||||
}
|
||||
QString strFeatureName = "";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MinValues"))
|
||||
strFeatureName = "最小值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MaxValues"))
|
||||
strFeatureName = "最大值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DCValues"))
|
||||
strFeatureName = "偏置电压/Gap";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("RMSValues"))
|
||||
strFeatureName = "有效值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DiagnosisPk2Pk"))
|
||||
strFeatureName = "诊断峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratRMS"))
|
||||
strFeatureName = "有效值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratPk2Pk"))
|
||||
strFeatureName = "积分峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("SpeedProfileSpeed"))
|
||||
strFeatureName = "转速";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("IntegratPk2Pk/2"))
|
||||
strFeatureName = "峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("DiagnosisPeak"))
|
||||
strFeatureName = "峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("MonitorPk2Pk"))
|
||||
strFeatureName = "监测保护峰峰值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("InvertDanger") )
|
||||
strFeatureName = "反时限危险值";
|
||||
else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("InvertAlarm"))
|
||||
strFeatureName = "反时限警报值";
|
||||
if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("Over")){
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + strFeatureName+ "-" + "高于" + triggerLevel + "值";
|
||||
}else if(m_vecTriggerAlarmStatusInfo[i].triggerEventName.contains("Under")){
|
||||
triggerEventName = m_vecTriggerAlarmStatusInfo[i].channelName + "-" + strFeatureName+ "-" + "低于" + triggerLevel + "值";
|
||||
}
|
||||
strRowItem << i + 1 << triggerLevel << triggerEventName << TStr;
|
||||
|
||||
createRowItem(i,strRowItem);
|
||||
}
|
||||
QMyTableViewBtnDelegate *m_btnDelegate = new QMyTableViewBtnDelegate(QStringList()<<"详情", this);
|
||||
ui->tableView->setItemDelegateForColumn(4, m_btnDelegate);
|
||||
connect(m_btnDelegate, SIGNAL(editData(const QModelIndex &)), this,SLOT(Details(const QModelIndex &)));
|
||||
|
||||
}else{
|
||||
QMessageBox::information(this, "提示", QString("未查询到数据!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,8 @@ public:
|
||||
private slots:
|
||||
void Details(const QModelIndex &index);
|
||||
void ItemCheckStateSlot(QString strID, bool bChecked);
|
||||
void on_pushButton_refresh_clicked();
|
||||
|
||||
public slots:
|
||||
void downloadProcess_Slot(qint64 byteSend, qint64 byteTotal);
|
||||
void DownloadStatus_Slot();
|
||||
|
||||
@ -18,7 +18,55 @@
|
||||
color: rgb(27, 30, 35);
|
||||
</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>488</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_refresh">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#pushButton_refresh { border-image: url(:/image/Btn/normal_Btn.png);
|
||||
color:#1f5188 }
|
||||
#pushButton_refresh:hover { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_refresh:pressed { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}
|
||||
#pushButton_refresh:checked { border-image: url(:/image/Btn/normal_Btn_p.png);
|
||||
color:#ffffff}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>刷新</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_alarm" native="true">
|
||||
<property name="styleSheet">
|
||||
|
||||
165
WaveDisplay.cpp
165
WaveDisplay.cpp
@ -24,44 +24,8 @@ CWaveDisPlay::CWaveDisPlay(QWidget *parent) :
|
||||
m_title = new QCPTextElement(ui->widget_wave, strTitle);
|
||||
ui->widget_wave->plotLayout()->addElement(0, 0, m_title);
|
||||
|
||||
// QAbstractItemView* view = ui->comboBox_channel_2->view();
|
||||
// QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect;
|
||||
// effect->setBlurRadius(6);
|
||||
// effect->setColor(Qt::black);
|
||||
// effect->setOffset(0, 0);
|
||||
// view->setGraphicsEffect(effect);
|
||||
// view->update();
|
||||
|
||||
// static_cast<QWidget*>(view->parent())
|
||||
// ->setStyleSheet(
|
||||
// "QWidget{border:none;background-color: rgb(255, 255, 255);}");
|
||||
|
||||
// QWidget* container = static_cast<QWidget*>(view->parent());
|
||||
// container->setAttribute(Qt::WA_TranslucentBackground);
|
||||
// container->setWindowFlag(Qt::FramelessWindowHint);
|
||||
// container->setWindowFlag(Qt::NoDropShadowWindowHint);
|
||||
|
||||
InitWindows();
|
||||
|
||||
// ui->widget_wave->xAxis->setRange(0, 1);
|
||||
// ui->widget_wave->xAxis->setLabel("Fs(Hz)");
|
||||
// ui->widget_wave->yAxis->setLabel(m_ChannelUnit);
|
||||
// QVector<double> ticks;
|
||||
// QVector<QString> labels;
|
||||
// ticks << 1 << 2 << 3 << 4 << 5 << 6 << 7;
|
||||
// labels << "USA" << "Japan" << "Germany" << "France" << "UK" << "Italy" << "Canada";
|
||||
// QVector<double> fossilData;
|
||||
// fossilData << 0.86*10.5 << 0.83*5.5 << 0.84*5.5 << 0.52*5.8 << 0.89*5.2 << 0.90*4.2 << 0.67*11.2;
|
||||
// QCPBars *bars = new QCPBars(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
// bars->setPen(QPen(QColor(31, 81, 136).lighter(130))); // 设置柱状图的边框颜色
|
||||
// bars->setBrush(QColor(31, 81, 136)); // 设置柱状图的画刷颜色
|
||||
// bars->setAntialiased(false);
|
||||
// bars->setWidth(0.02);
|
||||
// bars->setData(ticks, fossilData);
|
||||
// ui->widget_wave->xAxis->setRange(0, fossilData.size());
|
||||
// on_Btn_Scales_clicked();
|
||||
// ui->widget_wave->replot();
|
||||
|
||||
}
|
||||
|
||||
CWaveDisPlay::~CWaveDisPlay()
|
||||
@ -189,77 +153,55 @@ void CWaveDisPlay::ParseDataTimeWave(QJsonObject & objContent)
|
||||
|
||||
if(package + 1 == packageMax){
|
||||
|
||||
// if(!OneSecond){
|
||||
// m_Count ++;
|
||||
// m_WaveData = m_WaveData + data ;
|
||||
// qDebug() << "4S" <<"package" <<package << "packageMax" <<packageMax << endl;
|
||||
// m_PackgNum = 1;
|
||||
// QStringList waveData;
|
||||
// waveData = m_WaveData.split(",");
|
||||
// m_ListWaveData.append(waveData);
|
||||
// if(m_Count == 4){
|
||||
// ui->widget_wave->xAxis->setRange(0, 4);
|
||||
// ui->widget_wave->xAxis->setLabel("Time(s)");
|
||||
// double gap = (double)4/(double)m_ListWaveData.size();
|
||||
// QVector<double> x,y;
|
||||
// double f = 0.0;
|
||||
// QCPGraph* graph = ui->widget_wave->addGraph(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
// for(int i = 0; i < m_ListWaveData.size();i++){
|
||||
|
||||
// x.push_back(f);
|
||||
// y.push_back(m_ListWaveData[i].toDouble());
|
||||
// f += gap;
|
||||
// }
|
||||
// qDebug() << "x" <<x.size() << "y" << y.size() << endl;
|
||||
// graph->setData(x,y);
|
||||
// ui->widget_wave->xAxis->setRange(0, 1);
|
||||
// on_Btn_Scales_clicked();
|
||||
// ui->widget_wave->replot();
|
||||
// m_ListWaveData.clear();
|
||||
// m_Count = 0;
|
||||
// }
|
||||
// m_WaveData = "";
|
||||
// }else
|
||||
{
|
||||
m_WaveData = m_WaveData + data;
|
||||
qDebug() << "package" <<package << "packageMax" <<packageMax << endl;
|
||||
m_PackgNum = 1;
|
||||
bFlag = true;
|
||||
m_ListWaveData = m_WaveData.split(",");
|
||||
ui->widget_wave->xAxis->setLabel("Time(s)");
|
||||
ui->widget_wave->yAxis->setLabel(m_ChannelUnit);
|
||||
QString str = QString("wave size = %1").arg(m_ListWaveData.size());
|
||||
customLogMessageHandler(QtDebugMsg,str);
|
||||
double gap = 0.0;
|
||||
if(OneSecond){
|
||||
ui->widget_wave->xAxis->setRange(0, 1);
|
||||
gap = (double)1/(double)m_ListWaveData.size();
|
||||
}else{
|
||||
ui->widget_wave->xAxis->setRange(0, 4);
|
||||
gap = (double)4/(double)m_ListWaveData.size();
|
||||
}
|
||||
|
||||
double f = 0.0;
|
||||
QVector<double> x,y,x2,y2;
|
||||
QCPGraph* graph = ui->widget_wave->addGraph(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
for(int i = 0; i < m_ListWaveData.size();i++){
|
||||
x.push_back(f);
|
||||
y.push_back(m_ListWaveData[i].toDouble());
|
||||
f += gap;
|
||||
}
|
||||
|
||||
QVector<double>::iterator max = std::max_element(std::begin(y), std::end(y));
|
||||
double biggest = *max;
|
||||
|
||||
qDebug() << "x" << x.size() << "y" << y.size() << endl;
|
||||
graph->setData(x,y);
|
||||
|
||||
|
||||
ui->widget_wave->yAxis->setRange(-1,biggest+2);
|
||||
on_Btn_Scales_clicked();
|
||||
ui->widget_wave->replot();
|
||||
m_WaveData = m_WaveData + data;
|
||||
qDebug() << "package" <<package << "packageMax" <<packageMax << endl;
|
||||
m_PackgNum = 1;
|
||||
bFlag = true;
|
||||
m_ListWaveData = m_WaveData.split(",");
|
||||
ui->widget_wave->xAxis->setLabel("Time(s)");
|
||||
ui->widget_wave->yAxis->setLabel(m_ChannelUnit);
|
||||
QString str = QString("wave size = %1").arg(m_ListWaveData.size());
|
||||
customLogMessageHandler(QtDebugMsg,str);
|
||||
double gap = 0.0;
|
||||
if(OneSecond){
|
||||
ui->widget_wave->xAxis->setRange(0, 1);
|
||||
gap = (double)1/(double)m_ListWaveData.size();
|
||||
}else{
|
||||
ui->widget_wave->xAxis->setRange(0, 4);
|
||||
gap = (double)4/(double)m_ListWaveData.size();
|
||||
}
|
||||
|
||||
double f = 0.0;
|
||||
QVector<double> x,y;
|
||||
QCPGraph* graph = ui->widget_wave->addGraph(ui->widget_wave->xAxis, ui->widget_wave->yAxis);
|
||||
for(int i = 0; i < m_ListWaveData.size();i++){
|
||||
x.push_back(f);
|
||||
y.push_back(m_ListWaveData[i].toDouble());
|
||||
f += gap;
|
||||
}
|
||||
|
||||
QVector<double>::iterator max = std::max_element(std::begin(y), std::end(y));
|
||||
if(m_ChannelType == "PULSE_CURRENT"){
|
||||
QVector<double>::iterator min = std::min_element(std::begin(y), std::end(y));
|
||||
double min_y = *min;
|
||||
if(min_y < 1){
|
||||
double sum = std::accumulate(std::begin(y), std::end(y), 0.0);
|
||||
double size = y.size();
|
||||
double mean = sum/size;
|
||||
for(int i = 0; i < size;i++){
|
||||
y[i] = y[i] - mean;
|
||||
}
|
||||
}
|
||||
max = std::max_element(std::begin(y), std::end(y));
|
||||
}
|
||||
double biggest = *max;
|
||||
|
||||
qDebug() << "x" << x.size() << "y" << y.size() << endl;
|
||||
graph->setData(x,y);
|
||||
ui->widget_wave->yAxis->setRange(-1,biggest+2);
|
||||
on_Btn_Scales_clicked();
|
||||
ui->widget_wave->replot();
|
||||
|
||||
if(ui->pushButton_1S->isChecked() && (m_ChannelType == "TACHOMETER" || (m_speedRefChannelId != "" && m_speedRefChannelId != "- -"))){
|
||||
QJsonObject allObj,cmdBody;
|
||||
allObj.insert("cmd", "92");//获取键相
|
||||
@ -270,8 +212,6 @@ void CWaveDisPlay::ParseDataTimeWave(QJsonObject & objContent)
|
||||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||||
req.setUrl(sUrl);
|
||||
m_pNetMgr->PostJson(req,allObj);
|
||||
//ui->widget_wave->plotLayout()->clear();
|
||||
//
|
||||
}
|
||||
|
||||
}else{
|
||||
@ -536,16 +476,6 @@ void CWaveDisPlay::Cursor()
|
||||
|
||||
void CWaveDisPlay::on_pushButton_refresh_clicked()
|
||||
{
|
||||
// ui->comboBox_channel_2->clear();
|
||||
// ui->comboBox_channel_2->addItem("请选择通道...");
|
||||
// for (int i = 0; i < g_ChannelBaseInfo.size(); i++) {
|
||||
// ui->comboBox_channel_2->addItem(g_ChannelBaseInfo[i].channelName);
|
||||
// }
|
||||
|
||||
// ui->comboBox_channel_2->setView(new QListView());
|
||||
|
||||
|
||||
// //ui->comboBox_channel_2->setCurrentText("请选择通道...");
|
||||
on_comboBox_channel_2_currentTextChanged("");
|
||||
}
|
||||
|
||||
@ -578,7 +508,6 @@ void CWaveDisPlay::on_comboBox_channel_2_currentTextChanged(const QString &arg1)
|
||||
m_ChannelUnit = g_ChannelBaseInfo[i].sensorEngineeringUnit;
|
||||
if(ui->Btn_Timewave->isChecked())
|
||||
{
|
||||
|
||||
m_Times = 0;
|
||||
if(ui->pushButton_4S->isChecked()){
|
||||
OneSecond = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user