using BaseLibRWFile; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HRT_Measure { public class ClsPressure { public ClsPressure(string strInfo) { string[] arrStr = strInfo.Split(','); Name = arrStr[0]; Address = arrStr[1].Remove(0, 1); type = arrStr[2]; Scale = Convert.ToSingle(arrStr[3]); } public string Name = ""; public string Address = ""; public string type = ""; public string value = ""; public float Scale = 1.0f; } public class ClsPLCIO { public string ResetAdd = ""; public string SetAdd = ""; public string LedResetAdd = ""; public string LedSetAdd = ""; public string SensorResetAdd = ""; public string SensorSetAdd = ""; public string ResetEnableAdd = ""; public string SetEnableAdd = ""; public string PLCName = ""; public string CylinderName = ""; public bool isLedResetOn = false; public bool isLedSetOn = false; public bool isSensorResetOn = false; public bool isSensorSetOn = false; public bool isResetEnableOn = false; public bool isSetEnableOn = false; public ClsPLCIO(string plc, string strInfo) { PLCName = plc; string[] arrStr = strInfo.Split(','); //气缸名称,复位名称-复位点位-指示灯点位-使能点位-感应器点位,置位名称-置位点位-指示灯点位-使能点位-感应器点位 CylinderName = arrStr[0]; if (arrStr.Length == 2) { string[] arrStrAdd = arrStr[1].Split('-'); SetAdd = arrStrAdd[1]; LedSetAdd = arrStrAdd[2]; SetEnableAdd = arrStrAdd[3]; } else if (arrStr.Length == 3) { string strreset = arrStr[1]; string[] arrreset = strreset.Split('-'); ResetAdd = arrreset[1]; LedResetAdd = arrreset[2]; ResetEnableAdd = arrreset[3]; if (arrreset.Length == 5) { SensorResetAdd = arrreset[4]; } string strset = arrStr[2]; string[] arrset = strset.Split('-'); SetAdd = arrset[1]; LedSetAdd = arrset[2]; SetEnableAdd = arrset[3]; if (arrset.Length == 5) { SensorSetAdd = arrset[4]; } } } } public class ClsAlm { public ClsAlm(string plc, string strInfo) { PLCName = plc; string[] arrstr = strInfo.Split(','); AlmName = arrstr[0]; AlmAdd = arrstr[1]; } public string PLCName = ""; public string AlmName = ""; public string AlmAdd = ""; public bool isAlm = false; } public class PLCInitIO { //strHandOrAuto = "DB20.494.5"; //strInitDone = "DB48.24.4"; //strWait = "DB20.495.1"; //strAutoRunning = "DB20.495.2"; //strAlm = "DB20.495.0"; //string strIO = "DB20.494.5,DB48.24.4,DB20.495.1,DB20.495.2,DB20.495.0"; public PLCInitIO(string plc, string strInfo) { PLCName = plc; string[] strArr = strInfo.Split(','); HandOrAutoAdd = strArr[0]; InitDoneAdd = strArr[1]; WaitAdd = strArr[2]; AutoRunningAdd = strArr[3]; AlmAdd = strArr[4]; btnInitAdd = strArr[5]; btnExcetionQuitAdd = strArr[6]; btnStopAdd = strArr[7]; btnStartAdd = strArr[8]; btnHandOrAutoAdd = strArr[9]; } public string PLCName = ""; public string HandOrAutoAdd = ""; public string InitDoneAdd = ""; public string WaitAdd = ""; public string AutoRunningAdd = ""; public string AlmAdd = ""; public string btnInitAdd = ""; public string btnExcetionQuitAdd = ""; public string btnStopAdd = ""; public string btnStartAdd = ""; public string btnHandOrAutoAdd = ""; public bool isHandOrAuto = false; public bool isInitDone = false; public bool isWait = false; public bool isAutoRunning = false; public bool isAlm = false; public bool isBtnInit = false; public bool isBtnExceptionQuit = false; public bool isBtnStop = false; public bool isBtnStart = false; public bool isBtnHandOrAuto = false; } public class ClsAxisPos { public string GoAdd = ""; public string LightAdd = ""; public string PosName = ""; public string PLCName = ""; public string PosAdd = ""; public string SpeedAdd = ""; public string AxisName = ""; public bool isLightOn = false; public ushort uGoValue = 0; public ushort GoCurrValue = 0; public Ini newIni; public ClsAxisPos(string plc, string strAxisName, string strInfo) { PLCName = plc; AxisName = strAxisName; string[] arrStr = strInfo.Split(','); PosName = arrStr[0]; LightAdd = arrStr[1]; GoAdd = arrStr[2]; uGoValue = Convert.ToUInt16(arrStr[3]); PosAdd = arrStr[4]; SpeedAdd = arrStr[5]; newIni = new Ini(Application.StartupPath + $"\\Config\\PLCAxis{PLCName}.ini"); } public void WritePara(string strPosName, string axisName, string strValue) { newIni.WriteIni(axisName, strPosName, strValue); } public string ReadPara(string axisName, string strPosName) { return newIni.ReadIni(axisName, strPosName, "20"); } } public class ClsAxis { public string 当前位置 = ""; public string 异常代码 = ""; public string 点动速度 = ""; public string 寸动负 = ""; public string 寸动正 = ""; public string 轴使能 = ""; public string 回原点 = ""; public string 使能完成 = ""; public string 运行允许 = ""; public string 异常 = ""; public string 正极限 = ""; public string 原点 = ""; public string 负极限 = ""; public string 定位 = ""; public string AxisName = ""; public string PLCName = ""; public int i当前位置 = 0; public short s异常代码 = 0; public int i点动速度 = 0; public bool is轴使能 = false; public bool is使能完成 = false; public bool is运行允许 = false; public bool is异常 = false; public bool isPositiveLimitOn = false; public bool isNegativeLimitOn = false; public bool isOriginalLimitOn = false; public ClsAxis(string plc, string axisName, string strInfo) { PLCName = plc; AxisName = axisName; string[] arrStr = strInfo.Split(','); 当前位置 = arrStr[0]; 异常代码 = arrStr[1]; 点动速度 = arrStr[2]; 寸动负 = arrStr[3]; 寸动正 = arrStr[4]; 轴使能 = arrStr[5]; 回原点 = arrStr[6]; 使能完成 = arrStr[7]; 运行允许 = arrStr[8]; 异常 = arrStr[9]; 正极限 = arrStr[10]; 原点 = arrStr[11]; 负极限 = arrStr[12]; 定位 = arrStr[13]; } } public class ClsWeight { public ClsWeight()//string strInfo { for (int i = 0; i < 10; i++) { // f净重[i] = 0.0f; f完成[i] = 0.0f; f实时[i] = 0.0f; i数量[i] = 0; // f目标重量[i] = 0.0f; f正偏差[i] = 0.0f; f负偏差[i] = 0.0f; f快加提前量[i] = 0.0f; f慢加提前量[i] = 0.0f; f阈值[i] = 0.0f; // i快加速度[i] = 0; i慢加速度[i] = 0; i补料速度[i] = 0; i稳定检测时间[i] = 0; i快加禁止比较时间[i] = 0; i慢加禁止比较时间[i] = 0; i补加禁止比较时间[i] = 0; i完成动作执行时间[i] = 0; } } #region 地址 //主 public string[] Add净重 = new string[10];//1 = "", Add净重2 = "", Add净重3 = "", Add净重4 = "", Add净重5 = "", Add净重6 = "", Add净重7 = "", Add净重8 = "", Add净重9 = "", Add净重10 = ""; public string[] Add完成 = new string[10];//1 = "", Add完成2 = "", Add完成3 = "", Add完成4 = "", Add完成5 = "", Add完成6 = "", Add完成7 = "", Add完成8 = "", Add完成9 = "", Add完成10 = ""; public string[] Add实时 = new string[10];//1 = "", Add实时2 = "", Add实时3 = "", Add实时4 = "", Add实时5 = "", Add实时6 = "", Add实时7 = "", Add实时8 = "", Add实时9 = "", Add实时10 = ""; public string[] Add数量 = new string[10];//1 = "", Add数量2 = "", Add数量3 = "", Add数量4 = "", Add数量5 = "", Add数量6 = "", Add数量7 = "", Add数量8 = "", Add数量9 = "", Add数量10 = ""; //配方 public string[] Add目标重量 = new string[10];//1 = "", Add目标重量2 = "", Add目标重量3 = "", Add目标重量4 = "", Add目标重量5 = "", Add目标重量6 = "", Add目标重量7 = "", Add目标重量8 = "", Add目标重量9 = "", Add目标重量10 = ""; public string[] Add正偏差 = new string[10];//1 = "", Add正偏差2 = "", Add正偏差3 = "", Add正偏差4 = "", Add正偏差5 = "", Add正偏差6 = "", Add正偏差7 = "", Add正偏差8 = "", Add正偏差9 = "", Add正偏差10 = ""; public string[] Add负偏差 = new string[10];//1 = "", Add负偏差2 = "", Add负偏差3 = "", Add负偏差4 = "", Add负偏差5 = "", Add负偏差6 = "", Add负偏差7 = "", Add负偏差8 = "", Add负偏差9 = "", Add负偏差10 = ""; public string[] Add快加提前量 = new string[10];//1 = "", Add快加提前量2 = "", Add快加提前量3 = "", Add快加提前量4 = "", Add快加提前量5 = "", Add快加提前量6 = "", Add快加提前量7 = "", Add快加提前量8 = "", Add快加提前量9 = "", Add快加提前量10 = ""; public string[] Add慢加提前量 = new string[10];//1 = "", Add慢加提前量2 = "", Add慢加提前量3 = "", Add慢加提前量4 = "", Add慢加提前量5 = "", Add慢加提前量6 = "", Add慢加提前量7 = "", Add慢加提前量8 = "", Add慢加提前量9 = "", Add慢加提前量10 = ""; public string[] Add阈值 = new string[10];//1 = "", Add阈值2 = "", Add阈值3 = "", Add阈值4 = "", Add阈值5 = "", Add阈值6 = "", Add阈值7 = "", Add阈值8 = "", Add阈值9 = "", Add阈值10 = ""; //设备 public string[] Add快加速度 = new string[10];//1 = "", Add快加速度2 = "", Add快加速度3 = "", Add快加速度4 = "", Add快加速度5 = "", Add快加速度6 = "", Add快加速度7 = "", Add快加速度8 = "", Add快加速度9 = "", Add快加速度10 = ""; public string[] Add慢加速度 = new string[10];//1 = "", Add慢加速度2 = "", Add慢加速度3 = "", Add慢加速度4 = "", Add慢加速度5 = "", Add慢加速度6 = "", Add慢加速度7 = "", Add慢加速度8 = "", Add慢加速度9 = "", Add慢加速度10 = ""; public string[] Add补料速度 = new string[10];//1 = "", Add补料速度2 = "", Add补料速度3 = "", Add补料速度4 = "", Add补料速度5 = "", Add补料速度6 = "", Add补料速度7 = "", Add补料速度8 = "", Add补料速度9 = "", Add补料速度10 = ""; public string[] Add稳定检测时间 = new string[10];//1 = "";// = "", Add稳定检测时间2 = "", Add稳定检测时间3 = "", Add稳定检测时间4 = "", Add稳定检测时间5 = "", Add稳定检测时间6 = "", Add稳定检测时间7 = "", Add稳定检测时间8 = "", Add稳定检测时间9 = "", Add稳定检测时间10 = ""; public string[] Add快加禁止比较时间 = new string[10];//1 = "", Add快加禁止比较时间2 = "", Add快加禁止比较时间3 = "", Add快加禁止比较时间4 = "", Add快加禁止比较时间5 = "", Add快加禁止比较时间6 = "", Add快加禁止比较时间7 = "", Add快加禁止比较时间8 = "", Add快加禁止比较时间9 = "", Add快加禁止比较时间10 = ""; public string[] Add慢加禁止比较时间 = new string[10];//1 = "", Add慢加禁止比较时间2 = "", Add慢加禁止比较时间3 = "", Add慢加禁止比较时间4 = "", Add慢加禁止比较时间5 = "", Add慢加禁止比较时间6 = "", Add慢加禁止比较时间7 = "", Add慢加禁止比较时间8 = "", Add慢加禁止比较时间9 = "", Add慢加禁止比较时间10 = ""; public string[] Add补加禁止比较时间 = new string[10];//1 = "", Add补加禁止比较时间2 = "", Add补加禁止比较时间3 = "", Add补加禁止比较时间4 = "", Add补加禁止比较时间5 = "", Add补加禁止比较时间6 = "", Add补加禁止比较时间7 = "", Add补加禁止比较时间8 = "", Add补加禁止比较时间9 = "", Add补加禁止比较时间10 = ""; public string[] Add完成动作执行时间 = new string[10];//1 = "", Add完成动作执行时间2 = "", Add完成动作执行时间3 = "", Add完成动作执行时间4 = "", Add完成动作执行时间5 = "", Add完成动作执行时间6 = "", Add完成动作执行时间7 = "", Add完成动作执行时间8 = "", Add完成动作执行时间9 = "", Add完成动作执行时间10 = ""; //称重 public string Add零点跟踪范围 = ""; public string Add零点跟踪速率 = ""; public string Add稳定检测范围 = ""; public string Add稳定检测时间总 = ""; public string Add预处理滤波强度 = ""; public string Add预处理滤波系数 = ""; public string Add静态滤波防抖动 = ""; public string Add静态采样频率 = ""; public string Add静态滤波强度 = ""; public string Add静态滤波收敛 = ""; #endregion //主 public float[] f净重 = new float[10]; public float[] f完成 = new float[10]; public float[] f实时 = new float[10]; public int[] i数量 = new int[10]; //配方 public float[] f目标重量 = new float[10]; public float[] f正偏差 = new float[10]; public float[] f负偏差 = new float[10]; public float[] f快加提前量 = new float[10]; public float[] f慢加提前量 = new float[10]; public float[] f阈值 = new float[10]; //设备 public short[] i快加速度 = new short[10]; public short[] i慢加速度 = new short[10]; public short[] i补料速度 = new short[10]; public short[] i稳定检测时间 = new short[10]; public short[] i快加禁止比较时间 = new short[10]; public short[] i慢加禁止比较时间 = new short[10]; public short[] i补加禁止比较时间 = new short[10]; public short[] i完成动作执行时间 = new short[10]; //称重 public float f零点跟踪范围 = 0.0f; public float f稳定检测时间总 = 0.0f; public short i零点跟踪速率 = 0; public short i稳定检测范围 = 0; public short i预处理滤波强度 = 0; public short i预处理滤波系数 = 0; public short i静态滤波防抖动 = 0; public int i静态采样频率 = 0; public short i静态滤波强度 = 0; public short i静态滤波收敛 = 0; } }