diff --git a/repository/repository.go b/repository/repository.go index 620dd41..fff7d00 100644 --- a/repository/repository.go +++ b/repository/repository.go @@ -60,28 +60,32 @@ type Repository struct { func newRepository(id string, version string) *Repository { return &Repository{ - id: id, - version: version, - physicalSectionMap: make(map[string]*PhysicalSection), - checkPointMap: make(map[string]*CheckPoint), - turnoutMap: make(map[string]*Turnout), - signalMap: make(map[string]*Signal), - responderMap: make(map[string]*Transponder), - slopeMap: make(map[string]*Slope), - sectionalCurvatureMap: make(map[string]*SectionalCurvature), - kilometerConvertMap: make(map[string]*proto.KilometerConvert), - relayMap: make(map[string]*Relay), - phaseFailureProtectorMap: make(map[string]*PhaseFailureProtector), - linkMap: make(map[string]*Link), - buttonMap: make(map[string]*Button), - psdMap: make(map[string]*Psd), - lightMap: make(map[string]*Light), - alarmMap: make(map[string]*Alarm), - stationMap: make(map[string]*Station), - psdPslMap: make(map[string]*PsdPsl), - keyMap: make(map[string]*Key), - platformMap: make(map[string]*Platform), - centralizedMap: make(map[string]*proto.CentralizedStationRef), + id: id, + version: version, + physicalSectionMap: make(map[string]*PhysicalSection), + checkPointMap: make(map[string]*CheckPoint), + turnoutMap: make(map[string]*Turnout), + signalMap: make(map[string]*Signal), + responderMap: make(map[string]*Transponder), + slopeMap: make(map[string]*Slope), + sectionalCurvatureMap: make(map[string]*SectionalCurvature), + kilometerConvertMap: make(map[string]*proto.KilometerConvert), + relayMap: make(map[string]*Relay), + phaseFailureProtectorMap: make(map[string]*PhaseFailureProtector), + linkMap: make(map[string]*Link), + buttonMap: make(map[string]*Button), + psdMap: make(map[string]*Psd), + lightMap: make(map[string]*Light), + alarmMap: make(map[string]*Alarm), + stationMap: make(map[string]*Station), + psdPslMap: make(map[string]*PsdPsl), + keyMap: make(map[string]*Key), + platformMap: make(map[string]*Platform), + 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 管线 PipeFittingMap: make(map[string]*PipeFitting), //ISCS 管件 CircuitBreakerMap: make(map[string]*CircuitBreaker), //ISCS 断路器 diff --git a/sys/circuit_sys/ckm.go b/sys/circuit_sys/ckm.go index dee1edc..6704014 100644 --- a/sys/circuit_sys/ckm.go +++ b/sys/circuit_sys/ckm.go @@ -27,13 +27,13 @@ func (p *CkmSys) Update(world ecs.World) { return } posCom := component.FixedPositionTransformType.Get(entry) - remote := true //是否远程模式 + local := true //是否本地模式 circuit := component.CkmCircuitType.Get(entry) //目前不考虑没有车库门电路的情况 //车库门PSL if entry.HasComponent(component.CkmPslType) { ckmPsl := component.CkmPslType.Get(entry) 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 { @@ -46,7 +46,11 @@ func (p *CkmSys) Update(world ecs.World) { //门故障继电器及状态 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) if err == nil { component.RelayDriveType.Get(circuit.KMJ).Td = kmBit @@ -59,10 +63,6 @@ func (p *CkmSys) Update(world ecs.World) { } else { 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 {