动力学列车数据配置

This commit is contained in:
tiger_zhou 2024-01-18 16:33:27 +08:00
parent 23157a4055
commit 118fe91900
9 changed files with 667 additions and 364 deletions

View File

@ -50,7 +50,7 @@ type TrainDynamicConfig struct {
Jump bool `protobuf:"varint,9,opt,name=jump,proto3" json:"jump,omitempty"`
// 打滑(%
Slip float32 `protobuf:"fixed32,10,opt,name=slip,proto3" json:"slip,omitempty"`
// 前溜/后溜mm)(正数前溜,负数后溜)
// 前溜/后溜m/s)(正数前溜,负数后溜)
Slide int32 `protobuf:"varint,11,opt,name=slide,proto3" json:"slide,omitempty"`
// 过标/欠标mm正数过标负数欠标
StopSign int32 `protobuf:"varint,12,opt,name=stopSign,proto3" json:"stopSign,omitempty"`
@ -183,8 +183,8 @@ type TrainEndsState struct {
SpeedSensorEnableB bool `protobuf:"varint,2,opt,name=speedSensorEnableB,proto3" json:"speedSensorEnableB,omitempty"`
// 雷达是否有效
RadarEnable bool `protobuf:"varint,3,opt,name=radarEnable,proto3" json:"radarEnable,omitempty"`
// 雷达测速数值
RadarCheckSpeed float32 `protobuf:"fixed32,4,opt,name=radarCheckSpeed,proto3" json:"radarCheckSpeed,omitempty"`
// 雷达测速差值(米/秒)
RadarCheckSpeedDiff float32 `protobuf:"fixed32,4,opt,name=radarCheckSpeedDiff,proto3" json:"radarCheckSpeedDiff,omitempty"`
// 雷达检测时间(秒)
RadarCheckTime int32 `protobuf:"varint,5,opt,name=radarCheckTime,proto3" json:"radarCheckTime,omitempty"`
}
@ -242,9 +242,9 @@ func (x *TrainEndsState) GetRadarEnable() bool {
return false
}
func (x *TrainEndsState) GetRadarCheckSpeed() float32 {
func (x *TrainEndsState) GetRadarCheckSpeedDiff() float32 {
if x != nil {
return x.RadarCheckSpeed
return x.RadarCheckSpeedDiff
}
return 0
}
@ -294,7 +294,7 @@ var file_common_data_proto_rawDesc = []byte{
0x52, 0x04, 0x73, 0x6c, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x6c, 0x69, 0x64, 0x65, 0x18,
0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x6c, 0x69, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08,
0x73, 0x74, 0x6f, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
0x73, 0x74, 0x6f, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x22, 0xe4, 0x01, 0x0a, 0x0e, 0x54, 0x72, 0x61,
0x73, 0x74, 0x6f, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x22, 0xec, 0x01, 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,
@ -303,16 +303,16 @@ var file_common_data_proto_rawDesc = []byte{
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, 0x28, 0x0a,
0x0f, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64,
0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x72, 0x61, 0x64, 0x61, 0x72, 0x43, 0x68, 0x65,
0x63, 0x6b, 0x53, 0x70, 0x65, 0x65, 0x64, 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, 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,
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, 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

@ -5058,8 +5058,8 @@ type Train struct {
TrainModel Train_TrainModel `protobuf:"varint,1,opt,name=trainModel,proto3,enum=graphicData.Train_TrainModel" json:"trainModel,omitempty"` // 车型
CarriageLength int32 `protobuf:"varint,2,opt,name=carriageLength,proto3" json:"carriageLength,omitempty"` // 列车车厢长度
TotalLength int32 `protobuf:"varint,3,opt,name=totalLength,proto3" json:"totalLength,omitempty"` // 总长度
MinDiameter int32 `protobuf:"varint,4,opt,name=minDiameter,proto3" json:"minDiameter,omitempty"` // 车轮的最小直径
MaxDiameter int32 `protobuf:"varint,5,opt,name=maxDiameter,proto3" json:"maxDiameter,omitempty"` // 车轮的最大直径
// int32 minDiameter = 4; // 车轮的最小直径
// int32 maxDiameter = 5; // 车轮的最大直径
TrainSets string `protobuf:"bytes,6,opt,name=trainSets,proto3" json:"trainSets,omitempty"` // 编组
DynamicConfig *common_proto.TrainDynamicConfig `protobuf:"bytes,7,opt,name=dynamicConfig,proto3" json:"dynamicConfig,omitempty"` //动力学参数
}
@ -5117,20 +5117,6 @@ func (x *Train) GetTotalLength() int32 {
return 0
}
func (x *Train) GetMinDiameter() int32 {
if x != nil {
return x.MinDiameter
}
return 0
}
func (x *Train) GetMaxDiameter() int32 {
if x != nil {
return x.MaxDiameter
}
return 0
}
func (x *Train) GetTrainSets() string {
if x != nil {
return x.TrainSets
@ -6121,7 +6107,7 @@ var file_stationLayoutGraphics_proto_rawDesc = []byte{
0x28, 0x0d, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x2e,
0x0a, 0x12, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x53, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x12, 0x63, 0x65, 0x6e, 0x74,
0x72, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xde,
0x72, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x64, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9a,
0x02, 0x0a, 0x05, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x12, 0x3d, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x69,
0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x67,
0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e,
@ -6131,33 +6117,29 @@ var file_stationLayoutGraphics_proto_rawDesc = []byte{
0x0e, 0x63, 0x61, 0x72, 0x72, 0x69, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12,
0x20, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74,
0x68, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x69, 0x6e, 0x44, 0x69, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72,
0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6d, 0x69, 0x6e, 0x44, 0x69, 0x61, 0x6d, 0x65,
0x74, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x44, 0x69, 0x61, 0x6d, 0x65, 0x74,
0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x6d, 0x61, 0x78, 0x44, 0x69, 0x61,
0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x65,
0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53,
0x65, 0x74, 0x73, 0x12, 0x40, 0x0a, 0x0d, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63,
0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0d, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x43,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x28, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x4d, 0x6f,
0x64, 0x65, 0x6c, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10,
0x01, 0x12, 0x05, 0x0a, 0x01, 0x43, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x44, 0x10, 0x03, 0x22,
0x49, 0x0a, 0x09, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x16, 0x0a, 0x06, 0x6f, 0x6c, 0x64, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09,
0x52, 0x06, 0x6f, 0x6c, 0x64, 0x69, 0x64, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18,
0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x03, 0x69, 0x64, 0x73, 0x2a, 0x1d, 0x0a, 0x09, 0x44, 0x69,
0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x06, 0x0a, 0x02, 0x55, 0x50, 0x10, 0x00, 0x12,
0x08, 0x0a, 0x04, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x01, 0x42, 0x69, 0x0a, 0x25, 0x63, 0x6c, 0x75,
0x62, 0x2e, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x62, 0x6a, 0x72, 0x74, 0x73, 0x73,
0x2e, 0x61, 0x74, 0x73, 0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x73, 0x42, 0x13, 0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69,
0x63, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x5a, 0x2b, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b,
0x2e, 0x63, 0x6c, 0x75, 0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x68, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x73, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x73, 0x12,
0x40, 0x0a, 0x0d, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x54, 0x72, 0x61, 0x69, 0x6e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x52, 0x0d, 0x64, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x67, 0x22, 0x28, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12,
0x05, 0x0a, 0x01, 0x41, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x01, 0x12, 0x05, 0x0a,
0x01, 0x43, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x44, 0x10, 0x03, 0x22, 0x49, 0x0a, 0x09, 0x4f,
0x74, 0x68, 0x65, 0x72, 0x4c, 0x69, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06,
0x6f, 0x6c, 0x64, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x6c,
0x64, 0x69, 0x64, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
0x0d, 0x52, 0x03, 0x69, 0x64, 0x73, 0x2a, 0x1d, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x06, 0x0a, 0x02, 0x55, 0x50, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x44,
0x4f, 0x57, 0x4e, 0x10, 0x01, 0x42, 0x69, 0x0a, 0x25, 0x63, 0x6c, 0x75, 0x62, 0x2e, 0x6a, 0x6f,
0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x62, 0x6a, 0x72, 0x74, 0x73, 0x73, 0x2e, 0x61, 0x74, 0x73,
0x2e, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x42, 0x13,
0x4c, 0x61, 0x79, 0x6f, 0x75, 0x74, 0x47, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x5a, 0x2b, 0x6a, 0x6f, 0x79, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x63, 0x6c, 0x75,
0x62, 0x2f, 0x62, 0x6a, 0x2d, 0x72, 0x74, 0x73, 0x74, 0x73, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65,
0x72, 0x2f, 0x64, 0x74, 0x6f, 0x2f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -95,7 +95,7 @@ type ConfigTrainEnds struct {
SpeedSensorEnableA bool `json:"speedSensorEnableA"` // 2端速度传感器是否有效
SpeedSensorEnableB bool `json:"speedSensorEnableB"` // 2端速度传感器是否有效
RadarEnable bool `json:"radarEnable"` // 雷达是否有效
RadarCheckSpeed float32 `json:"radarCheckSpeed"` // 雷达测速数值
RadarCheckSpeedDiff float32 `json:"radarCheckSpeed"` // 雷达测速数值
RadarCheckTime int32 `json:"radarCheckTime"` // 雷达检测时间(秒)
}
type ConfigTrainData struct {

File diff suppressed because it is too large Load Diff

View File

@ -22,8 +22,8 @@ type TrainInfoDto struct {
TrainModel int32 `json:"train_model" form:"train_model"`
CarriageLength int32 `json:"carriage_length" form:"carriage_length"`
TotalLength int32 `json:"total_length" form:"total_length"`
MinDiameter int32 `json:"min_diameter" form:"min_diameter"`
MaxDiameter int32 `json:"max_diameter" form:"max_diameter"`
//MinDiameter int32 `json:"min_diameter" form:"min_diameter"`
//MaxDiameter int32 `json:"max_diameter" form:"max_diameter"`
TrainSets string `json:"train_sets" form:"train_sets"`
Description string `json:"description" form:"description"`
TrainConfigData *ConfigTrainData `json:"trainConfigData" form:"trainConfigData"`
@ -58,8 +58,8 @@ func ConvertDtoFromTrain(t *PublishedDto) *TrainInfoDto {
TrainModel: int32(message.TrainModel),
CarriageLength: message.CarriageLength,
TotalLength: message.TotalLength,
MinDiameter: message.MinDiameter,
MaxDiameter: message.MaxDiameter,
//MinDiameter: message.MinDiameter,
//MaxDiameter: message.MaxDiameter,
TrainSets: message.TrainSets,
TrainConfigData: TrainConfigToDtoConvert(message.DynamicConfig),
}

View File

@ -3,6 +3,8 @@ package message_server
import (
"encoding/hex"
"fmt"
"joylink.club/bj-rtsts-server/dto/common_proto"
"reflect"
"strings"
"time"
@ -361,13 +363,44 @@ func convertTrainState(v *state_proto.TrainState) *state_proto.TrainMapState {
RightDoorCloseCommand: v.VobcState.RightDoorCloseCommand,
AllDoorClose: v.VobcState.AllDoorClose,
VobcInterruption: v.VobcState.UdpInterruption,
TrainDynamicConfig: v.TrainDynamicConfig,
TrainEndsA: v.TrainEndsA,
TrainEndsB: v.TrainEndsB,
TrainEndsA: convertEnds(v.TrainEndsA),
TrainEndsB: convertEnds(v.TrainEndsB),
}
trainConfig := &state_proto.TrainDynamicConfigMqtt{}
convertDynamicConfig(v.TrainDynamicConfig, trainConfig)
t.TrainDynamicConfig = trainConfig
return t
}
func convertDynamicConfig(config *common_proto.TrainDynamicConfig, dest *state_proto.TrainDynamicConfigMqtt) {
configType := reflect.TypeOf(config).Elem()
for index := 0; index < configType.NumField(); index++ {
field := configType.Field(index)
if field.IsExported() {
fieldName := field.Name
destVal := reflect.ValueOf(dest).Elem().FieldByName(fieldName)
sourceData := reflect.ValueOf(config).Elem().FieldByName(fieldName).Interface()
if destVal.Kind() == reflect.String {
destVal.Set(reflect.ValueOf(fmt.Sprintf("%v", sourceData)))
} else {
destVal.Set(reflect.ValueOf(sourceData))
}
}
}
}
func convertEnds(ends *common_proto.TrainEndsState) *state_proto.TrainEndsStateMqtt {
return &state_proto.TrainEndsStateMqtt{SpeedSensorEnableA: ends.SpeedSensorEnableA,
SpeedSensorEnableB: ends.SpeedSensorEnableB,
RadarEnable: ends.RadarEnable,
RadarCheckSpeedDiff: floatToString(ends.RadarCheckSpeedDiff),
RadarCheckTime: ends.RadarCheckTime}
}
func floatToString(f float32) string {
return fmt.Sprintf("%v", f)
}
// 收集道岔状态
func collectTurnoutStates(sim *memory.VerifySimulation, mapId int32) ([]*state_proto.SwitchState, error) {
uidMap := memory.QueryMapUidMapByType(mapId, &data_proto.Turnout{})

View File

@ -82,8 +82,8 @@ func convertTrainDtoToProto(t *dto.TrainInfoDto) []byte {
TrainModel: data_proto.Train_TrainModel(t.TrainModel),
CarriageLength: t.CarriageLength,
TotalLength: t.TotalLength,
MinDiameter: t.MinDiameter,
MaxDiameter: t.MaxDiameter,
//MinDiameter: t.MinDiameter,
//MaxDiameter: t.MaxDiameter,
TrainSets: t.TrainSets,
DynamicConfig: TrainConfigToProtoConvert(t.TrainConfigData),
}

View File

@ -8,7 +8,7 @@ type InitTrainInfo struct {
Speed uint16 `json:"speed"`
Up bool `json:"up"`
//TrainLength uint32 `json:"trainLength"`
TrainOperationConfig *TrainOperationConfig `json:"TrainOperationConfig"`
TrainOperationConfig *TrainOperationConfig `json:"trainOperationConfig"`
}
// 移除列车请求参数

View File

@ -21,10 +21,6 @@ import (
"joylink.club/bj-rtsts-server/dto/state_proto"
)
func DtoTrainEndsToStateProto(ends dto.ConfigTrainEnds) *common_proto.TrainEndsState {
return &common_proto.TrainEndsState{SpeedSensorEnableA: ends.SpeedSensorEnableA, SpeedSensorEnableB: ends.SpeedSensorEnableB,
RadarEnable: ends.RadarEnable, RadarCheckSpeed: ends.RadarCheckSpeed, RadarCheckTime: ends.RadarCheckTime}
}
func CreateMsgTrainConfig(trainId int, trainLen int64, configTrainData dto.ConfigTrainData) *message.TrainOperationConfig {
return &message.TrainOperationConfig{TrainIndex: trainId, Length: int(trainLen),
BaseResistanceParamA: configTrainData.BaseResistanceParamA, BaseResistanceParamB: configTrainData.BaseResistanceParamB,
@ -203,7 +199,7 @@ func copyTrainEnds(trainState *state_proto.TrainState, fieldName string, configD
endsVal.SpeedSensorEnableA = configData.SpeedSensorEnableA
endsVal.SpeedSensorEnableB = configData.SpeedSensorEnableB
endsVal.RadarEnable = configData.RadarEnable
endsVal.RadarCheckSpeed = configData.RadarCheckSpeed
endsVal.RadarCheckSpeedDiff = configData.RadarCheckSpeedDiff
endsVal.RadarCheckTime = configData.RadarCheckTime
}
func UpdateConfigTrain(vs *VerifySimulation, ct *dto.ConfigTrainReqDto) {
@ -217,25 +213,8 @@ func UpdateConfigTrain(vs *VerifySimulation, ct *dto.ConfigTrainReqDto) {
panic(sys_error.New(fmt.Sprintf("列车参数修改断言:列车【%s】不存在", ct.TrainId)))
}
createOrUpdateStateDynamicConfig(trainState, ct.ConfigData, ct.TrainEndsA, ct.TrainEndsB)
/* if trainState.TrainDynamicConfig == nil {
trainState.TrainDynamicConfig = &state_proto.TrainDynamicConfig{}
}*/
/*trainState.TrainDynamicConfig.BaseResistanceParamA = ct.ConfigData.BaseResistanceParamA
trainState.TrainDynamicConfig.BaseResistanceParamB = ct.ConfigData.BaseResistanceParamB
trainState.TrainDynamicConfig.BaseResistanceParamC = ct.ConfigData.BaseResistanceParamC
trainState.TrainDynamicConfig.CurveResistanceParamR1 = ct.ConfigData.CurveResistanceParamR1
trainState.TrainDynamicConfig.CurveResistanceParamR2 = ct.ConfigData.CurveResistanceParamR2
trainState.TrainDynamicConfig.CurveResistanceParamR3 = ct.ConfigData.CurveResistanceParamR3
trainState.TrainDynamicConfig.CurveResistanceParamR4 = ct.ConfigData.CurveResistanceParamR4
trainState.TrainDynamicConfig.Jump = ct.ConfigData.Jump
trainState.TrainDynamicConfig.Slip = ct.ConfigData.Slip
trainState.TrainDynamicConfig.Slide = ct.ConfigData.Slide
trainState.TrainDynamicConfig.StopSign = ct.ConfigData.StopSign*/
trainState.TrainLength = ct.Length
trainState.WheelDiameter = ct.WheelDiameter
//copyTrainEnds(trainState.TrainDynamicConfig, "TrainEndsA", ct.ConfigData.TrainEndsA)
//copyTrainEnds(trainState.TrainDynamicConfig, "TrainEndsB", ct.ConfigData.TrainEndsB)
//requestDynamicConfig(ct)
}