Merge remote-tracking branch 'origin/master'

This commit is contained in:
joylink_zhangsai 2024-01-18 14:00:39 +08:00
commit 8d91ef9ce5
3 changed files with 10 additions and 68 deletions

View File

@ -235,37 +235,6 @@ func addTrain(c *gin.Context) {
RunDirection: req.RunDirection,
TrainLength: req.TrainLength,
WheelDiameter: req.WheelDiameter,
/*TrainDynamicConfig: &state_proto.TrainDynamicConfig{
//int32 mass=1;
//基本阻力参数A
BaseResistanceParamA: req.ConfigTrain.BaseResistanceParamA,
// 基本阻力参数B
BaseResistanceParamB: req.ConfigTrain.BaseResistanceParamB,
// 基本阻力参数C
BaseResistanceParamC: req.ConfigTrain.BaseResistanceParamC,
//曲线阻力参数R1
CurveResistanceParamR1: req.ConfigTrain.CurveResistanceParamR1,
// 曲线阻力参数R2
CurveResistanceParamR2: req.ConfigTrain.CurveResistanceParamR2,
// 曲线阻力参数R3
CurveResistanceParamR3: req.ConfigTrain.CurveResistanceParamR3,
// 曲线阻力参数R4
CurveResistanceParamR4: req.ConfigTrain.CurveResistanceParamR4,
//旋转质量参数
RevolvingMassParam: req.ConfigTrain.RevolvingMassParam,
//是否跳跃
Jump: req.ConfigTrain.Jump,
//打滑(%
Slip: req.ConfigTrain.Slip,
//前溜/后溜mm正数前溜负数后溜
Slide: req.ConfigTrain.Slide,
//过标/欠标mm正数过标负数欠标
StopSign: req.ConfigTrain.StopSign,
//车径
//WheelDiameter: req.ConfigTrain.WheelDiameter,
TrainEndsA: memory.DtoTrainEndsToStateProto(req.ConfigTrain.TrainEndsA),
TrainEndsB: memory.DtoTrainEndsToStateProto(req.ConfigTrain.TrainEndsB),
},*/
}
memory.AddTrainStateNew(simulation, rsp, req.ConfigTrain, req.TrainEndsA, req.TrainEndsB, req.MapId)
c.JSON(http.StatusOK, &rsp)

View File

@ -69,17 +69,10 @@ func TrainConfigToProtoConvert(t *dto.ConfigTrainData) *common_proto.TrainDynami
return nil
}
return &common_proto.TrainDynamicConfig{
BaseResistanceParamA: t.BaseResistanceParamA,
BaseResistanceParamB: t.BaseResistanceParamB,
BaseResistanceParamC: t.BaseResistanceParamC,
CurveResistanceParamR1: t.CurveResistanceParamR1,
CurveResistanceParamR2: t.CurveResistanceParamR2,
CurveResistanceParamR3: t.CurveResistanceParamR3,
CurveResistanceParamR4: t.CurveResistanceParamR4,
Jump: t.Jump,
Slip: t.Slip,
Slide: t.Slide,
StopSign: t.StopSign,
BaseResistanceParamA: t.BaseResistanceParamA, BaseResistanceParamB: t.BaseResistanceParamB, BaseResistanceParamC: t.BaseResistanceParamC,
CurveResistanceParamR1: t.CurveResistanceParamR1, CurveResistanceParamR2: t.CurveResistanceParamR2, CurveResistanceParamR3: t.CurveResistanceParamR3, CurveResistanceParamR4: t.CurveResistanceParamR4,
Jump: t.Jump, Slip: t.Slip,
Slide: t.Slide, StopSign: t.StopSign,
}
}

View File

@ -78,15 +78,6 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
TailLinkOffset: tailLOffset,
RunningUp: up,
}
/* status.TrainDynamicConfig = &state_proto.TrainDynamicConfig{
BaseResistanceParamA: configTrainData.BaseResistanceParamA, BaseResistanceParamB: configTrainData.BaseResistanceParamB,
BaseResistanceParamC: configTrainData.BaseResistanceParamC, CurveResistanceParamR1: configTrainData.CurveResistanceParamR1,
CurveResistanceParamR2: configTrainData.CurveResistanceParamR2, CurveResistanceParamR3: configTrainData.CurveResistanceParamR3,
CurveResistanceParamR4: configTrainData.CurveResistanceParamR4, RevolvingMassParam: configTrainData.RevolvingMassParam,
Jump: configTrainData.Jump, Slip: configTrainData.Slip,
Slide: configTrainData.Slide, StopSign: configTrainData.StopSign,
TrainEndsA: DtoTrainEndsToStateProto(configTrainData.TrainEndsA),
TrainEndsB: DtoTrainEndsToStateProto(configTrainData.TrainEndsB)}*/
//初始化列车参数状态
createOrUpdateStateDynamicConfig(status, configTrainData, trainEndsA, trainEndsB)
status.VobcState = &state_proto.TrainVobcState{}
@ -194,23 +185,12 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
func createOrUpdateStateDynamicConfig(trainState *state_proto.TrainState, configTrainData dto.ConfigTrainData, trainEndsA dto.ConfigTrainEnds,
trainEndsB dto.ConfigTrainEnds) {
trainState.TrainDynamicConfig = service.TrainConfigToProtoConvert(&configTrainData)
/*if trainState.TrainDynamicConfig == nil {
trainState.TrainDynamicConfig = &common_proto.TrainDynamicConfig{}
}
trainState.TrainDynamicConfig.BaseResistanceParamA = configTrainData.BaseResistanceParamA
trainState.TrainDynamicConfig.BaseResistanceParamB = configTrainData.BaseResistanceParamB
trainState.TrainDynamicConfig.BaseResistanceParamC = configTrainData.BaseResistanceParamC
trainState.TrainDynamicConfig.CurveResistanceParamR1 = configTrainData.CurveResistanceParamR1
trainState.TrainDynamicConfig.CurveResistanceParamR2 = configTrainData.CurveResistanceParamR2
trainState.TrainDynamicConfig.CurveResistanceParamR3 = configTrainData.CurveResistanceParamR3
trainState.TrainDynamicConfig.CurveResistanceParamR4 = configTrainData.CurveResistanceParamR4
trainState.TrainDynamicConfig.Jump = configTrainData.Jump
trainState.TrainDynamicConfig.Slip = configTrainData.Slip
trainState.TrainDynamicConfig.Slide = configTrainData.Slide
trainState.TrainDynamicConfig.StopSign = configTrainData.StopSign*/
if trainState.TrainDynamicConfig == nil {
slog.Error("")
} else {
copyTrainEnds(trainState, "TrainEndsA", trainEndsA)
copyTrainEnds(trainState, "TrainEndsB", trainEndsB)
}
}
func copyTrainEnds(trainState *state_proto.TrainState, fieldName string, configData dto.ConfigTrainEnds) {
@ -221,7 +201,7 @@ func copyTrainEnds(trainState *state_proto.TrainState, fieldName string, configD
fieldVal.Set(reflect.ValueOf(endsVal))
}
endsVal.SpeedSensorEnableA = configData.SpeedSensorEnableA
endsVal.SpeedSensorEnableA = configData.SpeedSensorEnableB
endsVal.SpeedSensorEnableB = configData.SpeedSensorEnableB
endsVal.RadarEnable = configData.RadarEnable
endsVal.RadarCheckSpeed = configData.RadarCheckSpeed
endsVal.RadarCheckTime = configData.RadarCheckTime