diff --git a/bj-rtss-message b/bj-rtss-message index 6e8fecb..63774c3 160000 --- a/bj-rtss-message +++ b/bj-rtss-message @@ -1 +1 @@ -Subproject commit 6e8fecb59b22e10c00398820076edb1a84d825ba +Subproject commit 63774c3fa82b3831a06d7b2b68675677d6fd5e1e diff --git a/message_server/psl_ms.go b/message_server/psl_ms.go index 0aa2390..c592bea 100644 --- a/message_server/psl_ms.go +++ b/message_server/psl_ms.go @@ -32,7 +32,7 @@ func NewPSLMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask { func collectGateBoxPSLState(world ecs.World, mapId int32, box *data_proto.GatedBox) (*state_proto.PushedDevicesStatus, error) { did := memory.GetMapElementId(box.Common) uidStructure := memory.QueryUidStructure[*memory.StationUidStructure](mapId) - boxUid := uidStructure.GateBoxIds[did].Uid + boxUid := uidStructure.PslIds[did].Uid mkxEntry, ok := entity.GetEntityByUid(world, boxUid) if !ok { return nil, fmt.Errorf("[id:%s]的门控箱实体找不到", boxUid) diff --git a/rtss_simulation b/rtss_simulation index 7ec4eb4..7694e09 160000 --- a/rtss_simulation +++ b/rtss_simulation @@ -1 +1 @@ -Subproject commit 7ec4eb44e42ff61ba906f914ffc882b210391883 +Subproject commit 7694e092231530cbfa1d838902d802ca8c1de336 diff --git a/ts/simulation/wayside/memory/wayside_memory_map_init.go b/ts/simulation/wayside/memory/wayside_memory_map_init.go index 57e60f2..7eb2da2 100644 --- a/ts/simulation/wayside/memory/wayside_memory_map_init.go +++ b/ts/simulation/wayside/memory/wayside_memory_map_init.go @@ -34,8 +34,9 @@ type StationUidStructure struct { StationIds map[uint32]*elementIdStructure PlatformIds map[uint32]*elementIdStructure PsdIds map[uint32]*elementIdStructure - GateBoxIds map[uint32]*elementIdStructure + PslIds map[uint32]*elementIdStructure SpksSwitchIds map[uint32]*elementIdStructure + IbpIds map[uint32]*elementIdStructure } type RelayUidStructure struct { @@ -245,8 +246,9 @@ func initStationUid(data *data_proto.RtssGraphicStorage) *StationUidStructure { StationIds: make(map[uint32]*elementIdStructure, len(data.Stations)), PlatformIds: make(map[uint32]*elementIdStructure, len(data.Platforms)), PsdIds: make(map[uint32]*elementIdStructure, len(data.ScreenDoors)), - GateBoxIds: make(map[uint32]*elementIdStructure, len(data.GateBoxs)), - SpksSwitchIds: make(map[uint32]*elementIdStructure, len(data.SpksSwitchs)), + PslIds: make(map[uint32]*elementIdStructure, len(data.GateBoxs)), + //SpksSwitchIds: make(map[uint32]*elementIdStructure, len(data.SpksSwitchs)), + IbpIds: make(map[uint32]*elementIdStructure, len(data.IbpBoxs)), } city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix) // 处理车站信息 @@ -368,50 +370,58 @@ func initStationUid(data *data_proto.RtssGraphicStorage) *StationUidStructure { } } // 屏蔽门 - psd_station_map := make(map[uint32]string) for _, door := range data.ScreenDoors { station := stationMap[platformMap[door.RefPlatformId].GetRefStationId()] if station == nil { //线路数据有问题 continue } eid := GetMapElementId(door.Common) - psd_station_map[eid] = station.StationName gus.PsdIds[eid] = &elementIdStructure{ CommonId: eid, Code: door.Code, Uid: GenerateElementUid(city, lineId, []string{station.StationName}, door.Code), } } - // 门控箱 - for _, box := range data.GateBoxs { - stationName := psd_station_map[box.RefScreenDoor] + // PSL + for _, box := range data.PslBoxs { + stationName := stationMap[platformMap[box.RefPlatformId].RefStationId].StationName eid := GetMapElementId(box.Common) - gus.GateBoxIds[eid] = &elementIdStructure{ + gus.PslIds[eid] = &elementIdStructure{ CommonId: eid, Code: box.Code, Uid: GenerateElementUid(city, lineId, []string{stationName}, box.Code), } } - // SPKS人员防护 - for _, spk := range data.SpksSwitchs { - if spk.RefStand == 0 { - continue - } - platform := platformMap[spk.RefStand] - if platform == nil { - continue - } - station := gus.StationIds[platform.RefStationId] - if station == nil { - continue - } - eid := GetMapElementId(spk.Common) - gus.SpksSwitchIds[eid] = &elementIdStructure{ + // IBP + for _, box := range data.IbpBoxs { + stationName := stationMap[box.RefStationId].StationName + eid := GetMapElementId(box.Common) + gus.IbpIds[eid] = &elementIdStructure{ CommonId: eid, - Code: spk.Code, - Uid: station.Uid + "_key_SPKS_" + spk.Code, + Code: box.Code, + Uid: GenerateElementUid(city, lineId, []string{stationName}, box.Code), } } + //// SPKS人员防护 + //for _, spk := range data.SpksSwitchs { + // if spk.RefStand == 0 { + // continue + // } + // platform := platformMap[spk.RefStand] + // if platform == nil { + // continue + // } + // station := gus.StationIds[platform.RefStationId] + // if station == nil { + // continue + // } + // eid := GetMapElementId(spk.Common) + // gus.SpksSwitchIds[eid] = &elementIdStructure{ + // CommonId: eid, + // Code: spk.Code, + // Uid: station.Uid + "_key_SPKS_" + spk.Code, + // } + //} return gus } diff --git a/ts/simulation/wayside/memory/wayside_memory_psl.go b/ts/simulation/wayside/memory/wayside_memory_psl.go index ba7b70f..50e6b2e 100644 --- a/ts/simulation/wayside/memory/wayside_memory_psl.go +++ b/ts/simulation/wayside/memory/wayside_memory_psl.go @@ -7,7 +7,7 @@ import ( // 操作PSL按钮 func ChangePSLButtonState(sim *VerifySimulation, mapId int32, gateBoxId uint32, btnCode string, pressDown bool) { uid := QueryUidStructure[*StationUidStructure](mapId) - gateBoxUid := uid.GateBoxIds[gateBoxId].Uid + gateBoxUid := uid.PslIds[gateBoxId].Uid if pressDown { fi.PressDownButton(sim.World, gateBoxUid+"_"+btnCode) } else { diff --git a/ts/simulation/wayside/memory/wayside_simulation.go b/ts/simulation/wayside/memory/wayside_simulation.go index 3fa068d..728f8ea 100644 --- a/ts/simulation/wayside/memory/wayside_simulation.go +++ b/ts/simulation/wayside/memory/wayside_simulation.go @@ -1002,6 +1002,7 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic repo.MainCoordinateSystem = storage.UniqueIdPrefix.MainCoordinateSystem axleCountingMap := make(map[uint32]*data_proto.AxleCounting) uidsMap := QueryUidStructure[*StationUidStructure](mapId) + //计轴 for _, data := range storage.AxleCountings { id := GetMapElementId(data.Common) axleCountingMap[id] = data @@ -1019,6 +1020,7 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic } repo.CheckPoints = append(repo.CheckPoints, cp) } + //区段 for _, data := range storage.Section { var turnoutUids []string if data.SectionType == data_proto.Section_TurnoutPhysical { @@ -1043,6 +1045,7 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic } repo.PhysicalSections = append(repo.PhysicalSections, physicalSection) } + //道岔 for _, data := range storage.Turnouts { var km *proto.Kilometer for _, ks := range data.KilometerSystem { @@ -1066,6 +1069,7 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic } repo.Turnouts = append(repo.Turnouts, turnout) } + //信号机 for _, data := range storage.Signals { signal := &proto.Signal{ Id: uidsMap.SignalIds[GetMapElementId(data.Common)].Uid, @@ -1081,6 +1085,7 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic repo.Signals = append(repo.Signals, signal) } stm := make(map[string][]string) + //应答器 for _, data := range storage.Transponders { fixedTelegram, err := hex.DecodeString(data.FixedTelegram) if err != nil { @@ -1113,9 +1118,11 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic repo.Transponders = append(repo.Transponders, responder) } slopeKsMap := make(map[uint32]*data_proto.SlopeKiloMarker) + //坡度公里标 for _, data := range storage.SlopeKiloMarker { slopeKsMap[GetMapElementId(data.Common)] = data } + //坡度 for _, data := range storage.Slopes { var kms []*proto.Kilometer for _, id := range data.RefDeviceId { @@ -1129,9 +1136,11 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic repo.Slopes = append(repo.Slopes, slope) } curveKsMap := make(map[uint32]*data_proto.CurvatureKiloMarker) + //曲度公里标 for _, data := range storage.CurvatureKiloMarker { curveKsMap[GetMapElementId(data.Common)] = data } + //曲度 for _, data := range storage.Curvatures { var kms []*proto.Kilometer for _, id := range data.RefDeviceId { @@ -1144,6 +1153,7 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic } repo.SectionalCurvatures = append(repo.SectionalCurvatures, slope) } + //公里标转换 for _, data := range storage.KilometerConvertList { repo.KilometerConverts = append(repo.KilometerConverts, &proto.KilometerConvert{ KmA: convertKm(data.KmA), @@ -1165,11 +1175,13 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic relateMap[data.Code] = data } // 处理车站信息 + repoStationMap := make(map[uint32]*proto.Station) for _, data := range storage.Stations { station := &proto.Station{ Id: uidsMap.StationIds[GetMapElementId(data.Common)].Uid, Code: data.StationName, } + repoStationMap[GetMapElementId(data.Common)] = station // 关联车站的设备 refs, ok := relateMap[station.Code] if ok { @@ -1190,8 +1202,8 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic station.ElectronicGroup = append(station.ElectronicGroup, group) } } - // 处理车站关联IBP的设备 - handlerIBPDeviceToStation(station, repo, data.RefIbpMapCode) + //// 处理车站关联IBP的设备 + //handlerIBPDeviceToStation(station, repo, data.RefIbpMapCode) repo.Stations = append(repo.Stations, station) // 处理集中站的信息 if stm[station.Code] != nil { @@ -1199,15 +1211,48 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic ref.TransponderId = append(ref.TransponderId, stm[station.Code]...) } } - //门控箱 - for _, data := range storage.GateBoxs { - boxUidInfo := uidsMap.GateBoxIds[GetMapElementId(data.Common)] + //站台 + platformMap := make(map[uint32]*data_proto.Platform) + for _, data := range storage.Platforms { + platformId := GetMapElementId(data.Common) + platformMap[platformId] = data + platform := &proto.Platform{ + Id: uidsMap.PlatformIds[platformId].Uid, + Code: data.Code, + } + repo.Platforms = append(repo.Platforms, platform) + platform.StationId = uidsMap.StationIds[data.RefStationId].Uid + platform.PhysicalSectionId = uidsMap.PhysicalSectionIds[data.RefSectionId].Uid + } + //屏蔽门 + platformId_psdUid_map := make(map[uint32]string) + for _, data := range storage.ScreenDoors { + var asdGroups []*proto.AsdGroup + for _, group := range storage.ScreenDoorConfig.ScreenDoorGroupList { + asdGroups = append(asdGroups, &proto.AsdGroup{ + Group: group.TrainGroupAmount, + Start: group.StartSmallDoor, + End: group.EndSmallDoor, + }) + } + psd := &proto.Psd{ + Id: uidsMap.PsdIds[GetMapElementId(data.Common)].Uid, + AsdAmount: storage.ScreenDoorConfig.SonDoorAmount, + AsdGroups: asdGroups, + PlatformId: uidsMap.PlatformIds[data.RefPlatformId].Uid, + } + platformId_psdUid_map[data.GetRefPlatformId()] = psd.Id + repo.Psds = append(repo.Psds, psd) + } + //PSL + for _, data := range storage.PslBoxs { + boxUidInfo := uidsMap.PslIds[GetMapElementId(data.Common)] mkx := &proto.Mkx{ Id: boxUidInfo.Uid, - PsdId: uidsMap.PsdIds[data.RefScreenDoor].Uid, + PsdId: platformId_psdUid_map[data.RefPlatformId], } repo.Mkxs = append(repo.Mkxs, mkx) - _, pslStorage := QueryGiDataByName[*data_proto.PslGraphicStorage](data.RefGatedBoxMapCode) + _, pslStorage := QueryGiDataByName[*data_proto.PslGraphicStorage](data.RefPslMapCode) for _, button := range pslStorage.PslButtons { repoButton := &proto.Button{ Id: boxUidInfo.Uid + "_" + button.Code, @@ -1244,36 +1289,10 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic } } } - //站台 - platformMap := make(map[uint32]*data_proto.Platform) - for _, data := range storage.Platforms { - platformId := GetMapElementId(data.Common) - platformMap[platformId] = data - platform := &proto.Platform{ - Id: uidsMap.PlatformIds[platformId].Uid, - Code: data.Code, - } - repo.Platforms = append(repo.Platforms, platform) - platform.StationId = uidsMap.StationIds[data.RefStationId].Uid - platform.PhysicalSectionId = uidsMap.PhysicalSectionIds[data.RefSectionId].Uid - } - //屏蔽门 - for _, data := range storage.ScreenDoors { - var asdGroups []*proto.AsdGroup - for _, group := range storage.ScreenDoorConfig.ScreenDoorGroupList { - asdGroups = append(asdGroups, &proto.AsdGroup{ - Group: group.TrainGroupAmount, - Start: group.StartSmallDoor, - End: group.EndSmallDoor, - }) - } - psd := &proto.Psd{ - Id: uidsMap.PsdIds[GetMapElementId(data.Common)].Uid, - AsdAmount: storage.ScreenDoorConfig.SonDoorAmount, - AsdGroups: asdGroups, - PlatformId: uidsMap.PlatformIds[data.RefPlatformId].Uid, - } - repo.Psds = append(repo.Psds, psd) + //IBP + for _, data := range storage.IbpBoxs { + station := repoStationMap[data.RefStationId] + handlerIBPDeviceToStation(station, repo, data.RefIbpMapCode) } }