diff --git a/entity/psd.go b/entity/psd.go index 649341d..09c776c 100644 --- a/entity/psd.go +++ b/entity/psd.go @@ -51,6 +51,8 @@ func loadPsdCircuit(world ecs.World, entry *ecs.Entry, psd *repository.Psd, entr switch ec.Code() { case "XGMJ", "SGMJ": circuit.GMJ = NewRelayEntity(world, relay, entryMap) + case "XKMJ", "SKMJ": + circuit.KMJMap[0] = NewRelayEntity(world, relay, entryMap) case "4XKMJ", "4SKMJ": circuit.KMJMap[4] = NewRelayEntity(world, relay, entryMap) case "8XKMJ", "8SKMJ": diff --git a/fi/psd.go b/fi/psd.go index 9fde927..3ad992f 100644 --- a/fi/psd.go +++ b/fi/psd.go @@ -243,12 +243,16 @@ func setQDTC(wd *component.WorldData, psdEntry *ecs.Entry) error { func setInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int32) error { if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路 circuit := component.PsdCircuitType.Get(psdEntry) - kmj := circuit.KMJMap[group] - if kmj == nil { - id := component.UidType.Get(psdEntry).Id - return errors.New(fmt.Sprintf("屏蔽门[id:%s]不支持[%d]编组操作", id, group)) + if circuit.KMJMap[0] != nil { //0编组意味着屏蔽门仅有一个开门继电器 + return setRelayDriveKm(wd, circuit, 0) + } else { + kmj := circuit.KMJMap[group] + if kmj == nil { + id := component.UidType.Get(psdEntry).Id + return errors.New(fmt.Sprintf("屏蔽门[id:%s]不支持[%d]编组操作", id, group)) + } + return setRelayDriveKm(wd, circuit, group) } - return setRelayDriveKm(wd, circuit, group) } else { psc := component.PscType.Get(psdEntry) psc.InterlockKmGroup[group] = true @@ -260,12 +264,16 @@ func setInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int32) e func cancelInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int32) error { if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路 circuit := component.PsdCircuitType.Get(psdEntry) - kmj := circuit.KMJMap[group] - if kmj == nil { - id := component.UidType.Get(psdEntry).Id - return errors.New(fmt.Sprintf("屏蔽门[id:%s]不支持[%d]编组操作", id, group)) + if circuit.KMJMap[0] != nil { //0编组意味着屏蔽门仅有一个开门继电器 + return cancelRelayDriveKm(wd, circuit, 0) + } else { + kmj := circuit.KMJMap[group] + if kmj == nil { + id := component.UidType.Get(psdEntry).Id + return errors.New(fmt.Sprintf("屏蔽门[id:%s]不支持[%d]编组操作", id, group)) + } + return cancelRelayDriveKm(wd, circuit, group) } - return cancelRelayDriveKm(wd, circuit, group) } else { psc := component.PscType.Get(psdEntry) psc.InterlockKmGroup[group] = false