优化bug
This commit is contained in:
parent
a25359713e
commit
9ac105367f
@ -422,6 +422,51 @@ double Calculation::Phase(QVector<double> & vecData)
|
||||
return Phase2 - Phase1;
|
||||
}
|
||||
|
||||
void Calculation::_Integration(QVector<double> & vecData,QVector<double>& retData,double& RMS)
|
||||
{
|
||||
QVector<double> realshiftfft;
|
||||
QVector<double> imageshiftfft;
|
||||
QVector<double> realvalue,imagevalue;
|
||||
_FFT(vecData,realshiftfft,imageshiftfft);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
realshiftfft[i] = 0;
|
||||
imageshiftfft[i] = 0;
|
||||
}
|
||||
for (int i = 1000; i < realshiftfft.size(); i++) {
|
||||
realshiftfft[i] = 0;
|
||||
imageshiftfft[i] = 0;
|
||||
}
|
||||
qDebug()<< realshiftfft.size() << endl;
|
||||
qDebug()<< imageshiftfft.size() << endl;
|
||||
|
||||
for(int k = 1; k < realshiftfft.size()+1;k++){
|
||||
realvalue.push_back((realshiftfft.at(k-1)/(k*2*3.14))*1000 * 2);//单位转换mm/s,*1000 *2 精度损失
|
||||
imagevalue.push_back((imageshiftfft.at(k-1)/(k*2*3.14))*1000 * 2);//单位转换mm/s,*1000
|
||||
}
|
||||
|
||||
_iFFT(realvalue,imagevalue,retData);
|
||||
|
||||
float Sum = 0.0;
|
||||
for(int j = 0; j < retData.size();j++){
|
||||
float fData = retData[j]*retData[j];
|
||||
Sum += fData;
|
||||
}
|
||||
|
||||
RMS = sqrt(Sum/(float)retData.size()); //有效值
|
||||
|
||||
}
|
||||
|
||||
void Calculation::_Differentiation(QVector<double> & vecData,QVector<double>& retData)
|
||||
{
|
||||
retData.push_back(vecData[0]);
|
||||
for(int j = 1; j < vecData.size()-3;j++)
|
||||
{
|
||||
retData.push_back((vecData.at(j+1)-vecData.at(j-1))/(double)(2*1/(double)vecData.size()));
|
||||
}
|
||||
retData.push_back(vecData.at(vecData.size()-1));
|
||||
}
|
||||
|
||||
QVector<double> Calculation::ComputeDenCoeffs(int FilterOrder, double Lcutoff, double Ucutoff)
|
||||
{
|
||||
int k; // loop variables
|
||||
|
||||
@ -71,7 +71,10 @@ public:
|
||||
void _fft(QVector<double> & vecData, QVector<double> & vecFFTrealData,QVector<double> & vecFFTimageData);
|
||||
void _iFFT(QVector<double> & vecData, QVector<double> & vecFFTSpecData,QVector<double> & veciFFTData);
|
||||
|
||||
|
||||
//积分
|
||||
void _Integration(QVector<double> & vecData,QVector<double>& retData,double& RMS);
|
||||
//微分
|
||||
void _Differentiation(QVector<double> & vecData,QVector<double>& retData);
|
||||
//包络图谱数据
|
||||
void envSpec(QVector<double> & vecData, QVector<double> & vecEnvSpecData,int StartFrequency,int EndFrequency,bool PolarPlot=false);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -102,6 +102,7 @@ public:
|
||||
void CalculateDifferentiation(bool isDoubleDifferentiation = false);
|
||||
void EnableBtn();
|
||||
void UpdateDiffMenu();
|
||||
void InitIntegration();
|
||||
QVector<WAVE_DATA> childWave;
|
||||
QVector<WAVE_DATA> OrbitXWave,OrbitYWave;
|
||||
QVector<KeyPhasor> vecKeyPhasor;
|
||||
@ -180,7 +181,7 @@ private:
|
||||
QAction *Rad;
|
||||
|
||||
QCPAxis *yAxis3;
|
||||
QList<QCPAxis*> axes;
|
||||
QList<QCPAxis*> Axis;
|
||||
QCPItemTracer *tracer; //游标
|
||||
QCPItemTracer *tracer2; //游标
|
||||
|
||||
|
||||
@ -683,7 +683,11 @@ void MainWidget::addChildItem(QTreeWidgetItem *pDataItem,QTreeWidgetItem *pNoIte
|
||||
filename = datpath + sfileName;
|
||||
QFileInfo file(filename);
|
||||
if(file.exists()){
|
||||
|
||||
qDebug() << datpath << endl;
|
||||
QIcon icon(":/images/images/imgTreeIcon/remove6.png");
|
||||
pNewItem->setIcon(0, icon);
|
||||
pNewItem->setData(0,FILE_ROLE,0);
|
||||
pSizeItem->addChild(pNewItem);
|
||||
}else{
|
||||
QIcon icon(":/images/images/imgTreeIcon/remove2.png");
|
||||
pNewItem->setIcon(0, icon);
|
||||
@ -698,7 +702,10 @@ void MainWidget::addChildItem(QTreeWidgetItem *pDataItem,QTreeWidgetItem *pNoIte
|
||||
filename = datpath + sfileName;
|
||||
QFileInfo file(filename);
|
||||
if(file.exists()){
|
||||
|
||||
QIcon icon(":/images/images/imgTreeIcon/remove6.png");
|
||||
pNewItem->setIcon(0, icon);
|
||||
pNewItem->setData(0,FILE_ROLE,0);
|
||||
pSizeItem->addChild(pNewItem);
|
||||
}else{
|
||||
QIcon icon(":/images/images/imgTreeIcon/remove2.png");
|
||||
pNewItem->setIcon(0, icon);
|
||||
@ -713,6 +720,9 @@ void MainWidget::addChildItem(QTreeWidgetItem *pDataItem,QTreeWidgetItem *pNoIte
|
||||
filename = datpath + sfileName;
|
||||
QFileInfo file(filename);
|
||||
if(file.exists()){
|
||||
QIcon icon(":/images/images/imgTreeIcon/remove6.png");
|
||||
pNewItem->setIcon(0, icon);
|
||||
pNewItem->setData(0,FILE_ROLE,0);
|
||||
pSizeItem->addChild(pNewItem);
|
||||
}else{
|
||||
QIcon icon(":/images/images/imgTreeIcon/remove2.png");
|
||||
@ -1183,9 +1193,6 @@ void MainWidget::ItemCheckStateSlot(QString strID, bool bChecked)
|
||||
QString strChannelType = iter.value().at(0).sensorType;
|
||||
if(strChannelType != "PROXIMETER")
|
||||
return;
|
||||
qDebug() << "speedChannelID" << speedChannelID << endl;
|
||||
qDebug() << "ChannelID" << ChannelID << endl;
|
||||
qDebug() << "size" << mapWaveData[ChannelID].size() << endl;
|
||||
if(speedChannelID == "NONE" || speedChannelID == ""){
|
||||
MyMsgBox(QMessageBox::Warning,"警告","当前文件中没有转速通道数据");
|
||||
return;
|
||||
@ -1249,7 +1256,7 @@ void MainWidget::ItemCheckStateSlot(QString strID, bool bChecked)
|
||||
if((iter.key() == strChannelID)){
|
||||
QString ChannelID = iter.value().at(0).pairChannelID;
|
||||
QString ChannelType = iter.value().at(0).sensorType;
|
||||
if((ChannelType != "PROXIMETER") && (ChannelID == "NONE" || ChannelID == "")){
|
||||
if((ChannelType != "PROXIMETER") /*&& (ChannelID == "NONE" || ChannelID == "")*/){
|
||||
MyMsgBox(QMessageBox::Warning,"警告","请选择径向位移通道");
|
||||
return;
|
||||
}
|
||||
@ -1765,6 +1772,10 @@ void MainWidget::View3D()
|
||||
}
|
||||
void MainWidget::Dat2Csv()
|
||||
{
|
||||
if(mapWaveData.size() < 1){
|
||||
MyMsgBox(QMessageBox::Warning,"警告","请先打开数据文件!");
|
||||
return;
|
||||
}
|
||||
QString dirpath = QFileDialog::getExistingDirectory(this, QStringLiteral("选择目录"), "./", QFileDialog::ShowDirsOnly);
|
||||
|
||||
if(dirpath.isEmpty()) return;
|
||||
@ -2220,7 +2231,7 @@ void MainWidget::ReadDatData(QString strPath,QString strFileName,QString strIP)
|
||||
for (int i = 0; i < waveSize; i++) {
|
||||
file.read((char *)&f, sizeof(f));
|
||||
m_WaveChnData[j].channelId = buf;
|
||||
m_WaveChnData[j].waveData.push_back(f);
|
||||
m_WaveChnData[j].waveData.push_back((double)f);
|
||||
m_WaveChnData[j].Second = Count;
|
||||
}
|
||||
|
||||
@ -2256,13 +2267,13 @@ void MainWidget::ReadDatData(QString strPath,QString strFileName,QString strIP)
|
||||
if(iter->channelId.left(15) == m_WaveChnData[i].channelId.left(15)){
|
||||
wave.waveData = m_WaveChnData[i].waveData;
|
||||
|
||||
float sum = 0.0;
|
||||
double sum = 0.0;
|
||||
if(iter->sensorType == "ACCELEROMETER" || iter->sensorType == "MICROPHONE" ||
|
||||
iter->sensorType == "PROXIMETER" || iter->sensorType == "VELOCITY" ||
|
||||
iter->sensorType == "TACHOMETER" || iter->sensorType == "THRUST" ||
|
||||
iter->sensorType == "FAST_VOLTAGE"){
|
||||
sum = std::accumulate(std::begin(wave.waveData), std::end(wave.waveData), 0.0);
|
||||
float size = m_WaveChnData[i].waveData.size();
|
||||
double size = m_WaveChnData[i].waveData.size();
|
||||
wave.mean = sum/size;
|
||||
|
||||
}else{
|
||||
|
||||
@ -22,7 +22,7 @@ typedef struct tag_WAVE_DATA{
|
||||
int channelNo;
|
||||
int Time;
|
||||
QString pairChannelID;
|
||||
QVector<float> waveData;
|
||||
QVector<double> waveData;
|
||||
QVector<double> waveDataRealTime;
|
||||
QColor linColor;
|
||||
QVector<double> SpeedProfileSpeed;
|
||||
@ -63,7 +63,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
int Second;
|
||||
QString channelId;
|
||||
QVector<float> waveData;
|
||||
QVector<double> waveData;
|
||||
QVector<double> TimeStamp;
|
||||
} WAVE_CHNDATA;
|
||||
|
||||
@ -89,12 +89,13 @@ typedef struct {
|
||||
QVector<double> wavedata; //原始数据
|
||||
QVector<double> wavedataEnv;//包络数据
|
||||
QVector<double> wavedata_DC;
|
||||
QVector<double> wavedataFre;//频域数据
|
||||
QVector<double> TimeStamp;
|
||||
QColor linColor;
|
||||
QString channelType;
|
||||
QString sensorEngineeringUnit;
|
||||
int SamleRate;
|
||||
float mean;
|
||||
double mean;
|
||||
double meanRpm;
|
||||
QString channleName;
|
||||
int iTrigger;
|
||||
@ -102,6 +103,7 @@ typedef struct {
|
||||
float iTriggerValue;
|
||||
float iHysteresis;
|
||||
bool tachAutoTach;
|
||||
double RMS;
|
||||
} WAVE_DISPALYDATA;
|
||||
|
||||
typedef struct{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user