道岔控制

This commit is contained in:
xzb 2023-08-25 17:36:12 +08:00
parent 2e43869b12
commit d7562e088c
9 changed files with 350 additions and 208 deletions

View File

@ -26,6 +26,9 @@ var PercentageDeviceStateComponent = ecs.NewComponentType[cstate.PercentageDevic
// 道岔继电器状态组件
var SwitchRelayStateComponent = ecs.NewComponentType[cstate.SwitchRelayState]()
// 道岔移动控制组件
var SwitchControlStateComponent = ecs.NewComponentType[cstate.SwitchControlState]()
// 物理区段状态组件
var PhysicalSectionStateComponent = ecs.NewComponentType[cstate.PhysicalSectionState]()

View File

@ -223,7 +223,8 @@ func (x *DeviceIdentity) GetId() string {
return ""
}
// 道岔继电器状态
// 道岔逻辑继电器状态
// 继电器为逻辑上的继电器,不对应真实继电器,仅用于道岔逻辑实现
type SwitchRelayState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -303,6 +304,74 @@ func (x *SwitchRelayState) GetFbJ() bool {
return false
}
// 道岔逻辑控制状态
// 通过计算道岔移动速度及方向来实现控制
type SwitchControlState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 触发定操
FireDcj bool `protobuf:"varint,1,opt,name=fireDcj,proto3" json:"fireDcj,omitempty"`
// 触发反操
FireFcj bool `protobuf:"varint,2,opt,name=fireFcj,proto3" json:"fireFcj,omitempty"`
// 道岔从0-100耗时单位ms
LhDistance int64 `protobuf:"varint,4,opt,name=lhDistance,proto3" json:"lhDistance,omitempty"`
}
func (x *SwitchControlState) Reset() {
*x = SwitchControlState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SwitchControlState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SwitchControlState) ProtoMessage() {}
func (x *SwitchControlState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[2]
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 SwitchControlState.ProtoReflect.Descriptor instead.
func (*SwitchControlState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{2}
}
func (x *SwitchControlState) GetFireDcj() bool {
if x != nil {
return x.FireDcj
}
return false
}
func (x *SwitchControlState) GetFireFcj() bool {
if x != nil {
return x.FireFcj
}
return false
}
func (x *SwitchControlState) GetLhDistance() int64 {
if x != nil {
return x.LhDistance
}
return 0
}
// 物理区段状态
type PhysicalSectionState struct {
state protoimpl.MessageState
@ -316,7 +385,7 @@ type PhysicalSectionState struct {
func (x *PhysicalSectionState) Reset() {
*x = PhysicalSectionState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[2]
mi := &file_status_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -329,7 +398,7 @@ func (x *PhysicalSectionState) String() string {
func (*PhysicalSectionState) ProtoMessage() {}
func (x *PhysicalSectionState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[2]
mi := &file_status_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -342,7 +411,7 @@ func (x *PhysicalSectionState) ProtoReflect() protoreflect.Message {
// Deprecated: Use PhysicalSectionState.ProtoReflect.Descriptor instead.
func (*PhysicalSectionState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{2}
return file_status_proto_rawDescGZIP(), []int{3}
}
func (x *PhysicalSectionState) GetOccupied() bool {
@ -365,7 +434,7 @@ type SignalState struct {
func (x *SignalState) Reset() {
*x = SignalState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[3]
mi := &file_status_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -378,7 +447,7 @@ func (x *SignalState) String() string {
func (*SignalState) ProtoMessage() {}
func (x *SignalState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[3]
mi := &file_status_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -391,7 +460,7 @@ func (x *SignalState) ProtoReflect() protoreflect.Message {
// Deprecated: Use SignalState.ProtoReflect.Descriptor instead.
func (*SignalState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{3}
return file_status_proto_rawDescGZIP(), []int{4}
}
func (x *SignalState) GetDisplay() SignalAspect {
@ -418,7 +487,7 @@ type SignalDisplayOperating struct {
func (x *SignalDisplayOperating) Reset() {
*x = SignalDisplayOperating{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[4]
mi := &file_status_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -431,7 +500,7 @@ func (x *SignalDisplayOperating) String() string {
func (*SignalDisplayOperating) ProtoMessage() {}
func (x *SignalDisplayOperating) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[4]
mi := &file_status_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -444,7 +513,7 @@ func (x *SignalDisplayOperating) ProtoReflect() protoreflect.Message {
// Deprecated: Use SignalDisplayOperating.ProtoReflect.Descriptor instead.
func (*SignalDisplayOperating) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{4}
return file_status_proto_rawDescGZIP(), []int{5}
}
func (x *SignalDisplayOperating) GetStartOperate() bool {
@ -485,7 +554,7 @@ type PsdState struct {
func (x *PsdState) Reset() {
*x = PsdState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[5]
mi := &file_status_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -498,7 +567,7 @@ func (x *PsdState) String() string {
func (*PsdState) ProtoMessage() {}
func (x *PsdState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[5]
mi := &file_status_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -511,7 +580,7 @@ func (x *PsdState) ProtoReflect() protoreflect.Message {
// Deprecated: Use PsdState.ProtoReflect.Descriptor instead.
func (*PsdState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{5}
return file_status_proto_rawDescGZIP(), []int{6}
}
func (x *PsdState) GetAllClosed() bool {
@ -550,7 +619,7 @@ type PercentageDeviceState struct {
func (x *PercentageDeviceState) Reset() {
*x = PercentageDeviceState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[6]
mi := &file_status_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -563,7 +632,7 @@ func (x *PercentageDeviceState) String() string {
func (*PercentageDeviceState) ProtoMessage() {}
func (x *PercentageDeviceState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[6]
mi := &file_status_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -576,7 +645,7 @@ func (x *PercentageDeviceState) ProtoReflect() protoreflect.Message {
// Deprecated: Use PercentageDeviceState.ProtoReflect.Descriptor instead.
func (*PercentageDeviceState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{6}
return file_status_proto_rawDescGZIP(), []int{7}
}
func (x *PercentageDeviceState) GetRate() int64 {
@ -611,7 +680,7 @@ type MovableDeviceState struct {
func (x *MovableDeviceState) Reset() {
*x = MovableDeviceState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[7]
mi := &file_status_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -624,7 +693,7 @@ func (x *MovableDeviceState) String() string {
func (*MovableDeviceState) ProtoMessage() {}
func (x *MovableDeviceState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[7]
mi := &file_status_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -637,7 +706,7 @@ func (x *MovableDeviceState) ProtoReflect() protoreflect.Message {
// Deprecated: Use MovableDeviceState.ProtoReflect.Descriptor instead.
func (*MovableDeviceState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{7}
return file_status_proto_rawDescGZIP(), []int{8}
}
func (x *MovableDeviceState) GetToH() bool {
@ -674,7 +743,7 @@ type BaliseState struct {
func (x *BaliseState) Reset() {
*x = BaliseState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[8]
mi := &file_status_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -687,7 +756,7 @@ func (x *BaliseState) String() string {
func (*BaliseState) ProtoMessage() {}
func (x *BaliseState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[8]
mi := &file_status_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -700,7 +769,7 @@ func (x *BaliseState) ProtoReflect() protoreflect.Message {
// Deprecated: Use BaliseState.ProtoReflect.Descriptor instead.
func (*BaliseState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{8}
return file_status_proto_rawDescGZIP(), []int{9}
}
func (x *BaliseState) GetContent() *BaliseContent {
@ -727,7 +796,7 @@ type BaliseContent struct {
func (x *BaliseContent) Reset() {
*x = BaliseContent{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[9]
mi := &file_status_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -740,7 +809,7 @@ func (x *BaliseContent) String() string {
func (*BaliseContent) ProtoMessage() {}
func (x *BaliseContent) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[9]
mi := &file_status_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -753,7 +822,7 @@ func (x *BaliseContent) ProtoReflect() protoreflect.Message {
// Deprecated: Use BaliseContent.ProtoReflect.Descriptor instead.
func (*BaliseContent) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{9}
return file_status_proto_rawDescGZIP(), []int{10}
}
func (x *BaliseContent) GetId() string {
@ -795,7 +864,7 @@ type OccupiedLinkPosition struct {
func (x *OccupiedLinkPosition) Reset() {
*x = OccupiedLinkPosition{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[10]
mi := &file_status_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -808,7 +877,7 @@ func (x *OccupiedLinkPosition) String() string {
func (*OccupiedLinkPosition) ProtoMessage() {}
func (x *OccupiedLinkPosition) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[10]
mi := &file_status_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -821,7 +890,7 @@ func (x *OccupiedLinkPosition) ProtoReflect() protoreflect.Message {
// Deprecated: Use OccupiedLinkPosition.ProtoReflect.Descriptor instead.
func (*OccupiedLinkPosition) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{10}
return file_status_proto_rawDescGZIP(), []int{11}
}
func (x *OccupiedLinkPosition) GetLinkId() string {
@ -860,7 +929,7 @@ type TrainState struct {
func (x *TrainState) Reset() {
*x = TrainState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[11]
mi := &file_status_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -873,7 +942,7 @@ func (x *TrainState) String() string {
func (*TrainState) ProtoMessage() {}
func (x *TrainState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[11]
mi := &file_status_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -886,7 +955,7 @@ func (x *TrainState) ProtoReflect() protoreflect.Message {
// Deprecated: Use TrainState.ProtoReflect.Descriptor instead.
func (*TrainState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{11}
return file_status_proto_rawDescGZIP(), []int{12}
}
func (x *TrainState) GetActiveHead() TrainActiveEnum {
@ -921,7 +990,7 @@ type TowPositionButtonState struct {
func (x *TowPositionButtonState) Reset() {
*x = TowPositionButtonState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[12]
mi := &file_status_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -934,7 +1003,7 @@ func (x *TowPositionButtonState) String() string {
func (*TowPositionButtonState) ProtoMessage() {}
func (x *TowPositionButtonState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[12]
mi := &file_status_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -947,7 +1016,7 @@ func (x *TowPositionButtonState) ProtoReflect() protoreflect.Message {
// Deprecated: Use TowPositionButtonState.ProtoReflect.Descriptor instead.
func (*TowPositionButtonState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{12}
return file_status_proto_rawDescGZIP(), []int{13}
}
func (x *TowPositionButtonState) GetPos1() bool {
@ -977,7 +1046,7 @@ type ButtonState struct {
func (x *ButtonState) Reset() {
*x = ButtonState{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[13]
mi := &file_status_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -990,7 +1059,7 @@ func (x *ButtonState) String() string {
func (*ButtonState) ProtoMessage() {}
func (x *ButtonState) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[13]
mi := &file_status_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1003,7 +1072,7 @@ func (x *ButtonState) ProtoReflect() protoreflect.Message {
// Deprecated: Use ButtonState.ProtoReflect.Descriptor instead.
func (*ButtonState) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{13}
return file_status_proto_rawDescGZIP(), []int{14}
}
func (x *ButtonState) GetPressDown() bool {
@ -1032,7 +1101,7 @@ type ButtonPressOperating struct {
func (x *ButtonPressOperating) Reset() {
*x = ButtonPressOperating{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[14]
mi := &file_status_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1045,7 +1114,7 @@ func (x *ButtonPressOperating) String() string {
func (*ButtonPressOperating) ProtoMessage() {}
func (x *ButtonPressOperating) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[14]
mi := &file_status_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1058,7 +1127,7 @@ func (x *ButtonPressOperating) ProtoReflect() protoreflect.Message {
// Deprecated: Use ButtonPressOperating.ProtoReflect.Descriptor instead.
func (*ButtonPressOperating) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{14}
return file_status_proto_rawDescGZIP(), []int{15}
}
func (x *ButtonPressOperating) GetStart() bool {
@ -1104,7 +1173,7 @@ type ButtonConfirmOperating struct {
func (x *ButtonConfirmOperating) Reset() {
*x = ButtonConfirmOperating{}
if protoimpl.UnsafeEnabled {
mi := &file_status_proto_msgTypes[15]
mi := &file_status_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1117,7 +1186,7 @@ func (x *ButtonConfirmOperating) String() string {
func (*ButtonConfirmOperating) ProtoMessage() {}
func (x *ButtonConfirmOperating) ProtoReflect() protoreflect.Message {
mi := &file_status_proto_msgTypes[15]
mi := &file_status_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1130,7 +1199,7 @@ func (x *ButtonConfirmOperating) ProtoReflect() protoreflect.Message {
// Deprecated: Use ButtonConfirmOperating.ProtoReflect.Descriptor instead.
func (*ButtonConfirmOperating) Descriptor() ([]byte, []int) {
return file_status_proto_rawDescGZIP(), []int{15}
return file_status_proto_rawDescGZIP(), []int{16}
}
func (x *ButtonConfirmOperating) GetConfirm() bool {
@ -1159,99 +1228,105 @@ var file_status_proto_rawDesc = []byte{
0x0a, 0x03, 0x66, 0x63, 0x4a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x66, 0x63, 0x4a,
0x12, 0x10, 0x0a, 0x03, 0x64, 0x62, 0x4a, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x64,
0x62, 0x4a, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x62, 0x4a, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52,
0x03, 0x66, 0x62, 0x4a, 0x22, 0x32, 0x0a, 0x14, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c,
0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08,
0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x22, 0x3d, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e,
0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c,
0x61, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74,
0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x07,
0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x22, 0x98, 0x01, 0x0a, 0x16, 0x53, 0x69, 0x67, 0x6e,
0x61, 0x6c, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
0x6e, 0x67, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x38, 0x0a, 0x0c, 0x74, 0x61, 0x72, 0x67,
0x65, 0x74, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14,
0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73,
0x70, 0x65, 0x63, 0x74, 0x52, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x73, 0x70, 0x65,
0x63, 0x74, 0x22, 0x74, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c,
0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09,
0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
0x09, 0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b,
0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x22, 0x43, 0x0a, 0x15, 0x50, 0x65, 0x72, 0x63,
0x65, 0x6e, 0x74, 0x61, 0x67, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x04, 0x72, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18,
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x58, 0x0a,
0x12, 0x4d, 0x6f, 0x76, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74,
0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x6f, 0x48, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
0x52, 0x03, 0x74, 0x6f, 0x48, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70,
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70,
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3e, 0x0a, 0x0b, 0x42, 0x61, 0x6c, 0x69, 0x73,
0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65,
0x2e, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x07,
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x4d, 0x0a, 0x0d, 0x42, 0x61, 0x6c, 0x69, 0x73,
0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07,
0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63,
0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x6e, 0x0a, 0x14, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69,
0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16,
0x0a, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f,
0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61,
0x72, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x4f,
0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64,
0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x89, 0x01, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x69, 0x6e,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48,
0x65, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x63, 0x73, 0x74, 0x61,
0x74, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x45, 0x6e,
0x75, 0x6d, 0x52, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x64, 0x12, 0x42,
0x0a, 0x0d, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x18,
0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4f,
0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73, 0x69, 0x74,
0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e,
0x6b, 0x73, 0x22, 0x40, 0x0a, 0x16, 0x54, 0x6f, 0x77, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x70, 0x6f, 0x73, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x6f, 0x73, 0x31,
0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04,
0x70, 0x6f, 0x73, 0x32, 0x22, 0x2b, 0x0a, 0x0b, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74,
0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77, 0x6e,
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77,
0x6e, 0x22, 0x84, 0x01, 0x0a, 0x14, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x50, 0x72, 0x65, 0x73,
0x73, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74,
0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74,
0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04,
0x64, 0x6f, 0x77, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54,
0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x65, 0x65,
0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x22, 0x4a, 0x0a, 0x16, 0x42, 0x75, 0x74, 0x74,
0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06,
0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x61,
0x6e, 0x63, 0x65, 0x6c, 0x2a, 0x81, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41,
0x73, 0x70, 0x65, 0x63, 0x74, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x6f, 0x10, 0x00, 0x12, 0x05, 0x0a,
0x01, 0x52, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x47, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x59,
0x10, 0x03, 0x12, 0x05, 0x0a, 0x01, 0x57, 0x10, 0x04, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x05,
0x12, 0x06, 0x0a, 0x02, 0x52, 0x59, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x57, 0x10, 0x07,
0x12, 0x06, 0x0a, 0x02, 0x47, 0x47, 0x10, 0x08, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x59, 0x10, 0x09,
0x12, 0x06, 0x0a, 0x02, 0x59, 0x59, 0x10, 0x0a, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x46, 0x10, 0x0b,
0x12, 0x06, 0x0a, 0x02, 0x59, 0x46, 0x10, 0x0c, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x46, 0x10, 0x0d,
0x12, 0x06, 0x0a, 0x02, 0x57, 0x46, 0x10, 0x0e, 0x2a, 0x35, 0x0a, 0x0f, 0x54, 0x72, 0x61, 0x69,
0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0a, 0x0a, 0x06, 0x48,
0x45, 0x41, 0x44, 0x5f, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f,
0x41, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x42, 0x10, 0x02, 0x42,
0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x03, 0x66, 0x62, 0x4a, 0x22, 0x68, 0x0a, 0x12, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x43, 0x6f,
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69,
0x72, 0x65, 0x44, 0x63, 0x6a, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x66, 0x69, 0x72,
0x65, 0x44, 0x63, 0x6a, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x69, 0x72, 0x65, 0x46, 0x63, 0x6a, 0x18,
0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x66, 0x69, 0x72, 0x65, 0x46, 0x63, 0x6a, 0x12, 0x1e,
0x0a, 0x0a, 0x6c, 0x68, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x03, 0x52, 0x0a, 0x6c, 0x68, 0x44, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x32,
0x0a, 0x14, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69,
0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, 0x63, 0x63, 0x75, 0x70, 0x69,
0x65, 0x64, 0x22, 0x3d, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74,
0x65, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x14, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e,
0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61,
0x79, 0x22, 0x98, 0x01, 0x0a, 0x16, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x44, 0x69, 0x73, 0x70,
0x6c, 0x61, 0x79, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x22, 0x0a, 0x0c,
0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x08, 0x52, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65,
0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69,
0x6d, 0x65, 0x12, 0x38, 0x0a, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x73, 0x70, 0x65,
0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74,
0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x0c,
0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x22, 0x74, 0x0a, 0x08,
0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x43,
0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c,
0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65,
0x6e, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x4f, 0x70,
0x65, 0x6e, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63,
0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,
0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73,
0x65, 0x64, 0x22, 0x43, 0x0a, 0x15, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x61, 0x67, 0x65,
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72,
0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x72, 0x61, 0x74, 0x65, 0x12,
0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x58, 0x0a, 0x12, 0x4d, 0x6f, 0x76, 0x61, 0x62,
0x6c, 0x65, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a,
0x03, 0x74, 0x6f, 0x48, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x74, 0x6f, 0x48, 0x12,
0x14, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x73, 0x70, 0x65, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x22, 0x3e, 0x0a, 0x0b, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65,
0x12, 0x2f, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x15, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x42, 0x61, 0x6c, 0x69, 0x73,
0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
0x74, 0x22, 0x4d, 0x0a, 0x0d, 0x42, 0x61, 0x6c, 0x69, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x65,
0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e,
0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x22, 0x6e, 0x0a, 0x14, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b,
0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x69, 0x6e, 0x6b,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64,
0x12, 0x20, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18,
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4f, 0x66, 0x66, 0x73,
0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18,
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x22, 0x89, 0x01, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x37, 0x0a, 0x0a, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x54, 0x72, 0x61,
0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x0a, 0x61, 0x63,
0x74, 0x69, 0x76, 0x65, 0x48, 0x65, 0x61, 0x64, 0x12, 0x42, 0x0a, 0x0d, 0x6f, 0x63, 0x63, 0x75,
0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x1c, 0x2e, 0x63, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65,
0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x6f,
0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x22, 0x40, 0x0a, 0x16,
0x54, 0x6f, 0x77, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x75, 0x74, 0x74, 0x6f,
0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x73, 0x31, 0x18, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x6f, 0x73, 0x31, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f,
0x73, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x6f, 0x73, 0x32, 0x22, 0x2b,
0x0a, 0x0b, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a,
0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
0x52, 0x09, 0x70, 0x72, 0x65, 0x73, 0x73, 0x44, 0x6f, 0x77, 0x6e, 0x22, 0x84, 0x01, 0x0a, 0x14,
0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x50, 0x72, 0x65, 0x73, 0x73, 0x4f, 0x70, 0x65, 0x72, 0x61,
0x74, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x6f,
0x77, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x20,
0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65,
0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18,
0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6e, 0x65, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x72, 0x6d, 0x22, 0x4a, 0x0a, 0x16, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x72, 0x6d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07,
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x63,
0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c,
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x2a, 0x81,
0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x12,
0x06, 0x0a, 0x02, 0x4e, 0x6f, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x52, 0x10, 0x01, 0x12, 0x05,
0x0a, 0x01, 0x47, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x59, 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01,
0x57, 0x10, 0x04, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x59,
0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x57, 0x10, 0x07, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x47,
0x10, 0x08, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x59, 0x10, 0x09, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x59,
0x10, 0x0a, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x46, 0x10, 0x0b, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x46,
0x10, 0x0c, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x46, 0x10, 0x0d, 0x12, 0x06, 0x0a, 0x02, 0x57, 0x46,
0x10, 0x0e, 0x2a, 0x35, 0x0a, 0x0f, 0x54, 0x72, 0x61, 0x69, 0x6e, 0x41, 0x63, 0x74, 0x69, 0x76,
0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x4e, 0x10,
0x00, 0x12, 0x0a, 0x0a, 0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x41, 0x10, 0x01, 0x12, 0x0a, 0x0a,
0x06, 0x48, 0x45, 0x41, 0x44, 0x5f, 0x42, 0x10, 0x02, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x63,
0x73, 0x74, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1267,33 +1342,34 @@ func file_status_proto_rawDescGZIP() []byte {
}
var file_status_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_status_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_status_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
var file_status_proto_goTypes = []interface{}{
(SignalAspect)(0), // 0: cstate.SignalAspect
(TrainActiveEnum)(0), // 1: cstate.TrainActiveEnum
(*DeviceIdentity)(nil), // 2: cstate.DeviceIdentity
(*SwitchRelayState)(nil), // 3: cstate.SwitchRelayState
(*PhysicalSectionState)(nil), // 4: cstate.PhysicalSectionState
(*SignalState)(nil), // 5: cstate.SignalState
(*SignalDisplayOperating)(nil), // 6: cstate.SignalDisplayOperating
(*PsdState)(nil), // 7: cstate.PsdState
(*PercentageDeviceState)(nil), // 8: cstate.PercentageDeviceState
(*MovableDeviceState)(nil), // 9: cstate.MovableDeviceState
(*BaliseState)(nil), // 10: cstate.BaliseState
(*BaliseContent)(nil), // 11: cstate.BaliseContent
(*OccupiedLinkPosition)(nil), // 12: cstate.OccupiedLinkPosition
(*TrainState)(nil), // 13: cstate.TrainState
(*TowPositionButtonState)(nil), // 14: cstate.TowPositionButtonState
(*ButtonState)(nil), // 15: cstate.ButtonState
(*ButtonPressOperating)(nil), // 16: cstate.ButtonPressOperating
(*ButtonConfirmOperating)(nil), // 17: cstate.ButtonConfirmOperating
(*SwitchControlState)(nil), // 4: cstate.SwitchControlState
(*PhysicalSectionState)(nil), // 5: cstate.PhysicalSectionState
(*SignalState)(nil), // 6: cstate.SignalState
(*SignalDisplayOperating)(nil), // 7: cstate.SignalDisplayOperating
(*PsdState)(nil), // 8: cstate.PsdState
(*PercentageDeviceState)(nil), // 9: cstate.PercentageDeviceState
(*MovableDeviceState)(nil), // 10: cstate.MovableDeviceState
(*BaliseState)(nil), // 11: cstate.BaliseState
(*BaliseContent)(nil), // 12: cstate.BaliseContent
(*OccupiedLinkPosition)(nil), // 13: cstate.OccupiedLinkPosition
(*TrainState)(nil), // 14: cstate.TrainState
(*TowPositionButtonState)(nil), // 15: cstate.TowPositionButtonState
(*ButtonState)(nil), // 16: cstate.ButtonState
(*ButtonPressOperating)(nil), // 17: cstate.ButtonPressOperating
(*ButtonConfirmOperating)(nil), // 18: cstate.ButtonConfirmOperating
}
var file_status_proto_depIdxs = []int32{
0, // 0: cstate.SignalState.display:type_name -> cstate.SignalAspect
0, // 1: cstate.SignalDisplayOperating.targetAspect:type_name -> cstate.SignalAspect
11, // 2: cstate.BaliseState.content:type_name -> cstate.BaliseContent
12, // 2: cstate.BaliseState.content:type_name -> cstate.BaliseContent
1, // 3: cstate.TrainState.activeHead:type_name -> cstate.TrainActiveEnum
12, // 4: cstate.TrainState.occupiedLinks:type_name -> cstate.OccupiedLinkPosition
13, // 4: cstate.TrainState.occupiedLinks:type_name -> cstate.OccupiedLinkPosition
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
@ -1332,7 +1408,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PhysicalSectionState); i {
switch v := v.(*SwitchControlState); i {
case 0:
return &v.state
case 1:
@ -1344,7 +1420,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SignalState); i {
switch v := v.(*PhysicalSectionState); i {
case 0:
return &v.state
case 1:
@ -1356,7 +1432,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SignalDisplayOperating); i {
switch v := v.(*SignalState); i {
case 0:
return &v.state
case 1:
@ -1368,7 +1444,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PsdState); i {
switch v := v.(*SignalDisplayOperating); i {
case 0:
return &v.state
case 1:
@ -1380,7 +1456,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PercentageDeviceState); i {
switch v := v.(*PsdState); i {
case 0:
return &v.state
case 1:
@ -1392,7 +1468,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MovableDeviceState); i {
switch v := v.(*PercentageDeviceState); i {
case 0:
return &v.state
case 1:
@ -1404,7 +1480,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BaliseState); i {
switch v := v.(*MovableDeviceState); i {
case 0:
return &v.state
case 1:
@ -1416,7 +1492,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BaliseContent); i {
switch v := v.(*BaliseState); i {
case 0:
return &v.state
case 1:
@ -1428,7 +1504,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OccupiedLinkPosition); i {
switch v := v.(*BaliseContent); i {
case 0:
return &v.state
case 1:
@ -1440,7 +1516,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TrainState); i {
switch v := v.(*OccupiedLinkPosition); i {
case 0:
return &v.state
case 1:
@ -1452,7 +1528,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TowPositionButtonState); i {
switch v := v.(*TrainState); i {
case 0:
return &v.state
case 1:
@ -1464,7 +1540,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ButtonState); i {
switch v := v.(*TowPositionButtonState); i {
case 0:
return &v.state
case 1:
@ -1476,7 +1552,7 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ButtonPressOperating); i {
switch v := v.(*ButtonState); i {
case 0:
return &v.state
case 1:
@ -1488,6 +1564,18 @@ func file_status_proto_init() {
}
}
file_status_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ButtonPressOperating); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_status_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ButtonConfirmOperating); i {
case 0:
return &v.state
@ -1506,7 +1594,7 @@ func file_status_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_status_proto_rawDesc,
NumEnums: 2,
NumMessages: 16,
NumMessages: 17,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -46,6 +46,7 @@ func initEntites(config *WorldConfig, world ecs.World) {
components.SwitchRelayStateComponent.Set(entry, &cstate.SwitchRelayState{DcJ: false, FcJ: false, DbJ: true, FbJ: false})
components.PercentageDeviceStateComponent.Set(entry, &cstate.PercentageDeviceState{Rate: system.SwitchNormalVaule, Target: system.SwitchNormalVaule})
components.MovableDeviceStateComponent.Set(entry, &cstate.MovableDeviceState{ToH: false, Speed: 0, Position: system.SwitchNormalVaule})
components.SwitchControlStateComponent.Set(entry, &cstate.SwitchControlState{FireDcj: false, FireFcj: false})
})
//
foreachModels(config.ModelManager, umi.Signal, func(md umi.IDeviceModel) {
@ -89,7 +90,7 @@ func CreateModelStorageRefEntity(w ecs.World) *ecs.Entry {
// 创建道岔实体
func CreateSwitchEntity(w ecs.World) *ecs.Entry {
return w.Create(components.DeviceIdentityComponent, components.SwitchRelayStateComponent, components.PercentageDeviceStateComponent, components.MovableDeviceStateComponent)
return w.Create(components.DeviceIdentityComponent, components.SwitchRelayStateComponent, components.SwitchControlStateComponent, components.PercentageDeviceStateComponent, components.MovableDeviceStateComponent)
}
// 创建信号机实体

View File

@ -26,7 +26,14 @@ func main() {
ModelManager: woldModelStorage,
Tick: 300,
InitTime: time.Now(),
Systems: []ecs.ISystem{system.NewMovableDeviceSystem(), system.NewPercentageDeviceSystem(), system.NewSwitchSystem(), system.NewPsdSystem(), system.NewTimerSystem(), system.NewDebugSystem()},
Systems: []ecs.ISystem{
system.NewSwitchControlSystem(),
system.NewMovableDeviceSystem(),
system.NewPercentageDeviceSystem(),
system.NewSwitchRelaySystem(),
system.NewPsdSystem(),
system.NewTimerSystem(),
system.NewDebugSystem()},
}
world := creator.InitializeWorld(config)
//
@ -35,6 +42,7 @@ func main() {
time.Sleep(2 * time.Second)
//
//testPsdOpt(world)
//testPsdCellOpt(world)
testSwitchTurn(world)
//
time.Sleep(120 * time.Second)
@ -103,9 +111,9 @@ func testPsdCellOpt(w ecs.World) {
operate.FirePsdCellOperation(w, "psd1", "psd1Cell2", 100)
}
func testSwitchTurn(w ecs.World) {
operate.FireSwitchTurn(w, "switch1", operate.SwitchReverseRate)
operate.FireSwitchFcj(w, "switch1")
time.Sleep(8 * time.Second)
operate.FireSwitchTurn(w, "switch1", operate.SwitchNormalRate)
operate.FireSwitchDcj(w, "switch1")
}
func testSignalOpt(w ecs.World) {

View File

@ -5,6 +5,7 @@ import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
"joylink.club/rtsssimulation/components/cstate"
"joylink.club/rtsssimulation/system"
"joylink.club/rtsssimulation/umi"
)
@ -18,46 +19,22 @@ const (
// 道岔定操
func FireSwitchDcj(w ecs.World, switchId string) error {
return FireSwitchTurn(w, switchId, SwitchNormalRate)
return fireSwitchTurn(w, switchId, true)
}
// 道岔反操
func FireSwitchFcj(w ecs.World, switchId string) error {
return FireSwitchTurn(w, switchId, SwitchReverseRate)
return fireSwitchTurn(w, switchId, false)
}
//////////////////////////////////////////////////////////////////////////////
// 触发道岔正常转动
// w: 当前世界
// switchId: 道岔id
// turnRate: 道岔转动到目标百分比[0,100]
func FireSwitchTurn(w ecs.World, switchId string, turnRate int8) error {
if turnRate < 0 || turnRate > 100 {
return fmt.Errorf("道岔操作turnRate(%d)不在[0,100]内", turnRate)
}
func fireSwitchTurn(w ecs.World, switchId string, turnNormal bool) error {
var switchEntry *ecs.Entry = system.QueryEntityById(w, system.SwitchQuery, switchId)
if switchEntry == nil {
return fmt.Errorf("道岔[%s]的实体不存在", switchId)
}
//
switchPercent := components.PercentageDeviceStateComponent.Get(switchEntry)
turnRateValue := system.GetRateValue(turnRate)
*(components.SwitchControlStateComponent.Get(switchEntry)) = cstate.SwitchControlState{FireDcj: turnNormal == true, FireFcj: turnNormal == false, LhDistance: getSwitchTurnTime(w, switchId)}
//
switchRelay := components.SwitchRelayStateComponent.Get(switchEntry)
if turnRateValue == switchPercent.Rate {
return nil
} else {
lhDistance := getSwitchTurnTime(w, switchId)
if turnRateValue > switchPercent.Rate { //反操
switchRelay.DcJ = false
switchRelay.FcJ = true
} else { //定操
switchRelay.DcJ = true
switchRelay.FcJ = false
}
return FirePercentageDevice(w, switchEntry, lhDistance, turnRateValue)
}
return nil
}
// 获取道岔转动耗时ms

View File

@ -12,7 +12,8 @@ message DeviceIdentity{
/////////////////////////////////////////////////////////
//
//
//
message SwitchRelayState{
//
//true-
@ -27,6 +28,16 @@ message SwitchRelayState{
//true-
bool fbJ = 4;
}
//
//
message SwitchControlState{
//
bool fireDcj = 1;
//
bool fireFcj = 2;
//0-100ms
int64 lhDistance = 4;
}
///////////////////////////////////////////////////////////

View File

@ -26,10 +26,9 @@ const (
// world 执行
func (me *PercentageDeviceSystem) Update(world ecs.World) {
me.query.Each(world, func(e *ecs.Entry) {
percentage := components.PercentageDeviceStateComponent.Get(e)
movable := components.MovableDeviceStateComponent.Get(e)
if percentage.Rate != percentage.Target || movable.Speed > 0 {
movable := components.MovableDeviceStateComponent.Get(e)
if movable.Speed > 0 {
percentage := components.PercentageDeviceStateComponent.Get(e)
if movable.ToH {
if movable.Position >= percentage.Target {
movable.Speed = 0
@ -57,3 +56,8 @@ func GetRateValue(rate int8) int64 {
func GetRate(rateValue int64) int8 {
return int8((float64(rateValue) / float64(PercentageRateValueMax)) * float64(100))
}
// 比率值变动速率计算
func CalculateRateSpeed(tick int32, lhDistance int64) int32 {
return int32(float64(tick) * (float64(PercentageRateValueMax) / float64(lhDistance)))
}

View File

@ -0,0 +1,49 @@
package system
import (
"github.com/yohamta/donburi/filter"
"joylink.club/ecs"
"joylink.club/rtsssimulation/components"
)
// 控制道岔定操反操的执行过程
type SwitchControlSystem struct {
query *ecs.Query
}
func NewSwitchControlSystem() *SwitchControlSystem {
return &SwitchControlSystem{query: ecs.NewQuery(filter.Contains(components.SwitchControlStateComponent))}
}
// world 执行
func (me *SwitchControlSystem) Update(w ecs.World) {
me.query.Each(w, func(e *ecs.Entry) {
control := components.SwitchControlStateComponent.Get(e)
if control.FireDcj || control.FireFcj {
relay := components.SwitchRelayStateComponent.Get(e)
percent := components.PercentageDeviceStateComponent.Get(e)
movable := components.MovableDeviceStateComponent.Get(e)
//
relay.DcJ = false
relay.FcJ = false
relay.DbJ = false
relay.FbJ = false
//
movable.Speed = CalculateRateSpeed(int32(w.Tick()), control.LhDistance)
//
if control.FireDcj {
relay.DcJ = true
movable.ToH = false
percent.Target = SwitchNormalVaule
}
if control.FireFcj {
relay.FcJ = true
movable.ToH = true
percent.Target = SwitchReverseValue
}
//
control.FireDcj = false
control.FireFcj = false
}
})
}

View File

@ -16,15 +16,16 @@ const (
)
// 道岔系统操作
type SwitchSystem struct {
type SwitchRelaySystem struct {
}
func NewSwitchSystem() *SwitchSystem {
return &SwitchSystem{}
func NewSwitchRelaySystem() *SwitchRelaySystem {
return &SwitchRelaySystem{}
}
// world 执行
func (me *SwitchSystem) Update(w ecs.World) {
// 观察道岔百分比组件来更新道岔逻辑继电器状态
func (me *SwitchRelaySystem) Update(w ecs.World) {
SwitchQuery.Each(w, func(e *ecs.Entry) {
switchPercent := components.PercentageDeviceStateComponent.Get(e)
switchRelay := components.SwitchRelayStateComponent.Get(e)