public override void ChangeMovingDirection(EnumMovingDirection newDirection) { if (Config.Type == EnumSafetySensorType.AreaSensor && newDirection != movingDirection) { if (Config.AreaSensorChangeDircetionInputIOList.ContainsKey(newDirection)) { if (!mipcControl.SendMIPCDataByMIPCTagName(Config.MIPCTagNmaeInput, Config.AreaSensorChangeDircetionInputIOList[newDirection])) { WriteLog(5, "", String.Concat("Device : ", Config.Device, " 切換移動方向 : ", newDirection.ToString(), " 失敗, 進行retry")); if (!mipcControl.SendMIPCDataByMIPCTagName(Config.MIPCTagNmaeInput, Config.AreaSensorChangeDircetionInputIOList[newDirection])) { WriteLog(5, "", String.Concat("Device : ", Config.Device, " 切換移動方向 : ", newDirection.ToString(), " retry失敗, ErrorBit on : ")); } else { WriteLog(5, "", String.Concat("Device : ", Config.Device, " 切換移動方向 : ", newDirection.ToString(), " retry成功")); movingDirection = newDirection; } } else { movingDirection = newDirection; } } else { WriteLog(3, "", String.Concat("Device : ", Config.Device, " Config 中並未定義移動方向 : ", newDirection.ToString(), " 的切換方式")); } } }
public void UpdateAllSafetySensor() { #region SafetySensor區域設定. EnumMovingDirection tempDirection = localData.MIPCData.MoveControlDirection; switch (tempDirection) { case EnumMovingDirection.Front: if (localData.MIPCData.BypassFront) { tempDirection = EnumMovingDirection.None; } break; case EnumMovingDirection.Back: if (localData.MIPCData.BypassBack) { tempDirection = EnumMovingDirection.None; } break; case EnumMovingDirection.Left: if (localData.MIPCData.BypassLeft) { tempDirection = EnumMovingDirection.None; } break; case EnumMovingDirection.Right: if (localData.MIPCData.BypassRight) { tempDirection = EnumMovingDirection.None; } break; case EnumMovingDirection.FrontLeft: if (localData.MIPCData.BypassFront && localData.MIPCData.BypassLeft) { tempDirection = EnumMovingDirection.None; } else if (localData.MIPCData.BypassFront) { tempDirection = EnumMovingDirection.Left; } else if (localData.MIPCData.BypassLeft) { tempDirection = EnumMovingDirection.Front; } break; case EnumMovingDirection.FrontRight: if (localData.MIPCData.BypassFront && localData.MIPCData.BypassRight) { tempDirection = EnumMovingDirection.None; } else if (localData.MIPCData.BypassFront) { tempDirection = EnumMovingDirection.Right; } else if (localData.MIPCData.BypassRight) { tempDirection = EnumMovingDirection.Front; } break; case EnumMovingDirection.BackLeft: if (localData.MIPCData.BypassBack && localData.MIPCData.BypassLeft) { tempDirection = EnumMovingDirection.None; } else if (localData.MIPCData.BypassBack) { tempDirection = EnumMovingDirection.Left; } else if (localData.MIPCData.BypassLeft) { tempDirection = EnumMovingDirection.Back; } break; case EnumMovingDirection.BackRight: if (localData.MIPCData.BypassBack && localData.MIPCData.BypassRight) { tempDirection = EnumMovingDirection.None; } else if (localData.MIPCData.BypassBack) { tempDirection = EnumMovingDirection.Right; } else if (localData.MIPCData.BypassRight) { tempDirection = EnumMovingDirection.Back; } break; default: break; } if (tempDirection != lastDirection) { WriteLog(7, "", String.Concat("MovingDirection : ", lastDirection.ToString(), " change to ", tempDirection.ToString())); for (int i = 0; i < AllSafetySensor.Count; i++) { AllSafetySensor[i].ChangeMovingDirection(lastDirection); } lastDirection = tempDirection; } #endregion uint tempStatus = 0; for (int i = 0; i < AllSafetySensor.Count; i++) { AllSafetySensor[i].UpdateStatus(); tempStatus = tempStatus | AllSafetySensor[i].Status; } AllStatus = tempStatus; EnumSafetyLevel newLevel = EnumSafetyLevel.Normal; for (int i = safetyLevelCount - 1; i >= 0; i--) { if ((tempStatus & (1 << i)) != 0 && ((EnumSafetyLevel)i) != EnumSafetyLevel.Warn) { newLevel = ((EnumSafetyLevel)i); break; } } if (newLevel != localData.MIPCData.safetySensorStatus) { if (newLevel == EnumSafetyLevel.IPCEMO) { WriteLog(7, "", String.Concat("動力電斷電")); mipcControl.SendMIPCDataByIPCTagName(new List <EnumMecanumIPCdefaultTag>() { EnumMecanumIPCdefaultTag.MIPCReady }, new List <float>() { 0 }); } WriteLog(7, "", String.Concat("safetySensorStatus 從 ", localData.MIPCData.safetySensorStatus.ToString(), " 切換至 ", newLevel.ToString())); localData.MIPCData.SafetySensorStatus = newLevel; } }
public virtual void ChangeMovingDirection(EnumMovingDirection newDirection) { }