【proto增加进路结构】
This commit is contained in:
parent
c9e89e2b02
commit
27bd611893
@ -47,15 +47,6 @@ type OccupiedStatus struct {
|
||||
|
||||
var OccupiedStatusType = ecs.NewComponentType[OccupiedStatus]() // 占用状态组件
|
||||
|
||||
// 位置:目标位置、占用位置
|
||||
type DevicePosition struct {
|
||||
Device *ecs.Entry // 设备
|
||||
Offset int64 // 在设备上的相对a位置偏移
|
||||
Direction bool // 从a到b为true;从b到a为false
|
||||
}
|
||||
|
||||
var DevicePositionType = ecs.NewComponentType[DevicePosition]()
|
||||
|
||||
// 进路锁闭状态
|
||||
type RouteLock struct {
|
||||
Route *ecs.Entry
|
||||
@ -92,27 +83,27 @@ type ClosedStatus struct {
|
||||
var ClosedStatusType = ecs.NewComponentType[ClosedStatus]() // 关闭状态组件
|
||||
|
||||
// 站台跳停状态
|
||||
type StandSkipStatus struct {
|
||||
type PlatformSkipStatus struct {
|
||||
AllSkip bool // 全部跳停
|
||||
Trains []*ecs.Entry // 跳停列车
|
||||
}
|
||||
|
||||
var StandSkipStatusType = ecs.NewComponentType[StandSkipStatus]() // 站台跳停状态
|
||||
var PlatformSkipStatusType = ecs.NewComponentType[PlatformSkipStatus]() // 站台跳停状态
|
||||
|
||||
// 站台停靠发车状态
|
||||
type StandParkStatus struct {
|
||||
type PlatformParkStatus struct {
|
||||
Park bool // 列车停靠状态
|
||||
ParkTime time.Duration // 停靠时间
|
||||
Depart bool // 列车发车状态
|
||||
}
|
||||
|
||||
var StandParkStatusType = ecs.NewComponentType[StandParkStatus]() // 站台停靠发车状态
|
||||
var PlatformParkStatusType = ecs.NewComponentType[PlatformParkStatus]() // 站台停靠发车状态
|
||||
|
||||
// 扣车状态
|
||||
type StandHoldStatus struct {
|
||||
type PlatformHoldStatus struct {
|
||||
}
|
||||
|
||||
var StandHoldStatusType = ecs.NewComponentType[StandHoldStatus]() // 扣车状态组件
|
||||
var PlatformHoldStatusType = ecs.NewComponentType[PlatformHoldStatus]() // 扣车状态组件
|
||||
|
||||
// 信号机状态
|
||||
type SignalStatus struct {
|
||||
@ -131,7 +122,47 @@ type RouteStatus struct {
|
||||
|
||||
var RouteStatusType = ecs.NewComponentType[RouteStatus]() // 进路状态组件
|
||||
|
||||
var (
|
||||
StandTag = ecs.NewTag() // 站台标签
|
||||
SectionTag = ecs.NewTag() // 区段标签
|
||||
// 列车运行级别
|
||||
type TrainRunLevel uint8
|
||||
|
||||
const (
|
||||
TrainRunLevel_CBTC TrainRunLevel = iota // cbtc级别
|
||||
TrainRunLevel_ITC // 点式通信
|
||||
TrainRunLevel_IL // 联锁级
|
||||
)
|
||||
|
||||
// 列车运行模式
|
||||
type DriveMode uint8
|
||||
|
||||
const (
|
||||
DriveMode_AM DriveMode = iota // 列车自动驾驶模式
|
||||
DriveMode_CM // ATP防护下的人工驾驶模式
|
||||
DriveMode_RM // 限制人工驾驶模式
|
||||
DriveMode_NRM // 无限制人工驾驶模式
|
||||
)
|
||||
|
||||
// 位置:目标位置、占用位置
|
||||
type DevicePosition struct {
|
||||
Device *ecs.Entry // 设备
|
||||
Offset int64 // 在设备上的相对a位置偏移
|
||||
Direction bool // 从a到b为true;从b到a为false
|
||||
}
|
||||
|
||||
var DevicePositionType = ecs.NewComponentType[DevicePosition]()
|
||||
|
||||
// 列车运行状态
|
||||
type TrainRunStatus struct {
|
||||
RunLevel TrainRunLevel // 列车运行级别
|
||||
DriveMode DriveMode // 驾驶模式
|
||||
Speed float32 // 运行速度
|
||||
SpeedMax float32 // 最大速度
|
||||
HeadPosition *DevicePosition // 车头位置
|
||||
TailPosition *DevicePosition // 车尾位置
|
||||
Hold bool // 扣车
|
||||
}
|
||||
|
||||
var TrainRunStatusType = ecs.NewComponentType[TrainRunStatus]() // 列车位置状态组件
|
||||
|
||||
var (
|
||||
TrainSpeedMax float32 = 80 / 3.6
|
||||
)
|
||||
|
@ -27,6 +27,7 @@ message Repository {
|
||||
string mainCoordinateSystem = 20;
|
||||
repeated Key Keys = 21;
|
||||
repeated CentralizedStationRef CentralizedStationRefs = 22;
|
||||
repeated Route routes = 23;
|
||||
//ISCS 编号[300,500]
|
||||
//ISCS管线
|
||||
repeated Pipe pipes = 300;
|
||||
@ -501,10 +502,16 @@ message Mkx {
|
||||
}
|
||||
//站台
|
||||
message Platform {
|
||||
enum PlatformDirection {
|
||||
Unknown = 0;
|
||||
Up = 1; // 上行
|
||||
Down = 2; // 下行
|
||||
}
|
||||
string id = 1;
|
||||
string code = 2;
|
||||
string stationId = 3;
|
||||
string physicalSectionId = 4;
|
||||
PlatformDirection direction = 5;
|
||||
}
|
||||
|
||||
// 报警器
|
||||
@ -558,6 +565,29 @@ message CiSectionCodePoint{
|
||||
string sectionId = 2;//物理区段id
|
||||
}
|
||||
|
||||
// 进路信息
|
||||
message Route {
|
||||
enum RouteType {
|
||||
RECEIVING = 0;
|
||||
DEPARTURE = 1;
|
||||
SHUNTING = 2;
|
||||
PASS = 3;
|
||||
LONG_SHUNTING = 4;
|
||||
}
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
// 开始信号机
|
||||
string startId = 3;
|
||||
// 目的信号机
|
||||
string destinationId = 4;
|
||||
// 关联设备ID
|
||||
repeated string deviceIds = 5;
|
||||
// 敌对进路ID
|
||||
repeated string conflictingRouteIds = 6;
|
||||
// 进路类型
|
||||
RouteType routeType = 7;
|
||||
}
|
||||
|
||||
//////////////////////////ISCS///////////////////////////////////
|
||||
|
||||
|
||||
@ -737,3 +767,4 @@ message GasEnvironment{
|
||||
string id = 1;
|
||||
string code = 2;
|
||||
}
|
||||
|
||||
|
33
sys/cbtc_sys/train_run_control.go
Normal file
33
sys/cbtc_sys/train_run_control.go
Normal file
@ -0,0 +1,33 @@
|
||||
package cbtc_sys
|
||||
|
||||
import (
|
||||
"github.com/yohamta/donburi"
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
)
|
||||
|
||||
// 列车运行控制组件,给列车增加限制组件
|
||||
type TrainRunControlSys struct {
|
||||
trainQuery *ecs.Query
|
||||
}
|
||||
|
||||
func NewTrainRunControlSys() *TrainRunControlSys {
|
||||
return &TrainRunControlSys{
|
||||
trainQuery: ecs.NewQuery(filter.Contains(component.TrainRunStatusType)),
|
||||
}
|
||||
}
|
||||
|
||||
func (sls *TrainRunControlSys) Update(w ecs.World) {
|
||||
sls.trainQuery.Each(w, func(e *donburi.Entry) {
|
||||
runStatus := component.TrainRunStatusType.Get(e)
|
||||
headDevice := runStatus.HeadPosition.Device
|
||||
// 限速赋值
|
||||
if headDevice.HasComponent(component.SpeedLimitType) { // 车头所在设备有限速组件
|
||||
speedLimit := component.SpeedLimitType.Get(headDevice)
|
||||
runStatus.SpeedMax = speedLimit.Val
|
||||
} else {
|
||||
runStatus.SpeedMax = component.TrainSpeedMax
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user