/// <summary> /// 添加一个轴安全区 /// </summary> /// <param name="card"></param> /// <param name="axisId"></param> /// <returns></returns> public AxisSafe Add(short type, short card, short axisId) { AxisSafe asf = new AxisSafe(type, card, axisId); Add(asf); return(asf); }
/// <summary> /// 判断当前轴运动是否是在PA 的安全 配置列表里面(pa.tag_AxisSafeManage.tag_AxisSafeList) 在返回TRUE /// </summary> /// <param name="_ac"></param> /// <param name="pa"></param> /// <returns></returns> public static bool isIOAxisHavePoint(AxisConfig _ac, PointAggregate pa, double pos) { int i = 0; if (pa == null || pa.tag_AxisSafeManage == null || pa.tag_AxisSafeManage.tag_AxisSafeList == null) { return(false); } while (i < pa.tag_AxisSafeManage.tag_AxisSafeList.Count) { AxisSafe currac = pa.tag_AxisSafeManage.tag_AxisSafeList[i]; if ((int)_ac.tag_MotionCardManufacturer * 1000 + _ac.CardNum * 100 + _ac.AxisNum == currac.tag_AxisId) { double poen_ac = 0.0; NewCtrlCardV0.SR_GetPrfPos((int)_ac.tag_MotionCardManufacturer, _ac.CardNum, _ac.AxisNum, ref poen_ac); // if (i == 0) { poen_ac = poen_ac / _ac.Eucf; if (poen_ac <= currac.tag_max && poen_ac >= currac.tag_min) { return(true); } else { return(false); } } } i++; } return(false); }
/// <summary> /// 设置一card 的axisId 轴的安全区 /// </summary> /// <param name="card"></param> /// <param name="axisId"></param> /// <param name="max"></param> /// <param name="min"></param> /// <returns></returns> public bool SetAxisSafe(short type, short card, short axisId, double max, double min) { Add(type, card, axisId); AxisSafe asf = GetAxisSafe(type, card, axisId); asf.tag_max = max; asf.tag_min = min; return(true); }
/// <summary> /// 添加一个轴安全区 /// </summary> /// <param name="asf"></param> /// <returns></returns> public bool Add(AxisSafe asf) { foreach (AxisSafe af in tag_AxisSafeList) { if (af.tag_AxisId == asf.tag_AxisId) { return(false); } } tag_AxisSafeList.Add(asf); return(false); }
/// <summary> /// 判断当前位置是否是本点的安全区 安全返回TRUE /// </summary> /// <returns></returns> public bool PointIsSafe(PointAggregate point) { foreach (StationModule sm in StationManage._Config.arrWorkStation) { foreach (AxisConfig ac in sm.arrAxis) { AxisSafe asf = GetAxisSafe((short)ac.tag_MotionCardManufacturer, ac.CardNum, ac.AxisNum); if (asf != null) { double poen_ac = 0; NewCtrlCardV0.SR_GetPrfPos((int)ac.tag_MotionCardManufacturer, ac.CardNum, ac.AxisNum, ref poen_ac); poen_ac = poen_ac / ac.Eucf; if (!asf.IsSafe(poen_ac)) //if (!asf.IsSafe(ac.dblEncPos)) { return(false); } } } } return(true); }
public AxisSafetySetControl(AxisSafe asf, string axisName) { tag_axisName = axisName; tag_AxisSafe = asf; InitializeComponent(); }