列车操控
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m53s
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m53s
This commit is contained in:
parent
dcdb4610f8
commit
c50b1b640d
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
||||
Subproject commit 94413167c079aaa7aa9717a0e4a6281a21c49244
|
||||
Subproject commit 30019273c5bb79fa29caab241bb89bd13d238fd9
|
8
third_party/can_btm/balise_detection.go
vendored
8
third_party/can_btm/balise_detection.go
vendored
@ -85,9 +85,14 @@ func (t *BaliseDetector) newDetect(wd *component.WorldData, repo *repository.Rep
|
||||
curAntennaRi := t.createBtmAntennaRunningInfo(wd, repo, th) //目前车头
|
||||
curAntennaRi2 := t.createBtmAntennaRunningInfo(wd, repo, th2) //上次车头
|
||||
var startBalises []*repository.Transponder
|
||||
if th.Link != th2.Link {
|
||||
startBalises = t.searchBalisesFromBetweenLinkPosition(repo, th.Up, curAntennaRi.LinkId, curAntennaRi.LinkOffset, curAntennaRi.LinkOffset)
|
||||
} else {
|
||||
startBalises = t.searchBalisesFromBetweenLinkPosition(repo, th.Up, curAntennaRi.LinkId, curAntennaRi2.LinkOffset, curAntennaRi.LinkOffset)
|
||||
}
|
||||
|
||||
//startBalises = t.searchBalisesFromBetweenLinkPosition(repo, th.Up, curAntennaRi.LinkId, th2.LinkOffset, th.LinkOffset)
|
||||
startBalises = t.searchBalisesFromBetweenLinkPosition(repo, th.Up, curAntennaRi.LinkId, curAntennaRi2.LinkOffset, curAntennaRi.LinkOffset)
|
||||
//startBalises = t.searchBalisesFromBetweenLinkPosition(repo, th.Up, curAntennaRi.LinkId, curAntennaRi2.LinkOffset, curAntennaRi.LinkOffset)
|
||||
|
||||
balises := make([]*repository.Transponder, 0)
|
||||
for _, balise := range startBalises {
|
||||
@ -108,7 +113,6 @@ func (t *BaliseDetector) newDetect(wd *component.WorldData, repo *repository.Rep
|
||||
//slog.Info(fmt.Sprintf("-----------------id:%v ,offset:%v, up: %v,linkeId:%v ,headoffset:%v,tailOffset:%v", balise.Id(), balise.LinkPosition().Offset(), th.Up, curAntennaRi.LinkId, curAntennaRi.LinkOffset, curAntennaRi2.LinkOffset))
|
||||
telegram, utel := t.rcvTelegram(wd, balise.Id())
|
||||
if t.addNewExpectedBalise(balise, btmCache, telegram, utel) {
|
||||
|
||||
//slog.Info(fmt.Sprintf("+++++++++++++id:%v ,offset:%v, up: %v,linkeId:%v ,headoffset:%v,tailOffset:%v", balise.Id(), balise.LinkPosition().Offset(), th.Up, curAntennaRi.LinkId, curAntennaRi.LinkOffset, curAntennaRi2.LinkOffset))
|
||||
}
|
||||
}
|
||||
|
12
third_party/dynamics/dynamics.go
vendored
12
third_party/dynamics/dynamics.go
vendored
@ -265,6 +265,18 @@ func (d *dynamics) Start(manager DynamicsMessageManager) error {
|
||||
d.udpDelayRecorder.Start()
|
||||
return nil
|
||||
}
|
||||
func (d *dynamics) trainControl(ctx context.Context) {
|
||||
for {
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化客户端、服务等信息
|
||||
func (d *dynamics) initDynamics() error {
|
||||
|
@ -101,7 +101,7 @@ func findTrainTccGraphicDataHandler(tccG *data_proto.TccGraphicStorage, id uint3
|
||||
|
||||
func initTrainVobc(trainLoad int64, trainIsUp bool) (*state_proto.TrainVobcState, uint32) {
|
||||
vobc := &state_proto.TrainVobcState{TrainLoad: int64(trainLoad), BrakingStatus: true, BrakeForce: DEFAULT_BRAKE_FORCE * 100, DirectionForward: true,
|
||||
AllDoorClose: true, ObstacleCheckBtn: true /*RightDoorCloseCommand: true, LeftDoorCloseCommand: true,*/, BrakeHeavyFault: true, AtpCutSwitch: true,
|
||||
AllDoorClose: true, ObstacleCheckBtn: true, RightDoorCloseCommand: true, LeftDoorCloseCommand: true, BrakeHeavyFault: true, AtpCutSwitch: true,
|
||||
ConfirmBtn: true, AtpPowerOnBtn: true, DoorModeMM: true,
|
||||
}
|
||||
var trainActDir uint32 = 0
|
||||
@ -134,11 +134,10 @@ func initTrainTcc(vs *VerifySimulation) *state_proto.TrainControlState {
|
||||
for _, b := range tccGI.TccButtons {
|
||||
btn := &state_proto.TrainControlState_ControlButton{Id: b.Common.Id, Passed: false}
|
||||
switch b.Code {
|
||||
case ATPQCKG /*GZM, GYM,*/, ZAWTGJC, ZDZGZ, ATPSD, MSQR:
|
||||
case ATPQCKG, ZAWTGJC, ZDZGZ, ATPSD, MSQR:
|
||||
btn.Passed = true
|
||||
}
|
||||
btns[b.Code] = btn
|
||||
//btns = append(btns, btn)
|
||||
}
|
||||
tcc.Buttons = btns
|
||||
for _, b := range tccGI.TccHandles {
|
||||
|
@ -25,16 +25,15 @@ const (
|
||||
//列车总质量(吨)
|
||||
DEFULAT_TRAIN_LOAD = 160
|
||||
//通号最大制动力是-1.21
|
||||
DEFAULT_BRAKE_FORCE = DEFULAT_TRAIN_LOAD * 1000 * 1.21 / 1000
|
||||
//DEFAULT_BRAKE_FORCE = DEFULAT_TRAIN_LOAD * 1000 * 1.21 / 1000
|
||||
DEFAULT_BRAKE_FORCE = 1.21
|
||||
//通号最大加速度是0.97
|
||||
DEFAULT_TRAIN_TRACTION = DEFULAT_TRAIN_LOAD * 1000 * 0.97 / 1000 //千牛
|
||||
DEFAULT_TRAIN_WORK = 2880 * 1000
|
||||
DEFAULT_TRAIN_STARTED_SPEED = 0.003
|
||||
DEFAULT_TRAIN_TRACTION_ACC2 = DEFULAT_TRAIN_LOAD * 1000 * 0.97 / 1000 //千牛
|
||||
DEFAULT_TRAIN_TRACTION_ACC = 0.97 //千牛
|
||||
TRAIN_MAX_TRACTION_POWER = 2880 * 1000
|
||||
DEFAULT_TRAIN_STARTED_SPEED float32 = 5.5555556 //列车起步速度单位 米/秒
|
||||
)
|
||||
|
||||
func culTrainTractionF(sta *state_proto.TrainState) {
|
||||
|
||||
}
|
||||
func CreateMsgTrainConfig(trainId int, trainLen int64, configTrainData dto.ConfigTrainData) *message.TrainOperationConfig {
|
||||
return &message.TrainOperationConfig{TrainIndex: trainId, Length: int(trainLen),
|
||||
DavisParamA: configTrainData.DavisParamA, DavisParamB: configTrainData.DavisParamB,
|
||||
@ -371,7 +370,6 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
|
||||
sta.DynamicState.RampResistance = float32(info.SlopeResistance) / 1000
|
||||
sta.DynamicState.CurveResistance = float32(info.CurveResistance) / 1000
|
||||
sta.DynamicState.Speed = speedParse(info.Speed)
|
||||
|
||||
sta.DynamicState.HeadSensorSpeed1 = speedParse(info.HeadSpeed1)
|
||||
sta.DynamicState.HeadSensorSpeed2 = speedParse(info.HeadSpeed2)
|
||||
sta.DynamicState.TailSensorSpeed1 = speedParse(info.TailSpeed1)
|
||||
|
@ -261,6 +261,12 @@ func (s *VerifySimulation) HandleDynamicsTrainInfo(info *message.DynamicsTrainIn
|
||||
train := t.(*state_proto.TrainState)
|
||||
// 更新列车状态
|
||||
trainState := UpdateTrainStateByDynamics(s, trainId, info)
|
||||
vs := train.VobcState
|
||||
if vs.TractionStatus {
|
||||
//动力学之前是kn * 100 这里*10就是N
|
||||
tf := float32(vs.TractionPower) / info.Speed
|
||||
vs.TractionForce = int64(tf / 10)
|
||||
}
|
||||
if train.ConnState.Conn && train.ConnState.ConnType == state_proto.TrainConnState_VOBC {
|
||||
semi_physical_train.Default().SendTrainControlMessage(info)
|
||||
electrical_machinery.Default().SendElectricMachineryMessage2(info, trainState)
|
||||
@ -388,6 +394,7 @@ func (s *VerifySimulation) CollectTrainControlState() []message.TrainControlMsg
|
||||
if train.ConnState.Conn == true && train.ConnState.ConnType == state_proto.TrainConnState_VOBC {
|
||||
vobc = true
|
||||
}
|
||||
//train.DynamicState.Speed
|
||||
cms = append(cms, message.TrainControlMsg{ControlInfo: train.VobcState, TrainId: train.Id, FromVobc: vobc})
|
||||
return true
|
||||
})
|
||||
|
@ -58,7 +58,7 @@ func ControlTrainUpdate(s *VerifySimulation, ct *request_proto.TrainControl) {
|
||||
oldTraction := sta.VobcState.TractionForce
|
||||
oldBrakeForce := sta.VobcState.BrakeForce
|
||||
isTraction := ct.Handler.Val > 0 //是否制动
|
||||
baseMsg = trainControlHandle(vobc, tcc, ct.Handler, ct.DeviceId, tccGraphicData)
|
||||
baseMsg = trainControlHandle(sta.DynamicState.Speed, vobc, tcc, ct.Handler, ct.DeviceId, tccGraphicData)
|
||||
train_pc_sim.Default().SendHandleSwitch(oldTraction, oldBrakeForce, isTraction, sta)
|
||||
} else if ct.ControlType == request_proto.TrainControl_TRAIN_DOOR_MODE_CHANGE {
|
||||
baseMsg = trainDoorModeChangeHandle(vobc, tcc, ct.SwitchKey, ct.DeviceId, tccGraphicData)
|
||||
@ -68,20 +68,6 @@ func ControlTrainUpdate(s *VerifySimulation, ct *request_proto.TrainControl) {
|
||||
} else {
|
||||
baseMsg = append(baseMsg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DIR_ZERO_FORWARD, 0}})
|
||||
}
|
||||
if vobc.LeftDoorOpenCommand || vobc.RightDoorOpenCommand {
|
||||
baseMsg = append(baseMsg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_LOCK_STATE, 0}})
|
||||
if vobc.LeftDoorOpenCommand {
|
||||
baseMsg = append(baseMsg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.LEFT_DOOR_STATE, 1}})
|
||||
baseMsg = append(baseMsg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.RIGHT_DOOR_STATE, 0}})
|
||||
} else if vobc.RightDoorOpenCommand {
|
||||
baseMsg = append(baseMsg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.LEFT_DOOR_STATE, 0}})
|
||||
baseMsg = append(baseMsg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.RIGHT_DOOR_STATE, 1}})
|
||||
}
|
||||
}
|
||||
if vobc.LeftDoorCloseCommand && vobc.RightDoorCloseCommand {
|
||||
baseMsg = append(baseMsg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_LOCK_STATE, 1}})
|
||||
}
|
||||
|
||||
if !vobc.DirectionForward && !vobc.DirectionBackward {
|
||||
vobc.TractionStatus = false
|
||||
vobc.TractionForce = 0
|
||||
@ -112,12 +98,8 @@ func trainControlButton(vobc *state_proto.TrainVobcState, buttonMap map[string]*
|
||||
return controlDoorOpenBtn(vobc, active, btn, graphicBtn.Code == KZM)
|
||||
|
||||
case GZM, GYM: //关左门按钮
|
||||
return controlDoorCloseBtn(vobc, active, btn, graphicBtn.Code == KZM)
|
||||
//return controlLeftDoorCloseBtn(vobc, active, btn)
|
||||
//case KYM: //开右门按钮
|
||||
// return controlRightDoorBtn(vobc, active, btn)
|
||||
//case GYM: //关右门按钮
|
||||
// return controlRightDoorCloseBtn(vobc, active, btn)
|
||||
return controlDoorCloseBtn(vobc, active, btn, graphicBtn.Code == GZM)
|
||||
|
||||
case ZF: //折返按钮
|
||||
return controlReverseBtn(vobc, active, btn)
|
||||
case QZMYX: //强制门允许
|
||||
@ -179,6 +161,7 @@ func controlDoorCloseBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *
|
||||
tccBtn.Passed = active
|
||||
var doorAct byte = message.CLOSE_LEFT_DOOR
|
||||
var doorState byte = message.LEFT_DOOR_STATE
|
||||
msg := make([]message.TrainPcSimBaseMessage, 0)
|
||||
if isLeft {
|
||||
vobc.LeftDoorCloseCommand = active
|
||||
} else {
|
||||
@ -186,10 +169,13 @@ func controlDoorCloseBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *
|
||||
doorAct = message.CLOSE_RIGHT_DOOR
|
||||
doorState = message.RIGHT_DOOR_STATE
|
||||
}
|
||||
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{doorAct, status}},
|
||||
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{doorState, 0}},
|
||||
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{doorAct, status}})
|
||||
if vobc.LeftDoorCloseCommand && vobc.RightDoorCloseCommand {
|
||||
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_LOCK_STATE, 1}})
|
||||
}
|
||||
|
||||
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{doorState, 0}})
|
||||
//msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{doorAct, 0}})
|
||||
return msg
|
||||
}
|
||||
|
||||
// 开车门
|
||||
@ -201,8 +187,10 @@ func controlDoorOpenBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *s
|
||||
var doorState byte = message.LEFT_DOOR_STATE
|
||||
if isLeft {
|
||||
vobc.LeftDoorOpenCommand = active
|
||||
vobc.LeftDoorCloseCommand = false
|
||||
} else {
|
||||
vobc.RightDoorOpenCommand = active
|
||||
vobc.RightDoorCloseCommand = false
|
||||
doorAct = message.OPEN_RIGHT_DOOR
|
||||
doorState = message.RIGHT_DOOR_STATE
|
||||
}
|
||||
@ -214,55 +202,6 @@ func controlDoorOpenBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *s
|
||||
return msg
|
||||
}
|
||||
|
||||
// 开左门按钮
|
||||
func controlLeftDoorBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_proto.TrainControlState_ControlButton) []message.TrainPcSimBaseMessage {
|
||||
var status byte = 0
|
||||
if active {
|
||||
status = 1
|
||||
}
|
||||
vobc.LeftDoorOpenCommand = active
|
||||
tccBtn.Passed = active
|
||||
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.LEFT_OPEN_DOOR, status}},
|
||||
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.LEFT_DOOR_STATE, status}},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 关左门按钮
|
||||
func controlLeftDoorCloseBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_proto.TrainControlState_ControlButton) []message.TrainPcSimBaseMessage {
|
||||
var status byte = 0
|
||||
if active {
|
||||
status = 1
|
||||
}
|
||||
vobc.LeftDoorCloseCommand = active
|
||||
tccBtn.Passed = active
|
||||
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.CLOSE_LEFT_DOOR, status}}}
|
||||
|
||||
}
|
||||
|
||||
// 开右门
|
||||
func controlRightDoorBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_proto.TrainControlState_ControlButton) []message.TrainPcSimBaseMessage {
|
||||
var status byte = 0
|
||||
if active {
|
||||
status = 1
|
||||
}
|
||||
vobc.RightDoorOpenCommand = active
|
||||
tccBtn.Passed = active
|
||||
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OPEN_RIGHT_DOOR, status}}}
|
||||
|
||||
}
|
||||
|
||||
// 关右门按钮
|
||||
func controlRightDoorCloseBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_proto.TrainControlState_ControlButton) []message.TrainPcSimBaseMessage {
|
||||
var status byte = 0
|
||||
if active {
|
||||
status = 1
|
||||
}
|
||||
vobc.RightDoorCloseCommand = active
|
||||
tccBtn.Passed = active
|
||||
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.CLOSE_RIGHT_DOOR, status}}}
|
||||
}
|
||||
|
||||
// 折返
|
||||
func controlReverseBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_proto.TrainControlState_ControlButton) []message.TrainPcSimBaseMessage {
|
||||
var status byte = 0
|
||||
@ -377,6 +316,7 @@ func controlOverhaulBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *s
|
||||
tccBtn.Passed = active
|
||||
vobc.OverhaulBtn = active
|
||||
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OVERHAUL, status}}}
|
||||
//return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.ATO_SEND_TRAIN, status}}}
|
||||
}
|
||||
|
||||
// 休眠按钮
|
||||
@ -480,19 +420,38 @@ func trainDoorModeChangeHandle(vobc *state_proto.TrainVobcState, tcc *state_prot
|
||||
return msg
|
||||
}
|
||||
|
||||
func trainTractionPower(speed int32, traction int64, handleVal int32) int32 {
|
||||
//速度(V)可以通过初始速度 加上加速度(a)乘以时间(t)来计算,即V=V1+at
|
||||
acc := float32(math.Abs(float64(handleVal)) / 100 * DEFAULT_TRAIN_TRACTION_ACC)
|
||||
resultSpeed := DEFAULT_TRAIN_STARTED_SPEED + acc
|
||||
if speed > 0 {
|
||||
resultSpeed = float32(speed)/3.6/100 + acc
|
||||
}
|
||||
// p=fv
|
||||
p := float32(traction) * resultSpeed
|
||||
if p >= TRAIN_MAX_TRACTION_POWER {
|
||||
return TRAIN_MAX_TRACTION_POWER
|
||||
}
|
||||
return int32(p)
|
||||
|
||||
}
|
||||
func trainBrakingOrTraction(trainLoad int64, handleVal int32, power float64) int64 {
|
||||
tl := trainLoad * 10 //列车初始化已经 * 100,再*10 就是对应的kg
|
||||
//F=ma 单位 F单位:牛顿,m单位:千克,a单位:米/秒²
|
||||
totalPower := float64(tl) * power / 1000
|
||||
//DEFULAT_TRAIN_LOAD * 1000 * 0.97 / 1000
|
||||
n := int64(math.Abs(float64(handleVal))/100*totalPower) * 100
|
||||
return n
|
||||
}
|
||||
|
||||
// 列车牵引控制
|
||||
func trainControlHandle(vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_PushHandler, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []message.TrainPcSimBaseMessage {
|
||||
func trainControlHandle(speed int32, vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_PushHandler, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []message.TrainPcSimBaseMessage {
|
||||
_, find := findTrainTccGraphicDataHandler(tccGraphic, deviceId)
|
||||
if !find {
|
||||
slog.Error("未找到对应的牵引制动手柄设备deviceId:", deviceId)
|
||||
return nil
|
||||
}
|
||||
/*trainStart := false
|
||||
if tcc.PushHandler.Val <= 0 {
|
||||
trainStart = true
|
||||
} else if tcc.PushHandler.Val > 0 {
|
||||
|
||||
}*/
|
||||
jjzdBtn := tcc.Buttons[JJZD]
|
||||
vobc.TractionStatus = false
|
||||
vobc.TractionForce = 0
|
||||
@ -503,14 +462,17 @@ func trainControlHandle(vobc *state_proto.TrainVobcState, tcc *state_proto.Train
|
||||
var zeroState byte = 0
|
||||
var brakeState byte = 0
|
||||
var traction byte = 0
|
||||
vobc.TractionPower = 0
|
||||
if request.Val > 0 {
|
||||
vobc.TractionStatus = true
|
||||
vobc.TractionForce = int64(float32(request.Val)/100*DEFAULT_TRAIN_TRACTION) * 100
|
||||
vobc.TractionForce = trainBrakingOrTraction(vobc.TrainLoad, request.Val, DEFAULT_TRAIN_TRACTION_ACC)
|
||||
vobc.TractionPower = trainTractionPower(speed, vobc.TractionForce, request.Val)
|
||||
notBreak = 1
|
||||
traction = 1
|
||||
} else if request.Val < 0 {
|
||||
vobc.BrakingStatus = true
|
||||
vobc.BrakeForce = int64(math.Abs(float64(request.Val))/100*DEFAULT_BRAKE_FORCE) * 100
|
||||
//vobc.BrakeForce = int64(math.Abs(float64(request.Val))/100*DEFAULT_BRAKE_FORCE) * 100
|
||||
vobc.BrakeForce = trainBrakingOrTraction(vobc.TrainLoad, request.Val, DEFAULT_BRAKE_FORCE)
|
||||
vobc.EmergencyBrakingStatus = false
|
||||
jjzdBtn.Passed = false
|
||||
brakeState = 1
|
||||
@ -702,7 +664,7 @@ func trainPcSimDigitalOutInfoHandleCode7_0(d byte, vobc *state_proto.TrainVobcSt
|
||||
vobc.EmergencyBrakingStatus = message.AtpLowPowerByte(message.GetBit(d, 3)) //紧急制动
|
||||
vobc.LeftDoorState = message.IsTrueForByte(message.GetBit(d, 4)) //开左门允许
|
||||
vobc.RightDoorState = message.IsTrueForByte(message.GetBit(d, 5)) //开右门允许
|
||||
vobc.RightDoorCloseCommand = message.IsTrueForByte(message.GetBit(d, 6)) //关右门
|
||||
vobc.AtoCloseRightDoor = message.IsTrueForByte(message.GetBit(d, 6)) //ATO关右门
|
||||
vobc.AllDoorClose = message.IsTrueForByte(message.GetBit(d, 7)) //车门保持关闭
|
||||
vobc.LightTractionSafetyCircuit = vobc.TractionSafetyCircuit //切牵引
|
||||
vobc.LightEmergencyBrakingStatus = vobc.EmergencyBrakingStatus //紧急制动
|
||||
@ -894,15 +856,15 @@ func (s *VerifySimulation) ObtainTrainDigitalMockDataForStatus(train *state_prot
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.HANDLE_FORWORD, 0}, Type: message.SENDER_TRAIN_OUTR_INFO}) //方向手柄向前控制
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.HANDLE_BACKWORD, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //方向手柄向前控制
|
||||
}
|
||||
/*if vs.RightDoorCloseCommand {
|
||||
/* if vs.RightDoorCloseCommand {
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.CLOSE_RIGHT_DOOR, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //关右门按钮
|
||||
}
|
||||
if vs.LeftDoorCloseCommand {
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.CLOSE_LEFT_DOOR, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //关左门按钮
|
||||
}*/
|
||||
if vs.AllDoorClose {
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DOOR_LOCK_STATE, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //车门锁闭状态
|
||||
}
|
||||
if vs.AllDoorClose {
|
||||
|
||||
}*/
|
||||
if vs.ObstacleCheckBtn {
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.OBSTACLE_CHECK, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //障碍物检测按钮
|
||||
}
|
||||
@ -922,18 +884,11 @@ func (s *VerifySimulation) ObtainTrainDigitalMockDataForStatus(train *state_prot
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.EMERGENT_HANDLE_DOWN, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //紧急手柄拉下
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.TRAIN_TRACTION_CUTED, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //紧急手柄拉下
|
||||
|
||||
if vs.DoorModeAA {
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DOOR_MODE_AA, 1}, Type: message.SENDER_TRAIN_OUTR_INFO})
|
||||
} else if vs.DoorModeAM {
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DOOR_MODE_AM, 1}, Type: message.SENDER_TRAIN_OUTR_INFO})
|
||||
} else if vs.DoorModeMM {
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DOOR_MODE_MM, 1}, Type: message.SENDER_TRAIN_OUTR_INFO})
|
||||
}
|
||||
return msgArr
|
||||
}
|
||||
func (s *VerifySimulation) ObtainTrainDigitalMockData(train *state_proto.TrainState) []message.TrainPcSimBaseMessage {
|
||||
msgArr := make([]message.TrainPcSimBaseMessage, 0)
|
||||
|
||||
vs := train.VobcState
|
||||
stateArr := s.ObtainTrainDigitalMockDataForStatus(train)
|
||||
msgArr = append(msgArr, stateArr...)
|
||||
|
||||
@ -947,7 +902,20 @@ func (s *VerifySimulation) ObtainTrainDigitalMockData(train *state_proto.TrainSt
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{38, 0}, Type: message.SENDER_TRAIN_OUTR_INFO}) //只牵引
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{40, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //本端机械钩
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{41, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //对端机械钩
|
||||
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DOOR_LOCK_STATE, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //车门锁闭状态
|
||||
var modeAA, modeAM, modeMM byte = 0, 0, 0
|
||||
if vs.DoorModeAA {
|
||||
modeAA = 1
|
||||
}
|
||||
if vs.DoorModeAM {
|
||||
modeAM = 1
|
||||
}
|
||||
if vs.DoorModeMM {
|
||||
modeMM = 1
|
||||
}
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DOOR_MODE_AA, modeAA}, Type: message.SENDER_TRAIN_OUTR_INFO})
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DOOR_MODE_AM, modeAM}, Type: message.SENDER_TRAIN_OUTR_INFO})
|
||||
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DOOR_MODE_MM, modeMM}, Type: message.SENDER_TRAIN_OUTR_INFO})
|
||||
train.BtmState = nil
|
||||
return msgArr
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user