列车pc仿真调整
This commit is contained in:
parent
225279dbd2
commit
e011e5d409
@ -6,8 +6,8 @@ server:
|
||||
# 数据源
|
||||
datasource:
|
||||
# 数据库访问url
|
||||
# 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: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
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
@ -33,7 +33,7 @@ logging:
|
||||
# 消息配置
|
||||
messaging:
|
||||
mqtt:
|
||||
# address: tcp://127.0.0.1:1883
|
||||
address: tcp://192.168.33.233:1883
|
||||
address: tcp://127.0.0.1:1883
|
||||
# address: tcp://192.168.33.233:1883
|
||||
username: rtsts_service
|
||||
password: joylink@0503
|
@ -1 +1 @@
|
||||
Subproject commit dd445689f17b65d274b39086ad525ae68d0e75c2
|
||||
Subproject commit 7d576a6c69ccbcdcdf14219f992602ccf0b1b30f
|
23
third_party/message/radar.go
vendored
23
third_party/message/radar.go
vendored
@ -32,7 +32,7 @@ type RadarState struct {
|
||||
Model string // 天线模式
|
||||
SyntheticalState string //综合状态
|
||||
DirState string //方向状态
|
||||
Dir string //方向
|
||||
Dir byte //方向
|
||||
}
|
||||
|
||||
func (r RadarInfo) Encode() []byte {
|
||||
@ -45,17 +45,32 @@ func (r RadarInfo) Encode() []byte {
|
||||
} else {
|
||||
buf = append(buf, byte(tmp))
|
||||
}
|
||||
|
||||
buf = binary.LittleEndian.AppendUint16(buf, r.RealSpeed)
|
||||
buf = binary.LittleEndian.AppendUint16(buf, r.DriftCounterS1)
|
||||
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)
|
||||
//6,7位 11
|
||||
//3,4,5位 011
|
||||
// 1位 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 sum int = 0
|
||||
var state byte
|
||||
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 {
|
||||
sum += int(d)
|
||||
}
|
||||
@ -119,7 +134,7 @@ func (s *RadarState) parseState() {
|
||||
// 第0位 =行驶方向
|
||||
// 1:前向
|
||||
// 0:反向
|
||||
s.Dir = bitStateStr(arr[0:1])
|
||||
s.Dir = arr[0:1][0]
|
||||
}
|
||||
|
||||
func (s *RadarState) getBitsStateArr() [8]byte {
|
||||
|
3
third_party/message/train_control.go
vendored
3
third_party/message/train_control.go
vendored
@ -57,6 +57,9 @@ func (r *TrainControlMsg) Encode() []byte {
|
||||
data = append(data, byte(ti))
|
||||
return data
|
||||
}
|
||||
func GetBit(b byte, bitNum uint) byte {
|
||||
return (b >> bitNum) & 1
|
||||
}
|
||||
func setBit(b byte, bitNum int, value byte) byte {
|
||||
if value != 0 && value != 1 {
|
||||
panic("value must be 0 or 1")
|
||||
|
3
third_party/radar/radar_test.go
vendored
3
third_party/radar/radar_test.go
vendored
@ -9,7 +9,8 @@ import (
|
||||
)
|
||||
|
||||
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("准备启动服务...")
|
||||
addr := fmt.Sprintf("%v:%v", "127.0.0.1", "8899")
|
||||
server := udp.NewServer(addr, handle)
|
||||
|
1
third_party/radar/radar_vobc.go
vendored
1
third_party/radar/radar_vobc.go
vendored
@ -81,6 +81,7 @@ func (rv *radarVobc) sendRadarInfo(ctx context.Context) {
|
||||
s2 := uint16(math.Round(td / 1000 / driftDefaultVal))
|
||||
|
||||
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)
|
||||
}
|
||||
time.Sleep(time.Millisecond * radar_interval)
|
||||
|
@ -564,14 +564,17 @@ func (s *VerifySimulation) FindRadarTrain() *state_proto.TrainState {
|
||||
s.Memory.Status.TrainStateMap.Range(func(k any, v any) bool {
|
||||
val, ok := v.(*state_proto.TrainState)
|
||||
if ok {
|
||||
if val.TrainEndsA.RadarEnable && val.TrainEndsB.RadarEnable {
|
||||
//trainStatus = val
|
||||
//return false
|
||||
if val.TrainEndsA.RadarEnable || val.TrainEndsB.RadarEnable {
|
||||
trainStatus = val
|
||||
return false
|
||||
}
|
||||
/*if val.TrainEndsA.RadarEnable && val.TrainEndsB.RadarEnable {
|
||||
|
||||
return true
|
||||
} else if val.TrainEndsA.RadarEnable || val.TrainEndsB.RadarEnable {
|
||||
trainStatus = val
|
||||
return false
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
@ -1,7 +1,6 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
@ -195,94 +194,157 @@ func (s *VerifySimulation) TrainPcSimDigitalOutInfoHandle(data []byte) {
|
||||
slog.Error("车载输出数字量,,列车未连接车载pc仿真")
|
||||
return
|
||||
}
|
||||
buf := bytes.NewBuffer(data)
|
||||
//buf := bytes.NewBuffer(data)
|
||||
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)
|
||||
vobc.TrainDoorOutLed = message.IsTrueForByte(trainDoorOutLed) //? 说明暂无此属性
|
||||
vobc.ParkingBrakeStatus = message.IsTrueForByte(stopBrakeAppend)
|
||||
vobc.EmergencyBrakingStatus = message.IsTrueForByte(emergentBrake)
|
||||
vobc.LeftDoorOpenCommand = message.IsTrueForByte(leftOpenDoor)
|
||||
vobc.RightDoorOpenCommand = message.IsTrueForByte(rightOpenDoor)
|
||||
vobc.RightDoorCloseCommand = message.IsTrueForByte(closeRightDoor)
|
||||
vobc.AllDoorClose = message.IsTrueForByte(doorAlwaysClosed)
|
||||
vobc.LocalAtpControl = message.IsTrueForByte(localAtpControl) //?
|
||||
vobc.Ato = message.IsTrueForByte(atoMode)
|
||||
vobc.AtoTractionCommandOut = message.IsTrueForByte(atoTractionCommandOut) //?
|
||||
//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.AtoTractionCommand1 = message.IsTrueForByte(atoTractionCommand1) //?
|
||||
vobc.AtoTractionCommand2 = message.IsTrueForByte(atoTractionCommand2) //?
|
||||
vobc.AtoTractionCommand3 = message.IsTrueForByte(atoTractionCommand3) //?
|
||||
vobc.AtoBrakeCommand = message.IsTrueForByte(atoBrakeCommand) //?
|
||||
vobc.JumpStatus = message.IsTrueForByte(skipCommand)
|
||||
vobc.DirectionForward = message.IsTrueForByte(direction1)
|
||||
vobc.DirectionBackward = message.IsTrueForByte(direction2)
|
||||
//vobc.TractionSafetyCircuit = message.IsTrueForByte(cutTraction)
|
||||
//vobc.TrainDoorOutLed = message.IsTrueForByte(trainDoorOutLed) //? 说明暂无此属性
|
||||
//vobc.ParkingBrakeStatus = message.IsTrueForByte(stopBrakeAppend)
|
||||
//vobc.EmergencyBrakingStatus = message.IsTrueForByte(emergentBrake)
|
||||
//vobc.LeftDoorOpenCommand = message.IsTrueForByte(leftOpenDoor)
|
||||
//vobc.RightDoorOpenCommand = message.IsTrueForByte(rightOpenDoor)
|
||||
//vobc.RightDoorCloseCommand = message.IsTrueForByte(closeRightDoor)
|
||||
//vobc.AllDoorClose = message.IsTrueForByte(doorAlwaysClosed)
|
||||
|
||||
vobc.AtoLazyCommandOut = message.IsTrueForByte(atoLazyCommandOut) //?
|
||||
vobc.SleepBtn = message.IsTrueForByte(sleepCommand)
|
||||
vobc.WakeUpBtn = message.IsTrueForByte(wakeUpCommand)
|
||||
vobc.AtoSendTrainBtn = message.IsTrueForByte(toPullTrainLed)
|
||||
vobc.TurnbackStatus = message.IsTrueForByte(arLightCommand) //?
|
||||
vobc.AtoAlwaysBrake = message.IsTrueForByte(atoAlwaysBrake) //?
|
||||
vobc.AtoOpenLeftDoor = message.IsTrueForByte(atoOpenLeftDoor) //?
|
||||
vobc.AtoOpenRightDoor = message.IsTrueForByte(atoOpenRightDoor) //?
|
||||
vobc.AtoCloseLeftDoor = message.IsTrueForByte(atoCloseLeftDoor) //?
|
||||
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) //? //停放制动缓解
|
||||
//vobc.LocalAtpControl = message.IsTrueForByte(localAtpControl) //?
|
||||
//vobc.Ato = message.IsTrueForByte(atoMode)
|
||||
//vobc.AtoTractionCommandOut = message.IsTrueForByte(atoTractionCommandOut) //?
|
||||
//vobc.AtoTractionCommand1 = message.IsTrueForByte(atoTractionCommand1) //?
|
||||
//vobc.AtoTractionCommand2 = message.IsTrueForByte(atoTractionCommand2) //?
|
||||
//vobc.AtoTractionCommand3 = message.IsTrueForByte(atoTractionCommand3) //?
|
||||
//vobc.AtoBrakeCommand = message.IsTrueForByte(atoBrakeCommand) //?
|
||||
//vobc.JumpStatus = message.IsTrueForByte(skipCommand)
|
||||
|
||||
//vobc.DirectionForward = message.IsTrueForByte(direction1)
|
||||
//vobc.DirectionBackward = message.IsTrueForByte(direction2)
|
||||
//vobc.AtoLazyCommandOut = message.IsTrueForByte(atoLazyCommandOut) //?
|
||||
//vobc.SleepBtn = message.IsTrueForByte(sleepCommand)
|
||||
//vobc.WakeUpBtn = message.IsTrueForByte(wakeUpCommand)
|
||||
//vobc.AtoSendTrainBtn = message.IsTrueForByte(toPullTrainLed)
|
||||
//vobc.TurnbackStatus = message.IsTrueForByte(arLightCommand) //?
|
||||
//vobc.AtoAlwaysBrake = message.IsTrueForByte(atoAlwaysBrake) //?
|
||||
|
||||
//vobc.AtoOpenLeftDoor = message.IsTrueForByte(atoOpenLeftDoor) //?
|
||||
//vobc.AtoOpenRightDoor = message.IsTrueForByte(atoOpenRightDoor) //?
|
||||
//vobc.AtoCloseLeftDoor = message.IsTrueForByte(atoCloseLeftDoor) //?
|
||||
//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}
|
||||
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. 车载输出数字反馈量信息报文内容
|
||||
func (s *VerifySimulation) TrainPcSimDigitalReportHandle(data []byte) {
|
||||
@ -296,14 +358,18 @@ func (s *VerifySimulation) TrainPcSimDigitalReportHandle(data []byte) {
|
||||
return
|
||||
}
|
||||
vobc := train.VobcState
|
||||
buf := bytes.NewBuffer(data)
|
||||
localEndAct, _ := buf.ReadByte()
|
||||
direction1, _ := buf.ReadByte()
|
||||
direction2, _ := buf.ReadByte()
|
||||
|
||||
vobc.Tc1Active = message.IsTrueForByte(localEndAct) //本端驾驶室激活(钥匙)
|
||||
vobc.DirectionForward = message.IsTrueForByte(direction1) //方向手柄进位
|
||||
vobc.DirectionBackward = message.IsTrueForByte(direction2) //方向手柄退位
|
||||
//buf := bytes.NewBuffer(data)
|
||||
//localEndAct, _ := buf.ReadByte()
|
||||
//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)) //方向手柄退位
|
||||
}
|
||||
|
||||
// 创建/删除列车
|
||||
|
Loading…
Reference in New Issue
Block a user