增加车尾设备及偏移量状态赋值逻辑

This commit is contained in:
thesai 2024-02-06 18:00:39 +08:00
parent 35246756fc
commit 0bdc8481e2
4 changed files with 569 additions and 542 deletions

@ -1 +1 @@
Subproject commit 71be4e2c1410225c4ef032313e4c05a3612c5a0d
Subproject commit 46bff1474133e89efc75151b0a3853cf9fa869ea

File diff suppressed because it is too large Load Diff

View File

@ -399,6 +399,8 @@ func convertTrainState(v *state_proto.TrainState) *state_proto.TrainMapState {
TrainEndsA: &state_proto.TrainEndsStateMqtt{},
TrainEndsB: &state_proto.TrainEndsStateMqtt{},
TrainDynamicConfig: &state_proto.TrainDynamicConfigMqtt{},
TailDeviceId: v.TailDeviceId,
TailOffset: v.TailOffset,
BtmState: v.BtmState,
}
convertDynamicConfig(v.TrainDynamicConfig, t.TrainDynamicConfig)

View File

@ -264,7 +264,7 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
//slog.Debug("处理动力学转换后的消息", "number", info.Number, "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
// 车尾相对车头link的偏移量
calctailOffset := calcTrailTailOffset(outLinkOffset, int64(info.Len), info.Up)
tailLinkId, _, _, tailLinkOffset, _, _, e2 := CalcInitializeLink(vs, outLinkId, calctailOffset, info.Up)
tailLinkId, tailDeviceId, _, tailLinkOffset, tailOffset, _, e2 := CalcInitializeLink(vs, outLinkId, calctailOffset, info.Up)
if e2 != nil {
panic(sys_error.New("动力学传输数据:列车车尾位置计算出错", e2))
}
@ -308,6 +308,8 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
if info.Speed < 0 {
sta.RunDirection = !sta.RunDirection
}
sta.TailDeviceId = vs.GetComIdByUid(tailDeviceId)
sta.TailOffset = tailOffset
// 赋值动力学信息
sta.DynamicState.Heartbeat = int32(info.LifeSignal)
sta.DynamicState.HeadLinkId = outLinkId