diff --git a/sys/circuit_sys/psd.go b/sys/circuit_sys/psd.go index 451b99e..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