diff --git a/examples/test1/sjzdj9/main.go b/examples/test1/sjzdj9/main.go index cf21134..3bed4f8 100644 --- a/examples/test1/sjzdj9/main.go +++ b/examples/test1/sjzdj9/main.go @@ -16,6 +16,7 @@ import ( // Test 测试双机ZDJ9道岔 func Test() { + system.XXDebug = true //模型仓库 modelStorage := tstorages.NewModelStorage() addRelays(modelStorage) diff --git a/proto/main.go b/proto/main.go index 2c9f5dc..b819c31 100644 --- a/proto/main.go +++ b/proto/main.go @@ -29,7 +29,6 @@ func main() { goOutDir = "../" } } - } // protoFiles := getProtoFiles() diff --git a/proto/src/model.proto b/proto/src/model.proto index 048340b..1af0546 100644 --- a/proto/src/model.proto +++ b/proto/src/model.proto @@ -16,6 +16,7 @@ message Repository { repeated SectionalCurvature sectionalCurvatures = 9; repeated KilometerConvert kilometerConverts = 10; repeated Relay relays = 11; + repeated PhaseFailureProtector phaseFailureProtectors = 12; } //物理区段 @@ -47,7 +48,7 @@ message Turnout { DevicePort bDevicePort = 4; DevicePort cDevicePort = 5; SwitchMachineType switchMachineType = 6; - repeated RelayGroup relayGroups = 7; //关联的继电器组 + repeated ElectronicComponentGroup electronicComponentGroups = 7; //关联的电子元件组合 } //信号机 @@ -56,7 +57,7 @@ message Signal { Kilometer km = 2; string sectionId = 3; //关联的区段 DevicePort turnoutPort = 4; //关联的区段端口 - repeated RelayGroup relayGroups = 7; //关联的继电器组 + repeated ElectronicComponentGroup electronicComponentGroups = 7; //关联的继电器组 } //应答器 @@ -100,6 +101,7 @@ enum DeviceType { DeviceType_Link = 8; DeviceType_LinkNode = 9; DeviceType_Relay = 10; + DeviceType_PhaseFailureProtector = 11; } enum Port { @@ -140,14 +142,28 @@ enum CheckPointType{ message Relay { enum Model { Unknown = 0; + JPXC_1000 = 1; + JPXC_1700 = 2; + JWJXC_480 = 3; + JWJXC_H125_80 = 4; + JWXC_1700 = 5; + JWXC_H340 = 6; + JYJXC_160_260 = 7; + JZXC_H18 = 8; } string id = 1; string code = 2; - string model = 3; + Model model = 3; } -//继电器组合 -message RelayGroup { +//断相保护器 +message PhaseFailureProtector { + string id = 1; + string code = 2; +} + +//电子元件组合 +message ElectronicComponentGroup { string code = 1; //组合的编号(名称) - repeated string relayIds = 2; //组合内继电器的id + repeated string componentIds = 2; //组合内电子元件的id } \ No newline at end of file diff --git a/repository/electronic_component.go b/repository/electronic_component.go new file mode 100644 index 0000000..b2c82ff --- /dev/null +++ b/repository/electronic_component.go @@ -0,0 +1,59 @@ +package repository + +import "joylink.club/rtsssimulation/repository/model/proto" + +// Relay 继电器 +type Relay struct { + Identity + code string + model proto.Relay_Model +} + +func newRelay(id string, code string, model proto.Relay_Model) *Relay { + return &Relay{ + Identity: identity{ + id: id, + deviceType: proto.DeviceType_DeviceType_Relay, + }, + code: code, + model: model, + } +} + +func (r *Relay) Code() string { + return r.code +} + +func (r *Relay) Model() proto.Relay_Model { + return r.model +} + +// ElectronicComponentGroup 电子元件组合 +type ElectronicComponentGroup struct { + code string + components []Identity +} + +func (r *ElectronicComponentGroup) Code() string { + return r.code +} + +func (r *ElectronicComponentGroup) Components() []Identity { + return r.components +} + +// PhaseFailureProtector 断相保护器 +type PhaseFailureProtector struct { + Identity + code string +} + +func newPhaseFailureProtector(id string, code string) *PhaseFailureProtector { + return &PhaseFailureProtector{ + Identity: identity{ + id: id, + deviceType: proto.DeviceType_DeviceType_PhaseFailureProtector, + }, + code: code, + } +} diff --git a/repository/model/proto/model.pb.go b/repository/model/proto/model.pb.go index a956cc5..e321fcd 100644 --- a/repository/model/proto/model.pb.go +++ b/repository/model/proto/model.pb.go @@ -23,17 +23,18 @@ const ( type DeviceType int32 const ( - DeviceType_DeviceType_Unknown DeviceType = 0 - DeviceType_DeviceType_PhysicalSection DeviceType = 1 - DeviceType_DeviceType_CheckPoint DeviceType = 2 - DeviceType_DeviceType_Turnout DeviceType = 3 - DeviceType_DeviceType_Signal DeviceType = 4 - DeviceType_DeviceType_Transponder DeviceType = 5 - DeviceType_DeviceType_Slope DeviceType = 6 - DeviceType_DeviceType_SectionalCurvature DeviceType = 7 - DeviceType_DeviceType_Link DeviceType = 8 - DeviceType_DeviceType_LinkNode DeviceType = 9 - DeviceType_DeviceType_Relay DeviceType = 10 + DeviceType_DeviceType_Unknown DeviceType = 0 + DeviceType_DeviceType_PhysicalSection DeviceType = 1 + DeviceType_DeviceType_CheckPoint DeviceType = 2 + DeviceType_DeviceType_Turnout DeviceType = 3 + DeviceType_DeviceType_Signal DeviceType = 4 + DeviceType_DeviceType_Transponder DeviceType = 5 + DeviceType_DeviceType_Slope DeviceType = 6 + DeviceType_DeviceType_SectionalCurvature DeviceType = 7 + DeviceType_DeviceType_Link DeviceType = 8 + DeviceType_DeviceType_LinkNode DeviceType = 9 + DeviceType_DeviceType_Relay DeviceType = 10 + DeviceType_DeviceType_PhaseFailureProtector DeviceType = 11 ) // Enum value maps for DeviceType. @@ -50,19 +51,21 @@ var ( 8: "DeviceType_Link", 9: "DeviceType_LinkNode", 10: "DeviceType_Relay", + 11: "DeviceType_PhaseFailureProtector", } DeviceType_value = map[string]int32{ - "DeviceType_Unknown": 0, - "DeviceType_PhysicalSection": 1, - "DeviceType_CheckPoint": 2, - "DeviceType_Turnout": 3, - "DeviceType_Signal": 4, - "DeviceType_Transponder": 5, - "DeviceType_Slope": 6, - "DeviceType_SectionalCurvature": 7, - "DeviceType_Link": 8, - "DeviceType_LinkNode": 9, - "DeviceType_Relay": 10, + "DeviceType_Unknown": 0, + "DeviceType_PhysicalSection": 1, + "DeviceType_CheckPoint": 2, + "DeviceType_Turnout": 3, + "DeviceType_Signal": 4, + "DeviceType_Transponder": 5, + "DeviceType_Slope": 6, + "DeviceType_SectionalCurvature": 7, + "DeviceType_Link": 8, + "DeviceType_LinkNode": 9, + "DeviceType_Relay": 10, + "DeviceType_PhaseFailureProtector": 11, } ) @@ -294,16 +297,40 @@ func (Turnout_SwitchMachineType) EnumDescriptor() ([]byte, []int) { type Relay_Model int32 const ( - Relay_Unknown Relay_Model = 0 + Relay_Unknown Relay_Model = 0 + Relay_JPXC_1000 Relay_Model = 1 + Relay_JPXC_1700 Relay_Model = 2 + Relay_JWJXC_480 Relay_Model = 3 + Relay_JWJXC_H125_80 Relay_Model = 4 + Relay_JWXC_1700 Relay_Model = 5 + Relay_JWXC_H340 Relay_Model = 6 + Relay_JYJXC_160_260 Relay_Model = 7 + Relay_JZXC_H18 Relay_Model = 8 ) // Enum value maps for Relay_Model. var ( Relay_Model_name = map[int32]string{ 0: "Unknown", + 1: "JPXC_1000", + 2: "JPXC_1700", + 3: "JWJXC_480", + 4: "JWJXC_H125_80", + 5: "JWXC_1700", + 6: "JWXC_H340", + 7: "JYJXC_160_260", + 8: "JZXC_H18", } Relay_Model_value = map[string]int32{ - "Unknown": 0, + "Unknown": 0, + "JPXC_1000": 1, + "JPXC_1700": 2, + "JWJXC_480": 3, + "JWJXC_H125_80": 4, + "JWXC_1700": 5, + "JWXC_H340": 6, + "JYJXC_160_260": 7, + "JZXC_H18": 8, } ) @@ -339,17 +366,18 @@ type Repository struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - PhysicalSections []*PhysicalSection `protobuf:"bytes,3,rep,name=physicalSections,proto3" json:"physicalSections,omitempty"` - CheckPoints []*CheckPoint `protobuf:"bytes,4,rep,name=checkPoints,proto3" json:"checkPoints,omitempty"` - Turnouts []*Turnout `protobuf:"bytes,5,rep,name=turnouts,proto3" json:"turnouts,omitempty"` - Signals []*Signal `protobuf:"bytes,6,rep,name=signals,proto3" json:"signals,omitempty"` - Transponders []*Transponder `protobuf:"bytes,7,rep,name=transponders,proto3" json:"transponders,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"` - KilometerConverts []*KilometerConvert `protobuf:"bytes,10,rep,name=kilometerConverts,proto3" json:"kilometerConverts,omitempty"` - Relays []*Relay `protobuf:"bytes,11,rep,name=relays,proto3" json:"relays,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + PhysicalSections []*PhysicalSection `protobuf:"bytes,3,rep,name=physicalSections,proto3" json:"physicalSections,omitempty"` + CheckPoints []*CheckPoint `protobuf:"bytes,4,rep,name=checkPoints,proto3" json:"checkPoints,omitempty"` + Turnouts []*Turnout `protobuf:"bytes,5,rep,name=turnouts,proto3" json:"turnouts,omitempty"` + Signals []*Signal `protobuf:"bytes,6,rep,name=signals,proto3" json:"signals,omitempty"` + Transponders []*Transponder `protobuf:"bytes,7,rep,name=transponders,proto3" json:"transponders,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"` + KilometerConverts []*KilometerConvert `protobuf:"bytes,10,rep,name=kilometerConverts,proto3" json:"kilometerConverts,omitempty"` + Relays []*Relay `protobuf:"bytes,11,rep,name=relays,proto3" json:"relays,omitempty"` + PhaseFailureProtectors []*PhaseFailureProtector `protobuf:"bytes,12,rep,name=phaseFailureProtectors,proto3" json:"phaseFailureProtectors,omitempty"` } func (x *Repository) Reset() { @@ -461,6 +489,13 @@ func (x *Repository) GetRelays() []*Relay { return nil } +func (x *Repository) GetPhaseFailureProtectors() []*PhaseFailureProtector { + if x != nil { + return x.PhaseFailureProtectors + } + return nil +} + // 物理区段 type PhysicalSection struct { state protoimpl.MessageState @@ -611,13 +646,13 @@ type Turnout 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"` - ADevicePort *DevicePort `protobuf:"bytes,3,opt,name=aDevicePort,proto3" json:"aDevicePort,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"` - SwitchMachineType Turnout_SwitchMachineType `protobuf:"varint,6,opt,name=switchMachineType,proto3,enum=model.Turnout_SwitchMachineType" json:"switchMachineType,omitempty"` - RelayGroups []*RelayGroup `protobuf:"bytes,7,rep,name=relayGroups,proto3" json:"relayGroups,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"` + ADevicePort *DevicePort `protobuf:"bytes,3,opt,name=aDevicePort,proto3" json:"aDevicePort,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"` + SwitchMachineType Turnout_SwitchMachineType `protobuf:"varint,6,opt,name=switchMachineType,proto3,enum=model.Turnout_SwitchMachineType" json:"switchMachineType,omitempty"` + ElectronicComponentGroups []*ElectronicComponentGroup `protobuf:"bytes,7,rep,name=electronicComponentGroups,proto3" json:"electronicComponentGroups,omitempty"` //关联的电子元件组合 } func (x *Turnout) Reset() { @@ -694,9 +729,9 @@ func (x *Turnout) GetSwitchMachineType() Turnout_SwitchMachineType { return Turnout_Unknown } -func (x *Turnout) GetRelayGroups() []*RelayGroup { +func (x *Turnout) GetElectronicComponentGroups() []*ElectronicComponentGroup { if x != nil { - return x.RelayGroups + return x.ElectronicComponentGroups } return nil } @@ -707,11 +742,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"` //关联的区段端口 - RelayGroups []*RelayGroup `protobuf:"bytes,7,rep,name=relayGroups,proto3" json:"relayGroups,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"` //关联的区段端口 + ElectronicComponentGroups []*ElectronicComponentGroup `protobuf:"bytes,7,rep,name=electronicComponentGroups,proto3" json:"electronicComponentGroups,omitempty"` //关联的继电器组 } func (x *Signal) Reset() { @@ -774,9 +809,9 @@ func (x *Signal) GetTurnoutPort() *DevicePort { return nil } -func (x *Signal) GetRelayGroups() []*RelayGroup { +func (x *Signal) GetElectronicComponentGroups() []*ElectronicComponentGroup { if x != nil { - return x.RelayGroups + return x.ElectronicComponentGroups } return nil } @@ -1179,9 +1214,9 @@ type Relay struct { 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"` - Model string `protobuf:"bytes,3,opt,name=model,proto3" json:"model,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 Relay_Model `protobuf:"varint,3,opt,name=model,proto3,enum=model.Relay_Model" json:"model,omitempty"` } func (x *Relay) Reset() { @@ -1230,25 +1265,25 @@ func (x *Relay) GetCode() string { return "" } -func (x *Relay) GetModel() string { +func (x *Relay) GetModel() Relay_Model { if x != nil { return x.Model } - return "" + return Relay_Unknown } -// 继电器组合 -type RelayGroup struct { +// 断相保护器 +type PhaseFailureProtector 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 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"` } -func (x *RelayGroup) Reset() { - *x = RelayGroup{} +func (x *PhaseFailureProtector) Reset() { + *x = PhaseFailureProtector{} if protoimpl.UnsafeEnabled { mi := &file_model_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1256,13 +1291,13 @@ func (x *RelayGroup) Reset() { } } -func (x *RelayGroup) String() string { +func (x *PhaseFailureProtector) String() string { return protoimpl.X.MessageStringOf(x) } -func (*RelayGroup) ProtoMessage() {} +func (*PhaseFailureProtector) ProtoMessage() {} -func (x *RelayGroup) ProtoReflect() protoreflect.Message { +func (x *PhaseFailureProtector) ProtoReflect() protoreflect.Message { mi := &file_model_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1274,21 +1309,77 @@ func (x *RelayGroup) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use RelayGroup.ProtoReflect.Descriptor instead. -func (*RelayGroup) Descriptor() ([]byte, []int) { +// Deprecated: Use PhaseFailureProtector.ProtoReflect.Descriptor instead. +func (*PhaseFailureProtector) Descriptor() ([]byte, []int) { return file_model_proto_rawDescGZIP(), []int{12} } -func (x *RelayGroup) GetCode() string { +func (x *PhaseFailureProtector) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PhaseFailureProtector) GetCode() string { if x != nil { return x.Code } return "" } -func (x *RelayGroup) GetRelayIds() []string { +// 电子元件组合 +type ElectronicComponentGroup struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` //组合的编号(名称) + ComponentIds []string `protobuf:"bytes,2,rep,name=componentIds,proto3" json:"componentIds,omitempty"` //组合内电子元件的id +} + +func (x *ElectronicComponentGroup) Reset() { + *x = ElectronicComponentGroup{} + if protoimpl.UnsafeEnabled { + mi := &file_model_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ElectronicComponentGroup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ElectronicComponentGroup) ProtoMessage() {} + +func (x *ElectronicComponentGroup) ProtoReflect() protoreflect.Message { + mi := &file_model_proto_msgTypes[13] + 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 ElectronicComponentGroup.ProtoReflect.Descriptor instead. +func (*ElectronicComponentGroup) Descriptor() ([]byte, []int) { + return file_model_proto_rawDescGZIP(), []int{13} +} + +func (x *ElectronicComponentGroup) GetCode() string { if x != nil { - return x.RelayIds + return x.Code + } + return "" +} + +func (x *ElectronicComponentGroup) GetComponentIds() []string { + if x != nil { + return x.ComponentIds } return nil } @@ -1297,7 +1388,7 @@ 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, 0x9c, 0x04, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x6f, 0x64, 0x65, 0x6c, 0x22, 0xf2, 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, @@ -1331,54 +1422,62 @@ var file_model_proto_rawDesc = []byte{ 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, 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, + 0x61, 0x79, 0x73, 0x12, 0x54, 0x0a, 0x16, 0x70, 0x68, 0x61, 0x73, 0x65, 0x46, 0x61, 0x69, 0x6c, + 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x0c, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x68, 0x61, 0x73, + 0x65, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x6f, + 0x72, 0x52, 0x16, 0x70, 0x68, 0x61, 0x73, 0x65, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x50, + 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 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, 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, 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, + 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, 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, 0xcd, 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, 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, 0x5d, 0x0a, 0x19, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, + 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x2e, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x19, 0x65, 0x6c, 0x65, 0x63, 0x74, + 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 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, + 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x10, 0x02, 0x22, 0xec, 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, @@ -1387,94 +1486,113 @@ var file_model_proto_rawDesc = []byte{ 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, + 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x5d, 0x0a, 0x19, 0x65, 0x6c, 0x65, 0x63, + 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x2e, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x19, 0x65, 0x6c, + 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, + 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 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, 0xeb, 0x01, 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, 0x28, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, + 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x05, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x22, 0x93, 0x01, 0x0a, 0x05, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x0b, 0x0a, 0x07, + 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x50, 0x58, + 0x43, 0x5f, 0x31, 0x30, 0x30, 0x30, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x50, 0x58, 0x43, + 0x5f, 0x31, 0x37, 0x30, 0x30, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x57, 0x4a, 0x58, 0x43, + 0x5f, 0x34, 0x38, 0x30, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x4a, 0x57, 0x4a, 0x58, 0x43, 0x5f, + 0x48, 0x31, 0x32, 0x35, 0x5f, 0x38, 0x30, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x57, 0x58, + 0x43, 0x5f, 0x31, 0x37, 0x30, 0x30, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x57, 0x58, 0x43, + 0x5f, 0x48, 0x33, 0x34, 0x30, 0x10, 0x06, 0x12, 0x11, 0x0a, 0x0d, 0x4a, 0x59, 0x4a, 0x58, 0x43, + 0x5f, 0x31, 0x36, 0x30, 0x5f, 0x32, 0x36, 0x30, 0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08, 0x4a, 0x5a, + 0x58, 0x43, 0x5f, 0x48, 0x31, 0x38, 0x10, 0x08, 0x22, 0x3b, 0x0a, 0x15, 0x50, 0x68, 0x61, 0x73, + 0x65, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x6f, + 0x72, 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, 0x22, 0x52, 0x0a, 0x18, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, + 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 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, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, + 0x6e, 0x74, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6d, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x73, 0x2a, 0xcd, 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, 0x12, 0x24, 0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x5f, 0x50, 0x68, 0x61, 0x73, 0x65, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x10, 0x0b, 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 ( @@ -1490,27 +1608,28 @@ func file_model_proto_rawDescGZIP() []byte { } var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 6) -var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 14) 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_Model)(0), // 5: model.Relay.Model - (*Repository)(nil), // 6: model.Repository - (*PhysicalSection)(nil), // 7: model.PhysicalSection - (*CheckPoint)(nil), // 8: model.CheckPoint - (*Turnout)(nil), // 9: model.Turnout - (*Signal)(nil), // 10: model.Signal - (*Transponder)(nil), // 11: model.Transponder - (*Slope)(nil), // 12: model.Slope - (*SectionalCurvature)(nil), // 13: model.SectionalCurvature - (*DevicePort)(nil), // 14: model.DevicePort - (*Kilometer)(nil), // 15: model.Kilometer - (*KilometerConvert)(nil), // 16: model.KilometerConvert - (*Relay)(nil), // 17: model.Relay - (*RelayGroup)(nil), // 18: model.RelayGroup + (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_Model)(0), // 5: model.Relay.Model + (*Repository)(nil), // 6: model.Repository + (*PhysicalSection)(nil), // 7: model.PhysicalSection + (*CheckPoint)(nil), // 8: model.CheckPoint + (*Turnout)(nil), // 9: model.Turnout + (*Signal)(nil), // 10: model.Signal + (*Transponder)(nil), // 11: model.Transponder + (*Slope)(nil), // 12: model.Slope + (*SectionalCurvature)(nil), // 13: model.SectionalCurvature + (*DevicePort)(nil), // 14: model.DevicePort + (*Kilometer)(nil), // 15: model.Kilometer + (*KilometerConvert)(nil), // 16: model.KilometerConvert + (*Relay)(nil), // 17: model.Relay + (*PhaseFailureProtector)(nil), // 18: model.PhaseFailureProtector + (*ElectronicComponentGroup)(nil), // 19: model.ElectronicComponentGroup } var file_model_proto_depIdxs = []int32{ 7, // 0: model.Repository.physicalSections:type_name -> model.PhysicalSection @@ -1522,34 +1641,36 @@ var file_model_proto_depIdxs = []int32{ 13, // 6: model.Repository.sectionalCurvatures:type_name -> model.SectionalCurvature 16, // 7: model.Repository.kilometerConverts:type_name -> model.KilometerConvert 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 + 18, // 9: model.Repository.phaseFailureProtectors:type_name -> model.PhaseFailureProtector + 14, // 10: model.PhysicalSection.aDevicePort:type_name -> model.DevicePort + 14, // 11: model.PhysicalSection.bDevicePort:type_name -> model.DevicePort + 15, // 12: model.CheckPoint.km:type_name -> model.Kilometer + 3, // 13: model.CheckPoint.type:type_name -> model.CheckPointType + 14, // 14: model.CheckPoint.devicePorts:type_name -> model.DevicePort + 15, // 15: model.Turnout.km:type_name -> model.Kilometer + 14, // 16: model.Turnout.aDevicePort:type_name -> model.DevicePort + 14, // 17: model.Turnout.bDevicePort:type_name -> model.DevicePort + 14, // 18: model.Turnout.cDevicePort:type_name -> model.DevicePort + 4, // 19: model.Turnout.switchMachineType:type_name -> model.Turnout.SwitchMachineType + 19, // 20: model.Turnout.electronicComponentGroups:type_name -> model.ElectronicComponentGroup + 15, // 21: model.Signal.km:type_name -> model.Kilometer + 14, // 22: model.Signal.turnoutPort:type_name -> model.DevicePort + 19, // 23: model.Signal.electronicComponentGroups:type_name -> model.ElectronicComponentGroup + 15, // 24: model.Transponder.km:type_name -> model.Kilometer + 14, // 25: model.Transponder.turnoutPort:type_name -> model.DevicePort + 15, // 26: model.Slope.kms:type_name -> model.Kilometer + 15, // 27: model.SectionalCurvature.kms:type_name -> model.Kilometer + 0, // 28: model.DevicePort.deviceType:type_name -> model.DeviceType + 1, // 29: model.DevicePort.port:type_name -> model.Port + 2, // 30: model.Kilometer.direction:type_name -> model.Direction + 15, // 31: model.KilometerConvert.kmA:type_name -> model.Kilometer + 15, // 32: model.KilometerConvert.kmB:type_name -> model.Kilometer + 5, // 33: model.Relay.model:type_name -> model.Relay.Model + 34, // [34:34] is the sub-list for method output_type + 34, // [34:34] is the sub-list for method input_type + 34, // [34:34] is the sub-list for extension type_name + 34, // [34:34] is the sub-list for extension extendee + 0, // [0:34] is the sub-list for field type_name } func init() { file_model_proto_init() } @@ -1703,7 +1824,19 @@ func file_model_proto_init() { } } file_model_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RelayGroup); i { + switch v := v.(*PhaseFailureProtector); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_model_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ElectronicComponentGroup); i { case 0: return &v.state case 1: @@ -1721,7 +1854,7 @@ func file_model_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_model_proto_rawDesc, NumEnums: 6, - NumMessages: 13, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, diff --git a/repository/relay.go b/repository/relay.go deleted file mode 100644 index dd6460b..0000000 --- a/repository/relay.go +++ /dev/null @@ -1,41 +0,0 @@ -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, - } -} - -func (r *Relay) Code() string { - return r.code -} - -func (r *Relay) Model() string { - return r.model -} - -type RelayGroup struct { - code string - relays []*Relay -} - -func (r *RelayGroup) Code() string { - return r.code -} - -func (r *RelayGroup) Relays() []*Relay { - return r.relays -} diff --git a/repository/repository.go b/repository/repository.go index d4a6c10..36c6bd2 100644 --- a/repository/repository.go +++ b/repository/repository.go @@ -8,35 +8,37 @@ import ( ) type Repository struct { - id string - version string - physicalSectionMap map[string]*PhysicalSection - checkPointMap map[string]*CheckPoint - turnoutMap map[string]*Turnout - signalMap map[string]*Signal - responderMap map[string]*Transponder - slopeMap map[string]*Slope - sectionalCurvatureMap map[string]*SectionalCurvature - kilometerConvertMap map[string]*proto.KilometerConvert - relayMap map[string]*Relay + id string + version string + physicalSectionMap map[string]*PhysicalSection + checkPointMap map[string]*CheckPoint + turnoutMap map[string]*Turnout + signalMap map[string]*Signal + responderMap map[string]*Transponder + slopeMap map[string]*Slope + sectionalCurvatureMap map[string]*SectionalCurvature + kilometerConvertMap map[string]*proto.KilometerConvert + relayMap map[string]*Relay + phaseFailureProtectorMap map[string]*PhaseFailureProtector linkMap map[string]*Link } func newRepository(id string, version string) *Repository { return &Repository{ - id: id, - version: version, - physicalSectionMap: make(map[string]*PhysicalSection), - checkPointMap: make(map[string]*CheckPoint), - turnoutMap: make(map[string]*Turnout), - signalMap: make(map[string]*Signal), - 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), + id: id, + version: version, + physicalSectionMap: make(map[string]*PhysicalSection), + checkPointMap: make(map[string]*CheckPoint), + turnoutMap: make(map[string]*Turnout), + signalMap: make(map[string]*Signal), + 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), + phaseFailureProtectorMap: make(map[string]*PhaseFailureProtector), + linkMap: make(map[string]*Link), } } diff --git a/repository/repository_manager.go b/repository/repository_manager.go index d56e83e..0882aae 100644 --- a/repository/repository_manager.go +++ b/repository/repository_manager.go @@ -83,6 +83,10 @@ func buildModels(source *proto.Repository, repository *Repository) { m := newRelay(protoData.Id, protoData.Code, protoData.Model) repository.relayMap[m.Id()] = m } + for _, protoData := range source.PhaseFailureProtectors { + m := newPhaseFailureProtector(protoData.Id, protoData.Code) + repository.phaseFailureProtectorMap[m.Id()] = m + } } func buildModelRelationship(source *proto.Repository, repository *Repository) error { @@ -257,17 +261,18 @@ func buildTurnoutRelationShip(source *proto.Repository, repo *Repository) error return err } //关联继电器组 - for _, group := range protoData.RelayGroups { - var relays []*Relay - for _, id := range group.RelayIds { - relay := repo.relayMap[id] - if relay != nil { - relays = append(relays, relay) + for _, group := range protoData.ElectronicComponentGroups { + var components []Identity + for _, id := range group.GetComponentIds() { + if relay := repo.relayMap[id]; relay != nil { + components = append(components, relay) + } else if pfp := repo.phaseFailureProtectorMap[id]; pfp != nil { + components = append(components, pfp) } } - turnout.relayGroups = append(turnout.relayGroups, &RelayGroup{ - code: group.Code, - relays: relays, + turnout.componentGroups = append(turnout.componentGroups, &ElectronicComponentGroup{ + code: group.Code, + components: components, }) } } diff --git a/repository/turnout.go b/repository/turnout.go index 84dba46..53f2119 100644 --- a/repository/turnout.go +++ b/repository/turnout.go @@ -41,7 +41,7 @@ type Turnout struct { bDevices []Identity cDevices []Identity - relayGroups []*RelayGroup + componentGroups []*ElectronicComponentGroup } func NewTurnout(id string, km *proto.Kilometer, switchMachineType proto.Turnout_SwitchMachineType) *Turnout { @@ -58,11 +58,16 @@ func NewTurnout(id string, km *proto.Kilometer, switchMachineType proto.Turnout_ // relayName-继电器在电路中的名称 // find-true找到,false未找到 func (t *Turnout) FindCircuitRoleById(relayId string) (relayGroup string, relayName string, find bool) { - if t.relayGroups != nil { - for _, rg := range t.relayGroups { - for _, relay := range rg.relays { - if relayId == relay.Id() { - return rg.code, relay.code, true + if t.componentGroups != nil { + for _, rg := range t.componentGroups { + for _, component := range rg.components { + if relayId == component.Id() { + switch component.Type() { + case proto.DeviceType_DeviceType_Relay: + return rg.code, component.(*Relay).code, true + case proto.DeviceType_DeviceType_PhaseFailureProtector: + return rg.code, component.(*PhaseFailureProtector).code, true + } } } } @@ -74,11 +79,18 @@ func (t *Turnout) FindCircuitRoleById(relayId string) (relayGroup string, relayN // relayGroup-继电器组合类型 // relayName-继电器在电路中的名称 func (t *Turnout) FindRelayModelByCRole(relayGroup string, relayName string) Identity { - if t.relayGroups != nil { - for _, rg := range t.relayGroups { - for _, relay := range rg.relays { - if rg.code == relayGroup && relay.code == relayName { - return relay + if t.componentGroups != nil { + for _, rg := range t.componentGroups { + for _, component := range rg.components { + switch component.Type() { + case proto.DeviceType_DeviceType_Relay: + if rg.code == relayGroup && component.(*Relay).code == relayName { + return component + } + case proto.DeviceType_DeviceType_PhaseFailureProtector: + if rg.code == relayGroup && component.(*PhaseFailureProtector).code == relayName { + return component + } } } } @@ -248,17 +260,17 @@ func (t *Turnout) GetTurnoutKm(port proto.Port) *proto.Kilometer { return t.km } -func (t *Turnout) RelayGroups() []*RelayGroup { - return t.relayGroups +func (t *Turnout) RelayGroups() []*ElectronicComponentGroup { + return t.componentGroups } func (t *Turnout) FindRelay(groupCode, relayCode string) *Relay { - for _, group := range t.relayGroups { + for _, group := range t.componentGroups { if group.code != groupCode { continue } - for _, relay := range group.relays { - if relay.code == relayCode { + for _, component := range group.components { + if relay, ok := component.(*Relay); ok && relay.code == relayCode { return relay } } diff --git a/system/psd_system.go b/system/psd_system.go index d3cf646..e7c9c05 100644 --- a/system/psd_system.go +++ b/system/psd_system.go @@ -3,17 +3,92 @@ package system import ( "github.com/yohamta/donburi/filter" "joylink.club/ecs" + sysEvent "joylink.club/rtsssimulation/system/event" ) +// PsdDriveXGMJ 联锁驱动XGMJ +func PsdDriveXGMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool { + psdEntry := FindEntityById(w, psdCircuitId) + if psdEntry == nil { + return false + } + psdState := PsdCircuitStateComponent.Get(psdEntry) + psdState.XGMLs = lsDrive + return true +} + +// PsdDriveSGMJ 联锁驱动SGMJ +func PsdDriveSGMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool { + psdEntry := FindEntityById(w, psdCircuitId) + if psdEntry == nil { + return false + } + psdState := PsdCircuitStateComponent.Get(psdEntry) + psdState.SGMLs = lsDrive + return true +} + +// PsdDrive4XKMJ 联锁驱动4XKMJ +func PsdDrive4XKMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool { + psdEntry := FindEntityById(w, psdCircuitId) + if psdEntry == nil { + return false + } + psdState := PsdCircuitStateComponent.Get(psdEntry) + psdState.G4XKMLs = lsDrive + return true +} + +// PsdDrive4SKMJ 联锁驱动4SKMJ +func PsdDrive4SKMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool { + psdEntry := FindEntityById(w, psdCircuitId) + if psdEntry == nil { + return false + } + psdState := PsdCircuitStateComponent.Get(psdEntry) + psdState.G4SKMLs = lsDrive + return true +} + +// PsdDrive8XKMJ 联锁驱动8XKMJ +func PsdDrive8XKMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool { + psdEntry := FindEntityById(w, psdCircuitId) + if psdEntry == nil { + return false + } + psdState := PsdCircuitStateComponent.Get(psdEntry) + psdState.G8XKMLs = lsDrive + return true +} + +// PsdDrive8SKMJ 联锁驱动8SKMJ +func PsdDrive8SKMJ(w ecs.World, psdCircuitId string, lsDrive bool) bool { + psdEntry := FindEntityById(w, psdCircuitId) + if psdEntry == nil { + return false + } + psdState := PsdCircuitStateComponent.Get(psdEntry) + psdState.G8SKMLs = lsDrive + return true +} + +////////////////////////////////////////////////////////////// + // PsdCircuitState 站台门控制电路状态,Psd为车站所有屏蔽门子门的集合 // 旁路继电器的工作原理是,当电路中的电流超过预定的阈值时,旁路继电器会自动断开电路,从而防止电路发生短路或过载等故障。 type PsdCircuitState struct { //关门继电器,true-吸合 XGMJ bool + //true-联锁驱动 + XGMLs bool //4编组开门继电器,true-吸合 G4XKMJ bool + //true-联锁驱动 + G4XKMLs bool //8编组开门继电器,true-吸合 G8XKMJ bool + //true-联锁驱动 + G8XKMLs bool //门关闭继电器,true-吸合 XMGJ bool //门旁路继电器,true-吸合 @@ -22,10 +97,16 @@ type PsdCircuitState struct { XOpenCode OpenCode //关门继电器,true-吸合 SGMJ bool + //true-联锁驱动 + SGMLs bool //4编组开门继电器,true-吸合 G4SKMJ bool + //true-联锁驱动 + G4SKMLs bool //8编组开门继电器,true-吸合 G8SKMJ bool + //true-联锁驱动 + G8SKMLs bool //门关闭继电器,true-吸合 SMGJ bool //门旁路继电器,true-吸合 @@ -127,204 +208,209 @@ const ( // Update world 执行 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) + me.calculateMG(w, psdCircuitEntry) + me.calculateGM(w, psdCircuitEntry) + me.calculate4KM(w, psdCircuitEntry) + me.calculate8KM(w, psdCircuitEntry) + me.calculateCellAct(w, psdCircuitEntry) + me.calculateCellMove(w, psdCircuitEntry) }) } // 屏蔽门子门移动运算,暂定门从全关到全开耗时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 +func (me *PsdsCircuitSystem) calculateCellMove(w ecs.World, psdCircuitEntry *ecs.Entry) { + psdTags := PsdTagsComponent.Get(psdCircuitEntry) + psdTags.psdCellsQuery(psdTags.XTag).Each(w, func(cellEntry *ecs.Entry) { + cellState := PsdCellStateComponent.Get(cellEntry) + cellMove := PercentageDeviceStateComponent.Get(cellEntry) + if cellState.actClosing { + cellMove.V = -50 + } + if cellState.actOpening { + cellMove.V = 50 + } + cellState.Rate = cellMove.GetRate() + }) + psdTags.psdCellsQuery(psdTags.STag).Each(w, func(cellEntry *ecs.Entry) { + cellState := PsdCellStateComponent.Get(cellEntry) + cellMove := PercentageDeviceStateComponent.Get(cellEntry) + if cellState.actClosing { + cellMove.V = -50 + } + if cellState.actOpening { + cellMove.V = 50 + } + cellState.Rate = cellMove.GetRate() + }) +} + +// 屏蔽门子门移动运算,暂定门从全关到全开耗时2000ms,则v=50/ms +func (me *PsdsCircuitSystem) calculateCellAct(w ecs.World, psdCircuitEntry *ecs.Entry) { + state := PsdCircuitStateComponent.Get(psdCircuitEntry) + psdTags := PsdTagsComponent.Get(psdCircuitEntry) + //关门 + if state.XGMJ { + psdTags.psdCellsQuery(psdTags.XTag).Each(w, func(cellEntry *ecs.Entry) { + cellState := PsdCellStateComponent.Get(cellEntry) + cellState.actClosing = true + cellState.actOpening = false + }) + } + if state.SGMJ { + psdTags.psdCellsQuery(psdTags.STag).Each(w, func(cellEntry *ecs.Entry) { + cellState := PsdCellStateComponent.Get(cellEntry) + cellState.actClosing = true + cellState.actOpening = false + }) + } + //开门 + if state.G4XKMJ { + var cellTag EntityTag = nil + if state.XOpenCode == OpenCodeUp { + cellTag = psdTags.X4KmUpTag + } else if state.XOpenCode == OpenCodeDown { + cellTag = psdTags.X4KmDownTag + } + if cellTag != nil { + psdTags.psdCellsQuery(cellTag).Each(w, func(cellEntry *ecs.Entry) { + cellState := PsdCellStateComponent.Get(cellEntry) + cellState.actClosing = false + cellState.actOpening = true + }) } } - if cell.actClosing { - move.V = -50 - if cell.Rate <= PsdCellRateClosed { //关门到位 - move.V = 0 + if state.G4SKMJ { + var cellTag EntityTag = nil + if state.SOpenCode == OpenCodeUp { + cellTag = psdTags.S4KmUpTag + } else if state.SOpenCode == OpenCodeDown { + cellTag = psdTags.S4KmDownTag + } + if cellTag != nil { + psdTags.psdCellsQuery(cellTag).Each(w, func(cellEntry *ecs.Entry) { + cellState := PsdCellStateComponent.Get(cellEntry) + cellState.actClosing = false + cellState.actOpening = true + }) } } - if !cell.actOpening && !cell.actClosing { - move.V = 0 + if state.G8XKMJ { + var cellTag EntityTag = nil + if state.XOpenCode == OpenCodeUp { + cellTag = psdTags.X8KmUpTag + } else if state.XOpenCode == OpenCodeDown { + cellTag = psdTags.X8KmDownTag + } + if cellTag != nil { + psdTags.psdCellsQuery(cellTag).Each(w, func(cellEntry *ecs.Entry) { + cellState := PsdCellStateComponent.Get(cellEntry) + cellState.actClosing = false + cellState.actOpening = true + }) + } + } + if state.G8SKMJ { + var cellTag EntityTag = nil + if state.SOpenCode == OpenCodeUp { + cellTag = psdTags.S8KmUpTag + } else if state.SOpenCode == OpenCodeDown { + cellTag = psdTags.S8KmDownTag + } + if cellTag != nil { + psdTags.psdCellsQuery(cellTag).Each(w, func(cellEntry *ecs.Entry) { + cellState := PsdCellStateComponent.Get(cellEntry) + cellState.actClosing = false + cellState.actOpening = true + }) + } } } -// 车站屏蔽门电路系统继电器励磁运算 ????????-----信息缺失 -func (me *PsdsCircuitSystem) calculateRelayLc(w ecs.World, psdCircuitEntry *ecs.Entry) { - //psd := PsdCircuitStateComponent.Get(psdCircuitEntry) +func (me *PsdsCircuitSystem) calculateMG(w ecs.World, psdCircuitEntry *ecs.Entry) { + state := PsdCircuitStateComponent.Get(psdCircuitEntry) + psdTags := PsdTagsComponent.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 - } - }) - 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) { + psdTags.psdCellsQuery(psdTags.XTag).Each(w, func(cellEntry *ecs.Entry) { if isXMG { - cell := PsdCellStateComponent.Get(cellEntry) - isXMG = cell.Rate <= PsdCellRateClosed + cellState := PsdCellStateComponent.Get(cellEntry) + if cellState.Rate > PsdCellRateClosed { + isXMG = false + } } }) - 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 - }) + if isXMG != state.XMGJ { + if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(psdCircuitEntry).Id, PSD_GT, PSD_XMGJ, isXMG); ok { + sysEvent.RelayNeedChangeEventBus.Publish(w, event) + } } -} - -// 车站下行侧关门操作运算 -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 - }) + // + isSMG := true + psdTags.psdCellsQuery(psdTags.STag).Each(w, func(cellEntry *ecs.Entry) { + if isSMG { + cellState := PsdCellStateComponent.Get(cellEntry) + if cellState.Rate > PsdCellRateClosed { + isSMG = false } } + }) + if isSMG != state.SMGJ { + if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(psdCircuitEntry).Id, PSD_GT, PSD_SMGJ, isSMG); ok { + sysEvent.RelayNeedChangeEventBus.Publish(w, event) + } } } -// 车站下行侧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 - }) - } +func (me *PsdsCircuitSystem) calculateGM(w ecs.World, psdCircuitEntry *ecs.Entry) { + state := PsdCircuitStateComponent.Get(psdCircuitEntry) + //关门继电器:联锁励磁||自闭保持 + isXGM := state.XGMLs || state.XGMJ && !state.G4XKMJ && !state.G8XKMJ + isSGM := state.SGMLs || state.SGMJ && !state.G4SKMJ && !state.G8SKMJ + if isXGM != state.XGMJ { + if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(psdCircuitEntry).Id, PSD_GT, PSD_XGMJ, isXGM); ok { + sysEvent.RelayNeedChangeEventBus.Publish(w, event) + } + } + if isSGM != state.SGMJ { + if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(psdCircuitEntry).Id, PSD_GT, PSD_SGMJ, isSGM); ok { + sysEvent.RelayNeedChangeEventBus.Publish(w, event) } } } -// 车站上行侧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 - }) - } +func (me *PsdsCircuitSystem) calculate4KM(w ecs.World, psdCircuitEntry *ecs.Entry) { + //4编组开门继电器:联锁励磁||自闭保持 + state := PsdCircuitStateComponent.Get(psdCircuitEntry) + is4XKM := state.G4XKMLs || state.G4XKMJ && !state.G8XKMJ && !state.XGMJ + is4SKM := state.G4SKMLs || state.G4SKMJ && !state.G8SKMJ && !state.SGMJ + if is4XKM != state.G4XKMJ { + if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(psdCircuitEntry).Id, PSD_GT, PSD_4XKMJ, is4XKM); ok { + sysEvent.RelayNeedChangeEventBus.Publish(w, event) + } + } + if is4SKM != state.G4SKMJ { + if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(psdCircuitEntry).Id, PSD_GT, PSD_4SKMJ, is4SKM); ok { + sysEvent.RelayNeedChangeEventBus.Publish(w, event) } } } -// 车站下行侧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 - }) - } +func (me *PsdsCircuitSystem) calculate8KM(w ecs.World, psdCircuitEntry *ecs.Entry) { + //8编组开门继电器:联锁励磁||自闭保持 + state := PsdCircuitStateComponent.Get(psdCircuitEntry) + is8XKM := state.G8XKMLs || state.G8XKMJ && !state.G4XKMJ && !state.XGMJ + is8SKM := state.G8SKMLs || state.G8SKMJ && !state.G4SKMJ && !state.SGMJ + if is8XKM != state.G8XKMJ { + if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(psdCircuitEntry).Id, PSD_GT, PSD_8XKMJ, is8XKM); ok { + sysEvent.RelayNeedChangeEventBus.Publish(w, event) + } + } + if is8SKM != state.G8SKMJ { + if event, ok := createRelayNeedChangeEvent(w, EntityIdentityComponent.Get(psdCircuitEntry).Id, PSD_GT, PSD_8SKMJ, is8SKM); ok { + sysEvent.RelayNeedChangeEventBus.Publish(w, event) } } } diff --git a/system/system.go b/system/system.go index 6934df5..93995a9 100644 --- a/system/system.go +++ b/system/system.go @@ -40,11 +40,11 @@ func QueryEntityById(world ecs.World, q *ecs.Query, id string) *ecs.Entry { var modelStorageQuery = ecs.NewQuery(filter.Contains(ModelStorageComponent)) // 测试用 -var xXDebug = false +var XXDebug = false // FindModelStorage 获取模型仓库 func FindModelStorage(world ecs.World) IModelManager { - if xXDebug { + if XXDebug { e, _ := modelStorageQuery.First(world) return ModelStorageComponent.Get(e).ModelManager } else {