【bug】车库门操作、状态发送等逻辑中的bug

This commit is contained in:
thesai 2024-03-27 14:15:34 +08:00
parent 01b0655eb5
commit 33ed496dcd
2 changed files with 33 additions and 29 deletions

View File

@ -60,28 +60,32 @@ type Repository struct {
func newRepository(id string, version string) *Repository { func newRepository(id string, version string) *Repository {
return &Repository{ return &Repository{
id: id, id: id,
version: version, version: version,
physicalSectionMap: make(map[string]*PhysicalSection), physicalSectionMap: make(map[string]*PhysicalSection),
checkPointMap: make(map[string]*CheckPoint), checkPointMap: make(map[string]*CheckPoint),
turnoutMap: make(map[string]*Turnout), turnoutMap: make(map[string]*Turnout),
signalMap: make(map[string]*Signal), signalMap: make(map[string]*Signal),
responderMap: make(map[string]*Transponder), responderMap: make(map[string]*Transponder),
slopeMap: make(map[string]*Slope), slopeMap: make(map[string]*Slope),
sectionalCurvatureMap: make(map[string]*SectionalCurvature), sectionalCurvatureMap: make(map[string]*SectionalCurvature),
kilometerConvertMap: make(map[string]*proto.KilometerConvert), kilometerConvertMap: make(map[string]*proto.KilometerConvert),
relayMap: make(map[string]*Relay), relayMap: make(map[string]*Relay),
phaseFailureProtectorMap: make(map[string]*PhaseFailureProtector), phaseFailureProtectorMap: make(map[string]*PhaseFailureProtector),
linkMap: make(map[string]*Link), linkMap: make(map[string]*Link),
buttonMap: make(map[string]*Button), buttonMap: make(map[string]*Button),
psdMap: make(map[string]*Psd), psdMap: make(map[string]*Psd),
lightMap: make(map[string]*Light), lightMap: make(map[string]*Light),
alarmMap: make(map[string]*Alarm), alarmMap: make(map[string]*Alarm),
stationMap: make(map[string]*Station), stationMap: make(map[string]*Station),
psdPslMap: make(map[string]*PsdPsl), psdPslMap: make(map[string]*PsdPsl),
keyMap: make(map[string]*Key), keyMap: make(map[string]*Key),
platformMap: make(map[string]*Platform), platformMap: make(map[string]*Platform),
centralizedMap: make(map[string]*proto.CentralizedStationRef), centralizedMap: make(map[string]*proto.CentralizedStationRef),
ckmMap: make(map[string]*Ckm),
ckmPslMap: make(map[string]*CkmPsl),
xcjMap: make(map[string]*Xcj),
PipeMap: make(map[string]*Pipe), //ISCS 管线 PipeMap: make(map[string]*Pipe), //ISCS 管线
PipeFittingMap: make(map[string]*PipeFitting), //ISCS 管件 PipeFittingMap: make(map[string]*PipeFitting), //ISCS 管件
CircuitBreakerMap: make(map[string]*CircuitBreaker), //ISCS 断路器 CircuitBreakerMap: make(map[string]*CircuitBreaker), //ISCS 断路器

View File

@ -27,13 +27,13 @@ func (p *CkmSys) Update(world ecs.World) {
return return
} }
posCom := component.FixedPositionTransformType.Get(entry) posCom := component.FixedPositionTransformType.Get(entry)
remote := true //是否远程模式 local := true //是否本地模式
circuit := component.CkmCircuitType.Get(entry) //目前不考虑没有车库门电路的情况 circuit := component.CkmCircuitType.Get(entry) //目前不考虑没有车库门电路的情况
//车库门PSL //车库门PSL
if entry.HasComponent(component.CkmPslType) { if entry.HasComponent(component.CkmPslType) {
ckmPsl := component.CkmPslType.Get(entry) ckmPsl := component.CkmPslType.Get(entry)
component.RelayDriveType.Get(circuit.MPLJ).Td = component.BitStateType.Get(ckmPsl.MPLA).Val component.RelayDriveType.Get(circuit.MPLJ).Td = component.BitStateType.Get(ckmPsl.MPLA).Val
remote = component.BitStateType.Get(ckmPsl.MMSA).Val local = component.BitStateType.Get(ckmPsl.MMSA).Val
} }
//门开/关继电器及状态 //门开/关继电器及状态
if posCom.Pos == consts.TwoPosMin { if posCom.Pos == consts.TwoPosMin {
@ -46,7 +46,11 @@ func (p *CkmSys) Update(world ecs.World) {
//门故障继电器及状态 //门故障继电器及状态
component.RelayDriveType.Get(circuit.MGZJ).Td = entry.HasComponent(component.CkmStateLossTag) component.RelayDriveType.Get(circuit.MGZJ).Td = entry.HasComponent(component.CkmStateLossTag)
//开/关门继电器驱动状态 //开/关门继电器驱动状态
if remote { if local {
ckmPsl := component.CkmPslType.Get(entry)
component.RelayDriveType.Get(circuit.KMJ).Td = component.BitStateType.Get(ckmPsl.KMA).Val
component.RelayDriveType.Get(circuit.GMJ).Td = component.BitStateType.Get(ckmPsl.GMA).Val
} else {
kmBit, err := worldData.QueryQdBit(component.UidType.Get(circuit.KMJ).Id) kmBit, err := worldData.QueryQdBit(component.UidType.Get(circuit.KMJ).Id)
if err == nil { if err == nil {
component.RelayDriveType.Get(circuit.KMJ).Td = kmBit component.RelayDriveType.Get(circuit.KMJ).Td = kmBit
@ -59,10 +63,6 @@ func (p *CkmSys) Update(world ecs.World) {
} else { } else {
slog.Error(err.Error()) slog.Error(err.Error())
} }
} else {
ckmPsl := component.CkmPslType.Get(entry)
component.RelayDriveType.Get(circuit.KMJ).Td = component.BitStateType.Get(ckmPsl.KMA).Val
component.RelayDriveType.Get(circuit.GMJ).Td = component.BitStateType.Get(ckmPsl.GMA).Val
} }
//驱动 //驱动
if component.BitStateType.Get(circuit.GMJ).Val { if component.BitStateType.Get(circuit.GMJ).Val {