列车动力学添加车组,仿真内添加列车添加车组

This commit is contained in:
tiger_zhou 2024-10-15 09:16:34 +08:00
parent 150aa24307
commit 2f7e505437
4 changed files with 764 additions and 746 deletions

View File

@ -88,6 +88,7 @@ message StopPosition{
Kilometer km = 4;
string sectionId = 5; //
DevicePort turnoutPort = 6; //
uint32 coachNum = 7;//
}
//
message SignalLayout {

File diff suppressed because it is too large Load Diff

View File

@ -68,9 +68,9 @@ func buildModels(source *proto.Repository, repository *Repository) error {
repository.stationMap[m.Id()] = m
}
for _, sp := range source.StopPosition {
calibrationKilometer(sp.Km, repository)
//calibrationKilometer(sp.Km, repository)
tid := strconv.Itoa(int(sp.Id))
t := NewStopPosition(tid, sp.Km)
t := NewStopPosition(tid, sp.Km, sp.CoachNum)
repository.StopPosition[tid] = t
}
for _, protoData := range source.PhysicalSections {
@ -1043,6 +1043,9 @@ func relateDevicesAndLink(repo *Repository, link *Link, startKm *proto.Kilometer
if visitedModelMap[device.Id()] {
continue
}
if device.Id() == "508" {
fmt.Println("aaaaaaaaaaaaaaaaa")
}
linkPositionDevice, ok := device.(LinkPositionDevice)
if !ok {
return fmt.Errorf("device [%s:%s] not implements LinkPositionDevice", device.Id(), device.Type().String())

View File

@ -9,12 +9,13 @@ type StopPosition struct {
dir proto.Platform_Direction
km *proto.Kilometer
linkPosition LinkPosition
coachNum uint32
}
func NewStopPosition(id string, km *proto.Kilometer) *StopPosition {
func NewStopPosition(id string, km *proto.Kilometer, coachNum uint32) *StopPosition {
return &StopPosition{
Identity: identity{id, proto.DeviceType_deviceType_Stop_position},
km: km,
km: km, coachNum: coachNum,
}
}
func (t *StopPosition) bindLinkPosition(position LinkPosition) {
@ -23,3 +24,6 @@ func (t *StopPosition) bindLinkPosition(position LinkPosition) {
func (t *StopPosition) LinkPosition() LinkPosition {
return t.linkPosition
}
func (t *StopPosition) CoachNum() int32 {
return int32(t.coachNum)
}