【区段增加关联站台属性】

This commit is contained in:
weizhihong 2023-12-29 17:58:39 +08:00
parent 27bd611893
commit 4f91be427e
13 changed files with 5484 additions and 960 deletions

View File

@ -159,6 +159,8 @@ type TrainRunStatus struct {
HeadPosition *DevicePosition // 车头位置 HeadPosition *DevicePosition // 车头位置
TailPosition *DevicePosition // 车尾位置 TailPosition *DevicePosition // 车尾位置
Hold bool // 扣车 Hold bool // 扣车
Skip bool // 跳停
Park bool // 停靠
} }
var TrainRunStatusType = ecs.NewComponentType[TrainRunStatus]() // 列车位置状态组件 var TrainRunStatusType = ecs.NewComponentType[TrainRunStatus]() // 列车位置状态组件

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.31.0 // protoc-gen-go v1.28.1
// protoc v4.23.1 // protoc v4.23.1
// source: component/ci.proto // source: component/ci.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.31.0 // protoc-gen-go v1.28.1
// protoc v4.23.1 // protoc v4.23.1
// source: component/common.proto // source: component/common.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.31.0 // protoc-gen-go v1.28.1
// protoc v4.23.1 // protoc v4.23.1
// source: component/psd.proto // source: component/psd.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.31.0 // protoc-gen-go v1.28.1
// protoc v4.23.1 // protoc v4.23.1
// source: component/signal.proto // source: component/signal.proto

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.31.0 // protoc-gen-go v1.28.1
// protoc v4.23.1 // protoc v4.23.1
// source: component/turnout.proto // source: component/turnout.proto

View File

@ -216,6 +216,8 @@ enum DeviceType {
DeviceType_Breakers = 21; DeviceType_Breakers = 21;
// //
DeviceType_PowerScreen = 22; DeviceType_PowerScreen = 22;
//
DeviceType_Route = 23;
//--------ISCS [300,500]------ //--------ISCS [300,500]------
//ISCS门磁 //ISCS门磁
@ -574,18 +576,24 @@ message Route {
PASS = 3; PASS = 3;
LONG_SHUNTING = 4; LONG_SHUNTING = 4;
} }
message TurnoutPosition {
string id = 1; // ID
bool normal = 2; //
}
string id = 1; string id = 1;
string name = 2; string name = 2;
// //
string startId = 3; string startId = 3;
// //
string destinationId = 4; string destinationId = 4;
// ID // ID
repeated string deviceIds = 5; repeated string deviceIds = 5;
// ID // ID
repeated string conflictingRouteIds = 6; repeated string conflictingRouteIds = 6;
// //
RouteType routeType = 7; RouteType routeType = 7;
//
repeated TurnoutPosition turnouts = 8;
} }
//////////////////////////ISCS/////////////////////////////////// //////////////////////////ISCS///////////////////////////////////

4061
repo/dto/cg_repo.pb.go Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,9 @@ type PhysicalSection struct {
//物理区段所属集中站 //物理区段所属集中站
centralizedStation string centralizedStation string
// 所属站台
platform *Platform
} }
func NewPhysicalSection(id string) *PhysicalSection { func NewPhysicalSection(id string) *PhysicalSection {
@ -188,6 +191,10 @@ func (s *PhysicalSection) LinkRanges() []*LinkRange {
return s.linkRanges return s.linkRanges
} }
func (p *PhysicalSection) Platform() *Platform {
return p.platform
}
type PhysicalSectionPort struct { type PhysicalSectionPort struct {
section *PhysicalSection section *PhysicalSection
port proto.Port port proto.Port

View File

@ -6,6 +6,7 @@ type Platform struct {
Identity Identity
code string code string
station *Station station *Station
section *PhysicalSection
} }
func NewPlatform(id string, code string) *Platform { func NewPlatform(id string, code string) *Platform {
@ -25,3 +26,7 @@ func (p *Platform) Code() string {
func (p *Platform) Station() *Station { func (p *Platform) Station() *Station {
return p.station return p.station
} }
func (p *Platform) Section() *PhysicalSection {
return p.section
}

55
repository/route.go Normal file
View File

@ -0,0 +1,55 @@
package repository
import "joylink.club/rtsssimulation/repository/model/proto"
type Route struct {
Identity
name string
routeType proto.Route_RouteType
start *Signal
destination *Signal
sections []*PhysicalSection
conflictingRoutes []*Route
turnoutPositions []*TurnoutPosition
}
func NewRoute(id string, name string, routeType proto.Route_RouteType) *Route {
return &Route{
Identity: identity{id, proto.DeviceType_DeviceType_Route},
name: name,
routeType: routeType,
}
}
func (s *Route) StartSignal() *Signal {
return s.start
}
func (s *Route) DestinationSignal() *Signal {
return s.destination
}
func (s *Route) Sections() []*PhysicalSection {
return s.sections
}
func (s *Route) ConflictingRoutes() []*Route {
return s.conflictingRoutes
}
func (s *Route) TurnoutPositions() []*TurnoutPosition {
return s.turnoutPositions
}
type TurnoutPosition struct {
turnout *Turnout
normal bool
}
func (s *TurnoutPosition) Turnout() *Turnout {
return s.turnout
}
func (s *TurnoutPosition) Position() bool {
return s.normal
}

View File

@ -5,6 +5,7 @@ import (
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/ecs/filter" "joylink.club/ecs/filter"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
) )
// 列车运行控制组件,给列车增加限制组件 // 列车运行控制组件,给列车增加限制组件
@ -29,5 +30,30 @@ func (sls *TrainRunControlSys) Update(w ecs.World) {
} else { } else {
runStatus.SpeedMax = component.TrainSpeedMax runStatus.SpeedMax = component.TrainSpeedMax
} }
// 检测扣车、跳停
worldData := entity.GetWorldData(w)
uid := component.UidType.Get(headDevice)
section := worldData.Repo.FindPhysicalSection(uid.Id)
platform := section.Platform()
if platform != nil { // 是站台轨
pe := worldData.EntityMap[platform.Id()]
// 扣车
runStatus.Hold = pe.HasComponent(component.PlatformHoldStatusType)
// 跳停
skip := pe.HasComponent(component.PlatformSkipStatusType)
if pe.HasComponent(component.PlatformSkipStatusType) {
st := component.PlatformSkipStatusType.Get(pe)
skip = st.AllSkip
if !skip {
for _, t := range st.Trains {
if t.Id() == e.Id() {
skip = true
break
}
}
}
}
runStatus.Skip = skip
}
}) })
} }