You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
7.8 KiB
C++

#pragma once
#include "module.h"
#include "LaserDevice.h"
//功率点检参数
class CPowCheckPar
{
public:
CPowCheckPar(void)
{
m_PulseFre = 1000;//激光脉冲频率Hz
m_StartCurr = 27;//开始电流值A
m_EndCurr = 40;//结束电流值A
m_GapCurr = 1;//间隔电流值A
m_FirstWaitDelay = 30;
m_WaitDelay = 15;
m_CollectDelay = 5;
ResetRotatoDimmerModePar();
};
void ResetRotatoDimmerModePar()
{
m_bRotatoDimmerMode = false;//是否为衰减角度点检模式
m_RotatoModeCurr = 28;//衰减模式电流
m_StartAng = 1;//开始角度
m_EndAng = 45;//结束角度
m_GapAng = 1;//间隔角度
}
void Serialize( CArchive& ar);
public:
double m_PulseFre;//激光脉冲频率Hz
double m_StartCurr;//开始电流值A
double m_EndCurr;//结束电流值A
double m_GapCurr;//间隔电流值A
int m_FirstWaitDelay;//第一个电流值设置后的等待延时s
int m_WaitDelay;//电流值设置后的等待延时s
int m_CollectDelay;//数据采集时间s
bool m_bRotatoDimmerMode;//是否为衰减角度点检模式
double m_RotatoModeCurr;//衰减模式电流
double m_StartAng;//开始角度
double m_EndAng;//结束角度
double m_GapAng;//间隔角度
};
//一个功率点检数据
class CPowCheckVal
{
public:
CPowCheckVal(void)
{
m_LaserSourcePow1 = 0;//光路功率1值W
m_LaserSourcePow2 = 0;//光路功率2值W
m_LaserPathPow = 0;//光路功率3值W
m_SurfacePow = 0;//产品面功率值W
m_PulseWidth = 0;//脉冲宽度ns
m_Pk2pk = 0;//峰峰值
m_Mean = 0;//平均值
m_Amplitude = 0;//幅度值
m_bValid = false;//是否有效
};
public:
CString m_Time;//数据采集的时间
bool m_bValid;//是否有效(参与平均值的计算)
double m_LaserSourcePow1;//光路功率1值W
double m_LaserSourcePow2;//光路功率2值W
double m_LaserPathPow;//光路功率3值W
double m_SurfacePow;//产品面功率值W
//示波器数据
double m_PulseWidth;//脉冲宽度ns
double m_Pk2pk;//峰峰值
double m_Mean;//平均值
double m_Amplitude;//幅度值
};
//单个电流对应的功率数据
class CPowCheckPt
{
public:
CPowCheckPt(void)
{
m_LaserFre = 1000;//激光频率Hz
m_SetCurr = 0;//设定电流值A
m_RotatoDimmerAng = 0;//衰减角度
m_PowCheckValCnt = 0;
};
public:
eLaserDeviceType m_LaserType;//激光的类型
double m_LaserFre;//激光频率Hz
double m_SetCurr;//设定电流值A
double m_RotatoDimmerAng;//衰减角度
int m_PowCheckValCnt;//参与计算的点数
CPowCheckVal m_PowCheckValAvg;//计算平均值
vector<CPowCheckVal> m_PowCheckValVec;//点检数据
};
//功率点检结果
class CPowCheckRet
{
public:
CPowCheckRet(void)
{
m_EnergyDensityK = 0;//功率密度的斜率
m_EnergyDensityPo = 0;//功率密度的截距
};
public:
double m_EnergyDensityK;//功率密度的斜率
double m_EnergyDensityPo;//功率密度的截距
};
class CPowCheckData
{
public:
CPowCheckData(void)
{
m_CheckType = _LaserDeviceType_MainLaser1;
m_EnergyDensityK = 0;//功率密度的斜率
m_EnergyDensityPo = 0;//功率密度的截距
m_LaserFre = 0;//点检使用的激光频率
};
void ResetCheckData(){m_bCheckDataValid = false;};
public:
bool m_bCheckDataValid;//点检结果是否有效
CString m_DateTime;//数据产生的时间
double m_LaserFre;//点检使用的激光频率Hz
eLaserDeviceType m_CheckType;//激光的类型
double m_EnergyDensityK;//功率密度的斜率
double m_EnergyDensityPo;//功率密度的截距
vector<CPowCheckPt> m_PowCheckPtVec;//功率点检数据容器
};
class CLaserPowCheckMgr :public CModule
{
public:
CLaserPowCheckMgr(void);
~CLaserPowCheckMgr(void);
virtual void OnAppInitialize();
void InitSelYearComb(CComboBox &ComboBox);
void InitSelMonthComb(CComboBox &ComboBox);
void InitSelLaserComb(CComboBox &ComboBox);
void IniParList(CListCtrl &list);
void UpdatePowCheckDataListExt(CListCtrl &List,bool bInsert,int SelIdx=-1);
void IniRecordList(CListCtrl &list);
void SetCurPowCheckType(int idx);
CPowCheckPar *GetCurPowCheckPar();
void SetCurPowCheckFre(double Fre);
void CreatCurPowCheckData();
void SetPowCheckPar(CPowCheckPar CheckPar);
void GetEnergyDensityPar(double &K,double &Po);
CPowCheckData &GetCurPowCheckData(){return m_CurPowCheckData;};
void LaserPowSavePt(CPowCheckPt *pCheckPt,bool bVaildData);
void BindingParList(CListCtrl *p){m_ParList = p;};
bool SaveCurPowCheckData(bool bRotatoDimmerMode,bool bManual=true);
void ChangeCurrent(CSetMainLaserPar &LaserPar,double Curr);
void ReadPowCheckData(int LaserType,CString Year,CString Month);
void UpdatePowCheckRecordList(CListCtrl &List);
void SaveSelCheckRecordToFile();
eLaserDeviceType GetCurPowCheckType(){return m_CurPowCheckType;};
void RecoverLastPowCheckData(eLaserDeviceType LaserDeviceType);
void GetLastPowCheckPar(eLaserDeviceType LaserDeviceType,double &K,double &Po);
void SaveCurPowCheckDataForRecipe(bool bManual=true);
void ReadLaserFixedCurrentPowFile(vector<CPowCheckPt> &PowCheckPtPowCheckPVec);
void SaveLaserFixedCurrentPowFile();
void ChangeOldPowCheckRcd(CString Path);
void UpdatePowCheckDataList();
void SavePowCheckDataFlie(CString Path,CPowCheckData &PowCheckData,bool bSaveMonitoringData);
void SaveMonitoringCheckData(CPowCheckData &PowCheckData,bool bRotatoDimmerMode);
void ResetRotatoModePar();
private:
CString GetPowCheckFilePath();
void ReadPowCheckPar();
void SavePowCheckPar();
bool CalEnergyDensityPar();
double CalTwoPtK(CPowCheckPt CheckPt1,CPowCheckPt CheckPt2);
void UpdatePowCheckDataListExtExt(CListCtrl &List,bool bInsert,CPowCheckData &PowCheckData);
void SerializePowCheckData(CArchive& ar,CPowCheckData &PowCheckData);
void ReadPowCheckDataFlie(CString Path,CPowCheckData &PowCheckData);
private:
CPowCheckPar m_MainPowCheckPar;//主激光的功率点检参数
CPowCheckPar m_RedPowCheckPar;//红光的功率点检参数
CPowCheckData m_CurPowCheckData;//当前功率点检数据
vector<CPowCheckData> m_CurPowCheckRecordVec;//当前的记录列表数据
int m_CurSelCheckRecordIdx;
eLaserDeviceType m_CurPowCheckType;//当前功率点检的类型
CListCtrl *m_ParList;
CString m_CurSelMonth;//当前选择的月
int m_CurExtLaserType;
CPowCheckData m_LastPow1CheckData;//最近一次激光1 功率点检数据(Prepare界面使用)
CPowCheckData m_LastPow2CheckData;//最近一次激光2 功率点检数据
CPowCheckData m_LastRedPowCheckData;//最近一次红光功率点检数据
};
extern CLaserPowCheckMgr *gLaserPowCheckMgr;