public void doorClosedChange(object sender, PropertyChangedEventArgs e) { try { ANODE node = sender as ANODE; if (sender == null) { return; } if (!node.DoorClosed) { if (!node.SafetyCheckComplete) { BCFApplication.onWarningMsg($"OHCV:[{node.NODE_ID}] door has been open without authorization."); //對CV所在路段的OHT下pause Todo by Kevin scApp.RoadControlService.ProcessOHCVAbnormallyScenario(node); //上報Alarm給MCS Todo by Kevin foreach (var ohcv in node.getSubEqptList()) { if (!ohcv.DoorClosed) { scApp.LineService.ProcessAlarmReport( ohcv.NODE_ID, ohcv.EQPT_ID, ohcv.Real_ID, "", SCAppConstants.SystemAlarmCode.OHCV_Issue.CVDoorAbnormallyOpen, ProtocolFormat.OHTMessage.ErrorStatus.ErrSet); } } } } } catch (Exception ex) { logger.Error(ex, "Exception:"); } }
public void safetyCheckCompleteChange(object sender, PropertyChangedEventArgs e) { try { ANODE node = sender as ANODE; if (sender == null) { return; } if (!node.SafetyCheckComplete) { if (node.DoorClosed && node.Is_Alive) { //enable 該CV所在路段 Todo by Kevin scApp.RoadControlService.doEnableDisableSegment (node.SegmentLocation, E_PORT_STATUS.InService, ASEGMENT.DisableType.Safety, Data.SECS.CSOT.SECSConst.LANECUTTYPE_LaneCutOnHMI); } } else { //do nothing } } catch (Exception ex) { logger.Error(ex, "Exception:"); } }
public void aliveChange(object sender, PropertyChangedEventArgs e) { try { ANODE node = sender as ANODE; if (sender == null) { return; } if (!node.Is_Alive) { BCFApplication.onWarningMsg($"OHCV:[{node.NODE_ID}] alive is not changing."); //對CV所在路段的OHT下pause Todo by Kevin scApp.RoadControlService.ProcessOHCVAbnormallyScenario(node); //上報Alarm給MCS Todo by Kevin foreach (var ohcv in node.getSubEqptList()) { if (!ohcv.Is_Eq_Alive) { scApp.LineService.ProcessAlarmReport( ohcv.NODE_ID, ohcv.EQPT_ID, ohcv.Real_ID, "", SCAppConstants.SystemAlarmCode.OHCV_Issue.CVOfAliveSignalAbnormal, ProtocolFormat.OHTMessage.ErrorStatus.ErrSet); } } } } catch (Exception ex) { logger.Error(ex, "Exception:"); } }
public (bool isSuccess, string reason) RecoverCVEnable(string segmentID) { bool is_success = true; string reason = ""; try { ASEGMENT seg_vo = SegmentBLL.cache.GetSegment(segmentID); List <sc.Data.VO.OHCV> ohcvs = app.EquipmentBLL.cache.loadOHCVDevicesBySegmentLocation(segmentID); if (ohcvs == null || ohcvs.Count == 0) { reason = $"Segment ID:{segmentID} not is cv of segemnt."; is_success = false;; return(is_success, reason); } if (!seg_vo.DISABLE_FLAG_SAFETY) { reason = $"Segment ID:{segmentID} of safty flag already off."; is_success = false;; return(is_success, reason); } foreach (sc.Data.VO.OHCV ohcv in ohcvs) { if (!ohcv.DoorClosed) { reason = $"ohcv ID:{ohcv.EQPT_ID} of door closed:{ohcv.DoorClosed} ,can't enable segment."; is_success = false; return(is_success, reason); } if (!ohcv.Is_Eq_Alive) { reason = $"ohcv ID:{ohcv.EQPT_ID} of alive:{ohcv.Is_Eq_Alive} ,can't enable segment."; is_success = false; return(is_success, reason); } } //取得CV所在的Node,By Segment ID string seg_id = SCUtility.Trim(segmentID, true); ANODE node = NodeBLL.OperateCatch.getNodeBySegment(seg_id); doEnableDisableSegment(seg_id, E_PORT_STATUS.InService, ASEGMENT.DisableType.Safety, sc.Data.SECS.CSOT.SECSConst.LANECUTTYPE_LaneCutOnHMI); foreach (var ohcv in node.getSubEqptList()) { LineService.ProcessAlarmReport( ohcv.NODE_ID, ohcv.EQPT_ID, ohcv.Real_ID, "", SCAppConstants.SystemAlarmCode.OHCV_Issue.CVALLAlarmReset, ProtocolFormat.OHTMessage.ErrorStatus.ErrReset); } return(is_success, reason); } catch (Exception ex) { logger.Error(ex, "Exception:"); reason = $"{ex}-Exception"; is_success = false; return(is_success, reason); } }
public bool RecoverCVEnable(string segmentID) { try { //取得CV所在的Node,By Segment ID string seg_id = SCUtility.Trim(segmentID, true); ANODE node = NodeBLL.OperateCatch.getNodeBySegment(seg_id); doEnableDisableSegment(seg_id, E_PORT_STATUS.InService, ASEGMENT.DisableType.Safety, sc.Data.SECS.CSOT.SECSConst.LANECUTTYPE_LaneCutOnHMI); foreach (var ohcv in node.getSubEqptList()) { LineService.ProcessAlarmReport( ohcv.NODE_ID, ohcv.EQPT_ID, ohcv.Real_ID, "", SCAppConstants.SystemAlarmCode.OHCV_Issue.CVALLAlarmReset, ProtocolFormat.OHTMessage.ErrorStatus.ErrReset); } return(true); } catch (Exception ex) { logger.Error(ex, "Exception:"); return(false); } }
public ANODE getNodeBySegment(string segmentID) { ANODE node = CacheManager.getAllNode(). Where(zone => SCUtility.isMatche(zone.SegmentLocation, segmentID)). SingleOrDefault(); return(node); }
/// <summary> /// Updates the node. /// </summary> /// <param name="conn">The connection.</param> /// <param name="node">The node.</param> public void updateNode(DBConnection_EF conn, ANODE node) { try { conn.SaveChanges(); } catch (Exception ex) { logger.Warn(ex); throw; } }
/// <summary> /// Inserts the node. /// </summary> /// <param name="conn">The connection.</param> /// <param name="node">The node.</param> public void insertNode(DBConnection_EF conn, ANODE node) { try { conn.ANODE.Add(node); conn.SaveChanges(); } catch (Exception ex) { logger.Warn(ex); throw; } }
public virtual void setContext(BaseEQObject baseEQ) { try { this.eqpt = baseEQ as OHCV; node = scApp.getEQObjCacheManager().getParentNodeByEQPTID(eqpt.EQPT_ID); string[] str_arr = eqpt.EQPT_ID.Split('_'); string code = str_arr[1] == "A" ? "B" : "A"; //pair_eqpt = scApp.getEQObjCacheManager().getEquipmentByEQPTID(eqpt.EQPT_ID.Split('_')[0] + "_B") as OHCV; pair_eqpt = scApp.getEQObjCacheManager().getEquipmentByEQPTID(eqpt.EQPT_ID.Split('_')[0] + "_" + code) as OHCV; } catch (Exception ex) { logger.Error(ex, "Exection:"); } }
/// <summary> /// Gets the node by node identifier. /// </summary> /// <param name="conn">The connection.</param> /// <param name="readLock">The read lock.</param> /// <param name="node_id">The node_id.</param> /// <returns>Node.</returns> public ANODE getNodeByNodeID(DBConnection_EF conn, Boolean readLock, string node_id) { ANODE rtnNode = null; try { var query = from node in conn.ANODE where node.NODE_ID == node_id.Trim() select node; rtnNode = query.SingleOrDefault(); } catch (Exception ex) { logger.Warn(ex); throw; } return(rtnNode); }
public void ProcessOHCVAbnormallyScenario(ANODE node) { if (node == null) { LogHelper.Log(logger: logger, LogLevel: LogLevel.Warn, Class: nameof(RoadControlService), Device: "OHxC", Data: $"Start process ohcv node abnormally scenario, but ohcv node object is null."); return; } string segment_location = node.SegmentLocation; LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(RoadControlService), Device: "OHxC", Data: $"Start process ohcv node id:{node?.NODE_ID} abnormal scenario...", VehicleID: node?.NODE_ID); //直接將該段Segment封閉 doEnableDisableSegment(segment_location, E_PORT_STATUS.OutOfService, ASEGMENT.DisableType.Safety, Data.SECS.CSOT.SECSConst.LANECUTTYPE_LaneCutOnHMI); //當CV的門突然被開啟時,要即將經過該CV所在的VH下達Pause的命令 List <string> will_be_pass_cmd_ids = null; bool has_cmd_will_pass = CMDBLL.HasCmdWillPassSegment(segment_location, out will_be_pass_cmd_ids); if (has_cmd_will_pass) { foreach (string cmd_id in will_be_pass_cmd_ids) { ACMD_OHTC cmd_obj = CMDBLL.getExcuteCMD_OHTCByCmdID(cmd_id); if (cmd_obj != null) { //要改成一直下達pause命令,直到OHT回復成功為止。 Task.Run(() => ProcessUrgentPauseBySafty(cmd_obj.VH_ID)); } } } LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(RoadControlService), Device: "OHxC", Data: $"End process ohcv node id:{node?.NODE_ID} abnormal scenario.", VehicleID: node?.NODE_ID); }
private bool IsOHCVNodeStatusNormal(Data.VO.OHCV requestOHCV) { ANODE ohcv_node = app.getEQObjCacheManager().getNodeByNodeID(requestOHCV.NODE_ID); return(ohcv_node.Is_Alive && ohcv_node.DoorClosed); }