【半实物参数修改】
This commit is contained in:
parent
cd0bffcd36
commit
ab806b8920
@ -213,12 +213,17 @@ func convertVobc(info *dynamics.TrainInfo) *vobc.SendTrainInfo {
|
||||
Speed: uint16(math.Abs(float64(info.Speed * 36))),
|
||||
Upslope: info.UpSlope,
|
||||
Slope: uint16(info.Slope),
|
||||
Acceleration: uint16(info.Acceleration * 100),
|
||||
TotalResistance: uint16(info.TotalResistance / 10),
|
||||
AirResistance: uint16(info.AirResistance / 10),
|
||||
SlopeResistance: uint16(info.SlopeResistance / 10),
|
||||
CurveResistance: uint16(info.CurveResistance / 10),
|
||||
}
|
||||
d := math.Abs(float64(info.Acceleration * 100))
|
||||
if info.Acceleration > 0 {
|
||||
param.Acceleration = uint8(d)
|
||||
} else {
|
||||
param.Deceleration = uint8(d)
|
||||
}
|
||||
return param
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,8 @@ func encoderVobcTrainInfo(info *SendTrainInfo) []byte {
|
||||
}
|
||||
// 中间预留一位
|
||||
data = append(data, 0)
|
||||
data = binary.BigEndian.AppendUint16(data, info.Acceleration) // 加速度 100 = 1 m/s*s
|
||||
data = append(data, info.Acceleration) // 加速度 100 = 1 m/s*s
|
||||
data = append(data, info.Deceleration) // 减速度 100 = 1 m/s*s
|
||||
data = binary.BigEndian.AppendUint16(data, info.TotalResistance) // 实际运行阻力 100 = 1KN
|
||||
data = binary.BigEndian.AppendUint16(data, info.AirResistance) // 空气阻力 100 = 1KN
|
||||
data = binary.BigEndian.AppendUint16(data, info.SlopeResistance) // 坡道阻力 100 = 1KN
|
||||
|
@ -101,7 +101,9 @@ type SendTrainInfo struct {
|
||||
// 坡度值 1= 1‰
|
||||
Slope uint16
|
||||
// 加速度 100 = 1 m/s*s
|
||||
Acceleration uint16
|
||||
Acceleration uint8
|
||||
// 减速度 100 = 1 m/s*s
|
||||
Deceleration uint8
|
||||
// 实际运行阻力 100 = 1KN
|
||||
TotalResistance uint16
|
||||
// 空气阻力 100 = 1KN
|
||||
|
Loading…
Reference in New Issue
Block a user