This commit is contained in:
xzb 2023-11-28 13:30:10 +08:00
parent c8fb7eb999
commit 7cdde1b7ef
2 changed files with 10 additions and 10 deletions

View File

@ -79,10 +79,10 @@ func (s *btmCanetClient) Start(bcm BtmCanetManager) {
s.bcm = bcm
cfg := s.bcm.GetBtmCanetConfig()
//测试用
cfg.Open = true
cfg.RemoteUdpPort = 5555
cfg.RemoteIp = "192.168.3.5"
cfg.LocalUdpPort = 6666
//cfg.Open = true
//cfg.RemoteUdpPort = 5555
//cfg.RemoteIp = "192.168.3.5"
//cfg.LocalUdpPort = 6666
//
if !cfg.Open {
return
@ -169,7 +169,7 @@ func (s *btmCanetClient) dealWithAptReq(f *message.CanetFrame) {
s.atpReqCrc16Check = atpReq.Crc16CheckOk
se := fi.TrainBalisePowerAmplifierSwitch(s.bcm.EvnWorld(), atpReq.PowerAmplifierTurnOn)
if se != nil {
slog.Warn(fmt.Sprintf("列车车载BTM功率放大器开关控制异常[%s]", se.Error()))
//slog.Warn(fmt.Sprintf("列车车载BTM功率放大器开关控制异常[%s]", se.Error()))
}
//ATP 是否要求BTM 重发上一应答器报文
isResendRequest := atpReq.ResendRequest == 2 //0b10
@ -192,7 +192,7 @@ func (s *btmCanetClient) rspToAtp(isResendRequest bool) {
statusF := message.NewBtmStatusRspFrame(s.atpReqSn)
btmStatus, btmStatusErr := fi.FindTrainBaliseBtmStatus(s.bcm.EvnWorld())
if btmStatusErr != nil {
slog.Debug(fmt.Sprintf("从仿真获取BTM状态失败%s", btmStatusErr.Error()))
//slog.Debug(fmt.Sprintf("从仿真获取BTM状态失败%s", btmStatusErr.Error()))
return
}
statusF.AntennaFault = btmStatus.AntennaFault

View File

@ -111,21 +111,21 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
sta := data.(*state.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)
//slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset)
inLinkId, inLinkOffset := strconv.Itoa(int(info.Link)), int64(info.LinkOffset)
outLinkId, id, port, outLinkOffset, offset, kilometer, e1 := CalcInitializeLink(vs, inLinkId, inLinkOffset, info.Up)
if e1 != nil {
panic(sys_error.New("动力学传输数据:列车车头位置计算出错", e1))
}
runDirection, pointTo := QueryDirectionAndABByDevice(vs.Repo, id, port, info.Up)
slog.Debug("处理动力学转换后的消息", "number", info.Number, "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
//slog.Debug("处理动力学转换后的消息", "number", info.Number, "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
// 车尾相对车头link的偏移量
calctailOffset := calcTrailTailOffset(outLinkOffset, int64(info.Len), info.Up)
tailLinkId, tailDeviceId, tailDevicePort, tailLinkOffset, tailDeviceOffset, _, e2 := CalcInitializeLink(vs, outLinkId, calctailOffset, info.Up)
tailLinkId, _, _, tailLinkOffset, _, _, e2 := CalcInitializeLink(vs, outLinkId, calctailOffset, info.Up)
if e2 != nil {
panic(sys_error.New("动力学传输数据:列车车尾位置计算出错", e2))
}
slog.Debug("车尾位置", tailDeviceId, "偏移", tailDeviceOffset, "所在设备端", tailDevicePort)
//slog.Debug("车尾位置", tailDeviceId, "偏移", tailDeviceOffset, "所在设备端", tailDevicePort)
// 修改world中的列车位置
fi.UpdateTrainPositionFromDynamics(vs.World, fi.TrainPositionInfo{
TrainId: trainId,