|
|
|
@ -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 {
|
|
|
|
|
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.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 {
|
|
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
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...)
|
|
|
|
|
|
|
|
|
@ -943,11 +898,24 @@ func (s *VerifySimulation) ObtainTrainDigitalMockData(train *state_proto.TrainSt
|
|
|
|
|
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.CONFIRM, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //列车完整性
|
|
|
|
|
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.TRAIN_INTEGRITY, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //列车完整性
|
|
|
|
|
|
|
|
|
|
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.NOT_BREAK, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //非制动
|
|
|
|
|
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.NOT_BREAK, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //非制动
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|