mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-12-16 11:33:31 +08:00
添加了calibration first
This commit is contained in:
@ -0,0 +1,87 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//ATP?<3F><>?<3F><><EFBFBD><EFBFBD>??????<3F><>???<3F><>
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
//#include "pch.h"
|
||||
#include "ZZ_Types.h"
|
||||
#include "ZZ_Math.h"
|
||||
#include <QSerialPort>
|
||||
#include "IrisFiberSpectrometerBase.h"
|
||||
|
||||
using namespace ZZ_MISCDEF;
|
||||
using namespace ZZ_MISCDEF::ATP;
|
||||
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||
|
||||
class ZZ_ATPControl_Serial_Qt:public CIrisFSBase
|
||||
{
|
||||
//Q_OBJECT
|
||||
public:
|
||||
ZZ_ATPControl_Serial_Qt();
|
||||
virtual ~ZZ_ATPControl_Serial_Qt();
|
||||
|
||||
public:
|
||||
//?<3F><>???<3F><>????
|
||||
//int SetBaudRate(int iBaud);
|
||||
//???????<3F><><EFBFBD><EFBFBD>?
|
||||
int Initialize(bool bIsUSBMode, std::string ucPortNumber, std::string strDeviceName);
|
||||
int Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName);
|
||||
//??<3F><>??<3F><><EFBFBD><EFBFBD>?
|
||||
void Close();
|
||||
|
||||
//???????????? ?????<3F><>???<3F><><EFBFBD><EFBFBD>???????
|
||||
int SingleShot(int &iPixels);
|
||||
|
||||
//????????????
|
||||
int SingleShot(DataFrame &dfData);
|
||||
|
||||
//????<3F><>?<3F><>??<3F><>????
|
||||
//int SingleShotDark(ATPDataFrame &dfData);
|
||||
|
||||
//int SingleShotDeducted(ATPDataFrame &dfData);
|
||||
//?<3F><>???????<3F><>??
|
||||
int SetExposureTime(int iExposureTimeInMS);
|
||||
|
||||
//?????????<3F><>???<3F><>??
|
||||
int GetExposureTime(int &iExposureTimeInMS);
|
||||
|
||||
//int GetWaveLength(float *pfWaveLength);
|
||||
|
||||
//?????<3F><><EFBFBD><EFBFBD>?????
|
||||
int GetDeviceInfo(DeviceInfo &Info);
|
||||
|
||||
//?????<3F><><EFBFBD><EFBFBD>????<3F><>????
|
||||
int GetDeviceAttribute(DeviceAttribute &Attr);
|
||||
|
||||
//int GetDeviceListInfo(); //use type name to enum
|
||||
|
||||
//?<3F><>??????
|
||||
int SetDeviceTemperature(float fTemperature);
|
||||
|
||||
//????????
|
||||
int GetDeviceTemperature(float &fTemperature);
|
||||
|
||||
//<2F><>???????
|
||||
int PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float &fPredictedExposureTime);
|
||||
|
||||
#ifdef _DEBUG
|
||||
public:
|
||||
#else //
|
||||
private:
|
||||
#endif
|
||||
//port
|
||||
int m_iBaudRate;
|
||||
QSerialPort *m_pSerialPort;
|
||||
|
||||
//ATP
|
||||
DeviceInfo m_diDeviceInfo;
|
||||
DeviceAttribute m_daDeviceAttr;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////shutter control stub code s
|
||||
//int SetExtShutter(int iShutterUP0, int iShutterDOWN1,int iShutterDOWN2,int iShutterDOWN3); //0:close 1:open
|
||||
//////////////////////////////////////////////////////////////////////////shutter control stub code e
|
||||
int SendCommand(QByteArray qbCommand);
|
||||
int RecvData(QByteArray &qbData);
|
||||
int ParseData(QByteArray &qbData);
|
||||
//private slots :
|
||||
//void ReadMessage();
|
||||
};
|
||||
@ -0,0 +1,53 @@
|
||||
//
|
||||
// Created by tangchao on 2022/1/11.
|
||||
//
|
||||
|
||||
#ifndef OCEAN_OPTICS_CALIBRATION_CONSOLE_FIBERSPECTROMETEROPERATIONBASE_H
|
||||
#define OCEAN_OPTICS_CALIBRATION_CONSOLE_FIBERSPECTROMETEROPERATIONBASE_H
|
||||
|
||||
|
||||
#include "ZZ_Types.h"
|
||||
|
||||
using namespace ZZ_MISCDEF;
|
||||
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||
|
||||
class FiberSpectrometerOperationBase
|
||||
{
|
||||
|
||||
public:
|
||||
// FiberSpectrometerOperationBase();
|
||||
// ~FiberSpectrometerOperationBase();
|
||||
|
||||
virtual void connectFiberSpectrometer(QString& sn, QString& pixelCount, QString& wavelengthInfo) = 0;
|
||||
virtual void disconnectFiberSpectrometer() = 0;
|
||||
virtual void getDeviceAttribute(DeviceAttribute& deviceAttribute) = 0;
|
||||
virtual void getDeviceInfo(DeviceInfo& deviceInfo) = 0;
|
||||
|
||||
virtual void setExposureTime(int iExposureTimeInMS) = 0;
|
||||
|
||||
virtual void getExposureTime(int &iExposureTimeInMS) = 0;
|
||||
virtual void getDeviceTemperature(float &fTemperature) = 0;
|
||||
|
||||
virtual void singleShot(DataFrame &dfData) = 0;
|
||||
|
||||
// ZZ_S32 GetMaxValue(ZZ_S32 * dark, int number) = 0;
|
||||
|
||||
DataFrame m_IntegratingSphereData;
|
||||
DataFrame m_DarkData;
|
||||
protected:
|
||||
ZZ_U32 m_MaxValueOfFiberSpectrometer;
|
||||
private:
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
virtual void recordDark(QString path) = 0;
|
||||
virtual void recordTarget(int recordTimes, QString path) = 0;
|
||||
virtual void autoExpose() = 0;
|
||||
|
||||
signals:
|
||||
void sendExposureTimeSignal(int exposureTime);
|
||||
|
||||
};
|
||||
|
||||
#endif //OCEAN_OPTICS_CALIBRATION_CONSOLE_FIBERSPECTROMETEROPERATIONBASE_H
|
||||
@ -0,0 +1,42 @@
|
||||
#include <string>
|
||||
#include "ZZ_Types.h"
|
||||
#pragma once
|
||||
using namespace ZZ_MISCDEF;
|
||||
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||
|
||||
class CIrisFSBase
|
||||
{
|
||||
public:
|
||||
//CIrisFSBase();
|
||||
//virtual ~CIrisFSBase()= 0;
|
||||
public:
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD>豸
|
||||
//<2F>˴<EFBFBD>stringΪָ<CEAA><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>ocean<61><6E><EFBFBD><EFBFBD><EFBFBD>ǵIJ<C7B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>c/c++<2B><><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
||||
//0Ϊ<30><EFBFBD><DEB4><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>뷵<EFBFBD>ز<EFBFBD>ֵͬ
|
||||
virtual int Initialize(bool bIsUSBMode,std::string ucPortNumber,std::string strDeviceName) = 0;
|
||||
|
||||
//<2F>ر<EFBFBD><D8B1>豸
|
||||
virtual void Close() = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2>
|
||||
virtual int SingleShot(DataFrame &dfData) = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
virtual int SetExposureTime(int iExposureTimeInMS) = 0;
|
||||
|
||||
//<2F><>ȡ<EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual int GetExposureTime(int &iExposureTimeInMS) = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>¶<EFBFBD>
|
||||
virtual int SetDeviceTemperature(float fTemperature) = 0;
|
||||
|
||||
//<2F><>ȡ<EFBFBD>¶<EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual int GetDeviceTemperature(float &fTemperature) = 0;
|
||||
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
||||
virtual int GetDeviceInfo(DeviceInfo &Info) = 0;
|
||||
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual int GetDeviceAttribute(DeviceAttribute &Attr) = 0;
|
||||
|
||||
};
|
||||
121
othersoft/calibration_console/Header_Files/ZZ_Math.h
Normal file
121
othersoft/calibration_console/Header_Files/ZZ_Math.h
Normal file
@ -0,0 +1,121 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#//#include "Dense"
|
||||
#include "Eigen/Dense"
|
||||
#include <unsupported/Eigen/Splines>
|
||||
#pragma once
|
||||
|
||||
namespace ZZ_MATH
|
||||
{
|
||||
template<typename T>
|
||||
void MinHeapify(T*arry, int size, int element)
|
||||
{
|
||||
int lchild = element * 2 + 1, rchild = lchild + 1;
|
||||
while (rchild < size)
|
||||
{
|
||||
if (arry[element] <= arry[lchild] && arry[element] <= arry[rchild])
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (arry[lchild] <= arry[rchild])
|
||||
{
|
||||
std::swap(arry[element], arry[lchild]);
|
||||
element = lchild;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::swap(arry[element], arry[rchild]);
|
||||
element = rchild;
|
||||
}
|
||||
lchild = element * 2 + 1;
|
||||
rchild = lchild + 1;
|
||||
}
|
||||
if (lchild < size&&arry[lchild] < arry[element])
|
||||
{
|
||||
std::swap(arry[lchild], arry[element]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void MaxHeapify(T*arry, int size, int element)
|
||||
{
|
||||
int lchild = element * 2 + 1, rchild = lchild + 1;
|
||||
while (rchild < size)
|
||||
{
|
||||
if (arry[element] >= arry[lchild] && arry[element] >= arry[rchild])
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (arry[lchild] >= arry[rchild])
|
||||
{
|
||||
std::swap(arry[element], arry[lchild]);
|
||||
element = lchild;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::swap(arry[element], arry[rchild]);
|
||||
element = rchild;
|
||||
}
|
||||
lchild = element * 2 + 1;
|
||||
rchild = lchild + 1;
|
||||
}
|
||||
if (lchild<size&&arry[lchild]>arry[element])
|
||||
{
|
||||
std::swap(arry[lchild], arry[element]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
void HeapSort(T*arry, int size)
|
||||
{
|
||||
int i;
|
||||
for (i = size - 1; i >= 0; i--)
|
||||
{
|
||||
MinHeapify(arry, size, i);
|
||||
}
|
||||
while (size > 0)
|
||||
{
|
||||
std::swap(arry[size - 1], arry[0]);
|
||||
|
||||
size--;
|
||||
MinHeapify(arry, size, 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
namespace PolyFit
|
||||
{
|
||||
void Eigen_Polyfit(const std::vector<double> &xv, const std::vector<double> &yv, std::vector<double> &coeff, int order);
|
||||
double Eigen_Polyeval(std::vector<double> coeffs, double x);
|
||||
};
|
||||
|
||||
namespace SplineFit
|
||||
{
|
||||
using namespace Eigen;
|
||||
VectorXd Eigen_Normalize(const VectorXd &x);
|
||||
void Test(std::vector<double> const &x_vec, std::vector<double> const &y_vec);// do not call
|
||||
|
||||
|
||||
class SplineInterpolation
|
||||
{
|
||||
public:
|
||||
SplineInterpolation(Eigen::VectorXd const &x_vec,Eigen::VectorXd const &y_vec);
|
||||
double operator()(double x) const;
|
||||
|
||||
private:
|
||||
double x_min;
|
||||
double x_max;
|
||||
|
||||
double scaled_value(double x) const;
|
||||
Eigen::RowVectorXd scaled_values(Eigen::VectorXd const &x_vec) const;
|
||||
|
||||
Eigen::Spline<double, 1> spline_;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
350
othersoft/calibration_console/Header_Files/ZZ_Types.h
Normal file
350
othersoft/calibration_console/Header_Files/ZZ_Types.h
Normal file
@ -0,0 +1,350 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//<2F><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>ļ<EFBFBD>
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <QTime>
|
||||
|
||||
#define MAX_DEVICENUMBER_FS 2
|
||||
#define MAX_LINEARSHUTTER_POSITION 12
|
||||
#define ZZ_Enum2String(x) #x
|
||||
|
||||
namespace ZZ_MISCDEF
|
||||
{
|
||||
typedef unsigned char ZZ_U8;
|
||||
typedef unsigned short int ZZ_U16;
|
||||
typedef unsigned long int ZZ_U32;
|
||||
typedef long int ZZ_S32;
|
||||
|
||||
|
||||
namespace IRIS
|
||||
{
|
||||
//Fiber Spectrometer
|
||||
namespace FS
|
||||
{
|
||||
typedef struct tagDataFrame
|
||||
{
|
||||
ZZ_U32 usExposureTimeInMS;
|
||||
ZZ_S32 lData[4096];
|
||||
float fTemperature = 0;
|
||||
double dTimes = 0;
|
||||
}DataFrame;
|
||||
|
||||
|
||||
|
||||
typedef struct tagDeviceInfo
|
||||
{
|
||||
std::string strPN;
|
||||
std::string strSN;
|
||||
}DeviceInfo;
|
||||
|
||||
typedef struct tagDeviceAttribute
|
||||
{
|
||||
int iPixels;
|
||||
int iMaxIntegrationTimeInMS;
|
||||
int iMinIntegrationTimeInMS;
|
||||
float fWaveLengthInNM[4096];
|
||||
|
||||
}DeviceAttribute;
|
||||
|
||||
// inline DataFrame GetIndex(DataFrame dfDark, DataFrame dfSignal)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
enum DeviceModel
|
||||
{
|
||||
OSIFAlpha=0,
|
||||
OSIFBeta,
|
||||
ISIF,
|
||||
IS1,
|
||||
IS2
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline std::string GetDeviceModelName(int iModel)
|
||||
{
|
||||
switch (iModel)
|
||||
{
|
||||
case DeviceModel::OSIFAlpha: return "OSIFAlpha"; break;
|
||||
case DeviceModel::OSIFBeta: return "OSIFBeta"; break;
|
||||
case DeviceModel::ISIF: return "ISIF"; 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")
|
||||
{
|
||||
return DeviceModel::OSIFAlpha;
|
||||
}
|
||||
else if (strDeviceModelName == "OSIFBeta")
|
||||
{
|
||||
return DeviceModel::OSIFBeta;
|
||||
}
|
||||
else if (strDeviceModelName == "ISIF")
|
||||
{
|
||||
return DeviceModel::ISIF;
|
||||
}
|
||||
else if (strDeviceModelName == "IS1")
|
||||
{
|
||||
return DeviceModel::IS1;
|
||||
}
|
||||
else if (strDeviceModelName == "IS2")
|
||||
{
|
||||
return DeviceModel::IS2;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//ATP????<3F><>???
|
||||
namespace ATP
|
||||
{
|
||||
const int MAX_SPECTRUM_SIZE = 4096;
|
||||
|
||||
const int GET_MODULECIRCUIT_TEMP = 0x01;
|
||||
const int GET_PN_NUMBER = 0x03;
|
||||
const int GET_SN_NUMBER = 0x04;
|
||||
const int GET_MANUFACTURE_DATA = 0x06;
|
||||
const int GET_MANUFACTURE_INFO = 0x09;
|
||||
const int GET_PIXEL_LENGTH = 0x0a;
|
||||
const int GET_TEC_TEMP = 0x13;
|
||||
const int SET_TEC_TEMP = 0x12;
|
||||
const int GET_OPTICS_TEMP = 0x35;
|
||||
const int GET_CIRCUITBOARD_TEMP = 0x36;
|
||||
const int SET_INTEGRATION_TIME = 0x14;
|
||||
const int GET_INTEGRATION_TIME = 0x41;
|
||||
const int GET_MAX_INTEGRATION_TIME = 0x42;
|
||||
const int GET_MIN_INTEGRATION_TIME = 0x43;
|
||||
const int ASYNC_COLLECT_DARK = 0x23;
|
||||
const int ASYNC_START_COLLECTION = 0x16;
|
||||
const int ASYNC_READ_DATA = 0x17;
|
||||
const int SET_AVERAGE_NUMBER = 0x28;
|
||||
const int SYNC_GET_DATA = 0x1e;
|
||||
const int SYNC_GET_DARK = 0x2f;
|
||||
const int EXTERNAL_TRIGGER_ENABLE = 0x1f;
|
||||
const int SET_XENON_LAMP_DELAY_TIME = 0x24;
|
||||
const int GET_WAVELENGTH_CALIBRATION_COEF = 0x55;
|
||||
const int GET_STAT_LAMPOUT = 0x60;
|
||||
const int SET_GPIO = 0x61;
|
||||
//const int SYNCHRONIZATION_GET_DARK = 0x23
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////device
|
||||
enum Model
|
||||
{
|
||||
ATP1010 = 0,
|
||||
ATP6500
|
||||
};
|
||||
|
||||
//???????<3F><>??
|
||||
typedef struct tagATPDataFrame
|
||||
{
|
||||
unsigned short usExposureTime;
|
||||
ZZ_U16 usData[4096];
|
||||
float fTemperature;
|
||||
double dTimes = 0;
|
||||
}ATPDataFrame;
|
||||
|
||||
//?<3F><><EFBFBD><EFBFBD>??????<3F><>??
|
||||
typedef struct tagATPDeviceInfo
|
||||
{
|
||||
std::string strPN;
|
||||
std::string strSN;
|
||||
}ATPDeviceInfo;
|
||||
|
||||
//?<3F><><EFBFBD><EFBFBD>????<3F><>?<3F><>??
|
||||
typedef struct tagATPDeviceAttribute
|
||||
{
|
||||
int iPixels;
|
||||
int iMaxIntegrationTime;
|
||||
int iMinIntegrationTime;
|
||||
float fWaveLength[4096];
|
||||
|
||||
}ATPDeviceAttribute;
|
||||
//////////////////////////////////////////////////////////////////////////config file
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//????????
|
||||
namespace ZZ_RUNPARAMS
|
||||
{
|
||||
typedef struct tagErrorInfo
|
||||
{
|
||||
int iDataTransferErr = -1000;
|
||||
float fTecTempErr = -1000;
|
||||
int iShutterErr = -1000;
|
||||
float fChassisTempErr = -1000;
|
||||
}ErrInfo;
|
||||
|
||||
typedef struct tagFiberSpecContext
|
||||
{
|
||||
ZZ_U8 ucDeviceNumber;
|
||||
ZZ_U8 ucDeviceModel[MAX_DEVICENUMBER_FS];
|
||||
std::string strInterface[MAX_DEVICENUMBER_FS];
|
||||
std::string strSN[MAX_DEVICENUMBER_FS];
|
||||
long lDepth[MAX_DEVICENUMBER_FS];
|
||||
float fMinFactor[MAX_DEVICENUMBER_FS];
|
||||
float fMaxFactor[MAX_DEVICENUMBER_FS];
|
||||
ZZ_U16 usPixels[MAX_DEVICENUMBER_FS];
|
||||
float fWavelength[MAX_DEVICENUMBER_FS][4096];
|
||||
}FSContext;
|
||||
|
||||
typedef struct tagLinearShutterContext
|
||||
{
|
||||
std::string strInterface;
|
||||
ZZ_U8 ucProtocolType;
|
||||
ZZ_U8 ucCmdID;
|
||||
}LSContext;
|
||||
|
||||
typedef struct tagAcquisitionTimeSettings
|
||||
{
|
||||
QTime qtStartTime;
|
||||
QTime qtStopTime;
|
||||
QTime qtInterval;
|
||||
}AcqTimeSettings;
|
||||
|
||||
typedef struct tagAcquisitionPositionSettings
|
||||
{
|
||||
int iTotalPosition;
|
||||
int iPosition[MAX_LINEARSHUTTER_POSITION];
|
||||
}AcqPosSettings;
|
||||
|
||||
typedef struct tagRunTimeGrabberParams
|
||||
{
|
||||
LSContext lscParam;
|
||||
FSContext fscParams;
|
||||
AcqTimeSettings atsParams;
|
||||
AcqPosSettings apsParams;
|
||||
}RunTimeGrabberParams;
|
||||
|
||||
typedef struct tagATPCalibrationSettings
|
||||
{
|
||||
//Up0 Down1,2,3
|
||||
QString qsISIF_CalibrationFilePath[4];
|
||||
QString qsIS1_CalibrationFilePath[4];
|
||||
}ATPCalibrationSettings;
|
||||
}
|
||||
|
||||
//?????????????<3F><>??
|
||||
namespace ZZ_DATAFILE
|
||||
{
|
||||
typedef struct tagEnvironmentalContext
|
||||
{
|
||||
QString qstrUTCDateTime;
|
||||
QString qstrLocation;
|
||||
QString qstrGPS_Longtitude;
|
||||
QString qstrGPS_Latitude;
|
||||
QString qstrGPS_Altitude;
|
||||
QString qstrGPS_North;
|
||||
QString qstrCaseTemperature;
|
||||
QString qstrCaseHumidity;
|
||||
QString qstrDEV_SN;
|
||||
}EContext;
|
||||
|
||||
typedef struct tagManmadeEnviromentalContext
|
||||
{
|
||||
QString qstrOriFileName;
|
||||
QString qstrInstallationTime;
|
||||
QString qstrISIFCalibrationTime;
|
||||
QString qstrIS1CalibrationTime;
|
||||
QString qstrNameOfMaintenanceStaff;
|
||||
QString qstrPhoneNumberOfMaintenanceStaff;
|
||||
QString qstrDownloadUserID;
|
||||
QString qstrDownlaodAddress;
|
||||
QString qstrHTTPServer;
|
||||
}MEContext;
|
||||
|
||||
|
||||
typedef struct tagIS1Information
|
||||
{
|
||||
QString qstrSN_ATP;
|
||||
QString qstrSN_IRIS;
|
||||
|
||||
QString qstrCalFile_U0;
|
||||
QString qstrCalFile_D1;
|
||||
QString qstrCalFile_D2;
|
||||
QString qstrCalFile_D3;
|
||||
|
||||
int iPixelCount;
|
||||
|
||||
int iExposureTimeInMS_U0;
|
||||
int iExposureTimeInMS_D1;
|
||||
int iExposureTimeInMS_D2;
|
||||
int iExposureTimeInMS_D3;
|
||||
|
||||
float fTemperature_U0;
|
||||
float fTemperature_D1;
|
||||
float fTemperature_D2;
|
||||
float fTemperature_D3;
|
||||
}IS1Info;
|
||||
|
||||
typedef struct tagISIFInformation
|
||||
{
|
||||
QString qstrSN_ATP;
|
||||
QString qstrSN_IRIS;
|
||||
|
||||
QString qstrCalFile_U0;
|
||||
QString qstrCalFile_D1;
|
||||
QString qstrCalFile_D2;
|
||||
QString qstrCalFile_D3;
|
||||
|
||||
int iPixelCount;
|
||||
|
||||
int iExposureTimeInMS_U0;
|
||||
int iExposureTimeInMS_D1;
|
||||
int iExposureTimeInMS_D2;
|
||||
int iExposureTimeInMS_D3;
|
||||
|
||||
float fTemperature_U0;
|
||||
float fTemperature_D1;
|
||||
float fTemperature_D2;
|
||||
float fTemperature_D3;
|
||||
}ISIFInfo;
|
||||
|
||||
typedef struct tagATPDataHeader
|
||||
{
|
||||
|
||||
|
||||
}ATPDataHeader;
|
||||
|
||||
typedef struct tagCalibrationFrame
|
||||
{
|
||||
ZZ_U32 uiExposureTimeInMS;
|
||||
float fTemperature;
|
||||
int iPixels;
|
||||
float fWaveLength[4096] = { 0 };
|
||||
double dCal_Gain[4096] = { 0 };
|
||||
double dCal_Offset[4096] = { 0 };
|
||||
}CalFrame;
|
||||
|
||||
typedef struct tagCalDataFrame
|
||||
{
|
||||
ZZ_U32 usExposureTimeInMS;
|
||||
float fTemperature = 0;
|
||||
int iPixels;
|
||||
float fData[4096];
|
||||
QString qstrGrabDate;
|
||||
}CalDataFrame;
|
||||
}
|
||||
|
||||
//misc detector
|
||||
namespace MISC_DETECTOR
|
||||
{
|
||||
typedef struct tagHumitureDeviceInfo
|
||||
{
|
||||
QString qstrInterfaceName;
|
||||
}HumitureDeviceInfo;
|
||||
}
|
||||
};
|
||||
51
othersoft/calibration_console/Header_Files/atpFiberImager.h
Normal file
51
othersoft/calibration_console/Header_Files/atpFiberImager.h
Normal file
@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include <qthread.h>
|
||||
//#include <QFileDialog>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "ATPControl_Serial_QT.h"
|
||||
#include "FiberSpectrometerOperationBase.h"
|
||||
|
||||
class ATPFiberImager :public QObject,public FiberSpectrometerOperationBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ATPFiberImager(bool bIsUSBMode, std::string ucPortNumber, std::string strDeviceName);
|
||||
~ATPFiberImager();
|
||||
|
||||
ZZ_ATPControl_Serial_Qt * m_FiberSpectrometer;
|
||||
|
||||
void connectFiberSpectrometer(QString& sn, QString& pixelCount, QString& wavelengthInfo);
|
||||
void disconnectFiberSpectrometer();
|
||||
void getDeviceAttribute(DeviceAttribute& deviceAttribute);
|
||||
void getDeviceInfo(DeviceInfo& deviceInfo);
|
||||
|
||||
void setExposureTime(int iExposureTimeInMS);
|
||||
|
||||
void getExposureTime(int &iExposureTimeInMS);//ok
|
||||
void getDeviceTemperature(float &fTemperature);//ok
|
||||
|
||||
void singleShot(DataFrame &dfData);
|
||||
|
||||
ZZ_S32 GetMaxValue(ZZ_S32 * dark, int number);
|
||||
|
||||
// DataFrame m_IntegratingSphereData;
|
||||
// DataFrame m_DarkData;
|
||||
protected:
|
||||
private:
|
||||
std::string mUcPortNumber;
|
||||
|
||||
// ZZ_U32 m_MaxValueOfFiberSpectrometer;
|
||||
|
||||
public slots:
|
||||
void recordDark(QString path);
|
||||
void recordTarget(int recordTimes, QString path);
|
||||
void autoExpose();
|
||||
|
||||
signals:
|
||||
void sendExposureTimeSignal(int exposureTime);
|
||||
};
|
||||
50
othersoft/calibration_console/Header_Files/calibration.h
Normal file
50
othersoft/calibration_console/Header_Files/calibration.h
Normal file
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#include <qthread.h>
|
||||
//#include <QFileDialog>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "ZZ_Types.h"
|
||||
#include "ZZ_Math.h"
|
||||
//#include "Dense"
|
||||
#include "Eigen/Dense"
|
||||
#include "unsupported/Eigen/Splines"
|
||||
|
||||
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||
|
||||
class CalibrationAlgorithm :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CalibrationAlgorithm();
|
||||
~CalibrationAlgorithm();
|
||||
|
||||
void readFile(QString filePath, DeviceAttribute deviceAttribute, DeviceInfo deviceInfo);
|
||||
|
||||
void produceCalfile(QString calFilePath, DeviceAttribute deviceAttribute, DataFrame integratingSphereData, DataFrame darkData);
|
||||
|
||||
|
||||
protected:
|
||||
private:
|
||||
double m_dStandardLightDataBase;//<2F><><EFBFBD><D7BC><EFBFBD>ļ<EFBFBD><C4BC>Ļ<EFBFBD><EFBFBD><D7BC><EFBFBD><EFBFBD>
|
||||
double * m_dStandardLightWavelength;
|
||||
double * m_dStandardLightData;
|
||||
|
||||
double * m_dStandardLightWavelengthResampled;
|
||||
double * m_dStandardLightDataResampled;
|
||||
|
||||
double * m_gain;
|
||||
double * m_offset;
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
69
othersoft/calibration_console/Header_Files/library.h
Normal file
69
othersoft/calibration_console/Header_Files/library.h
Normal file
@ -0,0 +1,69 @@
|
||||
#ifndef OCEAN_LIB_LIBRARY_H
|
||||
#define OCEAN_LIB_LIBRARY_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
//#include <unistd.h>
|
||||
#include <chrono>
|
||||
|
||||
#include "api/SeaBreezeWrapper.h"
|
||||
|
||||
#include "IrisFiberSpectrometerBase.h"
|
||||
#include "api/seabreezeapi/SeaBreezeAPI.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
class OceanOptics_lib :public CIrisFSBase
|
||||
{
|
||||
public:
|
||||
OceanOptics_lib();
|
||||
virtual ~OceanOptics_lib();
|
||||
public:
|
||||
//初始化设备
|
||||
//此处string为指明连接哪个ocean光谱仪的参数,可自行更换为其他c/c++标准类型
|
||||
//0为无错误,不同错误请返回不同值(不能确定:当不成功时SeaBreeze返回的错误代码error不为0 → 不敢将error直接返回)
|
||||
int Initialize(bool bIsUSBMode, std::string ucPortNumber, std::string strDeviceName);//ok
|
||||
int Initialize();//ok
|
||||
|
||||
//关闭设备
|
||||
void Close();//ok
|
||||
|
||||
//单次数据采集
|
||||
int SingleShot(DataFrame &dfData);
|
||||
|
||||
//设置曝光时间
|
||||
int SetExposureTime(int iExposureTimeInMS);//ok
|
||||
|
||||
//获取曝光时间设置
|
||||
int GetExposureTime(int &iExposureTimeInMS);//ok
|
||||
|
||||
//设置目标温度
|
||||
int SetDeviceTemperature(float fTemperature);//ok
|
||||
|
||||
//获取温度设置
|
||||
int GetDeviceTemperature(float &fTemperature);//ok
|
||||
|
||||
//获取设备信息
|
||||
int GetDeviceInfo(DeviceInfo &Info);//ok
|
||||
|
||||
//获取设备特征数据
|
||||
int GetDeviceAttribute(DeviceAttribute &Attr);//ok
|
||||
|
||||
//tc
|
||||
static const char* get_error_string(int error);
|
||||
private:
|
||||
int m_iSpectralmeterHandle;
|
||||
DeviceInfo m_deviceInfo;
|
||||
int m_iExposureTime;
|
||||
|
||||
bool isSuccess(char* resultStr);
|
||||
|
||||
string GetDeviceType(int index);
|
||||
string GetSerialNumber(int index);
|
||||
};
|
||||
|
||||
#endif //OCEAN_LIB_LIBRARY_H
|
||||
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#include <qthread.h>
|
||||
//#include <QFileDialog>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "library.h"
|
||||
#include "FiberSpectrometerOperationBase.h"
|
||||
|
||||
class OceanOpticsFiberImager :public QObject,public FiberSpectrometerOperationBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OceanOpticsFiberImager();
|
||||
~OceanOpticsFiberImager();
|
||||
|
||||
OceanOptics_lib * m_FiberSpectrometer;
|
||||
|
||||
void connectFiberSpectrometer(QString& sn, QString& pixelCount, QString& wavelengthInfo);
|
||||
void disconnectFiberSpectrometer();
|
||||
void getDeviceAttribute(DeviceAttribute& deviceAttribute);
|
||||
void getDeviceInfo(DeviceInfo& deviceInfo);
|
||||
|
||||
void setExposureTime(int iExposureTimeInMS);
|
||||
|
||||
void getExposureTime(int &iExposureTimeInMS);//ok
|
||||
void getDeviceTemperature(float &fTemperature);//ok
|
||||
|
||||
void singleShot(DataFrame &dfData);
|
||||
|
||||
ZZ_S32 GetMaxValue(ZZ_S32 * dark, int number);
|
||||
|
||||
// DataFrame m_IntegratingSphereData;
|
||||
// DataFrame m_DarkData;
|
||||
protected:
|
||||
private:
|
||||
|
||||
// ZZ_U32 m_MaxValueOfFiberSpectrometer;
|
||||
|
||||
public slots:
|
||||
void recordDark(QString path);
|
||||
void recordTarget(int recordTimes, QString path);
|
||||
void autoExpose();
|
||||
|
||||
signals:
|
||||
void sendExposureTimeSignal(int exposureTime);
|
||||
};
|
||||
Reference in New Issue
Block a user