【动力学火车接口增加列车长度】

This commit is contained in:
weizhihong 2023-08-24 10:24:56 +08:00
parent 6bd4013bfc
commit af28993e24
2 changed files with 9 additions and 7 deletions

View File

@ -32,11 +32,12 @@ func AddTrainState(simulation *VerifySimulation, status *state.TrainState) {
status.Up = up status.Up = up
status.PointTo = pointTo status.PointTo = pointTo
httpCode, _, err := dynamics.SendInitTrainReq(&dynamics.InitTrainInfo{ httpCode, _, err := dynamics.SendInitTrainReq(&dynamics.InitTrainInfo{
TrainIndex: uint16(trainIndex), TrainIndex: uint16(trainIndex),
LinkIndex: uint16(linkId), LinkIndex: uint16(linkId),
LinkOffset: uint32(loffset), LinkOffset: uint32(loffset),
Speed: uint16(math.Round(float64(status.Speed * 10))), Speed: uint16(math.Round(float64(status.Speed * 10))),
Up: status.Up, Up: status.Up,
TrainLength: uint16(status.TrainLength),
}) })
zap.S().Debugf("添加列车:[%d-%s-%d]", trainIndex, status.HeadLinkId, status.HeadLinkOffset) zap.S().Debugf("添加列车:[%d-%s-%d]", trainIndex, status.HeadLinkId, status.HeadLinkOffset)
zap.S().Debugf("列车初始化:[%d-%d-%d]", trainIndex, linkId, loffset) zap.S().Debugf("列车初始化:[%d-%d-%d]", trainIndex, linkId, loffset)

View File

@ -5,8 +5,9 @@ type InitTrainInfo struct {
LinkIndex uint16 `json:"linkIndex"` LinkIndex uint16 `json:"linkIndex"`
LinkOffset uint32 `json:"linkOffset"` LinkOffset uint32 `json:"linkOffset"`
//单位0.1km/h //单位0.1km/h
Speed uint16 `json:"speed"` Speed uint16 `json:"speed"`
Up bool `json:"up"` Up bool `json:"up"`
TrainLength uint16 `json:"trainLength"`
} }
// LineBaseInfo 线路基础信息,提供给动力学作为计算依据 // LineBaseInfo 线路基础信息,提供给动力学作为计算依据