列车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"`
// 前溜/后溜m/s默认0
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() {
@ -225,6 +226,13 @@ func (x *TrainDynamicConfig) GetTrainLoad() int32 {
return 0
}
func (x *TrainDynamicConfig) GetMaxSpeed() float32 {
if x != nil {
return x.MaxSpeed
}
return 0
}
// 列车一端的状态
type TrainEndsState struct {
state protoimpl.MessageState
@ -376,7 +384,7 @@ var File_common_data_proto protoreflect.FileDescriptor
var file_common_data_proto_rawDesc = []byte{
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,
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,
@ -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,
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,
0x05, 0x52, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x22, 0x88, 0x04, 0x0a,
0x0e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x64, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x2e, 0x0a, 0x12, 0x73, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x73, 0x70, 0x65,
0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x12,
0x2e, 0x0a, 0x12, 0x73, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x42, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x73, 0x70, 0x65,
0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x12,
0x20, 0x0a, 0x0b, 0x72, 0x61, 0x64, 0x61, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x72, 0x61, 0x64, 0x61, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c,
0x65, 0x12, 0x30, 0x0a, 0x13, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53,
0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x13,
0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44,
0x69, 0x66, 0x66, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63,
0x6b, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x72, 0x61, 0x64,
0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61,
0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
0x61, 0x63, 0x63, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x61, 0x63, 0x63,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x18, 0x07,
0x20, 0x01, 0x28, 0x02, 0x52, 0x11, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70,
0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x43, 0x68,
0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61,
0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x61,
0x63, 0x63, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05,
0x52, 0x0b, 0x61, 0x63, 0x63, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x24, 0x0a,
0x0d, 0x72, 0x61, 0x64, 0x61, 0x72, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x0a,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x72, 0x61, 0x64, 0x61, 0x72, 0x4f, 0x75, 0x74, 0x53, 0x70,
0x65, 0x65, 0x64, 0x12, 0x32, 0x0a, 0x14, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63,
0x6b, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28,
0x03, 0x52, 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, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x18, 0x0c, 0x20,
0x01, 0x28, 0x03, 0x52, 0x12, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d,
0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x42, 0x2f, 0x5a, 0x2d, 0x6a, 0x6f, 0x79, 0x6c, 0x69,
0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73,
0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x05, 0x52, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x4c, 0x6f, 0x61, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x6d, 0x61, 0x78, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x14, 0x20, 0x01, 0x28, 0x02, 0x52, 0x08,
0x6d, 0x61, 0x78, 0x53, 0x70, 0x65, 0x65, 0x64, 0x22, 0x88, 0x04, 0x0a, 0x0e, 0x54, 0x72, 0x61,
0x69, 0x6e, 0x45, 0x6e, 0x64, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x12, 0x73,
0x70, 0x65, 0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x73, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65,
0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x12, 0x2e, 0x0a, 0x12, 0x73,
0x70, 0x65, 0x65, 0x64, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
0x42, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x73, 0x70, 0x65, 0x65, 0x64, 0x53, 0x65,
0x6e, 0x73, 0x6f, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x12, 0x20, 0x0a, 0x0b, 0x72,
0x61, 0x64, 0x61, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,
0x52, 0x0b, 0x72, 0x61, 0x64, 0x61, 0x72, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x30, 0x0a,
0x13, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64,
0x44, 0x69, 0x66, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x13, 0x72, 0x61, 0x64, 0x61,
0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x12,
0x26, 0x0a, 0x0e, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d,
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68,
0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x63, 0x63, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x63, 0x63, 0x45,
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63,
0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44, 0x69, 0x66, 0x66, 0x18, 0x07, 0x20, 0x01, 0x28, 0x02,
0x52, 0x11, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 0x44,
0x69, 0x66, 0x66, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54,
0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x43, 0x68,
0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x63, 0x63, 0x4f, 0x75,
0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x61, 0x63,
0x63, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x72, 0x61, 0x64,
0x61, 0x72, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05,
0x52, 0x0d, 0x72, 0x61, 0x64, 0x61, 0x72, 0x4f, 0x75, 0x74, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12,
0x32, 0x0a, 0x14, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d,
0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 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, 0x63, 0x6b, 0x54,
0x69, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x41, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52,
0x12, 0x61, 0x63, 0x63, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x4f, 0x76, 0x65,
0x72, 0x41, 0x74, 0x42, 0x2f, 0x5a, 0x2d, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63,
0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72,
0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x5f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -130,6 +130,7 @@ type ConfigTrainData struct {
IdlingR float32 `json:"idlingR"` // 空转冲击率(m/s) 默认0
IdlingD int32 `json:"idlingD"` // 空转持续时间s 默认0
TrainLoad int32 `json:"trainLoad"` // 列车载重 默认 16000
MaxSpeed float32 `json:"maxSpeed"` //列车最大时速
//TrainEndsA ConfigTrainEnds `json:"TrainEndsA"` // 车辆A端
//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,
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,
TrainLoad: dc.TrainLoad,
TrainLoad: dc.TrainLoad, MaxSpeed: dc.MaxSpeed,
}
}
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})
case memory.LIGHT_BDATPKC:
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:
lights = append(lights, &state_proto.TrainControlState_ControlLight{Id: light.Id, Val: light.Val})
}

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

View File

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

View File

@ -25,13 +25,12 @@ const (
//列车总质量(吨)
DEFULAT_TRAIN_LOAD = 160
//通号最大制动力是-1.21
//DEFAULT_BRAKE_FORCE = DEFULAT_TRAIN_LOAD * 1000 * 1.21 / 1000
DEFAULT_BRAKE_FORCE = 1.21
//通号最大加速度是0.97
DEFAULT_TRAIN_TRACTION_ACC2 = DEFULAT_TRAIN_LOAD * 1000 * 0.97 / 1000 //千牛
DEFAULT_TRAIN_TRACTION_ACC = 0.97 //千牛
TRAIN_MAX_TRACTION_POWER = 2880 * 1000
DEFAULT_TRAIN_STARTED_SPEED float32 = 5.5555556 //列车起步速度单位 米/秒
DEFAULT_TRAIN_TRACTION_ACC = 0.97 //加速度
DEFAULT_TRAIN_STARTED_SPEED float64 = 80 / 3.6 //列车起步速度单位 米/秒
)
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)
vs := train.VobcState
if vs.TractionStatus {
//动力学之前是kn * 100 这里*10就是N
tf := float32(vs.TractionPower) / info.Speed
vs.TractionForce = int64(tf / 10)
if vs.Ato {
} else if vs.TractionStatus {
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 {
semi_physical_train.Default().SendTrainControlMessage(info)
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"
"log/slog"
"math"
"strings"
"time"
)
@ -122,6 +123,8 @@ func trainControlButton(vobc *state_proto.TrainVobcState, buttonMap map[string]*
return controlOverhaulBtn(vobc, active, btn)
case XM: //休眠按钮
return controlSleepBtn(vobc, active, btn)
case ATOQD:
return controlAtoSenderBtn(vobc, active, btn)
default:
return nil
}
@ -136,9 +139,11 @@ func controlEBBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *state_p
return nil
}
tccBtn.Passed = active
vobc.TractionStatus = false
vobc.EmergencyBrakingStatus = true
vobc.TractionForce = 0
vobc.BrakeForce = int64(DEFAULT_BRAKE_FORCE * 100)
vobc.BrakeForce = trainBraking(vobc.TrainLoad, 100) / 1000 * 100
vobc.BrakingStatus = true
return []message.TrainPcSimBaseMessage{
{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
vobc.OverhaulBtn = active
return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OVERHAUL, status}}}
//return []message.TrainPcSimBaseMessage{{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.ATO_SEND_TRAIN, status}}}
}
// 休眠按钮
@ -329,6 +333,15 @@ func controlSleepBtn(vobc *state_proto.TrainVobcState, active bool, tccBtn *stat
vobc.SleepBtn = active
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 {
@ -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 {
sk, find := findTrainTccGraphicDataHandler(tccGraphic, deviceId)
sk, find := findTrainTccGraphicDataKey(tccGraphic, deviceId)
if !find {
slog.Error("未找到对应的牵引制动手柄设备deviceId:", deviceId)
return nil
@ -408,42 +421,40 @@ func trainDoorModeChangeHandle(vobc *state_proto.TrainVobcState, tcc *state_prot
switch kl {
case request_proto.TrainControl_KL_END:
vobc.DoorModeMM = true
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AA, 1}})
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_MM, 1}})
case request_proto.TrainControl_KL_CENTER:
vobc.DoorModeAM = true
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AM, 1}})
case request_proto.TrainControl_KL_FONT:
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_MM, 1}})
msg = append(msg, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.DOOR_MODE_AA, 1}})
vobc.DoorModeAA = true
}
tcc.SwitchKeyMap[sk.Code].Val = request.Val
return msg
}
func trainTractionPower(speed int32, traction int64, handleVal int32) int32 {
//速度V可以通过初始速度 加上加速度a乘以时间t来计算即V=V1+at
acc := float32(math.Abs(float64(handleVal)) / 100 * DEFAULT_TRAIN_TRACTION_ACC)
resultSpeed := DEFAULT_TRAIN_STARTED_SPEED + acc
if speed > 0 {
resultSpeed = float32(speed)/3.6/100 + acc
}
// p=fv
p := float32(traction) * resultSpeed
if p >= TRAIN_MAX_TRACTION_POWER {
return TRAIN_MAX_TRACTION_POWER
}
return int32(p)
}
func trainBrakingOrTraction(trainLoad int64, handleVal int32, power float64) int64 {
func trainBraking(trainLoad int64, handleVal int32) int64 {
tl := trainLoad * 10 //列车初始化已经 * 100再*10 就是对应的kg
//F=ma 单位 F单位牛顿m单位千克a单位米/秒²
totalPower := float64(tl) * power / 1000
//DEFULAT_TRAIN_LOAD * 1000 * 0.97 / 1000
n := int64(math.Abs(float64(handleVal))/100*totalPower) * 100
totalPower := float64(tl) * DEFAULT_BRAKE_FORCE
n := int64(math.Abs(float64(handleVal)) / 100 * totalPower)
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 {
_, find := findTrainTccGraphicDataHandler(tccGraphic, deviceId)
@ -461,24 +472,23 @@ func trainControlHandle(speed int32, vobc *state_proto.TrainVobcState, tcc *stat
notBreak := byte(0)
var zeroState byte = 0
var brakeState byte = 0
var traction byte = 0
vobc.TractionPower = 0
//var traction byte = 0
if request.Val > 0 {
vobc.TractionStatus = true
vobc.TractionForce = trainBrakingOrTraction(vobc.TrainLoad, request.Val, DEFAULT_TRAIN_TRACTION_ACC)
vobc.TractionPower = trainTractionPower(speed, vobc.TractionForce, request.Val)
vobc.TractionForce = trainTractionPower(vobc.TrainLoad, request.Val, speed) / 1000 * 100
notBreak = 1
traction = 1
//traction = 1
} else if request.Val < 0 {
vobc.BrakingStatus = true
//vobc.BrakeForce = int64(math.Abs(float64(request.Val))/100*DEFAULT_BRAKE_FORCE) * 100
vobc.BrakeForce = trainBrakingOrTraction(vobc.TrainLoad, request.Val, DEFAULT_BRAKE_FORCE)
vobc.BrakeForce = trainBraking(vobc.TrainLoad, request.Val) / 1000 * 100
vobc.EmergencyBrakingStatus = false
jjzdBtn.Passed = false
brakeState = 1
} else {
zeroState = 1
brakeState = 1
}
if tcc.PushHandler == nil {
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.OUTER_EMERGENCY_BRAKE, 1}},*/
{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 {
@ -585,13 +595,51 @@ func (s *VerifySimulation) reportTrainMockInitMsg(train *state_proto.TrainState,
//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. 车载输出数字量信息报文内容
func (s *VerifySimulation) TrainPcSimDigitalOutInfoHandle(train *state_proto.TrainState, data []byte) {
/* slog.Info("开始接受atp输出模拟量==============")
for i, d := range data {
slog.Info(fmt.Sprintf("接受atp模拟量id:%v,data:%b", i, d))
slog.Info("开始接受atp输出模拟量==============")
for i, d := range data {
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])
vobc := train.VobcState
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.SleepBtn = message.IsTrueForByte(message.GetBit(d, 3)) //?休眠指令
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.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.AtoTractionCommand2 = message.IsTrueForByte(message.GetBit(d, 4)) //?ATO牵引指令2
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)) //跳跃指令
}