Compare commits

..

4 Commits

Author SHA1 Message Date
tiger_zhou
3bf98d1ddf Merge branch 'develop' into local-test
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m52s
2024-05-09 14:36:44 +08:00
tiger_zhou
6fa4c6e6a9 列车控制调整 2024-05-09 14:36:13 +08:00
tiger_zhou
0b25327b28 列车控制,方向设置“0”问题调整 2024-05-08 14:39:23 +08:00
tiger_zhou
7ed8fcbed7 列车pc仿真调整 2024-05-08 10:00:53 +08:00
7 changed files with 283 additions and 182 deletions

View File

@ -236,7 +236,7 @@ type TrainEndsState struct {
SpeedSensorEnableB bool `protobuf:"varint,2,opt,name=speedSensorEnableB,proto3" json:"speedSensorEnableB,omitempty"`
// 雷达是否有效
RadarEnable bool `protobuf:"varint,3,opt,name=radarEnable,proto3" json:"radarEnable,omitempty"`
// 雷达测速差值(米/秒
// 雷达测速差值(千米/小时
RadarCheckSpeedDiff float32 `protobuf:"fixed32,4,opt,name=radarCheckSpeedDiff,proto3" json:"radarCheckSpeedDiff,omitempty"`
// 雷达检测时间(秒)
RadarCheckTime int32 `protobuf:"varint,5,opt,name=radarCheckTime,proto3" json:"radarCheckTime,omitempty"`
@ -246,9 +246,9 @@ type TrainEndsState struct {
AccCheckSpeedDiff float32 `protobuf:"fixed32,7,opt,name=accCheckSpeedDiff,proto3" json:"accCheckSpeedDiff,omitempty"`
// 加速度持续时间
AccCheckTime int32 `protobuf:"varint,8,opt,name=accCheckTime,proto3" json:"accCheckTime,omitempty"`
// 速传速度输出(米/秒
// 速传速度输出(千米/小时
AccOutSpeed int32 `protobuf:"varint,9,opt,name=accOutSpeed,proto3" json:"accOutSpeed,omitempty"`
// 雷达速度输出(米/秒
// 雷达速度输出(千米/小时
RadarOutSpeed int32 `protobuf:"varint,10,opt,name=radarOutSpeed,proto3" json:"radarOutSpeed,omitempty"`
// 记录雷达设置检测时间的时间点,用于计算周期内的数字
RadarCheckTimeOverAt int64 `protobuf:"varint,11,opt,name=radarCheckTimeOverAt,proto3" json:"radarCheckTimeOverAt,omitempty"`

View File

@ -587,6 +587,55 @@ func (TrainControl_TrainControlType) EnumDescriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 0}
}
type TrainControl_Direction int32
const (
TrainControl_BACKWARD TrainControl_Direction = 0 //后退
TrainControl_FORWARD TrainControl_Direction = 1 //前进
TrainControl_NEUTRALWARD TrainControl_Direction = 2 //中位
)
// Enum value maps for TrainControl_Direction.
var (
TrainControl_Direction_name = map[int32]string{
0: "BACKWARD",
1: "FORWARD",
2: "NEUTRALWARD",
}
TrainControl_Direction_value = map[string]int32{
"BACKWARD": 0,
"FORWARD": 1,
"NEUTRALWARD": 2,
}
)
func (x TrainControl_Direction) Enum() *TrainControl_Direction {
p := new(TrainControl_Direction)
*p = x
return p
}
func (x TrainControl_Direction) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TrainControl_Direction) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[11].Descriptor()
}
func (TrainControl_Direction) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[11]
}
func (x TrainControl_Direction) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use TrainControl_Direction.Descriptor instead.
func (TrainControl_Direction) EnumDescriptor() ([]byte, []int) {
return file_request_proto_rawDescGZIP(), []int{14, 1}
}
type Ckm_Operation int32
const (
@ -617,11 +666,11 @@ func (x Ckm_Operation) String() string {
}
func (Ckm_Operation) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[11].Descriptor()
return file_request_proto_enumTypes[12].Descriptor()
}
func (Ckm_Operation) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[11]
return &file_request_proto_enumTypes[12]
}
func (x Ckm_Operation) Number() protoreflect.EnumNumber {
@ -666,11 +715,11 @@ func (x Ckm_Force) String() string {
}
func (Ckm_Force) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[12].Descriptor()
return file_request_proto_enumTypes[13].Descriptor()
}
func (Ckm_Force) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[12]
return &file_request_proto_enumTypes[13]
}
func (x Ckm_Force) Number() protoreflect.EnumNumber {
@ -712,11 +761,11 @@ func (x Ckm_Fault) String() string {
}
func (Ckm_Fault) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[13].Descriptor()
return file_request_proto_enumTypes[14].Descriptor()
}
func (Ckm_Fault) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[13]
return &file_request_proto_enumTypes[14]
}
func (x Ckm_Fault) Number() protoreflect.EnumNumber {
@ -758,11 +807,11 @@ func (x Xcj_Operation) String() string {
}
func (Xcj_Operation) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[14].Descriptor()
return file_request_proto_enumTypes[15].Descriptor()
}
func (Xcj_Operation) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[14]
return &file_request_proto_enumTypes[15]
}
func (x Xcj_Operation) Number() protoreflect.EnumNumber {
@ -804,11 +853,11 @@ func (x Xcj_Fault) String() string {
}
func (Xcj_Fault) Descriptor() protoreflect.EnumDescriptor {
return file_request_proto_enumTypes[15].Descriptor()
return file_request_proto_enumTypes[16].Descriptor()
}
func (Xcj_Fault) Type() protoreflect.EnumType {
return &file_request_proto_enumTypes[15]
return &file_request_proto_enumTypes[16]
}
func (x Xcj_Fault) Number() protoreflect.EnumNumber {
@ -2386,7 +2435,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, 0xb3, 0x05, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72,
0x74, 0x22, 0xec, 0x05, 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,
@ -2429,59 +2478,62 @@ var file_request_proto_rawDesc = []byte{
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, 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,
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,
}
var (
@ -2496,7 +2548,7 @@ func file_request_proto_rawDescGZIP() []byte {
return file_request_proto_rawDescData
}
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 16)
var file_request_proto_enumTypes = make([]protoimpl.EnumInfo, 17)
var file_request_proto_msgTypes = make([]protoimpl.MessageInfo, 25)
var file_request_proto_goTypes = []interface{}{
(Relay_Operation)(0), // 0: request.Relay.Operation
@ -2510,64 +2562,65 @@ var file_request_proto_goTypes = []interface{}{
(Psd_Force)(0), // 8: request.Psd.Force
(Psd_Fault)(0), // 9: request.Psd.Fault
(TrainControl_TrainControlType)(0), // 10: request.TrainControl.TrainControlType
(Ckm_Operation)(0), // 11: request.Ckm.Operation
(Ckm_Force)(0), // 12: request.Ckm.Force
(Ckm_Fault)(0), // 13: request.Ckm.Fault
(Xcj_Operation)(0), // 14: request.Xcj.Operation
(Xcj_Fault)(0), // 15: request.Xcj.Fault
(*Relay)(nil), // 16: request.Relay
(*RelayOperationReq)(nil), // 17: request.RelayOperationReq
(*Points)(nil), // 18: request.Points
(*PointsOperationReq)(nil), // 19: request.PointsOperationReq
(*PointsParam)(nil), // 20: request.PointsParam
(*Signal)(nil), // 21: request.Signal
(*SignalOperationReq)(nil), // 22: request.SignalOperationReq
(*SignalParam)(nil), // 23: request.SignalParam
(*Section)(nil), // 24: request.Section
(*SectionOperationReq)(nil), // 25: request.SectionOperationReq
(*SectionParam)(nil), // 26: request.SectionParam
(*Psd)(nil), // 27: request.Psd
(*PsdOperationReq)(nil), // 28: request.PsdOperationReq
(*PsdParam)(nil), // 29: request.PsdParam
(*TrainControl)(nil), // 30: request.TrainControl
(*CkmOperationReq)(nil), // 31: request.CkmOperationReq
(*Ckm)(nil), // 32: request.Ckm
(*CkmParam)(nil), // 33: request.CkmParam
(*XcjOperationReq)(nil), // 34: request.XcjOperationReq
(*Xcj)(nil), // 35: request.Xcj
(*XcjParam)(nil), // 36: request.XcjParam
(*TrainControl_EmergentButton)(nil), // 37: request.TrainControl.EmergentButton
(*TrainControl_DriverKeySwitch)(nil), // 38: request.TrainControl.DriverKeySwitch
(*TrainControl_DirectionKeySwitch)(nil), // 39: request.TrainControl.DirectionKeySwitch
(*TrainControl_PushHandler)(nil), // 40: request.TrainControl.PushHandler
(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_EmergentButton)(nil), // 38: request.TrainControl.EmergentButton
(*TrainControl_DriverKeySwitch)(nil), // 39: request.TrainControl.DriverKeySwitch
(*TrainControl_DirectionKeySwitch)(nil), // 40: request.TrainControl.DirectionKeySwitch
(*TrainControl_PushHandler)(nil), // 41: request.TrainControl.PushHandler
}
var file_request_proto_depIdxs = []int32{
0, // 0: request.RelayOperationReq.operation:type_name -> request.Relay.Operation
1, // 1: request.PointsOperationReq.operation:type_name -> request.Points.Operation
20, // 2: request.PointsOperationReq.param:type_name -> request.PointsParam
21, // 2: request.PointsOperationReq.param:type_name -> request.PointsParam
2, // 3: request.PointsParam.forcePosition:type_name -> request.Points.Force
3, // 4: request.SignalOperationReq.operation:type_name -> request.Signal.Operation
23, // 5: request.SignalOperationReq.param:type_name -> request.SignalParam
24, // 5: request.SignalOperationReq.param:type_name -> request.SignalParam
5, // 6: request.SignalParam.force:type_name -> request.Signal.Force
4, // 7: request.SignalParam.dsList:type_name -> request.Signal.DS
6, // 8: request.SectionOperationReq.operation:type_name -> request.Section.Operation
26, // 9: request.SectionOperationReq.param:type_name -> request.SectionParam
27, // 9: request.SectionOperationReq.param:type_name -> request.SectionParam
7, // 10: request.PsdOperationReq.operation:type_name -> request.Psd.Operation
29, // 11: request.PsdOperationReq.param:type_name -> request.PsdParam
30, // 11: request.PsdOperationReq.param:type_name -> request.PsdParam
8, // 12: request.PsdParam.force:type_name -> request.Psd.Force
9, // 13: request.PsdParam.fault:type_name -> request.Psd.Fault
10, // 14: request.TrainControl.controlType:type_name -> request.TrainControl.TrainControlType
37, // 15: request.TrainControl.button:type_name -> request.TrainControl.EmergentButton
38, // 16: request.TrainControl.driverKey:type_name -> request.TrainControl.DriverKeySwitch
39, // 17: request.TrainControl.dirKey:type_name -> request.TrainControl.DirectionKeySwitch
40, // 18: request.TrainControl.handler:type_name -> request.TrainControl.PushHandler
11, // 19: request.CkmOperationReq.operation:type_name -> request.Ckm.Operation
33, // 20: request.CkmOperationReq.param:type_name -> request.CkmParam
12, // 21: request.CkmParam.force:type_name -> request.Ckm.Force
13, // 22: request.CkmParam.fault:type_name -> request.Ckm.Fault
14, // 23: request.XcjOperationReq.operation:type_name -> request.Xcj.Operation
36, // 24: request.XcjOperationReq.param:type_name -> request.XcjParam
15, // 25: request.XcjParam.fault:type_name -> request.Xcj.Fault
38, // 15: request.TrainControl.button:type_name -> request.TrainControl.EmergentButton
39, // 16: request.TrainControl.driverKey:type_name -> request.TrainControl.DriverKeySwitch
40, // 17: request.TrainControl.dirKey:type_name -> request.TrainControl.DirectionKeySwitch
41, // 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
13, // 21: request.CkmParam.force:type_name -> request.Ckm.Force
14, // 22: request.CkmParam.fault:type_name -> request.Ckm.Fault
15, // 23: request.XcjOperationReq.operation:type_name -> request.Xcj.Operation
37, // 24: request.XcjOperationReq.param:type_name -> request.XcjParam
16, // 25: request.XcjParam.fault:type_name -> request.Xcj.Fault
26, // [26:26] is the sub-list for method output_type
26, // [26:26] is the sub-list for method input_type
26, // [26:26] is the sub-list for extension type_name
@ -2887,7 +2940,7 @@ func file_request_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_request_proto_rawDesc,
NumEnums: 16,
NumEnums: 17,
NumMessages: 25,
NumExtensions: 0,
NumServices: 0,

View File

@ -3211,7 +3211,7 @@ type TrainEndsStateMqtt struct {
SpeedSensorEnableB bool `protobuf:"varint,2,opt,name=speedSensorEnableB,proto3" json:"speedSensorEnableB,omitempty"`
// 雷达是否有效
RadarEnable bool `protobuf:"varint,3,opt,name=radarEnable,proto3" json:"radarEnable,omitempty"`
// 雷达测速差值(米/秒 原本数据float
// 雷达测速差值(千米/小时 原本数据float
RadarCheckSpeedDiff string `protobuf:"bytes,4,opt,name=radarCheckSpeedDiff,proto3" json:"radarCheckSpeedDiff,omitempty"`
// 雷达检测时间(秒)
RadarCheckTime int32 `protobuf:"varint,5,opt,name=radarCheckTime,proto3" json:"radarCheckTime,omitempty"`
@ -3220,9 +3220,9 @@ type TrainEndsStateMqtt struct {
AccCheckSpeedDiff string `protobuf:"bytes,7,opt,name=accCheckSpeedDiff,proto3" json:"accCheckSpeedDiff,omitempty"`
// 加速度持续时间
AccCheckTime int32 `protobuf:"varint,8,opt,name=accCheckTime,proto3" json:"accCheckTime,omitempty"`
// 速传速度输出(米/秒
// 速传速度输出(千米/小时
AccOutSpeed int32 `protobuf:"varint,9,opt,name=accOutSpeed,proto3" json:"accOutSpeed,omitempty"`
// 雷达速度输出(米/秒
// 雷达速度输出(千米/小时
RadarOutSpeed int32 `protobuf:"varint,10,opt,name=radarOutSpeed,proto3" json:"radarOutSpeed,omitempty"`
}

View File

@ -29,6 +29,7 @@ func (r *TrainControlMsg) Encode() []byte {
if !r.FromVobc {
ls := r.ControlInfo.LifeSignal
r.ControlInfo.LifeSignal = ls + 1
r.ControlInfo.UpdateTime = time.Now().UnixMilli()
}
//data := make([]byte, 0)
//data = binary.BigEndian.AppendUint16(data, uint16(r.ControlInfo.LifeSignal))

View File

@ -6,6 +6,14 @@ import (
"joylink.club/bj-rtsts-server/third_party/message"
)
const (
SKQYS1 = "SKQYS1" //驾驶端1
SKQYS2 = "SKQYS2" //驾驶端2
JJZD = "JJZD" //紧急停车
QHFXKZ = "QHFXKZ" //驾驶方向
QYSB = "QYSB" //牵引制动手柄
)
// 获取列车控制图形数据
func findTrainTccGraphicData(vs *VerifySimulation) *data_proto.TccGraphicStorage {
var tccGI *data_proto.TccGraphicStorage
@ -52,7 +60,7 @@ func findTrainTccGraphicDataHandler(tccG *data_proto.TccGraphicStorage, id uint3
}
// 初始化列车控制数据
func initTrainTcc(vs *VerifySimulation) *state_proto.TrainControlState {
func initTrainTcc(vs *VerifySimulation, runDir bool) *state_proto.TrainControlState {
var tccGI *data_proto.TccGraphicStorage
for _, id := range vs.MapIds {
if QueryGiType(id) == data_proto.PictureType_TrainControlCab {
@ -64,12 +72,12 @@ func initTrainTcc(vs *VerifySimulation) *state_proto.TrainControlState {
tcc := &state_proto.TrainControlState{}
if tccGI != nil {
for _, b := range tccGI.TccButtons {
if b.Code == "JJZD" {
if b.Code == JJZD {
tcc.Ebutton = &state_proto.TrainControlState_EmergentButton{Id: b.Common.Id, Passed: false}
}
}
for _, b := range tccGI.TccHandles {
if b.Code == "QYSB" {
if b.Code == QYSB {
tcc.PushHandler = &state_proto.TrainControlState_PushHandler{Id: b.Common.Id, Val: 0}
}
}
@ -77,7 +85,9 @@ func initTrainTcc(vs *VerifySimulation) *state_proto.TrainControlState {
for _, b := range tccGI.TccKeys {
if b.GetType() == data_proto.TccKey_driverControllerActivationClint {
val := false
if b.Code == "SKQYS1" {
if b.Code == SKQYS1 && runDir {
val = true
} else if b.Code == SKQYS2 && !runDir {
val = true
}
ds = append(ds, &state_proto.TrainControlState_DriverKeySwitch{Id: b.Common.Id, Val: val})

View File

@ -98,9 +98,15 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
if tl <= 0 {
tl = DEFULAT_TRAIN_LOAD
}
status.VobcState = &state_proto.TrainVobcState{Tc1Active: true, TrainLoad: int64(tl), BrakingStatus: true, BrakeForce: DEFAULT_BRAKE_FORCE, DirectionForward: true}
status.VobcState = &state_proto.TrainVobcState{TrainLoad: int64(tl), BrakingStatus: true, BrakeForce: DEFAULT_BRAKE_FORCE, DirectionForward: true}
//status.VobcState.HistoryDir = request_proto.TrainControl_FORWARD
status.Tcc = initTrainTcc(vs)
if status.RunDirection {
status.VobcState.Tc1Active = true
} else {
status.VobcState.Tc2Active = true
}
status.Tcc = initTrainTcc(vs, status.RunDirection)
slog.Debug("列车初始化", "trainIndex", trainIndex, "linkId", linkId, "loffset", loffset)
linkIdInt, _ := strconv.Atoi(linkId)
@ -295,7 +301,7 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
panic(sys_error.New("动力学传输数据:列车车头位置计算出错", e1))
}
runDirection, pointTo := QueryDirectionAndABByDevice(vs.Repo, id, port, info.Up)
//slog.Debug("处理动力学转换后的消息", "number", info.Number, "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
//slog.Debug("处理动力学转换后的消息", "number", info.Number, "Link", info.Link, "车头位置", id, "偏移", offset, "是否上行", runDirection, "是否ab", pointTo)
// 车尾相对车头link的偏移量
calctailOffset := calcTrailTailOffset(outLinkOffset, int64(info.Len), info.Up)
tailLinkId, tailDeviceId, tailDevicePort, tailLinkOffset, tailOffset, _, e2 := CalcInitializeLink(vs, outLinkId, calctailOffset, !info.Up)

View File

@ -35,34 +35,40 @@ func ControlTrainUpdate(s *VerifySimulation, ct *request_proto.TrainControl) {
panic(sys_error.New("未找到TCC图形数据"))
}
sta := data.(*state_proto.TrainState)
vobc := sta.VobcState
tcc := sta.Tcc
var tce []train_pc_sim.TrainControlEvent = nil
if ct.ControlType == request_proto.TrainControl_EMERGENT_BUTTON {
tce = trainControlEB(sta, ct.Button, ct.DeviceId, tccGraphicData)
tce = trainControlEB(vobc, tcc, ct.Button, ct.DeviceId, tccGraphicData)
} else if ct.ControlType == request_proto.TrainControl_DRIVER_KEY_SWITCH {
tce = trainControlDriverKey(sta, ct.DriverKey, ct.DeviceId, tccGraphicData)
tce = trainControlDriverKey(sta.DynamicState.Speed, vobc, tcc, ct.DriverKey, ct.DeviceId, tccGraphicData)
train_pc_sim.Default().SendDriverActive(sta.ConnState, sta.VobcState)
} else if ct.ControlType == request_proto.TrainControl_DIRECTION_KEY_SWITCH {
tce = trainControlDirKey(sta, ct.DirKey, ct.DeviceId, tccGraphicData)
tce = trainControlDirKey(sta.DynamicState.Speed, vobc, tcc, ct.DirKey, ct.DeviceId, tccGraphicData)
//此处先注释,根据现场调试情况 2024-4-16
//train_pc_sim.Default().SendTrainDirection(sta.VobcState.DirectionForward, sta.VobcState.DirectionBackward)
} else if ct.ControlType == request_proto.TrainControl_HANDLER {
oldTraction := sta.VobcState.TractionForce
oldBrakeForce := sta.VobcState.BrakeForce
isTraction := ct.Handler.Val > 0 //是否制动
tce = trainControlHandle(sta, ct.Handler, ct.DeviceId, tccGraphicData)
tce = trainControlHandle(vobc, tcc, ct.Handler, ct.DeviceId, tccGraphicData)
train_pc_sim.Default().SendHandleSwitch(oldTraction, oldBrakeForce, isTraction, sta.ConnState, sta.VobcState)
}
if !vobc.DirectionForward && !vobc.DirectionBackward {
vobc.TractionStatus = false
vobc.TractionForce = 0
}
if sta.ConnState.Conn && sta.ConnState.ConnType == state_proto.TrainConnState_PC_SIM && tce != nil {
train_pc_sim.Default().PublishTrainControlEvent(tce)
}
}
func trainControlEB(trainState *state_proto.TrainState, request *request_proto.TrainControl_EmergentButton, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
func trainControlEB(vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_EmergentButton, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
if !request.Active {
return nil
}
if trainState.Tcc.Ebutton != nil && trainState.Tcc.Ebutton.Passed {
if tcc.Ebutton != nil && tcc.Ebutton.Passed {
return nil
}
_, find := findTrainTccGraphicDataButton(tccGraphic, deviceId)
@ -70,67 +76,93 @@ func trainControlEB(trainState *state_proto.TrainState, request *request_proto.T
slog.Error("未找到对应的紧急停车摁钮,deviceId:", deviceId)
return nil
}
if trainState.Tcc.Ebutton == nil {
trainState.Tcc.Ebutton = &state_proto.TrainControlState_EmergentButton{Id: deviceId, Passed: request.Active}
if tcc.Ebutton == nil {
tcc.Ebutton = &state_proto.TrainControlState_EmergentButton{Id: deviceId}
}
trainState.VobcState.EmergencyBrakingStatus = true
trainState.Tcc.Ebutton.Passed = request.Active
trainState.VobcState.TractionForce = 0
trainState.VobcState.BrakeForce = DEFAULT_BRAKE_FORCE
tcc.Ebutton.Passed = request.Active
vobc.EmergencyBrakingStatus = true
vobc.TractionForce = 0
vobc.BrakeForce = DEFAULT_BRAKE_FORCE
return nil
}
// 列车方向
func trainControlDirKey(trainState *state_proto.TrainState, request *request_proto.TrainControl_DirectionKeySwitch, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
func trainControlDirKey(trainSpeed int32, vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_DirectionKeySwitch, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
_, find := findTrainTccGraphicDataKey(tccGraphic, deviceId)
if !find {
slog.Error("未找到对应的列车方向键deviceId:", deviceId)
return nil
panic(sys_error.New("未找到对应的列车方向键"))
}
if tcc.DirKey == nil {
tcc.DirKey = &state_proto.TrainControlState_DirectionKeySwitch{Id: deviceId}
}
trainState.VobcState.DirectionForward = false
trainState.VobcState.DirectionBackward = false
direction := request_proto.TrainControl_Direction(request.Val)
if trainSpeed > 0 {
panic(sys_error.New("列车未停稳时,不能变更方向"))
}
vobc.DirectionBackward = false
vobc.DirectionForward = false
if direction == request_proto.TrainControl_FORWARD {
vobc.DirectionForward = true
} else if direction == request_proto.TrainControl_BACKWARD {
vobc.DirectionBackward = true
}
/* if direction == request_proto.TrainControl_NEUTRALWARD {
vobc.DirectionBackward = false
vobc.DirectionForward = false
} else if trainSpeed > 0 && direction != vobc.HistoryDir {
tcc.DirKey.Val = uint32(vobc.HistoryDir.Number())
if vobc.HistoryDir == request_proto.TrainControl_FORWARD {
vobc.DirectionForward = true
} else if vobc.HistoryDir == request_proto.TrainControl_BACKWARD {
vobc.DirectionBackward = true
}
panic(sys_error.New("列车未停稳时,不能变更方向"))
}
vobc.DirectionBackward = false
vobc.DirectionForward = false
if direction == request_proto.TrainControl_FORWARD {
vobc.DirectionForward = true
vobc.HistoryDir = request_proto.TrainControl_FORWARD
} else if direction == request_proto.TrainControl_BACKWARD {
vobc.DirectionBackward = true
vobc.HistoryDir = request_proto.TrainControl_BACKWARD
}*/
if request.Val == 1 {
trainState.VobcState.DirectionForward = true
} else if request.Val == 0 {
trainState.VobcState.DirectionBackward = true
}
if trainState.Tcc.DirKey == nil {
trainState.Tcc.DirKey = &state_proto.TrainControlState_DirectionKeySwitch{Id: deviceId, Val: request.Val}
} else {
trainState.Tcc.DirKey.Val = request.Val
}
tcc.DirKey.Val = request.Val
tce := make([]train_pc_sim.TrainControlEvent, 0)
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_FORWORD, Status: message.IsTrue(trainState.VobcState.DirectionForward)})
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_BACKWORD, Status: message.IsTrue(trainState.VobcState.DirectionBackward)})
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_FORWORD, Status: message.IsTrue(vobc.DirectionForward)})
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_BACKWORD, Status: message.IsTrue(vobc.DirectionBackward)})
return tce
}
// 列车驾驶端激活
func trainControlDriverKey(trainState *state_proto.TrainState, request *request_proto.TrainControl_DriverKeySwitch, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
func trainControlDriverKey(trainSpeed int32, vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_DriverKeySwitch, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
obj, find := findTrainTccGraphicDataKey(tccGraphic, deviceId)
if !find {
slog.Error("未找到对应的驾驶端激活设备deviceId:", deviceId)
return nil
}
if obj.Code == "SKQYS1" {
trainState.VobcState.Tc1Active = request.Val
} else if obj.Code == "SKQYS2" {
trainState.VobcState.Tc2Active = request.Val
if trainSpeed != 0 {
panic(sys_error.New("因列车未停稳,不支持此操作"))
}
if trainState.VobcState.Tc1Active && trainState.VobcState.Tc2Active {
if obj.Code == "SKQYS1" {
trainState.VobcState.Tc1Active = false
} else if obj.Code == "SKQYS2" {
trainState.VobcState.Tc2Active = false
if obj.Code == SKQYS1 {
vobc.Tc1Active = request.Val
} else if obj.Code == SKQYS2 {
vobc.Tc2Active = request.Val
}
if vobc.Tc1Active && vobc.Tc2Active {
if obj.Code == SKQYS1 {
vobc.Tc1Active = false
} else if obj.Code == SKQYS2 {
vobc.Tc2Active = false
}
panic(sys_error.New("驾驶端不能同时激活"))
}
var addNew = true
for _, k := range trainState.Tcc.DriverKey {
for _, k := range tcc.DriverKey {
if k.Id == deviceId {
k.Id = deviceId
k.Val = request.Val
@ -139,46 +171,45 @@ func trainControlDriverKey(trainState *state_proto.TrainState, request *request_
}
}
if addNew {
trainState.Tcc.DriverKey = append(trainState.Tcc.DriverKey, &state_proto.TrainControlState_DriverKeySwitch{Id: deviceId, Val: request.Val})
tcc.DriverKey = append(tcc.DriverKey, &state_proto.TrainControlState_DriverKeySwitch{Id: deviceId, Val: request.Val})
}
return []train_pc_sim.TrainControlEvent{{Command: message.KEY_STATE, Status: message.IsTrue(request.Val)}}
}
// 列车牵引控制
func trainControlHandle(trainState *state_proto.TrainState, request *request_proto.TrainControl_PushHandler, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
func trainControlHandle(vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_PushHandler, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []train_pc_sim.TrainControlEvent {
_, find := findTrainTccGraphicDataHandler(tccGraphic, deviceId)
if !find {
slog.Error("未找到对应的牵引制动手柄设备deviceId:", deviceId)
return nil
}
trainState.VobcState.TractionStatus = false
trainState.VobcState.TractionForce = 0
trainState.VobcState.BrakingStatus = false
trainState.VobcState.BrakeForce = 0
trainState.VobcState.MaintainBrakeStatus = false
vobc.TractionStatus = false
vobc.TractionForce = 0
vobc.BrakingStatus = false
vobc.BrakeForce = 0
vobc.MaintainBrakeStatus = false
tce := make([]train_pc_sim.TrainControlEvent, 0)
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_TO_ZERO, Status: 0})
if request.Val > 0 {
trainState.VobcState.TractionStatus = true
trainState.VobcState.TractionForce = int64(request.Val * 180)
vobc.TractionStatus = true
vobc.TractionForce = int64(request.Val * 180)
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.TRAIN_BRAKE_STATE, Status: 0})
} else if request.Val < 0 {
trainState.VobcState.BrakingStatus = true
trainState.VobcState.BrakeForce = int64(-request.Val * 180)
trainState.VobcState.EmergencyBrakingStatus = false
if trainState.Tcc.Ebutton != nil {
trainState.Tcc.Ebutton.Passed = false
vobc.BrakingStatus = true
vobc.BrakeForce = int64(-request.Val * 180)
vobc.EmergencyBrakingStatus = false
if tcc.Ebutton != nil {
tcc.Ebutton.Passed = false
}
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.TRAIN_BRAKE_STATE, Status: 1})
} else {
tce = append(tce, train_pc_sim.TrainControlEvent{Command: message.HANDLE_TO_ZERO, Status: 1})
}
if trainState.Tcc.PushHandler == nil {
trainState.Tcc.PushHandler = &state_proto.TrainControlState_PushHandler{Id: deviceId, Val: request.Val}
if tcc.PushHandler == nil {
tcc.PushHandler = &state_proto.TrainControlState_PushHandler{Id: deviceId}
}
trainState.Tcc.PushHandler.Val = request.Val
tcc.PushHandler.Val = request.Val
return tce
}