列车默认值

This commit is contained in:
tiger_zhou 2024-04-30 10:15:20 +08:00
parent 4b77a87785
commit 34aa20ca65
1 changed files with 10 additions and 1 deletions

View File

@ -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 {