diff --git a/entities/psd_entity.go b/entities/psd_entity.go index f58eead..ab77587 100644 --- a/entities/psd_entity.go +++ b/entities/psd_entity.go @@ -1,49 +1,102 @@ package entities import ( - "github.com/yohamta/donburi" "joylink.club/ecs" "joylink.club/rtsssimulation/system" ) -// CreateStationPsdsCircuitEntity 创建车站屏蔽门电路实体 -func CreateStationPsdsCircuitEntity(w ecs.World, stationId string, psds []system.IPsdModel) *ecs.Entry { - circuit := w.Create(system.EntityIdentityComponent, system.StationPsdsCircuitStateComponent, system.PsdTagHandlerComponent) - system.EntityIdentityComponent.Set(circuit, &system.EntityIdentity{Id: stationId}) - system.StationPsdsCircuitStateComponent.Set(circuit, system.NewStationPsdsCircuitState()) - system.PsdTagHandlerComponent.Set(circuit, system.NewPsdTagHandler()) - tags := system.PsdTagHandlerComponent.Get(circuit) +// CreatePsdCircuitEntity 创建车站屏蔽门电路实体 +func CreatePsdCircuitEntity(w ecs.World, psdCircuitId string, psd system.IPsdModel) *ecs.Entry { + e := w.Create(system.EntityIdentityComponent, system.PsdCircuitStateComponent, system.PsdTagsComponent) + system.EntityIdentityComponent.Set(e, &system.EntityIdentity{Id: psdCircuitId}) + system.PsdCircuitStateComponent.Set(e, system.NewPsdCircuitState()) + system.PsdTagsComponent.Set(e, system.NewPsdTags()) // - for _, psd := range psds { - cc := make([]donburi.IComponentType, 6) - cc = append(cc, system.EntityIdentityComponent) - cc = append(cc, system.PsdStateComponent) - cc = append(cc, system.PercentageDeviceStateComponent) - if psd.IsS() { - cc = append(cc, tags.STag) - } - if psd.IsS4() { - 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() - system.EntityIdentityComponent.Set(psdEntry, &system.EntityIdentity{Id: psdId}) - system.PsdStateComponent.Set(psdEntry, system.NewPsdState()) - system.PercentageDeviceStateComponent.Set(psdEntry, system.NewPercentageDeviceStateL()) + type psdCell struct { + id string + STag bool //上行侧屏蔽门子门标签 + S4KmUpTag bool //上行侧4编组运行方向上行时屏蔽门子门标签 + S4KmDownTag bool //上行侧4编组运行方向下行时屏蔽门子门标签 + S8KmUpTag bool //上行侧8编组运行方向上行时屏蔽门子门标签 + S8KmDownTag bool //上行侧8编组运行方向下行时屏蔽门子门标签 + XTag bool + X4KmUpTag bool + X4KmDownTag bool + X8KmUpTag bool + X8KmDownTag bool + } + psdCellsMap := make(map[string]*psdCell) + // + for _, pc := range psd.FindSPsdCells() { + cell := &psdCell{id: pc.Id(), STag: true} + psdCellsMap[cell.id] = cell + } + 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 } diff --git a/proto/src/model.proto b/proto/src/model.proto index 26378a2..048340b 100644 --- a/proto/src/model.proto +++ b/proto/src/model.proto @@ -15,6 +15,7 @@ message Repository { repeated Slope slopes = 8; repeated SectionalCurvature sectionalCurvatures = 9; repeated KilometerConvert kilometerConverts = 10; + repeated Relay relays = 11; } //物理区段 @@ -46,7 +47,7 @@ message Turnout { DevicePort bDevicePort = 4; DevicePort cDevicePort = 5; SwitchMachineType switchMachineType = 6; - repeated string relayIds = 7; //道岔关联的继电器 + repeated RelayGroup relayGroups = 7; //关联的继电器组 } //信号机 @@ -55,6 +56,7 @@ message Signal { Kilometer km = 2; string sectionId = 3; //关联的区段 DevicePort turnoutPort = 4; //关联的区段端口 + repeated RelayGroup relayGroups = 7; //关联的继电器组 } //应答器 @@ -134,11 +136,18 @@ enum CheckPointType{ InsulatedJoint = 2; //绝缘节 } +//继电器 message Relay { - enum Type { + enum Model { Unknown = 0; } string id = 1; string code = 2; - Type type = 3; + string model = 3; +} + +//继电器组合 +message RelayGroup { + string code = 1; //组合的编号(名称) + repeated string relayIds = 2; //组合内继电器的id } \ No newline at end of file diff --git a/repository/model.go b/repository/model.go index f830c19..ea1fda6 100644 --- a/repository/model.go +++ b/repository/model.go @@ -47,3 +47,28 @@ type IModelManager interface { //FindByType 获取某类型设备的所有模型数据 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 +} diff --git a/repository/model/proto/model.pb.go b/repository/model/proto/model.pb.go index fefc36d..a956cc5 100644 --- a/repository/model/proto/model.pb.go +++ b/repository/model/proto/model.pb.go @@ -291,46 +291,46 @@ func (Turnout_SwitchMachineType) EnumDescriptor() ([]byte, []int) { return file_model_proto_rawDescGZIP(), []int{3, 0} } -type Relay_Type int32 +type Relay_Model int32 const ( - Relay_Unknown Relay_Type = 0 + Relay_Unknown Relay_Model = 0 ) -// Enum value maps for Relay_Type. +// Enum value maps for Relay_Model. var ( - Relay_Type_name = map[int32]string{ + Relay_Model_name = map[int32]string{ 0: "Unknown", } - Relay_Type_value = map[string]int32{ + Relay_Model_value = map[string]int32{ "Unknown": 0, } ) -func (x Relay_Type) Enum() *Relay_Type { - p := new(Relay_Type) +func (x Relay_Model) Enum() *Relay_Model { + p := new(Relay_Model) *p = x return p } -func (x Relay_Type) String() string { +func (x Relay_Model) String() string { 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() } -func (Relay_Type) Type() protoreflect.EnumType { +func (Relay_Model) Type() protoreflect.EnumType { return &file_model_proto_enumTypes[5] } -func (x Relay_Type) Number() protoreflect.EnumNumber { +func (x Relay_Model) Number() protoreflect.EnumNumber { return protoreflect.EnumNumber(x) } -// Deprecated: Use Relay_Type.Descriptor instead. -func (Relay_Type) EnumDescriptor() ([]byte, []int) { +// Deprecated: Use Relay_Model.Descriptor instead. +func (Relay_Model) EnumDescriptor() ([]byte, []int) { 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"` SectionalCurvatures []*SectionalCurvature `protobuf:"bytes,9,rep,name=sectionalCurvatures,proto3" json:"sectionalCurvatures,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() { @@ -453,6 +454,13 @@ func (x *Repository) GetKilometerConverts() []*KilometerConvert { return nil } +func (x *Repository) GetRelays() []*Relay { + if x != nil { + return x.Relays + } + return nil +} + // 物理区段 type PhysicalSection struct { state protoimpl.MessageState @@ -609,7 +617,7 @@ type Turnout struct { BDevicePort *DevicePort `protobuf:"bytes,4,opt,name=bDevicePort,proto3" json:"bDevicePort,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"` - 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() { @@ -686,9 +694,9 @@ func (x *Turnout) GetSwitchMachineType() Turnout_SwitchMachineType { return Turnout_Unknown } -func (x *Turnout) GetRelayIds() []string { +func (x *Turnout) GetRelayGroups() []*RelayGroup { if x != nil { - return x.RelayIds + return x.RelayGroups } return nil } @@ -699,10 +707,11 @@ type Signal struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,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"` //关联的区段 - TurnoutPort *DevicePort `protobuf:"bytes,4,opt,name=turnoutPort,proto3" json:"turnoutPort,omitempty"` //关联的区段端口 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,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"` //关联的区段 + 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() { @@ -765,6 +774,13 @@ func (x *Signal) GetTurnoutPort() *DevicePort { return nil } +func (x *Signal) GetRelayGroups() []*RelayGroup { + if x != nil { + return x.RelayGroups + } + return nil +} + // 应答器 type Transponder struct { state protoimpl.MessageState @@ -1157,14 +1173,15 @@ func (x *KilometerConvert) GetSameTrend() bool { return false } +// 继电器 type Relay struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,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"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` + Model string `protobuf:"bytes,3,opt,name=model,proto3" json:"model,omitempty"` } func (x *Relay) Reset() { @@ -1213,18 +1230,74 @@ func (x *Relay) GetCode() string { return "" } -func (x *Relay) GetType() Relay_Type { +func (x *Relay) GetModel() string { 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_rawDesc = []byte{ 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, 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, @@ -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, 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, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x73, 0x22, 0xab, 0x01, - 0x0a, 0x0f, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, - 0x73, 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, 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, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x73, 0x12, 0x24, 0x0a, + 0x06, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x52, 0x06, 0x72, 0x65, 0x6c, + 0x61, 0x79, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x0f, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, + 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x75, 0x72, 0x6e, 0x6f, + 0x75, 0x74, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x75, 0x72, + 0x6e, 0x6f, 0x75, 0x74, 0x49, 0x64, 0x73, 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, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x22, 0x8a, 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, + 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, 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, 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, - 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, 0x72, 0x74, 0x52, 0x0b, 0x63, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x4e, 0x0a, 0x11, 0x73, 0x77, 0x69, - 0x74, 0x63, 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x54, 0x75, 0x72, - 0x6e, 0x6f, 0x75, 0x74, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, - 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x11, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61, - 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6c, - 0x61, 0x79, 0x49, 0x64, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6c, - 0x61, 0x79, 0x49, 0x64, 0x73, 0x22, 0x42, 0x0a, 0x11, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, - 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, - 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x5a, 0x44, 0x4a, 0x39, 0x5f, - 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x5a, 0x44, 0x4a, 0x39, - 0x5f, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x10, 0x02, 0x22, 0x8d, 0x01, 0x0a, 0x06, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x6c, 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, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 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, 0x74, 0x75, - 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x0b, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 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, 0x1c, 0x0a, 0x09, 0x73, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0b, 0x74, 0x75, 0x72, - 0x6e, 0x6f, 0x75, 0x74, 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, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x53, - 0x0a, 0x05, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, - 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, - 0x65, 0x67, 0x72, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x64, 0x65, 0x67, - 0x72, 0x65, 0x65, 0x22, 0x60, 0x0a, 0x12, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, - 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x73, 0x12, 0x16, 0x0a, - 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x72, - 0x61, 0x64, 0x69, 0x75, 0x73, 0x22, 0x7c, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, - 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, - 0x31, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x0b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x04, 0x70, - 0x6f, 0x72, 0x74, 0x22, 0x7d, 0x0a, 0x09, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, - 0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x12, 0x2e, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x78, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, - 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x41, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x41, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, - 0x42, 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, 0x03, 0x6b, 0x6d, 0x42, 0x12, 0x1c, - 0x0a, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x22, 0x67, 0x0a, 0x05, - 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, - 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x22, 0x13, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, - 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x2a, 0xa7, 0x02, 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, 0x70, 0x65, 0x5f, 0x50, 0x68, 0x79, 0x73, 0x69, - 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10, 0x03, 0x12, - 0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x69, - 0x67, 0x6e, 0x61, 0x6c, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, - 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x5f, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x10, 0x06, 0x12, 0x21, 0x0a, 0x1d, 0x44, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, - 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x6e, 0x6b, 0x10, 0x08, - 0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, - 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x10, 0x0a, 0x2a, - 0x25, 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, 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, + 0x72, 0x74, 0x52, 0x0b, 0x63, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, + 0x4e, 0x0a, 0x11, 0x73, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x2e, 0x53, 0x77, 0x69, 0x74, 0x63, + 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x11, 0x73, 0x77, + 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x33, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x73, 0x22, 0x42, 0x0a, 0x11, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x4d, 0x61, + 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, + 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x5a, 0x44, 0x4a, 0x39, 0x5f, 0x53, + 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x5a, 0x44, 0x4a, 0x39, 0x5f, + 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x10, 0x02, 0x22, 0xc2, 0x01, 0x0a, 0x06, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x6c, 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, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 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, 0x74, 0x75, 0x72, + 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x33, 0x0a, 0x0b, 0x72, 0x65, 0x6c, 0x61, + 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x52, 0x0b, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x92, 0x01, + 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 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, + 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x33, 0x0a, + 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 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, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, + 0x72, 0x74, 0x22, 0x53, 0x0a, 0x05, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b, + 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x73, 0x12, + 0x16, 0x0a, 0x06, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x22, 0x60, 0x0a, 0x12, 0x53, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, + 0x03, 0x6b, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, + 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x22, 0x7c, 0x0a, 0x0a, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, + 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x6f, 0x72, + 0x74, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x7d, 0x0a, 0x09, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x6f, + 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, + 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x2e, 0x0a, 0x09, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x64, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x78, 0x0a, 0x10, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, + 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, + 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d, 0x41, 0x12, 0x22, + 0x0a, 0x03, 0x6b, 0x6d, 0x42, 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, 0x03, 0x6b, + 0x6d, 0x42, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65, 0x6e, 0x64, + 0x22, 0x57, 0x0a, 0x05, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x22, 0x14, 0x0a, 0x05, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x0b, 0x0a, 0x07, + 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x22, 0x3c, 0x0a, 0x0a, 0x52, 0x65, 0x6c, + 0x61, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, + 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x72, + 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x73, 0x2a, 0xa7, 0x02, 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, 0x70, 0x65, 0x5f, 0x50, 0x68, 0x79, + 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x19, + 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10, + 0x03, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, + 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, + 0x65, 0x72, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x5f, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x10, 0x06, 0x12, 0x21, 0x0a, 0x1d, 0x44, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x10, 0x07, 0x12, 0x13, 0x0a, + 0x0f, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x6e, 0x6b, + 0x10, 0x08, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x5f, 0x4c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x10, + 0x0a, 0x2a, 0x25, 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, 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 ( @@ -1407,14 +1490,14 @@ func file_model_proto_rawDescGZIP() []byte { } 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{}{ (DeviceType)(0), // 0: model.DeviceType (Port)(0), // 1: model.Port (Direction)(0), // 2: model.Direction (CheckPointType)(0), // 3: model.CheckPointType (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 (*PhysicalSection)(nil), // 7: model.PhysicalSection (*CheckPoint)(nil), // 8: model.CheckPoint @@ -1427,6 +1510,7 @@ var file_model_proto_goTypes = []interface{}{ (*Kilometer)(nil), // 15: model.Kilometer (*KilometerConvert)(nil), // 16: model.KilometerConvert (*Relay)(nil), // 17: model.Relay + (*RelayGroup)(nil), // 18: model.RelayGroup } var file_model_proto_depIdxs = []int32{ 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 13, // 6: model.Repository.sectionalCurvatures:type_name -> model.SectionalCurvature 16, // 7: model.Repository.kilometerConverts:type_name -> model.KilometerConvert - 14, // 8: model.PhysicalSection.aDevicePort:type_name -> model.DevicePort - 14, // 9: model.PhysicalSection.bDevicePort:type_name -> model.DevicePort - 15, // 10: model.CheckPoint.km:type_name -> model.Kilometer - 3, // 11: model.CheckPoint.type:type_name -> model.CheckPointType - 14, // 12: model.CheckPoint.devicePorts:type_name -> model.DevicePort - 15, // 13: model.Turnout.km:type_name -> model.Kilometer - 14, // 14: model.Turnout.aDevicePort:type_name -> model.DevicePort - 14, // 15: model.Turnout.bDevicePort:type_name -> model.DevicePort - 14, // 16: model.Turnout.cDevicePort:type_name -> model.DevicePort - 4, // 17: model.Turnout.switchMachineType:type_name -> model.Turnout.SwitchMachineType - 15, // 18: model.Signal.km:type_name -> model.Kilometer - 14, // 19: model.Signal.turnoutPort:type_name -> model.DevicePort - 15, // 20: model.Transponder.km:type_name -> model.Kilometer - 14, // 21: model.Transponder.turnoutPort:type_name -> model.DevicePort - 15, // 22: model.Slope.kms:type_name -> model.Kilometer - 15, // 23: model.SectionalCurvature.kms:type_name -> model.Kilometer - 0, // 24: model.DevicePort.deviceType:type_name -> model.DeviceType - 1, // 25: model.DevicePort.port:type_name -> model.Port - 2, // 26: model.Kilometer.direction:type_name -> model.Direction - 15, // 27: model.KilometerConvert.kmA:type_name -> model.Kilometer - 15, // 28: model.KilometerConvert.kmB:type_name -> model.Kilometer - 5, // 29: model.Relay.type:type_name -> model.Relay.Type - 30, // [30:30] is the sub-list for method output_type - 30, // [30:30] is the sub-list for method input_type - 30, // [30:30] is the sub-list for extension type_name - 30, // [30:30] is the sub-list for extension extendee - 0, // [0:30] is the sub-list for field type_name + 17, // 8: model.Repository.relays:type_name -> model.Relay + 14, // 9: model.PhysicalSection.aDevicePort:type_name -> model.DevicePort + 14, // 10: model.PhysicalSection.bDevicePort:type_name -> model.DevicePort + 15, // 11: model.CheckPoint.km:type_name -> model.Kilometer + 3, // 12: model.CheckPoint.type:type_name -> model.CheckPointType + 14, // 13: model.CheckPoint.devicePorts:type_name -> model.DevicePort + 15, // 14: model.Turnout.km:type_name -> model.Kilometer + 14, // 15: model.Turnout.aDevicePort:type_name -> model.DevicePort + 14, // 16: model.Turnout.bDevicePort:type_name -> model.DevicePort + 14, // 17: model.Turnout.cDevicePort:type_name -> model.DevicePort + 4, // 18: model.Turnout.switchMachineType:type_name -> model.Turnout.SwitchMachineType + 18, // 19: model.Turnout.relayGroups:type_name -> model.RelayGroup + 15, // 20: model.Signal.km:type_name -> model.Kilometer + 14, // 21: model.Signal.turnoutPort:type_name -> model.DevicePort + 18, // 22: model.Signal.relayGroups:type_name -> model.RelayGroup + 15, // 23: model.Transponder.km:type_name -> model.Kilometer + 14, // 24: model.Transponder.turnoutPort:type_name -> model.DevicePort + 15, // 25: model.Slope.kms:type_name -> model.Kilometer + 15, // 26: model.SectionalCurvature.kms:type_name -> model.Kilometer + 0, // 27: model.DevicePort.deviceType:type_name -> model.DeviceType + 1, // 28: model.DevicePort.port:type_name -> model.Port + 2, // 29: model.Kilometer.direction:type_name -> model.Direction + 15, // 30: model.KilometerConvert.kmA:type_name -> model.Kilometer + 15, // 31: model.KilometerConvert.kmB:type_name -> model.Kilometer + 32, // [32:32] is the sub-list for method output_type + 32, // [32:32] is the sub-list for method input_type + 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() } @@ -1616,6 +1702,18 @@ func file_model_proto_init() { 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{} out := protoimpl.TypeBuilder{ @@ -1623,7 +1721,7 @@ func file_model_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_model_proto_rawDesc, NumEnums: 6, - NumMessages: 12, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/repository/physical_section.go b/repository/physical_section.go index b727c6a..8dd4ad4 100644 --- a/repository/physical_section.go +++ b/repository/physical_section.go @@ -3,6 +3,7 @@ package repository import ( "errors" "fmt" + "joylink.club/rtsssimulation/repository/model/proto" ) @@ -68,6 +69,14 @@ func (s *PhysicalSection) BRelation() DevicePort { 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 { _, isSectionPort := devicePort.(*PhysicalSectionPort) _, isTurnoutPort := devicePort.(*TurnoutPort) diff --git a/repository/relay.go b/repository/relay.go new file mode 100644 index 0000000..d7ece25 --- /dev/null +++ b/repository/relay.go @@ -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 +} diff --git a/repository/repository.go b/repository/repository.go index 88d68de..9d049ec 100644 --- a/repository/repository.go +++ b/repository/repository.go @@ -16,21 +16,16 @@ type Repository struct { responderMap map[string]*Transponder slopeMap map[string]*Slope sectionalCurvatureMap map[string]*SectionalCurvature + kilometerConvertMap map[string]*proto.KilometerConvert + relayMap map[string]*Relay 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 { return &Repository{ - id: id, - version: version, - //modelMap: make(map[string]model.Identity), + id: id, + version: version, physicalSectionMap: make(map[string]*PhysicalSection), checkPointMap: make(map[string]*CheckPoint), turnoutMap: make(map[string]*Turnout), @@ -38,12 +33,9 @@ func newRepository(id string, version string) *Repository { responderMap: make(map[string]*Transponder), slopeMap: make(map[string]*Slope), sectionalCurvatureMap: make(map[string]*SectionalCurvature), + kilometerConvertMap: make(map[string]*proto.KilometerConvert), + relayMap: make(map[string]*Relay), 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), } } @@ -110,6 +102,13 @@ func (repo *Repository) KilometerConvertList() []*proto.KilometerConvert { } 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) { switch deviceType { diff --git a/repository/repository_manager.go b/repository/repository_manager.go index 4b9faf5..b8cbeb4 100644 --- a/repository/repository_manager.go +++ b/repository/repository_manager.go @@ -74,6 +74,10 @@ func buildModels(source *proto.Repository, repository *Repository) { m := NewSectionalCurvature(protoData.Id, protoData.Kms, protoData.Radius) 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 { @@ -211,6 +215,17 @@ func buildTurnoutRelationShip(source *proto.Repository, repo *Repository) error if err != nil { 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 } diff --git a/repository/turnout.go b/repository/turnout.go index 7181c53..64d21e1 100644 --- a/repository/turnout.go +++ b/repository/turnout.go @@ -3,6 +3,7 @@ package repository import ( "errors" "fmt" + "joylink.club/rtsssimulation/repository/model/proto" ) @@ -40,6 +41,8 @@ type Turnout struct { aDevices []Identity bDevices []Identity cDevices []Identity + + relayGroups []*RelayGroup } 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 } +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 { turnout *Turnout port proto.Port diff --git a/system/model_umi.go b/system/model_umi.go index 5fcbdff..4631cb1 100644 --- a/system/model_umi.go +++ b/system/model_umi.go @@ -27,17 +27,4 @@ type IModelManager = repository.IModelManager // IPsdModel 仿真底层屏蔽门模型 // 用户所有屏蔽门模型定义须实现该接口 -type IPsdModel interface { - //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 -} +type IPsdModel = repository.IPsdModel diff --git a/system/psd_system.go b/system/psd_system.go index af7aa34..d3cf646 100644 --- a/system/psd_system.go +++ b/system/psd_system.go @@ -3,12 +3,11 @@ package system import ( "github.com/yohamta/donburi/filter" "joylink.club/ecs" - sysEvent "joylink.club/rtsssimulation/system/event" ) -// StationPsdsCircuitState 站台门控制电路状态 +// PsdCircuitState 站台门控制电路状态,Psd为车站所有屏蔽门子门的集合 // 旁路继电器的工作原理是,当电路中的电流超过预定的阈值时,旁路继电器会自动断开电路,从而防止电路发生短路或过载等故障。 -type StationPsdsCircuitState struct { +type PsdCircuitState struct { //关门继电器,true-吸合 XGMJ bool //4编组开门继电器,true-吸合 @@ -19,6 +18,8 @@ type StationPsdsCircuitState struct { XMGJ bool //门旁路继电器,true-吸合 XMPLJ bool + //车站下行侧屏蔽门开门码 + XOpenCode OpenCode //关门继电器,true-吸合 SGMJ bool //4编组开门继电器,true-吸合 @@ -29,65 +30,84 @@ type StationPsdsCircuitState struct { SMGJ bool //门旁路继电器,true-吸合 SMPLJ bool + //车站上行侧屏蔽门开门码 + SOpenCode OpenCode } -// PsdState 站台一侧屏蔽门由多个Psd构成 -type PsdState struct { +// PsdCellState 车站屏蔽门子门 +type PsdCellState struct { //屏蔽门打开的百分比,则0-完全关闭,100-完全打开 - Rate int + Rate int8 //关门操作被激活 actClosing bool //开门操作被激活 actOpening bool } -// PsdTagHandler 屏蔽门标签,用于ecs query -type PsdTagHandler struct { - //上行标签 - STag EntityTag - //上行4编组标签 - S4Tag EntityTag - //上行8编组标签 - S8Tag EntityTag - //下行标签 - XTag EntityTag - //下行4编组标签 - X4Tag EntityTag - //下行8编组标签 - X8Tag EntityTag +// PsdTags 屏蔽门标签 +type PsdTags struct { + STag EntityTag //上行侧屏蔽门子门标签 + S4KmUpTag EntityTag //上行侧4编组运行方向上行时屏蔽门子门标签 + S4KmDownTag EntityTag //上行侧4编组运行方向下行时屏蔽门子门标签 + S8KmUpTag EntityTag //上行侧8编组运行方向上行时屏蔽门子门标签 + S8KmDownTag EntityTag //上行侧8编组运行方向下行时屏蔽门子门标签 + XTag EntityTag + X4KmUpTag EntityTag + X4KmDownTag EntityTag + X8KmUpTag 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 { - return &StationPsdsCircuitSystem{} -} -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} +// PsdsCircuitSystem 站台门电路系统 +type PsdsCircuitSystem struct { } -var StationPsdsCircuitStateComponent = ecs.NewComponentType[StationPsdsCircuitState]() -var PsdTagHandlerComponent = ecs.NewComponentType[PsdTagHandler]() -var PsdStateComponent = ecs.NewComponentType[PsdState]() -var psdsQuery = ecs.NewQuery(filter.Contains(PsdStateComponent, PercentageDeviceStateComponent)) -var psdsCircuitQuery = ecs.NewQuery(filter.Contains(StationPsdsCircuitStateComponent)) +func NewPsdsCircuitSystem() *PsdsCircuitSystem { + return &PsdsCircuitSystem{} +} +func NewPsdTags() *PsdTags { + 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 ( - PSD_CLOSED int64 = 0 //psd 完全关闭 - PSD_OPENED int64 = 2000 //psd 完全打开 + OpenCodeNon OpenCode = iota //无效开门码 + OpenCodeUp //运行方向为上行的开门码 + OpenCodeDown //运行方向为下行的开门码 ) const ( - PSD_CLOSED_RATE = 0 - PSD_OPENED_RATE = 100 + PsdCellRateClosed int8 = 0 + PsdCellRateOpened int8 = 100 ) // PSD组合类型和继电器功能名称 @@ -106,79 +126,205 @@ const ( ) // Update world 执行 -func (me *StationPsdsCircuitSystem) Update(w ecs.World) { - me.psdUpdate(w) - me.circuitUpdate(w) -} - -// 车站上下行屏蔽门电路运算 -func (me *StationPsdsCircuitSystem) circuitUpdate(w ecs.World) { - psdsCircuitQuery.Each(w, func(e *ecs.Entry) { - me.calculateMG(w, e) - me.calculateActGM(w, e) +func (me *PsdsCircuitSystem) Update(w ecs.World) { + // + psdCellQuery.Each(w, func(cellEntry *ecs.Entry) { + me.calculateCellMove(w, cellEntry) + }) + // + psdCircuitQuery.Each(w, func(psdCircuitEntry *ecs.Entry) { + me.calculateSMG(w, psdCircuitEntry) + me.calculateXMG(w, psdCircuitEntry) + me.calculateSGM(w, psdCircuitEntry) + me.calculateXGM(w, psdCircuitEntry) + me.calculate4SKM(w, psdCircuitEntry) + me.calculate4XKM(w, psdCircuitEntry) + me.calculate8SKM(w, psdCircuitEntry) + me.calculate8XKM(w, psdCircuitEntry) }) } -// 关门动作运算 -func (me *StationPsdsCircuitSystem) calculateActGM(w ecs.World, circuitEntry *ecs.Entry) { - circuit := StationPsdsCircuitStateComponent.Get(circuitEntry) - tags := PsdTagHandlerComponent.Get(circuitEntry) - //上行 - isActSGm := circuit.SGMJ && !circuit.G4SKMJ && !circuit.G8SKMJ - sQuery := ecs.NewQuery(filter.Contains(tags.STag)) - sQuery.Each(w, func(sPsd *ecs.Entry) { - sPsdState := PsdStateComponent.Get(sPsd) - sPsdState.actClosing = isActSGm - }) - //下行 - isActXGm := circuit.XGMJ && !circuit.G4XKMJ && !circuit.G8XKMJ - xQuery := ecs.NewQuery(filter.Contains(tags.XTag)) - xQuery.Each(w, func(xPsd *ecs.Entry) { - xPsdState := PsdStateComponent.Get(xPsd) - xPsdState.actClosing = isActXGm - }) -} - -// 4编组开门动作运算 -func (me *StationPsdsCircuitSystem) calculateAct4KM(w ecs.World, circuitEntry *ecs.Entry) { - -} - -// 门关状态运算 -func (me *StationPsdsCircuitSystem) calculateMG(w ecs.World, circuitEntry *ecs.Entry) { - tags := PsdTagHandlerComponent.Get(circuitEntry) - circuit := StationPsdsCircuitStateComponent.Get(circuitEntry) - //上行 - isSMg := true - sQuery := ecs.NewQuery(filter.Contains(tags.STag)) - sQuery.Each(w, func(sPsd *ecs.Entry) { - if isSMg { - isSMg = PsdStateComponent.Get(sPsd).Rate == PSD_CLOSED_RATE - } - }) - if isSMg != circuit.SMGJ { - if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(circuitEntry).Id, PSD_GT, PSD_SMGJ, isSMg); ok { - sysEvent.RelayNeedChangeEventBus.Publish(w, event) +// 屏蔽门子门移动运算,暂定门从全关到全开耗时2000ms,则v=50/ms +func (me *PsdsCircuitSystem) calculateCellMove(w ecs.World, cellEntry *ecs.Entry) { + move := PercentageDeviceStateComponent.Get(cellEntry) + cell := PsdCellStateComponent.Get(cellEntry) + cell.Rate = move.GetRate() + if cell.actOpening { + move.V = 50 + if cell.Rate >= PsdCellRateOpened { //开门到位 + move.V = 0 } } - //下行 - isXMg := true - xQuery := ecs.NewQuery(filter.Contains(tags.XTag)) - xQuery.Each(w, func(xPsd *ecs.Entry) { - if isXMg { - isXMg = PsdStateComponent.Get(xPsd).Rate == PSD_CLOSED_RATE + if cell.actClosing { + move.V = -50 + if cell.Rate <= PsdCellRateClosed { //关门到位 + move.V = 0 + } + } + if !cell.actOpening && !cell.actClosing { + move.V = 0 + } +} + +// 车站屏蔽门电路系统继电器励磁运算 ????????-----信息缺失 +func (me *PsdsCircuitSystem) calculateRelayLc(w ecs.World, psdCircuitEntry *ecs.Entry) { + //psd := PsdCircuitStateComponent.Get(psdCircuitEntry) + // + +} + +// 车站上行侧所有屏蔽门子门关运算 +func (me *PsdsCircuitSystem) calculateSMG(w ecs.World, psdCircuitEntry *ecs.Entry) { + tags := PsdTagsComponent.Get(psdCircuitEntry) + isSMG := true + tags.psdCellsQuery(tags.STag).Each(w, func(cellEntry *ecs.Entry) { + if isSMG { + cell := PsdCellStateComponent.Get(cellEntry) + isSMG = cell.Rate <= PsdCellRateClosed } }) - if isXMg != circuit.XMGJ { - if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(circuitEntry).Id, PSD_GT, PSD_XMGJ, isSMg); ok { - sysEvent.RelayNeedChangeEventBus.Publish(w, event) + PsdCircuitStateComponent.Get(psdCircuitEntry).SMGJ = isSMG +} + +// 车站下行侧所有屏蔽门子门关运算 +func (me *PsdsCircuitSystem) calculateXMG(w ecs.World, psdCircuitEntry *ecs.Entry) { + tags := PsdTagsComponent.Get(psdCircuitEntry) + isXMG := true + tags.psdCellsQuery(tags.XTag).Each(w, func(cellEntry *ecs.Entry) { + if isXMG { + cell := PsdCellStateComponent.Get(cellEntry) + isXMG = cell.Rate <= PsdCellRateClosed + } + }) + PsdCircuitStateComponent.Get(psdCircuitEntry).XMGJ = isXMG +} + +// 车站上行侧关门操作运算 +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 + }) + } } } } -////////////////////////////////////////////////////////////////////// - -// 单个屏蔽门运算 -func (me *StationPsdsCircuitSystem) psdUpdate(w ecs.World) { - +// 车站下行侧4编组开门操作运算 +func (me *PsdsCircuitSystem) calculate4XKM(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.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 + }) + } + } + } }