This commit is contained in:
xzb 2023-12-07 16:28:54 +08:00
commit 42f369ebd0
4 changed files with 37 additions and 33 deletions

View File

@ -170,7 +170,7 @@ func LoadEMPEntity(w ecs.World, entry *ecs.Entry, datas []*repository.Electronic
d.EMPJ = NewRelayEntity(w, r, entityMap) d.EMPJ = NewRelayEntity(w, r, entityMap)
emp.EMPJMap[r.Code()] = d emp.EMPJMap[r.Code()] = d
} else { } 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) d.EMPD = NewIBPLightEntity(w, c.Id(), entityMap)
} else if ok && strings.HasSuffix(c.Code(), "EMPFA") { } else if ok && strings.HasSuffix(c.Code(), "EMPFA") {
d.EMPFA_BTN = NewButtonEntity(w, b, entityMap) 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)) d.EMP_BTNS = append(d.EMP_BTNS, NewButtonEntity(w, b, entityMap))
} else { } else {
slog.Warn("车站未实现设备[id:%s]逻辑", c.Id()) slog.Warn("未实现设备[id:%s]逻辑", c.Id())
} }
} }
emp.EMPJMap[g.Code()] = d emp.EMPJMap[g.Code()] = d
} }
} }
if emp.Alarm == nil || emp.QBA == nil || emp.SDA == nil { 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 { for code, e := range emp.EMPJMap {
if e.EMPFA_BTN == nil || e.EMPD == nil || len(e.EMP_BTNS) == 0 { 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 { } else if e.EMPJ == nil {
return fmt.Errorf("车站组合[%s]还原按钮未关联,请检查继电器地图组合数据", code) return fmt.Errorf("组合[%s]继电器未关联,请检查继电器地图组合数据", code)
} }
} }
entry.AddComponent(component.EmpElectronicType, unsafe.Pointer(emp)) entry.AddComponent(component.EmpElectronicType, unsafe.Pointer(emp))

View File

@ -1,6 +1,8 @@
package entity package entity
import ( import (
"fmt"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
) )
@ -25,11 +27,11 @@ func LoadStations(w ecs.World) error {
entry := NewStationEntity(w, station.Id(), data) entry := NewStationEntity(w, station.Id(), data)
err = LoadSPKEntity(w, entry, station.SpksComponents(), data) // 人员防护 err = LoadSPKEntity(w, entry, station.SpksComponents(), data) // 人员防护
if err != nil { if err != nil {
return err return fmt.Errorf("车站【%s】人员防护error:%s", station.Id(), err.Error())
} }
err = LoadEMPEntity(w, entry, station.EmpGroups(), data) // 紧急停车 err = LoadEMPEntity(w, entry, station.EmpGroups(), data) // 紧急停车
if err != nil { if err != nil {
return err return fmt.Errorf("车站【%s】紧急停车error:%s", station.Id(), err.Error())
} }
} }
return nil return nil

View File

@ -43,7 +43,7 @@ func baseCheck(source *proto.Repository) []string {
errMsg = append(errMsg, fmt.Sprintf("信号机[%s]缺少公里标", signal.Id)) errMsg = append(errMsg, fmt.Sprintf("信号机[%s]缺少公里标", signal.Id))
} }
if signal.SectionId == "" && signal.TurnoutPort == nil { if signal.SectionId == "" && signal.TurnoutPort == nil {
errMsg = append(errMsg, fmt.Sprintf("检测点[%s]缺少关联的区段或道岔", signal.Id)) errMsg = append(errMsg, fmt.Sprintf("信号机[%s]缺少关联的区段或道岔", signal.Id))
} }
} }
//应答器 //应答器

View File

@ -56,32 +56,34 @@ func (p *PsdSys) Update(world ecs.World) {
psdState.Close = p.isAllAsdMotorClosed(asdList) psdState.Close = p.isAllAsdMotorClosed(asdList)
} }
//更新站台门控箱电路及PSC相关状态 //更新站台门控箱电路及PSC相关状态
pmc := component.PlatformMkxCircuitType.Get(entry) if entry.HasComponent(component.PlatformMkxCircuitType) {
var pcbTd bool pmc := component.PlatformMkxCircuitType.Get(entry)
var pobTd bool var pcbTd bool
var pabTd bool var pobTd bool
for _, mkxEntry := range pmc.MkxList { var pabTd bool
mkx := component.MkxType.Get(mkxEntry) for _, mkxEntry := range pmc.MkxList {
if mkx.PCB != nil && component.BitStateType.Get(mkx.PCB).Val { mkx := component.MkxType.Get(mkxEntry)
pcbTd = true 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 { if pmc.PCBJ != nil {
pobTd = true 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 { if pmc.POBJ != nil {
pabTd = true 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 repo := entity.GetWorldData(world).Repo
@ -89,7 +91,7 @@ func (p *PsdSys) Update(world ecs.World) {
if psc.MkxKM { //优先门控箱的开门 if psc.MkxKM { //优先门控箱的开门
group := psd.FindAsdGroup(8) group := psd.FindAsdGroup(8)
p.km(group.Start, group.End, asdList) p.km(group.Start, group.End, asdList)
} else if psc.MkxKM { //其次门控箱的关门 } else if psc.MkxGM { //其次门控箱的关门
p.gm(asdList) p.gm(asdList)
} else if !psc.InterlockMPL { //联锁操作没有被旁路 } else if !psc.InterlockMPL { //联锁操作没有被旁路
if psc.InterlockGM { if psc.InterlockGM {