eis/inc/zlib/ZoneTracking.h

190 lines
4.6 KiB
C
Raw Normal View History

/*********************************************************************
*
* file: ZoneTracking.h
*
* copyright: Shanghai Baosight Software Co., Ltd.
*
* Version history
* 1.0 2020-02-16 zoufuzhou create
*
*********************************************************************/
#ifndef _ZONE_TRACK_H_
#define _ZONE_TRACK_H_
#include <log4cplus/LOG.h>
#include <zlib/MemTrk.h>
#include <base/MatrixFile.h>
#include <proxy/MessageICE.h>
struct LOOP_UNIT
{
int group; /* groupid */
int count; /* one loop count */
long length; /* one loop total lenght */
};
struct GROUP
{
int start; /* loop start zone id */
int end; /* loop end zone id */
};
class ZoneTracking
{
public:
ZoneTracking(void);
virtual ~ZoneTracking();
void ReInit(const string& file="zone.cfg", int procmode = 0);
public://dsc track mode
/*************************************
* set the non-looping segment tracking change length
* group: section grouping
* length: once move length
*************************************/
int SetGroupStep( int group, long length);
/*************************************
* set loop current step
* loopno: loop no index start by 1
* entlength: entry move length [mm]
* percentage: loop percentage [100%]
* prePercentage: loop before percentage [100%]
*************************************/
int SetLoopStep( int loopno, long entlength, long percentage, long prePercentage);
/*************************************
* set loop current step
* loopno: loop no index start by 1
* entlength: entry move length [mm]
* totallooplen: loop total length [mm]
* pretotallooplen: loop before total length [mm]
*************************************/
int SetLoopStepByLen( int loopno, long entlength, double totallooplen, double pretotallooplen);
/*************************************
* set loop current step
* loopno: loop no index start by 1
* entlength: entry move length [mm]
* percentage: loop percentage [100%]
* prePercentage: loop before percentage [100%]
*************************************/
//int SetLoopStep( int loopno, long extlength, long percentage);
/* get loop step by loop percentage*/
int GetLoopStep( int loopno,long percentage, long prePercentage);
/* get loop step by loop percentage*/
float GetTotalLoopLength( int loopno,long percentage);
/*strip move forward*/
void StripForward();
/*adjust from head to tail of zone coil length*/
void AdjustLength();
public://plc track mode
// set loop distance
int SetLoopDistance(int loopno, long percentage);
// processing has L1 tracking
void StripForward(int plczone,int ti,long wplen,const string& entId = "");
public:
void PrintMap();
void PrintMap(int zone);
void PrintGroup();
public:
//weld pos coil id create by random
int SimWelding(const string& entId,const string& extId,int ti = 99999);
//
int Welding(const string& entId = CS_ENTIDBOOK,const string& extId = CS_ENTIDBOOK,int ti = 99999);
//weld cancel
int CancelWeld( int innerid);
//WPD On ,Adjust the lead according to the error value
int WPDOn( int wpdindex, long range, int *pti, long* poffset);
//Length adjustment of strip
int CoilShift( int innerid, long step);
//Match the weld pos coilno
int WeldCoil(const char* entId,const char* extId);
//Match the weld pos coilno
int MatchEntId(const char* entId,const char* extId,int ti = 0);
//Match the weld TI
int MatchTI(int newti,int oldti = 999);
//Adjust the strip forward
int LineShiftForward( long step);
//Adjust the strip backward
int LineShiftBackward( long step);
//Print the length of strip across the line (mm)
void PrintCoilLength();
/*get loop max length
* loopno: start by one
*/
long GetLoopMaxLength(int loopno);
/*get trk data
* section: start by one
*/
const TRK_UNIT* Getmap( int section) const;
int GetZoneSize();
int GetZone(int wpdindex);
private:
//weld strip by strip
int Welding(int ti);
private:
void SetGroup( int section, int group, int loop,float distance);
void SetGroup( int section, int group, int loop,float distanceFix,float distanceVariable,int eventno,int plczone,float elgfactor);
void Initial();
private:
std::string m_path;
int m_procmode;
private:
CMemTrk* p_mtrk;
int maxwpdx;
int maxgroup;
std::vector<int> mv_wpdpos;
std::vector<LOOP_UNIT> mv_loops;
std::vector<GROUP> mv_groups;
int m_preStripZone;
char* db_msg;
MatrixFile* mp_matrix;
};
#endif