【区段增加关联站台属性】
This commit is contained in:
parent
27bd611893
commit
4f91be427e
@ -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]() // 列车位置状态组件
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
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
@ -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
|
||||||
|
@ -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
55
repository/route.go
Normal 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
|
||||||
|
}
|
@ -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
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user