[新增]增加GJ继电器相关逻辑

This commit is contained in:
thesai 2024-05-13 13:17:16 +08:00
parent 8ccd46aa6c
commit 90003ec942
13 changed files with 325 additions and 204 deletions

View File

@ -0,0 +1,11 @@
package component
import "joylink.club/ecs"
var (
TrackCircuitType = ecs.NewComponentType[TrackCircuit]()
)
type TrackCircuit struct {
GJ *ecs.Entry
}

View File

@ -13,7 +13,7 @@ var CkmBaseComponentTypes = []ecs.IComponentType{component.UidType, component.Ck
func LoadCkm(w ecs.World) error {
data := GetWorldData(w)
for _, ckm := range data.Repo.CkmList() {
ckmEntry := buildBaseEntry(w, ckm, data)
ckmEntry := newCkmEntry(w, ckm, data)
addCkmCircuit(w, ckm, ckmEntry, data)
}
for _, psl := range data.Repo.CkmPslList() {
@ -24,7 +24,7 @@ func LoadCkm(w ecs.World) error {
}
// 构建基础镜像
func buildBaseEntry(w ecs.World, ckm *repository.Ckm, data *component.WorldData) *donburi.Entry {
func newCkmEntry(w ecs.World, ckm *repository.Ckm, data *component.WorldData) *donburi.Entry {
//创建基础entry
entry := w.Entry(w.Create(CkmBaseComponentTypes...))
component.UidType.SetValue(entry, component.Uid{Id: ckm.Id()})

View File

@ -56,5 +56,10 @@ func Load(w ecs.World, repo *repository.Repository) error {
if err != nil {
return err
}
//加载轨道电路
err = LoadTrackCircuit(w)
if err != nil {
return err
}
return err
}

51
entity/track_circuit.go Normal file
View File

@ -0,0 +1,51 @@
package entity
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/repository"
"unsafe"
)
var TrackCircuitBaseComponentTypeArr = []ecs.IComponentType{component.UidType, component.TrackCircuitType}
func LoadTrackCircuit(w ecs.World) error {
data := GetWorldData(w)
for _, trackCircuit := range data.Repo.PhysicalSectionList() {
isAxleSection, err := trackCircuit.IsAxleSection()
if isAxleSection || err != nil {
continue
}
trackCircuitEntry := newTrackCircuitEntry(w, trackCircuit, data)
addTrackCircuit(w, trackCircuit, trackCircuitEntry, data)
}
return nil
}
func newTrackCircuitEntry(w ecs.World, section *repository.PhysicalSection, data *component.WorldData) *ecs.Entry {
uid := section.Id()
entry, ok := data.EntityMap[uid]
if !ok {
entry = w.Entry(w.Create(TrackCircuitBaseComponentTypeArr...))
component.UidType.SetValue(entry, component.Uid{Id: uid})
data.EntityMap[uid] = entry
}
return entry
}
func addTrackCircuit(w ecs.World, circuit *repository.PhysicalSection, entry *ecs.Entry, data *component.WorldData) {
if len(circuit.ComponentGroups()) == 0 {
return
}
trackCircuit := component.TrackCircuit{}
entry.AddComponent(component.TrackCircuitType, unsafe.Pointer(&trackCircuit))
for _, group := range circuit.ComponentGroups() {
for _, ec := range group.Components() {
relay := ec.(*repository.Relay)
switch ec.Code() {
case "GJ":
trackCircuit.GJ = NewRelayEntity(w, relay, data.EntityMap)
}
}
}
}

View File

@ -225,6 +225,7 @@ enum DeviceType {
DeviceType_Ckm = 24; //
DeviceType_Xcj = 25; //
DeviceType_CkmPsl = 26; //PSL
DeviceType_TrackCircuit = 27; //
//--------ISCS [300,500]------
//ISCS门磁

View File

@ -54,6 +54,7 @@ const (
DeviceType_DeviceType_Ckm DeviceType = 24 //车库门
DeviceType_DeviceType_Xcj DeviceType = 25 //洗车机
DeviceType_DeviceType_CkmPsl DeviceType = 26 //车库门PSL
DeviceType_DeviceType_TrackCircuit DeviceType = 27 //轨道电路
// ISCS门磁
DeviceType_DeviceType_DoorSensor DeviceType = 323
// ISCS进闸机
@ -224,6 +225,7 @@ var (
24: "DeviceType_Ckm",
25: "DeviceType_Xcj",
26: "DeviceType_CkmPsl",
27: "DeviceType_TrackCircuit",
323: "DeviceType_DoorSensor",
324: "DeviceType_EntranceGate",
325: "DeviceType_ExitGate",
@ -322,6 +324,7 @@ var (
"DeviceType_Ckm": 24,
"DeviceType_Xcj": 25,
"DeviceType_CkmPsl": 26,
"DeviceType_TrackCircuit": 27,
"DeviceType_DoorSensor": 323,
"DeviceType_EntranceGate": 324,
"DeviceType_ExitGate": 325,
@ -6236,7 +6239,7 @@ var file_model_proto_rawDesc = []byte{
0x52, 0x19, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70,
0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x6e,
0x75, 0x6d, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d,
0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0xc0, 0x16,
0x52, 0x0b, 0x6e, 0x75, 0x6d, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0xdd, 0x16,
0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x6e, 0x6b, 0x6e, 0x6f,
0x77, 0x6e, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
@ -6279,156 +6282,158 @@ var file_model_proto_rawDesc = []byte{
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x6b, 0x6d, 0x10, 0x18, 0x12, 0x12, 0x0a,
0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x58, 0x63, 0x6a, 0x10,
0x19, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x43, 0x6b, 0x6d, 0x50, 0x73, 0x6c, 0x10, 0x1a, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x44, 0x6f, 0x6f, 0x72, 0x53, 0x65, 0x6e, 0x73, 0x6f,
0x72, 0x10, 0xc3, 0x02, 0x12, 0x1c, 0x0a, 0x17, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x45, 0x6e, 0x74, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x47, 0x61, 0x74, 0x65, 0x10,
0xc4, 0x02, 0x12, 0x18, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x5f, 0x45, 0x78, 0x69, 0x74, 0x47, 0x61, 0x74, 0x65, 0x10, 0xc5, 0x02, 0x12, 0x1a, 0x0a, 0x15,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x77, 0x6f, 0x57, 0x61,
0x79, 0x47, 0x61, 0x74, 0x65, 0x10, 0xc6, 0x02, 0x12, 0x24, 0x0a, 0x1f, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x56, 0x65, 0x6e,
0x64, 0x69, 0x6e, 0x67, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x10, 0xc7, 0x02, 0x12, 0x25,
0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x6d,
0x69, 0x41, 0x75, 0x74, 0x6f, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69,
0x6e, 0x65, 0x10, 0xc8, 0x02, 0x12, 0x25, 0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x5f, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x69,
0x6e, 0x67, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x10, 0xc9, 0x02, 0x12, 0x1a, 0x0a, 0x15,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x69, 0x72, 0x43, 0x75,
0x72, 0x74, 0x61, 0x69, 0x6e, 0x10, 0xca, 0x02, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x68, 0x69, 0x6c, 0x6c, 0x65, 0x72, 0x55, 0x6e,
0x69, 0x74, 0x10, 0xcb, 0x02, 0x12, 0x20, 0x0a, 0x1b, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x5f, 0x43, 0x69, 0x76, 0x69, 0x6c, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x73, 0x65,
0x44, 0x6f, 0x6f, 0x72, 0x10, 0xcc, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x10,
0xcd, 0x02, 0x12, 0x18, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x5f, 0x45, 0x6c, 0x65, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x10, 0xce, 0x02, 0x12, 0x21, 0x0a, 0x1c,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x6d, 0x65, 0x72, 0x67,
0x65, 0x6e, 0x63, 0x79, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x69, 0x6e, 0x67, 0x10, 0xcf, 0x02, 0x12,
0x13, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x61,
0x6e, 0x10, 0xd0, 0x02, 0x12, 0x1e, 0x0a, 0x19, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x41, 0x69, 0x72, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x65,
0x72, 0x10, 0xd1, 0x02, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x10, 0xd2, 0x02,
0x12, 0x20, 0x0a, 0x1b, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c,
0x69, 0x67, 0x68, 0x74, 0x69, 0x6e, 0x67, 0x47, 0x75, 0x69, 0x64, 0x61, 0x6e, 0x63, 0x65, 0x10,
0xd3, 0x02, 0x12, 0x23, 0x0a, 0x1e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x5f, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x47, 0x75, 0x69, 0x64,
0x61, 0x6e, 0x63, 0x65, 0x10, 0xd4, 0x02, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x47,
0x75, 0x69, 0x64, 0x61, 0x6e, 0x63, 0x65, 0x10, 0xd5, 0x02, 0x12, 0x22, 0x0a, 0x1d, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x47,
0x61, 0x74, 0x65, 0x47, 0x75, 0x69, 0x64, 0x61, 0x6e, 0x63, 0x65, 0x10, 0xd6, 0x02, 0x12, 0x29,
0x0a, 0x24, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x61, 0x63, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x75,
0x69, 0x64, 0x61, 0x6e, 0x63, 0x65, 0x10, 0xd7, 0x02, 0x12, 0x1d, 0x0a, 0x18, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x53,
0x77, 0x69, 0x74, 0x63, 0x68, 0x10, 0xd8, 0x02, 0x12, 0x1d, 0x0a, 0x18, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x6c, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
0x6c, 0x6c, 0x65, 0x72, 0x10, 0xd9, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x57, 0x61, 0x74, 0x65, 0x72, 0x50, 0x75, 0x6d, 0x70, 0x10,
0xda, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x5f, 0x57, 0x61, 0x74, 0x65, 0x72, 0x54, 0x61, 0x6e, 0x6b, 0x10, 0xdb, 0x02, 0x12, 0x22, 0x0a,
0x1d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x75, 0x72, 0x69,
0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x10, 0xdc,
0x02, 0x12, 0x18, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x54, 0x68, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x10, 0xdd, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x4f, 0x32, 0x53, 0x65, 0x6e,
0x73, 0x6f, 0x72, 0x10, 0xde, 0x02, 0x12, 0x1c, 0x0a, 0x17, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x5f, 0x57, 0x61, 0x74, 0x65, 0x72, 0x54, 0x53, 0x65, 0x6e, 0x73, 0x6f,
0x72, 0x10, 0xdf, 0x02, 0x12, 0x1e, 0x0a, 0x19, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x50, 0x72, 0x65, 0x73, 0x73, 0x75, 0x72, 0x65, 0x53, 0x65, 0x6e, 0x73, 0x6f,
0x72, 0x10, 0xe0, 0x02, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x10, 0xe1, 0x02,
0x12, 0x21, 0x0a, 0x1c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54,
0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72,
0x10, 0xe2, 0x02, 0x12, 0x1c, 0x0a, 0x17, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
0x65, 0x5f, 0x43, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x77, 0x65, 0x72, 0x10, 0xe4,
0x43, 0x6b, 0x6d, 0x50, 0x73, 0x6c, 0x10, 0x1a, 0x12, 0x1b, 0x0a, 0x17, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x43, 0x69, 0x72, 0x63,
0x75, 0x69, 0x74, 0x10, 0x1b, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x5f, 0x44, 0x6f, 0x6f, 0x72, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x10, 0xc3,
0x02, 0x12, 0x1c, 0x0a, 0x17, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x45, 0x6e, 0x74, 0x72, 0x61, 0x6e, 0x63, 0x65, 0x47, 0x61, 0x74, 0x65, 0x10, 0xc4, 0x02, 0x12,
0x18, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x78,
0x69, 0x74, 0x47, 0x61, 0x74, 0x65, 0x10, 0xc5, 0x02, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x77, 0x6f, 0x57, 0x61, 0x79, 0x47, 0x61,
0x74, 0x65, 0x10, 0xc6, 0x02, 0x12, 0x24, 0x0a, 0x1f, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x5f, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x56, 0x65, 0x6e, 0x64, 0x69, 0x6e,
0x67, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x10, 0xc7, 0x02, 0x12, 0x25, 0x0a, 0x20, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x6d, 0x69, 0x41, 0x75,
0x74, 0x6f, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x10,
0xc8, 0x02, 0x12, 0x25, 0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x5f, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x4d,
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x10, 0xc9, 0x02, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x69, 0x72, 0x43, 0x75, 0x72, 0x74, 0x61,
0x69, 0x6e, 0x10, 0xca, 0x02, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x5f, 0x43, 0x68, 0x69, 0x6c, 0x6c, 0x65, 0x72, 0x55, 0x6e, 0x69, 0x74, 0x10,
0xcb, 0x02, 0x12, 0x20, 0x0a, 0x1b, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x5f, 0x43, 0x69, 0x76, 0x69, 0x6c, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x73, 0x65, 0x44, 0x6f, 0x6f,
0x72, 0x10, 0xcc, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x45, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x10, 0xcd, 0x02, 0x12,
0x18, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x6c,
0x65, 0x76, 0x61, 0x74, 0x6f, 0x72, 0x10, 0xce, 0x02, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x6d, 0x65, 0x72, 0x67, 0x65, 0x6e, 0x63,
0x79, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x69, 0x6e, 0x67, 0x10, 0xcf, 0x02, 0x12, 0x13, 0x0a, 0x0e,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x61, 0x6e, 0x10, 0xd0,
0x02, 0x12, 0x1e, 0x0a, 0x19, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x57, 0x61, 0x74, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x10, 0xe5,
0x02, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x48, 0x6f, 0x73, 0x74, 0x10, 0xe6, 0x02, 0x12, 0x1d,
0x0a, 0x18, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x6d, 0x6f,
0x6b, 0x65, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x10, 0xe7, 0x02, 0x12, 0x23, 0x0a,
0x1e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x65, 0x6d, 0x70,
0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x10,
0xe8, 0x02, 0x12, 0x25, 0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x5f, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x46, 0x69, 0x72, 0x65, 0x41, 0x6c, 0x61, 0x72, 0x6d,
0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x10, 0xe9, 0x02, 0x12, 0x23, 0x0a, 0x1e, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x47, 0x61, 0x73, 0x46, 0x69, 0x72, 0x65, 0x45,
0x78, 0x74, 0x69, 0x6e, 0x67, 0x75, 0x69, 0x73, 0x68, 0x65, 0x72, 0x10, 0xea, 0x02, 0x12, 0x19,
0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x6c, 0x61,
0x72, 0x6d, 0x42, 0x65, 0x6c, 0x6c, 0x10, 0xeb, 0x02, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x69, 0x72, 0x65, 0x52, 0x6f, 0x6c, 0x6c,
0x65, 0x72, 0x53, 0x68, 0x75, 0x74, 0x74, 0x65, 0x72, 0x10, 0xec, 0x02, 0x12, 0x16, 0x0a, 0x11,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x61, 0x73, 0x41, 0x63,
0x73, 0x10, 0xed, 0x02, 0x12, 0x16, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x46, 0x61, 0x73, 0x41, 0x66, 0x63, 0x10, 0xee, 0x02, 0x12, 0x22, 0x0a, 0x1d,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4e, 0x6f, 0x6e, 0x46, 0x69,
0x72, 0x65, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0xef, 0x02,
0x12, 0x22, 0x0a, 0x1d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x57,
0x61, 0x74, 0x65, 0x72, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f,
0x72, 0x10, 0xf0, 0x02, 0x12, 0x1f, 0x0a, 0x1a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x50, 0x75, 0x6d, 0x70, 0x53, 0x74, 0x61, 0x72, 0x74, 0x42, 0x75, 0x74, 0x74,
0x6f, 0x6e, 0x10, 0xf1, 0x02, 0x12, 0x27, 0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x5f, 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53,
0x65, 0x6e, 0x73, 0x69, 0x6e, 0x67, 0x43, 0x61, 0x62, 0x6c, 0x65, 0x10, 0xf2, 0x02, 0x12, 0x1a,
0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x69, 0x72,
0x65, 0x44, 0x61, 0x6d, 0x70, 0x65, 0x72, 0x10, 0xf3, 0x02, 0x12, 0x27, 0x0a, 0x22, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x69,
0x63, 0x53, 0x6d, 0x6f, 0x6b, 0x65, 0x46, 0x69, 0x72, 0x65, 0x44, 0x61, 0x6d, 0x70, 0x65, 0x72,
0x10, 0xf4, 0x02, 0x12, 0x29, 0x0a, 0x24, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
0x65, 0x5f, 0x46, 0x69, 0x72, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x6e, 0x65,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x10, 0xf5, 0x02, 0x12, 0x19,
0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x6c, 0x6f,
0x6f, 0x64, 0x47, 0x61, 0x74, 0x65, 0x10, 0xf6, 0x02, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x57, 0x69, 0x72, 0x65, 0x43, 0x61, 0x62, 0x69,
0x6e, 0x65, 0x74, 0x10, 0xf7, 0x02, 0x12, 0x1e, 0x0a, 0x19, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x42, 0x72, 0x65, 0x61,
0x6b, 0x65, 0x72, 0x10, 0xf8, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x5f, 0x52, 0x65, 0x63, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0xf9,
0x41, 0x69, 0x72, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x10, 0xd1,
0x02, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x46, 0x6c, 0x6f, 0x77, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x10, 0xd2, 0x02, 0x12, 0x20, 0x0a,
0x1b, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x67, 0x68,
0x74, 0x69, 0x6e, 0x67, 0x47, 0x75, 0x69, 0x64, 0x61, 0x6e, 0x63, 0x65, 0x10, 0xd3, 0x02, 0x12,
0x23, 0x0a, 0x1e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x6f,
0x77, 0x65, 0x72, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x47, 0x75, 0x69, 0x64, 0x61, 0x6e, 0x63,
0x65, 0x10, 0xd4, 0x02, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x45, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x74, 0x6f, 0x72, 0x47, 0x75, 0x69, 0x64,
0x61, 0x6e, 0x63, 0x65, 0x10, 0xd5, 0x02, 0x12, 0x22, 0x0a, 0x1d, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x47, 0x61, 0x74, 0x65,
0x47, 0x75, 0x69, 0x64, 0x61, 0x6e, 0x63, 0x65, 0x10, 0xd6, 0x02, 0x12, 0x29, 0x0a, 0x24, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x45, 0x76, 0x61, 0x63, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x75, 0x69, 0x64, 0x61,
0x6e, 0x63, 0x65, 0x10, 0xd7, 0x02, 0x12, 0x1d, 0x0a, 0x18, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x5f, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x53, 0x77, 0x69, 0x74,
0x63, 0x68, 0x10, 0xd8, 0x02, 0x12, 0x1d, 0x0a, 0x18, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x5f, 0x50, 0x6c, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65,
0x72, 0x10, 0xd9, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x70, 0x65, 0x5f, 0x57, 0x61, 0x74, 0x65, 0x72, 0x50, 0x75, 0x6d, 0x70, 0x10, 0xda, 0x02, 0x12,
0x19, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x57, 0x61,
0x74, 0x65, 0x72, 0x54, 0x61, 0x6e, 0x6b, 0x10, 0xdb, 0x02, 0x12, 0x22, 0x0a, 0x1d, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x75, 0x72, 0x69, 0x66, 0x69, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x10, 0xdc, 0x02, 0x12, 0x18,
0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x68, 0x53,
0x65, 0x6e, 0x73, 0x6f, 0x72, 0x10, 0xdd, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x4f, 0x32, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72,
0x10, 0xde, 0x02, 0x12, 0x1c, 0x0a, 0x17, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
0x65, 0x5f, 0x57, 0x61, 0x74, 0x65, 0x72, 0x54, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x10, 0xdf,
0x02, 0x12, 0x1e, 0x0a, 0x19, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x48, 0x61, 0x6e, 0x64, 0x63, 0x61, 0x72, 0x74, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x10, 0xfa,
0x02, 0x12, 0x22, 0x0a, 0x1d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x56, 0x6f, 0x6c, 0x74, 0x61, 0x67, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d,
0x65, 0x72, 0x10, 0xfb, 0x02, 0x12, 0x23, 0x0a, 0x1e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x5f, 0x54, 0x68, 0x72, 0x65, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x10, 0xfc, 0x02, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69,
0x6e, 0x67, 0x41, 0x72, 0x72, 0x65, 0x73, 0x74, 0x65, 0x72, 0x10, 0xfd, 0x02, 0x12, 0x1c, 0x0a,
0x17, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x44, 0x69, 0x73, 0x63,
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x10, 0xfe, 0x02, 0x12, 0x14, 0x0a, 0x0f, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x69, 0x70, 0x65, 0x10, 0xff,
0x02, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x50, 0x69, 0x70, 0x65, 0x46, 0x69, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x10, 0x80, 0x03, 0x12, 0x1b,
0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x6f, 0x77,
0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0x81, 0x03, 0x12, 0x1e, 0x0a, 0x19, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x61, 0x72, 0x74, 0x68, 0x69,
0x6e, 0x67, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x10, 0x82, 0x03, 0x12, 0x1b, 0x0a, 0x16, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x69, 0x72, 0x50, 0x61, 0x76,
0x69, 0x6c, 0x69, 0x6f, 0x6e, 0x10, 0x83, 0x03, 0x12, 0x15, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x56, 0x61, 0x6c, 0x76, 0x65, 0x10, 0x84, 0x03, 0x12,
0x20, 0x0a, 0x1b, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x47, 0x61,
0x73, 0x4d, 0x69, 0x78, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x85,
0x03, 0x12, 0x29, 0x0a, 0x24, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x43, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x69, 0x72, 0x43, 0x6f,
0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x10, 0x86, 0x03, 0x12, 0x25, 0x0a, 0x20,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x69, 0x72, 0x50, 0x75,
0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x10, 0x87, 0x03, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
0x65, 0x5f, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x88, 0x03,
0x2a, 0x2c, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65,
0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02,
0x12, 0x05, 0x0a, 0x01, 0x43, 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01, 0x44, 0x10, 0x04, 0x2a, 0x20,
0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c,
0x45, 0x46, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47, 0x48, 0x54, 0x10, 0x01,
0x2a, 0x43, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79,
0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x10, 0x00,
0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x10,
0x01, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4a, 0x6f,
0x69, 0x6e, 0x74, 0x10, 0x02, 0x42, 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73,
0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x50, 0x72, 0x65, 0x73, 0x73, 0x75, 0x72, 0x65, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x10, 0xe0,
0x02, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x46, 0x6c, 0x6f, 0x77, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x10, 0xe1, 0x02, 0x12, 0x21, 0x0a,
0x1c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x65, 0x6d, 0x70,
0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x10, 0xe2, 0x02,
0x12, 0x1c, 0x0a, 0x17, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43,
0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x54, 0x6f, 0x77, 0x65, 0x72, 0x10, 0xe4, 0x02, 0x12, 0x1e,
0x0a, 0x19, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x57, 0x61, 0x74,
0x65, 0x72, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x6f, 0x72, 0x10, 0xe5, 0x02, 0x12, 0x1b,
0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4e, 0x65, 0x74,
0x77, 0x6f, 0x72, 0x6b, 0x48, 0x6f, 0x73, 0x74, 0x10, 0xe6, 0x02, 0x12, 0x1d, 0x0a, 0x18, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x6d, 0x6f, 0x6b, 0x65, 0x44,
0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x10, 0xe7, 0x02, 0x12, 0x23, 0x0a, 0x1e, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61,
0x74, 0x75, 0x72, 0x65, 0x44, 0x65, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x10, 0xe8, 0x02, 0x12,
0x25, 0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4d, 0x61,
0x6e, 0x75, 0x61, 0x6c, 0x46, 0x69, 0x72, 0x65, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x42, 0x75, 0x74,
0x74, 0x6f, 0x6e, 0x10, 0xe9, 0x02, 0x12, 0x23, 0x0a, 0x1e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x5f, 0x47, 0x61, 0x73, 0x46, 0x69, 0x72, 0x65, 0x45, 0x78, 0x74, 0x69,
0x6e, 0x67, 0x75, 0x69, 0x73, 0x68, 0x65, 0x72, 0x10, 0xea, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x42,
0x65, 0x6c, 0x6c, 0x10, 0xeb, 0x02, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x69, 0x72, 0x65, 0x52, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x53,
0x68, 0x75, 0x74, 0x74, 0x65, 0x72, 0x10, 0xec, 0x02, 0x12, 0x16, 0x0a, 0x11, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x61, 0x73, 0x41, 0x63, 0x73, 0x10, 0xed,
0x02, 0x12, 0x16, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x46, 0x61, 0x73, 0x41, 0x66, 0x63, 0x10, 0xee, 0x02, 0x12, 0x22, 0x0a, 0x1d, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4e, 0x6f, 0x6e, 0x46, 0x69, 0x72, 0x65, 0x50,
0x6f, 0x77, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0xef, 0x02, 0x12, 0x22, 0x0a,
0x1d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x57, 0x61, 0x74, 0x65,
0x72, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x10, 0xf0,
0x02, 0x12, 0x1f, 0x0a, 0x1a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x50, 0x75, 0x6d, 0x70, 0x53, 0x74, 0x61, 0x72, 0x74, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x10,
0xf1, 0x02, 0x12, 0x27, 0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x5f, 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x53, 0x65, 0x6e, 0x73,
0x69, 0x6e, 0x67, 0x43, 0x61, 0x62, 0x6c, 0x65, 0x10, 0xf2, 0x02, 0x12, 0x1a, 0x0a, 0x15, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x69, 0x72, 0x65, 0x44, 0x61,
0x6d, 0x70, 0x65, 0x72, 0x10, 0xf3, 0x02, 0x12, 0x27, 0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x69, 0x63, 0x53, 0x6d,
0x6f, 0x6b, 0x65, 0x46, 0x69, 0x72, 0x65, 0x44, 0x61, 0x6d, 0x70, 0x65, 0x72, 0x10, 0xf4, 0x02,
0x12, 0x29, 0x0a, 0x24, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46,
0x69, 0x72, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x10, 0xf5, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x46, 0x6c, 0x6f, 0x6f, 0x64, 0x47,
0x61, 0x74, 0x65, 0x10, 0xf6, 0x02, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x54, 0x79, 0x70, 0x65, 0x5f, 0x57, 0x69, 0x72, 0x65, 0x43, 0x61, 0x62, 0x69, 0x6e, 0x65, 0x74,
0x10, 0xf7, 0x02, 0x12, 0x1e, 0x0a, 0x19, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
0x65, 0x5f, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x65, 0x72,
0x10, 0xf8, 0x02, 0x12, 0x19, 0x0a, 0x14, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
0x65, 0x5f, 0x52, 0x65, 0x63, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x10, 0xf9, 0x02, 0x12, 0x1e,
0x0a, 0x19, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x48, 0x61, 0x6e,
0x64, 0x63, 0x61, 0x72, 0x74, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x10, 0xfa, 0x02, 0x12, 0x22,
0x0a, 0x1d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x56, 0x6f, 0x6c,
0x74, 0x61, 0x67, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x10,
0xfb, 0x02, 0x12, 0x23, 0x0a, 0x1e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x5f, 0x54, 0x68, 0x72, 0x65, 0x65, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x77,
0x69, 0x74, 0x63, 0x68, 0x10, 0xfc, 0x02, 0x12, 0x21, 0x0a, 0x1c, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x41,
0x72, 0x72, 0x65, 0x73, 0x74, 0x65, 0x72, 0x10, 0xfd, 0x02, 0x12, 0x1c, 0x0a, 0x17, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x6e, 0x6e,
0x65, 0x63, 0x74, 0x6f, 0x72, 0x10, 0xfe, 0x02, 0x12, 0x14, 0x0a, 0x0f, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x69, 0x70, 0x65, 0x10, 0xff, 0x02, 0x12, 0x1b,
0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x69, 0x70,
0x65, 0x46, 0x69, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x10, 0x80, 0x03, 0x12, 0x1b, 0x0a, 0x16, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x53,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0x81, 0x03, 0x12, 0x1e, 0x0a, 0x19, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x61, 0x72, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x10, 0x82, 0x03, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x69, 0x72, 0x50, 0x61, 0x76, 0x69, 0x6c, 0x69,
0x6f, 0x6e, 0x10, 0x83, 0x03, 0x12, 0x15, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
0x79, 0x70, 0x65, 0x5f, 0x56, 0x61, 0x6c, 0x76, 0x65, 0x10, 0x84, 0x03, 0x12, 0x20, 0x0a, 0x1b,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x47, 0x61, 0x73, 0x4d, 0x69,
0x78, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x61, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x85, 0x03, 0x12, 0x29,
0x0a, 0x24, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x6f, 0x6d,
0x62, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x69, 0x72, 0x43, 0x6f, 0x6e, 0x64, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x10, 0x86, 0x03, 0x12, 0x25, 0x0a, 0x20, 0x44, 0x65, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x69, 0x72, 0x50, 0x75, 0x72, 0x69, 0x66,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x10, 0x87, 0x03,
0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45,
0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x88, 0x03, 0x2a, 0x2c, 0x0a,
0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12,
0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x12, 0x05, 0x0a,
0x01, 0x43, 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01, 0x44, 0x10, 0x04, 0x2a, 0x20, 0x0a, 0x09, 0x44,
0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x45, 0x46, 0x54,
0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47, 0x48, 0x54, 0x10, 0x01, 0x2a, 0x43, 0x0a,
0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12,
0x0c, 0x0a, 0x08, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x10, 0x00, 0x12, 0x0f, 0x0a,
0x0b, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x10, 0x01, 0x12, 0x12,
0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x69, 0x6e, 0x74,
0x10, 0x02, 0x42, 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f,
0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -7,7 +7,7 @@ import (
"joylink.club/rtsssimulation/util/number"
)
// 物理区段
// PhysicalSection 物理区段
type PhysicalSection struct {
Identity
@ -38,6 +38,13 @@ type PhysicalSection struct {
// 所属站台
platform *Platform
//电子元件
componentGroups []*ElectronicComponentGroup
}
func (p *PhysicalSection) ComponentGroups() []*ElectronicComponentGroup {
return p.componentGroups
}
func NewPhysicalSection(id string) *PhysicalSection {
@ -54,44 +61,44 @@ func (p *PhysicalSection) bindLinkRange(link *Link, one int64, two int64) {
})
}
func (s *PhysicalSection) PortNum() int {
func (p *PhysicalSection) PortNum() int {
return 2
}
func (s *PhysicalSection) ALinkPosition() *LinkPosition {
return s.aLinkPosition
func (p *PhysicalSection) ALinkPosition() *LinkPosition {
return p.aLinkPosition
}
func (s *PhysicalSection) BLinkPosition() *LinkPosition {
return s.bLinkPosition
func (p *PhysicalSection) BLinkPosition() *LinkPosition {
return p.bLinkPosition
}
func (s *PhysicalSection) ARelation() DevicePort {
return s.aRelation
func (p *PhysicalSection) ARelation() DevicePort {
return p.aRelation
}
func (s *PhysicalSection) BRelation() DevicePort {
return s.bRelation
func (p *PhysicalSection) BRelation() DevicePort {
return p.bRelation
}
func (s *PhysicalSection) AKilometer() *proto.Kilometer {
return s.aKm
func (p *PhysicalSection) AKilometer() *proto.Kilometer {
return p.aKm
}
func (s *PhysicalSection) BKilometer() *proto.Kilometer {
return s.bKm
func (p *PhysicalSection) BKilometer() *proto.Kilometer {
return p.bKm
}
// IsAxleSection 判断是否为计轴区段
func (s *PhysicalSection) IsAxleSection() (bool, error) {
if len(s.checkPoints) > 0 {
func (p *PhysicalSection) IsAxleSection() (bool, error) {
if len(p.checkPoints) > 0 {
axleCount := 0
for _, cp := range s.checkPoints {
for _, cp := range p.checkPoints {
if cp.pointType == proto.CheckPointType_AxleCounter {
axleCount++
}
}
if axleCount == len(s.checkPoints) {
if axleCount == len(p.checkPoints) {
return true, nil
} else if axleCount == 0 {
return false, nil
@ -102,10 +109,10 @@ func (s *PhysicalSection) IsAxleSection() (bool, error) {
return false, fmt.Errorf("物理区段没有检测点")
}
}
func (s *PhysicalSection) CentralizedStation() string {
return s.centralizedStation
func (p *PhysicalSection) CentralizedStation() string {
return p.centralizedStation
}
func (s *PhysicalSection) bindDevicePort(port proto.Port, devicePort DevicePort) error {
func (p *PhysicalSection) bindDevicePort(port proto.Port, devicePort DevicePort) error {
_, isSectionPort := devicePort.(*PhysicalSectionPort)
_, isTurnoutPort := devicePort.(*TurnoutPort)
if !isSectionPort && !isTurnoutPort {
@ -113,9 +120,9 @@ func (s *PhysicalSection) bindDevicePort(port proto.Port, devicePort DevicePort)
}
switch port {
case proto.Port_A:
s.aRelation = devicePort
p.aRelation = devicePort
case proto.Port_B:
s.bRelation = devicePort
p.bRelation = devicePort
default:
return fmt.Errorf("物理区段无端口[%s]", port)
}
@ -123,15 +130,15 @@ func (s *PhysicalSection) bindDevicePort(port proto.Port, devicePort DevicePort)
}
// 绑定区段边界公里标。(仅限非道岔物理区段调用)
func (s *PhysicalSection) bindBoundaryKm(km *proto.Kilometer, port proto.Port) error {
func (p *PhysicalSection) bindBoundaryKm(km *proto.Kilometer, port proto.Port) error {
if km == nil || (km.CoordinateSystem == "" && km.Value == 0) {
return nil
}
switch port {
case proto.Port_A:
s.aKm = km
p.aKm = km
case proto.Port_B:
s.bKm = km
p.bKm = km
default:
return fmt.Errorf("区段无端口[%s]", port)
}
@ -139,56 +146,56 @@ func (s *PhysicalSection) bindBoundaryKm(km *proto.Kilometer, port proto.Port) e
}
// 道岔物理区段绑定道岔
func (s *PhysicalSection) bindTurnouts(turnouts ...*Turnout) {
func (p *PhysicalSection) bindTurnouts(turnouts ...*Turnout) {
for _, turnout := range turnouts {
s.turnouts = append(s.turnouts, turnout)
p.turnouts = append(p.turnouts, turnout)
for _, cp := range turnout.checkPoints() {
s.bindDevices(cp)
p.bindDevices(cp)
}
}
}
func (s *PhysicalSection) bindDevices(devices ...Identity) {
func (p *PhysicalSection) bindDevices(devices ...Identity) {
for _, device := range devices {
s.devices = append(s.devices, device)
p.devices = append(p.devices, device)
cp, ok := device.(*CheckPoint)
if ok {
s.checkPoints = append(s.checkPoints, cp)
p.checkPoints = append(p.checkPoints, cp)
}
}
}
func (s *PhysicalSection) findOtherDevicePort(port proto.Port) DevicePort {
func (p *PhysicalSection) findOtherDevicePort(port proto.Port) DevicePort {
switch port {
case proto.Port_A:
return s.bRelation
return p.bRelation
case proto.Port_B:
return s.aRelation
return p.aRelation
}
return nil
}
func (s *PhysicalSection) findOtherBoundaryKmByPort(port proto.Port) *proto.Kilometer {
func (p *PhysicalSection) findOtherBoundaryKmByPort(port proto.Port) *proto.Kilometer {
switch port {
case proto.Port_A:
return s.bKm
return p.bKm
case proto.Port_B:
return s.aKm
return p.aKm
}
return nil
}
func (s *PhysicalSection) findBoundaryKmByPort(port proto.Port) *proto.Kilometer {
func (p *PhysicalSection) findBoundaryKmByPort(port proto.Port) *proto.Kilometer {
switch port {
case proto.Port_A:
return s.aKm
return p.aKm
case proto.Port_B:
return s.bKm
return p.bKm
}
return nil
}
func (s *PhysicalSection) LinkRanges() []*LinkRange {
return s.linkRanges
func (p *PhysicalSection) LinkRanges() []*LinkRange {
return p.linkRanges
}
func (p *PhysicalSection) Platform() *Platform {

View File

@ -455,10 +455,6 @@ func (repo *Repository) FindPlatfrom(id string) *Platform {
return repo.platformMap[id]
}
func (repo *Repository) AddPhysicalSection(section *PhysicalSection) {
repo.physicalSectionMap[section.Id()] = section
}
func (repo *Repository) ConvertKilometer(km *proto.Kilometer, cs string) (*proto.Kilometer, error) {
if km.CoordinateSystem == cs {
return km, nil

View File

@ -30,6 +30,7 @@ func BindSystem(w ecs.World) {
circuit_sys.NewSignalJDXHSystem(),
circuit_sys.NewCkmSys(),
circuit_sys.NewXcjSys(),
circuit_sys.NewTrackCircuitSys(),
device_sys.NewLightSys(),
//屏蔽门
circuit_sys.NewPsdSys(),

View File

@ -0,0 +1,44 @@
package circuit_sys
import (
"github.com/yohamta/donburi"
"joylink.club/ecs"
"joylink.club/ecs/filter"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
"joylink.club/rtsssimulation/sys/device_sys"
)
type TrackCircuitSys struct {
trainQuery *ecs.Query
query *ecs.Query
}
func NewTrackCircuitSys() *TrackCircuitSys {
return &TrackCircuitSys{
trainQuery: ecs.NewQuery(filter.Contains(component.UidType, component.TrainPositionInfoType)),
query: ecs.NewQuery(filter.Contains(entity.TrackCircuitBaseComponentTypeArr...)),
}
}
func (t *TrackCircuitSys) Update(world ecs.World) {
var withTrainSectionMap = make(map[string]bool)
t.trainQuery.Each(world, func(entry *donburi.Entry) {
trainPos := component.TrainPositionInfoType.Get(entry)
sections := device_sys.DoSearchTrainOccupiedSections(world, trainPos)
for _, sectionId := range sections {
withTrainSectionMap[sectionId] = true
}
})
t.query.Each(world, func(entry *ecs.Entry) {
if !entry.HasComponent(component.TrackCircuitType) {
return
}
gj := component.TrackCircuitType.Get(entry).GJ
if withTrainSectionMap[component.UidType.Get(entry).Id] {
component.RelayDriveType.Get(gj).Td = false
} else {
component.RelayDriveType.Get(gj).Td = true
}
})
}

View File

@ -30,7 +30,7 @@ func (s *SectionDetectSystem) Update(w ecs.World) {
s.trainQuery.Each(w, func(entry *ecs.Entry) {
tp := component.TrainPositionInfoType.Get(entry)
//fmt.Println("============>>>>>>列车位置信息:", tp.ToString())
trainSectionIds := s.doSearchTrainOccupiedSections(w, tp)
trainSectionIds := DoSearchTrainOccupiedSections(w, tp)
//fmt.Println("============>>>>>>列车所在物理区段:", trainSectionIds)
for _, sectionId := range trainSectionIds { //车所在区段
tc, find := sectionTrainMap[sectionId]
@ -64,7 +64,7 @@ func newTrainCount() *trainCount {
func (c *trainCount) add() {
c.count++
}
func (s *SectionDetectSystem) doSearchTrainOccupiedSections(w ecs.World, tp *component.TrainPositionInfo) []string {
func DoSearchTrainOccupiedSections(w ecs.World, tp *component.TrainPositionInfo) []string {
wd := entity.GetWorldData(w)
curLink := wd.Repo.FindLink(tp.HeadLink)
stp := &stpContext{w: w, trainLen: tp.Len, curLink: curLink, curOffset: tp.HeadLinkOffset, searchDirection: !tp.Up, acLen: 0}