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.

155 lines
8.1 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#include "module.h"
#include "WorkTime.h"
//功率点检的参数
class CEnergyDensityPar
{
public:
CEnergyDensityPar(void)
{
m_LaserDeviceType = 0;
m_LaserFre = 1000;//点检时的频率Hz
m_EdiK = 0;//功率密度的斜率
m_EdiPo = 0;//功率密度的截距
};
public:
int m_LaserDeviceType;//激光的类型
double m_LaserFre;//点检时的频率Hz
double m_EdiK;//功率密度的斜率
double m_EdiPo;//功率密度的截距
};
class CWorkCmdContainer;
//激光
class CLaser :public CModule
{
public:
CLaser(void);
~CLaser(void);
virtual MODULE GetModuleType(){return _LASER_PROP;};
virtual CMFCPropertyGridProperty *CreatGridProperty();
virtual void OnAppInitialize();
virtual void WriteWorkFileExt(vector<CLab> &LabVec);
virtual void ReadWorkFile(CLabVecRang &LabVecRang);
virtual void Draw(CDC* pDC);
virtual void OnExitApp();
double GetBaseThickness(){return m_BaseThickness;};
void SetBaseThickness(double n){m_BaseThickness = n;};
void SetWorkThickness(double n){m_WorkThickness = n;};
double GetWorkThickness(){return m_WorkThickness;};
bool IsLaserSwitch(){return m_LaserSwitch;};
int GetLaserType(){return m_LaserType;};
int GetOpenLaserDelay();
double GetScanIntervals(double ScanOverlapRatio,bool bhorizontal);
double GetScanOverlapRatio(){return m_ScanOverlapRatio;};
void SetScanOverlapRatio(double val){m_ScanOverlapRatio = val;};
void SetGateFre();
int GetGateOpDelay(){return m_GateOpDelay;};
void SetbLaserGateOpen(bool b){m_bLaserGateOpen = b;};
bool IsbLaserGateOpen(){return m_bLaserGateOpen;};
void SetbRedLaserGateOpen(bool b){m_bRedLaserGateOpen = b;};
bool IsbRedLaserGateOpen(){return m_bRedLaserGateOpen;};
void SetbMachineGateOpen(bool b){m_bMachineGateOpen = b;};
bool IsMachineGateOpen(){return m_bMachineGateOpen;};
int GetShortOpenLaserDelay();
bool IsbCloseAppCloseLaser(){return m_bCloseAppCloseLaser;};
void SetFocusZMoveUpVal(double ZFocus){m_FocusZMoveUpVal = ZFocus;};
double GetFocusZMoveUpVal();
bool IsbAutoCalScanSpeed(){return m_bAutoCalSpeedX;};
bool IsbAutoCalCurr(){return m_bAutoCalCurr;};
double GetLaserFocusDis();
void IOSwitchLaserDimmer(bool bOpen);
void IOSwitchLaserDimmerByTargetCoord(Dbxy TargetCoord);
void StartLaserSleepTime();
void StopLaserSleepTime();
void LaserSleepTimeExt();
CString GetCurSleepLeftTimes();
void CalEnergyDensity(eLaserDeviceType LaserDeviceType,double F,double I,double &Edi);
void CalCurrByEdi(eLaserDeviceType LaserDeviceType,double F,double &I,double Edi);
void LaserSleepImmediately();
double GetCurWorkFoucsZcoord(){return m_CurWorkFoucsZcoord;};
void SetCurWorkFoucsZcoord(double Coord);
void ResetCurWorkFoucsZcoord();
bool IsbInited(){return m_bInited;};
void SetEnergyDensityPar(eLaserDeviceType LaserDeviceType,double Fre,double K,double Po);
bool GetEnergyDensityPar(eLaserDeviceType LaserDeviceType,double Fre,double &K,double &Po);
bool CheckEnergyDensityPar(eLaserDeviceType LaserDeviceType,double Fre,double K,double Po);
int GetRedLaserDelayAdjust(){return m_RedLaserDelayAdjust;};
int GetRedLaserPowCheckPluseW(){return m_RedLaserPowCheckPluseW;};
DbSize GetSpotSize(eLaserDeviceType LaserDeviceType);
bool IsbScanByDirX(){return m_bScanByDirX;};
CString GetLaserDeviceName(eLaserDeviceType LaserDeviceType);
void IniEdiParList(CListCtrl &list);
void UpdateEdiParList(CListCtrl &list);
bool IsLaserSleepTimeRun(){return !m_bStopLaserSleepTime;};//休眠计时是否正在运行
double CalPowerByRecipePar(eLaserDeviceType LaserDeviceType,double Fre,double I);
double CalPowerByDensityPar(double Po,double K,double I);
bool IsbPowRecordWriteCalPow(){return m_bPowRecordWriteCalPow;};
double CalEnergyDensityByPow(eLaserDeviceType LaserDeviceType,double F,double P);
int GetLaserCurrDigitsCnt(){return (m_LaserCurrDigitsCnt==1)?1:2;};
void UpdateLaserProp();
void GetLaserFixedCurrentPow(eLaserDeviceType LaserDeviceType,double Fre,double FixCurr,double &FixPow);
private:
double CalEnergyDensityExt(eLaserDeviceType LaserDeviceType,double F,double I,double K,double Po);
double CalCurrByEdiExt(eLaserDeviceType LaserDeviceType,double F,double Edi,double K,double Po);
void ReadEnergyDensityParFile();
void WriteEnergyDensityParFile();
double ReadCurSetLddCurrent(eLaserDeviceType LaserDeviceType);
private:
bool m_bInited;//是否初始化成功
DbSize m_SpotSize;//激光光斑的尺寸w表示X方向h表示Y方向(保存值)
double m_ScanOverlapRatio;//扫描重叠率,用来计算扫描间隔(0~100%)
bool m_bAutoCalSpeedX;//根据重叠率自动计算扫描速度(保存值)
bool m_bAutoCalCurr;//根据功率密度自动计算电流(保存值)
bool m_LaserSwitch;//激光是否反向(保存值)
bool m_bScanByDirX;//X方向扫描
int m_LaserType;//激光器类型(保存值)
int m_OpenLaserDelay;//开激光后延时ms (长延时) (保存值)
int m_OpenLaserDelayShort;//开激光后延时ms (短延时) (保存值)
bool m_bLaserGateOpen;//激光gate 是否为打开状态
bool m_bRedLaserGateOpen;//激光2 gate 是否为打开状态(辅助激光)
bool m_bSetGateFre;//是否设置了关闸的频率
bool m_bMachineGateOpen;//光闸是否打开
int m_GateOpDelay;//操作光闸后的延时ms(因为关闸偏转需要时间)(保存值)
int m_GateFre;//关闸的频率(保存值)
//激光焦距管理,Z 轴有电机的情况使用
bool m_bAdaptThickness;//是否适应产品的厚度
double m_BaseThickness;//用来调试焦距的基准产品厚度mm
double m_WorkThickness;//当前加工的产品厚度mm
double m_MaxThickness;//最大产品厚度mm
double m_MinThickness;//最小产品厚度mm
double m_FocusZMoveUpVal;//电机Z 的激光焦距位置(测距仪基准向上移动的值)
bool m_bCloseAppCloseLaser;//是否在关闭软件时关闭激光(保存值)
bool m_bCtrLaserDimmerByMotionIO;//控制激光衰减器(true 运动控制卡的IO )(false PLC控制)
bool m_bCtrLaserDimmerRev;//光闸控制反向
CWorkTime m_LaserSleepTime;//用来控制激光器休眠的时间对象
bool m_bStopLaserSleepTime;//停止休眠计时
double m_EnergyParChangeScal;//用于判断点检后功率密度参数变化的范围比例(保存值)
int m_RedLaserPowCheckPluseW;//红光点检时使用的脉宽us
DbSize m_RedSpotSize;//红光激光光斑的尺寸w表示X方向h表示Y方向(保存值)
int m_RedLaserDelayAdjust;//红光延时补偿值(用于调整脉冲发生器的相位)
bool m_bPowRecordWriteCalPow;//导出功率点检记录时输出计算功率P = Po+K*I;
int m_LaserCurrDigitsCnt;//激光电流小数点的位数
vector<CEnergyDensityPar> m_EnergyDensityParVec;//当前点检过的功率密度参数
double m_CurWorkFoucsZcoord;//当前加工晶圆Z 轴坐标(绝对坐标)
};
extern CLaser *gLaser;