列车动力学添加车组,仿真内添加列车添加车组
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m51s
Details
local-test分支打包构建docker并发布运行 / Docker-Build (push) Successful in 1m51s
Details
This commit is contained in:
parent
c6fe82c7e6
commit
27322532e0
|
@ -263,6 +263,7 @@ func addTrain(c *gin.Context) {
|
||||||
WheelDiameter: req.WheelDiameter,
|
WheelDiameter: req.WheelDiameter,
|
||||||
Speed: req.TrainSpeed,
|
Speed: req.TrainSpeed,
|
||||||
Show: true,
|
Show: true,
|
||||||
|
TrainCoachNum: req.TrainCoachNum,
|
||||||
ConnState: &state_proto.TrainConnState{TrainControlMapId: req.TrainControlMapId, Conn: false, ConnType: state_proto.TrainConnState_NONE},
|
ConnState: &state_proto.TrainConnState{TrainControlMapId: req.TrainControlMapId, Conn: false, ConnType: state_proto.TrainConnState_NONE},
|
||||||
}
|
}
|
||||||
var err *sys_error.BusinessError = memory.AddTrainStateNew(simulation,
|
var err *sys_error.BusinessError = memory.AddTrainStateNew(simulation,
|
||||||
|
|
|
@ -77,6 +77,7 @@ type AddTrainReqDtoNew struct {
|
||||||
TrainMaxAcc float32 `json:"trainMaxAcc" from:"trainMaxAcc"`
|
TrainMaxAcc float32 `json:"trainMaxAcc" from:"trainMaxAcc"`
|
||||||
TrainMaxBrake float32 `json:"trainMaxBrake" from:"trainMaxBrake"`
|
TrainMaxBrake float32 `json:"trainMaxBrake" from:"trainMaxBrake"`
|
||||||
TrainEmergencyBrake float32 `json:"trainEmergencyBrake" from:"trainEmergencyBrake"`
|
TrainEmergencyBrake float32 `json:"trainEmergencyBrake" from:"trainEmergencyBrake"`
|
||||||
|
TrainCoachNum uint32 `json:"trainCoachNum" from:"trainCoachNum"`
|
||||||
// 场景ID
|
// 场景ID
|
||||||
MapId int32 `json:"mapId" from:"mapId"`
|
MapId int32 `json:"mapId" from:"mapId"`
|
||||||
WheelDiameter int32 `json:"wheelDiameter" from:"wheelDiameter"`
|
WheelDiameter int32 `json:"wheelDiameter" from:"wheelDiameter"`
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1 +1 @@
|
||||||
Subproject commit 150aa24307c42916cde8f6fbe629c9d100be8737
|
Subproject commit 2f7e5054376d2e22b28807c4dd10b3a46b01b2b4
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5b0baec461fba33bcb76212ce2b1a19d1b79057f
|
Subproject commit a6293366a132680309a62855d4c4e19546ba3aa8
|
|
@ -142,7 +142,7 @@ func (d *dynamics) requestStartSimulation(base *message.LineBaseInfo) error {
|
||||||
}
|
}
|
||||||
url := d.buildUrl("/api/start/")
|
url := d.buildUrl("/api/start/")
|
||||||
data, _ := json.Marshal(base)
|
data, _ := json.Marshal(base)
|
||||||
//fmt.Println(string(data))
|
slog.Info(string(data))
|
||||||
resp, err := d.httpClient.Post(url, "application/json", bytes.NewBuffer(data))
|
resp, err := d.httpClient.Post(url, "application/json", bytes.NewBuffer(data))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sys_error.New("动力学开始仿真请求发送错误", err)
|
return sys_error.New("动力学开始仿真请求发送错误", err)
|
||||||
|
|
|
@ -9,6 +9,7 @@ type InitTrainInfo struct {
|
||||||
Up bool `json:"up"`
|
Up bool `json:"up"`
|
||||||
//TrainLength uint32 `json:"trainLength"`
|
//TrainLength uint32 `json:"trainLength"`
|
||||||
TrainOperationConfig *TrainOperationConfig `json:"config"`
|
TrainOperationConfig *TrainOperationConfig `json:"config"`
|
||||||
|
TrainCoachNum uint32 `json:"coachNum"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// 移除列车请求参数
|
// 移除列车请求参数
|
||||||
|
@ -27,6 +28,7 @@ type StopPosition struct {
|
||||||
Id int32 `json:"id"`
|
Id int32 `json:"id"`
|
||||||
LinkId int32 `json:"linkId"`
|
LinkId int32 `json:"linkId"`
|
||||||
LinkOffset int32 `json:"linkOffset"`
|
LinkOffset int32 `json:"linkOffset"`
|
||||||
|
CoachNum int32 `json:"coachNum"`
|
||||||
}
|
}
|
||||||
type Link struct {
|
type Link struct {
|
||||||
ID int32 `json:"id"`
|
ID int32 `json:"id"`
|
||||||
|
|
|
@ -118,6 +118,7 @@ func AddTrainStateNew(vs *VerifySimulation, status *state_proto.TrainState, conf
|
||||||
LinkOffset: uint32(loffset),
|
LinkOffset: uint32(loffset),
|
||||||
Speed: status.Speed / 3.6,
|
Speed: status.Speed / 3.6,
|
||||||
Up: status.Up,
|
Up: status.Up,
|
||||||
|
TrainCoachNum: status.TrainCoachNum,
|
||||||
TrainOperationConfig: CreateMsgTrainConfig(int(trainIndex), status.TrainLength, configTrainData),
|
TrainOperationConfig: CreateMsgTrainConfig(int(trainIndex), status.TrainLength, configTrainData),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -320,7 +321,7 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
|
||||||
//pointTO 指的是是否ab,或是否到岔心
|
//pointTO 指的是是否ab,或是否到岔心
|
||||||
_, pointTo := QueryDirectionAndABByDevice(vs.Repo, id, port, info.Up)
|
_, pointTo := QueryDirectionAndABByDevice(vs.Repo, id, port, info.Up)
|
||||||
|
|
||||||
//slog.Debug("处理动力学转换后的消息", "number", info.Number, "up", info.Up, "Link", info.Link, "车头位置", id, "偏移", offset, "是否上行", true, "是否ab", pointTo, "t1Dir:", info.TrainActToMax, "t2Dir:", info.TrainActToMin)
|
slog.Info("处理动力学转换后的消息", "number", info.Number, "up", info.Up, "Link", info.Link, "link位置", info.LinkOffset, "outlink位置", outLinkOffset, "车头位置", id, "偏移", offset, "是否上行", true, "是否ab", pointTo, "t1Dir:", info.TrainActToMax, "t2Dir:", info.TrainActToMin)
|
||||||
trainHeadActUp := true
|
trainHeadActUp := true
|
||||||
if info.TrainActToMax || info.TrainActToMin {
|
if info.TrainActToMax || info.TrainActToMin {
|
||||||
if info.TrainActToMin {
|
if info.TrainActToMin {
|
||||||
|
|
|
@ -376,7 +376,7 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
|
||||||
id, _ := strconv.Atoi(sp.Id())
|
id, _ := strconv.Atoi(sp.Id())
|
||||||
linkId, _ := strconv.Atoi(sp.LinkPosition().Link().Id())
|
linkId, _ := strconv.Atoi(sp.LinkPosition().Link().Id())
|
||||||
linkOffset := sp.LinkPosition().Offset()
|
linkOffset := sp.LinkPosition().Offset()
|
||||||
d := &message.StopPosition{Id: int32(id), LinkId: int32(linkId), LinkOffset: int32(linkOffset)}
|
d := &message.StopPosition{Id: int32(id), LinkId: int32(linkId), LinkOffset: int32(linkOffset), CoachNum: sp.CoachNum()}
|
||||||
info.StopPosition = append(info.StopPosition, d)
|
info.StopPosition = append(info.StopPosition, d)
|
||||||
}
|
}
|
||||||
return info
|
return info
|
||||||
|
@ -472,13 +472,14 @@ func (s *VerifySimulation) CollectInterlockRelayInfo(code string) *message.Inter
|
||||||
// 获取列车可用连接半实物类型
|
// 获取列车可用连接半实物类型
|
||||||
func (s *VerifySimulation) FindTrainConnTypes() []dto.TrainConnTypeConfigDto {
|
func (s *VerifySimulation) FindTrainConnTypes() []dto.TrainConnTypeConfigDto {
|
||||||
typeConfig := make([]dto.TrainConnTypeConfigDto, 0)
|
typeConfig := make([]dto.TrainConnTypeConfigDto, 0)
|
||||||
if /*s.runConfig.Vobc.Open &&*/ s.runConfig.Vobc.Ip != "" {
|
if /*s.runConfig.Vobc.Open &&*/ s.runConfig.Vobc.Ip != "" && s.runConfig.Vobc.Open {
|
||||||
typeConfig = append(typeConfig, dto.TrainConnTypeConfigDto{TypeName: "半实物vobc", ConnType: state_proto.TrainConnState_VOBC})
|
typeConfig = append(typeConfig, dto.TrainConnTypeConfigDto{TypeName: "半实物vobc", ConnType: state_proto.TrainConnState_VOBC})
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, pcSim := range s.runConfig.PcSimConfigs {
|
for _, pcSim := range s.runConfig.PcSimConfigs {
|
||||||
|
if pcSim.Open {
|
||||||
typeConfig = append(typeConfig, dto.TrainConnTypeConfigDto{TypeName: pcSim.ConfigName, ConnType: state_proto.TrainConnState_PC_SIM})
|
typeConfig = append(typeConfig, dto.TrainConnTypeConfigDto{TypeName: pcSim.ConfigName, ConnType: state_proto.TrainConnState_PC_SIM})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* if s.runConfig.PcSimConfig.Open {
|
/* if s.runConfig.PcSimConfig.Open {
|
||||||
typeConfig = append(typeConfig, dto.TrainConnTypeConfigDto{ConnType: state_proto.TrainConnState_PC_SIM})
|
typeConfig = append(typeConfig, dto.TrainConnTypeConfigDto{ConnType: state_proto.TrainConnState_PC_SIM})
|
||||||
|
@ -1129,7 +1130,15 @@ func fillProtoRepository(repo *proto.Repository, storage *data_proto.RtssGraphic
|
||||||
for _, sp := range storage.StopPositions {
|
for _, sp := range storage.StopPositions {
|
||||||
id := GetMapElementId(sp.Common)
|
id := GetMapElementId(sp.Common)
|
||||||
psp := &proto.StopPosition{Id: id, Km: convertKm(sp.KilometerSystem)}
|
psp := &proto.StopPosition{Id: id, Km: convertKm(sp.KilometerSystem)}
|
||||||
|
var coachNum uint32 = 4
|
||||||
|
if sp.CoachNum == data_proto.StopPosition_Six {
|
||||||
|
coachNum = 6
|
||||||
|
} else if sp.CoachNum == data_proto.StopPosition_Four {
|
||||||
|
coachNum = 4
|
||||||
|
} else if sp.CoachNum == data_proto.StopPosition_Eight {
|
||||||
|
coachNum = 8
|
||||||
|
}
|
||||||
|
psp.CoachNum = coachNum
|
||||||
switch sp.GetRefDev().DeviceType {
|
switch sp.GetRefDev().DeviceType {
|
||||||
case data_proto.RelatedRef_Section:
|
case data_proto.RelatedRef_Section:
|
||||||
psp.SectionId = uidsMap.PhysicalSectionIds[sp.GetRefDev().Id].Uid
|
psp.SectionId = uidsMap.PhysicalSectionIds[sp.GetRefDev().Id].Uid
|
||||||
|
|
|
@ -530,7 +530,7 @@ func trainAtoControlTractionAndBrake(train *state_proto.TrainState) {
|
||||||
|
|
||||||
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.NOT_BREAK, notBreak}},
|
{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.NOT_BREAK, notBreak}},
|
||||||
}
|
}
|
||||||
slog.Info(fmt.Sprintf("列车 id:%v,ato:%v,AtoLevle:%v,牵引:%v,制动:%v,牵引力:%v,制动力%v", train.Id, vs.Ato, vs.AtoStepLevel, vs.AtoTractionCommandOut, vs.AtoBrakeCommand, vs.TractionForce, vs.BrakeForce))
|
//slog.Info(fmt.Sprintf("列车 id:%v,ato:%v,AtoLevle:%v,牵引:%v,制动:%v,牵引力:%v,制动力%v", train.Id, vs.Ato, vs.AtoStepLevel, vs.AtoTractionCommandOut, vs.AtoBrakeCommand, vs.TractionForce, vs.BrakeForce))
|
||||||
train_pc_sim.Default().SendTrainControlMsg2(train, msg, train.TrainPort)
|
train_pc_sim.Default().SendTrainControlMsg2(train, msg, train.TrainPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue