Compare commits
No commits in common. "e7f6f8e74d7e6dcdb408b105769643cbe0ed420f" and "2569265a1fe58119938eeaa2050bae304adc9969" have entirely different histories.
e7f6f8e74d
...
2569265a1f
3
third_party/message/dynamics.go
vendored
3
third_party/message/dynamics.go
vendored
@ -3,7 +3,6 @@ package message
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DynamicsTurnoutInfo struct {
|
||||
@ -81,7 +80,6 @@ type DynamicsTrainInfo struct {
|
||||
Displacement uint16
|
||||
TrainActToMax bool
|
||||
TrainActToMin bool
|
||||
UpdateTime int64
|
||||
}
|
||||
|
||||
// 解析动力学的列车信息
|
||||
@ -120,6 +118,5 @@ func (t *DynamicsTrainInfo) Decode(buf []byte) error {
|
||||
t.Acceleration = math.Float32frombits(binary.BigEndian.Uint32(buf[60:64]))
|
||||
t.VobcLifeSignal = binary.BigEndian.Uint16(buf[64:66])
|
||||
t.Displacement = binary.BigEndian.Uint16(buf[66:68])
|
||||
t.UpdateTime = time.Now().UnixMilli()
|
||||
return nil
|
||||
}
|
||||
|
@ -293,7 +293,6 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
|
||||
sta := data.(*state_proto.TrainState)
|
||||
delayTime := time.Now().UnixMilli() - sta.VobcState.UpdateTime
|
||||
sta.ControlDelayTime = (int64(sta.VobcState.LifeSignal)-int64(info.VobcLifeSignal))*20 + delayTime
|
||||
|
||||
//slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset)
|
||||
inLinkId, inLinkOffset := strconv.Itoa(int(info.Link)), int64(info.LinkOffset)
|
||||
|
||||
@ -464,13 +463,7 @@ func removeTrain(vs *VerifySimulation, trainId string, train *state_proto.TrainS
|
||||
return err
|
||||
}
|
||||
}
|
||||
if train.VobcState != nil {
|
||||
vobc := train.VobcState
|
||||
vobc.TractionStatus = false
|
||||
vobc.BrakingStatus = true
|
||||
vobc.TractionForce = 0
|
||||
vobc.BrakeForce = DEFAULT_BRAKE_FORCE
|
||||
}
|
||||
|
||||
train.Show = false
|
||||
train.ConnState.ConnType = state_proto.TrainConnState_NONE
|
||||
return fi.RemoveTrainFromWorld(vs.World, trainId)
|
||||
|
Loading…
Reference in New Issue
Block a user