Compare commits

...

5 Commits

Author SHA1 Message Date
tiger_zhou
fa600673a6 列车控制支持门模式更新
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 3m15s
2024-08-22 13:12:03 +08:00
f8517f0ead [修改]暂时注释掉12号线联锁和计轴的大段日志 2024-08-21 09:18:55 +08:00
tiger_zhou
0de305b397 列车操控调整 2024-08-16 15:33:30 +08:00
tiger_zhou
15c015a9a5 列车应答器调整 2024-08-15 14:54:16 +08:00
eae1b8d6df [bug]之前,在仿真运行时联锁配置中的code被替换为了车站uid,后来我只是简单将此转换去掉了,导致有些将此code当uid使用的场景出错 2024-08-15 14:43:20 +08:00
20 changed files with 2610 additions and 2352 deletions

File diff suppressed because it is too large Load Diff

View File

@ -74,6 +74,7 @@ type TccKey_TccKeyType int32
const (
TccKey_driverControllerActivationClint TccKey_TccKeyType = 0 //司控器激活端
TccKey_frontAndRearDirectionalControl TccKey_TccKeyType = 1 //前后方向控制
TccKey_trainDoorMode TccKey_TccKeyType = 2 //列车门模式
)
// Enum value maps for TccKey_TccKeyType.
@ -81,10 +82,12 @@ var (
TccKey_TccKeyType_name = map[int32]string{
0: "driverControllerActivationClint",
1: "frontAndRearDirectionalControl",
2: "trainDoorMode",
}
TccKey_TccKeyType_value = map[string]int32{
"driverControllerActivationClint": 0,
"frontAndRearDirectionalControl": 1,
"trainDoorMode": 2,
}
)
@ -591,7 +594,7 @@ var file_tccGraphics_proto_rawDesc = []byte{
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x1a, 0x0a,
0x08, 0x66, 0x6f, 0x6e, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
0x08, 0x66, 0x6f, 0x6e, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x22, 0xdb, 0x01, 0x0a, 0x06, 0x54, 0x63,
0x08, 0x66, 0x6f, 0x6e, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x22, 0xee, 0x01, 0x0a, 0x06, 0x54, 0x63,
0x63, 0x4b, 0x65, 0x79, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61,
0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63,
@ -600,37 +603,38 @@ var file_tccGraphics_proto_rawDesc = []byte{
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x74, 0x63, 0x63, 0x47, 0x72, 0x61,
0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x63, 0x63, 0x4b, 0x65, 0x79, 0x2e,
0x54, 0x63, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
0x22, 0x55, 0x0a, 0x0a, 0x54, 0x63, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x23,
0x22, 0x68, 0x0a, 0x0a, 0x54, 0x63, 0x63, 0x4b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x23,
0x0a, 0x1f, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c,
0x65, 0x72, 0x41, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x69, 0x6e,
0x74, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x41, 0x6e, 0x64, 0x52,
0x65, 0x61, 0x72, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x43, 0x6f,
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x10, 0x01, 0x22, 0x50, 0x0a, 0x09, 0x54, 0x63, 0x63, 0x48, 0x61,
0x6e, 0x64, 0x6c, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61,
0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x06, 0x63,
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0xd6, 0x01, 0x0a, 0x08, 0x54, 0x63,
0x63, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63,
0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x3f, 0x0a, 0x0a, 0x6c,
0x69, 0x67, 0x68, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x1f, 0x2e, 0x74, 0x63, 0x63, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61,
0x2e, 0x54, 0x63, 0x63, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
0x52, 0x0a, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x20, 0x0a, 0x0b,
0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28,
0x08, 0x52, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x22,
0x0a, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x05,
0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61,
0x74, 0x65, 0x2a, 0x2f, 0x0a, 0x0f, 0x54, 0x63, 0x63, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74,
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x09, 0x0a, 0x05, 0x67, 0x72, 0x65, 0x65, 0x6e, 0x10, 0x00,
0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x62, 0x6c, 0x75,
0x65, 0x10, 0x02, 0x42, 0x2d, 0x5a, 0x2b, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63,
0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72,
0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x74, 0x72, 0x61, 0x69, 0x6e,
0x44, 0x6f, 0x6f, 0x72, 0x4d, 0x6f, 0x64, 0x65, 0x10, 0x02, 0x22, 0x50, 0x0a, 0x09, 0x54, 0x63,
0x63, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69,
0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0xd6, 0x01, 0x0a,
0x08, 0x54, 0x63, 0x63, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x61, 0x70,
0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x49, 0x6e,
0x66, 0x6f, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x3f,
0x0a, 0x0a, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x74, 0x63, 0x63, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44,
0x61, 0x74, 0x61, 0x2e, 0x54, 0x63, 0x63, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f,
0x6c, 0x6f, 0x72, 0x52, 0x0a, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12,
0x20, 0x0a, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x04,
0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x65, 0x76, 0x65,
0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74,
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c,
0x53, 0x74, 0x61, 0x74, 0x65, 0x2a, 0x2f, 0x0a, 0x0f, 0x54, 0x63, 0x63, 0x45, 0x6c, 0x65, 0x6d,
0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x09, 0x0a, 0x05, 0x67, 0x72, 0x65, 0x65,
0x6e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04,
0x62, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x42, 0x2d, 0x5a, 0x2b, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e,
0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x5f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -538,10 +538,11 @@ func (Psd_Fault) EnumDescriptor() ([]byte, []int) {
type TrainControl_TrainControlType int32
const (
TrainControl_EMERGENT_BUTTON TrainControl_TrainControlType = 0 // 摁钮
TrainControl_DRIVER_KEY_SWITCH TrainControl_TrainControlType = 1 //驾驶端钥匙
TrainControl_DIRECTION_KEY_SWITCH TrainControl_TrainControlType = 2 //方向钥匙
TrainControl_HANDLER TrainControl_TrainControlType = 3 //手柄
TrainControl_EMERGENT_BUTTON TrainControl_TrainControlType = 0 // 摁钮
TrainControl_DRIVER_KEY_SWITCH TrainControl_TrainControlType = 1 //驾驶端钥匙
TrainControl_DIRECTION_KEY_SWITCH TrainControl_TrainControlType = 2 //方向钥匙
TrainControl_HANDLER TrainControl_TrainControlType = 3 //手柄
TrainControl_TRAIN_DOOR_MODE_CHANGE TrainControl_TrainControlType = 4 //列车门模式
)
// Enum value maps for TrainControl_TrainControlType.
@ -551,12 +552,14 @@ var (
1: "DRIVER_KEY_SWITCH",
2: "DIRECTION_KEY_SWITCH",
3: "HANDLER",
4: "TRAIN_DOOR_MODE_CHANGE",
}
TrainControl_TrainControlType_value = map[string]int32{
"EMERGENT_BUTTON": 0,
"DRIVER_KEY_SWITCH": 1,
"DIRECTION_KEY_SWITCH": 2,
"HANDLER": 3,
"EMERGENT_BUTTON": 0,
"DRIVER_KEY_SWITCH": 1,
"DIRECTION_KEY_SWITCH": 2,
"HANDLER": 3,
"TRAIN_DOOR_MODE_CHANGE": 4,
}
)
@ -587,52 +590,52 @@ func (TrainControl_TrainControlType) EnumDescriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 0}
}
type TrainControl_Direction int32
type TrainControl_KeyLocation int32
const (
TrainControl_BACKWARD TrainControl_Direction = 0 //后退
TrainControl_FORWARD TrainControl_Direction = 1 //前进
TrainControl_NEUTRALWARD TrainControl_Direction = 2 //中位
TrainControl_KL_END TrainControl_KeyLocation = 0 //方向:后退 门模式:mm模式
TrainControl_KL_FONT TrainControl_KeyLocation = 1 //方向:前进 门模式:AA模式
TrainControl_KL_CENTER TrainControl_KeyLocation = 2 //方向:中位 门模式:AM模式
)
// Enum value maps for TrainControl_Direction.
// Enum value maps for TrainControl_KeyLocation.
var (
TrainControl_Direction_name = map[int32]string{
0: "BACKWARD",
1: "FORWARD",
2: "NEUTRALWARD",
TrainControl_KeyLocation_name = map[int32]string{
0: "KL_END",
1: "KL_FONT",
2: "KL_CENTER",
}
TrainControl_Direction_value = map[string]int32{
"BACKWARD": 0,
"FORWARD": 1,
"NEUTRALWARD": 2,
TrainControl_KeyLocation_value = map[string]int32{
"KL_END": 0,
"KL_FONT": 1,
"KL_CENTER": 2,
}
)
func (x TrainControl_Direction) Enum() *TrainControl_Direction {
p := new(TrainControl_Direction)
func (x TrainControl_KeyLocation) Enum() *TrainControl_KeyLocation {
p := new(TrainControl_KeyLocation)
*p = x
return p
}
func (x TrainControl_Direction) String() string {
func (x TrainControl_KeyLocation) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TrainControl_Direction) Descriptor() protoreflect.EnumDescriptor {
func (TrainControl_KeyLocation) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[11].Descriptor()
}
func (TrainControl_Direction) Type() protoreflect.EnumType {
func (TrainControl_KeyLocation) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[11]
}
func (x TrainControl_Direction) Number() protoreflect.EnumNumber {
func (x TrainControl_KeyLocation) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use TrainControl_Direction.Descriptor instead.
func (TrainControl_Direction) EnumDescriptor() ([]byte, []int) {
// Deprecated: Use TrainControl_KeyLocation.Descriptor instead.
func (TrainControl_KeyLocation) EnumDescriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 1}
}
@ -1682,14 +1685,14 @@ type TrainControl struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id
TrainId string `protobuf:"bytes,2,opt,name=trainId,proto3" json:"trainId,omitempty"`
DeviceId uint32 `protobuf:"varint,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` //设备id
ControlType TrainControl_TrainControlType `protobuf:"varint,4,opt,name=controlType,proto3,enum=request.TrainControl_TrainControlType" json:"controlType,omitempty"`
ControlButton *TrainControl_ControlButton `protobuf:"bytes,5,opt,name=controlButton,proto3" json:"controlButton,omitempty"` // 控制按钮
DriverKey *TrainControl_DriverKeySwitch `protobuf:"bytes,6,opt,name=driverKey,proto3" json:"driverKey,omitempty"`
DirKey *TrainControl_DirectionKeySwitch `protobuf:"bytes,7,opt,name=dirKey,proto3" json:"dirKey,omitempty"` //方向
Handler *TrainControl_PushHandler `protobuf:"bytes,8,opt,name=handler,proto3" json:"handler,omitempty"` //手柄
SimulationId string `protobuf:"bytes,1,opt,name=simulationId,proto3" json:"simulationId,omitempty"` // 仿真id
TrainId string `protobuf:"bytes,2,opt,name=trainId,proto3" json:"trainId,omitempty"`
DeviceId uint32 `protobuf:"varint,3,opt,name=deviceId,proto3" json:"deviceId,omitempty"` //设备id
ControlType TrainControl_TrainControlType `protobuf:"varint,4,opt,name=controlType,proto3,enum=request.TrainControl_TrainControlType" json:"controlType,omitempty"`
ControlButton *TrainControl_ControlButton `protobuf:"bytes,5,opt,name=controlButton,proto3" json:"controlButton,omitempty"` // 控制按钮
DriverKey *TrainControl_DriverKeySwitch `protobuf:"bytes,6,opt,name=driverKey,proto3" json:"driverKey,omitempty"`
SwitchKey *TrainControl_SwitchKeyChange `protobuf:"bytes,7,opt,name=switchKey,proto3" json:"switchKey,omitempty"` //方向/门模式
Handler *TrainControl_PushHandler `protobuf:"bytes,8,opt,name=handler,proto3" json:"handler,omitempty"` //手柄
}
func (x *TrainControl) Reset() {
@ -1766,9 +1769,9 @@ func (x *TrainControl) GetDriverKey() *TrainControl_DriverKeySwitch {
return nil
}
func (x *TrainControl) GetDirKey() *TrainControl_DirectionKeySwitch {
func (x *TrainControl) GetSwitchKey() *TrainControl_SwitchKeyChange {
if x != nil {
return x.DirKey
return x.SwitchKey
}
return nil
}
@ -2259,16 +2262,16 @@ func (x *TrainControl_DriverKeySwitch) GetVal() bool {
return false
}
type TrainControl_DirectionKeySwitch struct {
type TrainControl_SwitchKeyChange struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Val uint32 `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"` //0=后1=前,2=中位
Val uint32 `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"` //0=后(门模式:MM)1=前(门模式:AA),2=中位(门模式:AM)
}
func (x *TrainControl_DirectionKeySwitch) Reset() {
*x = TrainControl_DirectionKeySwitch{}
func (x *TrainControl_SwitchKeyChange) Reset() {
*x = TrainControl_SwitchKeyChange{}
if protoimpl.UnsafeEnabled {
mi := &file_request_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -2276,13 +2279,13 @@ func (x *TrainControl_DirectionKeySwitch) Reset() {
}
}
func (x *TrainControl_DirectionKeySwitch) String() string {
func (x *TrainControl_SwitchKeyChange) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrainControl_DirectionKeySwitch) ProtoMessage() {}
func (*TrainControl_SwitchKeyChange) ProtoMessage() {}
func (x *TrainControl_DirectionKeySwitch) ProtoReflect() protoreflect.Message {
func (x *TrainControl_SwitchKeyChange) ProtoReflect() protoreflect.Message {
mi := &file_request_proto_msgTypes[24]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -2294,12 +2297,12 @@ func (x *TrainControl_DirectionKeySwitch) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use TrainControl_DirectionKeySwitch.ProtoReflect.Descriptor instead.
func (*TrainControl_DirectionKeySwitch) Descriptor() ([]byte, []int) {
// Deprecated: Use TrainControl_SwitchKeyChange.ProtoReflect.Descriptor instead.
func (*TrainControl_SwitchKeyChange) Descriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 3}
}
func (x *TrainControl_DirectionKeySwitch) GetVal() uint32 {
func (x *TrainControl_SwitchKeyChange) GetVal() uint32 {
if x != nil {
return x.Val
}
@ -2482,7 +2485,7 @@ var file_request_proto_rawDesc = []byte{
0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x2e, 0x50, 0x73, 0x64, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75, 0x6c,
0x74, 0x22, 0xa2, 0x06, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72,
0x74, 0x22, 0xbd, 0x06, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72,
0x6f, 0x6c, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x49,
@ -2502,89 +2505,90 @@ var file_request_proto_rawDesc = []byte{
0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54,
0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x44, 0x72, 0x69, 0x76,
0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x52, 0x09, 0x64, 0x72, 0x69,
0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x40, 0x0a, 0x06, 0x64, 0x69, 0x72, 0x4b, 0x65, 0x79,
0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x44, 0x69,
0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68,
0x52, 0x06, 0x64, 0x69, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x3b, 0x0a, 0x07, 0x68, 0x61, 0x6e, 0x64,
0x6c, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x72, 0x65, 0x71, 0x75,
0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x43, 0x0a, 0x09, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68,
0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x72, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c,
0x2e, 0x50, 0x75, 0x73, 0x68, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52, 0x07, 0x68, 0x61,
0x6e, 0x64, 0x6c, 0x65, 0x72, 0x1a, 0x27, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c,
0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x1a, 0x28,
0x0a, 0x0e, 0x45, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e,
0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x1a, 0x23, 0x0a, 0x0f, 0x44, 0x72, 0x69, 0x76,
0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x76,
0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x1a, 0x26, 0x0a,
0x12, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x53, 0x77, 0x69,
0x74, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4b, 0x65, 0x79, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
0x52, 0x09, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x3b, 0x0a, 0x07, 0x68,
0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x72,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74,
0x72, 0x6f, 0x6c, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x52,
0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x1a, 0x27, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x74,
0x72, 0x6f, 0x6c, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74,
0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76,
0x65, 0x1a, 0x28, 0x0a, 0x0e, 0x45, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x74, 0x42, 0x75, 0x74,
0x74, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x1a, 0x23, 0x0a, 0x0f, 0x44,
0x72, 0x69, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x12, 0x10,
0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x76, 0x61, 0x6c,
0x1a, 0x23, 0x0a, 0x0f, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4b, 0x65, 0x79, 0x43, 0x68, 0x61,
0x6e, 0x67, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
0x52, 0x03, 0x76, 0x61, 0x6c, 0x1a, 0x1f, 0x0a, 0x0b, 0x50, 0x75, 0x73, 0x68, 0x48, 0x61, 0x6e,
0x64, 0x6c, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x65, 0x0a, 0x10, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43,
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x4d,
0x45, 0x52, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x42, 0x55, 0x54, 0x54, 0x4f, 0x4e, 0x10, 0x00, 0x12,
0x15, 0x0a, 0x11, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x57,
0x49, 0x54, 0x43, 0x48, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54,
0x49, 0x4f, 0x4e, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x57, 0x49, 0x54, 0x43, 0x48, 0x10, 0x02,
0x12, 0x0b, 0x0a, 0x07, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x52, 0x10, 0x03, 0x22, 0x37, 0x0a,
0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x41,
0x43, 0x4b, 0x57, 0x41, 0x52, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x4f, 0x52, 0x57,
0x41, 0x52, 0x44, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x45, 0x55, 0x54, 0x52, 0x41, 0x4c,
0x57, 0x41, 0x52, 0x44, 0x10, 0x02, 0x22, 0xc6, 0x01, 0x0a, 0x0f, 0x43, 0x6b, 0x6d, 0x4f, 0x70,
0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69,
0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14,
0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d,
0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64,
0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b,
0x6d, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18,
0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e,
0x43, 0x6b, 0x6d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22,
0x82, 0x01, 0x0a, 0x03, 0x43, 0x6b, 0x6d, 0x22, 0x29, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65,
0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x10, 0x01, 0x22, 0x27, 0x0a, 0x05, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x46,
0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x5f, 0x4b, 0x4d, 0x10,
0x01, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x5f, 0x47, 0x4d, 0x10, 0x02, 0x22, 0x27, 0x0a, 0x05, 0x46,
0x61, 0x75, 0x6c, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x41, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10,
0x00, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x41, 0x5f, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x4c, 0x6f,
0x73, 0x73, 0x10, 0x01, 0x22, 0x5e, 0x0a, 0x08, 0x43, 0x6b, 0x6d, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x12, 0x28, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x2e, 0x46, 0x6f,
0x72, 0x63, 0x65, 0x52, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61,
0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66,
0x61, 0x75, 0x6c, 0x74, 0x22, 0xc6, 0x01, 0x0a, 0x0f, 0x58, 0x63, 0x6a, 0x4f, 0x70, 0x65, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75,
0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05,
0x6d, 0x61, 0x70, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70,
0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34,
0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28,
0x0e, 0x32, 0x16, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a, 0x2e,
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x05, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58, 0x63,
0x6a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x54, 0x0a,
0x03, 0x58, 0x63, 0x6a, 0x22, 0x29, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00,
0x12, 0x0d, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x10, 0x01, 0x22,
0x22, 0x0a, 0x05, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x41, 0x5f, 0x4e,
0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x41, 0x5f, 0x46, 0x61, 0x75, 0x6c,
0x74, 0x10, 0x01, 0x22, 0x34, 0x0a, 0x08, 0x58, 0x63, 0x6a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12,
0x28, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12,
0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a, 0x2e, 0x46, 0x61, 0x75,
0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x42, 0x30, 0x5a, 0x2e, 0x6a, 0x6f, 0x79,
0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73,
0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x05, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x81, 0x01, 0x0a, 0x10, 0x54, 0x72, 0x61, 0x69, 0x6e,
0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x45,
0x4d, 0x45, 0x52, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x42, 0x55, 0x54, 0x54, 0x4f, 0x4e, 0x10, 0x00,
0x12, 0x15, 0x0a, 0x11, 0x44, 0x52, 0x49, 0x56, 0x45, 0x52, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x53,
0x57, 0x49, 0x54, 0x43, 0x48, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x49, 0x52, 0x45, 0x43,
0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x4b, 0x45, 0x59, 0x5f, 0x53, 0x57, 0x49, 0x54, 0x43, 0x48, 0x10,
0x02, 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x41, 0x4e, 0x44, 0x4c, 0x45, 0x52, 0x10, 0x03, 0x12, 0x1a,
0x0a, 0x16, 0x54, 0x52, 0x41, 0x49, 0x4e, 0x5f, 0x44, 0x4f, 0x4f, 0x52, 0x5f, 0x4d, 0x4f, 0x44,
0x45, 0x5f, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x04, 0x22, 0x35, 0x0a, 0x0b, 0x4b, 0x65,
0x79, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x0a, 0x06, 0x4b, 0x4c, 0x5f,
0x45, 0x4e, 0x44, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4b, 0x4c, 0x5f, 0x46, 0x4f, 0x4e, 0x54,
0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4b, 0x4c, 0x5f, 0x43, 0x45, 0x4e, 0x54, 0x45, 0x52, 0x10,
0x02, 0x22, 0xc6, 0x01, 0x0a, 0x0f, 0x43, 0x6b, 0x6d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d,
0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70,
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12,
0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16,
0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x2e, 0x4f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x12, 0x27, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x11, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x82, 0x01, 0x0a, 0x03, 0x43,
0x6b, 0x6d, 0x22, 0x29, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d,
0x0a, 0x09, 0x53, 0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x10, 0x01, 0x22, 0x27, 0x0a,
0x05, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x5f, 0x4e, 0x4f, 0x4e, 0x45,
0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x5f, 0x4b, 0x4d, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04,
0x46, 0x5f, 0x47, 0x4d, 0x10, 0x02, 0x22, 0x27, 0x0a, 0x05, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12,
0x0b, 0x0a, 0x07, 0x46, 0x41, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
0x46, 0x41, 0x5f, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x4c, 0x6f, 0x73, 0x73, 0x10, 0x01, 0x22,
0x5e, 0x0a, 0x08, 0x43, 0x6b, 0x6d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x28, 0x0a, 0x05, 0x66,
0x6f, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x2e, 0x43, 0x6b, 0x6d, 0x2e, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x52, 0x05,
0x66, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x43,
0x6b, 0x6d, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x22,
0xc6, 0x01, 0x0a, 0x0f, 0x58, 0x63, 0x6a, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x69, 0x6d, 0x75, 0x6c,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a,
0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x34, 0x0a, 0x09, 0x6f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x72,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x27, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x54, 0x0a, 0x03, 0x58, 0x63, 0x6a, 0x22,
0x29, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09,
0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53,
0x65, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x10, 0x01, 0x22, 0x22, 0x0a, 0x05, 0x46, 0x61,
0x75, 0x6c, 0x74, 0x12, 0x0b, 0x0a, 0x07, 0x46, 0x41, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00,
0x12, 0x0c, 0x0a, 0x08, 0x46, 0x41, 0x5f, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x10, 0x01, 0x22, 0x34,
0x0a, 0x08, 0x58, 0x63, 0x6a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x28, 0x0a, 0x05, 0x66, 0x61,
0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x72, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x2e, 0x58, 0x63, 0x6a, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66,
0x61, 0x75, 0x6c, 0x74, 0x42, 0x30, 0x5a, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e,
0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65,
0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -2602,49 +2606,49 @@ func file_request_proto_rawDescGZIP() []byte {
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 17)
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 26)
var file_request_proto_goTypes = []interface{}{
(Relay_Operation)(0), // 0: request.Relay.Operation
(Points_Operation)(0), // 1: request.Points.Operation
(Points_Force)(0), // 2: request.Points.Force
(Signal_Operation)(0), // 3: request.Signal.Operation
(Signal_DS)(0), // 4: request.Signal.DS
(Signal_Force)(0), // 5: request.Signal.Force
(Section_Operation)(0), // 6: request.Section.Operation
(Psd_Operation)(0), // 7: request.Psd.Operation
(Psd_Force)(0), // 8: request.Psd.Force
(Psd_Fault)(0), // 9: request.Psd.Fault
(TrainControl_TrainControlType)(0), // 10: request.TrainControl.TrainControlType
(TrainControl_Direction)(0), // 11: request.TrainControl.Direction
(Ckm_Operation)(0), // 12: request.Ckm.Operation
(Ckm_Force)(0), // 13: request.Ckm.Force
(Ckm_Fault)(0), // 14: request.Ckm.Fault
(Xcj_Operation)(0), // 15: request.Xcj.Operation
(Xcj_Fault)(0), // 16: request.Xcj.Fault
(*Relay)(nil), // 17: request.Relay
(*RelayOperationReq)(nil), // 18: request.RelayOperationReq
(*Points)(nil), // 19: request.Points
(*PointsOperationReq)(nil), // 20: request.PointsOperationReq
(*PointsParam)(nil), // 21: request.PointsParam
(*Signal)(nil), // 22: request.Signal
(*SignalOperationReq)(nil), // 23: request.SignalOperationReq
(*SignalParam)(nil), // 24: request.SignalParam
(*Section)(nil), // 25: request.Section
(*SectionOperationReq)(nil), // 26: request.SectionOperationReq
(*SectionParam)(nil), // 27: request.SectionParam
(*Psd)(nil), // 28: request.Psd
(*PsdOperationReq)(nil), // 29: request.PsdOperationReq
(*PsdParam)(nil), // 30: request.PsdParam
(*TrainControl)(nil), // 31: request.TrainControl
(*CkmOperationReq)(nil), // 32: request.CkmOperationReq
(*Ckm)(nil), // 33: request.Ckm
(*CkmParam)(nil), // 34: request.CkmParam
(*XcjOperationReq)(nil), // 35: request.XcjOperationReq
(*Xcj)(nil), // 36: request.Xcj
(*XcjParam)(nil), // 37: request.XcjParam
(*TrainControl_ControlButton)(nil), // 38: request.TrainControl.ControlButton
(*TrainControl_EmergentButton)(nil), // 39: request.TrainControl.EmergentButton
(*TrainControl_DriverKeySwitch)(nil), // 40: request.TrainControl.DriverKeySwitch
(*TrainControl_DirectionKeySwitch)(nil), // 41: request.TrainControl.DirectionKeySwitch
(*TrainControl_PushHandler)(nil), // 42: request.TrainControl.PushHandler
(Relay_Operation)(0), // 0: request.Relay.Operation
(Points_Operation)(0), // 1: request.Points.Operation
(Points_Force)(0), // 2: request.Points.Force
(Signal_Operation)(0), // 3: request.Signal.Operation
(Signal_DS)(0), // 4: request.Signal.DS
(Signal_Force)(0), // 5: request.Signal.Force
(Section_Operation)(0), // 6: request.Section.Operation
(Psd_Operation)(0), // 7: request.Psd.Operation
(Psd_Force)(0), // 8: request.Psd.Force
(Psd_Fault)(0), // 9: request.Psd.Fault
(TrainControl_TrainControlType)(0), // 10: request.TrainControl.TrainControlType
(TrainControl_KeyLocation)(0), // 11: request.TrainControl.KeyLocation
(Ckm_Operation)(0), // 12: request.Ckm.Operation
(Ckm_Force)(0), // 13: request.Ckm.Force
(Ckm_Fault)(0), // 14: request.Ckm.Fault
(Xcj_Operation)(0), // 15: request.Xcj.Operation
(Xcj_Fault)(0), // 16: request.Xcj.Fault
(*Relay)(nil), // 17: request.Relay
(*RelayOperationReq)(nil), // 18: request.RelayOperationReq
(*Points)(nil), // 19: request.Points
(*PointsOperationReq)(nil), // 20: request.PointsOperationReq
(*PointsParam)(nil), // 21: request.PointsParam
(*Signal)(nil), // 22: request.Signal
(*SignalOperationReq)(nil), // 23: request.SignalOperationReq
(*SignalParam)(nil), // 24: request.SignalParam
(*Section)(nil), // 25: request.Section
(*SectionOperationReq)(nil), // 26: request.SectionOperationReq
(*SectionParam)(nil), // 27: request.SectionParam
(*Psd)(nil), // 28: request.Psd
(*PsdOperationReq)(nil), // 29: request.PsdOperationReq
(*PsdParam)(nil), // 30: request.PsdParam
(*TrainControl)(nil), // 31: request.TrainControl
(*CkmOperationReq)(nil), // 32: request.CkmOperationReq
(*Ckm)(nil), // 33: request.Ckm
(*CkmParam)(nil), // 34: request.CkmParam
(*XcjOperationReq)(nil), // 35: request.XcjOperationReq
(*Xcj)(nil), // 36: request.Xcj
(*XcjParam)(nil), // 37: request.XcjParam
(*TrainControl_ControlButton)(nil), // 38: request.TrainControl.ControlButton
(*TrainControl_EmergentButton)(nil), // 39: request.TrainControl.EmergentButton
(*TrainControl_DriverKeySwitch)(nil), // 40: request.TrainControl.DriverKeySwitch
(*TrainControl_SwitchKeyChange)(nil), // 41: request.TrainControl.SwitchKeyChange
(*TrainControl_PushHandler)(nil), // 42: request.TrainControl.PushHandler
}
var file_request_proto_depIdxs = []int32{
0, // 0: request.RelayOperationReq.operation:type_name -> request.Relay.Operation
@ -2664,7 +2668,7 @@ var file_request_proto_depIdxs = []int32{
10, // 14: request.TrainControl.controlType:type_name -> request.TrainControl.TrainControlType
38, // 15: request.TrainControl.controlButton:type_name -> request.TrainControl.ControlButton
40, // 16: request.TrainControl.driverKey:type_name -> request.TrainControl.DriverKeySwitch
41, // 17: request.TrainControl.dirKey:type_name -> request.TrainControl.DirectionKeySwitch
41, // 17: request.TrainControl.switchKey:type_name -> request.TrainControl.SwitchKeyChange
42, // 18: request.TrainControl.handler:type_name -> request.TrainControl.PushHandler
12, // 19: request.CkmOperationReq.operation:type_name -> request.Ckm.Operation
34, // 20: request.CkmOperationReq.param:type_name -> request.CkmParam
@ -2975,7 +2979,7 @@ func file_request_proto_init() {
}
}
file_request_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrainControl_DirectionKeySwitch); i {
switch v := v.(*TrainControl_SwitchKeyChange); i {
case 0:
return &v.state
case 1:

File diff suppressed because it is too large Load Diff

View File

@ -70,7 +70,11 @@ func NewTrainControlMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask
for _, button := range ttcc.Buttons {
buttons = append(buttons, button)
}
tcc := &state_proto.TrainControlStateMsg{Buttons: buttons, DriverKey: ttcc.DriverKey, DirKey: ttcc.DirKey, PushHandler: ttcc.PushHandler, Lights: lights}
sks := make([]*state_proto.TrainControlState_SwitchKeyChange, 0)
for _, sk := range ttcc.SwitchKeyMap {
sks = append(sks, sk)
}
tcc := &state_proto.TrainControlStateMsg{Buttons: buttons, DriverKey: ttcc.DriverKey, SwitchKeys: sks, PushHandler: ttcc.PushHandler, Lights: lights}
err := mqtt.GetMsgClient().PubTrainControlState(vs.SimulationId, trainId, tcc)
if err != nil {
slog.Error("发送列车控制mqtt失败", err)

@ -1 +1 @@
Subproject commit ec6c571a37999ad7bab8f613deeb207b202468f0
Subproject commit bc7ca44ffd0a95f8a1ae14b391f93b28b11a452b

View File

@ -95,7 +95,7 @@ func Start(simulation *memory.VerifySimulation) {
serviceCtx.msgChan = msgChan
netAConfig := rsspConfig.NetAConfig
server := udp.NewServer(fmt.Sprintf(":%d", netAConfig.LocalPort), func(b []byte) {
logger().Info(fmt.Sprintf("收到数据:%x", b))
//logger().Info(fmt.Sprintf("收到数据:%x", b))
msgChan <- b
})
client := udp.NewClient(fmt.Sprintf("%s:%d", netAConfig.RemoteIp, netAConfig.RemotePort))
@ -254,7 +254,7 @@ func (s *serviceContext) runCollectTask(ctx context.Context) {
if err != nil {
logger().Error("发送状态数据失败", "error", err)
} else {
logger().Info(fmt.Sprintf("发送数据:%x", data))
//logger().Info(fmt.Sprintf("发送数据:%x", data))
}
}
}

View File

@ -53,15 +53,32 @@ type btmCanetClient struct {
baliseDetector *BaliseDetector
}
func (s *btmCanetClient) FindNotSendState(train *state_proto.TrainState) (*state_proto.BTMState, byte, byte, byte) {
func (s *btmCanetClient) FindBaliseResend(train *state_proto.TrainState) (*state_proto.BTMState, byte, byte, byte) {
s.baliseDetector.eqLock.Lock()
defer s.baliseDetector.eqLock.Unlock()
cache := train.BtmBaliseCache
for _, balise := range cache.BaliseList {
slog.Info(fmt.Sprintf("===========%v", len(cache.BaliseList)))
if balise != nil && balise.BaliseId == cache.ResendBaliseId && balise.ResendCount < 3 {
balise.ResendCount++
ndsn := BaliseCounterAdd(cache.Dsn)
cache.Dsn = uint32(ndsn)
return balise, ndsn, byte(cache.BaliseCount), byte(cache.MessageCounter)
}
}
return nil, 0, 0, 0
}
func (s *btmCanetClient) FindBaliseByNotSend(train *state_proto.TrainState) (*state_proto.BTMState, byte, byte, byte) {
s.baliseDetector.eqLock.Lock()
defer s.baliseDetector.eqLock.Unlock()
cache := train.BtmBaliseCache
for _, btmCache := range cache.BaliseList {
if btmCache != nil && !btmCache.IsSend {
ndsn := BaliseCounterAdd(cache.Dsn)
cache.Dsn = uint32(ndsn)
cache.ResendBaliseId = btmCache.BaliseId
return btmCache, ndsn, byte(cache.BaliseCount), byte(cache.MessageCounter)
}
}
@ -86,7 +103,8 @@ type BtmCanetClient interface {
HandleTrainHeadPositionInfo(w ecs.World, vobcBtm *state_proto.VobcBtmState, h *TrainHeadPositionInfo)
HandleTrainHeadPositionInfoForTrain(w ecs.World, train *state_proto.TrainBtmCache, h *TrainHeadPositionInfo)
FindNotSendState(train *state_proto.TrainState) (*state_proto.BTMState, byte, byte, byte)
FindBaliseByNotSend(train *state_proto.TrainState) (*state_proto.BTMState, byte, byte, byte)
FindBaliseResend(train *state_proto.TrainState) (*state_proto.BTMState, byte, byte, byte)
}
var (
@ -121,16 +139,7 @@ func (s *btmCanetClient) HandleTrainHeadPositionInfo(w ecs.World, vobcBtm *state
//slog.Debug(h.String())
wd := entity.GetWorldData(w)
repo := wd.Repo
//s.baliseDetector.detect(wd, repo, h, vobcBtm)
h2 := &TrainHeadPositionInfo{
TrainId: h.TrainId,
Up: h.Up,
Link: h.OldLink,
LinkOffset: h.OldLinkOffset,
Speed: h.Speed,
Acceleration: h.Acceleration}
s.baliseDetector.detect2(wd, repo, h, h2, vobcBtm)
s.baliseDetector.detect(wd, repo, h, vobcBtm)
}
func (s *btmCanetClient) Start(bcm BtmCanetManager) {
s.bcm = bcm

View File

@ -2,6 +2,7 @@ package can_btm
import (
"fmt"
"joylink.club/bj-rtsts-server/const/balise_const"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/third_party/btm_vobc"
"joylink.club/rtsssimulation/component"
@ -11,6 +12,7 @@ import (
"log/slog"
"math"
"sort"
"strings"
"sync"
"time"
)
@ -84,11 +86,12 @@ func (t *BaliseDetector) newDetect(wd *component.WorldData, repo *repository.Rep
curAntennaRi2 := t.createBtmAntennaRunningInfo(wd, repo, th2) //上次车头
var startBalises []*repository.Transponder
//startBalises = t.searchBalisesFromBetweenLinkPosition(repo, th.Up, curAntennaRi2.LinkId, th2.LinkOffset, th.LinkOffset)
startBalises = t.searchBalisesFromBetweenLinkPosition(repo, th2.Up, curAntennaRi2.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)
balises := make([]*repository.Transponder, 0)
for _, balise := range startBalises {
//slog.Info(fmt.Sprintf("id:%v , %v,linkeId:%v ,headoffset:%v,tailOffset:%v", balise.Id(), th.Up, curAntennaRi.LinkId, curAntennaRi.LinkOffset, curAntennaRi2.LinkOffset))
find := false
for _, transponder := range balises {
if transponder.Id() == balise.Id() {
@ -102,67 +105,14 @@ func (t *BaliseDetector) newDetect(wd *component.WorldData, repo *repository.Rep
}
if len(balises) > 0 {
balise := balises[0]
//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) {
t.addNewExpectedBalise(balise, btmCache, telegram, utel)
}
}
func (t *BaliseDetector) detect2(wd *component.WorldData, repo *repository.Repository, th, th2 *TrainHeadPositionInfo, vobcBtm *state_proto.VobcBtmState) {
t.tryRebind(th)
//BTM天线中心点运行信息
curAntennaRi := t.createBtmAntennaRunningInfo(wd, repo, th) //目前车头
curAntennaRi2 := t.createBtmAntennaRunningInfo(wd, repo, th2) //上次车头
var startBalises []*repository.Transponder
//startBalises = t.searchBalisesFromBetweenLinkPosition(repo, th.Up, curAntennaRi2.LinkId, th2.LinkOffset, th.LinkOffset)
startBalises = t.searchBalisesFromBetweenLinkPosition(repo, th2.Up, curAntennaRi2.LinkId, curAntennaRi2.LinkOffset, curAntennaRi.LinkOffset)
balises := make([]*repository.Transponder, 0)
for _, balise := range startBalises {
find := false
for _, transponder := range balises {
if transponder.Id() == balise.Id() {
find = true
break
}
}
if !find {
balises = append(balises, balise)
//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))
}
}
if len(balises) > 0 {
balise := balises[0]
baliseInfo := &BtmAntennaScanningBaliseInfo{BaliseId: balise.Id(), BaliseType: balise.BaliseType()}
//uuid := uuid2.NewString()
//slog.Info(fmt.Sprintf("uid :%v,baliseId:%v,Distance:%v,up:%v", uuid, balise.Id(), baliseInfo.Distance, curAntennaRi.Up))
telegram, utel := t.rcvTelegram(wd, balise.Id())
if utel != nil && t.addExpectedBalise(baliseInfo) {
t.baliseCounterAdd1() //应答器计数器
if len(telegram) > 0 {
baliseInfo.telegram = utel
baliseInfo.telegram128 = telegram
t.baliseMessageCounterAdd1() //报文计数器
}
}
t.aboveBalise = true
} else {
t.aboveBalise = false
}
/* curAntennaRi2 := t.createBtmAntennaRunningInfo(wd, repo, &TrainHeadPositionInfo{TrainId: th.TrainId,
Up: !th.Up,
Link: th.Link,
LinkOffset: th.LinkOffset,
Speed: th.Speed,
Acceleration: th.Acceleration})
curExpect2 := t.timeScanNearestBalise(curTime, wd, repo, curAntennaRi2)
if curExpect2 != nil && curExpect2.Distance > 20 {
btm_vobc.Default().UpdateTrainLeave(vobcBtm, curExpect2.BaliseId, curTime.UnixMilli())
}*/
}
func (t *BaliseDetector) detect(wd *component.WorldData, repo *repository.Repository, th *TrainHeadPositionInfo, vobcBtm *state_proto.VobcBtmState) {
@ -285,13 +235,20 @@ func (t *BaliseDetector) addNewExpectedBalise(balise *repository.Transponder, bt
btmCache.BaliseCount = uint32(bc)
btmCache.MessageCounter = mc
//存入队尾
bl[len(bl)-1] = &state_proto.BTMState{BaliseId: balise.Id(),
btmS := &state_proto.BTMState{BaliseId: balise.Id(),
Telegram: fmt.Sprintf("%x", userTelegram),
Telegram128: fmt.Sprintf("%x", telegram),
Telegram128: fmt.Sprintf("%X", telegram),
Unpack: unpack,
BaliseType: int32(balise.BaliseType().Number()),
AboveBalise: true}
AboveBalise: true, HasData: true}
if userTelegram == nil || len(userTelegram) == 0 {
btmS.Telegram = strings.Repeat("00", balise_const.UserTelegramByteLen)
btmS.Telegram128 = strings.Repeat("00", balise_const.TelegramByteLen)
btmS.HasData = false
}
//存入队尾
bl[len(bl)-1] = btmS
return true
}
@ -547,6 +504,34 @@ func (t *BaliseDetector) searchBalisesFromLinkPosition(repo *repository.Reposito
}
// 列车车头端点运行信息转换为车载BTM天线中心点运行信息
func (t *BaliseDetector) createBtmAntennaRunningInfo2(wd *component.WorldData, isSameLink bool, repo *repository.Repository, head *TrainHeadPositionInfo) *BtmAntennaRunningInfo {
headLink := repo.FindLink(head.Link)
if head.Up {
if isSameLink { //车头与BTM天线在同一个轨道上
return &BtmAntennaRunningInfo{Up: head.Up, LinkId: head.Link, LinkOffset: head.LinkOffset + int64(math.Abs(float64(BtmAntennaOffsetHead))), Speed: head.Speed, Acceleration: head.Acceleration}
} else { //车头与BTM天线在同一个轨道上
nextLinkPort := t.getNextLink(wd, repo, head.Link, !head.Up)
nextLink := nextLinkPort.Link()
if nextLinkPort.IsPortA() {
return &BtmAntennaRunningInfo{Up: false, LinkId: nextLink.Id(), LinkOffset: BtmAntennaOffsetHead - head.LinkOffset, Speed: head.Speed, Acceleration: head.Acceleration}
} else {
return &BtmAntennaRunningInfo{Up: true, LinkId: nextLink.Id(), LinkOffset: nextLink.Length() - (BtmAntennaOffsetHead - head.LinkOffset), Speed: head.Speed, Acceleration: head.Acceleration}
}
}
} else {
if isSameLink { //车头与BTM天线在同一个轨道上
return &BtmAntennaRunningInfo{Up: head.Up, LinkId: head.Link, LinkOffset: head.LinkOffset + BtmAntennaOffsetHead, Speed: head.Speed, Acceleration: head.Acceleration}
} else {
nextLinkPort := t.getNextLink(wd, repo, head.Link, !head.Up)
nextLink := nextLinkPort.Link()
if nextLinkPort.IsPortA() {
return &BtmAntennaRunningInfo{Up: false, LinkId: nextLink.Id(), LinkOffset: BtmAntennaOffsetHead - headLink.Length() + head.LinkOffset, Speed: head.Speed, Acceleration: head.Acceleration}
} else {
return &BtmAntennaRunningInfo{Up: true, LinkId: nextLink.Id(), LinkOffset: nextLink.Length() - (BtmAntennaOffsetHead - headLink.Length() + head.LinkOffset), Speed: head.Speed, Acceleration: head.Acceleration}
}
}
}
}
func (t *BaliseDetector) createBtmAntennaRunningInfo(wd *component.WorldData, repo *repository.Repository, head *TrainHeadPositionInfo) *BtmAntennaRunningInfo {
headLink := repo.FindLink(head.Link)
if head.Up {

View File

@ -150,7 +150,7 @@ func (i *interlockProxy) collectInfoStateTask(ctx context.Context) {
if err != nil {
logger().Error(fmt.Sprintf("向联锁发送继电器状态失败:%s", err))
} else {
logger().Info(fmt.Sprintf("向联锁发送继电器数据成功:%x", collectInfoState.Encode()))
//logger().Info(fmt.Sprintf("向联锁发送继电器数据成功:%x", collectInfoState.Encode()))
}
}
}
@ -183,7 +183,7 @@ func (i *interlockProxy) initInterlockProxy() {
func (i *interlockProxy) handleFromCiData(n int, data []byte) {
data = data[:n]
logger().Info(fmt.Sprintf("收到联锁驱动及应答器报文数据,长度%d", n))
//logger().Info(fmt.Sprintf("收到联锁驱动及应答器报文数据,长度%d", n))
if len(i.fromCIBytes) != 0 { //报文头已经存进去了
i.fromCIBytes = append(i.fromCIBytes, data...)
if len(i.fromCIBytes) < fromCIBytesLen { //当存储的报文长度不足预期长度
@ -198,7 +198,7 @@ func (i *interlockProxy) handleFromCiData(n int, data []byte) {
//处理联锁报文
msg := &fromCiMsg{}
err := msg.decode(i.fromCIBytes)
logger().Info(fmt.Sprintf("解析完整联锁驱动及应答器报文数据:%x", i.fromCIBytes))
//logger().Info(fmt.Sprintf("解析完整联锁驱动及应答器报文数据:%x", i.fromCIBytes))
i.fromCIBytes = i.fromCIBytes[:0] //清空联锁报文存储
if err != nil {
logger().Error(fmt.Sprintf("解析来自CI的数据出错%s", err.Error()))
@ -206,19 +206,24 @@ func (i *interlockProxy) handleFromCiData(n int, data []byte) {
}
//处理驱动数据
if i.simulation != nil {
logger().Info(fmt.Sprintf("解析出的驱动数据:%x", msg.driveData))
i.simulation.HandleInterlockDriverInfo(i.runConfig.Code, msg.driveData)
//logger().Info(fmt.Sprintf("解析出的驱动数据:%x", msg.driveData))
station := i.simulation.Repo.FindStationByStationName(i.runConfig.Code)
if station != nil {
i.simulation.HandleInterlockDriverInfo(station.Id(), msg.driveData)
} else {
logger().Error(fmt.Sprintf("没有找到名为%s的车站", i.runConfig.Code))
}
}
//处理应答器数据
for _, datum := range msg.baliseTelegramData {
indexBalise2 := i.indexBalise[datum.leuIndex]
if indexBalise2 == nil {
logger().Error(fmt.Sprintf("没有leuIndex[%d]的应答器", datum.leuIndex))
//logger().Error(fmt.Sprintf("没有leuIndex[%d]的应答器", datum.leuIndex))
continue
}
balise := indexBalise2[datum.index]
if balise == nil {
logger().Error(fmt.Sprintf("没有leuIndex[%d]leu内索引[%d]的应答器", datum.leuIndex, datum.index))
//logger().Error(fmt.Sprintf("没有leuIndex[%d]leu内索引[%d]的应答器", datum.leuIndex, datum.index))
continue
}
userTelegram, err := balisecodec.Decode(datum.telegram)
@ -226,13 +231,13 @@ func (i *interlockProxy) handleFromCiData(n int, data []byte) {
logger().Error(fmt.Sprintf("解析应答器报文[%x]出错:%s", datum.telegram, err.Error()))
continue
} else {
logger().Info(fmt.Sprintf("解析出应答器[%s]的可变报文", balise.Id()))
//logger().Info(fmt.Sprintf("解析出应答器[%s]的可变报文", balise.Id()))
}
err = fi.BaliseUpdateVariableTelegram(i.simulation.World, balise.Id(), datum.telegram, userTelegram, false)
if err != nil {
logger().Error(fmt.Sprintf("更新leuIndex[%d]leu内索引[%d]的应答器[%s]数据出错:%s", datum.leuIndex, datum.index, balise.Id(), err.Error()))
} else {
logger().Info(fmt.Sprintf("更新leuIndex[%d]leu内索引[%d]的应答器[%s]数据成功", datum.leuIndex, datum.index, balise.Id()))
//logger().Info(fmt.Sprintf("更新leuIndex[%d]leu内索引[%d]的应答器[%s]数据成功", datum.leuIndex, datum.index, balise.Id()))
}
}
}

View File

@ -73,6 +73,13 @@ type AtpRequestFrame struct {
//IsTrainPcSim bool
}
func (f *AtpRequestFrame) IsResend() bool {
if f.ResendRequest == 2 {
return true
}
return false
}
// NewAtpRequestFrame 创建ATP查询帧
func NewAtpRequestFrame(sn byte) *AtpRequestFrame {
return &AtpRequestFrame{
@ -98,10 +105,16 @@ func (f *AtpRequestFrame) Decode2(cf *BtmHeadFrame) bool {
buf := bytes.NewBuffer(cf.CanData)
if d, err := buf.ReadByte(); err == nil {
f.Speed = uint16(d << 4)
f.ResendRequest = GetBit(d, 5)>>5 | GetBit(d, 4)>>6
rr := byte(0)
rr = setBit(rr, 0, GetBit(d, 4))
rr = setBit(rr, 1, GetBit(d, 5))
f.ResendRequest = rr
f.PowerAmplifierControlledByAtp = true
f.PowerAmplifierTurnOn = true
if rr == 2 {
slog.Error(fmt.Sprintf("获取ATP请求帧数据%b,rr :=%v ,result:%v id1:%v,id2:%v,id3:%v,id4:%v", d, rr, rr, f.FId.ID1, f.FId.ID2, f.FId.ID3, f.FId.ID4))
}
} else {
return false
}

View File

@ -7,7 +7,7 @@ import (
)
// 返回应答器数据帧(数据帧 + timeA+timeB+结束帧)
func CreateBtmAtpDataRspFramesData(statusRsp *BtmHeadFrame, msg []byte, msgPackError bool, msgTimeA uint32, msgTimeB uint32, tkTimeB uint32) ([]byte, bool) {
func CreateBtmAtpDataRspFramesData(statusRsp *BtmHeadFrame, msg []byte, msgPackError, haxBaliseData bool, msgTimeA uint32, msgTimeB uint32, tkTimeB uint32) ([]byte, bool) {
sn := statusRsp.CanId.ID4
//应答器整个是16个数据帧其中报文占13帧timeA,timeB 占2帧最后是结束帧
//数据
@ -33,8 +33,8 @@ func CreateBtmAtpDataRspFramesData(statusRsp *BtmHeadFrame, msg []byte, msgPackE
}
}
}
dtA := createTimeA(sn, DATA_TIME_A_OFFSET, msgTimeA, msgPackError, msg)
dtB := createTimeA(sn, DATA_TIME_B_OFFSET, msgTimeB, msgPackError, msg)
dtA := createTimeA(sn, DATA_TIME_A_OFFSET, msgTimeA, msgPackError, msg, haxBaliseData)
dtB := createTimeA(sn, DATA_TIME_B_OFFSET, msgTimeB, msgPackError, msg, haxBaliseData)
dtACf := dtA.Encode()
dtBCf := dtB.Encode()
@ -56,6 +56,7 @@ func CreateBtmAtpDataRspFramesData(statusRsp *BtmHeadFrame, msg []byte, msgPackE
}
return rt, true
}
func createDataAtpEnd(sn byte, time uint32, statusData, msg, dtAData, dtBData []byte) *BtmDataMessageAtpTimeAndEndFrame {
end := BtmDataMessageEndAtpFrame(sn)
end.Time = time
@ -67,23 +68,27 @@ func createDataAtpEnd(sn byte, time uint32, statusData, msg, dtAData, dtBData []
crc32cData = append(crc32cData, dtBData...)
crc32cData = binary.BigEndian.AppendUint32(crc32cData, end.Time)
end.Crc32 = Can_Crc32(crc32cData)
return end
}
func createTimeA(sn, offset byte, time uint32, msgPackError bool, msg []byte) *BtmDataMessageAtpTimeAndEndFrame {
func createTimeA(sn, offset byte, time uint32, msgPackError bool, msg []byte, hasBaliseData bool) *BtmDataMessageAtpTimeAndEndFrame {
tf := CreateBtmDataMessageTimeAtpFrame(sn, offset)
tf.Time = time
if !msgPackError {
var crcData []byte
crcData = append(crcData, msg...)
crcData = binary.BigEndian.AppendUint32(crcData, time)
if offset == DATA_TIME_A_OFFSET {
tf.Crc32 = Can_Crc32A(crcData) //CRC32A的校验范围是报文+时间戳B
if !hasBaliseData {
tf.Crc32 = 0
} else {
tf.Crc32 = Can_Crc32B(crcData) //CRC32B的校验范围是报文+时间戳B
}
if offset == DATA_TIME_A_OFFSET {
tf.Crc32 = Can_Crc32A(crcData) //CRC32A的校验范围是报文+时间戳B
} else {
tf.Crc32 = Can_Crc32B(crcData) //CRC32B的校验范围是报文+时间戳B
}
}
} else { //BTM解包发生错误则数据帧及CRC32A/B全填“0xFF”
tf.Crc32 = 0xff_ff_ff_ff
}

View File

@ -222,9 +222,9 @@ const (
DRIVER_ACTIVE_REPORT
//制动重故障按钮
BRAKE_HEAVY_FAULT
//左门状态按钮
//左门状态
LEFT_DOOR_STATE
//右门状态按钮
//右门状态
RIGHT_DOOR_STATE
//唤醒按钮
WAKE_UP
@ -249,7 +249,6 @@ const (
ATP_CUT
//AA自动开关门
DOOR_MODE_AA
//AM自开人关
DOOR_MODE_AM
//MM人开人关

View File

@ -13,10 +13,10 @@ type TrainPcReciverData struct {
clientKey string
tcpClient *tcp.TcpClient
pcSimManage TrainPcSimManage
trainInit bool
state tpapi.ThirdPartyApiServiceState
speedPlace *message.TrainSpeedPlaceReportMsg
train *state_proto.TrainState
//trainInit bool
state tpapi.ThirdPartyApiServiceState
speedPlace *message.TrainSpeedPlaceReportMsg
train *state_proto.TrainState
}
func (rd *TrainPcReciverData) Name() string {
@ -62,12 +62,12 @@ func (rd *TrainPcReciverData) receiverDataHandle(n int, data []byte) {
//case RECIVE_TRAIN_CREATE_REMOVE:
// pc.trainPcSimManage.TrainPcSimConnOrRemoveHandle(baseMsg.Data[0])
case message.RECIVE_TRAIN_INTERFACE_CABINET_OUTR:
initResult := rd.pcSimManage.TrainPcSimDigitalOutInfoHandle(train, rd.trainInit, baseMsg.Data)
rd.trainInit = initResult
rd.pcSimManage.TrainPcSimDigitalOutInfoHandle(train, baseMsg.Data)
case message.RECIVE_TRAIN_INTERFACE_CABINET_OUTR_BACK:
rd.pcSimManage.TrainPcSimDigitalReportHandle(train, baseMsg.Data)
case message.RECIVE_TRAIN_QUERY_STATUS:
rd.pcSimManage.TrainBtmQuery(train, baseMsg.Data)
rd.pcSimManage.TrainBtmQuery2(train, baseMsg.Data)
case message.RECIVE_TRAIN_MOCK_DATA:
rd.pcSimManage.TrainPcSimMockInfo(train, baseMsg.Data)

View File

@ -57,7 +57,7 @@ type TrainPcSimManage interface {
//获取列车模拟量数据
ObtainTrainDigitalMockData(train *state_proto.TrainState) []message.TrainPcSimBaseMessage
// TrainPcSimDigitalOutInfoHandle 4.4.1. 车载输出数字量信息报文内容
TrainPcSimDigitalOutInfoHandle(train *state_proto.TrainState, trainInit bool, data []byte) bool
TrainPcSimDigitalOutInfoHandle(train *state_proto.TrainState, data []byte)
// TrainPcSimDigitalReportHandle 4.4.2. 车载输出数字反馈量信息报文内容
TrainPcSimDigitalReportHandle(train *state_proto.TrainState, data []byte)
FindConnTrain(ct state_proto.TrainConnState_TrainConnType) *state_proto.TrainState
@ -66,7 +66,8 @@ type TrainPcSimManage interface {
//处理列车pc仿真模拟量数据
TrainPcSimMockInfo(train *state_proto.TrainState, data []byte)
// TrainBtmQuery 处理列车btm查询
TrainBtmQuery(train *state_proto.TrainState, data []byte)
TrainBtmQuery2(train *state_proto.TrainState, data []byte)
}
type trainPcSimService struct {
state tpapi.ThirdPartyApiServiceState
@ -207,7 +208,7 @@ func (d *trainPcSimService) newCloseConn(clientKey string) {
rd.tcpClient = nil
rd.train = nil
rd.speedPlace = nil
rd.trainInit = false
//rd.trainInit = false
//d.cancleContextFun()
}
}
@ -228,7 +229,7 @@ func (d *trainPcSimService) initConn(clientKey string) error {
if rd != nil && rd.tcpClient != nil && rd.tcpClient.IsConning() {
return nil
} else {
rd.trainInit = false
//rd.trainInit = false
rd.tcpClient = nil
}
cfg, cfgErr := d.findConfig(clientKey)
@ -382,7 +383,7 @@ func (d *trainPcSimService) sendTrainLocationAndSpeedTask(ctx context.Context) {
trainClient.updateState(connState)
s1, _ := d.pluseSpeed(train)
runDir := uint16(2)
if train.Tcc.DirKey.Val == 1 {
if train.VobcState.DirectionForward {
runDir = 1
}
disPluse := pluseCountSpeed(train.WheelDiameter, trainClient.speedPlace.PulseCount1)
@ -410,8 +411,7 @@ func (d *trainPcSimService) SendDriverActive(train *state_proto.TrainState) {
vobc := train.VobcState
defulatBuf := make([]byte, 0)
msg := &message.TrainPcSimBaseMessage{Data: defulatBuf}
msg := &message.TrainPcSimBaseMessage{}
if train.TrainRunUp {
if vobc.Tc1Active {
msg.Type = message.SENDER_TRAIN_TC_ACTIVE
@ -540,7 +540,9 @@ func (d *trainPcSimService) SendTrainControlMsg(train *state_proto.TrainState, b
}
for _, msg := range baseMessage {
d.sendData(trainClient.tcpClient, msg.Encode())
dd := msg.Encode()
//slog.Info(fmt.Sprintf("发送列车控制信息:%x", dd))
d.sendData(trainClient.tcpClient, dd)
}
}
func (d *trainPcSimService) sendData(client *tcp.TcpClient, data []byte) {

View File

@ -2,6 +2,7 @@ package memory
import (
"joylink.club/bj-rtsts-server/dto/data_proto"
"joylink.club/bj-rtsts-server/dto/request_proto"
"joylink.club/bj-rtsts-server/dto/state_proto"
"joylink.club/bj-rtsts-server/third_party/message"
)
@ -100,16 +101,13 @@ 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,
ConfirmBtn: true, AtpPowerOnBtn: true,
AllDoorClose: true, ObstacleCheckBtn: true /*RightDoorCloseCommand: true, LeftDoorCloseCommand: true,*/, BrakeHeavyFault: true, AtpCutSwitch: true,
ConfirmBtn: true, AtpPowerOnBtn: true, DoorModeMM: true,
}
var trainActDir uint32 = 0
if trainIsUp {
//vobc.Tc1Active = true
trainActDir = 1
} else {
//vobc.Tc2Active = true
trainActDir = 2
}
return vobc, trainActDir
@ -136,7 +134,7 @@ 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 /*GZM, GYM,*/, ZAWTGJC, ZDZGZ, ATPSD, MSQR:
btn.Passed = true
}
btns[b.Code] = btn
@ -149,6 +147,7 @@ func initTrainTcc(vs *VerifySimulation) *state_proto.TrainControlState {
}
}
ds := make([]*state_proto.TrainControlState_DriverKeySwitch, 0)
tcc.SwitchKeyMap = make(map[string]*state_proto.TrainControlState_SwitchKeyChange, 0)
for _, b := range tccGI.TccKeys {
if b.GetType() == data_proto.TccKey_driverControllerActivationClint {
val := false
@ -159,7 +158,10 @@ func initTrainTcc(vs *VerifySimulation) *state_proto.TrainControlState {
}*/
ds = append(ds, &state_proto.TrainControlState_DriverKeySwitch{Id: b.Common.Id, Val: val})
} else if b.GetType() == data_proto.TccKey_frontAndRearDirectionalControl {
tcc.DirKey = &state_proto.TrainControlState_DirectionKeySwitch{Id: b.Common.Id, Val: uint32(message.IsTrue(true))}
tcc.SwitchKeyMap[b.Code] = &state_proto.TrainControlState_SwitchKeyChange{Id: b.Common.Id, Val: uint32(message.IsTrue(true))}
} else if b.GetType() == data_proto.TccKey_trainDoorMode {
tcc.SwitchKeyMap[b.Code] = &state_proto.TrainControlState_SwitchKeyChange{Id: b.Common.Id, Val: uint32(request_proto.TrainControl_KL_END.Number())}
}
}
tcc.DriverKey = ds

View File

@ -73,8 +73,6 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
linkId, loffset := QueryLinkAndOffsetByDevice(vs.Repo, uid, status.DevicePort, status.HeadOffset)
// link上的运行方向、设备上的运行方向
up, pointTo := QueryUpAndABByDevice(vs.Repo, uid, status.DevicePort, status.TrainRunUp)
//up, pointTo, _ = QueryDirectionAndABByDevice(vs.Repo, uid, status.DevicePort, status.TrainRunUp)
//fmt.Println(up2, pointTo2)
// 车头所在公里标
kilometer := CalcTrainKilometer(vs.Repo, uid, status.DevicePort, status.TrainRunUp, status.HeadOffset)
@ -111,19 +109,16 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
vobc, _ := initTrainVobc(int64(tl), status.TrainRunUp)
status.VobcState = vobc
//status.TrainActiveDirection = trainActDir
status.Tcc = initTrainTcc(vs)
status.VobcBtm = &state_proto.VobcBtmState{TelegramState: make([]*state_proto.VobcBtmState_TelegramState, 3), History: make(map[uint32]*state_proto.VobcBtmState_VobcBtmHistoryState)}
//slog.Debug("列车初始化", "trainIndex", trainIndex, "linkId", linkId, "loffset", loffset)
linkIdInt, _ := strconv.Atoi(linkId)
err := dynamics.Default().RequestAddTrain(&message.InitTrainInfo{
TrainIndex: uint16(trainIndex),
LinkIndex: uint16(linkIdInt),
LinkOffset: uint32(loffset),
Speed: status.Speed / 3.6,
Up: status.Up,
//Up: status.TrainRunUp,
TrainIndex: uint16(trainIndex),
LinkIndex: uint16(linkIdInt),
LinkOffset: uint32(loffset),
Speed: status.Speed / 3.6,
Up: status.Up,
TrainOperationConfig: CreateMsgTrainConfig(int(trainIndex), status.TrainLength, configTrainData),
})
if err != nil {

View File

@ -412,7 +412,6 @@ func (s *VerifySimulation) HandleInterlockDriverInfo(code string, driveBytes []b
driveInfo = append(driveInfo, (b&(1<<bit)) != 0)
}
}
slog.Info(fmt.Sprintf("12号线驱动数据解析结果%v", driveInfo))
for i, b := range driveInfo {
qdData := m.QdList[i]
for _, relayId := range qdData.RefRelays {
@ -430,8 +429,12 @@ func (s *VerifySimulation) HandleInterlockDriverInfo(code string, driveBytes []b
// 采集联锁中的继电器消息
func (s *VerifySimulation) CollectInterlockRelayInfo(code string) *message.InterlockSendMsgPkg {
station := s.Repo.FindStationByStationName(code)
if station == nil {
return nil
}
for _, m := range s.Repo.CiQcList() { // 获取继电器地图信息
if m.StationId != code {
if m.StationId != station.Id() {
continue
}
if len(m.CjList) == 0 {

View File

@ -45,24 +45,43 @@ func ControlTrainUpdate(s *VerifySimulation, ct *request_proto.TrainControl) {
baseMsg = trainControlDriverKey(sta, ct.DriverKey, ct.DeviceId, tccGraphicData)
train_pc_sim.Default().SendDriverActive(sta)
} else if ct.ControlType == request_proto.TrainControl_DIRECTION_KEY_SWITCH {
baseMsg = trainControlDirKey(sta.DynamicState.Speed, vobc, tcc, ct.DirKey, ct.DeviceId, tccGraphicData)
baseMsg = trainControlDirKey(sta.DynamicState.Speed, vobc, tcc, ct.SwitchKey, ct.DeviceId, tccGraphicData)
//此处先注释,根据现场调试情况 2024-4-16
train_pc_sim.Default().SendTrainDirection(sta, sta.VobcState.DirectionForward, sta.VobcState.DirectionBackward)
} else if ct.ControlType == request_proto.TrainControl_HANDLER {
if !vobc.Tc1Active && !vobc.Tc2Active {
panic(sys_error.New("TC1和TC2都未激活不能搬动牵引制动手柄 "))
}
if vobc.TractionSafetyCircuit {
panic(sys_error.New("牵引切除,不能进行列车控制"))
}
oldTraction := sta.VobcState.TractionForce
oldBrakeForce := sta.VobcState.BrakeForce
isTraction := ct.Handler.Val > 0 //是否制动
baseMsg = trainControlHandle(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)
}
if vobc.DirectionForward && vobc.TractionForce == 0 {
baseMsg = append(baseMsg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DIR_ZERO_FORWARD, 1}})
} 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
@ -89,16 +108,16 @@ func trainControlButton(vobc *state_proto.TrainVobcState, buttonMap map[string]*
return controlEBBtn(vobc, active, btn)
case ATPQCKG: //atp切除
return controlAtpBtn(vobc, active, btn)
/* case "WBJJZDFK": //外部紧急制动反馈
return controlOutEbReportBtn(vobc, active, btn)*/
case KZM: //开左门按钮
return controlLeftDoorBtn(vobc, active, btn)
case GZM: //关左门按钮
return controlLeftDoorCloseBtn(vobc, active, btn)
case KYM: //开右门按钮
return controlRightDoorBtn(vobc, active, btn)
case GYM: //关右门按钮
return controlRightDoorCloseBtn(vobc, active, btn)
case KZM, KYM: //开左门按钮
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)
case ZF: //折返按钮
return controlReverseBtn(vobc, active, btn)
case QZMYX: //强制门允许
@ -155,6 +174,45 @@ func controlAtpBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_
tccBtn.Passed = active
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.ATP_CUT, status}}}
}
func controlDoorCloseBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_proto.TrainControlState_ControlButton, isLeft bool) []message.TrainPcSimBaseMessage {
status := message.IsTrue(active)
tccBtn.Passed = active
var doorAct byte = message.CLOSE_LEFT_DOOR
var doorState byte = message.LEFT_DOOR_STATE
if isLeft {
vobc.LeftDoorCloseCommand = active
} else {
vobc.RightDoorCloseCommand = active
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}},
}
}
// 开车门
func controlDoorOpenBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_proto.TrainControlState_ControlButton, isLeft bool) []message.TrainPcSimBaseMessage {
status := message.IsTrue(active)
msg := make([]message.TrainPcSimBaseMessage, 0)
tccBtn.Passed = active
var doorAct byte = message.LEFT_OPEN_DOOR
var doorState byte = message.LEFT_DOOR_STATE
if isLeft {
vobc.LeftDoorOpenCommand = active
} else {
vobc.RightDoorOpenCommand = active
doorAct = message.OPEN_RIGHT_DOOR
doorState = message.RIGHT_DOOR_STATE
}
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{doorAct, status}})
if active {
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_LOCK_STATE, 0}})
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{doorState, status}})
}
return msg
}
// 开左门按钮
func controlLeftDoorBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_proto.TrainControlState_ControlButton) []message.TrainPcSimBaseMessage {
@ -164,7 +222,9 @@ func controlLeftDoorBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *s
}
vobc.LeftDoorOpenCommand = active
tccBtn.Passed = active
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.LEFT_OPEN_DOOR, status}}}
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}},
}
}
@ -331,27 +391,25 @@ func controlSleepBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *stat
}
// 列车方向
func trainControlDirKey(trainSpeed int32, vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_DirectionKeySwitch, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []message.TrainPcSimBaseMessage {
_, find := findTrainTccGraphicDataKey(tccGraphic, deviceId)
func trainControlDirKey(trainSpeed int32, vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_SwitchKeyChange, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []message.TrainPcSimBaseMessage {
dirKey, find := findTrainTccGraphicDataKey(tccGraphic, deviceId)
if !find {
slog.Error("未找到对应的列车方向键deviceId:", deviceId)
panic(sys_error.New("未找到对应的列车方向键"))
}
if tcc.DirKey == nil {
tcc.DirKey = &state_proto.TrainControlState_DirectionKeySwitch{Id: deviceId}
}
direction := request_proto.TrainControl_Direction(request.Val)
direction := request_proto.TrainControl_KeyLocation(request.Val)
if trainSpeed > 0 {
panic(sys_error.New("列车未停稳时,不能变更方向"))
}
vobc.DirectionBackward = false
vobc.DirectionForward = false
if direction == request_proto.TrainControl_FORWARD {
if direction == request_proto.TrainControl_KL_FONT {
vobc.DirectionForward = true
} else if direction == request_proto.TrainControl_BACKWARD {
} else if direction == request_proto.TrainControl_KL_END {
vobc.DirectionBackward = true
}
tcc.DirKey.Val = request.Val
tcc.SwitchKeyMap[dirKey.Code].Val = request.Val
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.HANDLE_BACKWORD, message.IsTrue(vobc.DirectionBackward)}},
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.HANDLE_FORWORD, message.IsTrue(vobc.DirectionForward)}}}
}
@ -396,6 +454,31 @@ func trainControlDriverKey(train *state_proto.TrainState, request *request_proto
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.KEY_STATE, message.IsTrue(request.Val)}}}
}
func trainDoorModeChangeHandle(vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_SwitchKeyChange, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []message.TrainPcSimBaseMessage {
sk, find := findTrainTccGraphicDataHandler(tccGraphic, deviceId)
if !find {
slog.Error("未找到对应的牵引制动手柄设备deviceId:", deviceId)
return nil
}
msg := make([]message.TrainPcSimBaseMessage, 0)
kl := request_proto.TrainControl_KeyLocation(request.Val)
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AA, 0}})
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AM, 0}})
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_MM, 0}})
switch kl {
case request_proto.TrainControl_KL_END:
vobc.DoorModeMM = true
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AA, 1}})
case request_proto.TrainControl_KL_CENTER:
vobc.DoorModeAM = true
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AM, 1}})
case request_proto.TrainControl_KL_FONT:
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_MM, 1}})
vobc.DoorModeAA = true
}
tcc.SwitchKeyMap[sk.Code].Val = request.Val
return msg
}
// 列车牵引控制
func trainControlHandle(vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_PushHandler, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []message.TrainPcSimBaseMessage {
@ -419,16 +502,19 @@ func trainControlHandle(vobc *state_proto.TrainVobcState, tcc *state_proto.Train
notBreak := byte(0)
var zeroState byte = 0
var brakeState byte = 0
var traction byte = 0
if request.Val > 0 {
vobc.TractionStatus = true
vobc.TractionForce = int64(float32(request.Val)/100*DEFAULT_TRAIN_TRACTION) * 100
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.EmergencyBrakingStatus = false
jjzdBtn.Passed = false
brakeState = 0
brakeState = 1
} else {
zeroState = 1
}
@ -440,7 +526,8 @@ func trainControlHandle(vobc *state_proto.TrainVobcState, tcc *state_proto.Train
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.HANDLE_TO_ZERO, zeroState}},
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.TRAIN_BRAKE_STATE, brakeState}},
/*{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OUTER_EMERGENCY_BRAKE, 1}},*/
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.NOT_BREAK, notBreak}}}
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.NOT_BREAK, notBreak}},
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{38, traction}}}
}
func (s *VerifySimulation) GetConnTrain2() []*state_proto.TrainState {
@ -487,15 +574,16 @@ func (s *VerifySimulation) FindConnTrain(ct state_proto.TrainConnState_TrainConn
}
// 反馈atp输出数字量数据
func (s *VerifySimulation) reportTrainMockInitMsg(train *state_proto.TrainState, data1, data3 byte, trainInit bool) bool {
func (s *VerifySimulation) reportTrainMockInitMsg(train *state_proto.TrainState, data1, data3 byte) {
vobc := train.VobcState
tcc := train.Tcc
tce := make([]message.TrainPcSimBaseMessage, 0)
tcc.Line12ConnErr = false
initResult := trainInit
//initResult := trainInit
if vobc.Tc1Active || vobc.Tc2Active {
state := message.GetBit(data1, 3)
if trainInit {
//if trainInit {
if vobc.TrainConnInitComplate {
if data1 == 0 {
tcc.Line12ConnErr = true
}
@ -504,19 +592,15 @@ func (s *VerifySimulation) reportTrainMockInitMsg(train *state_proto.TrainState,
ebTce := controlEBBtn(vobc, true, jjzdBtn)
tce = append(tce, ebTce...)
} else if message.GetBit(data1, 0) == 0 {
jjzdBtn := tcc.Buttons[JJZD]
ebTce := controlEBBtn(vobc, true, jjzdBtn)
tce = append(tce, ebTce...)
tce = append(tce, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OUTER_EMERGENCY_BRAKE, state}})
//tce = append(tce, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.TRAIN_TRACTION_CUTED, 1}})
//tce = append(tce, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.NOT_BREAK, 0}})
//tce = append(tce, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{0x38, 0}})
//tce = append(tce, message.TrainPcSimBaseMessage{Type: message.RECIVE_TRAIN_HAND_KEY_CANCLE_FORWARD})
//tce = append(tce, message.TrainPcSimBaseMessage{Type: message.RECIVE_TRAIN_HAND_KEY_BACKWARD})
tce = append(tce, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.TRAIN_TRACTION_CUTED, 1}})
}
} else {
initResult = true
//initResult = false
vobc.TrainConnInitComplate = true
if tcc.LineInitTimeStamp12 <= 0 {
tcc.LineInitTimeStamp12 = time.Now().Add(time.Second * 6).Unix()
}
@ -524,7 +608,8 @@ func (s *VerifySimulation) reportTrainMockInitMsg(train *state_proto.TrainState,
tce = append(tce, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OUTER_EMERGENCY_BRAKE, state}})
initData := s.ObtainTrainDigitalMockDataForStatus(train)
tce = append(tce, initData...)
initResult = false
//initResult = false
vobc.TrainConnInitComplate = false
}
}
@ -535,26 +620,25 @@ func (s *VerifySimulation) reportTrainMockInitMsg(train *state_proto.TrainState,
tce = append(tce, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.TRAIN_INTEGRITY, 1}})
}
train_pc_sim.Default().SendTrainControlMsg(train, tce)
return initResult
//return initResult
}
// 4.4.1. 车载输出数字量信息报文内容
func (s *VerifySimulation) TrainPcSimDigitalOutInfoHandle(train *state_proto.TrainState, trainInit bool, data []byte) bool {
/*for i, d := range data {
slog.Info(fmt.Sprintf("atp模拟量分析index:%v ,bin:%2b,trainInit:%v", i, d, trainInit))
}*/
initResult := s.reportTrainMockInitMsg(train, data[4], data[1], trainInit)
func (s *VerifySimulation) TrainPcSimDigitalOutInfoHandle(train *state_proto.TrainState, data []byte) {
/* slog.Info("开始接受atp输出模拟量==============")
for i, d := range data {
slog.Info(fmt.Sprintf("接受atp模拟量id:%v,data:%b", i, d))
}
slog.Info("结束接受atp输出模拟量eeeeeeeeeeeeeeeeee")*/
s.reportTrainMockInitMsg(train, data[4], data[1])
vobc := train.VobcState
trainPcSimDigitalOutInfoHandleCode7_0(data[4], vobc)
trainPcSimDigitalOutInfoHandleCode15_8(data[3], vobc)
trainPcSimDigitalOutInfoHandleCode23_16(data[2], vobc)
trainPcSimDigitalOutInfoHandleCode31_24(data[1], vobc)
trainPcSimDigitalOutInfoHandleCode39_32(data[0], vobc)
/* if !vobc.EmergencyBrakingStatus {
train_pc_sim.Default().ResetPlusePlace(train)
}*/
return initResult
//return initResult
}
func trainPcSimDigitalOutInfoHandleCode39_32(d byte, vobc *state_proto.TrainVobcState) {
@ -694,75 +778,65 @@ func (s *VerifySimulation) TrainPcSimMockInfo(train *state_proto.TrainState, dat
}
// 4.4.4. 车载输出BTM查询同步帧报文内容0x04
func (s *VerifySimulation) TrainBtmQuery(train *state_proto.TrainState, data []byte) {
func (s *VerifySimulation) TrainBtmQuery2(train *state_proto.TrainState, data []byte) {
ts := time.Now().UnixMilli()
if len(data) < 12 {
slog.Error("列车btm查询报文长度错误:", len(data))
return
}
balise, dsn, bc, mc := can_btm.Default().FindNotSendState(train)
trainAtm := message.NewBtmHeadFrame(data)
atpReq := &message.AtpRequestFrame{}
if !atpReq.Decode2(trainAtm) {
slog.Warn("列车pc驾驶模拟-CanetFrame解码成AtpRequestFrame失败", "CanetFrame", trainAtm.String())
return
}
var balise *state_proto.BTMState
var dsn, bc, mc byte
if atpReq.IsResend() {
balise, dsn, bc, mc = can_btm.Default().FindBaliseResend(train)
} else {
balise, dsn, bc, mc = can_btm.Default().FindBaliseByNotSend(train)
}
balise, dsn, bc, mc = can_btm.Default().FindBaliseByNotSend(train)
cl := clock(atpReq)
btmRepFrame := createBtmStatus(trainAtm.CanId.ID4, balise, atpReq, cl, dsn, bc, mc)
timeSyncF := message.NewBtmTimeSyncCheckFrame(trainAtm.CanId.ID4)
timeSyncF.T2 = cl.BtmTk
timeSyncF.T3 = cl.TkNow()
if balise == nil {
queryData := make([]byte, 0)
queryData = append(queryData, btmRepFrame.EncodeBtmAtp().Encode()...)
queryData = append(queryData, timeSyncF.EncodeBtmAtp().Encode()...)
train_pc_sim.Default().SendBaliseData(train, message.RECIVE_TRAIN_BTM_NOT_DATA, queryData)
//slog.Info(fmt.Sprintf("接受应答器查询:%x发送无应答器数据,id:%v,数据:%X", data, trainAtm.CanId.ID4, queryData))
} else {
logstr := ""
if atpReq.IsResend() {
logstr = fmt.Sprintf("准备重新发送应答id:%v,接受时间:%v,发送时间:%v , 数据:%v 经过:%v,解报文:%v,接受应答器报文:%X", balise.BaliseId, ts, time.Now().UnixMilli(), balise.Telegram, bc, mc, data)
if atpReq.ResendRequest == 2 {
slog.Info(fmt.Sprintf("rrrrrrrrrrrrrrrrr:%v", atpReq.String()))
//重新发送
//if len(train.BtmState.BaliseTelegramForPcSimResend) > 0 {
if len(balise.BaliseTelegramForPcSimResend) > 0 {
slog.Info(fmt.Sprintf("rrrrrrrrrrrrrrrrr111111111:%v", atpReq.String()))
//dd, _ := hex.DecodeString(train.BtmState.BaliseTelegramForPcSimResend)
dd, _ := hex.DecodeString(balise.BaliseTelegramForPcSimResend)
train_pc_sim.Default().SendBaliseData(train, message.RECIVE_TRAIN_BTM_HAS_DATA, dd)
} else if !balise.IsSend {
balise.IsSend = true
logstr = fmt.Sprintf("准备发送应答id:%v,接受时间:%v,发送时间:%v , 数据:%v 经过:%v,解报文:%v,接受应答器报文:%X", balise.BaliseId, ts, time.Now().UnixMilli(), balise.Telegram, bc, mc, data)
} else {
slog.Info(fmt.Sprintf("rrrrrrrrrrrrrrrrr2222222222222:%v", atpReq.String()))
timeSyncF := message.NewBtmTimeSyncCheckFrame(trainAtm.CanId.ID4)
return
}
slog.Info(logstr)
aliseData, _ := hex.DecodeString(balise.Telegram)
stateRepFrame := btmRepFrame.EncodeBtmAtp()
statusDataCf, statusDataCfOk := message.CreateBtmAtpDataRspFramesData(stateRepFrame, aliseData, false, balise.HasData, cl.BtmTk, cl.BtmTk, cl.BtmTk)
if statusDataCfOk {
timeSyncF.T2 = cl.BtmTk
timeSyncF.T3 = cl.TkNow()
queryData := make([]byte, 0)
queryData = append(queryData, btmRepFrame.EncodeBtmAtp().Encode()...)
queryData = append(queryData, timeSyncF.Encode().Encode()...)
train_pc_sim.Default().SendBaliseData(train, message.RECIVE_TRAIN_BTM_NOT_DATA, queryData)
}
} else {
timeSyncF := message.NewBtmTimeSyncCheckFrame(trainAtm.CanId.ID4)
timeSyncF.T2 = cl.BtmTk
timeSyncF.T3 = cl.TkNow()
if balise == nil {
//无应答器数据
queryData := make([]byte, 0)
queryData = append(queryData, btmRepFrame.EncodeBtmAtp().Encode()...)
queryData = append(queryData, stateRepFrame.Encode()...)
queryData = append(queryData, timeSyncF.EncodeBtmAtp().Encode()...)
train_pc_sim.Default().SendBaliseData(train, message.RECIVE_TRAIN_BTM_NOT_DATA, queryData)
} else if !balise.IsSend {
balise.IsSend = true
slog.Info(fmt.Sprintf("准备发送应答id:%v,接受时间:%v,发送时间:%v , 数据:%v 经过:%v,解报文:%v", balise.BaliseId, ts, time.Now().UnixMilli(), balise.Telegram, bc, mc))
aliseData, _ := hex.DecodeString(balise.Telegram)
stateRepFrame := btmRepFrame.EncodeBtmAtp()
statusDataCf, statusDataCfOk := message.CreateBtmAtpDataRspFramesData(stateRepFrame, aliseData, false, cl.BtmTk, cl.BtmTk, cl.BtmTk)
if statusDataCfOk {
timeSyncF.T2 = cl.BtmTk
timeSyncF.T3 = cl.TkNow()
queryData := make([]byte, 0)
queryData = append(queryData, stateRepFrame.Encode()...)
queryData = append(queryData, timeSyncF.EncodeBtmAtp().Encode()...)
queryData = append(queryData, statusDataCf...) //数据帧包含结束帧
balise.BaliseTelegramForPcSimResend = fmt.Sprintf("%X", statusDataCf)
train_pc_sim.Default().SendBaliseData(train, message.RECIVE_TRAIN_BTM_HAS_DATA, queryData)
} else {
slog.Error("列车pc仿真 BtmCanetClient应答帧、数据帧编码失败")
}
queryData = append(queryData, statusDataCf...) //数据帧包含结束帧
balise.BaliseTelegramForPcSimResend = fmt.Sprintf("%X", statusDataCf)
train_pc_sim.Default().SendBaliseData(train, message.RECIVE_TRAIN_BTM_HAS_DATA, queryData)
} else {
slog.Error("列车pc仿真 BtmCanetClient应答帧、数据帧编码失败")
}
}
}
@ -794,7 +868,6 @@ func clock(atpReq *message.AtpRequestFrame) can_btm.BtmClock {
func (s *VerifySimulation) ObtainTrainDigitalMockDataForStatus(train *state_proto.TrainState) []message.TrainPcSimBaseMessage {
msgArr := make([]message.TrainPcSimBaseMessage, 0)
vs := train.VobcState
tcc := train.Tcc
if vs.Tc1Active || vs.Tc2Active {
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.KEY_STATE, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //钥匙激活
@ -813,24 +886,20 @@ func (s *VerifySimulation) ObtainTrainDigitalMockDataForStatus(train *state_prot
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.OUTER_EMERGENCY_BRAKE, 0}, Type: message.SENDER_TRAIN_OUTR_INFO}) //紧急制动
}
dir := request_proto.TrainControl_Direction(tcc.DirKey.Val)
/*if vs.DirectionForward && vs.TractionForce == 0 {
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DIR_ZERO_FORWARD, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //手柄零位方向向前
} else*/if dir == request_proto.TrainControl_FORWARD {
//msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DIR_ZERO_FORWARD, 0}, Type: message.SENDER_TRAIN_OUTR_INFO}) //手柄零位方向向前
if vs.DirectionForward {
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.HANDLE_FORWORD, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //方向手柄向前控制
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.HANDLE_BACKWORD, 0}, Type: message.SENDER_TRAIN_OUTR_INFO}) //方向手柄向前控制
} else if dir == request_proto.TrainControl_BACKWARD {
//msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.DIR_ZERO_FORWARD, 0}, Type: message.SENDER_TRAIN_OUTR_INFO}) //手柄零位方向向前
} else if vs.DirectionForward {
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}) //车门锁闭状态
}
@ -852,6 +921,14 @@ func (s *VerifySimulation) ObtainTrainDigitalMockDataForStatus(train *state_prot
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.LIFE_DOOR, 1}, Type: message.SENDER_TRAIN_OUTR_INFO}) //逃生门状态
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 {
@ -859,6 +936,7 @@ func (s *VerifySimulation) ObtainTrainDigitalMockData(train *state_proto.TrainSt
stateArr := s.ObtainTrainDigitalMockDataForStatus(train)
msgArr = append(msgArr, stateArr...)
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.ATO_SEND_TRAIN, 0}, Type: message.SENDER_TRAIN_OUTR_INFO}) //ATO发车按钮
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.LEFT_DOOR_STATE, 0}, Type: message.SENDER_TRAIN_OUTR_INFO}) //左门状态按钮
msgArr = append(msgArr, message.TrainPcSimBaseMessage{Data: []byte{message.RIGHT_DOOR_STATE, 0}, Type: message.SENDER_TRAIN_OUTR_INFO}) //列车完整性

View File

@ -156,20 +156,6 @@ func runThirdParty(s *memory.VerifySimulation) error {
func stopThirdParty(s *memory.VerifySimulation) {
// 停止半实物
semi_physical_train.Default().Stop()
// 联锁启动
for _, c := range s.GetRunConfig().Interlocks {
switch c.Line {
case "11":
beijing11.Stop(c.Code)
default:
beijing12.Stop(c)
}
}
//计轴RSSP启动销毁
axleBeijing12.Stop(s)
//obsolete.StopLineAllRsspAxleServices()
// 电机UDP停止
electrical_machinery.Default().Stop()
// 车载BTM停止
can_btm.Default().Stop()
// 联锁驱采Modbus服务停止
@ -184,6 +170,21 @@ func stopThirdParty(s *memory.VerifySimulation) {
btm_vobc.Default().Stop()
// 停止动力学接口功能
dynamics.Default().Stop()
// 联锁启动
for _, c := range s.GetRunConfig().Interlocks {
switch c.Line {
case "11":
beijing11.Stop(c.Code)
default:
beijing12.Stop(c)
}
}
//计轴RSSP启动销毁
axleBeijing12.Stop(s)
//obsolete.StopLineAllRsspAxleServices()
// 电机UDP停止
electrical_machinery.Default().Stop()
}
func createSimulationId(projectId int32) string {