Compare commits

...

3 Commits

Author SHA1 Message Date
tiger_zhou
d1504e7bf0 列车12号线操控调整
All checks were successful
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 2m5s
2024-08-29 16:09:07 +08:00
6c1ef600a8 Merge remote-tracking branch 'origin/develop' into develop 2024-08-28 11:32:47 +08:00
2af5007698 [修改]11号线联锁通信暂时提交 2024-08-28 11:32:27 +08:00
17 changed files with 1363 additions and 848 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 99ebcb04e516eaf0ad52ec35057606c0e52b31fa Subproject commit a94fdb12f720a5d9bbf57b1916e8ba5990130e6e

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

View File

@ -37,7 +37,7 @@ type serviceContext struct {
client udp.UdpClient client udp.UdpClient
cancelFunc context.CancelFunc cancelFunc context.CancelFunc
ciSectionIndexConfigs []*proto.CiSectionCodePoint ciSectionIndexConfigs []*proto.CiSectionCodePoint
sectionStateMap map[string]*fi.AxleSectionState //存储预复位/复位请求的返回结果 sectionStateMap map[string]*fi.PhysicalSectionState //存储预复位/复位请求的返回结果
remoteAddr uint16 //联锁地址 从配置中的16进制字符串转来的 remoteAddr uint16 //联锁地址 从配置中的16进制字符串转来的
localAddr uint16 //计轴地址 从配置中的16进制字符串转来的 localAddr uint16 //计轴地址 从配置中的16进制字符串转来的
@ -176,7 +176,7 @@ func initServiceContext(rsspConfig config.RsspAxleConfig, ref *proto.Centralized
sim: simulation, sim: simulation,
config: rsspConfig, config: rsspConfig,
ciSectionIndexConfigs: ref.SectionCodePoints, ciSectionIndexConfigs: ref.SectionCodePoints,
sectionStateMap: make(map[string]*fi.AxleSectionState), sectionStateMap: make(map[string]*fi.PhysicalSectionState),
remoteAddr: uint16(sourceAddr), remoteAddr: uint16(sourceAddr),
localAddr: uint16(targetAddr), localAddr: uint16(targetAddr),
@ -379,14 +379,14 @@ func (s *serviceContext) handleRsdMsg(data []byte) {
for i, cmdInfo := range cmdInfos { for i, cmdInfo := range cmdInfos {
sectionIndexConfig := s.ciSectionIndexConfigs[i] sectionIndexConfig := s.ciSectionIndexConfigs[i]
if cmdInfo.PDRST { if cmdInfo.PDRST {
state, err := fi.AxleSectionPdrstDrive(s.sim.World, sectionIndexConfig.SectionId) state, err := fi.PhysicalSectionPdrstDrive(s.sim.World, sectionIndexConfig.SectionId)
if err != nil { if err != nil {
logger().Error("计轴预复位驱动出错", "error", err) logger().Error("计轴预复位驱动出错", "error", err)
} }
s.sectionStateMap[sectionIndexConfig.SectionId] = state s.sectionStateMap[sectionIndexConfig.SectionId] = state
} }
if cmdInfo.DRST { if cmdInfo.DRST {
state, err := fi.AxleSectionDrstDrive(s.sim.World, sectionIndexConfig.SectionId) state, err := fi.PhysicalSectionDrstDrive(s.sim.World, sectionIndexConfig.SectionId)
if err != nil { if err != nil {
logger().Error("计轴复位驱动出错", "error", err) logger().Error("计轴复位驱动出错", "error", err)
} }

View File

@ -9,6 +9,14 @@ const ( //不知道对不对,问也不回,先瞎写吧
OFF = 0xAA //按钮-抬起;道岔-反位;屏蔽门-开门;计轴区段-出清 OFF = 0xAA //按钮-抬起;道岔-反位;屏蔽门-开门;计轴区段-出清
) )
const (
SignalAspect_No = 0x01 //灭灯
SignalAspect_H = 0x02 //红灯
SignalAspect_L = 0x03 //绿灯
SignalAspect_U = 0x04 //黄灯
SignalAspect_HU = 0x05 //红黄
)
func GetStateByte(state bool) byte { func GetStateByte(state bool) byte {
if state { if state {
return ON return ON
@ -257,24 +265,26 @@ func (t *ToInterlockFrame) encode() []byte {
for _, state := range t.SPKSStates { for _, state := range t.SPKSStates {
data = state.encode(data) data = state.encode(data)
} }
//车库门数量0 ////车库门数量0
data = binary.BigEndian.AppendUint16(data, 0) //data = binary.BigEndian.AppendUint16(data, 0)
//CRC32不校验随便填
data = append(data, 0xff, 0xff, 0xff, 0xff)
//填充报文长度 //填充报文长度
binary.BigEndian.PutUint16(data[1:3], uint16(len(data))) binary.BigEndian.PutUint16(data[1:3], uint16(len(data)-7))
return data return data
} }
type TurnoutState struct { type TurnoutState struct {
Id uint16 //道岔ID Id uint16 //道岔ID
State byte //道岔的采集状态 State byte //道岔的采集状态
Alarm byte //道岔的报警状态 //Alarm byte //道岔的报警状态
Current1 byte //转辙机1电流值单位A //Current1 byte //转辙机1电流值单位A
Current2 byte //转辙机2电流值单位A //Current2 byte //转辙机2电流值单位A
} }
func (s *TurnoutState) encode(data []byte) []byte { func (s *TurnoutState) encode(data []byte) []byte {
data = binary.BigEndian.AppendUint16(data, s.Id) data = binary.BigEndian.AppendUint16(data, s.Id)
data = append(data, s.State, s.Alarm, s.Current1, s.Current2) data = append(data, s.State /*, s.Alarm, s.Current1, s.Current2*/)
return data return data
} }
@ -315,14 +325,14 @@ type HoldTrainState struct {
} }
type SignalState struct { type SignalState struct {
Id uint16 //信号机ID Id uint16 //信号机ID
State byte //信号机的采集状态 State byte //信号机的采集状态
Current byte //信号机当前亮灯的电流值 //Current byte //信号机当前亮灯的电流值
} }
func (s *SignalState) encode(data []byte) []byte { func (s *SignalState) encode(data []byte) []byte {
data = binary.BigEndian.AppendUint16(data, s.Id) data = binary.BigEndian.AppendUint16(data, s.Id)
data = append(data, s.State, s.Current) data = append(data, s.State /*s.Current*/)
return data return data
} }

View File

@ -2,63 +2,105 @@ package beijing11
import ( import (
"encoding/binary" "encoding/binary"
"encoding/hex"
"encoding/json" "encoding/json"
"fmt" "fmt"
"joylink.club/bj-rtsts-server/util/myreader"
"testing" "testing"
) )
func TestFromInterlockFrame_Decode(t *testing.T) { func TestFromInterlockFrame_Decode(t *testing.T) {
var interlockCode uint16 = 10010 str := "82009a3c0163010006000100000200000300000600000700000800000200010000050000020001aaaa0005aaaa00000008000401000501000601000701001801001901001a01001b010010000480000580000680000780000800000900000a00001d00001e00001f000020000021000022000023000024000025000000000000040001aaaa0002aaaa0003aaaa0004aaaa00000000000000000000000040ace569"
var waysideCode uint16 = 10086 data, err := hex.DecodeString(str)
var data []byte
data = append(data, 0x82)
data = append(data, 0, 0) //报文长度(占位)
data = binary.BigEndian.AppendUint16(data, interlockCode)
data = binary.BigEndian.AppendUint16(data, waysideCode)
//填充设备数据
deviceCmdCount := []int{1, 1, 2, 4, 1, 1, 1, 1, 2, 1}
for i, count := range deviceCmdCount {
data = binary.BigEndian.AppendUint16(data, uint16(i)) //设备数量
for j := 0; j < i; j++ {
data = binary.BigEndian.AppendUint16(data, uint16(j)) //设备ID
for k := 0; k < count; k++ {
data = append(data, byte(k)) //设备命令
}
}
}
//保留字节及CRC先瞎填吧现在没有校验
for i := 0; i < 14; i++ {
data = append(data, 0)
}
//替换长度
len := uint16(len(data) - 3)
data[1] = byte(len >> 8)
data[2] = byte(len)
f := &FromInterlockFrame{}
err := f.Decode(data)
if err != nil { if err != nil {
t.Error(err) t.Fatal(err)
t.FailNow() }
frame := &FromInterlockFrame{}
err = frame.Decode(data)
if err != nil {
t.Fatal(err)
}
marshal, err := json.Marshal(frame)
if err != nil {
t.Fatal(err)
} }
marshal, _ := json.Marshal(f)
fmt.Println(string(marshal)) fmt.Println(string(marshal))
//if f.WaysideCode != interlockCode {
// t.Error()
//}
//if f.WaysideCode != waysideCode {
// t.Error()
//}
//elem := reflect.ValueOf(f).Elem()
//for i, count := range deviceCmdCount {
// field := elem.Field(3 + i)
// num := field.FieldByName("Num").Uint()
// if int(num) != count {
// t.Error()
// }
//}
} }
func TestName(t *testing.T) { func TestToInterlockFrame_Decode(t *testing.T) {
str := "83009663013c0100060001010002010003010006010007010008010002000155ffaaaaaa000555ffaaaaaa00020001aaaa0005aaaa00000008000401000501000601000701001801001901001a01001b010010000440000540000640000740000840000940000a40001d40001e40001f40002040002140002240002340002440002540000000000004000155aa000255aa000355aa000455aaffffffff"
data, err := hex.DecodeString(str)
if err != nil {
t.Fatal(err)
}
reader := myreader.NewReader(data)
fmt.Printf("%x【报文类型】\t\n", reader.ReadByte())
fmt.Printf("%x【报文长度】\t\n", reader.ReadBytes(2))
fmt.Printf("%x【轨旁编号】\t\n", reader.ReadBytes(2))
fmt.Printf("%x【联锁编号】\t\n", reader.ReadBytes(2))
{ //道岔
deviceNum := reader.ReadBytes(2)
fmt.Printf("%x\t", deviceNum)
for i := 0; i < int(binary.BigEndian.Uint16(deviceNum)); i++ {
fmt.Printf("%x ", reader.ReadBytes(3))
}
fmt.Println("【道岔】")
}
{ //屏蔽门
deviceNum := reader.ReadBytes(2)
fmt.Printf("%x\t", deviceNum)
for i := 0; i < int(binary.BigEndian.Uint16(deviceNum)); i++ {
fmt.Printf("%x ", reader.ReadBytes(8))
}
fmt.Println("【屏蔽门】")
}
{ //紧急停车按钮
deviceNum := reader.ReadBytes(2)
fmt.Printf("%x\t", deviceNum)
for i := 0; i < int(binary.BigEndian.Uint16(deviceNum)); i++ {
fmt.Printf("%x ", reader.ReadBytes(4))
}
fmt.Println("【紧急停车按钮】")
}
{ //扣车按钮
deviceNum := reader.ReadBytes(2)
fmt.Printf("%x\t", deviceNum)
fmt.Println("【扣车按钮】")
}
{ //信号机
deviceNum := reader.ReadBytes(2)
fmt.Printf("%x\t", deviceNum)
for i := 0; i < int(binary.BigEndian.Uint16(deviceNum)); i++ {
fmt.Printf("%x ", reader.ReadBytes(3))
}
fmt.Println("【信号机】")
}
{ //计轴区段
deviceNum := reader.ReadBytes(2)
fmt.Printf("%x\t", deviceNum)
for i := 0; i < int(binary.BigEndian.Uint16(deviceNum)); i++ {
fmt.Printf("%x ", reader.ReadBytes(3))
}
fmt.Println("【计轴区段】")
}
{ //无人折返
deviceNum := reader.ReadBytes(2)
fmt.Printf("%x\t", deviceNum)
fmt.Println("【无人折返】")
}
{ //防淹门
deviceNum := reader.ReadBytes(2)
fmt.Printf("%x\t", deviceNum)
fmt.Println("【防淹门】")
}
{ //SPKS
deviceNum := reader.ReadBytes(2)
fmt.Printf("%x\t", deviceNum)
for i := 0; i < int(binary.BigEndian.Uint16(deviceNum)); i++ {
fmt.Printf("%x ", reader.ReadBytes(4))
}
fmt.Println("【SPKS】")
}
//CRC32
fmt.Printf("%x【CRC32】", reader.ReadBytes(4))
} }

View File

@ -2,25 +2,25 @@ package beijing11
// StationDeviceIndexTable 联锁站设备索引表 // StationDeviceIndexTable 联锁站设备索引表
type StationDeviceIndexTable struct { type StationDeviceIndexTable struct {
StationName string //地图数据中车站的Code属性 StationName string //地图数据中车站的Code属性
InterlockCode uint16 //通信数据中的“联锁编号” InterlockCode uint16 //通信数据中的“联锁编号”
TurnoutMap map[uint16]*Row TurnoutMap map[uint16]*Row //key-联锁编号
PsdMap map[uint16]*Row PsdMap map[uint16]*Row //key-联锁编号
EsbMap map[uint16]*Row EsbMap map[uint16]*Row //key-联锁编号
HoldTrainMap map[uint16]*Row HoldTrainMap map[uint16]*Row //key-联锁编号
SignalMap map[uint16]*Row SignalMap map[uint16]*Row //key-联锁编号
AxleSectionMap map[uint16]*Row AxleSectionMap map[uint16]*Row //key-联锁编号
WrzfMap map[uint16]*Row WrzfMap map[uint16]*Row //key-联锁编号
FymMap map[uint16]*Row FymMap map[uint16]*Row //key-联锁编号
SpksMap map[uint16]*Row SpksMap map[uint16]*Row //key-联锁编号
CkmMap map[uint16]*Row CkmMap map[uint16]*Row //key-联锁编号
XcjMap map[uint16]*Row XcjMap map[uint16]*Row //key-联锁编号
} }
func NewStationDeviceIndexTable(stationName string, interlockCode uint16) *StationDeviceIndexTable { func NewStationDeviceIndexTable(stationName string, interlockIndex uint16) *StationDeviceIndexTable {
return &StationDeviceIndexTable{ return &StationDeviceIndexTable{
StationName: stationName, StationName: stationName,
InterlockCode: interlockCode, InterlockCode: 0x3C00 + interlockIndex,
TurnoutMap: make(map[uint16]*Row), TurnoutMap: make(map[uint16]*Row),
PsdMap: make(map[uint16]*Row), PsdMap: make(map[uint16]*Row),
EsbMap: make(map[uint16]*Row), EsbMap: make(map[uint16]*Row),
@ -42,8 +42,10 @@ type Row struct {
relateDeviceMap map[string]string //此设备关联的其它设备 key-查找设备所用的标识val-uid relateDeviceMap map[string]string //此设备关联的其它设备 key-查找设备所用的标识val-uid
} }
const ( const ( //屏蔽门相关的继电器
POB = "POB" POB = "POB"
PCB = "PCB" PCB = "PCB"
DPB = "DPB" DPB = "DPB"
S = "S" //屏蔽门短编组开门继电器索引
L = "L" //屏蔽门长编组开门继电器索引
) )

View File

@ -11,7 +11,9 @@ import (
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity" "joylink.club/rtsssimulation/entity"
"log/slog" "log/slog"
"math"
"runtime/debug" "runtime/debug"
"sort"
"sync" "sync"
"time" "time"
) )
@ -29,12 +31,13 @@ var (
) )
type serviceContext struct { type serviceContext struct {
cancelFunc context.CancelFunc //用来结束各个协程的函数 cancelFunc context.CancelFunc //用来结束各个协程的函数
client udp.UdpClient //向联锁发送数据的客户端 client udp.UdpClient //向联锁发送数据的客户端
server udp.UdpServer //接收联锁数据的服务端 server udp.UdpServer //接收联锁数据的服务端
sim *memory.VerifySimulation //启动服务所使用的仿真 sim *memory.VerifySimulation //启动服务所使用的仿真
iConfig config.InterlockConfig //启动服务使用的联锁配置 iConfig config.InterlockConfig //启动服务使用的联锁配置
deviceTable *StationDeviceIndexTable //联锁站的设备ID表key-车站名 deviceTable *StationDeviceIndexTable //联锁站的设备ID表key-车站名
driveMsgSlice []*FromInterlockFrame //驱动消息切片
} }
func Start(interlockConfig config.InterlockConfig, simulation *memory.VerifySimulation) { func Start(interlockConfig config.InterlockConfig, simulation *memory.VerifySimulation) {
@ -83,10 +86,189 @@ func (s *serviceContext) handleDriveMsg(data []byte) {
logger().Error("解析数据出错", "error", err) logger().Error("解析数据出错", "error", err)
return return
} }
//for _, cmd := range frame.TurnoutData.CmdList { if len(s.driveMsgSlice) < 2 {
// uid := s.deviceTable.TurnoutMap[cmd.Id].uid if frame.InterlockCode == 0x3c01 || frame.InterlockCode == 0x3c02 {
// fi.turn s.driveMsgSlice = append(s.driveMsgSlice, frame)
}
}
//wd := entity.GetWorldData(s.sim.World)
////for _, cmd := range frame.TurnoutData.CmdList {
//// uid := s.deviceTable.TurnoutMap[cmd.Id].uid
////}
//for _, cmd := range frame.PSDData.CmdList {
// row := s.deviceTable.PsdMap[cmd.Id]
// entry := wd.EntityMap[row.uid]
// circuit := component.PsdCircuitType.Get(entry)
// switch cmd.Cmd {
// case 0xAA: //短编组开门
// component.RelayDriveType.Get(wd.EntityMap[row.relateDeviceMap[S]]).Td = true
// component.RelayDriveType.Get(wd.EntityMap[row.relateDeviceMap[L]]).Td = false
// component.RelayDriveType.Get(circuit.GMJ).Td = false
// case 0xBB: //长编组开门
// component.RelayDriveType.Get(wd.EntityMap[row.relateDeviceMap[S]]).Td = false
// component.RelayDriveType.Get(wd.EntityMap[row.relateDeviceMap[L]]).Td = true
// component.RelayDriveType.Get(circuit.GMJ).Td = false
// case 0x55:
// component.RelayDriveType.Get(wd.EntityMap[row.relateDeviceMap[S]]).Td = false
// component.RelayDriveType.Get(wd.EntityMap[row.relateDeviceMap[L]]).Td = false
// component.RelayDriveType.Get(circuit.GMJ).Td = true
// }
//} //}
//for _, cmd := range frame.ESBData.CmdList {
// uid := s.deviceTable.EsbMap[cmd.Id].uid
// esb := s.sim.Repo.FindEsb(uid)
// if cmd.JjtcplCmd == ON {
// err := fi.DriveRelayUp(s.sim.World, esb.RelayId())
// if err != nil {
// logger().Error("驱动ESB出错", "error", err)
// }
// continue
// }
// if cmd.JjtcCmd == ON {
// err := fi.DriveRelayDown(s.sim.World, esb.RelayId())
// if err != nil {
// logger().Error("驱动ESB出错", "error", err)
// }
// } else {
// err := fi.DriveRelayUp(s.sim.World, esb.RelayId())
// if err != nil {
// logger().Error("驱动ESB出错", "error", err)
// }
// }
//}
//for _, cmd := range frame.SignalData.CmdList {
// uid := s.deviceTable.SignalMap[cmd.Id].uid
// entry := wd.EntityMap[uid]
// if entry.HasComponent(component.Signal2XH1ElectronicType) { // 2XH1信号机
// signal2XH1 := component.Signal2XH1ElectronicType.Get(entry)
// switch cmd.Cmd {
// case SignalAspect_No:
// component.RelayDriveType.Get(signal2XH1.Z2XH1_DDJ).Td = true
// component.RelayDriveType.Get(signal2XH1.Z2XH1_LXJ).Td = false
// case SignalAspect_H:
// component.RelayDriveType.Get(signal2XH1.Z2XH1_DDJ).Td = false
// component.RelayDriveType.Get(signal2XH1.Z2XH1_LXJ).Td = false
// case SignalAspect_L:
// component.RelayDriveType.Get(signal2XH1.Z2XH1_DDJ).Td = false
// component.RelayDriveType.Get(signal2XH1.Z2XH1_LXJ).Td = true
// default:
// logger().Error(fmt.Sprintf("信号机[%s]无法开放[%x]信号", uid, cmd.Cmd))
// }
// } else if entry.HasComponent(component.Signal3XH1ElectronicType) { // 3XH1信号机
// signal3XH1 := component.Signal3XH1ElectronicType.Get(entry)
// switch cmd.Cmd {
// case SignalAspect_No:
// component.RelayDriveType.Get(signal3XH1.Z3XH1_DDJ).Td = true
// component.RelayDriveType.Get(signal3XH1.Z3XH1_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_ZXJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_YXJ).Td = false
// case SignalAspect_H:
// component.RelayDriveType.Get(signal3XH1.Z3XH1_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_ZXJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_YXJ).Td = false
// case SignalAspect_L:
// component.RelayDriveType.Get(signal3XH1.Z3XH1_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_LXJ).Td = true
// component.RelayDriveType.Get(signal3XH1.Z3XH1_ZXJ).Td = true
// component.RelayDriveType.Get(signal3XH1.Z3XH1_YXJ).Td = false
// case SignalAspect_U:
// component.RelayDriveType.Get(signal3XH1.Z3XH1_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_LXJ).Td = true
// component.RelayDriveType.Get(signal3XH1.Z3XH1_ZXJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_YXJ).Td = false
// case SignalAspect_HU:
// component.RelayDriveType.Get(signal3XH1.Z3XH1_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_ZXJ).Td = false
// component.RelayDriveType.Get(signal3XH1.Z3XH1_YXJ).Td = true
// default:
// logger().Error(fmt.Sprintf("信号机[%s]无法开放[%x]信号", uid, cmd.Cmd))
// }
// } else if entry.HasComponent(component.Signal3XH2ElectronicType) { // 3XH2信号机
// signal3XH2 := component.Signal3XH2ElectronicType.Get(entry)
// switch cmd.Cmd {
// case SignalAspect_No:
// component.RelayDriveType.Get(signal3XH2.Z3XH2_DDJ).Td = true
// component.RelayDriveType.Get(signal3XH2.Z3XH2_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH2.Z3XH2_YXJ).Td = false
// case SignalAspect_H:
// component.RelayDriveType.Get(signal3XH2.Z3XH2_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH2.Z3XH2_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH2.Z3XH2_YXJ).Td = false
// case SignalAspect_L:
// component.RelayDriveType.Get(signal3XH2.Z3XH2_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH2.Z3XH2_LXJ).Td = true
// component.RelayDriveType.Get(signal3XH2.Z3XH2_YXJ).Td = false
// case SignalAspect_HU:
// component.RelayDriveType.Get(signal3XH2.Z3XH2_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH2.Z3XH2_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH2.Z3XH2_YXJ).Td = true
// default:
// logger().Error(fmt.Sprintf("信号机[%s]无法开放[%x]信号", uid, cmd.Cmd))
// }
// } else if entry.HasComponent(component.Signal3XH3ElectronicType) { // 3XH3信号机
// signal3XH3 := component.Signal3XH3ElectronicType.Get(entry)
// switch cmd.Cmd {
// case SignalAspect_No:
// component.RelayDriveType.Get(signal3XH3.Z3XH3_DDJ).Td = true
// component.RelayDriveType.Get(signal3XH3.Z3XH3_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH3.Z3XH3_YXJ).Td = false
// case SignalAspect_H:
// component.RelayDriveType.Get(signal3XH3.Z3XH3_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH3.Z3XH3_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH3.Z3XH3_YXJ).Td = false
// case SignalAspect_U:
// component.RelayDriveType.Get(signal3XH3.Z3XH3_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH3.Z3XH3_LXJ).Td = true
// component.RelayDriveType.Get(signal3XH3.Z3XH3_YXJ).Td = false
// case SignalAspect_HU:
// component.RelayDriveType.Get(signal3XH3.Z3XH3_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH3.Z3XH3_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH3.Z3XH3_YXJ).Td = true
// default:
// logger().Error(fmt.Sprintf("信号机[%s]无法开放[%x]信号", uid, cmd.Cmd))
// }
// } else if entry.HasComponent(component.Signal3XH4ElectronicType) { // 3XH4信号机
// signal3XH4 := component.Signal3XH4ElectronicType.Get(entry)
// switch cmd.Cmd {
// case SignalAspect_No:
// component.RelayDriveType.Get(signal3XH4.Z3XH4_DDJ).Td = true
// component.RelayDriveType.Get(signal3XH4.Z3XH4_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH4.Z3XH4_ZXJ).Td = false
// case SignalAspect_H:
// component.RelayDriveType.Get(signal3XH4.Z3XH4_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH4.Z3XH4_LXJ).Td = false
// component.RelayDriveType.Get(signal3XH4.Z3XH4_ZXJ).Td = false
// case SignalAspect_L:
// component.RelayDriveType.Get(signal3XH4.Z3XH4_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH4.Z3XH4_LXJ).Td = true
// component.RelayDriveType.Get(signal3XH4.Z3XH4_ZXJ).Td = true
// case SignalAspect_U:
// component.RelayDriveType.Get(signal3XH4.Z3XH4_DDJ).Td = false
// component.RelayDriveType.Get(signal3XH4.Z3XH4_LXJ).Td = true
// component.RelayDriveType.Get(signal3XH4.Z3XH4_ZXJ).Td = false
// default:
// logger().Error(fmt.Sprintf("信号机[%s]无法开放[%x]信号", uid, cmd.Cmd))
// }
// } else {
// logger().Error(fmt.Sprintf("信号机[%s]的型号未知", uid))
// }
//}
//for _, cmd := range frame.AxleSectionData.CmdList {
// if cmd.Cmd == 0x80 {
// uid := s.deviceTable.AxleSectionMap[cmd.Id].uid
// physicalSectionUid := s.sim.Repo.FindAxleCountingSection(uid).PhysicalSection().Id()
// _, err := fi.PhysicalSectionDrstDrive(s.sim.World, physicalSectionUid)
// if err != nil {
// logger().Error(fmt.Sprintf("计轴区段[%s]复位出错:%s", uid, err))
// }
// }
//}
////for _, cmd := range frame.SPKSData.CmdList {
//// uid := s.deviceTable.SpksMap[cmd.Id].uid
////}
} }
func Stop(stationCode string) { func Stop(stationCode string) {
@ -139,7 +321,7 @@ func makeTable(sim *memory.VerifySimulation, stationCode string) *StationDeviceI
} }
for _, station := range uids.TurnoutIds[data.Id].CentralizedStations { for _, station := range uids.TurnoutIds[data.Id].CentralizedStations {
if station.StationName == stationCode { if station.StationName == stationCode {
table.TurnoutMap[uint16(data.Id)] = &Row{ table.TurnoutMap[uint16(data.Index)] = &Row{
commonId: data.Id, commonId: data.Id,
uid: uids.TurnoutIds[data.Id].Uid, uid: uids.TurnoutIds[data.Id].Uid,
index: uint16(data.Index), index: uint16(data.Index),
@ -153,9 +335,26 @@ func makeTable(sim *memory.VerifySimulation, stationCode string) *StationDeviceI
if data.Index <= 0 { if data.Index <= 0 {
continue continue
} }
relateDeviceMap := make(map[string]string)
wd := entity.GetWorldData(sim.World)
entry := wd.EntityMap[uids.PsdIds[data.Id].Uid]
circuit := component.PsdCircuitType.Get(entry)
var s, l int32 = math.MaxInt32, 0
var sRelayId, lRelayId string
for i, relay := range circuit.KMJMap {
if i <= s {
s = i
sRelayId = component.UidType.Get(relay).Id
}
if i >= l {
l = i
lRelayId = component.UidType.Get(relay).Id
}
}
relateDeviceMap[S] = sRelayId
relateDeviceMap[L] = lRelayId
for _, station := range uids.PsdIds[data.Id].CentralizedStations { for _, station := range uids.PsdIds[data.Id].CentralizedStations {
if station.StationName == stationCode { if station.StationName == stationCode {
relateDeviceMap := make(map[string]string)
for _, mkx := range sim.Repo.MkxList() { for _, mkx := range sim.Repo.MkxList() {
if mkx.Psd().Id() == uids.PsdIds[data.Id].Uid { if mkx.Psd().Id() == uids.PsdIds[data.Id].Uid {
relateDeviceMap[POB] = mkx.Pobj().Id() relateDeviceMap[POB] = mkx.Pobj().Id()
@ -163,7 +362,7 @@ func makeTable(sim *memory.VerifySimulation, stationCode string) *StationDeviceI
relateDeviceMap[DPB] = mkx.Pabj().Id() relateDeviceMap[DPB] = mkx.Pabj().Id()
} }
} }
table.PsdMap[uint16(data.Id)] = &Row{ table.PsdMap[uint16(data.Index)] = &Row{
commonId: data.Id, commonId: data.Id,
uid: uids.PsdIds[data.Id].Uid, uid: uids.PsdIds[data.Id].Uid,
index: uint16(data.Index), index: uint16(data.Index),
@ -179,7 +378,7 @@ func makeTable(sim *memory.VerifySimulation, stationCode string) *StationDeviceI
} }
for _, station := range uids.EsbIds[data.Id].CentralizedStations { for _, station := range uids.EsbIds[data.Id].CentralizedStations {
if station.StationName == stationCode { if station.StationName == stationCode {
table.EsbMap[uint16(data.Id)] = &Row{ table.EsbMap[uint16(data.Index)] = &Row{
commonId: data.Id, commonId: data.Id,
uid: uids.EsbIds[data.Id].Uid, uid: uids.EsbIds[data.Id].Uid,
index: uint16(data.Index), index: uint16(data.Index),
@ -196,7 +395,7 @@ func makeTable(sim *memory.VerifySimulation, stationCode string) *StationDeviceI
} }
for _, station := range uids.SignalIds[data.Id].CentralizedStations { for _, station := range uids.SignalIds[data.Id].CentralizedStations {
if station.StationName == stationCode { if station.StationName == stationCode {
table.SignalMap[uint16(data.Id)] = &Row{ table.SignalMap[uint16(data.Index)] = &Row{
commonId: data.Id, commonId: data.Id,
uid: uids.SignalIds[data.Id].Uid, uid: uids.SignalIds[data.Id].Uid,
index: uint16(data.Index), index: uint16(data.Index),
@ -213,7 +412,7 @@ func makeTable(sim *memory.VerifySimulation, stationCode string) *StationDeviceI
sectionModule := sim.Repo.FindAxleCountingSection(uids.AxleCountingSectionIds[data.Id].Uid) sectionModule := sim.Repo.FindAxleCountingSection(uids.AxleCountingSectionIds[data.Id].Uid)
for _, station := range sectionModule.PhysicalSection().CentralizedStation() { for _, station := range sectionModule.PhysicalSection().CentralizedStation() {
if station.GetCode() == stationCode { if station.GetCode() == stationCode {
table.AxleSectionMap[uint16(data.Id)] = &Row{ table.AxleSectionMap[uint16(data.Index)] = &Row{
commonId: data.Id, commonId: data.Id,
uid: uids.AxleCountingSectionIds[data.Id].Uid, uid: uids.AxleCountingSectionIds[data.Id].Uid,
index: uint16(data.Index), index: uint16(data.Index),
@ -231,7 +430,7 @@ func makeTable(sim *memory.VerifySimulation, stationCode string) *StationDeviceI
} }
for _, station := range uids.SpksIds[data.Id].CentralizedStations { for _, station := range uids.SpksIds[data.Id].CentralizedStations {
if station.StationName == stationCode { if station.StationName == stationCode {
table.SpksMap[uint16(data.Id)] = &Row{ table.SpksMap[uint16(data.Index)] = &Row{
commonId: data.Id, commonId: data.Id,
uid: uids.SpksIds[data.Id].Uid, uid: uids.SpksIds[data.Id].Uid,
index: uint16(data.Index), index: uint16(data.Index),
@ -260,55 +459,59 @@ func (s *serviceContext) runCollectTask(ctx context.Context) {
case <-ctx.Done(): case <-ctx.Done():
return return
default: default:
frame := s.collectDeviceState() for _, driveMsg := range s.driveMsgSlice {
data := frame.encode() frame := s.collectDeviceState(driveMsg)
err := s.client.Send(data) data := frame.encode()
if err != nil { err := s.client.Send(data)
logger().Error("向联锁发送数据失败", "error", err) if err != nil {
} else { logger().Error("向联锁发送数据失败", "error", err)
logger().Info(fmt.Sprintf("向联锁发送数据:%x", data)) } else {
logger().Info(fmt.Sprintf("向联锁发送数据:%x", data))
}
} }
//frame := s.collectDeviceState()
//data := frame.encode()
//err := s.client.Send(data)
//if err != nil {
// logger().Error("向联锁发送数据失败", "error", err)
//} else {
// logger().Info(fmt.Sprintf("向联锁发送数据:%x", data))
//}
} }
} }
}() }()
} }
func (s *serviceContext) collectDeviceState() *ToInterlockFrame { func (s *serviceContext) collectDeviceState(msg *FromInterlockFrame) *ToInterlockFrame {
wd := entity.GetWorldData(s.sim.World) wd := entity.GetWorldData(s.sim.World)
frame := &ToInterlockFrame{} frame := &ToInterlockFrame{}
frame.WaysideCode = waysideCode frame.WaysideCode = waysideCode
frame.InterlockCode = s.deviceTable.InterlockCode frame.InterlockCode = msg.InterlockCode
//道岔 //道岔
for _, row := range s.deviceTable.TurnoutMap { for _, cmd := range msg.TurnoutData.CmdList {
row := s.deviceTable.TurnoutMap[cmd.Id]
entry := wd.EntityMap[row.uid] entry := wd.EntityMap[row.uid]
pos := component.TurnoutPositionType.Get(entry) tp := component.TurnoutPositionType.Get(entry)
state := GetStateByte(pos.Db) var stateByte byte
var current1 byte if tp.Dw {
var current2 byte stateByte = 0x01
if entry.HasComponent(component.TurnoutZzjType) { } else if tp.Fw {
zzjList := component.TurnoutZzjType.Get(entry).ZzjList stateByte = 0x02
for i, zzj := range zzjList { } else {
speed := component.FixedPositionTransformType.Get(zzj).Speed stateByte = 0x08
if speed != 0 {
switch i {
case 0:
current1 = 100
case 1:
current2 = 100
}
}
}
} }
frame.TurnoutStates = append(frame.TurnoutStates, &TurnoutState{ frame.TurnoutStates = append(frame.TurnoutStates, &TurnoutState{
Id: row.index, Id: row.index,
State: state, State: stateByte,
Alarm: 0,
Current1: current1,
Current2: current2,
}) })
} }
sort.Slice(frame.TurnoutStates, func(i, j int) bool {
return frame.TurnoutStates[i].Id < frame.TurnoutStates[j].Id
})
//屏蔽门 //屏蔽门
for _, row := range s.deviceTable.PsdMap { for _, cmd := range msg.PSDData.CmdList {
row := s.deviceTable.PsdMap[cmd.Id]
entry := wd.EntityMap[row.uid] entry := wd.EntityMap[row.uid]
psdState := component.PsdStateType.Get(entry) psdState := component.PsdStateType.Get(entry)
mkxBytes := make([]byte, 0, 3) mkxBytes := make([]byte, 0, 3)
@ -321,14 +524,18 @@ func (s *serviceContext) collectDeviceState() *ToInterlockFrame {
frame.PsdStates = append(frame.PsdStates, &PSDState{ frame.PsdStates = append(frame.PsdStates, &PSDState{
Id: row.index, Id: row.index,
State: GetStateByte(psdState.Close), State: GetStateByte(psdState.Close),
Hsjc: GetStateByte(psdState.InterlockRelease), Hsjc: 0xff,
PCB: mkxBytes[0], PCB: mkxBytes[0],
POB: mkxBytes[1], POB: mkxBytes[1],
DPB: mkxBytes[2], DPB: mkxBytes[2],
}) })
} }
sort.Slice(frame.PsdStates, func(i, j int) bool {
return frame.PsdStates[i].Id < frame.PsdStates[j].Id
})
//紧急停车 //紧急停车
for _, row := range s.deviceTable.EsbMap { for _, cmd := range msg.ESBData.CmdList {
row := s.deviceTable.EsbMap[cmd.Id]
esb := s.sim.Repo.FindEsb(row.uid) esb := s.sim.Repo.FindEsb(row.uid)
relay := wd.EntityMap[esb.RelayId()] relay := wd.EntityMap[esb.RelayId()]
pla := wd.EntityMap[esb.PlaId()] pla := wd.EntityMap[esb.PlaId()]
@ -338,34 +545,78 @@ func (s *serviceContext) collectDeviceState() *ToInterlockFrame {
PlState: GetStateByte(component.BitStateType.Get(pla).Val), PlState: GetStateByte(component.BitStateType.Get(pla).Val),
}) })
} }
sort.Slice(frame.ESBStates, func(i, j int) bool {
return frame.ESBStates[i].Id < frame.ESBStates[j].Id
})
//信号机 //信号机
for _, row := range s.deviceTable.SignalMap { for _, cmd := range msg.SignalData.CmdList {
row := s.deviceTable.SignalMap[cmd.Id]
entry := wd.EntityMap[row.uid] entry := wd.EntityMap[row.uid]
lights := component.SignalLightsType.Get(entry) lights := component.SignalLightsType.Get(entry)
var current byte isL := false
isH := false
isU := false
isA := false
isB := false
for _, light := range lights.Lights { for _, light := range lights.Lights {
if component.BitStateType.Get(light).Val { switch {
current = 100 case light.HasComponent(component.LdTag):
break isL = component.BitStateType.Get(light).Val
case light.HasComponent(component.HdTag):
isH = component.BitStateType.Get(light).Val
case light.HasComponent(component.UdTag):
isU = component.BitStateType.Get(light).Val
case light.HasComponent(component.BdTag):
isB = component.BitStateType.Get(light).Val
case light.HasComponent(component.AdTag):
isA = component.BitStateType.Get(light).Val
}
}
var stateByte byte
if isH && isU {
stateByte = 0x03
} else {
switch {
case isL:
stateByte = 0x04
case isH:
stateByte = 0x01
case isU:
stateByte = 0x02
case isB:
stateByte = 0x08
case isA:
stateByte = 0x09
} }
} }
frame.SignalStates = append(frame.SignalStates, &SignalState{ frame.SignalStates = append(frame.SignalStates, &SignalState{
Id: row.index, Id: row.index,
State: 1, //目前还不知道每种显示对应什么字节,先这样 State: stateByte,
Current: current,
}) })
} }
sort.Slice(frame.SignalStates, func(i, j int) bool {
return frame.SignalStates[i].Id < frame.SignalStates[j].Id
})
//计轴区段 //计轴区段
for _, row := range s.deviceTable.AxleSectionMap { for _, cmd := range msg.AxleSectionData.CmdList {
row := s.deviceTable.AxleSectionMap[cmd.Id]
entry := wd.EntityMap[row.uid] entry := wd.EntityMap[row.uid]
sectionState := component.AxleCountingSectionStateType.Get(entry) sectionState := component.AxleCountingSectionStateType.Get(entry)
var stateByte byte = 0x40
if sectionState.Occupied {
stateByte = 0x40
}
frame.AxleSectionStates = append(frame.AxleSectionStates, &AxleSectionState{ frame.AxleSectionStates = append(frame.AxleSectionStates, &AxleSectionState{
Id: row.index, Id: row.index,
State: GetStateByte(sectionState.Occupied), State: stateByte,
}) })
} }
sort.Slice(frame.AxleSectionStates, func(i, j int) bool {
return frame.AxleSectionStates[i].Id < frame.AxleSectionStates[j].Id
})
//SPKS //SPKS
for _, row := range s.deviceTable.SpksMap { for _, cmd := range msg.SPKSData.CmdList {
row := s.deviceTable.SpksMap[cmd.Id]
spks := s.sim.Repo.FindSpks(row.uid) spks := s.sim.Repo.FindSpks(row.uid)
relay := wd.EntityMap[spks.Relay()] relay := wd.EntityMap[spks.Relay()]
pla := wd.EntityMap[spks.PlaId()] pla := wd.EntityMap[spks.PlaId()]
@ -375,9 +626,155 @@ func (s *serviceContext) collectDeviceState() *ToInterlockFrame {
PlState: GetStateByte(component.BitStateType.Get(pla).Val), PlState: GetStateByte(component.BitStateType.Get(pla).Val),
}) })
} }
sort.Slice(frame.SPKSStates, func(i, j int) bool {
return frame.SPKSStates[i].Id < frame.SPKSStates[j].Id
})
return frame return frame
} }
//func (s *serviceContext) collectDeviceState() *ToInterlockFrame {
// wd := entity.GetWorldData(s.sim.World)
// frame := &ToInterlockFrame{}
// frame.WaysideCode = waysideCode
// frame.InterlockCode = s.deviceTable.InterlockCode
// //道岔
// for _, row := range s.deviceTable.TurnoutMap {
// entry := wd.EntityMap[row.uid]
// tp := component.TurnoutPositionType.Get(entry)
// var stateByte byte
// if tp.Dw {
// stateByte = 0x01
// } else if tp.Fw {
// stateByte = 0x02
// } else {
// stateByte = 0x08
// }
// frame.TurnoutStates = append(frame.TurnoutStates, &TurnoutState{
// Id: row.index,
// State: stateByte,
// })
// }
// sort.Slice(frame.TurnoutStates, func(i, j int) bool {
// return frame.TurnoutStates[i].Id < frame.TurnoutStates[j].Id
// })
// //屏蔽门
// for _, row := range s.deviceTable.PsdMap {
// entry := wd.EntityMap[row.uid]
// psdState := component.PsdStateType.Get(entry)
// mkxBytes := make([]byte, 0, 3)
// for _, mkxRelayUid := range []string{row.relateDeviceMap[POB], row.relateDeviceMap[PCB], row.relateDeviceMap[DPB]} {
// if mkxRelayUid == "" {
// continue
// }
// mkxBytes = append(mkxBytes, GetStateByte(component.BitStateType.Get(wd.EntityMap[mkxRelayUid]).Val))
// }
// frame.PsdStates = append(frame.PsdStates, &PSDState{
// Id: row.index,
// State: GetStateByte(psdState.Close),
// Hsjc: 0xff,
// PCB: mkxBytes[0],
// POB: mkxBytes[1],
// DPB: mkxBytes[2],
// })
// }
// sort.Slice(frame.PsdStates, func(i, j int) bool {
// return frame.PsdStates[i].Id < frame.PsdStates[j].Id
// })
// //紧急停车
// for _, row := range s.deviceTable.EsbMap {
// esb := s.sim.Repo.FindEsb(row.uid)
// relay := wd.EntityMap[esb.RelayId()]
// pla := wd.EntityMap[esb.PlaId()]
// frame.ESBStates = append(frame.ESBStates, &ESBState{
// Id: row.index,
// State: GetStateByte(!component.BitStateType.Get(relay).Val),
// PlState: GetStateByte(component.BitStateType.Get(pla).Val),
// })
// }
// sort.Slice(frame.ESBStates, func(i, j int) bool {
// return frame.ESBStates[i].Id < frame.ESBStates[j].Id
// })
// //信号机
// for _, row := range s.deviceTable.SignalMap {
// entry := wd.EntityMap[row.uid]
// lights := component.SignalLightsType.Get(entry)
// isL := false
// isH := false
// isU := false
// isA := false
// isB := false
// for _, light := range lights.Lights {
// switch {
// case light.HasComponent(component.LdTag):
// isL = component.BitStateType.Get(light).Val
// case light.HasComponent(component.HdTag):
// isH = component.BitStateType.Get(light).Val
// case light.HasComponent(component.UdTag):
// isU = component.BitStateType.Get(light).Val
// case light.HasComponent(component.BdTag):
// isB = component.BitStateType.Get(light).Val
// case light.HasComponent(component.AdTag):
// isA = component.BitStateType.Get(light).Val
// }
// }
// var stateByte byte
// if isH && isU {
// stateByte = 0x03
// } else {
// switch {
// case isL:
// stateByte = 0x04
// case isH:
// stateByte = 0x01
// case isU:
// stateByte = 0x02
// case isB:
// stateByte = 0x08
// case isA:
// stateByte = 0x09
// }
// }
// frame.SignalStates = append(frame.SignalStates, &SignalState{
// Id: row.index,
// State: stateByte,
// })
// }
// sort.Slice(frame.SignalStates, func(i, j int) bool {
// return frame.SignalStates[i].Id < frame.SignalStates[j].Id
// })
// //计轴区段
// for _, row := range s.deviceTable.AxleSectionMap {
// entry := wd.EntityMap[row.uid]
// sectionState := component.AxleCountingSectionStateType.Get(entry)
// var stateByte byte = 0x40
// if sectionState.Occupied {
// stateByte = 0x40
// }
// frame.AxleSectionStates = append(frame.AxleSectionStates, &AxleSectionState{
// Id: row.index,
// State: stateByte,
// })
// }
// sort.Slice(frame.AxleSectionStates, func(i, j int) bool {
// return frame.AxleSectionStates[i].Id < frame.AxleSectionStates[j].Id
// })
// //SPKS
// for _, row := range s.deviceTable.SpksMap {
// spks := s.sim.Repo.FindSpks(row.uid)
// relay := wd.EntityMap[spks.Relay()]
// pla := wd.EntityMap[spks.PlaId()]
// frame.SPKSStates = append(frame.SPKSStates, &SPKSState{
// Id: row.index,
// State: GetStateByte(component.BitStateType.Get(relay).Val),
// PlState: GetStateByte(component.BitStateType.Get(pla).Val),
// })
// }
// sort.Slice(frame.SPKSStates, func(i, j int) bool {
// return frame.SPKSStates[i].Id < frame.SPKSStates[j].Id
// })
// return frame
//}
func logger() *slog.Logger { func logger() *slog.Logger {
loggerInit.Do(func() { loggerInit.Do(func() {
privateLogger = slog.Default().With("tag", logTag) privateLogger = slog.Default().With("tag", logTag)

View File

@ -13,37 +13,40 @@ 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" //开左门按钮
GZM = "GZM" //关左门按钮 GZM = "GZM" //关左门按钮
GYM = "GYM" //关右门按钮 GYM = "GYM" //关右门按钮
KYM = "KYM" //开右门 KYM = "KYM" //开右门
ZAWTGJC = "ZAWTGJC" //障碍物/脱轨检测 ZAWTGJC = "ZAWTGJC" //障碍物/脱轨检测
ZDZGZ = "ZDZGZ" //制动重故障 ZDZGZ = "ZDZGZ" //制动重故障
ATPSD = "ATPSD" //ATP上电按钮 ATPSD = "ATPSD" //ATP上电按钮
MSQR = "MSQR" //模式确认 MSQR = "MSQR" //模式确认
ZF = "ZF" ZF = "ZF"
QZMYX = "QZMYX" //强制门允许 QZMYX = "QZMYX" //强制门允许
MSJJ = "MSJJ" //模式降级 MSJJ = "MSJJ" //模式降级
MSSJ = "MSSJ" // 模式升级 MSSJ = "MSSJ" // 模式升级
HX = "HX" //唤醒按钮 HX = "HX" //唤醒按钮
JX = "JX" //检修按钮 JX = "JX" //检修按钮
XM = "XM" //休眠按钮 XM = "XM" //休眠按钮
LIGHT_JJZD = JJZD
LIGHT_QQY = "QQY" //切牵引指示灯 LIGHT_JJZD = JJZD
LIGHT_JSSJH = "JSSJH" // 驾驶室激活 LIGHT_QQY = "QQY" //切牵引指示灯
LIGHT_TFZDHJ = "TFZDHJ" //停放制动缓解 LIGHT_JSSJH = "JSSJH" // 驾驶室激活
LIGHT_QYYX = "QYYX" // 牵引有效 LIGHT_TFZDHJ = "TFZDHJ" //停放制动缓解
LIGHT_ZDYX = "ZDYX" //制动有效 LIGHT_QYYX = "QYYX" // 牵引有效
LIGHT_TFZDSJ = "TFZDSJ" //停放制动施加 LIGHT_ZDYX = "ZDYX" //制动有效
LIGHT_CYZD = "CYZD" //常用制动 LIGHT_TFZDSJ = "TFZDSJ" //停放制动施加
LIGHT_ZDGL = "ZDGL" //制动隔离 LIGHT_CYZD = "CYZD" //常用制动
LIGHT_LSXH = "LSXH" //零速信号 LIGHT_ZDGL = "ZDGL" //制动隔离
LIGHT_ZMYX = "ZMYX" //左门允许 LIGHT_LSXH = "LSXH" //零速信号
LIGHT_YMYX = "YMYX" //右门允许 LIGHT_ZMYX = "ZMYX" //左门允许
LIGHT_ZFZSD = "ZFZSD" //折返指示灯 LIGHT_YMYX = "YMYX" //右门允许
LIGHT_BDATPKC = "BDATPKC" //本段atp控车 LIGHT_ZFZSD = "ZFZSD" //折返指示灯
LIGHT_BDATPKC = "BDATPKC" //本段atp控车
LIGHT_ATOFCZSD = "ATOFCZSD" //ato发车指示灯
) )
// 获取列车控制图形数据 // 获取列车控制图形数据

View File

@ -18,14 +18,14 @@ func HandleSectionOperation(simulation *VerifySimulation, req *request_proto.Sec
// 区段操作 // 区段操作
switch req.Operation { switch req.Operation {
case request_proto.Section_SetFaultOcc: case request_proto.Section_SetFaultOcc:
return fi.AxleSectionFaultOccDrive(simulation.World, uid, true) return fi.PhysicalSectionFaultOccDrive(simulation.World, uid, true)
case request_proto.Section_SetParams: case request_proto.Section_SetParams:
err := setSectionParam(simulation.World, uid, req.Param) err := setSectionParam(simulation.World, uid, req.Param)
if err != nil { if err != nil {
return err return err
} }
if req.Param.MockDrst { if req.Param.MockDrst {
state, err := fi.AxleSectionDrstDrive(simulation.World, uid) state, err := fi.PhysicalSectionDrstDrive(simulation.World, uid)
if err != nil { if err != nil {
return err return err
} }
@ -34,7 +34,7 @@ func HandleSectionOperation(simulation *VerifySimulation, req *request_proto.Sec
} }
} }
if req.Param.MockPdrst { if req.Param.MockPdrst {
state, err := fi.AxleSectionPdrstDrive(simulation.World, uid) state, err := fi.PhysicalSectionPdrstDrive(simulation.World, uid)
if err != nil { if err != nil {
return err return err
} }
@ -66,17 +66,17 @@ func setSectionParam(world ecs.World, uid string, sectionParam *request_proto.Se
// } // }
// switch req.Operation { // switch req.Operation {
// case request_proto.Section_CancelDrst: // case request_proto.Section_CancelDrst:
// return fi.AxleSectionDrstDrive(simulation.World, sectionUid, false) // return fi.PhysicalSectionDrstDrive(simulation.World, sectionUid, false)
// case request_proto.Section_SetDrst: // case request_proto.Section_SetDrst:
// return fi.AxleSectionDrstDrive(simulation.World, sectionUid, true) // return fi.PhysicalSectionDrstDrive(simulation.World, sectionUid, true)
// case request_proto.Section_CancelPdrst: // case request_proto.Section_CancelPdrst:
// return fi.AxleSectionPdrstDrive(simulation.World, sectionUid, false) // return fi.PhysicalSectionPdrstDrive(simulation.World, sectionUid, false)
// case request_proto.Section_SetPdrst: // case request_proto.Section_SetPdrst:
// return fi.AxleSectionPdrstDrive(simulation.World, sectionUid, true) // return fi.PhysicalSectionPdrstDrive(simulation.World, sectionUid, true)
// case request_proto.Section_CancelFaultOcc: // case request_proto.Section_CancelFaultOcc:
// return fi.AxleSectionFaultOccDrive(simulation.World, sectionUid, false) // return fi.PhysicalSectionFaultOccDrive(simulation.World, sectionUid, false)
// case request_proto.Section_SetFaultOcc: // case request_proto.Section_SetFaultOcc:
// return fi.AxleSectionFaultOccDrive(simulation.World, sectionUid, true) // return fi.PhysicalSectionFaultOccDrive(simulation.World, sectionUid, true)
// } // }
// return nil // return nil
// } // }

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

@ -191,13 +191,13 @@ func (s *VerifySimulation) CollectSectionStatus(city string, lineId string, cent
} }
// //
//slog.Debug("收集计轴区段状态", "计轴区段len", len(axleSectionIds), "axleSectionIds", axleSectionIds) //slog.Debug("收集计轴区段状态", "计轴区段len", len(axleSectionIds), "axleSectionIds", axleSectionIds)
as, e := fi.FindAxleSectionsStatus(s.World, axleSectionIds) as, e := fi.FindPhysicalSectionsStatus(s.World, axleSectionIds)
if e != nil { //从仿真中收集计轴区段状态的失败列表 if e != nil { //从仿真中收集计轴区段状态的失败列表
return nil, e return nil, e
} }
//slog.Debug("收集计轴区段状态", "仿真中计轴状态len", len(as)) //slog.Debug("收集计轴区段状态", "仿真中计轴状态len", len(as))
// //
stateMap := make(map[string]*fi.AxleSectionState) stateMap := make(map[string]*fi.PhysicalSectionState)
for _, a := range as { for _, a := range as {
stateMap[a.Id] = a stateMap[a.Id] = a
} }
@ -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)) //跳跃指令
} }