列车12号线操控调整
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 2m5s

This commit is contained in:
tiger_zhou 2024-08-29 16:09:07 +08:00
parent 6c1ef600a8
commit d1504e7bf0
10 changed files with 757 additions and 693 deletions

View File

@ -64,7 +64,8 @@ type TrainDynamicConfig struct {
StopSign int32 `protobuf:"varint,17,opt,name=stopSign,proto3" json:"stopSign,omitempty"` StopSign int32 `protobuf:"varint,17,opt,name=stopSign,proto3" json:"stopSign,omitempty"`
// 前溜/后溜m/s默认0 // 前溜/后溜m/s默认0
Slide float32 `protobuf:"fixed32,18,opt,name=slide,proto3" json:"slide,omitempty"` Slide float32 `protobuf:"fixed32,18,opt,name=slide,proto3" json:"slide,omitempty"`
TrainLoad int32 `protobuf:"varint,19,opt,name=trainLoad,proto3" json:"trainLoad,omitempty"` //列车载荷 TrainLoad int32 `protobuf:"varint,19,opt,name=trainLoad,proto3" json:"trainLoad,omitempty"` //列车载荷(吨)
MaxSpeed float32 `protobuf:"fixed32,20,opt,name=maxSpeed,proto3" json:"maxSpeed,omitempty"`
} }
func (x *TrainDynamicConfig) Reset() { func (x *TrainDynamicConfig) Reset() {
@ -225,6 +226,13 @@ func (x *TrainDynamicConfig) GetTrainLoad() int32 {
return 0 return 0
} }
func (x *TrainDynamicConfig) GetMaxSpeed() float32 {
if x != nil {
return x.MaxSpeed
}
return 0
}
// 列车一端的状态 // 列车一端的状态
type TrainEndsState struct { type TrainEndsState struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -376,7 +384,7 @@ var File_common_data_proto protoreflect.FileDescriptor
var file_common_data_proto_rawDesc = []byte{ var file_common_data_proto_rawDesc = []byte{
0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x22, 0xfe, 0x04, 0x0a, 0x12, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x22, 0x9a, 0x05, 0x0a, 0x12,
0x54, 0x72, 0x61, 0x69, 0x6e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x61, 0x76, 0x69, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x69, 0x67, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x61, 0x76, 0x69, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0b, 0x64, 0x61, 0x76, 0x69, 0x73, 0x50, 0x61, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0b, 0x64, 0x61, 0x76, 0x69, 0x73, 0x50, 0x61,
@ -416,43 +424,45 @@ var file_common_data_proto_rawDesc = []byte{
0x73, 0x74, 0x6f, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x6c, 0x69, 0x64, 0x73, 0x74, 0x6f, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x6c, 0x69, 0x64,
0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x73, 0x6c, 0x69, 0x64, 0x65, 0x12, 0x1c, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05, 0x73, 0x6c, 0x69, 0x64, 0x65, 0x12, 0x1c,
0x0a, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0a, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x18, 0x13, 0x20, 0x01, 0x28,
0x05, 0x52, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x22, 0x88, 0x04, 0x0a, 0x05, 0x52, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x0e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x64, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x6d, 0x61, 0x78, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x02, 0x52, 0x08,
0x2e, 0x0a, 0x12, 0x73, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x6d, 0x61, 0x78, 0x53, 0x70, 0x65, 0x65, 0x64, 0x22, 0x88, 0x04, 0x0a, 0x0e, 0x54, 0x72, 0x61,
0x61, 0x62, 0x6c, 0x65, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x73, 0x70, 0x65, 0x69, 0x6e, 0x45, 0x6e, 0x64, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x12, 0x73,
0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x12, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
0x2e, 0x0a, 0x12, 0x73, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x73, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65,
0x61, 0x62, 0x6c, 0x65, 0x42, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x73, 0x70, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x12, 0x2e, 0x0a, 0x12, 0x73,
0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x12, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
0x20, 0x0a, 0x0b, 0x72, 0x61, 0x64, 0x61, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x42, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x73, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65,
0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x72, 0x61, 0x64, 0x61, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x12, 0x20, 0x0a, 0x0b, 0x72,
0x65, 0x12, 0x30, 0x0a, 0x13, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x61, 0x64, 0x61, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,
0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x13, 0x52, 0x0b, 0x72, 0x61, 0x64, 0x61, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x30, 0x0a,
0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x13, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64,
0x69, 0x66, 0x66, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x44, 0x69, 0x66, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x13, 0x72, 0x61, 0x64, 0x61,
0x6b, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x72, 0x61, 0x64, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x12,
0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x26, 0x0a, 0x0e, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d,
0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68,
0x61, 0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x63, 0x63, 0x45, 0x6e,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x18, 0x07, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x63, 0x63, 0x45,
0x20, 0x01, 0x28, 0x02, 0x52, 0x11, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63,
0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x43, 0x68, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x18, 0x07, 0x20, 0x01, 0x28, 0x02,
0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61, 0x52, 0x11, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44,
0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x69, 0x66, 0x66, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54,
0x63, 0x63, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x43, 0x68,
0x52, 0x0b, 0x61, 0x63, 0x63, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x24, 0x0a, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x4f, 0x75,
0x0d, 0x72, 0x61, 0x64, 0x61, 0x72, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x0a, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x61, 0x63,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x72, 0x61, 0x64, 0x61, 0x72, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x63, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x72, 0x61, 0x64,
0x65, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x14, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x61, 0x72, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05,
0x6b, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x52, 0x0d, 0x72, 0x61, 0x64, 0x61, 0x72, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12,
0x03, 0x52, 0x14, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x32, 0x0a, 0x14, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d,
0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x12, 0x2e, 0x0a, 0x12, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x72,
0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x18, 0x0c, 0x20, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x76, 0x65,
0x01, 0x28, 0x03, 0x52, 0x12, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x72, 0x41, 0x74, 0x12, 0x2e, 0x0a, 0x12, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54,
0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x42, 0x2f, 0x5a, 0x2d, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x69, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52,
0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x12, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x76, 0x65,
0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x72, 0x41, 0x74, 0x42, 0x2f, 0x5a, 0x2d, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63,
0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72,
0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -130,6 +130,7 @@ type ConfigTrainData struct {
IdlingR float32 `json:"idlingR"` // 空转冲击率(m/s) 默认0 IdlingR float32 `json:"idlingR"` // 空转冲击率(m/s) 默认0
IdlingD int32 `json:"idlingD"` // 空转持续时间s 默认0 IdlingD int32 `json:"idlingD"` // 空转持续时间s 默认0
TrainLoad int32 `json:"trainLoad"` // 列车载重 默认 16000 TrainLoad int32 `json:"trainLoad"` // 列车载重 默认 16000
MaxSpeed float32 `json:"maxSpeed"` //列车最大时速
//TrainEndsA ConfigTrainEnds `json:"TrainEndsA"` // 车辆A端 //TrainEndsA ConfigTrainEnds `json:"TrainEndsA"` // 车辆A端
//TrainEndsB ConfigTrainEnds `json:"TrainEndsB"` // 车辆B端 //TrainEndsB ConfigTrainEnds `json:"TrainEndsB"` // 车辆B端
} }

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@ func TrainConfigToDtoConvert(dc *common_proto.TrainDynamicConfig) *ConfigTrainDa
CurveResistanceParamR1: dc.CurveResistanceParamR1, CurveResistanceParamR2: dc.CurveResistanceParamR2, CurveResistanceParamR3: dc.CurveResistanceParamR3, CurveResistanceParamR1: dc.CurveResistanceParamR1, CurveResistanceParamR2: dc.CurveResistanceParamR2, CurveResistanceParamR3: dc.CurveResistanceParamR3,
CurveResistanceParamR4: dc.CurveResistanceParamR4, RevolvingMassParam: dc.RevolvingMassParam, CurveResistanceParamR4: dc.CurveResistanceParamR4, RevolvingMassParam: dc.RevolvingMassParam,
Jump: dc.Jump, SlipA: dc.SlipA, SlipR: dc.SlipR, SlipD: dc.SlipD, Slide: dc.Slide, IdlingA: dc.IdlingA, IdlingR: dc.IdlingR, IdlingD: dc.IdlingD, StopSign: dc.StopSign, Jump: dc.Jump, SlipA: dc.SlipA, SlipR: dc.SlipR, SlipD: dc.SlipD, Slide: dc.Slide, IdlingA: dc.IdlingA, IdlingR: dc.IdlingR, IdlingD: dc.IdlingD, StopSign: dc.StopSign,
TrainLoad: dc.TrainLoad, TrainLoad: dc.TrainLoad, MaxSpeed: dc.MaxSpeed,
} }
} }
return nil return nil

View File

@ -61,7 +61,8 @@ func NewTrainControlMs(vs *memory.VerifySimulation, mapId int32) ms_api.MsgTask
lights = append(lights, &state_proto.TrainControlState_ControlLight{Id: light.Id, Val: vobc.TurnbackStatus}) lights = append(lights, &state_proto.TrainControlState_ControlLight{Id: light.Id, Val: vobc.TurnbackStatus})
case memory.LIGHT_BDATPKC: case memory.LIGHT_BDATPKC:
lights = append(lights, &state_proto.TrainControlState_ControlLight{Id: light.Id, Val: vobc.LocalAtpControl}) lights = append(lights, &state_proto.TrainControlState_ControlLight{Id: light.Id, Val: vobc.LocalAtpControl})
case memory.LIGHT_ATOFCZSD:
lights = append(lights, &state_proto.TrainControlState_ControlLight{Id: light.Id, Val: vobc.LightAtoSend})
default: default:
lights = append(lights, &state_proto.TrainControlState_ControlLight{Id: light.Id, Val: light.Val}) lights = append(lights, &state_proto.TrainControlState_ControlLight{Id: light.Id, Val: light.Val})
} }

@ -1 +1 @@
Subproject commit 30019273c5bb79fa29caab241bb89bd13d238fd9 Subproject commit 67d7d79c5a50880b61be05d98184209422f15f1b

View File

@ -13,6 +13,7 @@ const (
JJZD = "JJZD" //紧急停车 JJZD = "JJZD" //紧急停车
QHFXKZ = "QHFXKZ" //驾驶方向 QHFXKZ = "QHFXKZ" //驾驶方向
QYSB = "QYSB" //牵引制动手柄 QYSB = "QYSB" //牵引制动手柄
ATOQD = "ATOQD" //ato 启动
ATPQCKG = "ATPQCKG" //ATP切除开关 ATPQCKG = "ATPQCKG" //ATP切除开关
KZM = "KZM" //开左门按钮 KZM = "KZM" //开左门按钮
@ -30,6 +31,7 @@ const (
HX = "HX" //唤醒按钮 HX = "HX" //唤醒按钮
JX = "JX" //检修按钮 JX = "JX" //检修按钮
XM = "XM" //休眠按钮 XM = "XM" //休眠按钮
LIGHT_JJZD = JJZD LIGHT_JJZD = JJZD
LIGHT_QQY = "QQY" //切牵引指示灯 LIGHT_QQY = "QQY" //切牵引指示灯
LIGHT_JSSJH = "JSSJH" // 驾驶室激活 LIGHT_JSSJH = "JSSJH" // 驾驶室激活
@ -44,6 +46,7 @@ const (
LIGHT_YMYX = "YMYX" //右门允许 LIGHT_YMYX = "YMYX" //右门允许
LIGHT_ZFZSD = "ZFZSD" //折返指示灯 LIGHT_ZFZSD = "ZFZSD" //折返指示灯
LIGHT_BDATPKC = "BDATPKC" //本段atp控车 LIGHT_BDATPKC = "BDATPKC" //本段atp控车
LIGHT_ATOFCZSD = "ATOFCZSD" //ato发车指示灯
) )
// 获取列车控制图形数据 // 获取列车控制图形数据

View File

@ -25,13 +25,12 @@ const (
//列车总质量(吨) //列车总质量(吨)
DEFULAT_TRAIN_LOAD = 160 DEFULAT_TRAIN_LOAD = 160
//通号最大制动力是-1.21 //通号最大制动力是-1.21
//DEFAULT_BRAKE_FORCE = DEFULAT_TRAIN_LOAD * 1000 * 1.21 / 1000
DEFAULT_BRAKE_FORCE = 1.21 DEFAULT_BRAKE_FORCE = 1.21
//通号最大加速度是0.97 //通号最大加速度是0.97
DEFAULT_TRAIN_TRACTION_ACC2 = DEFULAT_TRAIN_LOAD * 1000 * 0.97 / 1000 //千牛 DEFAULT_TRAIN_TRACTION_ACC = 0.97 //加速度
DEFAULT_TRAIN_TRACTION_ACC = 0.97 //千牛
TRAIN_MAX_TRACTION_POWER = 2880 * 1000 DEFAULT_TRAIN_STARTED_SPEED float64 = 80 / 3.6 //列车起步速度单位 米/秒
DEFAULT_TRAIN_STARTED_SPEED float32 = 5.5555556 //列车起步速度单位 米/秒
) )
func CreateMsgTrainConfig(trainId int, trainLen int64, configTrainData dto.ConfigTrainData) *message.TrainOperationConfig { func CreateMsgTrainConfig(trainId int, trainLen int64, configTrainData dto.ConfigTrainData) *message.TrainOperationConfig {

View File

@ -262,11 +262,13 @@ func (s *VerifySimulation) HandleDynamicsTrainInfo(info *message.DynamicsTrainIn
// 更新列车状态 // 更新列车状态
trainState := UpdateTrainStateByDynamics(s, trainId, info) trainState := UpdateTrainStateByDynamics(s, trainId, info)
vs := train.VobcState vs := train.VobcState
if vs.TractionStatus { if vs.Ato {
//动力学之前是kn * 100 这里*10就是N
tf := float32(vs.TractionPower) / info.Speed } else if vs.TractionStatus {
vs.TractionForce = int64(tf / 10) f := trainTractionPower(vs.TrainLoad, train.Tcc.PushHandler.Val, trainState.DynamicState.Speed)
vs.TractionForce = f / 1000 * 100
} }
if train.ConnState.Conn && train.ConnState.ConnType == state_proto.TrainConnState_VOBC { if train.ConnState.Conn && train.ConnState.ConnType == state_proto.TrainConnState_VOBC {
semi_physical_train.Default().SendTrainControlMessage(info) semi_physical_train.Default().SendTrainControlMessage(info)
electrical_machinery.Default().SendElectricMachineryMessage2(info, trainState) electrical_machinery.Default().SendElectricMachineryMessage2(info, trainState)

View File

@ -15,6 +15,7 @@ import (
train_pc_sim "joylink.club/bj-rtsts-server/third_party/train_pc_sim" train_pc_sim "joylink.club/bj-rtsts-server/third_party/train_pc_sim"
"log/slog" "log/slog"
"math" "math"
"strings"
"time" "time"
) )
@ -122,6 +123,8 @@ func trainControlButton(vobc *state_proto.TrainVobcState, buttonMap map[string]*
return controlOverhaulBtn(vobc, active, btn) return controlOverhaulBtn(vobc, active, btn)
case XM: //休眠按钮 case XM: //休眠按钮
return controlSleepBtn(vobc, active, btn) return controlSleepBtn(vobc, active, btn)
case ATOQD:
return controlAtoSenderBtn(vobc, active, btn)
default: default:
return nil return nil
} }
@ -136,9 +139,11 @@ func controlEBBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_p
return nil return nil
} }
tccBtn.Passed = active tccBtn.Passed = active
vobc.TractionStatus = false
vobc.EmergencyBrakingStatus = true vobc.EmergencyBrakingStatus = true
vobc.TractionForce = 0 vobc.TractionForce = 0
vobc.BrakeForce = int64(DEFAULT_BRAKE_FORCE * 100)
vobc.BrakeForce = trainBraking(vobc.TrainLoad, 100) / 1000 * 100
vobc.BrakingStatus = true vobc.BrakingStatus = true
return []message.TrainPcSimBaseMessage{ return []message.TrainPcSimBaseMessage{
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OUTER_EMERGENCY_BRAKE, 0}}, {Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OUTER_EMERGENCY_BRAKE, 0}},
@ -316,7 +321,6 @@ func controlOverhaulBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *s
tccBtn.Passed = active tccBtn.Passed = active
vobc.OverhaulBtn = active vobc.OverhaulBtn = active
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OVERHAUL, status}}} return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OVERHAUL, status}}}
//return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.ATO_SEND_TRAIN, status}}}
} }
// 休眠按钮 // 休眠按钮
@ -329,6 +333,15 @@ func controlSleepBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *stat
vobc.SleepBtn = active vobc.SleepBtn = active
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.SLEEP, status}}} return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.SLEEP, status}}}
} }
func controlAtoSenderBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_proto.TrainControlState_ControlButton) []message.TrainPcSimBaseMessage {
var status byte = 0
if active {
status = 1
}
tccBtn.Passed = active
vobc.AtoSendTrainBtn = active
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.ATO_SEND_TRAIN, status}}}
}
// 列车方向 // 列车方向
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 { 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 {
@ -395,7 +408,7 @@ func trainControlDriverKey(train *state_proto.TrainState, request *request_proto
} }
func trainDoorModeChangeHandle(vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_SwitchKeyChange, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []message.TrainPcSimBaseMessage { 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) sk, find := findTrainTccGraphicDataKey(tccGraphic, deviceId)
if !find { if !find {
slog.Error("未找到对应的牵引制动手柄设备deviceId:", deviceId) slog.Error("未找到对应的牵引制动手柄设备deviceId:", deviceId)
return nil return nil
@ -408,42 +421,40 @@ func trainDoorModeChangeHandle(vobc *state_proto.TrainVobcState, tcc *state_prot
switch kl { switch kl {
case request_proto.TrainControl_KL_END: case request_proto.TrainControl_KL_END:
vobc.DoorModeMM = true vobc.DoorModeMM = true
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AA, 1}}) msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_MM, 1}})
case request_proto.TrainControl_KL_CENTER: case request_proto.TrainControl_KL_CENTER:
vobc.DoorModeAM = true vobc.DoorModeAM = true
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AM, 1}}) msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AM, 1}})
case request_proto.TrainControl_KL_FONT: case request_proto.TrainControl_KL_FONT:
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_MM, 1}}) msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AA, 1}})
vobc.DoorModeAA = true vobc.DoorModeAA = true
} }
tcc.SwitchKeyMap[sk.Code].Val = request.Val tcc.SwitchKeyMap[sk.Code].Val = request.Val
return msg return msg
} }
func trainTractionPower(speed int32, traction int64, handleVal int32) int32 { func trainBraking(trainLoad int64, handleVal int32) int64 {
//速度V可以通过初始速度 加上加速度a乘以时间t来计算即V=V1+at
acc := float32(math.Abs(float64(handleVal)) / 100 * DEFAULT_TRAIN_TRACTION_ACC)
resultSpeed := DEFAULT_TRAIN_STARTED_SPEED + acc
if speed > 0 {
resultSpeed = float32(speed)/3.6/100 + acc
}
// p=fv
p := float32(traction) * resultSpeed
if p >= TRAIN_MAX_TRACTION_POWER {
return TRAIN_MAX_TRACTION_POWER
}
return int32(p)
}
func trainBrakingOrTraction(trainLoad int64, handleVal int32, power float64) int64 {
tl := trainLoad * 10 //列车初始化已经 * 100再*10 就是对应的kg tl := trainLoad * 10 //列车初始化已经 * 100再*10 就是对应的kg
//F=ma 单位 F单位牛顿m单位千克a单位米/秒² //F=ma 单位 F单位牛顿m单位千克a单位米/秒²
totalPower := float64(tl) * power / 1000 totalPower := float64(tl) * DEFAULT_BRAKE_FORCE
//DEFULAT_TRAIN_LOAD * 1000 * 0.97 / 1000 n := int64(math.Abs(float64(handleVal)) / 100 * totalPower)
n := int64(math.Abs(float64(handleVal))/100*totalPower) * 100
return n return n
} }
func trainTractionPower(trainLoad int64, handleVal int32, speedKM int32) int64 {
//f(牛) = m(质量) * (加速度* 牵引杆%* (1 - 速度(米/秒)/(最大速度(米/秒) * 牵引杆%)))
//
m := trainLoad * 10
speedM := float64(speedKM) / 3.6 / 100
acc := math.Abs(float64(handleVal)) / 100 * DEFAULT_TRAIN_TRACTION_ACC
sp := math.Abs(float64(handleVal)) / 100 * DEFAULT_TRAIN_STARTED_SPEED
if speedM > sp {
return 0
}
f := float64(m) * (acc * (1 - speedM/sp))
return int64(f)
}
// 列车牵引控制 // 列车牵引控制
func trainControlHandle(speed int32, vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_PushHandler, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []message.TrainPcSimBaseMessage { func trainControlHandle(speed int32, vobc *state_proto.TrainVobcState, tcc *state_proto.TrainControlState, request *request_proto.TrainControl_PushHandler, deviceId uint32, tccGraphic *data_proto.TccGraphicStorage) []message.TrainPcSimBaseMessage {
_, find := findTrainTccGraphicDataHandler(tccGraphic, deviceId) _, find := findTrainTccGraphicDataHandler(tccGraphic, deviceId)
@ -461,24 +472,23 @@ func trainControlHandle(speed int32, vobc *state_proto.TrainVobcState, tcc *stat
notBreak := byte(0) notBreak := byte(0)
var zeroState byte = 0 var zeroState byte = 0
var brakeState byte = 0 var brakeState byte = 0
var traction byte = 0 //var traction byte = 0
vobc.TractionPower = 0
if request.Val > 0 { if request.Val > 0 {
vobc.TractionStatus = true vobc.TractionStatus = true
vobc.TractionForce = trainBrakingOrTraction(vobc.TrainLoad, request.Val, DEFAULT_TRAIN_TRACTION_ACC) vobc.TractionForce = trainTractionPower(vobc.TrainLoad, request.Val, speed) / 1000 * 100
vobc.TractionPower = trainTractionPower(speed, vobc.TractionForce, request.Val)
notBreak = 1 notBreak = 1
traction = 1 //traction = 1
} else if request.Val < 0 { } else if request.Val < 0 {
vobc.BrakingStatus = true vobc.BrakingStatus = true
//vobc.BrakeForce = int64(math.Abs(float64(request.Val))/100*DEFAULT_BRAKE_FORCE) * 100 vobc.BrakeForce = trainBraking(vobc.TrainLoad, request.Val) / 1000 * 100
vobc.BrakeForce = trainBrakingOrTraction(vobc.TrainLoad, request.Val, DEFAULT_BRAKE_FORCE)
vobc.EmergencyBrakingStatus = false vobc.EmergencyBrakingStatus = false
jjzdBtn.Passed = false jjzdBtn.Passed = false
brakeState = 1 brakeState = 1
} else { } else {
zeroState = 1 zeroState = 1
brakeState = 1
} }
if tcc.PushHandler == nil { if tcc.PushHandler == nil {
tcc.PushHandler = &state_proto.TrainControlState_PushHandler{Id: deviceId} tcc.PushHandler = &state_proto.TrainControlState_PushHandler{Id: deviceId}
@ -489,7 +499,7 @@ func trainControlHandle(speed int32, vobc *state_proto.TrainVobcState, tcc *stat
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.TRAIN_BRAKE_STATE, brakeState}}, {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.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}}} /*{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{38, traction}}*/}
} }
func (s *VerifySimulation) GetConnTrain2() []*state_proto.TrainState { func (s *VerifySimulation) GetConnTrain2() []*state_proto.TrainState {
@ -585,13 +595,51 @@ func (s *VerifySimulation) reportTrainMockInitMsg(train *state_proto.TrainState,
//return initResult //return initResult
} }
const (
ATO_LEVEL_NONE = iota
ATO_LEVEL_1
ATO_LEVEL_2
ATO_LEVEL_3
ATO_LEVEL_4
ATO_LEVEL_5
ATO_LEVEL_6
ATO_LEVEL_7
)
func trainAtoLevel(ato3, ato2, ato1 byte) int32 {
switch {
case ato3 == 0 && ato2 == 0 && ato1 == 1:
return ATO_LEVEL_1
case ato3 == 0 && ato2 == 1 && ato1 == 1:
return ATO_LEVEL_2
case ato3 == 0 && ato2 == 1 && ato1 == 0:
return ATO_LEVEL_3
case ato3 == 1 && ato2 == 1 && ato1 == 0:
return ATO_LEVEL_4
case ato3 == 1 && ato2 == 0 && ato1 == 0:
return ATO_LEVEL_5
case ato3 == 1 && ato2 == 0 && ato1 == 1:
return ATO_LEVEL_6
case ato3 == 1 && ato2 == 1 && ato1 == 1:
return ATO_LEVEL_7
default:
return ATO_LEVEL_NONE
}
}
// 4.4.1. 车载输出数字量信息报文内容 // 4.4.1. 车载输出数字量信息报文内容
func (s *VerifySimulation) TrainPcSimDigitalOutInfoHandle(train *state_proto.TrainState, data []byte) { func (s *VerifySimulation) TrainPcSimDigitalOutInfoHandle(train *state_proto.TrainState, data []byte) {
/* slog.Info("开始接受atp输出模拟量==============") slog.Info("开始接受atp输出模拟量==============")
for i, d := range data { for i, d := range data {
slog.Info(fmt.Sprintf("接受atp模拟量id:%v,data:%b", i, d))
dd := &strings.Builder{}
for j := 0; j < 8; j++ {
dd.WriteString(fmt.Sprintf(" bit%v val:%v , ", j, message.GetBit(d, uint(j))))
} }
slog.Info("结束接受atp输出模拟量eeeeeeeeeeeeeeeeee")*/ slog.Info(fmt.Sprintf("接受atp模拟量id:%v,data:%b,bits:%v", i, d, dd.String()))
}
slog.Info("结束接受atp输出模拟量eeeeeeeeeeeeeeeeee")
s.reportTrainMockInitMsg(train, data[4], data[1]) s.reportTrainMockInitMsg(train, data[4], data[1])
vobc := train.VobcState vobc := train.VobcState
trainPcSimDigitalOutInfoHandleCode7_0(data[4], vobc) trainPcSimDigitalOutInfoHandleCode7_0(data[4], vobc)
@ -640,7 +688,7 @@ func trainPcSimDigitalOutInfoHandleCode23_16(d byte, vobc *state_proto.TrainVobc
vobc.AtoLazyCommandOut = message.IsTrueForByte(message.GetBit(d, 2)) //?ATO惰行命令输出 vobc.AtoLazyCommandOut = message.IsTrueForByte(message.GetBit(d, 2)) //?ATO惰行命令输出
vobc.SleepBtn = message.IsTrueForByte(message.GetBit(d, 3)) //?休眠指令 vobc.SleepBtn = message.IsTrueForByte(message.GetBit(d, 3)) //?休眠指令
vobc.WakeUpBtn = message.IsTrueForByte(message.GetBit(d, 4)) //?唤醒指令 vobc.WakeUpBtn = message.IsTrueForByte(message.GetBit(d, 4)) //?唤醒指令
vobc.AtoSendTrainBtn = message.IsTrueForByte(message.GetBit(d, 5)) //?ATO发车指示灯 vobc.LightAtoSend = message.IsTrueForByte(message.GetBit(d, 5)) //?ATO发车指示灯
vobc.TurnbackStatus = message.IsTrueForByte(message.GetBit(d, 6)) //?AR灯命令 vobc.TurnbackStatus = message.IsTrueForByte(message.GetBit(d, 6)) //?AR灯命令
vobc.AtoAlwaysBrake = message.IsTrueForByte(message.GetBit(d, 7)) //? ATO保持制动 vobc.AtoAlwaysBrake = message.IsTrueForByte(message.GetBit(d, 7)) //? ATO保持制动
@ -653,7 +701,7 @@ func trainPcSimDigitalOutInfoHandleCode15_8(d byte, vobc *state_proto.TrainVobcS
vobc.AtoTractionCommand1 = message.IsTrueForByte(message.GetBit(d, 3)) //?ATO牵引指令1 vobc.AtoTractionCommand1 = message.IsTrueForByte(message.GetBit(d, 3)) //?ATO牵引指令1
vobc.AtoTractionCommand2 = message.IsTrueForByte(message.GetBit(d, 4)) //?ATO牵引指令2 vobc.AtoTractionCommand2 = message.IsTrueForByte(message.GetBit(d, 4)) //?ATO牵引指令2
vobc.AtoTractionCommand3 = message.IsTrueForByte(message.GetBit(d, 5)) //?ATO牵引指令3 vobc.AtoTractionCommand3 = message.IsTrueForByte(message.GetBit(d, 5)) //?ATO牵引指令3
vobc.AtoBrakeCommand = message.IsTrueForByte(message.GetBit(d, 6)) //?ATO制动命令输出 vobc.AtoBrakeCommand = message.AtpLowPowerByte(message.GetBit(d, 6)) //?ATO制动命令输出
vobc.JumpStatus = message.IsTrueForByte(message.GetBit(d, 7)) //跳跃指令 vobc.JumpStatus = message.IsTrueForByte(message.GetBit(d, 7)) //跳跃指令
} }