动力学初始化停车点数据

This commit is contained in:
tiger_zhou 2024-09-29 09:33:00 +08:00
parent 2463edd996
commit 76183883da
6 changed files with 25 additions and 15 deletions

@ -1 +1 @@
Subproject commit ef7ff5459cde3eced121d1908b192ee586a47c97
Subproject commit 150aa24307c42916cde8f6fbe629c9d100be8737

View File

@ -18,11 +18,16 @@ type RemoveTrainReq struct {
// LineBaseInfo 线路基础信息,提供给动力学作为计算依据
type LineBaseInfo struct {
LinkList []*Link `json:"linkList"`
SlopeList []*Slope `json:"slopeList"`
CurveList []*Curve `json:"curveList"`
LinkList []*Link `json:"linkList"`
SlopeList []*Slope `json:"slopeList"`
CurveList []*Curve `json:"curveList"`
StopPosition []*StopPosition `json:"stopPositionList"`
}
type StopPosition struct {
Id int32 `json:"id"`
LinkId int32 `json:"linkId"`
LinkOffset int32 `json:"linkOffset"`
}
type Link struct {
ID int32 `json:"id"`
//长度 mm

View File

@ -206,10 +206,13 @@ func (d *trainPcSimService) trainPluseCountReset(pc *state_proto.SensorSpeedPuls
}
func (d *trainPcSimService) newCloseAllConn() {
trains := d.trainPcSimManage.GetConnTrain2()
for _, train := range trains {
d.CreateOrRemoveTrain(train, false)
if d.trainPcSimManage != nil {
trains := d.trainPcSimManage.GetConnTrain2()
for _, train := range trains {
d.CreateOrRemoveTrain(train, false)
}
}
}
func (d *trainPcSimService) newCloseConn(clientKey string) {

View File

@ -309,6 +309,7 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
sta.ControlDelayTime = (int64(sta.VobcState.LifeSignal)-int64(info.VobcLifeSignal))*20 + delayTime
//slog.Debug("收到动力学原始消息", "Number", info.Number, "Link", info.Link, "LinkOffset", info.LinkOffset)
//slog.Info("收到动力学原始速度信息", "速度:", info.Speed, "加速度:", info.Acceleration, "位移:", info.Displacement)
inLinkId, inLinkOffset := strconv.Itoa(int(info.Link)), int64(info.LinkOffset)
outLinkId, id, port, outLinkOffset, offset, kilometer, e1 := CalcInitializeLink(vs, inLinkId, inLinkOffset, info.Up)
@ -338,7 +339,7 @@ func UpdateTrainStateByDynamics(vs *VerifySimulation, trainId string, info *mess
//slog.Debug("车尾位置", tailDeviceId, "偏移", tailDeviceOffset, "所在设备端", tailDevicePort)
// 修改world中的列车位置
slog.Debug("处理动力学转换后的消息", "number", info.Number, "up", info.Up, "Link", info.Link, "车头位置", id, "偏移", offset, "车尾位置:", tailDeviceId, "车尾偏移:", tailOffset, "车头linkOffset", outLinkOffset, "车位linkOffset", tailLinkOffset)
//slog.Debug("处理动力学转换后的消息", "number", info.Number, "up", info.Up, "Link", info.Link, "车头位置", id, "偏移", offset, "车尾位置:", tailDeviceId, "车尾偏移:", tailOffset, "车头linkOffset", outLinkOffset, "车位linkOffset", tailLinkOffset)
handleTrainPositionFromDynamic(vs, info, sta, outLinkId, outLinkOffset, tailLinkId, tailLinkOffset)
//修改列车激活方向
updateTrainActiveDirFromDynamic(vs, info, sta, id, port, trainHeadActUp)

View File

@ -372,6 +372,13 @@ func (s *VerifySimulation) GetDynamicsRunRepository() *message.LineBaseInfo {
endLinkId, _ := strconv.Atoi(model.EndLinkPosition().Link().Id())
curve.EndLinkId = int32(endLinkId)
}
for _, sp := range s.Repo.StopPosition {
id, _ := strconv.Atoi(sp.Id())
linkId, _ := strconv.Atoi(sp.LinkPosition().Link().Id())
linkOffset := sp.LinkPosition().Offset()
d := &message.StopPosition{Id: int32(id), LinkId: int32(linkId), LinkOffset: int32(linkOffset)}
info.StopPosition = append(info.StopPosition, d)
}
return info
}

View File

@ -632,7 +632,6 @@ func (s *VerifySimulation) reportTrainMockInitMsg2(driverActive, initConn bool,
tce := make([]message.TrainPcSimBaseMessage, 0)
connErr := false
state := message.GetBit(data1, 3)
//slog.Info(fmt.Sprintf("act:%v ,t1:%v ,a1 :%v,t2:%v,a2:%v,init:%v,ts:%v", act, train.VobcState.Tc1Active, tcc.ActiveTrainA, train.VobcState.Tc2Active, tcc.ActiveTrainB, initConn, initTimeStamp), aport)
if message.GetBit(data3, 3) == 0 {
actt := byte(0)
@ -671,11 +670,6 @@ func (s *VerifySimulation) reportTrainMockInitMsg2(driverActive, initConn bool,
tce = append(tce, message.TrainPcSimBaseMessage{Type: message.SENDER_TRAIN_OUTR_INFO, Data: []byte{message.OUTER_EMERGENCY_BRAKE, state}})
initData := s.ObtainTrainDigitalMockDataForStatus(train)
tce = append(tce, initData...)
/* if trainClientPort == state_proto.TrainState_PORT_A {
tcc.ActiveTrainA = true
} else if trainClientPort == state_proto.TrainState_PORT_A {
tcc.ActiveTrainB = true
}*/
initConn = false
}
}