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 {