This commit is contained in:
walker 2023-09-22 18:33:08 +08:00
commit ac8dcdbd18
11 changed files with 749 additions and 368 deletions

View File

@ -1,49 +1,102 @@
package entities package entities
import ( import (
"github.com/yohamta/donburi"
"joylink.club/ecs" "joylink.club/ecs"
"joylink.club/rtsssimulation/system" "joylink.club/rtsssimulation/system"
) )
// CreateStationPsdsCircuitEntity 创建车站屏蔽门电路实体 // CreatePsdCircuitEntity 创建车站屏蔽门电路实体
func CreateStationPsdsCircuitEntity(w ecs.World, stationId string, psds []system.IPsdModel) *ecs.Entry { func CreatePsdCircuitEntity(w ecs.World, psdCircuitId string, psd system.IPsdModel) *ecs.Entry {
circuit := w.Create(system.EntityIdentityComponent, system.StationPsdsCircuitStateComponent, system.PsdTagHandlerComponent) e := w.Create(system.EntityIdentityComponent, system.PsdCircuitStateComponent, system.PsdTagsComponent)
system.EntityIdentityComponent.Set(circuit, &system.EntityIdentity{Id: stationId}) system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: psdCircuitId})
system.StationPsdsCircuitStateComponent.Set(circuit, system.NewStationPsdsCircuitState()) system.PsdCircuitStateComponent.Set(e, system.NewPsdCircuitState())
system.PsdTagHandlerComponent.Set(circuit, system.NewPsdTagHandler()) system.PsdTagsComponent.Set(e, system.NewPsdTags())
tags := system.PsdTagHandlerComponent.Get(circuit)
// //
for _, psd := range psds { type psdCell struct {
cc := make([]donburi.IComponentType, 6) id string
cc = append(cc, system.EntityIdentityComponent) STag bool //上行侧屏蔽门子门标签
cc = append(cc, system.PsdStateComponent) S4KmUpTag bool //上行侧4编组运行方向上行时屏蔽门子门标签
cc = append(cc, system.PercentageDeviceStateComponent) S4KmDownTag bool //上行侧4编组运行方向下行时屏蔽门子门标签
if psd.IsS() { S8KmUpTag bool //上行侧8编组运行方向上行时屏蔽门子门标签
cc = append(cc, tags.STag) S8KmDownTag bool //上行侧8编组运行方向下行时屏蔽门子门标签
XTag bool
X4KmUpTag bool
X4KmDownTag bool
X8KmUpTag bool
X8KmDownTag bool
} }
if psd.IsS4() { psdCellsMap := make(map[string]*psdCell)
cc = append(cc, tags.S4Tag)
}
if psd.IsS8() {
cc = append(cc, tags.S8Tag)
}
if psd.IsX() {
cc = append(cc, tags.XTag)
}
if psd.IsX4() {
cc = append(cc, tags.X4Tag)
}
if psd.IsX8() {
cc = append(cc, tags.X8Tag)
}
psdEntry := w.Create(cc...)
// //
psdId := psd.(system.IDeviceModel).Id() for _, pc := range psd.FindSPsdCells() {
system.EntityIdentityComponent.Set(psdEntry, &system.EntityIdentity{Id: psdId}) cell := &psdCell{id: pc.Id(), STag: true}
system.PsdStateComponent.Set(psdEntry, system.NewPsdState()) psdCellsMap[cell.id] = cell
system.PercentageDeviceStateComponent.Set(psdEntry, system.NewPercentageDeviceStateL()) }
for _, pc := range psd.FindXPsdCells() {
cell := &psdCell{id: pc.Id(), XTag: true}
psdCellsMap[cell.id] = cell
}
for _, pc := range psd.FindS4KmUpPsdCells() {
psdCellsMap[pc.Id()].S4KmUpTag = true
}
for _, pc := range psd.FindS4KmDownPsdCells() {
psdCellsMap[pc.Id()].S4KmDownTag = true
}
for _, pc := range psd.FindS8KmUpPsdCells() {
psdCellsMap[pc.Id()].S8KmUpTag = true
}
for _, pc := range psd.FindS8KmDownPsdCells() {
psdCellsMap[pc.Id()].S8KmDownTag = true
}
for _, pc := range psd.FindX4KmUpPsdCells() {
psdCellsMap[pc.Id()].X4KmUpTag = true
}
for _, pc := range psd.FindX4KmDownPsdCells() {
psdCellsMap[pc.Id()].X4KmDownTag = true
}
for _, pc := range psd.FindX8KmUpPsdCells() {
psdCellsMap[pc.Id()].X8KmUpTag = true
}
for _, pc := range psd.FindX8KmDownPsdCells() {
psdCellsMap[pc.Id()].X8KmDownTag = true
} }
// //
return circuit tags := system.PsdTagsComponent.Get(e)
for cellId, cell := range psdCellsMap {
cellEntry := w.Create(system.EntityIdentityComponent, system.PsdCellStateComponent, system.PercentageDeviceStateComponent)
system.EntityIdentityComponent.Set(cellEntry, &system.EntityIdentity{Id: cellId})
system.PsdCellStateComponent.Set(cellEntry, system.NewPsdCellState())
system.PercentageDeviceStateComponent.Set(cellEntry, system.NewPercentageDeviceStateL()) //默认关门状态
if cell.STag {
cellEntry.AddComponent(tags.STag)
}
if cell.S4KmUpTag {
cellEntry.AddComponent(tags.S4KmUpTag)
}
if cell.S4KmDownTag {
cellEntry.AddComponent(tags.S4KmDownTag)
}
if cell.S8KmUpTag {
cellEntry.AddComponent(tags.S8KmUpTag)
}
if cell.S8KmDownTag {
cellEntry.AddComponent(tags.S8KmDownTag)
}
if cell.XTag {
cellEntry.AddComponent(tags.XTag)
}
if cell.X4KmUpTag {
cellEntry.AddComponent(tags.X4KmUpTag)
}
if cell.X4KmDownTag {
cellEntry.AddComponent(tags.X4KmDownTag)
}
if cell.X8KmUpTag {
cellEntry.AddComponent(tags.X8KmUpTag)
}
if cell.X8KmDownTag {
cellEntry.AddComponent(tags.X8KmDownTag)
}
}
//
return e
} }

View File

@ -15,6 +15,7 @@ message Repository {
repeated Slope slopes = 8; repeated Slope slopes = 8;
repeated SectionalCurvature sectionalCurvatures = 9; repeated SectionalCurvature sectionalCurvatures = 9;
repeated KilometerConvert kilometerConverts = 10; repeated KilometerConvert kilometerConverts = 10;
repeated Relay relays = 11;
} }
// //
@ -46,7 +47,7 @@ message Turnout {
DevicePort bDevicePort = 4; DevicePort bDevicePort = 4;
DevicePort cDevicePort = 5; DevicePort cDevicePort = 5;
SwitchMachineType switchMachineType = 6; SwitchMachineType switchMachineType = 6;
repeated string relayIds = 7; // repeated RelayGroup relayGroups = 7; //
} }
// //
@ -55,6 +56,7 @@ message Signal {
Kilometer km = 2; Kilometer km = 2;
string sectionId = 3; // string sectionId = 3; //
DevicePort turnoutPort = 4; // DevicePort turnoutPort = 4; //
repeated RelayGroup relayGroups = 7; //
} }
// //
@ -134,11 +136,18 @@ enum CheckPointType{
InsulatedJoint = 2; // InsulatedJoint = 2; //
} }
//
message Relay { message Relay {
enum Type { enum Model {
Unknown = 0; Unknown = 0;
} }
string id = 1; string id = 1;
string code = 2; string code = 2;
Type type = 3; string model = 3;
}
//
message RelayGroup {
string code = 1; //
repeated string relayIds = 2; //id
} }

View File

@ -47,3 +47,28 @@ type IModelManager interface {
//FindByType 获取某类型设备的所有模型数据 //FindByType 获取某类型设备的所有模型数据
FindByType(deviceType proto.DeviceType) []Identity FindByType(deviceType proto.DeviceType) []Identity
} }
// IPsdModel 仿真底层屏蔽门模型
// 用户所有屏蔽门模型定义须实现该接口
type IPsdModel interface {
//FindSPsdCells 获取车站上行侧所有屏蔽门子门
FindSPsdCells() []Identity
//FindS4KmUpPsdCells 4编组运行方向为上行且在车站上行侧时对应所有屏蔽门子门
FindS4KmUpPsdCells() []Identity
//FindS8KmUpPsdCells 8编组运行方向为上行且在车站上行侧时对应所有屏蔽门子门
FindS8KmUpPsdCells() []Identity
//FindS4KmDownPsdCells 4编组运行方向为下行且在车站上行侧时对应所有屏蔽门子门
FindS4KmDownPsdCells() []Identity
//FindS8KmDownPsdCells 8编组运行方向为下行且在车站上行侧时对应所有屏蔽门子门
FindS8KmDownPsdCells() []Identity
//FindXPsdCells 获取车站上行侧所有屏蔽门子门
FindXPsdCells() []Identity
//FindX4KmUpPsdCells 4编组运行方向为上行且在车站下行侧时对应所有屏蔽门子门
FindX4KmUpPsdCells() []Identity
//FindX8KmUpPsdCells 8编组运行方向为上行且在车站下行侧时对应所有屏蔽门子门
FindX8KmUpPsdCells() []Identity
//FindX4KmDownPsdCells 4编组运行方向为下行且在车站下行侧时对应所有屏蔽门子门
FindX4KmDownPsdCells() []Identity
//FindX8KmDownPsdCells 8编组运行方向为下行且在车站下行侧时对应所有屏蔽门子门
FindX8KmDownPsdCells() []Identity
}

View File

@ -291,46 +291,46 @@ func (Turnout_SwitchMachineType) EnumDescriptor() ([]byte, []int) {
return file_model_proto_rawDescGZIP(), []int{3, 0} return file_model_proto_rawDescGZIP(), []int{3, 0}
} }
type Relay_Type int32 type Relay_Model int32
const ( const (
Relay_Unknown Relay_Type = 0 Relay_Unknown Relay_Model = 0
) )
// Enum value maps for Relay_Type. // Enum value maps for Relay_Model.
var ( var (
Relay_Type_name = map[int32]string{ Relay_Model_name = map[int32]string{
0: "Unknown", 0: "Unknown",
} }
Relay_Type_value = map[string]int32{ Relay_Model_value = map[string]int32{
"Unknown": 0, "Unknown": 0,
} }
) )
func (x Relay_Type) Enum() *Relay_Type { func (x Relay_Model) Enum() *Relay_Model {
p := new(Relay_Type) p := new(Relay_Model)
*p = x *p = x
return p return p
} }
func (x Relay_Type) String() string { func (x Relay_Model) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
} }
func (Relay_Type) Descriptor() protoreflect.EnumDescriptor { func (Relay_Model) Descriptor() protoreflect.EnumDescriptor {
return file_model_proto_enumTypes[5].Descriptor() return file_model_proto_enumTypes[5].Descriptor()
} }
func (Relay_Type) Type() protoreflect.EnumType { func (Relay_Model) Type() protoreflect.EnumType {
return &file_model_proto_enumTypes[5] return &file_model_proto_enumTypes[5]
} }
func (x Relay_Type) Number() protoreflect.EnumNumber { func (x Relay_Model) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x) return protoreflect.EnumNumber(x)
} }
// Deprecated: Use Relay_Type.Descriptor instead. // Deprecated: Use Relay_Model.Descriptor instead.
func (Relay_Type) EnumDescriptor() ([]byte, []int) { func (Relay_Model) EnumDescriptor() ([]byte, []int) {
return file_model_proto_rawDescGZIP(), []int{11, 0} return file_model_proto_rawDescGZIP(), []int{11, 0}
} }
@ -349,6 +349,7 @@ type Repository struct {
Slopes []*Slope `protobuf:"bytes,8,rep,name=slopes,proto3" json:"slopes,omitempty"` Slopes []*Slope `protobuf:"bytes,8,rep,name=slopes,proto3" json:"slopes,omitempty"`
SectionalCurvatures []*SectionalCurvature `protobuf:"bytes,9,rep,name=sectionalCurvatures,proto3" json:"sectionalCurvatures,omitempty"` SectionalCurvatures []*SectionalCurvature `protobuf:"bytes,9,rep,name=sectionalCurvatures,proto3" json:"sectionalCurvatures,omitempty"`
KilometerConverts []*KilometerConvert `protobuf:"bytes,10,rep,name=kilometerConverts,proto3" json:"kilometerConverts,omitempty"` KilometerConverts []*KilometerConvert `protobuf:"bytes,10,rep,name=kilometerConverts,proto3" json:"kilometerConverts,omitempty"`
Relays []*Relay `protobuf:"bytes,11,rep,name=relays,proto3" json:"relays,omitempty"`
} }
func (x *Repository) Reset() { func (x *Repository) Reset() {
@ -453,6 +454,13 @@ func (x *Repository) GetKilometerConverts() []*KilometerConvert {
return nil return nil
} }
func (x *Repository) GetRelays() []*Relay {
if x != nil {
return x.Relays
}
return nil
}
// 物理区段 // 物理区段
type PhysicalSection struct { type PhysicalSection struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -609,7 +617,7 @@ type Turnout struct {
BDevicePort *DevicePort `protobuf:"bytes,4,opt,name=bDevicePort,proto3" json:"bDevicePort,omitempty"` BDevicePort *DevicePort `protobuf:"bytes,4,opt,name=bDevicePort,proto3" json:"bDevicePort,omitempty"`
CDevicePort *DevicePort `protobuf:"bytes,5,opt,name=cDevicePort,proto3" json:"cDevicePort,omitempty"` CDevicePort *DevicePort `protobuf:"bytes,5,opt,name=cDevicePort,proto3" json:"cDevicePort,omitempty"`
SwitchMachineType Turnout_SwitchMachineType `protobuf:"varint,6,opt,name=switchMachineType,proto3,enum=model.Turnout_SwitchMachineType" json:"switchMachineType,omitempty"` SwitchMachineType Turnout_SwitchMachineType `protobuf:"varint,6,opt,name=switchMachineType,proto3,enum=model.Turnout_SwitchMachineType" json:"switchMachineType,omitempty"`
RelayIds []string `protobuf:"bytes,7,rep,name=relayIds,proto3" json:"relayIds,omitempty"` //道岔关联的继电器 RelayGroups []*RelayGroup `protobuf:"bytes,7,rep,name=relayGroups,proto3" json:"relayGroups,omitempty"` //关联的继电器组
} }
func (x *Turnout) Reset() { func (x *Turnout) Reset() {
@ -686,9 +694,9 @@ func (x *Turnout) GetSwitchMachineType() Turnout_SwitchMachineType {
return Turnout_Unknown return Turnout_Unknown
} }
func (x *Turnout) GetRelayIds() []string { func (x *Turnout) GetRelayGroups() []*RelayGroup {
if x != nil { if x != nil {
return x.RelayIds return x.RelayGroups
} }
return nil return nil
} }
@ -703,6 +711,7 @@ type Signal struct {
Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"` Km *Kilometer `protobuf:"bytes,2,opt,name=km,proto3" json:"km,omitempty"`
SectionId string `protobuf:"bytes,3,opt,name=sectionId,proto3" json:"sectionId,omitempty"` //关联的区段 SectionId string `protobuf:"bytes,3,opt,name=sectionId,proto3" json:"sectionId,omitempty"` //关联的区段
TurnoutPort *DevicePort `protobuf:"bytes,4,opt,name=turnoutPort,proto3" json:"turnoutPort,omitempty"` //关联的区段端口 TurnoutPort *DevicePort `protobuf:"bytes,4,opt,name=turnoutPort,proto3" json:"turnoutPort,omitempty"` //关联的区段端口
RelayGroups []*RelayGroup `protobuf:"bytes,7,rep,name=relayGroups,proto3" json:"relayGroups,omitempty"` //关联的继电器组
} }
func (x *Signal) Reset() { func (x *Signal) Reset() {
@ -765,6 +774,13 @@ func (x *Signal) GetTurnoutPort() *DevicePort {
return nil return nil
} }
func (x *Signal) GetRelayGroups() []*RelayGroup {
if x != nil {
return x.RelayGroups
}
return nil
}
// 应答器 // 应答器
type Transponder struct { type Transponder struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -1157,6 +1173,7 @@ func (x *KilometerConvert) GetSameTrend() bool {
return false return false
} }
// 继电器
type Relay struct { type Relay struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -1164,7 +1181,7 @@ type Relay struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
Type Relay_Type `protobuf:"varint,3,opt,name=type,proto3,enum=model.Relay_Type" json:"type,omitempty"` Model string `protobuf:"bytes,3,opt,name=model,proto3" json:"model,omitempty"`
} }
func (x *Relay) Reset() { func (x *Relay) Reset() {
@ -1213,18 +1230,74 @@ func (x *Relay) GetCode() string {
return "" return ""
} }
func (x *Relay) GetType() Relay_Type { func (x *Relay) GetModel() string {
if x != nil { if x != nil {
return x.Type return x.Model
} }
return Relay_Unknown return ""
}
// 继电器组合
type RelayGroup struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` //组合的编号(名称)
RelayIds []string `protobuf:"bytes,2,rep,name=relayIds,proto3" json:"relayIds,omitempty"` //组合内继电器的id
}
func (x *RelayGroup) Reset() {
*x = RelayGroup{}
if protoimpl.UnsafeEnabled {
mi := &file_model_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RelayGroup) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RelayGroup) ProtoMessage() {}
func (x *RelayGroup) ProtoReflect() protoreflect.Message {
mi := &file_model_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RelayGroup.ProtoReflect.Descriptor instead.
func (*RelayGroup) Descriptor() ([]byte, []int) {
return file_model_proto_rawDescGZIP(), []int{12}
}
func (x *RelayGroup) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *RelayGroup) GetRelayIds() []string {
if x != nil {
return x.RelayIds
}
return nil
} }
var File_model_proto protoreflect.FileDescriptor var File_model_proto protoreflect.FileDescriptor
var file_model_proto_rawDesc = []byte{ var file_model_proto_rawDesc = []byte{
0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d, 0x0a, 0x0b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d,
0x6f, 0x64, 0x65, 0x6c, 0x22, 0xf6, 0x03, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x64, 0x65, 0x6c, 0x22, 0x9c, 0x04, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74,
0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x6f, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a,
@ -1255,143 +1328,153 @@ var file_model_proto_rawDesc = []byte{
0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65,
0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x52, 0x11, 0x6b, 0x69, 0x6c, 0x6f, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x52, 0x11, 0x6b, 0x69, 0x6c, 0x6f,
0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x73, 0x22, 0xab, 0x01, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x73, 0x12, 0x24, 0x0a,
0x0a, 0x0f, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x06, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e,
0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x06, 0x72, 0x65, 0x6c,
0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, 0x73, 0x18, 0x61, 0x79, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x0f, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c,
0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x73, 0x12, 0x33, 0x0a, 0x0b, 0x61, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x75, 0x74, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x75, 0x72,
0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x61, 0x44, 0x65, 0x76, 0x69, 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, 0x73, 0x12, 0x33, 0x0a, 0x0b, 0x61, 0x44, 0x65, 0x76, 0x69,
0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x33, 0x0a, 0x0b, 0x62, 0x44, 0x65, 0x76, 0x69, 0x63, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d,
0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f,
0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b,
0x62, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x9e, 0x01, 0x0a, 0x0a,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b,
0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x12, 0x29, 0x0a, 0x04,
0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64,
0x65, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70,
0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63,
0x65, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d,
0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52,
0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x22, 0x8a, 0x03, 0x0a, 0x0b, 0x61, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x33, 0x0a, 0x0b,
0x07, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x62, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x62, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72,
0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x12, 0x33, 0x0a, 0x0b, 0x61, 0x44, 0x74, 0x22, 0x9e, 0x01, 0x0a, 0x0a, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74,
0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d,
0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02,
0x6b, 0x6d, 0x12, 0x29, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x15, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f,
0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a,
0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72,
0x74, 0x73, 0x22, 0xa3, 0x03, 0x0a, 0x07, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20,
0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64,
0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d,
0x12, 0x33, 0x0a, 0x0b, 0x61, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18,
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65,
0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x61, 0x44, 0x65, 0x76, 0x69, 0x63,
0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x33, 0x0a, 0x0b, 0x62, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x50, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64,
0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x62,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x33, 0x0a, 0x0b, 0x63, 0x44,
0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f,
0x72, 0x74, 0x52, 0x0b, 0x61, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x72, 0x74, 0x52, 0x0b, 0x63, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12,
0x33, 0x0a, 0x0b, 0x62, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x4e, 0x0a, 0x11, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6d, 0x6f, 0x64,
0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x62, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x65, 0x6c, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63,
0x50, 0x6f, 0x72, 0x74, 0x12, 0x33, 0x0a, 0x0b, 0x63, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x11, 0x73, 0x77,
0x6f, 0x72, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12,
0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x63, 0x44, 0x33, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x07,
0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x4e, 0x0a, 0x11, 0x73, 0x77, 0x69, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x6c,
0x74, 0x63, 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72,
0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x54, 0x75, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x42, 0x0a, 0x11, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61,
0x6e, 0x6f, 0x75, 0x74, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b,
0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x11, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x5a, 0x44, 0x4a, 0x39, 0x5f, 0x53,
0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x5a, 0x44, 0x4a, 0x39, 0x5f,
0x61, 0x79, 0x49, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x10, 0x02, 0x22, 0xc2, 0x01, 0x0a, 0x06, 0x53, 0x69, 0x67,
0x61, 0x79, 0x49, 0x64, 0x73, 0x22, 0x42, 0x0a, 0x11, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x6e, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x5a, 0x44, 0x4a, 0x39, 0x5f, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65,
0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x5a, 0x44, 0x4a, 0x39, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x10, 0x02, 0x22, 0x8d, 0x01, 0x0a, 0x06, 0x53, 0x69, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x67, 0x6e, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f,
0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x74, 0x75, 0x72,
0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x33, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x61,
0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x6f, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70,
0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x92, 0x01,
0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x74, 0x75, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a,
0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a,
0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x12,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02, 0x6b, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a,
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01,
0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0b, 0x74, 0x75, 0x72, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63,
0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f,
0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x72, 0x74, 0x22, 0x53, 0x0a, 0x05, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x74, 0x52, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x53, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b,
0x0a, 0x05, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x73, 0x18, 0x02, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x73, 0x12,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x06, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x22, 0x60, 0x0a, 0x12, 0x53, 0x65, 0x63, 0x74, 0x69,
0x65, 0x67, 0x72, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x64, 0x65, 0x67, 0x6f, 0x6e, 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x0e, 0x0a,
0x72, 0x65, 0x65, 0x22, 0x60, 0x0a, 0x12, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a,
0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x6b, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x73, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d,
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x05, 0x52, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x22, 0x7c, 0x0a, 0x0a, 0x44, 0x65, 0x76,
0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x72, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63,
0x61, 0x64, 0x69, 0x75, 0x73, 0x22, 0x7c, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63,
0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e,
0x31, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69,
0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x6f, 0x72,
0x70, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x74, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x7d, 0x0a, 0x09, 0x4b, 0x69, 0x6c, 0x6f, 0x6d,
0x32, 0x0b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x04, 0x70, 0x65, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20,
0x6f, 0x72, 0x74, 0x22, 0x7d, 0x0a, 0x09, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x6f,
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x02,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65,
0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x2e, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74,
0x52, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65,
0x65, 0x6d, 0x12, 0x2e, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x6c, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64, 0x69, 0x72,
0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x69, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x78, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65,
0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d,
0x6f, 0x6e, 0x22, 0x78, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e,
0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x41, 0x18, 0x01, 0x20, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x41, 0x12, 0x22,
0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x0a, 0x03, 0x6b, 0x6d, 0x42, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f,
0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x41, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b,
0x42, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x6d, 0x42, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x18,
0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x42, 0x12, 0x1c, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64,
0x0a, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x22, 0x57, 0x0a, 0x05, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x08, 0x52, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x22, 0x67, 0x0a, 0x05, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a,
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f,
0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x64, 0x65, 0x6c, 0x22, 0x14, 0x0a, 0x05, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x0b, 0x0a, 0x07,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x22, 0x3c, 0x0a, 0x0a, 0x52, 0x65, 0x6c,
0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
0x22, 0x13, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72,
0x6f, 0x77, 0x6e, 0x10, 0x00, 0x2a, 0xa7, 0x02, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72,
0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x73, 0x2a, 0xa7, 0x02, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69,
0x70, 0x65, 0x5f, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x68, 0x79, 0x73, 0x69, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x1e,
0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x0a, 0x1a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x68, 0x79,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x19,
0x50, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x68, 0x65,
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10, 0x03, 0x12, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76,
0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x69, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10,
0x67, 0x6e, 0x61, 0x6c, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69,
0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64,
0x5f, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x10, 0x06, 0x12, 0x21, 0x0a, 0x1d, 0x44, 0x65, 0x76, 0x69, 0x65, 0x72, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79,
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x70, 0x65, 0x5f, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x10, 0x06, 0x12, 0x21, 0x0a, 0x1d, 0x44, 0x65,
0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x6e, 0x6b, 0x10, 0x08, 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x10, 0x07, 0x12, 0x13, 0x0a,
0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x0f, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x6e, 0x6b,
0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x10, 0x08, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x10, 0x0a, 0x2a, 0x5f, 0x4c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10, 0x44,
0x25, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x10,
0x00, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x12, 0x0a, 0x2a, 0x25, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e,
0x05, 0x0a, 0x01, 0x43, 0x10, 0x03, 0x2a, 0x20, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x65, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10,
0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x45, 0x46, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x43, 0x10, 0x03, 0x2a, 0x20, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65,
0x05, 0x52, 0x49, 0x47, 0x48, 0x54, 0x10, 0x01, 0x2a, 0x43, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x45, 0x46, 0x54, 0x10, 0x00, 0x12,
0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x6f, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47, 0x48, 0x54, 0x10, 0x01, 0x2a, 0x43, 0x0a, 0x0e, 0x43, 0x68,
0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x78, 0x6c, 0x65, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x78,
0x75, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x42, 0x1a, 0x5a, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x49,
0x18, 0x2e, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x42,
0x64, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f,
0x33, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
} }
var ( var (
@ -1407,14 +1490,14 @@ func file_model_proto_rawDescGZIP() []byte {
} }
var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 6) var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 6)
var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_model_proto_goTypes = []interface{}{ var file_model_proto_goTypes = []interface{}{
(DeviceType)(0), // 0: model.DeviceType (DeviceType)(0), // 0: model.DeviceType
(Port)(0), // 1: model.Port (Port)(0), // 1: model.Port
(Direction)(0), // 2: model.Direction (Direction)(0), // 2: model.Direction
(CheckPointType)(0), // 3: model.CheckPointType (CheckPointType)(0), // 3: model.CheckPointType
(Turnout_SwitchMachineType)(0), // 4: model.Turnout.SwitchMachineType (Turnout_SwitchMachineType)(0), // 4: model.Turnout.SwitchMachineType
(Relay_Type)(0), // 5: model.Relay.Type (Relay_Model)(0), // 5: model.Relay.Model
(*Repository)(nil), // 6: model.Repository (*Repository)(nil), // 6: model.Repository
(*PhysicalSection)(nil), // 7: model.PhysicalSection (*PhysicalSection)(nil), // 7: model.PhysicalSection
(*CheckPoint)(nil), // 8: model.CheckPoint (*CheckPoint)(nil), // 8: model.CheckPoint
@ -1427,6 +1510,7 @@ var file_model_proto_goTypes = []interface{}{
(*Kilometer)(nil), // 15: model.Kilometer (*Kilometer)(nil), // 15: model.Kilometer
(*KilometerConvert)(nil), // 16: model.KilometerConvert (*KilometerConvert)(nil), // 16: model.KilometerConvert
(*Relay)(nil), // 17: model.Relay (*Relay)(nil), // 17: model.Relay
(*RelayGroup)(nil), // 18: model.RelayGroup
} }
var file_model_proto_depIdxs = []int32{ var file_model_proto_depIdxs = []int32{
7, // 0: model.Repository.physicalSections:type_name -> model.PhysicalSection 7, // 0: model.Repository.physicalSections:type_name -> model.PhysicalSection
@ -1437,33 +1521,35 @@ var file_model_proto_depIdxs = []int32{
12, // 5: model.Repository.slopes:type_name -> model.Slope 12, // 5: model.Repository.slopes:type_name -> model.Slope
13, // 6: model.Repository.sectionalCurvatures:type_name -> model.SectionalCurvature 13, // 6: model.Repository.sectionalCurvatures:type_name -> model.SectionalCurvature
16, // 7: model.Repository.kilometerConverts:type_name -> model.KilometerConvert 16, // 7: model.Repository.kilometerConverts:type_name -> model.KilometerConvert
14, // 8: model.PhysicalSection.aDevicePort:type_name -> model.DevicePort 17, // 8: model.Repository.relays:type_name -> model.Relay
14, // 9: model.PhysicalSection.bDevicePort:type_name -> model.DevicePort 14, // 9: model.PhysicalSection.aDevicePort:type_name -> model.DevicePort
15, // 10: model.CheckPoint.km:type_name -> model.Kilometer 14, // 10: model.PhysicalSection.bDevicePort:type_name -> model.DevicePort
3, // 11: model.CheckPoint.type:type_name -> model.CheckPointType 15, // 11: model.CheckPoint.km:type_name -> model.Kilometer
14, // 12: model.CheckPoint.devicePorts:type_name -> model.DevicePort 3, // 12: model.CheckPoint.type:type_name -> model.CheckPointType
15, // 13: model.Turnout.km:type_name -> model.Kilometer 14, // 13: model.CheckPoint.devicePorts:type_name -> model.DevicePort
14, // 14: model.Turnout.aDevicePort:type_name -> model.DevicePort 15, // 14: model.Turnout.km:type_name -> model.Kilometer
14, // 15: model.Turnout.bDevicePort:type_name -> model.DevicePort 14, // 15: model.Turnout.aDevicePort:type_name -> model.DevicePort
14, // 16: model.Turnout.cDevicePort:type_name -> model.DevicePort 14, // 16: model.Turnout.bDevicePort:type_name -> model.DevicePort
4, // 17: model.Turnout.switchMachineType:type_name -> model.Turnout.SwitchMachineType 14, // 17: model.Turnout.cDevicePort:type_name -> model.DevicePort
15, // 18: model.Signal.km:type_name -> model.Kilometer 4, // 18: model.Turnout.switchMachineType:type_name -> model.Turnout.SwitchMachineType
14, // 19: model.Signal.turnoutPort:type_name -> model.DevicePort 18, // 19: model.Turnout.relayGroups:type_name -> model.RelayGroup
15, // 20: model.Transponder.km:type_name -> model.Kilometer 15, // 20: model.Signal.km:type_name -> model.Kilometer
14, // 21: model.Transponder.turnoutPort:type_name -> model.DevicePort 14, // 21: model.Signal.turnoutPort:type_name -> model.DevicePort
15, // 22: model.Slope.kms:type_name -> model.Kilometer 18, // 22: model.Signal.relayGroups:type_name -> model.RelayGroup
15, // 23: model.SectionalCurvature.kms:type_name -> model.Kilometer 15, // 23: model.Transponder.km:type_name -> model.Kilometer
0, // 24: model.DevicePort.deviceType:type_name -> model.DeviceType 14, // 24: model.Transponder.turnoutPort:type_name -> model.DevicePort
1, // 25: model.DevicePort.port:type_name -> model.Port 15, // 25: model.Slope.kms:type_name -> model.Kilometer
2, // 26: model.Kilometer.direction:type_name -> model.Direction 15, // 26: model.SectionalCurvature.kms:type_name -> model.Kilometer
15, // 27: model.KilometerConvert.kmA:type_name -> model.Kilometer 0, // 27: model.DevicePort.deviceType:type_name -> model.DeviceType
15, // 28: model.KilometerConvert.kmB:type_name -> model.Kilometer 1, // 28: model.DevicePort.port:type_name -> model.Port
5, // 29: model.Relay.type:type_name -> model.Relay.Type 2, // 29: model.Kilometer.direction:type_name -> model.Direction
30, // [30:30] is the sub-list for method output_type 15, // 30: model.KilometerConvert.kmA:type_name -> model.Kilometer
30, // [30:30] is the sub-list for method input_type 15, // 31: model.KilometerConvert.kmB:type_name -> model.Kilometer
30, // [30:30] is the sub-list for extension type_name 32, // [32:32] is the sub-list for method output_type
30, // [30:30] is the sub-list for extension extendee 32, // [32:32] is the sub-list for method input_type
0, // [0:30] is the sub-list for field type_name 32, // [32:32] is the sub-list for extension type_name
32, // [32:32] is the sub-list for extension extendee
0, // [0:32] is the sub-list for field type_name
} }
func init() { file_model_proto_init() } func init() { file_model_proto_init() }
@ -1616,6 +1702,18 @@ func file_model_proto_init() {
return nil return nil
} }
} }
file_model_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RelayGroup); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
@ -1623,7 +1721,7 @@ func file_model_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_model_proto_rawDesc, RawDescriptor: file_model_proto_rawDesc,
NumEnums: 6, NumEnums: 6,
NumMessages: 12, NumMessages: 13,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -3,6 +3,7 @@ package repository
import ( import (
"errors" "errors"
"fmt" "fmt"
"joylink.club/rtsssimulation/repository/model/proto" "joylink.club/rtsssimulation/repository/model/proto"
) )
@ -68,6 +69,14 @@ func (s *PhysicalSection) BRelation() DevicePort {
return s.bRelation return s.bRelation
} }
func (s *PhysicalSection) AKilometer() *proto.Kilometer {
return s.aKm
}
func (s *PhysicalSection) BKilometer() *proto.Kilometer {
return s.bKm
}
func (s *PhysicalSection) bindDevicePort(port proto.Port, devicePort DevicePort) error { func (s *PhysicalSection) bindDevicePort(port proto.Port, devicePort DevicePort) error {
_, isSectionPort := devicePort.(*PhysicalSectionPort) _, isSectionPort := devicePort.(*PhysicalSectionPort)
_, isTurnoutPort := devicePort.(*TurnoutPort) _, isTurnoutPort := devicePort.(*TurnoutPort)

25
repository/relay.go Normal file
View File

@ -0,0 +1,25 @@
package repository
import "joylink.club/rtsssimulation/repository/model/proto"
type Relay struct {
Identity
code string
model string
}
func newRelay(id string, code string, model string) *Relay {
return &Relay{
Identity: identity{
id: id,
deviceType: proto.DeviceType_DeviceType_Relay,
},
code: code,
model: model,
}
}
type RelayGroup struct {
code string
relays []*Relay
}

View File

@ -16,21 +16,16 @@ type Repository struct {
responderMap map[string]*Transponder responderMap map[string]*Transponder
slopeMap map[string]*Slope slopeMap map[string]*Slope
sectionalCurvatureMap map[string]*SectionalCurvature sectionalCurvatureMap map[string]*SectionalCurvature
kilometerConvertMap map[string]*proto.KilometerConvert
relayMap map[string]*Relay
linkMap map[string]*Link linkMap map[string]*Link
//devicePositionMap map[string]*DeviceLinkPosition //key为device的id
//linkNodeMap map[string]*LinkNode //LinkNode的id应该没什么意义所以此处key用LinkNode中Turnout的id
//slopeLinkSegmentMap map[string]*SlopeLinkSegment
//sectionalCurvatureLinkSegmentMap map[string]*SectionalCurvatureLinkSegment
kilometerConvertMap map[string]*proto.KilometerConvert
} }
func newRepository(id string, version string) *Repository { func newRepository(id string, version string) *Repository {
return &Repository{ return &Repository{
id: id, id: id,
version: version, version: version,
//modelMap: make(map[string]model.Identity),
physicalSectionMap: make(map[string]*PhysicalSection), physicalSectionMap: make(map[string]*PhysicalSection),
checkPointMap: make(map[string]*CheckPoint), checkPointMap: make(map[string]*CheckPoint),
turnoutMap: make(map[string]*Turnout), turnoutMap: make(map[string]*Turnout),
@ -38,12 +33,9 @@ func newRepository(id string, version string) *Repository {
responderMap: make(map[string]*Transponder), responderMap: make(map[string]*Transponder),
slopeMap: make(map[string]*Slope), slopeMap: make(map[string]*Slope),
sectionalCurvatureMap: make(map[string]*SectionalCurvature), sectionalCurvatureMap: make(map[string]*SectionalCurvature),
linkMap: make(map[string]*Link),
//devicePositionMap: make(map[string]*DeviceLinkPosition),
//linkNodeMap: make(map[string]*LinkNode),
//slopeLinkSegmentMap: make(map[string]*SlopeLinkSegment),
//sectionalCurvatureLinkSegmentMap: make(map[string]*SectionalCurvatureLinkSegment),
kilometerConvertMap: make(map[string]*proto.KilometerConvert), kilometerConvertMap: make(map[string]*proto.KilometerConvert),
relayMap: make(map[string]*Relay),
linkMap: make(map[string]*Link),
} }
} }
@ -110,6 +102,13 @@ func (repo *Repository) KilometerConvertList() []*proto.KilometerConvert {
} }
return list return list
} }
func (repo *Repository) RelayList() []*Relay {
var list []*Relay
for _, model := range repo.relayMap {
list = append(list, model)
}
return list
}
func (repo *Repository) getModel(deviceId string, deviceType proto.DeviceType) (Identity, error) { func (repo *Repository) getModel(deviceId string, deviceType proto.DeviceType) (Identity, error) {
switch deviceType { switch deviceType {

View File

@ -74,6 +74,10 @@ func buildModels(source *proto.Repository, repository *Repository) {
m := NewSectionalCurvature(protoData.Id, protoData.Kms, protoData.Radius) m := NewSectionalCurvature(protoData.Id, protoData.Kms, protoData.Radius)
repository.sectionalCurvatureMap[m.Id()] = m repository.sectionalCurvatureMap[m.Id()] = m
} }
for _, protoData := range source.Relays {
m := newRelay(protoData.Id, protoData.Code, protoData.Model)
repository.relayMap[m.Id()] = m
}
} }
func buildModelRelationship(source *proto.Repository, repository *Repository) error { func buildModelRelationship(source *proto.Repository, repository *Repository) error {
@ -211,6 +215,17 @@ func buildTurnoutRelationShip(source *proto.Repository, repo *Repository) error
if err != nil { if err != nil {
return err return err
} }
//关联继电器组
for _, group := range protoData.RelayGroups {
var relays []*Relay
for _, id := range group.RelayIds {
relays = append(relays, repo.relayMap[id])
}
turnout.relayGroups = append(turnout.relayGroups, &RelayGroup{
code: group.Code,
relays: relays,
})
}
} }
return nil return nil
} }

View File

@ -3,6 +3,7 @@ package repository
import ( import (
"errors" "errors"
"fmt" "fmt"
"joylink.club/rtsssimulation/repository/model/proto" "joylink.club/rtsssimulation/repository/model/proto"
) )
@ -40,6 +41,8 @@ type Turnout struct {
aDevices []Identity aDevices []Identity
bDevices []Identity bDevices []Identity
cDevices []Identity cDevices []Identity
relayGroups []*RelayGroup
} }
func NewTurnout(id string, km *proto.Kilometer, switchMachineType proto.Turnout_SwitchMachineType) *Turnout { func NewTurnout(id string, km *proto.Kilometer, switchMachineType proto.Turnout_SwitchMachineType) *Turnout {
@ -201,6 +204,18 @@ func (t *Turnout) SwitchMachineType() proto.Turnout_SwitchMachineType {
return t.switchMachineType return t.switchMachineType
} }
func (t *Turnout) GetTurnoutKm(port proto.Port) *proto.Kilometer {
switch port {
case proto.Port_A:
return t.aKm
case proto.Port_B:
return t.bKm
case proto.Port_C:
return t.cKm
}
return t.km
}
type TurnoutPort struct { type TurnoutPort struct {
turnout *Turnout turnout *Turnout
port proto.Port port proto.Port

View File

@ -27,17 +27,4 @@ type IModelManager = repository.IModelManager
// IPsdModel 仿真底层屏蔽门模型 // IPsdModel 仿真底层屏蔽门模型
// 用户所有屏蔽门模型定义须实现该接口 // 用户所有屏蔽门模型定义须实现该接口
type IPsdModel interface { type IPsdModel = repository.IPsdModel
//IsS true-上行
IsS() bool
//IsS4 true-上行4编组
IsS4() bool
//IsS8 true-上行8编组
IsS8() bool
//IsX true-下行
IsX() bool
//IsX4 true-下行4编组
IsX4() bool
//IsX8 true-下行8编组
IsX8() bool
}

View File

@ -3,12 +3,11 @@ package system
import ( import (
"github.com/yohamta/donburi/filter" "github.com/yohamta/donburi/filter"
"joylink.club/ecs" "joylink.club/ecs"
sysEvent "joylink.club/rtsssimulation/system/event"
) )
// StationPsdsCircuitState 站台门控制电路状态 // PsdCircuitState 站台门控制电路状态Psd为车站所有屏蔽门子门的集合
// 旁路继电器的工作原理是,当电路中的电流超过预定的阈值时,旁路继电器会自动断开电路,从而防止电路发生短路或过载等故障。 // 旁路继电器的工作原理是,当电路中的电流超过预定的阈值时,旁路继电器会自动断开电路,从而防止电路发生短路或过载等故障。
type StationPsdsCircuitState struct { type PsdCircuitState struct {
//关门继电器,true-吸合 //关门继电器,true-吸合
XGMJ bool XGMJ bool
//4编组开门继电器,true-吸合 //4编组开门继电器,true-吸合
@ -19,6 +18,8 @@ type StationPsdsCircuitState struct {
XMGJ bool XMGJ bool
//门旁路继电器,true-吸合 //门旁路继电器,true-吸合
XMPLJ bool XMPLJ bool
//车站下行侧屏蔽门开门码
XOpenCode OpenCode
//关门继电器,true-吸合 //关门继电器,true-吸合
SGMJ bool SGMJ bool
//4编组开门继电器,true-吸合 //4编组开门继电器,true-吸合
@ -29,65 +30,84 @@ type StationPsdsCircuitState struct {
SMGJ bool SMGJ bool
//门旁路继电器,true-吸合 //门旁路继电器,true-吸合
SMPLJ bool SMPLJ bool
//车站上行侧屏蔽门开门码
SOpenCode OpenCode
} }
// PsdState 站台一侧屏蔽门由多个Psd构成 // PsdCellState 车站屏蔽门子门
type PsdState struct { type PsdCellState struct {
//屏蔽门打开的百分比则0-完全关闭100-完全打开 //屏蔽门打开的百分比则0-完全关闭100-完全打开
Rate int Rate int8
//关门操作被激活 //关门操作被激活
actClosing bool actClosing bool
//开门操作被激活 //开门操作被激活
actOpening bool actOpening bool
} }
// PsdTagHandler 屏蔽门标签用于ecs query // PsdTags 屏蔽门标签
type PsdTagHandler struct { type PsdTags struct {
//上行标签 STag EntityTag //上行侧屏蔽门子门标签
STag EntityTag S4KmUpTag EntityTag //上行侧4编组运行方向上行时屏蔽门子门标签
//上行4编组标签 S4KmDownTag EntityTag //上行侧4编组运行方向下行时屏蔽门子门标签
S4Tag EntityTag S8KmUpTag EntityTag //上行侧8编组运行方向上行时屏蔽门子门标签
//上行8编组标签 S8KmDownTag EntityTag //上行侧8编组运行方向下行时屏蔽门子门标签
S8Tag EntityTag
//下行标签
XTag EntityTag XTag EntityTag
//下行4编组标签 X4KmUpTag EntityTag
X4Tag EntityTag X4KmDownTag EntityTag
//下行8编组标签 X8KmUpTag EntityTag
X8Tag EntityTag X8KmDownTag EntityTag
queryMap map[EntityTag]*ecs.Query
} }
// StationPsdsCircuitSystem 站台门电路系统 // 屏蔽门子门查询
type StationPsdsCircuitSystem struct { func (me *PsdTags) psdCellsQuery(tag EntityTag) *ecs.Query {
if query, ok := me.queryMap[tag]; !ok {
query = ecs.NewQuery(filter.Contains(tag))
me.queryMap[tag] = query
}
return me.queryMap[tag]
} }
func NewStationPsdsCircuitSystem() *StationPsdsCircuitSystem { // PsdsCircuitSystem 站台门电路系统
return &StationPsdsCircuitSystem{} type PsdsCircuitSystem struct {
}
func NewPsdTagHandler() *PsdTagHandler {
return &PsdTagHandler{STag: NewTag(), S4Tag: NewTag(), S8Tag: NewTag(), XTag: NewTag(), X4Tag: NewTag(), X8Tag: NewTag()}
}
func NewStationPsdsCircuitState() *StationPsdsCircuitState {
return &StationPsdsCircuitState{}
}
func NewPsdState() *PsdState {
return &PsdState{Rate: PSD_CLOSED_RATE}
} }
var StationPsdsCircuitStateComponent = ecs.NewComponentType[StationPsdsCircuitState]() func NewPsdsCircuitSystem() *PsdsCircuitSystem {
var PsdTagHandlerComponent = ecs.NewComponentType[PsdTagHandler]() return &PsdsCircuitSystem{}
var PsdStateComponent = ecs.NewComponentType[PsdState]() }
var psdsQuery = ecs.NewQuery(filter.Contains(PsdStateComponent, PercentageDeviceStateComponent)) func NewPsdTags() *PsdTags {
var psdsCircuitQuery = ecs.NewQuery(filter.Contains(StationPsdsCircuitStateComponent)) return &PsdTags{S4KmUpTag: NewTag(), S8KmDownTag: NewTag(), S4KmDownTag: NewTag(), S8KmUpTag: NewTag(), STag: NewTag(),
XTag: NewTag(), X4KmDownTag: NewTag(), X4KmUpTag: NewTag(), X8KmDownTag: NewTag(), X8KmUpTag: NewTag(),
queryMap: make(map[EntityTag]*ecs.Query, 10)}
}
func NewPsdCellState() *PsdCellState {
return &PsdCellState{}
}
func NewPsdCircuitState() *PsdCircuitState {
return &PsdCircuitState{XMGJ: true, SMGJ: true, XMPLJ: false, XGMJ: false, XOpenCode: OpenCodeNon, G8SKMJ: false,
G4SKMJ: false, G4XKMJ: false, G8XKMJ: false, SGMJ: false, SMPLJ: false, SOpenCode: OpenCodeNon}
}
// PSD var (
PsdCircuitStateComponent = ecs.NewComponentType[PsdCircuitState]()
PsdCellStateComponent = ecs.NewComponentType[PsdCellState]()
PsdTagsComponent = ecs.NewComponentType[PsdTags]()
psdCircuitQuery = ecs.NewQuery(filter.Contains(PsdCircuitStateComponent))
psdCellQuery = ecs.NewQuery(filter.Contains(PsdCellStateComponent))
)
// OpenCode 开门码
type OpenCode int8
// 开门码枚举
const ( const (
PSD_CLOSED int64 = 0 //psd 完全关闭 OpenCodeNon OpenCode = iota //无效开门码
PSD_OPENED int64 = 2000 //psd 完全打开 OpenCodeUp //运行方向为上行的开门码
OpenCodeDown //运行方向为下行的开门码
) )
const ( const (
PSD_CLOSED_RATE = 0 PsdCellRateClosed int8 = 0
PSD_OPENED_RATE = 100 PsdCellRateOpened int8 = 100
) )
// PSD组合类型和继电器功能名称 // PSD组合类型和继电器功能名称
@ -106,79 +126,205 @@ const (
) )
// Update world 执行 // Update world 执行
func (me *StationPsdsCircuitSystem) Update(w ecs.World) { func (me *PsdsCircuitSystem) Update(w ecs.World) {
me.psdUpdate(w) //
me.circuitUpdate(w) psdCellQuery.Each(w, func(cellEntry *ecs.Entry) {
} me.calculateCellMove(w, cellEntry)
})
// 车站上下行屏蔽门电路运算 //
func (me *StationPsdsCircuitSystem) circuitUpdate(w ecs.World) { psdCircuitQuery.Each(w, func(psdCircuitEntry *ecs.Entry) {
psdsCircuitQuery.Each(w, func(e *ecs.Entry) { me.calculateSMG(w, psdCircuitEntry)
me.calculateMG(w, e) me.calculateXMG(w, psdCircuitEntry)
me.calculateActGM(w, e) me.calculateSGM(w, psdCircuitEntry)
me.calculateXGM(w, psdCircuitEntry)
me.calculate4SKM(w, psdCircuitEntry)
me.calculate4XKM(w, psdCircuitEntry)
me.calculate8SKM(w, psdCircuitEntry)
me.calculate8XKM(w, psdCircuitEntry)
}) })
} }
// 关门动作运算 // 屏蔽门子门移动运算,暂定门从全关到全开耗时2000ms,则v=50/ms
func (me *StationPsdsCircuitSystem) calculateActGM(w ecs.World, circuitEntry *ecs.Entry) { func (me *PsdsCircuitSystem) calculateCellMove(w ecs.World, cellEntry *ecs.Entry) {
circuit := StationPsdsCircuitStateComponent.Get(circuitEntry) move := PercentageDeviceStateComponent.Get(cellEntry)
tags := PsdTagHandlerComponent.Get(circuitEntry) cell := PsdCellStateComponent.Get(cellEntry)
//上行 cell.Rate = move.GetRate()
isActSGm := circuit.SGMJ && !circuit.G4SKMJ && !circuit.G8SKMJ if cell.actOpening {
sQuery := ecs.NewQuery(filter.Contains(tags.STag)) move.V = 50
sQuery.Each(w, func(sPsd *ecs.Entry) { if cell.Rate >= PsdCellRateOpened { //开门到位
sPsdState := PsdStateComponent.Get(sPsd) move.V = 0
sPsdState.actClosing = isActSGm }
}) }
//下行 if cell.actClosing {
isActXGm := circuit.XGMJ && !circuit.G4XKMJ && !circuit.G8XKMJ move.V = -50
xQuery := ecs.NewQuery(filter.Contains(tags.XTag)) if cell.Rate <= PsdCellRateClosed { //关门到位
xQuery.Each(w, func(xPsd *ecs.Entry) { move.V = 0
xPsdState := PsdStateComponent.Get(xPsd) }
xPsdState.actClosing = isActXGm }
}) if !cell.actOpening && !cell.actClosing {
move.V = 0
}
} }
// 4编组开门动作运算 // 车站屏蔽门电路系统继电器励磁运算 ???-----信息缺失
func (me *StationPsdsCircuitSystem) calculateAct4KM(w ecs.World, circuitEntry *ecs.Entry) { func (me *PsdsCircuitSystem) calculateRelayLc(w ecs.World, psdCircuitEntry *ecs.Entry) {
//psd := PsdCircuitStateComponent.Get(psdCircuitEntry)
//
} }
// 门关状态运算 // 车站上行侧所有屏蔽门子门关运算
func (me *StationPsdsCircuitSystem) calculateMG(w ecs.World, circuitEntry *ecs.Entry) { func (me *PsdsCircuitSystem) calculateSMG(w ecs.World, psdCircuitEntry *ecs.Entry) {
tags := PsdTagHandlerComponent.Get(circuitEntry) tags := PsdTagsComponent.Get(psdCircuitEntry)
circuit := StationPsdsCircuitStateComponent.Get(circuitEntry) isSMG := true
//上行 tags.psdCellsQuery(tags.STag).Each(w, func(cellEntry *ecs.Entry) {
isSMg := true if isSMG {
sQuery := ecs.NewQuery(filter.Contains(tags.STag)) cell := PsdCellStateComponent.Get(cellEntry)
sQuery.Each(w, func(sPsd *ecs.Entry) { isSMG = cell.Rate <= PsdCellRateClosed
if isSMg {
isSMg = PsdStateComponent.Get(sPsd).Rate == PSD_CLOSED_RATE
} }
}) })
if isSMg != circuit.SMGJ { PsdCircuitStateComponent.Get(psdCircuitEntry).SMGJ = isSMG
if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(circuitEntry).Id, PSD_GT, PSD_SMGJ, isSMg); ok { }
sysEvent.RelayNeedChangeEventBus.Publish(w, event)
} // 车站下行侧所有屏蔽门子门关运算
} func (me *PsdsCircuitSystem) calculateXMG(w ecs.World, psdCircuitEntry *ecs.Entry) {
//下行 tags := PsdTagsComponent.Get(psdCircuitEntry)
isXMg := true isXMG := true
xQuery := ecs.NewQuery(filter.Contains(tags.XTag)) tags.psdCellsQuery(tags.XTag).Each(w, func(cellEntry *ecs.Entry) {
xQuery.Each(w, func(xPsd *ecs.Entry) { if isXMG {
if isXMg { cell := PsdCellStateComponent.Get(cellEntry)
isXMg = PsdStateComponent.Get(xPsd).Rate == PSD_CLOSED_RATE isXMG = cell.Rate <= PsdCellRateClosed
} }
}) })
if isXMg != circuit.XMGJ { PsdCircuitStateComponent.Get(psdCircuitEntry).XMGJ = isXMG
if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(circuitEntry).Id, PSD_GT, PSD_XMGJ, isSMg); ok { }
sysEvent.RelayNeedChangeEventBus.Publish(w, event)
// 车站上行侧关门操作运算
func (me *PsdsCircuitSystem) calculateSGM(w ecs.World, psdCircuitEntry *ecs.Entry) {
psd := PsdCircuitStateComponent.Get(psdCircuitEntry)
if psd.SGMJ && !psd.G4SKMJ && !psd.G8SKMJ {
tags := PsdTagsComponent.Get(psdCircuitEntry)
tags.psdCellsQuery(tags.STag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = cell.Rate > PsdCellRateClosed
cell.actOpening = false
})
}
}
// 车站下行侧关门操作运算
func (me *PsdsCircuitSystem) calculateXGM(w ecs.World, psdCircuitEntry *ecs.Entry) {
psd := PsdCircuitStateComponent.Get(psdCircuitEntry)
if psd.XGMJ && !psd.G4XKMJ && !psd.G8XKMJ {
tags := PsdTagsComponent.Get(psdCircuitEntry)
tags.psdCellsQuery(tags.XTag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = cell.Rate > PsdCellRateClosed
cell.actOpening = false
})
}
}
// 车站上行侧4编组开门操作运算
func (me *PsdsCircuitSystem) calculate4SKM(w ecs.World, psdCircuitEntry *ecs.Entry) {
psd := PsdCircuitStateComponent.Get(psdCircuitEntry)
if psd.G4SKMJ && !psd.G8SKMJ && !psd.SGMJ && psd.SOpenCode != OpenCodeNon {
tags := PsdTagsComponent.Get(psdCircuitEntry)
switch {
case psd.SOpenCode == OpenCodeUp:
{
tags.psdCellsQuery(tags.S4KmUpTag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = false
cell.actOpening = cell.Rate < PsdCellRateOpened
})
}
case psd.SOpenCode == OpenCodeDown:
{
tags.psdCellsQuery(tags.S4KmDownTag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = false
cell.actOpening = cell.Rate < PsdCellRateOpened
})
}
} }
} }
} }
////////////////////////////////////////////////////////////////////// // 车站下行侧4编组开门操作运算
func (me *PsdsCircuitSystem) calculate4XKM(w ecs.World, psdCircuitEntry *ecs.Entry) {
// 单个屏蔽门运算 psd := PsdCircuitStateComponent.Get(psdCircuitEntry)
func (me *StationPsdsCircuitSystem) psdUpdate(w ecs.World) { if psd.G4XKMJ && !psd.G8XKMJ && !psd.XGMJ && psd.XOpenCode != OpenCodeNon {
tags := PsdTagsComponent.Get(psdCircuitEntry)
switch {
case psd.XOpenCode == OpenCodeUp:
{
tags.psdCellsQuery(tags.X4KmUpTag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = false
cell.actOpening = cell.Rate < PsdCellRateOpened
})
}
case psd.XOpenCode == OpenCodeDown:
{
tags.psdCellsQuery(tags.X4KmDownTag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = false
cell.actOpening = cell.Rate < PsdCellRateOpened
})
}
}
}
}
// 车站上行侧8编组开门操作运算
func (me *PsdsCircuitSystem) calculate8SKM(w ecs.World, psdCircuitEntry *ecs.Entry) {
psd := PsdCircuitStateComponent.Get(psdCircuitEntry)
if !psd.G4SKMJ && psd.G8SKMJ && !psd.SGMJ && psd.SOpenCode != OpenCodeNon {
tags := PsdTagsComponent.Get(psdCircuitEntry)
switch {
case psd.SOpenCode == OpenCodeUp:
{
tags.psdCellsQuery(tags.S8KmUpTag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = false
cell.actOpening = cell.Rate < PsdCellRateOpened
})
}
case psd.SOpenCode == OpenCodeDown:
{
tags.psdCellsQuery(tags.S8KmDownTag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = false
cell.actOpening = cell.Rate < PsdCellRateOpened
})
}
}
}
}
// 车站下行侧8编组开门操作运算
func (me *PsdsCircuitSystem) calculate8XKM(w ecs.World, psdCircuitEntry *ecs.Entry) {
psd := PsdCircuitStateComponent.Get(psdCircuitEntry)
if !psd.G4XKMJ && psd.G8XKMJ && !psd.XGMJ && psd.XOpenCode != OpenCodeNon {
tags := PsdTagsComponent.Get(psdCircuitEntry)
switch {
case psd.XOpenCode == OpenCodeUp:
{
tags.psdCellsQuery(tags.X8KmUpTag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = false
cell.actOpening = cell.Rate < PsdCellRateOpened
})
}
case psd.XOpenCode == OpenCodeDown:
{
tags.psdCellsQuery(tags.X8KmDownTag).Each(w, func(cellEntry *ecs.Entry) {
cell := PsdCellStateComponent.Get(cellEntry)
cell.actClosing = false
cell.actOpening = cell.Rate < PsdCellRateOpened
})
}
}
}
} }