修改屏蔽门操作逻辑

This commit is contained in:
joylink_zhangsai 2023-12-08 17:43:20 +08:00
parent 8f1b02cbc3
commit 537fd57cb0
2 changed files with 20 additions and 10 deletions

View File

@ -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":

View File

@ -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