diff --git a/third_party/message/dynamics_http.go b/third_party/message/dynamics_http.go index b9b9d2a..5e67a2f 100644 --- a/third_party/message/dynamics_http.go +++ b/third_party/message/dynamics_http.go @@ -19,10 +19,11 @@ type RemoveTrainReq struct { // LineBaseInfo 线路基础信息,提供给动力学作为计算依据 type LineBaseInfo struct { - LinkList []*Link `json:"linkList"` - SlopeList []*Slope `json:"slopeList"` - CurveList []*Curve `json:"curveList"` - StopPosition []*StopPosition `json:"stopPositionList"` + LinkList []*Link `json:"linkList"` + SlopeList []*Slope `json:"slopeList"` + CurveList []*Curve `json:"curveList"` + //StopPosition []*StopPosition `json:"stopPositionList"` + StopPosition []*StopPosition `json:"stopList"` } type StopPosition struct { Id int32 `json:"id"` diff --git a/ts/simulation/wayside/memory/wayside_memory_map_init.go b/ts/simulation/wayside/memory/wayside_memory_map_init.go index 4950e9d..d425a9b 100644 --- a/ts/simulation/wayside/memory/wayside_memory_map_init.go +++ b/ts/simulation/wayside/memory/wayside_memory_map_init.go @@ -57,6 +57,7 @@ type StationUidStructure struct { IbpIds map[uint32]*DeviceRelationship CkmIds map[uint32]*DeviceRelationship XcjIds map[uint32]*DeviceRelationship + StopPoint map[uint32]*DeviceRelationship } type RelayUidStructure struct { @@ -270,6 +271,7 @@ func initStationUid(data *data_proto.RtssGraphicStorage) *StationUidStructure { IbpIds: make(map[uint32]*DeviceRelationship, len(data.IbpBoxs)), CkmIds: make(map[uint32]*DeviceRelationship, len(data.GarageDoors)), XcjIds: make(map[uint32]*DeviceRelationship, len(data.CarWashings)), + StopPoint: make(map[uint32]*DeviceRelationship, len(data.StopPositions)), } city, lineId, _ := getUIdPrefix(data.UniqueIdPrefix) // 处理车站信息 @@ -291,6 +293,19 @@ func initStationUid(data *data_proto.RtssGraphicStorage) *StationUidStructure { } } } + // 初始停车点信息 + for _, a := range data.StopPositions { + eid := GetMapElementId(a.Common) + code := getMapELementCode(eid, a.Code) + uid := strconv.Itoa(int(eid)) + gus.StopPoint[eid] = &DeviceRelationship{ + CommonId: eid, + Code: code, + //Uid: BuildUid(city, lineId, strconv.Itoa(int(eid))), + Uid: uid, + //CentralizedStations: gus.StationIds[platform.RefStationId].GetCentralizedStations(), + } + } // 初始化计轴信息 for _, a := range data.AxleCountings { eid := GetMapElementId(a.Common) diff --git a/ts/simulation/wayside/memory/wayside_memory_train.go b/ts/simulation/wayside/memory/wayside_memory_train.go index 9aeacdc..f7f7843 100644 --- a/ts/simulation/wayside/memory/wayside_memory_train.go +++ b/ts/simulation/wayside/memory/wayside_memory_train.go @@ -321,7 +321,7 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess //pointTO 指的是是否ab,或是否到岔心 _, pointTo := QueryDirectionAndABByDevice(vs.Repo, id, port, info.Up) - slog.Info("处理动力学转换后的消息", "number", info.Number, "up", info.Up, "Link", info.Link, "link位置", info.LinkOffset, "outlink位置", outLinkOffset, "车头位置", id, "偏移", offset, "是否上行", true, "是否ab", pointTo, "t1Dir:", info.TrainActToMax, "t2Dir:", info.TrainActToMin) + //slog.Info("处理动力学转换后的消息", "number", info.Number, "up", info.Up, "Link", info.Link, "link位置", info.LinkOffset, "outlink位置", outLinkOffset, "车头位置", id, "偏移", offset, "是否上行", true, "是否ab", pointTo, "t1Dir:", info.TrainActToMax, "t2Dir:", info.TrainActToMin, "acc", info.Acceleration) trainHeadActUp := true if info.TrainActToMax || info.TrainActToMin { if info.TrainActToMin { diff --git a/ts/simulation/wayside/memory/wayside_simulation.go b/ts/simulation/wayside/memory/wayside_simulation.go index 5615442..dad8e43 100644 --- a/ts/simulation/wayside/memory/wayside_simulation.go +++ b/ts/simulation/wayside/memory/wayside_simulation.go @@ -1126,25 +1126,7 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic } repo.CheckPoints = append(repo.CheckPoints, cp) } - //列车停车点 - for _, sp := range storage.StopPositions { - id := GetMapElementId(sp.Common) - psp := &proto.StopPosition{Id: id, Km: convertKm(sp.KilometerSystem)} - var coachNum uint32 = 4 - if sp.CoachNum == data_proto.StopPosition_Six { - coachNum = 6 - } else if sp.CoachNum == data_proto.StopPosition_Four { - coachNum = 4 - } else if sp.CoachNum == data_proto.StopPosition_Eight { - coachNum = 8 - } - psp.CoachNum = coachNum - switch sp.GetRefDev().DeviceType { - case data_proto.RelatedRef_Section: - psp.SectionId = uidsMap.PhysicalSectionIds[sp.GetRefDev().Id].Uid - } - repo.StopPosition = append(repo.StopPosition, psp) - } + //物理区段 for _, data := range storage.Section { var turnoutUids []string @@ -1174,6 +1156,27 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic } repo.PhysicalSections = append(repo.PhysicalSections, physicalSection) } + //列车停车点 + for _, sp := range storage.StopPositions { + //id := GetMapElementId(sp.Common) + psp := &proto.StopPosition{ + Id: uidsMap.StopPoint[GetMapElementId(sp.Common)].Uid, + Km: convertKm(sp.KilometerSystem)} + var coachNum uint32 = 4 + if sp.CoachNum == data_proto.StopPosition_Six { + coachNum = 6 + } else if sp.CoachNum == data_proto.StopPosition_Four { + coachNum = 4 + } else if sp.CoachNum == data_proto.StopPosition_Eight { + coachNum = 8 + } + psp.CoachNum = coachNum + switch sp.RefDev.DeviceType { + case data_proto.RelatedRef_Section: + psp.SectionId = uidsMap.PhysicalSectionIds[sp.RefDev.Id].Uid + } + repo.StopPosition = append(repo.StopPosition, psp) + } //计轴区段 for _, data := range storage.AxleCountingSections { var axleCountingIds []string