列车pc仿真调整

This commit is contained in:
tiger_zhou 2024-04-11 08:55:12 +08:00
parent 225279dbd2
commit e011e5d409
8 changed files with 192 additions and 103 deletions

View File

@ -6,8 +6,8 @@ server:
# 数据源 # 数据源
datasource: datasource:
# 数据库访问url # 数据库访问url
# dsn: root:root@tcp(127.0.0.1:3306)/bj-rtss?charset=utf8mb4&parseTime=true&loc=UTC dsn: root:root@tcp(127.0.0.1:3306)/bj-rtss?charset=utf8mb4&parseTime=true&loc=UTC
dsn: root:joylink0503@tcp(192.168.33.233:3306)/bj-rtss?charset=utf8mb4&parseTime=true&loc=UTC # dsn: root:joylink0503@tcp(192.168.33.233:3306)/bj-rtss?charset=utf8mb4&parseTime=true&loc=UTC
# 日志配置 # 日志配置
logging: logging:
@ -33,7 +33,7 @@ logging:
# 消息配置 # 消息配置
messaging: messaging:
mqtt: mqtt:
# address: tcp://127.0.0.1:1883 address: tcp://127.0.0.1:1883
address: tcp://192.168.33.233:1883 # address: tcp://192.168.33.233:1883
username: rtsts_service username: rtsts_service
password: joylink@0503 password: joylink@0503

@ -1 +1 @@
Subproject commit dd445689f17b65d274b39086ad525ae68d0e75c2 Subproject commit 7d576a6c69ccbcdcdf14219f992602ccf0b1b30f

View File

@ -32,7 +32,7 @@ type RadarState struct {
Model string // 天线模式 Model string // 天线模式
SyntheticalState string //综合状态 SyntheticalState string //综合状态
DirState string //方向状态 DirState string //方向状态
Dir string //方向 Dir byte //方向
} }
func (r RadarInfo) Encode() []byte { func (r RadarInfo) Encode() []byte {
@ -45,17 +45,32 @@ func (r RadarInfo) Encode() []byte {
} else { } else {
buf = append(buf, byte(tmp)) buf = append(buf, byte(tmp))
} }
buf = binary.LittleEndian.AppendUint16(buf, r.RealSpeed) buf = binary.LittleEndian.AppendUint16(buf, r.RealSpeed)
buf = binary.LittleEndian.AppendUint16(buf, r.DriftCounterS1) buf = binary.LittleEndian.AppendUint16(buf, r.DriftCounterS1)
buf = binary.LittleEndian.AppendUint16(buf, r.DriftCounterS2) buf = binary.LittleEndian.AppendUint16(buf, r.DriftCounterS2)
//buf = append(buf, byte(r.RealSpeed>>8))
//buf = append(buf, byte(r.RealSpeed&0x00FF))
//buf = append(buf, byte(r.DriftCounterS1>>8))
//buf = append(buf, byte(r.DriftCounterS1&0x00FF))
//buf = append(buf, byte(r.DriftCounterS2>>8))
//buf = append(buf, byte(r.DriftCounterS2&0x00FF))
buf = append(buf, 0) buf = append(buf, 0)
buf = append(buf, 0) buf = append(buf, 0)
//6,7位 11 //6,7位 11
//3,4,5位 011 //3,4,5位 011
// 1位 1 // 1位 1
//0位 1 //0位 1
buf = append(buf, 0|(byte(1)<<7)|(byte(1)<<6)|(byte(1)<<5)|(byte(1)<<4)|(byte(1)<<1)|(byte(1)<<0)) var state byte
var sum int = 0 state = setBit(state, 7, 1)
state = setBit(state, 6, 1)
state = setBit(state, 5, 1)
state = setBit(state, 4, 1)
state = setBit(state, 3, 0)
state = setBit(state, 1, 0)
state = setBit(state, 0, byte(r.State.Dir))
buf = append(buf, state)
var sum = 0
for _, d := range buf { for _, d := range buf {
sum += int(d) sum += int(d)
} }
@ -119,7 +134,7 @@ func (s *RadarState) parseState() {
// 第0位 =行驶方向 // 第0位 =行驶方向
// 1前向 // 1前向
// 0反向 // 0反向
s.Dir = bitStateStr(arr[0:1]) s.Dir = arr[0:1][0]
} }
func (s *RadarState) getBitsStateArr() [8]byte { func (s *RadarState) getBitsStateArr() [8]byte {

View File

@ -57,6 +57,9 @@ func (r *TrainControlMsg) Encode() []byte {
data = append(data, byte(ti)) data = append(data, byte(ti))
return data return data
} }
func GetBit(b byte, bitNum uint) byte {
return (b >> bitNum) & 1
}
func setBit(b byte, bitNum int, value byte) byte { func setBit(b byte, bitNum int, value byte) byte {
if value != 0 && value != 1 { if value != 0 && value != 1 {
panic("value must be 0 or 1") panic("value must be 0 or 1")

View File

@ -9,7 +9,8 @@ import (
) )
func TestUdp(t *testing.T) { func TestUdp(t *testing.T) {
fmt.Println(0 | (byte(1) << 7) | (byte(1) << 6) | (byte(1) << 5) | (byte(1) << 4) | (byte(1) << 1) | (byte(1) << 0))
fmt.Println(fmt.Sprintf("%b", 0|(byte(1)<<7)|(byte(1)<<6)|(byte(1)<<5)|(byte(1)<<4)|(byte(1)<<1)|(byte(1)<<0)))
fmt.Println("准备启动服务...") fmt.Println("准备启动服务...")
addr := fmt.Sprintf("%v:%v", "127.0.0.1", "8899") addr := fmt.Sprintf("%v:%v", "127.0.0.1", "8899")
server := udp.NewServer(addr, handle) server := udp.NewServer(addr, handle)

View File

@ -81,6 +81,7 @@ func (rv *radarVobc) sendRadarInfo(ctx context.Context) {
s2 := uint16(math.Round(td / 1000 / driftDefaultVal)) s2 := uint16(math.Round(td / 1000 / driftDefaultVal))
ri := message.RadarInfo{RealSpeed: uint16(math.Round(hourSpeed / fixed_speed)), DriftCounterS1: s1, DriftCounterS2: s2} ri := message.RadarInfo{RealSpeed: uint16(math.Round(hourSpeed / fixed_speed)), DriftCounterS1: s1, DriftCounterS2: s2}
ri.State = &message.RadarState{Dir: message.IsTrue(trainStatus.RunDirection)}
rv.vobcClient.SendMsg(ri) rv.vobcClient.SendMsg(ri)
} }
time.Sleep(time.Millisecond * radar_interval) time.Sleep(time.Millisecond * radar_interval)

View File

@ -564,14 +564,17 @@ func (s *VerifySimulation) FindRadarTrain() *state_proto.TrainState {
s.Memory.Status.TrainStateMap.Range(func(k any, v any) bool { s.Memory.Status.TrainStateMap.Range(func(k any, v any) bool {
val, ok := v.(*state_proto.TrainState) val, ok := v.(*state_proto.TrainState)
if ok { if ok {
if val.TrainEndsA.RadarEnable && val.TrainEndsB.RadarEnable { if val.TrainEndsA.RadarEnable || val.TrainEndsB.RadarEnable {
//trainStatus = val trainStatus = val
//return false return false
}
/*if val.TrainEndsA.RadarEnable && val.TrainEndsB.RadarEnable {
return true return true
} else if val.TrainEndsA.RadarEnable || val.TrainEndsB.RadarEnable { } else if val.TrainEndsA.RadarEnable || val.TrainEndsB.RadarEnable {
trainStatus = val trainStatus = val
return false return false
} }*/
} }
return true return true
}) })

View File

@ -1,7 +1,6 @@
package memory package memory
import ( import (
"bytes"
"encoding/binary" "encoding/binary"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
@ -195,94 +194,157 @@ func (s *VerifySimulation) TrainPcSimDigitalOutInfoHandle(data []byte) {
slog.Error("车载输出数字量,,列车未连接车载pc仿真") slog.Error("车载输出数字量,,列车未连接车载pc仿真")
return return
} }
buf := bytes.NewBuffer(data) //buf := bytes.NewBuffer(data)
vobc := train.VobcState vobc := train.VobcState
cutTraction, _ := buf.ReadByte() //切牵引
trainDoorOutLed, _ := buf.ReadByte() //车门外指示灯
stopBrakeAppend, _ := buf.ReadByte() //停放制动施加
emergentBrake, _ := buf.ReadByte() //紧急制动
leftOpenDoor, _ := buf.ReadByte() //开左门允许
rightOpenDoor, _ := buf.ReadByte() //开右门允许
closeRightDoor, _ := buf.ReadByte() //关右门
doorAlwaysClosed, _ := buf.ReadByte() //车门保持关闭
localAtpControl, _ := buf.ReadByte() //本端ATP控车
atoMode, _ := buf.ReadByte() //ATO模式
atoTractionCommandOut, _ := buf.ReadByte() //ATO牵引命令输出
atoTractionCommand1, _ := buf.ReadByte() //ATO牵引指令1
atoTractionCommand2, _ := buf.ReadByte() //ATO牵引指令2
atoTractionCommand3, _ := buf.ReadByte() //ATO牵引指令3
atoBrakeCommand, _ := buf.ReadByte() //ATO制动命令输出
skipCommand, _ := buf.ReadByte() //跳跃指令
direction1, _ := buf.ReadByte() //列车方向1
direction2, _ := buf.ReadByte() //列车方向2
atoLazyCommandOut, _ := buf.ReadByte() //ATO惰行命令输出
sleepCommand, _ := buf.ReadByte() //休眠指令
wakeUpCommand, _ := buf.ReadByte() //唤醒指令
toPullTrainLed, _ := buf.ReadByte() //ATO发车指示灯
arLightCommand, _ := buf.ReadByte() //AR灯命令
atoAlwaysBrake, _ := buf.ReadByte() //ATO保持制动
atoOpenLeftDoor, _ := buf.ReadByte() //ATO开左门
atoOpenRightDoor, _ := buf.ReadByte() //ATO开右门
atoCloseLeftDoor, _ := buf.ReadByte() //ATO关左门
ariverActive, _ := buf.ReadByte() //驾驶室激活
noSpeedSigle, _ := buf.ReadByte() //零速信号
famMode, _ := buf.ReadByte() //FAM模式
camMode, _ := buf.ReadByte() //CAM模式
trainStartedLed, _ := buf.ReadByte() //列车启动指示灯
mostUseBrake, _ := buf.ReadByte() //常用制动
splittingOut, _ := buf.ReadByte() //过分相输出
modeRelay, _ := buf.ReadByte() //模式继电器
tractionEffective, _ := buf.ReadByte() //牵引有效
brakeEffective, _ := buf.ReadByte() //制动有效
lifeDoorUsed, _ := buf.ReadByte() //逃生门使能
brakeQuarantine, _ := buf.ReadByte() //制动隔离
stopNotAllBrake, _ := buf.ReadByte() //停放制动缓解
vobc.TractionSafetyCircuit = message.IsTrueForByte(cutTraction) //cutTraction, _ := buf.ReadByte() //切牵引
vobc.TrainDoorOutLed = message.IsTrueForByte(trainDoorOutLed) //? 说明暂无此属性 //trainDoorOutLed, _ := buf.ReadByte() //车门外指示灯
vobc.ParkingBrakeStatus = message.IsTrueForByte(stopBrakeAppend) //stopBrakeAppend, _ := buf.ReadByte() //停放制动施加
vobc.EmergencyBrakingStatus = message.IsTrueForByte(emergentBrake) //emergentBrake, _ := buf.ReadByte() //紧急制动
vobc.LeftDoorOpenCommand = message.IsTrueForByte(leftOpenDoor) //leftOpenDoor, _ := buf.ReadByte() //开左门允许
vobc.RightDoorOpenCommand = message.IsTrueForByte(rightOpenDoor) //rightOpenDoor, _ := buf.ReadByte() //开右门允许
vobc.RightDoorCloseCommand = message.IsTrueForByte(closeRightDoor) //closeRightDoor, _ := buf.ReadByte() //关右门
vobc.AllDoorClose = message.IsTrueForByte(doorAlwaysClosed) //doorAlwaysClosed, _ := buf.ReadByte() //车门保持关闭
vobc.LocalAtpControl = message.IsTrueForByte(localAtpControl) //? //localAtpControl, _ := buf.ReadByte() //本端ATP控车
vobc.Ato = message.IsTrueForByte(atoMode) //atoMode, _ := buf.ReadByte() //ATO模式
vobc.AtoTractionCommandOut = message.IsTrueForByte(atoTractionCommandOut) //? //atoTractionCommandOut, _ := buf.ReadByte() //ATO牵引命令输出
//atoTractionCommand1, _ := buf.ReadByte() //ATO牵引指令1
//atoTractionCommand2, _ := buf.ReadByte() //ATO牵引指令2
//atoTractionCommand3, _ := buf.ReadByte() //ATO牵引指令3
//atoBrakeCommand, _ := buf.ReadByte() //ATO制动命令输出
//skipCommand, _ := buf.ReadByte() //跳跃指令
//direction1, _ := buf.ReadByte() //列车方向1
//direction2, _ := buf.ReadByte() //列车方向2
//atoLazyCommandOut, _ := buf.ReadByte() //ATO惰行命令输出
//sleepCommand, _ := buf.ReadByte() //休眠指令
//wakeUpCommand, _ := buf.ReadByte() //唤醒指令
//toPullTrainLed, _ := buf.ReadByte() //ATO发车指示灯
//arLightCommand, _ := buf.ReadByte() //AR灯命令
//atoAlwaysBrake, _ := buf.ReadByte() //ATO保持制动
//atoOpenLeftDoor, _ := buf.ReadByte() //ATO开左门
//atoOpenRightDoor, _ := buf.ReadByte() //ATO开右门
//atoCloseLeftDoor, _ := buf.ReadByte() //ATO关左门
//ariverActive, _ := buf.ReadByte() //驾驶室激活
//noSpeedSigle, _ := buf.ReadByte() //零速信号
//famMode, _ := buf.ReadByte() //FAM模式
//camMode, _ := buf.ReadByte() //CAM模式
//trainStartedLed, _ := buf.ReadByte() //列车启动指示灯
//mostUseBrake, _ := buf.ReadByte() //常用制动
//splittingOut, _ := buf.ReadByte() //过分相输出
//modeRelay, _ := buf.ReadByte() //模式继电器
//tractionEffective, _ := buf.ReadByte() //牵引有效
//brakeEffective, _ := buf.ReadByte() //制动有效
//lifeDoorUsed, _ := buf.ReadByte() //逃生门使能
//brakeQuarantine, _ := buf.ReadByte() //制动隔离
//stopNotAllBrake, _ := buf.ReadByte() //停放制动缓解
vobc.AtoTractionCommand1 = message.IsTrueForByte(atoTractionCommand1) //? //vobc.TractionSafetyCircuit = message.IsTrueForByte(cutTraction)
vobc.AtoTractionCommand2 = message.IsTrueForByte(atoTractionCommand2) //? //vobc.TrainDoorOutLed = message.IsTrueForByte(trainDoorOutLed) //? 说明暂无此属性
vobc.AtoTractionCommand3 = message.IsTrueForByte(atoTractionCommand3) //? //vobc.ParkingBrakeStatus = message.IsTrueForByte(stopBrakeAppend)
vobc.AtoBrakeCommand = message.IsTrueForByte(atoBrakeCommand) //? //vobc.EmergencyBrakingStatus = message.IsTrueForByte(emergentBrake)
vobc.JumpStatus = message.IsTrueForByte(skipCommand) //vobc.LeftDoorOpenCommand = message.IsTrueForByte(leftOpenDoor)
vobc.DirectionForward = message.IsTrueForByte(direction1) //vobc.RightDoorOpenCommand = message.IsTrueForByte(rightOpenDoor)
vobc.DirectionBackward = message.IsTrueForByte(direction2) //vobc.RightDoorCloseCommand = message.IsTrueForByte(closeRightDoor)
//vobc.AllDoorClose = message.IsTrueForByte(doorAlwaysClosed)
vobc.AtoLazyCommandOut = message.IsTrueForByte(atoLazyCommandOut) //? //vobc.LocalAtpControl = message.IsTrueForByte(localAtpControl) //?
vobc.SleepBtn = message.IsTrueForByte(sleepCommand) //vobc.Ato = message.IsTrueForByte(atoMode)
vobc.WakeUpBtn = message.IsTrueForByte(wakeUpCommand) //vobc.AtoTractionCommandOut = message.IsTrueForByte(atoTractionCommandOut) //?
vobc.AtoSendTrainBtn = message.IsTrueForByte(toPullTrainLed) //vobc.AtoTractionCommand1 = message.IsTrueForByte(atoTractionCommand1) //?
vobc.TurnbackStatus = message.IsTrueForByte(arLightCommand) //? //vobc.AtoTractionCommand2 = message.IsTrueForByte(atoTractionCommand2) //?
vobc.AtoAlwaysBrake = message.IsTrueForByte(atoAlwaysBrake) //? //vobc.AtoTractionCommand3 = message.IsTrueForByte(atoTractionCommand3) //?
vobc.AtoOpenLeftDoor = message.IsTrueForByte(atoOpenLeftDoor) //? //vobc.AtoBrakeCommand = message.IsTrueForByte(atoBrakeCommand) //?
vobc.AtoOpenRightDoor = message.IsTrueForByte(atoOpenRightDoor) //? //vobc.JumpStatus = message.IsTrueForByte(skipCommand)
vobc.AtoCloseLeftDoor = message.IsTrueForByte(atoCloseLeftDoor) //?
vobc.Tc1Active = message.IsTrueForByte(ariverActive) //vobc.DirectionForward = message.IsTrueForByte(direction1)
vobc.NoSpeedSigle = message.IsTrueForByte(noSpeedSigle) //? //vobc.DirectionBackward = message.IsTrueForByte(direction2)
vobc.Fam = message.IsTrueForByte(famMode) //vobc.AtoLazyCommandOut = message.IsTrueForByte(atoLazyCommandOut) //?
vobc.Cam = message.IsTrueForByte(camMode) //vobc.SleepBtn = message.IsTrueForByte(sleepCommand)
vobc.TrainStartedLed = message.IsTrueForByte(trainStartedLed) //? //vobc.WakeUpBtn = message.IsTrueForByte(wakeUpCommand)
vobc.MostUseBrake = message.IsTrueForByte(mostUseBrake) //? //常用制动 //vobc.AtoSendTrainBtn = message.IsTrueForByte(toPullTrainLed)
vobc.SplittingOut = message.IsTrueForByte(splittingOut) //? //过分相输出 //vobc.TurnbackStatus = message.IsTrueForByte(arLightCommand) //?
vobc.ModeRelay = message.IsTrueForByte(modeRelay) //? //模式继电器 //vobc.AtoAlwaysBrake = message.IsTrueForByte(atoAlwaysBrake) //?
vobc.TractionEffective = message.IsTrueForByte(tractionEffective) //? //牵引有效
vobc.BrakeEffective = message.IsTrueForByte(brakeEffective) //? //制动有效 //vobc.AtoOpenLeftDoor = message.IsTrueForByte(atoOpenLeftDoor) //?
vobc.LifeDoorState = message.IsTrueForByte(lifeDoorUsed) //逃生门使能 //vobc.AtoOpenRightDoor = message.IsTrueForByte(atoOpenRightDoor) //?
vobc.BrakeQuarantine = message.IsTrueForByte(brakeQuarantine) //? //制动隔离 //vobc.AtoCloseLeftDoor = message.IsTrueForByte(atoCloseLeftDoor) //?
vobc.StopNotAllBrake = message.IsTrueForByte(stopNotAllBrake) //? //停放制动缓解 //vobc.Tc1Active = message.IsTrueForByte(ariverActive)
//vobc.NoSpeedSigle = message.IsTrueForByte(noSpeedSigle) //?
//vobc.Fam = message.IsTrueForByte(famMode)
//vobc.Cam = message.IsTrueForByte(camMode)
//vobc.TrainStartedLed = message.IsTrueForByte(trainStartedLed) //?
//vobc.MostUseBrake = message.IsTrueForByte(mostUseBrake) //? //常用制动
//vobc.SplittingOut = message.IsTrueForByte(splittingOut) //? //过分相输出
//vobc.ModeRelay = message.IsTrueForByte(modeRelay) //? //模式继电器
//vobc.TractionEffective = message.IsTrueForByte(tractionEffective) //? //牵引有效
//vobc.BrakeEffective = message.IsTrueForByte(brakeEffective) //? //制动有效
//vobc.LifeDoorState = message.IsTrueForByte(lifeDoorUsed) //逃生门使能
//vobc.BrakeQuarantine = message.IsTrueForByte(brakeQuarantine) //? //制动隔离
//vobc.StopNotAllBrake = message.IsTrueForByte(stopNotAllBrake) //? //停放制动缓解
trainPcSimDigitalOutInfoHandleCode39_32(data[0], vobc)
trainPcSimDigitalOutInfoHandleCode31_24(data[1], vobc)
trainPcSimDigitalOutInfoHandleCode23_16(data[2], vobc)
trainPcSimDigitalOutInfoHandleCode15_8(data[3], vobc)
trainPcSimDigitalOutInfoHandleCode7_0(data[4], vobc)
cm := &message.TrainControlMsg{TrainId: train.Id, ControlInfo: vobc} cm := &message.TrainControlMsg{TrainId: train.Id, ControlInfo: vobc}
dynamics.Default().SendTrainControl(cm) dynamics.Default().SendTrainControl(cm)
} }
func trainPcSimDigitalOutInfoHandleCode39_32(d byte, vobc *state_proto.TrainVobcState) {
vobc.MostUseBrake = message.IsTrueForByte(message.GetBit(d, 0)) //? //常用制动
vobc.SplittingOut = message.IsTrueForByte(message.GetBit(d, 1)) //? //过分相输出
vobc.ModeRelay = message.IsTrueForByte(message.GetBit(d, 2)) //? //模式继电器
vobc.TractionEffective = message.IsTrueForByte(message.GetBit(d, 3)) //? //牵引有效
vobc.BrakeEffective = message.IsTrueForByte(message.GetBit(d, 4)) //? //制动有效
vobc.LifeDoorState = message.IsTrueForByte(message.GetBit(d, 5)) //逃生门使能
vobc.BrakeQuarantine = message.IsTrueForByte(message.GetBit(d, 6)) //? //制动隔离
vobc.StopNotAllBrake = message.IsTrueForByte(message.GetBit(d, 7)) //? //停放制动缓解
}
func trainPcSimDigitalOutInfoHandleCode31_24(d byte, vobc *state_proto.TrainVobcState) {
vobc.AtoOpenLeftDoor = message.IsTrueForByte(message.GetBit(d, 0)) //?//ATO开左门
vobc.AtoOpenRightDoor = message.IsTrueForByte(message.GetBit(d, 1)) //?//ATO开右门
vobc.AtoCloseLeftDoor = message.IsTrueForByte(message.GetBit(d, 2)) //?//ATO关左门
vobc.Tc1Active = message.IsTrueForByte(message.GetBit(d, 3)) //驾驶室激活
vobc.NoSpeedSigle = message.IsTrueForByte(message.GetBit(d, 4)) //?//零速信号
vobc.Fam = message.IsTrueForByte(message.GetBit(d, 5)) //FAM模式
vobc.Cam = message.IsTrueForByte(message.GetBit(d, 6)) //CAM模式
vobc.TrainStartedLed = message.IsTrueForByte(message.GetBit(d, 7)) //?//列车启动指示灯
}
func trainPcSimDigitalOutInfoHandleCode23_16(d byte, vobc *state_proto.TrainVobcState) {
vobc.DirectionForward = message.IsTrueForByte(message.GetBit(d, 0)) //列车方向1
vobc.DirectionBackward = message.IsTrueForByte(message.GetBit(d, 1)) //列车方向2
vobc.AtoLazyCommandOut = message.IsTrueForByte(message.GetBit(d, 2)) //?//ATO惰行命令输出
vobc.SleepBtn = message.IsTrueForByte(message.GetBit(d, 3)) //休眠指令
vobc.WakeUpBtn = message.IsTrueForByte(message.GetBit(d, 4)) //唤醒指令
vobc.AtoSendTrainBtn = message.IsTrueForByte(message.GetBit(d, 5)) //ATO发车指示灯
vobc.TurnbackStatus = message.IsTrueForByte(message.GetBit(d, 6)) //?//AR灯命令
vobc.AtoAlwaysBrake = message.IsTrueForByte(message.GetBit(d, 7)) //? //ATO保持制动
}
func trainPcSimDigitalOutInfoHandleCode15_8(d byte, vobc *state_proto.TrainVobcState) {
vobc.LocalAtpControl = message.IsTrueForByte(message.GetBit(d, 0)) //?//本端ATP控车
vobc.Ato = message.IsTrueForByte(message.GetBit(d, 1)) //ATO模式
vobc.AtoTractionCommandOut = message.IsTrueForByte(message.GetBit(d, 2)) //?//ATO牵引命令输出
vobc.AtoTractionCommand1 = message.IsTrueForByte(message.GetBit(d, 3)) //?//ATO牵引指令1
vobc.AtoTractionCommand2 = message.IsTrueForByte(message.GetBit(d, 4)) //?//ATO牵引指令2
vobc.AtoTractionCommand3 = message.IsTrueForByte(message.GetBit(d, 5)) //?//ATO牵引指令3
vobc.AtoBrakeCommand = message.IsTrueForByte(message.GetBit(d, 6)) //?//ATO制动命令输出
vobc.JumpStatus = message.IsTrueForByte(message.GetBit(d, 7)) //跳跃指令
}
func trainPcSimDigitalOutInfoHandleCode7_0(d byte, vobc *state_proto.TrainVobcState) {
vobc.TractionSafetyCircuit = message.IsTrueForByte(message.GetBit(d, 0)) //切牵引
vobc.TrainDoorOutLed = message.IsTrueForByte(message.GetBit(d, 1)) //? 说明暂无此属性
vobc.ParkingBrakeStatus = message.IsTrueForByte(message.GetBit(d, 2)) //停放制动施加
vobc.EmergencyBrakingStatus = message.IsTrueForByte(message.GetBit(d, 3)) //紧急制动
vobc.LeftDoorOpenCommand = message.IsTrueForByte(message.GetBit(d, 4)) //开左门允许
vobc.RightDoorOpenCommand = message.IsTrueForByte(message.GetBit(d, 5)) //开右门允许
vobc.RightDoorCloseCommand = message.IsTrueForByte(message.GetBit(d, 6)) //关右门
vobc.AllDoorClose = message.IsTrueForByte(message.GetBit(d, 7)) //车门保持关闭
}
// 4.4.2. 车载输出数字反馈量信息报文内容 // 4.4.2. 车载输出数字反馈量信息报文内容
func (s *VerifySimulation) TrainPcSimDigitalReportHandle(data []byte) { func (s *VerifySimulation) TrainPcSimDigitalReportHandle(data []byte) {
@ -296,14 +358,18 @@ func (s *VerifySimulation) TrainPcSimDigitalReportHandle(data []byte) {
return return
} }
vobc := train.VobcState vobc := train.VobcState
buf := bytes.NewBuffer(data)
localEndAct, _ := buf.ReadByte()
direction1, _ := buf.ReadByte()
direction2, _ := buf.ReadByte()
vobc.Tc1Active = message.IsTrueForByte(localEndAct) //本端驾驶室激活(钥匙) //buf := bytes.NewBuffer(data)
vobc.DirectionForward = message.IsTrueForByte(direction1) //方向手柄进位 //localEndAct, _ := buf.ReadByte()
vobc.DirectionBackward = message.IsTrueForByte(direction2) //方向手柄退位 //direction1, _ := buf.ReadByte()
//direction2, _ := buf.ReadByte()
//vobc.Tc1Active = message.IsTrueForByte(localEndAct) //本端驾驶室激活(钥匙)
//vobc.DirectionForward = message.IsTrueForByte(direction1) //方向手柄进位
//vobc.DirectionBackward = message.IsTrueForByte(direction2) //方向手柄退位
buf := data[0]
vobc.Tc1Active = message.IsTrueForByte(message.GetBit(buf, 0)) //本端驾驶室激活(钥匙)
vobc.DirectionForward = message.IsTrueForByte(message.GetBit(buf, 1)) //方向手柄进位
vobc.DirectionBackward = message.IsTrueForByte(message.GetBit(buf, 2)) //方向手柄退位
} }
// 创建/删除列车 // 创建/删除列车