From 34aa20ca654a1b328eea581747997c544ea3703b Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Tue, 30 Apr 2024 10:15:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ts/simulation/wayside/memory/wayside_memory_train.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ts/simulation/wayside/memory/wayside_memory_train.go b/ts/simulation/wayside/memory/wayside_memory_train.go index 6b6b970..86f6d27 100644 --- a/ts/simulation/wayside/memory/wayside_memory_train.go +++ b/ts/simulation/wayside/memory/wayside_memory_train.go @@ -22,6 +22,11 @@ import ( "joylink.club/bj-rtsts-server/dto/state_proto" ) +const ( + DEFULAT_TRAIN_LOAD = 160 + DEFAULT_BRAKE_FORCE = 19040 +) + func CreateMsgTrainConfig(trainId int, trainLen int64, configTrainData dto.ConfigTrainData) *message.TrainOperationConfig { return &message.TrainOperationConfig{TrainIndex: trainId, Length: int(trainLen), DavisParamA: configTrainData.DavisParamA, DavisParamB: configTrainData.DavisParamB, @@ -89,7 +94,11 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf status.TailDevicePort = tailDevicePort //初始化列车参数状态 createOrUpdateStateDynamicConfig(status, configTrainData, trainEndsA, trainEndsB) - status.VobcState = &state_proto.TrainVobcState{Tc1Active: true, TrainLoad: int64(configTrainData.TrainLoad), BrakingStatus: true, BrakeForce: 19040} + tl := configTrainData.TrainLoad + if tl <= 0 { + tl = DEFULAT_TRAIN_LOAD + } + status.VobcState = &state_proto.TrainVobcState{Tc1Active: true, TrainLoad: int64(tl), BrakingStatus: true, BrakeForce: DEFAULT_BRAKE_FORCE} if status.RunDirection { status.VobcState.DirectionForward = true } else {