diff --git a/entity/ibp.go b/entity/ibp.go index 76ae4ff..994c520 100644 --- a/entity/ibp.go +++ b/entity/ibp.go @@ -170,7 +170,7 @@ func LoadEMPEntity(w ecs.World, entry *ecs.Entry, datas []*repository.Electronic d.EMPJ = NewRelayEntity(w, r, entityMap) emp.EMPJMap[r.Code()] = d } else { - slog.Warn("车站未实现设备[id:%s]逻辑", c.Id()) + slog.Warn("未实现设备[id:%s]逻辑", c.Id()) } } } @@ -185,23 +185,23 @@ func LoadEMPEntity(w ecs.World, entry *ecs.Entry, datas []*repository.Electronic d.EMPD = NewIBPLightEntity(w, c.Id(), entityMap) } else if ok && strings.HasSuffix(c.Code(), "EMPFA") { d.EMPFA_BTN = NewButtonEntity(w, b, entityMap) - } else if ok && strings.HasPrefix(c.Code(), "EMP") { + } else if ok && (strings.HasPrefix(c.Code(), "EMP") || strings.HasPrefix(c.Code(), "ESB")) { d.EMP_BTNS = append(d.EMP_BTNS, NewButtonEntity(w, b, entityMap)) } else { - slog.Warn("车站未实现设备[id:%s]逻辑", c.Id()) + slog.Warn("未实现设备[id:%s]逻辑", c.Id()) } } emp.EMPJMap[g.Code()] = d } } if emp.Alarm == nil || emp.QBA == nil || emp.SDA == nil { - return fmt.Errorf("车站EMP组合初始化出错,请检查IBP地图组合数据") + return fmt.Errorf("EMP组合初始化出错,请检查IBP地图组合数据") } for code, e := range emp.EMPJMap { if e.EMPFA_BTN == nil || e.EMPD == nil || len(e.EMP_BTNS) == 0 { - return fmt.Errorf("车站组合[%s]还原按钮未关联,请检查IBP地图组合数据", code) + return fmt.Errorf("组合[%s]还原按钮未关联,请检查IBP地图组合数据", code) } else if e.EMPJ == nil { - return fmt.Errorf("车站组合[%s]还原按钮未关联,请检查继电器地图组合数据", code) + return fmt.Errorf("组合[%s]继电器未关联,请检查继电器地图组合数据", code) } } entry.AddComponent(component.EmpElectronicType, unsafe.Pointer(emp)) diff --git a/entity/station.go b/entity/station.go index 185fb78..a8ddebb 100644 --- a/entity/station.go +++ b/entity/station.go @@ -1,6 +1,8 @@ package entity import ( + "fmt" + "joylink.club/ecs" "joylink.club/rtsssimulation/component" ) @@ -25,11 +27,11 @@ func LoadStations(w ecs.World) error { entry := NewStationEntity(w, station.Id(), data) err = LoadSPKEntity(w, entry, station.SpksComponents(), data) // 人员防护 if err != nil { - return err + return fmt.Errorf("车站【%s】人员防护error:%s", station.Id(), err.Error()) } err = LoadEMPEntity(w, entry, station.EmpGroups(), data) // 紧急停车 if err != nil { - return err + return fmt.Errorf("车站【%s】紧急停车error:%s", station.Id(), err.Error()) } } return nil diff --git a/repository/repository_check.go b/repository/repository_check.go index 6089450..d087c1c 100644 --- a/repository/repository_check.go +++ b/repository/repository_check.go @@ -43,7 +43,7 @@ func baseCheck(source *proto.Repository) []string { errMsg = append(errMsg, fmt.Sprintf("信号机[%s]缺少公里标", signal.Id)) } if signal.SectionId == "" && signal.TurnoutPort == nil { - errMsg = append(errMsg, fmt.Sprintf("检测点[%s]缺少关联的区段或道岔", signal.Id)) + errMsg = append(errMsg, fmt.Sprintf("信号机[%s]缺少关联的区段或道岔", signal.Id)) } } //应答器 diff --git a/sys/circuit_sys/psd.go b/sys/circuit_sys/psd.go index 399bf2c..55c92da 100644 --- a/sys/circuit_sys/psd.go +++ b/sys/circuit_sys/psd.go @@ -56,32 +56,34 @@ func (p *PsdSys) Update(world ecs.World) { psdState.Close = p.isAllAsdMotorClosed(asdList) } //更新站台门控箱电路及PSC相关状态 - pmc := component.PlatformMkxCircuitType.Get(entry) - var pcbTd bool - var pobTd bool - var pabTd bool - for _, mkxEntry := range pmc.MkxList { - mkx := component.MkxType.Get(mkxEntry) - if mkx.PCB != nil && component.BitStateType.Get(mkx.PCB).Val { - pcbTd = true + if entry.HasComponent(component.PlatformMkxCircuitType) { + pmc := component.PlatformMkxCircuitType.Get(entry) + var pcbTd bool + var pobTd bool + var pabTd bool + for _, mkxEntry := range pmc.MkxList { + mkx := component.MkxType.Get(mkxEntry) + if mkx.PCB != nil && component.BitStateType.Get(mkx.PCB).Val { + pcbTd = true + } + if mkx.POB != nil && component.BitStateType.Get(mkx.POB).Val { + pobTd = true + } + if mkx.PAB != nil && component.BitStateType.Get(mkx.PAB).Val { + pabTd = true + } } - if mkx.POB != nil && component.BitStateType.Get(mkx.POB).Val { - pobTd = true + if pmc.PCBJ != nil { + component.RelayDriveType.Get(pmc.PCBJ).Td = pcbTd + psc.MkxGM = component.BitStateType.Get(pmc.PCBJ).Val } - if mkx.PAB != nil && component.BitStateType.Get(mkx.PAB).Val { - pabTd = true + if pmc.POBJ != nil { + component.RelayDriveType.Get(pmc.POBJ).Td = pobTd + psc.MkxKM = component.BitStateType.Get(pmc.POBJ).Val + } + if pmc.PABJ != nil { + component.RelayDriveType.Get(pmc.PABJ).Td = pabTd } - } - if pmc.PCBJ != nil { - component.RelayDriveType.Get(pmc.PCBJ).Td = pcbTd - psc.MkxGM = component.BitStateType.Get(pmc.PCBJ).Val - } - if pmc.POBJ != nil { - component.RelayDriveType.Get(pmc.POBJ).Td = pobTd - psc.MkxKM = component.BitStateType.Get(pmc.POBJ).Val - } - if pmc.PABJ != nil { - component.RelayDriveType.Get(pmc.PABJ).Td = pabTd } //设置滑动门电机通断电状态 repo := entity.GetWorldData(world).Repo @@ -89,7 +91,7 @@ func (p *PsdSys) Update(world ecs.World) { if psc.MkxKM { //优先门控箱的开门 group := psd.FindAsdGroup(8) p.km(group.Start, group.End, asdList) - } else if psc.MkxKM { //其次门控箱的关门 + } else if psc.MkxGM { //其次门控箱的关门 p.gm(asdList) } else if !psc.InterlockMPL { //联锁操作没有被旁路 if psc.InterlockGM {