门控箱相关继电器不再能直接控制屏蔽门,而是被联锁采集后由联锁发起控制;MPLJ改为仅供联锁采集
This commit is contained in:
parent
4ee6f05b62
commit
5086c8732a
@ -99,9 +99,9 @@ type Psc struct {
|
|||||||
InterlockGM bool
|
InterlockGM bool
|
||||||
InterlockMPL bool
|
InterlockMPL bool
|
||||||
|
|
||||||
MkxKM bool
|
//MkxKM bool 门控箱控制继电器->联锁采集继电器状态->联锁驱动屏蔽门控制继电器
|
||||||
MkxGM bool
|
//MkxGM bool
|
||||||
MkxPL bool
|
//MkxPL bool
|
||||||
|
|
||||||
QDTC bool
|
QDTC bool
|
||||||
TZTC bool
|
TZTC bool
|
||||||
|
80
fi/ibp.go
80
fi/ibp.go
@ -2,7 +2,7 @@ package fi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"joylink.club/bj-rtsts-server/dto/request_proto"
|
//"joylink.club/bj-rtsts-server/dto/request_proto"
|
||||||
|
|
||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
@ -60,42 +60,42 @@ func SwitchKeyGear(w ecs.World, id string, gear int32) error {
|
|||||||
return result.Err
|
return result.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetBypassBtn(w ecs.World, id string, p request_proto.BypassOperationReq_Operation) error {
|
//func SetBypassBtn(w ecs.World, id string, p request_proto.BypassOperationReq_Operation) error {
|
||||||
|
//
|
||||||
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
// result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||||
wd := entity.GetWorldData(w)
|
// wd := entity.GetWorldData(w)
|
||||||
entry, ok := wd.EntityMap[id]
|
// entry, ok := wd.EntityMap[id]
|
||||||
if ok {
|
// if ok {
|
||||||
state := component.BitStateType.Get(entry)
|
// state := component.BitStateType.Get(entry)
|
||||||
state.Bypass.BypassEnable = convertBypassBoolVal(p)
|
// state.Bypass.BypassEnable = convertBypassBoolVal(p)
|
||||||
state.Bypass.OldVal = state.Val
|
// state.Bypass.OldVal = state.Val
|
||||||
} else {
|
// } else {
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的按钮", id))
|
// return ecs.NewErrResult(fmt.Errorf("未找到id=%s的按钮", id))
|
||||||
}
|
// }
|
||||||
return ecs.NewOkEmptyResult()
|
// return ecs.NewOkEmptyResult()
|
||||||
})
|
// })
|
||||||
return result.Err
|
// return result.Err
|
||||||
}
|
//}
|
||||||
func SetBypassSwitchKey(w ecs.World, id string, p request_proto.BypassOperationReq_Operation) error {
|
//func SetBypassSwitchKey(w ecs.World, id string, p request_proto.BypassOperationReq_Operation) error {
|
||||||
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
// result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||||
wd := entity.GetWorldData(w)
|
// wd := entity.GetWorldData(w)
|
||||||
entry, ok := wd.EntityMap[id]
|
// entry, ok := wd.EntityMap[id]
|
||||||
if ok {
|
// if ok {
|
||||||
state := component.GearStateType.Get(entry)
|
// state := component.GearStateType.Get(entry)
|
||||||
state.BypassEnable = convertBypassBoolVal(p)
|
// state.BypassEnable = convertBypassBoolVal(p)
|
||||||
state.OldVal = state.Val == 0
|
// state.OldVal = state.Val == 0
|
||||||
} else {
|
// } else {
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的钥匙开关", id))
|
// return ecs.NewErrResult(fmt.Errorf("未找到id=%s的钥匙开关", id))
|
||||||
}
|
// }
|
||||||
return ecs.NewOkEmptyResult()
|
// return ecs.NewOkEmptyResult()
|
||||||
})
|
// })
|
||||||
return result.Err
|
// return result.Err
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
func convertBypassBoolVal(p request_proto.BypassOperationReq_Operation) bool {
|
//func convertBypassBoolVal(p request_proto.BypassOperationReq_Operation) bool {
|
||||||
val := true
|
// val := true
|
||||||
if p == request_proto.BypassOperationReq_bypass_reset {
|
// if p == request_proto.BypassOperationReq_bypass_reset {
|
||||||
val = false
|
// val = false
|
||||||
}
|
// }
|
||||||
return val
|
// return val
|
||||||
}
|
//}
|
||||||
|
@ -43,10 +43,10 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
p.driveMGJ(psdCircuit, asdList)
|
p.driveMGJ(psdCircuit, asdList)
|
||||||
psdState.Close = component.BitStateType.Get(psdCircuit.MGJ).Val
|
psdState.Close = component.BitStateType.Get(psdCircuit.MGJ).Val
|
||||||
}
|
}
|
||||||
if psdCircuit.MPLJ != nil {
|
//if psdCircuit.MPLJ != nil { 此继电器代表互锁接触,仅需要给联锁采集
|
||||||
p.driveMPLJ(world, psdCircuit, component.UidType.Get(entry))
|
// p.driveMPLJ(world, psdCircuit, component.UidType.Get(entry))
|
||||||
psc.InterlockMPL = component.BitStateType.Get(psdCircuit.MPLJ).Val
|
// psc.InterlockMPL = component.BitStateType.Get(psdCircuit.MPLJ).Val
|
||||||
}
|
//}
|
||||||
//间隙探测驱动
|
//间隙探测驱动
|
||||||
if psdCircuit.QDTCJ != nil && psdCircuit.TZTCJ != nil {
|
if psdCircuit.QDTCJ != nil && psdCircuit.TZTCJ != nil {
|
||||||
p.exciteQDTCJ(worldData, psdCircuit)
|
p.exciteQDTCJ(worldData, psdCircuit)
|
||||||
@ -62,56 +62,51 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
} else {
|
} else {
|
||||||
psdState.Close = p.isAllAsdMotorClosed(asdList)
|
psdState.Close = p.isAllAsdMotorClosed(asdList)
|
||||||
}
|
}
|
||||||
//更新站台门控箱电路及PSC相关状态
|
////更新站台门控箱电路及PSC相关状态
|
||||||
if entry.HasComponent(component.PlatformMkxCircuitType) {
|
//if entry.HasComponent(component.PlatformMkxCircuitType) {
|
||||||
pmc := component.PlatformMkxCircuitType.Get(entry)
|
// pmc := component.PlatformMkxCircuitType.Get(entry)
|
||||||
var pcbTd bool
|
// var pcbTd bool
|
||||||
var pobTd bool
|
// var pobTd bool
|
||||||
var pabTd bool
|
// var pabTd bool
|
||||||
for _, mkxEntry := range pmc.MkxList {
|
// for _, mkxEntry := range pmc.MkxList {
|
||||||
mkx := component.MkxType.Get(mkxEntry)
|
// mkx := component.MkxType.Get(mkxEntry)
|
||||||
//门控箱站台门关闭
|
// //门控箱站台门关闭
|
||||||
pcb := component.BitStateType.Get(mkx.PCB)
|
// pcb := component.BitStateType.Get(mkx.PCB)
|
||||||
if !pcb.BypassEnable {
|
// if !pcb.BypassEnable {
|
||||||
if mkx.PCB != nil && pcb.Val {
|
// if mkx.PCB != nil && pcb.Val {
|
||||||
pcbTd = true
|
// pcbTd = true
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//门控箱站台门打开
|
// //门控箱站台门打开
|
||||||
pob := component.BitStateType.Get(mkx.POB)
|
// pob := component.BitStateType.Get(mkx.POB)
|
||||||
if !pob.BypassEnable {
|
// if !pob.BypassEnable {
|
||||||
if mkx.POB != nil && pob.Val {
|
// if mkx.POB != nil && pob.Val {
|
||||||
pobTd = true
|
// pobTd = true
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//门控箱站台确认
|
// //门控箱站台确认
|
||||||
pab := component.BitStateType.Get(mkx.PAB)
|
// pab := component.BitStateType.Get(mkx.PAB)
|
||||||
if !pab.BypassEnable {
|
// if !pab.BypassEnable {
|
||||||
if mkx.PAB != nil && pab.Val {
|
// if mkx.PAB != nil && pab.Val {
|
||||||
pabTd = true
|
// pabTd = true
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if pmc.PCBJ != nil {
|
// if pmc.PCBJ != nil {
|
||||||
component.RelayDriveType.Get(pmc.PCBJ).Td = pcbTd
|
// component.RelayDriveType.Get(pmc.PCBJ).Td = pcbTd
|
||||||
psc.MkxGM = component.BitStateType.Get(pmc.PCBJ).Val
|
// psc.MkxGM = component.BitStateType.Get(pmc.PCBJ).Val
|
||||||
}
|
// }
|
||||||
if pmc.POBJ != nil {
|
// if pmc.POBJ != nil {
|
||||||
component.RelayDriveType.Get(pmc.POBJ).Td = pobTd
|
// component.RelayDriveType.Get(pmc.POBJ).Td = pobTd
|
||||||
psc.MkxKM = component.BitStateType.Get(pmc.POBJ).Val
|
// psc.MkxKM = component.BitStateType.Get(pmc.POBJ).Val
|
||||||
}
|
// }
|
||||||
if pmc.PABJ != nil {
|
// if pmc.PABJ != nil {
|
||||||
component.RelayDriveType.Get(pmc.PABJ).Td = pabTd
|
// component.RelayDriveType.Get(pmc.PABJ).Td = pabTd
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
//设置滑动门电机通断电状态
|
//设置滑动门电机通断电状态
|
||||||
repo := entity.GetWorldData(world).Repo
|
repo := entity.GetWorldData(world).Repo
|
||||||
psd := repo.FindPsd(component.UidType.Get(entry).Id)
|
psd := repo.FindPsd(component.UidType.Get(entry).Id)
|
||||||
if psc.MkxKM { //优先门控箱的开门
|
|
||||||
p.allKm(asdList)
|
|
||||||
} else if psc.MkxGM { //其次门控箱的关门
|
|
||||||
p.gm(asdList)
|
|
||||||
} else if !psc.InterlockMPL { //联锁操作没有被旁路
|
|
||||||
if psc.InterlockGM {
|
if psc.InterlockGM {
|
||||||
p.gm(asdList)
|
p.gm(asdList)
|
||||||
} else {
|
} else {
|
||||||
@ -127,7 +122,27 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//if psc.MkxKM { //优先门控箱的开门
|
||||||
|
// p.allKm(asdList)
|
||||||
|
//} else if psc.MkxGM { //其次门控箱的关门
|
||||||
|
// p.gm(asdList)
|
||||||
|
//} else if !psc.InterlockMPL { //联锁操作没有被旁路
|
||||||
|
// if psc.InterlockGM {
|
||||||
|
// p.gm(asdList)
|
||||||
|
// } else {
|
||||||
|
// for group, km := range psc.InterlockKmGroup {
|
||||||
|
// if km {
|
||||||
|
// var asdGroup *proto.AsdGroup
|
||||||
|
// if group == 0 {
|
||||||
|
// asdGroup = psd.FindFirstAsdGroup()
|
||||||
|
// } else {
|
||||||
|
// asdGroup = psd.FindAsdGroup(group)
|
||||||
|
// }
|
||||||
|
// p.km(asdGroup.Start, asdGroup.End, asdList)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user