mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-19 11:49:42 +08:00
文件存储完成
This commit is contained in:
@ -1 +0,0 @@
|
|||||||
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_06 09:17:15,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,
|
|
6
Data/2021_12_08/beijing_14_17_03.csv
Normal file
6
Data/2021_12_08/beijing_14_17_03.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_19_23.csv
Normal file
6
Data/2021_12_08/beijing_16_19_23.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_20_01.csv
Normal file
6
Data/2021_12_08/beijing_16_20_01.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_22_09.csv
Normal file
6
Data/2021_12_08/beijing_16_22_09.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_22_42.csv
Normal file
6
Data/2021_12_08/beijing_16_22_42.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_23_39.csv
Normal file
6
Data/2021_12_08/beijing_16_23_39.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_28_22.csv
Normal file
6
Data/2021_12_08/beijing_16_28_22.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_28_57.csv
Normal file
6
Data/2021_12_08/beijing_16_28_57.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_31_32.csv
Normal file
6
Data/2021_12_08/beijing_16_31_32.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_58_10.csv
Normal file
6
Data/2021_12_08/beijing_16_58_10.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_08/beijing_16_58_25.csv
Normal file
6
Data/2021_12_08/beijing_16_58_25.csv
Normal file
File diff suppressed because one or more lines are too long
15
Data/2021_12_08/beijing_17_23_37.csv
Normal file
15
Data/2021_12_08/beijing_17_23_37.csv
Normal file
File diff suppressed because one or more lines are too long
15
Data/2021_12_08/beijing_17_25_45.csv
Normal file
15
Data/2021_12_08/beijing_17_25_45.csv
Normal file
File diff suppressed because one or more lines are too long
15
Data/2021_12_08/beijing_17_38_47.csv
Normal file
15
Data/2021_12_08/beijing_17_38_47.csv
Normal file
File diff suppressed because one or more lines are too long
@ -1,9 +1,6 @@
|
|||||||
[DEVICE INFO]
|
[DEVICE INFO]
|
||||||
TotalSpectrometer=1
|
TotalSpectrometer=2
|
||||||
[FS2]
|
|
||||||
Model=OSIFBeta
|
|
||||||
Port=-1
|
|
||||||
UID=QEP02975
|
|
||||||
[FS1]
|
[FS1]
|
||||||
Model=OSIFBeta
|
Model=OSIFBeta
|
||||||
Port=-1
|
Port=-1
|
||||||
@ -12,6 +9,13 @@ AEMax=0.85
|
|||||||
AEMin=0.75
|
AEMin=0.75
|
||||||
Depth=65535
|
Depth=65535
|
||||||
[FS2]
|
[FS2]
|
||||||
|
Model=OSIFAlpha
|
||||||
|
Port=-1
|
||||||
|
UID=QEP02975
|
||||||
|
AEMax=0.85
|
||||||
|
AEMin=0.75
|
||||||
|
Depth=65535
|
||||||
|
[FS3]
|
||||||
Model=Null
|
Model=Null
|
||||||
[LINEAR SHUTTER]
|
[LINEAR SHUTTER]
|
||||||
Port=4
|
Port=4
|
||||||
|
8
main.cpp
8
main.cpp
@ -42,10 +42,16 @@ int main(int argc, char *argv[])
|
|||||||
testDG.InitializeWorkers();
|
testDG.InitializeWorkers();
|
||||||
testDG.SetupMsgPipelines();
|
testDG.SetupMsgPipelines();
|
||||||
testDG.StartWorkers();
|
testDG.StartWorkers();
|
||||||
m_pqDataGrabberThreadHolder->start();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
m_pqDataGrabberThreadHolder->start();
|
||||||
testDG.StartGrab();
|
testDG.StartGrab();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//QString qstrTest = "This is a test message 2";
|
//QString qstrTest = "This is a test message 2";
|
||||||
//qDebug() << qstrTest;
|
//qDebug() << qstrTest;
|
||||||
//cout << "This is a test message";
|
//cout << "This is a test message";
|
||||||
|
@ -366,13 +366,13 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapSort(dfTemp.usData, m_daDeviceAttr.iPixels);
|
HeapSort(dfTemp.lData, m_daDeviceAttr.iPixels);
|
||||||
|
|
||||||
double dSum = 0;
|
double dSum = 0;
|
||||||
int iCount = m_daDeviceAttr.iPixels / 100;
|
int iCount = m_daDeviceAttr.iPixels / 100;
|
||||||
for (int i = 0; i < iCount; i++)
|
for (int i = 0; i < iCount; i++)
|
||||||
{
|
{
|
||||||
dSum += dfTemp.usData[i];
|
dSum += dfTemp.lData[i];
|
||||||
}
|
}
|
||||||
double dTemp = dSum / iCount;
|
double dTemp = dSum / iCount;
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame &dfData)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int iDataSizeInPixel = (qbRecv.size() - 1) / 2;
|
int iDataSizeInPixel = (qbRecv.size() - 1) / 2;
|
||||||
memcpy(dfData.usData, qbRecv.data() + 1, iDataSizeInPixel * 2);
|
memcpy(dfData.lData, qbRecv.data() + 1, iDataSizeInPixel * 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,10 +24,23 @@ void DataFileProcessor::SetManmadeEnviromentalContext(MEContext struMEC)
|
|||||||
m_struMEC = struMEC;
|
m_struMEC = struMEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataFileProcessor::SetDeviceInfo(FSContext struDeviceContext)
|
||||||
|
{
|
||||||
|
m_struDeviceContext = struDeviceContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataFileProcessor::SetData(std::vector<std::vector<DataFrame>> vecData)
|
||||||
|
{
|
||||||
|
m_vecData.clear();
|
||||||
|
m_vecData = vecData;
|
||||||
|
}
|
||||||
|
|
||||||
bool DataFileProcessor::WriteDataFile()
|
bool DataFileProcessor::WriteDataFile()
|
||||||
{
|
{
|
||||||
GenerateFilePath();
|
GenerateFilePath();
|
||||||
WriteInfo();
|
WriteEnvironmentInfo();
|
||||||
|
WriteDeviceInfo();
|
||||||
|
WriteData();
|
||||||
bool res = true;
|
bool res = true;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -46,7 +59,7 @@ void DataFileProcessor::GenerateFilePath()
|
|||||||
{
|
{
|
||||||
m_struEC.qstrLocation = "Unknown";
|
m_struEC.qstrLocation = "Unknown";
|
||||||
}
|
}
|
||||||
m_qstrFullFileName= m_qstrFullFileName+"/"+m_struEC.qstrLocation + qstrAddHMS+".txt";
|
m_qstrFullFileName= m_qstrFullFileName+"/"+m_struEC.qstrLocation + qstrAddHMS+".csv";
|
||||||
|
|
||||||
QDir qdirPath(m_qstrFilePath);
|
QDir qdirPath(m_qstrFilePath);
|
||||||
if (!qdirPath.exists())
|
if (!qdirPath.exists())
|
||||||
@ -55,7 +68,7 @@ void DataFileProcessor::GenerateFilePath()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataFileProcessor::WriteInfo()
|
bool DataFileProcessor::WriteEnvironmentInfo()
|
||||||
{
|
{
|
||||||
bool bRes = true;
|
bool bRes = true;
|
||||||
QFile qfData(m_qstrFullFileName);
|
QFile qfData(m_qstrFullFileName);
|
||||||
@ -90,7 +103,6 @@ bool DataFileProcessor::WriteInfo()
|
|||||||
qfData.write("UTCDateTime,");
|
qfData.write("UTCDateTime,");
|
||||||
qfData.write(m_struEC.qstrUTCDateTime.toLatin1());
|
qfData.write(m_struEC.qstrUTCDateTime.toLatin1());
|
||||||
qfData.write(",");
|
qfData.write(",");
|
||||||
|
|
||||||
//qfData.write("\n");
|
//qfData.write("\n");
|
||||||
|
|
||||||
//MEC
|
//MEC
|
||||||
@ -112,14 +124,109 @@ bool DataFileProcessor::WriteInfo()
|
|||||||
qfData.write(",");
|
qfData.write(",");
|
||||||
qfData.write("PhoneNumberOfMaintenanceStaff,");
|
qfData.write("PhoneNumberOfMaintenanceStaff,");
|
||||||
qfData.write(m_struMEC.qstrPhoneNumberOfMaintenanceStaff.toLatin1());
|
qfData.write(m_struMEC.qstrPhoneNumberOfMaintenanceStaff.toLatin1());
|
||||||
qfData.write(",");
|
//qfData.write(",");
|
||||||
|
|
||||||
qfData.close();
|
qfData.close();
|
||||||
return bRes;
|
return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataFileProcessor::WriteDeviceInfo()
|
||||||
|
{
|
||||||
|
QFile qfData(m_qstrFullFileName);
|
||||||
|
bool bRes = qfData.open(QFile::WriteOnly | QFile::Text | QIODevice::Append);
|
||||||
|
QString qstrTemp;
|
||||||
|
|
||||||
|
qfData.write("\n");
|
||||||
|
qfData.write("TotalSpectrometer,");
|
||||||
|
qstrTemp = QString::number(m_struDeviceContext.ucDeviceNumber);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
qfData.write("\n");
|
||||||
|
|
||||||
|
for (int i=0;i< m_struDeviceContext.ucDeviceNumber;i++)
|
||||||
|
{
|
||||||
|
qstrTemp = QString("FS%1_Info").arg(i + 1);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
qfData.write(",");
|
||||||
|
|
||||||
|
qfData.write("Model,");
|
||||||
|
using namespace ZZ_MISCDEF::IRIS;
|
||||||
|
qstrTemp = QString::fromStdString(GetDeviceModelName(m_struDeviceContext.ucDeviceModel[i]));
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
qfData.write(",");
|
||||||
|
|
||||||
|
qfData.write("SN,");
|
||||||
|
qstrTemp = QString::fromStdString(m_struDeviceContext.strSN[i]);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
qfData.write(",");
|
||||||
|
|
||||||
|
qfData.write("Pixels,");
|
||||||
|
qstrTemp = QString::number(m_struDeviceContext.usPixels[i]);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
qfData.write(",");
|
||||||
|
|
||||||
|
qfData.write("Depth,");
|
||||||
|
qstrTemp = QString::number(m_struDeviceContext.lDepth[i]);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
|
||||||
|
qfData.write("\n");
|
||||||
|
|
||||||
|
qfData.write("Wavelength,");
|
||||||
|
for (unsigned short j = 0; j < m_struDeviceContext.usPixels[i]-1; j++)
|
||||||
|
{
|
||||||
|
qstrTemp = QString::number(m_struDeviceContext.fWavelength[i][j]);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
qfData.write(",");
|
||||||
|
}
|
||||||
|
|
||||||
|
qstrTemp = QString::number(m_struDeviceContext.fWavelength[i][m_struDeviceContext.usPixels[i] - 1]);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
|
||||||
|
qfData.write("\n");
|
||||||
|
}
|
||||||
|
qfData.close();
|
||||||
|
}
|
||||||
|
|
||||||
bool DataFileProcessor::WriteData()
|
bool DataFileProcessor::WriteData()
|
||||||
{
|
{
|
||||||
|
QFile qfData(m_qstrFullFileName);
|
||||||
|
bool bRes = qfData.open(QFile::WriteOnly | QFile::Text | QIODevice::Append);
|
||||||
|
QString qstrTemp;
|
||||||
|
qfData.write("Data Section");
|
||||||
|
qfData.write("\n");
|
||||||
|
|
||||||
|
using namespace ZZ_MISCDEF::IRIS;
|
||||||
|
for (int i=0;i<m_struDeviceContext.ucDeviceNumber;i++)
|
||||||
|
{
|
||||||
|
for (int j=0;j<m_vecData[i].size();j++)
|
||||||
|
{
|
||||||
|
qstrTemp = QString::fromStdString(GetDeviceModelName(m_struDeviceContext.ucDeviceModel[i]));
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
qstrTemp = QString("_P%1").arg(j + 1);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
qfData.write(",");
|
||||||
|
qfData.write("valid");
|
||||||
|
qfData.write(",");
|
||||||
|
qstrTemp = QString::number(m_vecData[i][j].usExposureTimeInMS);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
for (int k=0;k< m_struDeviceContext.usPixels[i];k++)
|
||||||
|
{
|
||||||
|
qfData.write(",");
|
||||||
|
qstrTemp = QString::number(m_vecData[i][j].lData[k]);
|
||||||
|
qfData.write(qstrTemp.toLatin1());
|
||||||
|
}
|
||||||
|
qfData.write("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool res = true;
|
bool res = true;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,18 +2,24 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "ZZ_Types.h"
|
#include "ZZ_Types.h"
|
||||||
using namespace ZZ_MISCDEF::ZZ_DATAFILE;
|
using namespace ZZ_MISCDEF::ZZ_DATAFILE;
|
||||||
|
using namespace ZZ_MISCDEF::ZZ_RUNPARAMS;
|
||||||
|
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||||
class DataFileProcessor
|
class DataFileProcessor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DataFileProcessor();
|
DataFileProcessor();
|
||||||
virtual ~DataFileProcessor();
|
virtual ~DataFileProcessor();
|
||||||
|
public:
|
||||||
public:
|
public:
|
||||||
void SetEnvironmentContex(EContext struEC);
|
void SetEnvironmentContex(EContext struEC);
|
||||||
void SetManmadeEnviromentalContext(MEContext truMEC);
|
void SetManmadeEnviromentalContext(MEContext struMEC);
|
||||||
|
void SetDeviceInfo(FSContext struDeviceContext);
|
||||||
|
void SetData(std::vector<std::vector<DataFrame>> vecData);
|
||||||
bool WriteDataFile();
|
bool WriteDataFile();
|
||||||
private:
|
private:
|
||||||
void GenerateFilePath();
|
void GenerateFilePath();
|
||||||
bool WriteInfo();
|
bool WriteEnvironmentInfo();
|
||||||
|
void WriteDeviceInfo();
|
||||||
bool WriteData();
|
bool WriteData();
|
||||||
|
|
||||||
|
|
||||||
@ -22,7 +28,11 @@ private:
|
|||||||
QString m_qstrFullFileName;
|
QString m_qstrFullFileName;
|
||||||
QString m_qstrFileName;
|
QString m_qstrFileName;
|
||||||
QString m_qstrFilePath;
|
QString m_qstrFilePath;
|
||||||
|
|
||||||
|
QDateTime m_qdtTime;
|
||||||
|
|
||||||
EContext m_struEC;
|
EContext m_struEC;
|
||||||
MEContext m_struMEC;
|
MEContext m_struMEC;
|
||||||
QDateTime m_qdtTime;
|
FSContext m_struDeviceContext;
|
||||||
|
std::vector<std::vector<DataFrame>> m_vecData;
|
||||||
};
|
};
|
@ -285,7 +285,7 @@ int OceanOptics_lib::SingleShot(DataFrame &dfData)
|
|||||||
|
|
||||||
for (int tmp = 0; tmp < spec_length; tmp++)
|
for (int tmp = 0; tmp < spec_length; tmp++)
|
||||||
{
|
{
|
||||||
dfData.usData[tmp] = spectrum[tmp];
|
dfData.lData[tmp] = spectrum[tmp];
|
||||||
}
|
}
|
||||||
|
|
||||||
int exposureTimeInMS;
|
int exposureTimeInMS;
|
||||||
|
@ -6,11 +6,14 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#define MAX_DEVICENUMBER_FS 2
|
#define MAX_DEVICENUMBER_FS 2
|
||||||
#define MAX_LINEARSHUTTER_POSITION 12
|
#define MAX_LINEARSHUTTER_POSITION 12
|
||||||
|
#define ZZ_Enum2String(x) #x
|
||||||
|
|
||||||
namespace ZZ_MISCDEF
|
namespace ZZ_MISCDEF
|
||||||
{
|
{
|
||||||
typedef unsigned char ZZ_U8;
|
typedef unsigned char ZZ_U8;
|
||||||
typedef unsigned short int ZZ_U16;
|
typedef unsigned short int ZZ_U16;
|
||||||
typedef unsigned long int ZZ_U32;
|
typedef unsigned long int ZZ_U32;
|
||||||
|
typedef long int ZZ_S32;
|
||||||
|
|
||||||
|
|
||||||
namespace IRIS
|
namespace IRIS
|
||||||
@ -21,11 +24,13 @@ namespace ZZ_MISCDEF
|
|||||||
typedef struct tagDataFrame
|
typedef struct tagDataFrame
|
||||||
{
|
{
|
||||||
ZZ_U16 usExposureTimeInMS;
|
ZZ_U16 usExposureTimeInMS;
|
||||||
ZZ_U16 usData[4096];
|
ZZ_S32 lData[4096];
|
||||||
float fTemperature;
|
float fTemperature = -1000;
|
||||||
double dTimes = 0;
|
double dTimes = 0;
|
||||||
}DataFrame;
|
}DataFrame;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct tagDeviceInfo
|
typedef struct tagDeviceInfo
|
||||||
{
|
{
|
||||||
std::string strPN;
|
std::string strPN;
|
||||||
@ -40,6 +45,11 @@ namespace ZZ_MISCDEF
|
|||||||
float fWaveLengthInNM[4096];
|
float fWaveLengthInNM[4096];
|
||||||
|
|
||||||
}DeviceAttribute;
|
}DeviceAttribute;
|
||||||
|
|
||||||
|
// inline DataFrame GetIndex(DataFrame dfDark, DataFrame dfSignal)
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
enum DeviceModel
|
enum DeviceModel
|
||||||
@ -51,46 +61,48 @@ namespace ZZ_MISCDEF
|
|||||||
IS2
|
IS2
|
||||||
};
|
};
|
||||||
|
|
||||||
// inline std::string GetDeviceModelName(int iModel)
|
|
||||||
// {
|
|
||||||
// switch (iModel)
|
inline std::string GetDeviceModelName(int iModel)
|
||||||
// {
|
{
|
||||||
// case DeviceModel::OSIFAlpha: return "OSIFAlpha"; break;
|
switch (iModel)
|
||||||
// case DeviceModel::OSIFBeta: return "OSIFBeta"; break;
|
{
|
||||||
// case DeviceModel::ISIF: return "ISIF"; break;
|
case DeviceModel::OSIFAlpha: return "OSIFAlpha"; break;
|
||||||
// case DeviceModel::IS1: return "IS1"; break;
|
case DeviceModel::OSIFBeta: return "OSIFBeta"; break;
|
||||||
// case DeviceModel::IS2: return "IS2"; break;
|
case DeviceModel::ISIF: return "ISIF"; break;
|
||||||
// default: return "error"; break;
|
case DeviceModel::IS1: return "IS1"; break;
|
||||||
// }
|
case DeviceModel::IS2: return "IS2"; break;
|
||||||
// }
|
default: return "error"; break;
|
||||||
//
|
}
|
||||||
// inline int GetIndex(std::string strDeviceModelName)
|
}
|
||||||
// {
|
|
||||||
// if (strDeviceModelName== "OSIFAlpha")
|
inline int GetIndex(std::string strDeviceModelName)
|
||||||
// {
|
{
|
||||||
// return DeviceModel::OSIFAlpha;
|
if (strDeviceModelName == "OSIFAlpha")
|
||||||
// }
|
{
|
||||||
// else if (strDeviceModelName == "OSIFBeta")
|
return DeviceModel::OSIFAlpha;
|
||||||
// {
|
}
|
||||||
// return DeviceModel::OSIFBeta;
|
else if (strDeviceModelName == "OSIFBeta")
|
||||||
// }
|
{
|
||||||
// else if (strDeviceModelName == "ISIF")
|
return DeviceModel::OSIFBeta;
|
||||||
// {
|
}
|
||||||
// return DeviceModel::ISIF;
|
else if (strDeviceModelName == "ISIF")
|
||||||
// }
|
{
|
||||||
// else if (strDeviceModelName == "IS1")
|
return DeviceModel::ISIF;
|
||||||
// {
|
}
|
||||||
// return DeviceModel::IS1;
|
else if (strDeviceModelName == "IS1")
|
||||||
// }
|
{
|
||||||
// else if(strDeviceModelName == "IS2")
|
return DeviceModel::IS1;
|
||||||
// {
|
}
|
||||||
// return DeviceModel::IS2;
|
else if (strDeviceModelName == "IS2")
|
||||||
// }
|
{
|
||||||
// else
|
return DeviceModel::IS2;
|
||||||
// {
|
}
|
||||||
// return -1;
|
else
|
||||||
// }
|
{
|
||||||
// }
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,6 +188,8 @@ namespace ZZ_MISCDEF
|
|||||||
long lDepth[MAX_DEVICENUMBER_FS];
|
long lDepth[MAX_DEVICENUMBER_FS];
|
||||||
float fMinFactor[MAX_DEVICENUMBER_FS];
|
float fMinFactor[MAX_DEVICENUMBER_FS];
|
||||||
float fMaxFactor[MAX_DEVICENUMBER_FS];
|
float fMaxFactor[MAX_DEVICENUMBER_FS];
|
||||||
|
ZZ_U16 usPixels[MAX_DEVICENUMBER_FS];
|
||||||
|
float fWavelength[MAX_DEVICENUMBER_FS][4096];
|
||||||
}FSContext;
|
}FSContext;
|
||||||
|
|
||||||
typedef struct tagLinearShutterContext
|
typedef struct tagLinearShutterContext
|
||||||
|
@ -42,6 +42,7 @@ int CAbstractFSController::InitializeFSControl()
|
|||||||
qDebug() << "OSIFAlpha Not Opened";
|
qDebug() << "OSIFAlpha Not Opened";
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DeviceModel::OSIFBeta:
|
case DeviceModel::OSIFBeta:
|
||||||
m_pFSCtrl = new OceanOptics_lib;
|
m_pFSCtrl = new OceanOptics_lib;
|
||||||
@ -93,6 +94,12 @@ int CAbstractFSController::InitializeFSControl()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CAbstractFSController::GetDeviceAttr(DeviceAttribute &daAttr)
|
||||||
|
{
|
||||||
|
daAttr = m_daDeviceAttr;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int CAbstractFSController::PerformAutoExposure()
|
int CAbstractFSController::PerformAutoExposure()
|
||||||
{
|
{
|
||||||
qDebug() << "--------------------------Starting PerformAutoExposure" << " Thread ID:" << m_iThreadID;
|
qDebug() << "--------------------------Starting PerformAutoExposure" << " Thread ID:" << m_iThreadID;
|
||||||
@ -146,13 +153,13 @@ int CAbstractFSController::PerformAutoExposure()
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapSort(dfTemp.usData, m_daDeviceAttr.iPixels);
|
HeapSort(dfTemp.lData, m_daDeviceAttr.iPixels);
|
||||||
|
|
||||||
double dSum = 0;
|
double dSum = 0;
|
||||||
int iCount = m_daDeviceAttr.iPixels / 100;
|
int iCount = m_daDeviceAttr.iPixels / 100;
|
||||||
for (int i = 0; i < iCount; i++)
|
for (int i = 0; i < iCount; i++)
|
||||||
{
|
{
|
||||||
dSum += dfTemp.usData[i];
|
dSum += dfTemp.lData[i];
|
||||||
}
|
}
|
||||||
double dTemp = dSum / iCount;
|
double dTemp = dSum / iCount;
|
||||||
|
|
||||||
@ -219,6 +226,10 @@ int CAbstractFSController::PerformAutoExposure()
|
|||||||
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3";
|
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3";
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to 30sec";
|
||||||
|
}
|
||||||
bFlagIsOverMaxExposureTime = true;
|
bFlagIsOverMaxExposureTime = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -291,7 +302,10 @@ int CAbstractFSController::StartAcquisitionSignal()
|
|||||||
// m_pFSCtrl->SetExposureTime(10000000);
|
// m_pFSCtrl->SetExposureTime(10000000);
|
||||||
// m_pFSCtrl->GetExposureTime(iii);
|
// m_pFSCtrl->GetExposureTime(iii);
|
||||||
// m_pFSCtrl->SingleShot(struDF);
|
// m_pFSCtrl->SingleShot(struDF);
|
||||||
PerformAutoExposure();
|
|
||||||
|
|
||||||
|
|
||||||
|
//PerformAutoExposure();
|
||||||
TakeSignalFrame();
|
TakeSignalFrame();
|
||||||
|
|
||||||
qDebug() << "Stop acq Signal" << " Thread ID:" << m_iThreadID;
|
qDebug() << "Stop acq Signal" << " Thread ID:" << m_iThreadID;
|
||||||
@ -321,10 +335,13 @@ int CAbstractFSController::ClearBuffer()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CAbstractFSController::GetBuffer(std::vector<DataFrame> *pvecDataFrameDark, std::vector<DataFrame> *pvecDataFrameSignal)
|
int CAbstractFSController::GetBuffer(std::vector<DataFrame> &pvecDataFrameDark, std::vector<DataFrame> &pvecDataFrameSignal)
|
||||||
{
|
{
|
||||||
pvecDataFrameDark = &m_vecDataFrameDark;
|
for (size_t i=0; i < m_vecDataFrameSignal.size(); i++)
|
||||||
pvecDataFrameSignal = &m_vecDataFrameSignal;
|
{
|
||||||
|
pvecDataFrameSignal.push_back(m_vecDataFrameSignal[i]);
|
||||||
|
pvecDataFrameDark.push_back(m_vecDataFrameDark[i]);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,9 @@ public:
|
|||||||
//create derived class from base class
|
//create derived class from base class
|
||||||
virtual int InitializeFSControl();
|
virtual int InitializeFSControl();
|
||||||
|
|
||||||
DataFrame GetLastDataFrame();
|
//sync info
|
||||||
|
virtual int GetDeviceAttr(DeviceAttribute &daAttr);
|
||||||
|
//DataFrame GetLastDataFrame();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CIrisFSBase *m_pFSCtrl;
|
CIrisFSBase *m_pFSCtrl;
|
||||||
@ -50,7 +52,7 @@ public slots:
|
|||||||
virtual int StartAcquisitionDark();
|
virtual int StartAcquisitionDark();
|
||||||
virtual int StopAcquisition();
|
virtual int StopAcquisition();
|
||||||
virtual int ClearBuffer();
|
virtual int ClearBuffer();
|
||||||
virtual int GetBuffer(std::vector<DataFrame> *pvecDataFrameDark, std::vector<DataFrame> *pvecDataFrameSignal);
|
virtual int GetBuffer(std::vector<DataFrame> &pvecDataFrameDark, std::vector<DataFrame> &pvecDataFrameSignal);
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -48,6 +48,14 @@ void CMainDataGrabber::Delay_MSec(ZZ_U16 usMS)
|
|||||||
qeLoop.exec();
|
qeLoop.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMainDataGrabber::SubDataFrame(DataFrame& dfLeft, DataFrame const dfRight, int iCount)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < iCount; i++)
|
||||||
|
{
|
||||||
|
dfLeft.lData[i] = dfLeft.lData[i]- dfRight.lData[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int CMainDataGrabber::SetGrabberParams(RunTimeGrabberParams struGrabberRTParams)
|
int CMainDataGrabber::SetGrabberParams(RunTimeGrabberParams struGrabberRTParams)
|
||||||
{
|
{
|
||||||
m_struAcqTime = struGrabberRTParams.atsParams;
|
m_struAcqTime = struGrabberRTParams.atsParams;
|
||||||
@ -108,8 +116,18 @@ int CMainDataGrabber::InitializeWorkers()
|
|||||||
CAbstractFSController* m_pWorkThread = new CAbstractFSController;
|
CAbstractFSController* m_pWorkThread = new CAbstractFSController;
|
||||||
m_pWorkThread->SetRunParas(i, fsInfo);
|
m_pWorkThread->SetRunParas(i, fsInfo);
|
||||||
m_pWorkThread->InitializeFSControl();
|
m_pWorkThread->InitializeFSControl();
|
||||||
|
|
||||||
|
DeviceAttribute daAttrTemp;
|
||||||
|
m_pWorkThread->GetDeviceAttr(daAttrTemp);
|
||||||
|
m_struDeviceContext.usPixels[i] = (ZZ_U16)daAttrTemp.iPixels;
|
||||||
|
for (ZZ_U16 j=0;j< daAttrTemp.iPixels;j++)
|
||||||
|
{
|
||||||
|
m_struDeviceContext.fWavelength[i][j] = daAttrTemp.fWaveLengthInNM[j];
|
||||||
|
}
|
||||||
|
|
||||||
m_pControlThread.push_back(m_pWorkThread);
|
m_pControlThread.push_back(m_pWorkThread);
|
||||||
}
|
}
|
||||||
|
m_pdfpSaver->SetDeviceInfo(m_struDeviceContext);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +316,7 @@ int CMainDataGrabber::GrabOnceFinished()
|
|||||||
}
|
}
|
||||||
m_iFlagIsCapturing = 1;
|
m_iFlagIsCapturing = 1;
|
||||||
|
|
||||||
m_struAcqPosSetting.iTotalPosition = 2;
|
m_struAcqPosSetting.iTotalPosition = 5;
|
||||||
|
|
||||||
//m_pdfpSaver->WriteDataFile();
|
//m_pdfpSaver->WriteDataFile();
|
||||||
for (ZZ_U8 i = 0; i < m_struDeviceContext.ucDeviceNumber; i++)
|
for (ZZ_U8 i = 0; i < m_struDeviceContext.ucDeviceNumber; i++)
|
||||||
@ -329,11 +347,20 @@ int CMainDataGrabber::GrabOnceFinished()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<DataFrame> test,test1;
|
std::vector<std::vector<DataFrame>> vecData;
|
||||||
|
|
||||||
for (ZZ_U8 i = 0; i < m_struDeviceContext.ucDeviceNumber; i++)
|
for (ZZ_U8 i = 0; i < m_struDeviceContext.ucDeviceNumber; i++)
|
||||||
{
|
{
|
||||||
m_pControlThread[i]->GetBuffer(&test, &test1);
|
std::vector<DataFrame> vecDark, vecSignal, vecResult;
|
||||||
|
m_pControlThread[i]->GetBuffer(vecDark, vecSignal);
|
||||||
|
for (size_t j=0;j< vecDark.size();j++)
|
||||||
|
{
|
||||||
|
SubDataFrame(vecSignal[j], vecDark[j], m_struDeviceContext.usPixels[i]);
|
||||||
}
|
}
|
||||||
|
vecData.push_back(vecSignal);
|
||||||
|
}
|
||||||
|
m_pdfpSaver->SetData(vecData);
|
||||||
|
m_pdfpSaver->WriteDataFile();
|
||||||
// qDebug() << "-------------------------------------------busy" << QTime::currentTime().toString();
|
// qDebug() << "-------------------------------------------busy" << QTime::currentTime().toString();
|
||||||
// QThread::msleep(5000);
|
// QThread::msleep(5000);
|
||||||
// return 0;
|
// return 0;
|
||||||
|
@ -38,6 +38,7 @@ private:
|
|||||||
QTimer *m_GrabTimer;
|
QTimer *m_GrabTimer;
|
||||||
private:
|
private:
|
||||||
void Delay_MSec(ZZ_U16 usMS);
|
void Delay_MSec(ZZ_U16 usMS);
|
||||||
|
void SubDataFrame(DataFrame& dfLeft, DataFrame const dfRight,int iCount);
|
||||||
public:
|
public:
|
||||||
//Call this first
|
//Call this first
|
||||||
int SetGrabberParams(RunTimeGrabberParams struGrabberRTParams);
|
int SetGrabberParams(RunTimeGrabberParams struGrabberRTParams);
|
||||||
|
Reference in New Issue
Block a user