eis/inc/zcus/LineDefine.h

165 lines
3.4 KiB
C++

#ifndef _LINE_DEFINE_H
#define _LINE_DEFINE_H
#include <iostream>
#include <vector>
//using namespace baosight;
//#define E 2.71828183
#define PI 3.1415926 //define pi for calc
#define WELD_ERROR_RANGE 60000 //焊缝误差50mm
#define TCMBEFOREXM 125 //轧机前X米定义长度
#define MIN_LOOP 0 //活套物理最小极限套量%
#define ENC_DRIVE_SCALE_S_1 14 //电机与S辊的传动比例 1#S辊
#define ENC_DRIVE_SCALE_S_2 14 //电机与S辊的传动比例 2#S辊
#define ENC_DRIVE_SCALE_S_3 14 //电机与S辊的传动比例 3#S辊
#define ENC_DRIVE_SCALE_S_4 14 //电机与S辊的传动比例 4#S辊
#define ENC_DRIVE_SCALE_S_5 14 //11.731 //电机与S辊的传动比例 5#S辊
//const int ZONE_COUNT = 22;
const int LP_COUNT = 3;
const int WPD_COUNT = 7;
const int ROLL_S_COUNT = 6;
//const int WELD_MAX = 10;
const double roll_dima = 500; //辊半径
const double roll_dima_1 = 500;//modify 2014-2-19
const double roll_dima_2 = 500;//modify 2014-2-19
const double roll_dima_3 = 500;//modify 2014-2-19
const double roll_dima_4 = 500;//modify 2014-2-19
const double roll_dima_5 = 500;//modify 2014-2-19
//const long ENC_MAX = (long)(2147483648);//= 2e31;//脉冲最大值
const long ENC_MAX = (long)(32767);//= 2e31;//脉冲最大值
//const int ENC_DRIVE_ONE_CYCLE = 4096; //电机转动一圈的脉冲值变化
//const int ENC_DRIVE_ONE_CYCLE = 1024; //电机转动一圈的脉冲值变化
const int ENC_DRIVE_ONE_CYCLE = 256; //电机转动一圈的脉冲值变化
class IHDB
{
public:
static const int CACHE_BUFF = 10000;
static const int CACHE_SIZE = 1000;
};
typedef float IHDB_CACHE[IHDB::CACHE_SIZE][IHDB::CACHE_BUFF];
struct Roll{
//long speed;
long pulse;
};
struct RollS{
int BrPulse; // S辊编码器
int BrImp; // #S辊
};
struct Welder{
float ok; // 焊机焊接完成指令(手工确认)
float up; // 焊机焊接完成指令(手工确认)
float down; // 焊机焊接完成指令(手工确认)
};
struct SCut{
float UTailLen;
float LHeadLen;
float LMiddleLen;
float LTailLen;
float UHSampleLen;
float UTSampleLen;
float LHSampleLen;
float LTSampleLen;
float HSrapLen;
float TSrapLen;
};
struct TrackSign{
float PorOn[2];
float TorModel[2];
float TailOff[2];
float TrOn[2];
float TrModel[2];
float channel;
};
struct Cut{
float tr;
float up;
float down;
float DCut;
};
struct Len{
float por1;
float por2;
float por;
float tr;
};
struct WD_COIL{
float weld_inner;
char weld_coil[40];
char weld_ay[16];
char weld_sg[32];
char weld_code[4];
float weld_thick;
float weld_width;
};
struct SCRAP{
int ent_scrap_up;
int ent_scrap_low;
int ext_scrap_tail;
int ext_sample_tail;
int ext_scrap_head;
int ext_sample_head;
};
struct BR{
float BR_GR;
float BR_DIA;
float BR_RUAND;
float BR_PLG;
};
struct SignData{
BR Br[ROLL_S_COUNT]; // #S辊
float loop[LP_COUNT]; //活套n的活套量3 10000%
float wpd[WPD_COUNT]; //n#焊缝检测仪信号3
Welder welder; //焊机信号3
Cut cut;
Len len;
char por1Id[24];
char por2Id[24];
char tr1Id[24];
char tr2Id[24];
float speed[5];
float loop_pos[LP_COUNT];
float ti;
TrackSign trksign;// zmtr 跟踪数据,放结尾
};
/* 入口段1#S辊计速
出口活套段2#S辊计速
联机活套段4#S辊计速
轧机入口6#S辊辊计速*/
struct OnceMove{
float length[ROLL_S_COUNT];//每段S辊区间的移动长度 mm
};
struct CalcData{
OnceMove oncemove;
long groupstep[10]; //Length difference between groups
long loopstep[5];
};// calculated data
#endif