diff --git a/component/ci.go b/component/ci.go new file mode 100644 index 0000000..65bb7c1 --- /dev/null +++ b/component/ci.go @@ -0,0 +1,10 @@ +package component + +import ( + "joylink.club/ecs" + "joylink.club/rtsssimulation/component/component_data" +) + +var ( + CiSysRAMType = ecs.NewComponentType[component_data.CiSysRAM]() +) diff --git a/component/common.go b/component/common.go index 258c2e9..4a475bc 100644 --- a/component/common.go +++ b/component/common.go @@ -6,6 +6,8 @@ import ( "joylink.club/rtsssimulation/consts" ) +var BitType = ecs.NewComponentType[bool]() + // 唯一ID组件 type Uid struct { Id string @@ -19,16 +21,17 @@ var UidType = ecs.NewComponentType[Uid]() // Speed int // } -type TwoPositionTransform struct { +type FixedPositionTransform struct { component_proto.TwoPositionTransform } // 当前位置百分比值 -func (tp *TwoPositionTransform) Percentage() float32 { +func (tp *FixedPositionTransform) Percentage() float32 { return float32(tp.Pos) / consts.TwoPosMax } -var TwoPositionTransformType = ecs.NewComponentType[TwoPositionTransform]() +// 固定位置转换组件类型 +var FixedPositionTransformType = ecs.NewComponentType[FixedPositionTransform]() // 计算两位置动作的平均速度 // 总时间t和tick的单位都应该是ms diff --git a/component/component_data/ci.pb.go b/component/component_data/ci.pb.go new file mode 100644 index 0000000..5368b01 --- /dev/null +++ b/component/component_data/ci.pb.go @@ -0,0 +1,1305 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.23.1 +// source: component/ci.proto + +package component_data + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// 信号显示 +type Signal_Aspect int32 + +const ( + // 红灯亮 + Signal_H Signal_Aspect = 0 + // 绿灯亮 + Signal_L Signal_Aspect = 1 + // 黄灯亮 + Signal_U Signal_Aspect = 2 + // 黄红灯亮(引导信号) + Signal_UH Signal_Aspect = 3 + // 白灯亮 + Signal_B Signal_Aspect = 4 + // 蓝灯亮 + Signal_A Signal_Aspect = 5 +) + +// Enum value maps for Signal_Aspect. +var ( + Signal_Aspect_name = map[int32]string{ + 0: "H", + 1: "L", + 2: "U", + 3: "UH", + 4: "B", + 5: "A", + } + Signal_Aspect_value = map[string]int32{ + "H": 0, + "L": 1, + "U": 2, + "UH": 3, + "B": 4, + "A": 5, + } +) + +func (x Signal_Aspect) Enum() *Signal_Aspect { + p := new(Signal_Aspect) + *p = x + return p +} + +func (x Signal_Aspect) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Signal_Aspect) Descriptor() protoreflect.EnumDescriptor { + return file_component_ci_proto_enumTypes[0].Descriptor() +} + +func (Signal_Aspect) Type() protoreflect.EnumType { + return &file_component_ci_proto_enumTypes[0] +} + +func (x Signal_Aspect) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Signal_Aspect.Descriptor instead. +func (Signal_Aspect) EnumDescriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{4, 0} +} + +// 进路信号控制级别 +type RouteSignal_ControlLevel int32 + +const ( + // 关闭 + RouteSignal_Close RouteSignal_ControlLevel = 0 + // 引导信号控制级别 + RouteSignal_CallOn RouteSignal_ControlLevel = 1 + // 移动闭塞信号控制级别 + RouteSignal_CTC RouteSignal_ControlLevel = 2 + // 主信号控制级别 + RouteSignal_Main RouteSignal_ControlLevel = 3 +) + +// Enum value maps for RouteSignal_ControlLevel. +var ( + RouteSignal_ControlLevel_name = map[int32]string{ + 0: "Close", + 1: "CallOn", + 2: "CTC", + 3: "Main", + } + RouteSignal_ControlLevel_value = map[string]int32{ + "Close": 0, + "CallOn": 1, + "CTC": 2, + "Main": 3, + } +) + +func (x RouteSignal_ControlLevel) Enum() *RouteSignal_ControlLevel { + p := new(RouteSignal_ControlLevel) + *p = x + return p +} + +func (x RouteSignal_ControlLevel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (RouteSignal_ControlLevel) Descriptor() protoreflect.EnumDescriptor { + return file_component_ci_proto_enumTypes[1].Descriptor() +} + +func (RouteSignal_ControlLevel) Type() protoreflect.EnumType { + return &file_component_ci_proto_enumTypes[1] +} + +func (x RouteSignal_ControlLevel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use RouteSignal_ControlLevel.Descriptor instead. +func (RouteSignal_ControlLevel) EnumDescriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{7, 0} +} + +// 联锁系统内存数据状态 +type CiSysRAM struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + QcStates map[string]*CiQcState `protobuf:"bytes,2,rep,name=qcStates,proto3" json:"qcStates,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SectionStates map[string]*CiSectionState `protobuf:"bytes,3,rep,name=sectionStates,proto3" json:"sectionStates,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + TurnoutStates map[string]*CiPointsState `protobuf:"bytes,4,rep,name=turnoutStates,proto3" json:"turnoutStates,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + SignalStates map[string]*CiSignalState `protobuf:"bytes,5,rep,name=signalStates,proto3" json:"signalStates,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + PlatformStates map[string]*CiPlatformState `protobuf:"bytes,6,rep,name=platformStates,proto3" json:"platformStates,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + RouteStates map[string]*CiRouteState `protobuf:"bytes,7,rep,name=routeStates,proto3" json:"routeStates,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + OverlapStates map[string]*CiOverlapState `protobuf:"bytes,8,rep,name=overlapStates,proto3" json:"overlapStates,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *CiSysRAM) Reset() { + *x = CiSysRAM{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CiSysRAM) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CiSysRAM) ProtoMessage() {} + +func (x *CiSysRAM) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_proto_msgTypes[0] + 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 CiSysRAM.ProtoReflect.Descriptor instead. +func (*CiSysRAM) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{0} +} + +func (x *CiSysRAM) GetQcStates() map[string]*CiQcState { + if x != nil { + return x.QcStates + } + return nil +} + +func (x *CiSysRAM) GetSectionStates() map[string]*CiSectionState { + if x != nil { + return x.SectionStates + } + return nil +} + +func (x *CiSysRAM) GetTurnoutStates() map[string]*CiPointsState { + if x != nil { + return x.TurnoutStates + } + return nil +} + +func (x *CiSysRAM) GetSignalStates() map[string]*CiSignalState { + if x != nil { + return x.SignalStates + } + return nil +} + +func (x *CiSysRAM) GetPlatformStates() map[string]*CiPlatformState { + if x != nil { + return x.PlatformStates + } + return nil +} + +func (x *CiSysRAM) GetRouteStates() map[string]*CiRouteState { + if x != nil { + return x.RouteStates + } + return nil +} + +func (x *CiSysRAM) GetOverlapStates() map[string]*CiOverlapState { + if x != nil { + return x.OverlapStates + } + return nil +} + +// 联锁驱动、采集状态表 +type CiQcState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 驱动bit表 + Qbs []byte `protobuf:"bytes,2,opt,name=qbs,proto3" json:"qbs,omitempty"` + // 采集bit表 + Cbs []byte `protobuf:"bytes,3,opt,name=cbs,proto3" json:"cbs,omitempty"` +} + +func (x *CiQcState) Reset() { + *x = CiQcState{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CiQcState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CiQcState) ProtoMessage() {} + +func (x *CiQcState) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_proto_msgTypes[1] + 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 CiQcState.ProtoReflect.Descriptor instead. +func (*CiQcState) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{1} +} + +func (x *CiQcState) GetQbs() []byte { + if x != nil { + return x.Qbs + } + return nil +} + +func (x *CiQcState) GetCbs() []byte { + if x != nil { + return x.Cbs + } + return nil +} + +// 联锁区段状态 +type CiSectionState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 是否物理检测占用 + CiOccupied bool `protobuf:"varint,2,opt,name=ciOccupied,proto3" json:"ciOccupied,omitempty"` + // 是否cbtc逻辑占用 + CbtcOccupied bool `protobuf:"varint,3,opt,name=cbtcOccupied,proto3" json:"cbtcOccupied,omitempty"` + // 是否进路锁闭 + RouteLock bool `protobuf:"varint,4,opt,name=routeLock,proto3" json:"routeLock,omitempty"` + // 是否延续保护锁闭 + OverlapLock bool `protobuf:"varint,5,opt,name=overlapLock,proto3" json:"overlapLock,omitempty"` + // 是否封锁 + Block bool `protobuf:"varint,6,opt,name=block,proto3" json:"block,omitempty"` + // 是否故障锁闭 + FailLock bool `protobuf:"varint,7,opt,name=failLock,proto3" json:"failLock,omitempty"` +} + +func (x *CiSectionState) Reset() { + *x = CiSectionState{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CiSectionState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CiSectionState) ProtoMessage() {} + +func (x *CiSectionState) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_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 CiSectionState.ProtoReflect.Descriptor instead. +func (*CiSectionState) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{2} +} + +func (x *CiSectionState) GetCiOccupied() bool { + if x != nil { + return x.CiOccupied + } + return false +} + +func (x *CiSectionState) GetCbtcOccupied() bool { + if x != nil { + return x.CbtcOccupied + } + return false +} + +func (x *CiSectionState) GetRouteLock() bool { + if x != nil { + return x.RouteLock + } + return false +} + +func (x *CiSectionState) GetOverlapLock() bool { + if x != nil { + return x.OverlapLock + } + return false +} + +func (x *CiSectionState) GetBlock() bool { + if x != nil { + return x.Block + } + return false +} + +func (x *CiSectionState) GetFailLock() bool { + if x != nil { + return x.FailLock + } + return false +} + +// 联锁道岔状态 +type CiPointsState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 是否物理检测占用 + CiOccupied bool `protobuf:"varint,1,opt,name=ciOccupied,proto3" json:"ciOccupied,omitempty"` + // 是否cbtc逻辑占用 + CbtcOccupied bool `protobuf:"varint,2,opt,name=cbtcOccupied,proto3" json:"cbtcOccupied,omitempty"` + // 是否进路锁闭 + RouteLock bool `protobuf:"varint,3,opt,name=routeLock,proto3" json:"routeLock,omitempty"` + // 是否延续保护锁闭 + OverlapLock bool `protobuf:"varint,4,opt,name=overlapLock,proto3" json:"overlapLock,omitempty"` + // 是否封锁 + Block bool `protobuf:"varint,5,opt,name=block,proto3" json:"block,omitempty"` + // 是否故障锁闭 + FailLock bool `protobuf:"varint,6,opt,name=failLock,proto3" json:"failLock,omitempty"` + // 是否定位 + Normal bool `protobuf:"varint,7,opt,name=normal,proto3" json:"normal,omitempty"` + // 是否反位 + Reverse bool `protobuf:"varint,8,opt,name=reverse,proto3" json:"reverse,omitempty"` + // 是否挤岔 + Jammed bool `protobuf:"varint,9,opt,name=jammed,proto3" json:"jammed,omitempty"` + // 是否单锁 + SingleLock bool `protobuf:"varint,10,opt,name=singleLock,proto3" json:"singleLock,omitempty"` +} + +func (x *CiPointsState) Reset() { + *x = CiPointsState{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CiPointsState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CiPointsState) ProtoMessage() {} + +func (x *CiPointsState) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_proto_msgTypes[3] + 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 CiPointsState.ProtoReflect.Descriptor instead. +func (*CiPointsState) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{3} +} + +func (x *CiPointsState) GetCiOccupied() bool { + if x != nil { + return x.CiOccupied + } + return false +} + +func (x *CiPointsState) GetCbtcOccupied() bool { + if x != nil { + return x.CbtcOccupied + } + return false +} + +func (x *CiPointsState) GetRouteLock() bool { + if x != nil { + return x.RouteLock + } + return false +} + +func (x *CiPointsState) GetOverlapLock() bool { + if x != nil { + return x.OverlapLock + } + return false +} + +func (x *CiPointsState) GetBlock() bool { + if x != nil { + return x.Block + } + return false +} + +func (x *CiPointsState) GetFailLock() bool { + if x != nil { + return x.FailLock + } + return false +} + +func (x *CiPointsState) GetNormal() bool { + if x != nil { + return x.Normal + } + return false +} + +func (x *CiPointsState) GetReverse() bool { + if x != nil { + return x.Reverse + } + return false +} + +func (x *CiPointsState) GetJammed() bool { + if x != nil { + return x.Jammed + } + return false +} + +func (x *CiPointsState) GetSingleLock() bool { + if x != nil { + return x.SingleLock + } + return false +} + +type Signal struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Signal) Reset() { + *x = Signal{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Signal) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Signal) ProtoMessage() {} + +func (x *Signal) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_proto_msgTypes[4] + 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 Signal.ProtoReflect.Descriptor instead. +func (*Signal) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{4} +} + +// 联锁信号机状态 +type CiSignalState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 信号显示 + Aspect Signal_Aspect `protobuf:"varint,1,opt,name=aspect,proto3,enum=component.Signal_Aspect" json:"aspect,omitempty"` + // 是否逻辑点灯(即室外灭灯) + Logic bool `protobuf:"varint,2,opt,name=logic,proto3" json:"logic,omitempty"` + // 是否封锁 + Block bool `protobuf:"varint,3,opt,name=block,proto3" json:"block,omitempty"` + // 是否灯丝断丝 + LampFault bool `protobuf:"varint,4,opt,name=lampFault,proto3" json:"lampFault,omitempty"` +} + +func (x *CiSignalState) Reset() { + *x = CiSignalState{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CiSignalState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CiSignalState) ProtoMessage() {} + +func (x *CiSignalState) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_proto_msgTypes[5] + 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 CiSignalState.ProtoReflect.Descriptor instead. +func (*CiSignalState) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{5} +} + +func (x *CiSignalState) GetAspect() Signal_Aspect { + if x != nil { + return x.Aspect + } + return Signal_H +} + +func (x *CiSignalState) GetLogic() bool { + if x != nil { + return x.Logic + } + return false +} + +func (x *CiSignalState) GetBlock() bool { + if x != nil { + return x.Block + } + return false +} + +func (x *CiSignalState) GetLampFault() bool { + if x != nil { + return x.LampFault + } + return false +} + +// 联锁站台状态 +type CiPlatformState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 车站上行扣车 + UpwardHold bool `protobuf:"varint,1,opt,name=upwardHold,proto3" json:"upwardHold,omitempty"` + // 车站下行扣车 + DownwardHold bool `protobuf:"varint,2,opt,name=downwardHold,proto3" json:"downwardHold,omitempty"` + // 中心上行扣车 + OccUpwardHold bool `protobuf:"varint,3,opt,name=occUpwardHold,proto3" json:"occUpwardHold,omitempty"` + // 中心下行扣车 + OccDownwardHold bool `protobuf:"varint,4,opt,name=occDownwardHold,proto3" json:"occDownwardHold,omitempty"` + // 屏蔽门开 + PsdOpen bool `protobuf:"varint,5,opt,name=psdOpen,proto3" json:"psdOpen,omitempty"` + // 紧急关闭/停车 + EmergStop bool `protobuf:"varint,6,opt,name=emergStop,proto3" json:"emergStop,omitempty"` + // 停站时间 + StopTime int32 `protobuf:"varint,7,opt,name=stopTime,proto3" json:"stopTime,omitempty"` +} + +func (x *CiPlatformState) Reset() { + *x = CiPlatformState{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CiPlatformState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CiPlatformState) ProtoMessage() {} + +func (x *CiPlatformState) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_proto_msgTypes[6] + 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 CiPlatformState.ProtoReflect.Descriptor instead. +func (*CiPlatformState) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{6} +} + +func (x *CiPlatformState) GetUpwardHold() bool { + if x != nil { + return x.UpwardHold + } + return false +} + +func (x *CiPlatformState) GetDownwardHold() bool { + if x != nil { + return x.DownwardHold + } + return false +} + +func (x *CiPlatformState) GetOccUpwardHold() bool { + if x != nil { + return x.OccUpwardHold + } + return false +} + +func (x *CiPlatformState) GetOccDownwardHold() bool { + if x != nil { + return x.OccDownwardHold + } + return false +} + +func (x *CiPlatformState) GetPsdOpen() bool { + if x != nil { + return x.PsdOpen + } + return false +} + +func (x *CiPlatformState) GetEmergStop() bool { + if x != nil { + return x.EmergStop + } + return false +} + +func (x *CiPlatformState) GetStopTime() int32 { + if x != nil { + return x.StopTime + } + return 0 +} + +type RouteSignal struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RouteSignal) Reset() { + *x = RouteSignal{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RouteSignal) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RouteSignal) ProtoMessage() {} + +func (x *RouteSignal) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_proto_msgTypes[7] + 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 RouteSignal.ProtoReflect.Descriptor instead. +func (*RouteSignal) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{7} +} + +// 联锁进路状态 +type CiRouteState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 是否进路锁闭 + Lock bool `protobuf:"varint,1,opt,name=lock,proto3" json:"lock,omitempty"` + // 是否接近锁闭 + ApproachLock bool `protobuf:"varint,2,opt,name=approachLock,proto3" json:"approachLock,omitempty"` + // 是否车队模式 + FleetMode bool `protobuf:"varint,3,opt,name=fleetMode,proto3" json:"fleetMode,omitempty"` + // 是否联锁自动触发 + CiAutoMode bool `protobuf:"varint,4,opt,name=ciAutoMode,proto3" json:"ciAutoMode,omitempty"` + // 是否ats自动控 + AtsAutoMode bool `protobuf:"varint,5,opt,name=atsAutoMode,proto3" json:"atsAutoMode,omitempty"` + // 是否办理中 + Setting bool `protobuf:"varint,6,opt,name=setting,proto3" json:"setting,omitempty"` + // 进路信号控制级别 + ControlLevel RouteSignal_ControlLevel `protobuf:"varint,7,opt,name=controlLevel,proto3,enum=component.RouteSignal_ControlLevel" json:"controlLevel,omitempty"` +} + +func (x *CiRouteState) Reset() { + *x = CiRouteState{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CiRouteState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CiRouteState) ProtoMessage() {} + +func (x *CiRouteState) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_proto_msgTypes[8] + 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 CiRouteState.ProtoReflect.Descriptor instead. +func (*CiRouteState) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{8} +} + +func (x *CiRouteState) GetLock() bool { + if x != nil { + return x.Lock + } + return false +} + +func (x *CiRouteState) GetApproachLock() bool { + if x != nil { + return x.ApproachLock + } + return false +} + +func (x *CiRouteState) GetFleetMode() bool { + if x != nil { + return x.FleetMode + } + return false +} + +func (x *CiRouteState) GetCiAutoMode() bool { + if x != nil { + return x.CiAutoMode + } + return false +} + +func (x *CiRouteState) GetAtsAutoMode() bool { + if x != nil { + return x.AtsAutoMode + } + return false +} + +func (x *CiRouteState) GetSetting() bool { + if x != nil { + return x.Setting + } + return false +} + +func (x *CiRouteState) GetControlLevel() RouteSignal_ControlLevel { + if x != nil { + return x.ControlLevel + } + return RouteSignal_Close +} + +// 联锁延续保护进路状态 +type CiOverlapState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 是否延续保护锁闭 + Lock bool `protobuf:"varint,1,opt,name=lock,proto3" json:"lock,omitempty"` +} + +func (x *CiOverlapState) Reset() { + *x = CiOverlapState{} + if protoimpl.UnsafeEnabled { + mi := &file_component_ci_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CiOverlapState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CiOverlapState) ProtoMessage() {} + +func (x *CiOverlapState) ProtoReflect() protoreflect.Message { + mi := &file_component_ci_proto_msgTypes[9] + 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 CiOverlapState.ProtoReflect.Descriptor instead. +func (*CiOverlapState) Descriptor() ([]byte, []int) { + return file_component_ci_proto_rawDescGZIP(), []int{9} +} + +func (x *CiOverlapState) GetLock() bool { + if x != nil { + return x.Lock + } + return false +} + +var File_component_ci_proto protoreflect.FileDescriptor + +var file_component_ci_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x69, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x22, + 0x93, 0x09, 0x0a, 0x08, 0x43, 0x69, 0x53, 0x79, 0x73, 0x52, 0x41, 0x4d, 0x12, 0x3d, 0x0a, 0x08, + 0x71, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x53, 0x79, 0x73, + 0x52, 0x41, 0x4d, 0x2e, 0x51, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x08, 0x71, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x0d, 0x73, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, + 0x69, 0x53, 0x79, 0x73, 0x52, 0x41, 0x4d, 0x2e, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x73, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x0d, 0x74, 0x75, 0x72, + 0x6e, 0x6f, 0x75, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x53, + 0x79, 0x73, 0x52, 0x41, 0x4d, 0x2e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, + 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x49, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x53, 0x79, 0x73, 0x52, + 0x41, 0x4d, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x73, 0x12, 0x4f, 0x0a, 0x0e, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x53, 0x79, 0x73, 0x52, 0x41, 0x4d, 0x2e, + 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x0e, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x0b, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x53, 0x79, 0x73, 0x52, 0x41, 0x4d, 0x2e, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, + 0x72, 0x6f, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x0d, 0x6f, + 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, + 0x69, 0x53, 0x79, 0x73, 0x52, 0x41, 0x4d, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x6f, 0x76, 0x65, 0x72, + 0x6c, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x1a, 0x51, 0x0a, 0x0d, 0x51, 0x63, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x51, 0x63, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5b, 0x0a, 0x12, + 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, + 0x43, 0x69, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5a, 0x0a, 0x12, 0x54, 0x75, 0x72, + 0x6e, 0x6f, 0x75, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x50, + 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x59, 0x0a, 0x11, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2e, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x1a, 0x5d, 0x0a, 0x13, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, + 0x57, 0x0a, 0x10, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, + 0x2e, 0x43, 0x69, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5b, 0x0a, 0x12, 0x4f, 0x76, 0x65, 0x72, + 0x6c, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x2f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x19, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x69, 0x4f, 0x76, + 0x65, 0x72, 0x6c, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x2f, 0x0a, 0x09, 0x43, 0x69, 0x51, 0x63, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x71, 0x62, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x03, 0x71, 0x62, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x62, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x03, 0x63, 0x62, 0x73, 0x22, 0xc6, 0x01, 0x0a, 0x0e, 0x43, 0x69, 0x53, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x4f, + 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x63, + 0x69, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x62, 0x74, + 0x63, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0c, 0x63, 0x62, 0x74, 0x63, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x12, 0x1c, 0x0a, + 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x4c, 0x6f, 0x63, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x6f, + 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x4c, 0x6f, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0b, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x14, 0x0a, + 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x63, 0x6b, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x63, 0x6b, 0x22, + 0xaf, 0x02, 0x0a, 0x0d, 0x43, 0x69, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x63, 0x69, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, + 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x62, 0x74, 0x63, 0x4f, 0x63, 0x63, 0x75, 0x70, 0x69, 0x65, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x63, 0x62, 0x74, 0x63, 0x4f, 0x63, 0x63, + 0x75, 0x70, 0x69, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x4c, 0x6f, + 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x4c, + 0x6f, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x4c, 0x6f, + 0x63, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, + 0x70, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x66, + 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, + 0x61, 0x69, 0x6c, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x72, 0x6d, 0x61, + 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x12, + 0x18, 0x0a, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x07, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6a, 0x61, 0x6d, + 0x6d, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6a, 0x61, 0x6d, 0x6d, 0x65, + 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x6b, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x4c, 0x6f, 0x63, + 0x6b, 0x22, 0x3d, 0x0a, 0x06, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x22, 0x33, 0x0a, 0x06, 0x41, + 0x73, 0x70, 0x65, 0x63, 0x74, 0x12, 0x05, 0x0a, 0x01, 0x48, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, + 0x4c, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x55, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x55, 0x48, + 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x04, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x05, + 0x22, 0x8b, 0x01, 0x0a, 0x0d, 0x43, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x52, 0x06, 0x61, 0x73, + 0x70, 0x65, 0x63, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x61, 0x6d, 0x70, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x6c, 0x61, 0x6d, 0x70, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x22, 0xf9, + 0x01, 0x0a, 0x0f, 0x43, 0x69, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x70, 0x77, 0x61, 0x72, 0x64, 0x48, 0x6f, 0x6c, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x75, 0x70, 0x77, 0x61, 0x72, 0x64, 0x48, 0x6f, + 0x6c, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x77, 0x61, 0x72, 0x64, 0x48, 0x6f, + 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x77, 0x61, + 0x72, 0x64, 0x48, 0x6f, 0x6c, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x63, 0x63, 0x55, 0x70, 0x77, + 0x61, 0x72, 0x64, 0x48, 0x6f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x6f, + 0x63, 0x63, 0x55, 0x70, 0x77, 0x61, 0x72, 0x64, 0x48, 0x6f, 0x6c, 0x64, 0x12, 0x28, 0x0a, 0x0f, + 0x6f, 0x63, 0x63, 0x44, 0x6f, 0x77, 0x6e, 0x77, 0x61, 0x72, 0x64, 0x48, 0x6f, 0x6c, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x6f, 0x63, 0x63, 0x44, 0x6f, 0x77, 0x6e, 0x77, 0x61, + 0x72, 0x64, 0x48, 0x6f, 0x6c, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x73, 0x64, 0x4f, 0x70, 0x65, + 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x73, 0x64, 0x4f, 0x70, 0x65, 0x6e, + 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6d, 0x65, 0x72, 0x67, 0x53, 0x74, 0x6f, 0x70, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x6d, 0x65, 0x72, 0x67, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x1a, + 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x08, 0x73, 0x74, 0x6f, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x47, 0x0a, 0x0b, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x22, 0x38, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x6c, 0x6f, + 0x73, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x4f, 0x6e, 0x10, 0x01, + 0x12, 0x07, 0x0a, 0x03, 0x43, 0x54, 0x43, 0x10, 0x02, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x61, 0x69, + 0x6e, 0x10, 0x03, 0x22, 0x89, 0x02, 0x0a, 0x0c, 0x43, 0x69, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x04, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x70, 0x70, 0x72, + 0x6f, 0x61, 0x63, 0x68, 0x4c, 0x6f, 0x63, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, + 0x61, 0x70, 0x70, 0x72, 0x6f, 0x61, 0x63, 0x68, 0x4c, 0x6f, 0x63, 0x6b, 0x12, 0x1c, 0x0a, 0x09, + 0x66, 0x6c, 0x65, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x09, 0x66, 0x6c, 0x65, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, + 0x41, 0x75, 0x74, 0x6f, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, + 0x63, 0x69, 0x41, 0x75, 0x74, 0x6f, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x74, + 0x73, 0x41, 0x75, 0x74, 0x6f, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x0b, 0x61, 0x74, 0x73, 0x41, 0x75, 0x74, 0x6f, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x73, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, + 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x47, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x63, + 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x53, 0x69, + 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4c, 0x65, 0x76, 0x65, + 0x6c, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, + 0x24, 0x0a, 0x0e, 0x43, 0x69, 0x4f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x04, 0x6c, 0x6f, 0x63, 0x6b, 0x42, 0x1c, 0x5a, 0x1a, 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x64, + 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_component_ci_proto_rawDescOnce sync.Once + file_component_ci_proto_rawDescData = file_component_ci_proto_rawDesc +) + +func file_component_ci_proto_rawDescGZIP() []byte { + file_component_ci_proto_rawDescOnce.Do(func() { + file_component_ci_proto_rawDescData = protoimpl.X.CompressGZIP(file_component_ci_proto_rawDescData) + }) + return file_component_ci_proto_rawDescData +} + +var file_component_ci_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_component_ci_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_component_ci_proto_goTypes = []interface{}{ + (Signal_Aspect)(0), // 0: component.Signal.Aspect + (RouteSignal_ControlLevel)(0), // 1: component.RouteSignal.ControlLevel + (*CiSysRAM)(nil), // 2: component.CiSysRAM + (*CiQcState)(nil), // 3: component.CiQcState + (*CiSectionState)(nil), // 4: component.CiSectionState + (*CiPointsState)(nil), // 5: component.CiPointsState + (*Signal)(nil), // 6: component.Signal + (*CiSignalState)(nil), // 7: component.CiSignalState + (*CiPlatformState)(nil), // 8: component.CiPlatformState + (*RouteSignal)(nil), // 9: component.RouteSignal + (*CiRouteState)(nil), // 10: component.CiRouteState + (*CiOverlapState)(nil), // 11: component.CiOverlapState + nil, // 12: component.CiSysRAM.QcStatesEntry + nil, // 13: component.CiSysRAM.SectionStatesEntry + nil, // 14: component.CiSysRAM.TurnoutStatesEntry + nil, // 15: component.CiSysRAM.SignalStatesEntry + nil, // 16: component.CiSysRAM.PlatformStatesEntry + nil, // 17: component.CiSysRAM.RouteStatesEntry + nil, // 18: component.CiSysRAM.OverlapStatesEntry +} +var file_component_ci_proto_depIdxs = []int32{ + 12, // 0: component.CiSysRAM.qcStates:type_name -> component.CiSysRAM.QcStatesEntry + 13, // 1: component.CiSysRAM.sectionStates:type_name -> component.CiSysRAM.SectionStatesEntry + 14, // 2: component.CiSysRAM.turnoutStates:type_name -> component.CiSysRAM.TurnoutStatesEntry + 15, // 3: component.CiSysRAM.signalStates:type_name -> component.CiSysRAM.SignalStatesEntry + 16, // 4: component.CiSysRAM.platformStates:type_name -> component.CiSysRAM.PlatformStatesEntry + 17, // 5: component.CiSysRAM.routeStates:type_name -> component.CiSysRAM.RouteStatesEntry + 18, // 6: component.CiSysRAM.overlapStates:type_name -> component.CiSysRAM.OverlapStatesEntry + 0, // 7: component.CiSignalState.aspect:type_name -> component.Signal.Aspect + 1, // 8: component.CiRouteState.controlLevel:type_name -> component.RouteSignal.ControlLevel + 3, // 9: component.CiSysRAM.QcStatesEntry.value:type_name -> component.CiQcState + 4, // 10: component.CiSysRAM.SectionStatesEntry.value:type_name -> component.CiSectionState + 5, // 11: component.CiSysRAM.TurnoutStatesEntry.value:type_name -> component.CiPointsState + 7, // 12: component.CiSysRAM.SignalStatesEntry.value:type_name -> component.CiSignalState + 8, // 13: component.CiSysRAM.PlatformStatesEntry.value:type_name -> component.CiPlatformState + 10, // 14: component.CiSysRAM.RouteStatesEntry.value:type_name -> component.CiRouteState + 11, // 15: component.CiSysRAM.OverlapStatesEntry.value:type_name -> component.CiOverlapState + 16, // [16:16] is the sub-list for method output_type + 16, // [16:16] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name +} + +func init() { file_component_ci_proto_init() } +func file_component_ci_proto_init() { + if File_component_ci_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_component_ci_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiSysRAM); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_ci_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiQcState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_ci_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiSectionState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_ci_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiPointsState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_ci_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Signal); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_ci_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiSignalState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_ci_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiPlatformState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_ci_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RouteSignal); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_ci_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiRouteState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_ci_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CiOverlapState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_component_ci_proto_rawDesc, + NumEnums: 2, + NumMessages: 17, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_component_ci_proto_goTypes, + DependencyIndexes: file_component_ci_proto_depIdxs, + EnumInfos: file_component_ci_proto_enumTypes, + MessageInfos: file_component_ci_proto_msgTypes, + }.Build() + File_component_ci_proto = out.File + file_component_ci_proto_rawDesc = nil + file_component_ci_proto_goTypes = nil + file_component_ci_proto_depIdxs = nil +} diff --git a/component/component_data/common.pb.go b/component/component_data/common.pb.go new file mode 100644 index 0000000..ee5921d --- /dev/null +++ b/component/component_data/common.pb.go @@ -0,0 +1,436 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.23.1 +// source: component/common.proto + +package component_data + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// 电机 +type Motor struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 是否通电 + PowerUp bool `protobuf:"varint,1,opt,name=powerUp,proto3" json:"powerUp,omitempty"` + // 是否正转 + Forward bool `protobuf:"varint,2,opt,name=forward,proto3" json:"forward,omitempty"` +} + +func (x *Motor) Reset() { + *x = Motor{} + if protoimpl.UnsafeEnabled { + mi := &file_component_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Motor) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Motor) ProtoMessage() {} + +func (x *Motor) ProtoReflect() protoreflect.Message { + mi := &file_component_common_proto_msgTypes[0] + 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 Motor.ProtoReflect.Descriptor instead. +func (*Motor) Descriptor() ([]byte, []int) { + return file_component_common_proto_rawDescGZIP(), []int{0} +} + +func (x *Motor) GetPowerUp() bool { + if x != nil { + return x.PowerUp + } + return false +} + +func (x *Motor) GetForward() bool { + if x != nil { + return x.Forward + } + return false +} + +// 固定位置转换组件 +type FixedPositionTransform struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pos int32 `protobuf:"varint,1,opt,name=pos,proto3" json:"pos,omitempty"` // 当前位置百分比,[0, 10000],两位小数 + Speed int32 `protobuf:"varint,2,opt,name=speed,proto3" json:"speed,omitempty"` +} + +func (x *FixedPositionTransform) Reset() { + *x = FixedPositionTransform{} + if protoimpl.UnsafeEnabled { + mi := &file_component_common_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FixedPositionTransform) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FixedPositionTransform) ProtoMessage() {} + +func (x *FixedPositionTransform) ProtoReflect() protoreflect.Message { + mi := &file_component_common_proto_msgTypes[1] + 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 FixedPositionTransform.ProtoReflect.Descriptor instead. +func (*FixedPositionTransform) Descriptor() ([]byte, []int) { + return file_component_common_proto_rawDescGZIP(), []int{1} +} + +func (x *FixedPositionTransform) GetPos() int32 { + if x != nil { + return x.Pos + } + return 0 +} + +func (x *FixedPositionTransform) GetSpeed() int32 { + if x != nil { + return x.Speed + } + return 0 +} + +// 开关状态组件 +type BitState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val bool `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"` +} + +func (x *BitState) Reset() { + *x = BitState{} + if protoimpl.UnsafeEnabled { + mi := &file_component_common_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BitState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BitState) ProtoMessage() {} + +func (x *BitState) ProtoReflect() protoreflect.Message { + mi := &file_component_common_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 BitState.ProtoReflect.Descriptor instead. +func (*BitState) Descriptor() ([]byte, []int) { + return file_component_common_proto_rawDescGZIP(), []int{2} +} + +func (x *BitState) GetVal() bool { + if x != nil { + return x.Val + } + return false +} + +// 计数/计时组件 +type Counter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val int32 `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"` + Step int32 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"` +} + +func (x *Counter) Reset() { + *x = Counter{} + if protoimpl.UnsafeEnabled { + mi := &file_component_common_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Counter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Counter) ProtoMessage() {} + +func (x *Counter) ProtoReflect() protoreflect.Message { + mi := &file_component_common_proto_msgTypes[3] + 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 Counter.ProtoReflect.Descriptor instead. +func (*Counter) Descriptor() ([]byte, []int) { + return file_component_common_proto_rawDescGZIP(), []int{3} +} + +func (x *Counter) GetVal() int32 { + if x != nil { + return x.Val + } + return 0 +} + +func (x *Counter) GetStep() int32 { + if x != nil { + return x.Step + } + return 0 +} + +// 倒数/倒计时组件 +type CounterDown struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Val int32 `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"` + Step int32 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"` +} + +func (x *CounterDown) Reset() { + *x = CounterDown{} + if protoimpl.UnsafeEnabled { + mi := &file_component_common_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CounterDown) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CounterDown) ProtoMessage() {} + +func (x *CounterDown) ProtoReflect() protoreflect.Message { + mi := &file_component_common_proto_msgTypes[4] + 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 CounterDown.ProtoReflect.Descriptor instead. +func (*CounterDown) Descriptor() ([]byte, []int) { + return file_component_common_proto_rawDescGZIP(), []int{4} +} + +func (x *CounterDown) GetVal() int32 { + if x != nil { + return x.Val + } + return 0 +} + +func (x *CounterDown) GetStep() int32 { + if x != nil { + return x.Step + } + return 0 +} + +var File_component_common_proto protoreflect.FileDescriptor + +var file_component_common_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x22, 0x3b, 0x0a, 0x05, 0x4d, 0x6f, 0x74, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, + 0x70, 0x6f, 0x77, 0x65, 0x72, 0x55, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, + 0x6f, 0x77, 0x65, 0x72, 0x55, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, + 0x22, 0x40, 0x0a, 0x16, 0x46, 0x69, 0x78, 0x65, 0x64, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x6f, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x12, 0x14, 0x0a, 0x05, + 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x70, 0x65, + 0x65, 0x64, 0x22, 0x1c, 0x0a, 0x08, 0x42, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x76, 0x61, 0x6c, + 0x22, 0x2f, 0x0a, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x76, + 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x12, 0x0a, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x22, 0x33, 0x0a, 0x0b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x44, 0x6f, 0x77, 0x6e, + 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x76, + 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x42, 0x1c, 0x5a, 0x1a, 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, + 0x64, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_component_common_proto_rawDescOnce sync.Once + file_component_common_proto_rawDescData = file_component_common_proto_rawDesc +) + +func file_component_common_proto_rawDescGZIP() []byte { + file_component_common_proto_rawDescOnce.Do(func() { + file_component_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_component_common_proto_rawDescData) + }) + return file_component_common_proto_rawDescData +} + +var file_component_common_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_component_common_proto_goTypes = []interface{}{ + (*Motor)(nil), // 0: component.Motor + (*FixedPositionTransform)(nil), // 1: component.FixedPositionTransform + (*BitState)(nil), // 2: component.BitState + (*Counter)(nil), // 3: component.Counter + (*CounterDown)(nil), // 4: component.CounterDown +} +var file_component_common_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_component_common_proto_init() } +func file_component_common_proto_init() { + if File_component_common_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_component_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Motor); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FixedPositionTransform); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BitState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Counter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CounterDown); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_component_common_proto_rawDesc, + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_component_common_proto_goTypes, + DependencyIndexes: file_component_common_proto_depIdxs, + MessageInfos: file_component_common_proto_msgTypes, + }.Build() + File_component_common_proto = out.File + file_component_common_proto_rawDesc = nil + file_component_common_proto_goTypes = nil + file_component_common_proto_depIdxs = nil +} diff --git a/component/component_data/points.pb.go b/component/component_data/points.pb.go new file mode 100644 index 0000000..38f6420 --- /dev/null +++ b/component/component_data/points.pb.go @@ -0,0 +1,639 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v4.23.1 +// source: component/points.proto + +package component_data + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// 道岔故障 +type Points_Fault int32 + +const ( + // 失表 + Points_SB Points_Fault = 0 + // 定位失表 + Points_DWSB Points_Fault = 1 + // 反位失表 + Points_FWSB Points_Fault = 2 + // 挤岔 + Points_JC Points_Fault = 3 + // 联锁无法驱动故障 + Points_CIQD Points_Fault = 4 +) + +// Enum value maps for Points_Fault. +var ( + Points_Fault_name = map[int32]string{ + 0: "SB", + 1: "DWSB", + 2: "FWSB", + 3: "JC", + 4: "CIQD", + } + Points_Fault_value = map[string]int32{ + "SB": 0, + "DWSB": 1, + "FWSB": 2, + "JC": 3, + "CIQD": 4, + } +) + +func (x Points_Fault) Enum() *Points_Fault { + p := new(Points_Fault) + *p = x + return p +} + +func (x Points_Fault) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Points_Fault) Descriptor() protoreflect.EnumDescriptor { + return file_component_points_proto_enumTypes[0].Descriptor() +} + +func (Points_Fault) Type() protoreflect.EnumType { + return &file_component_points_proto_enumTypes[0] +} + +func (x Points_Fault) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Points_Fault.Descriptor instead. +func (Points_Fault) EnumDescriptor() ([]byte, []int) { + return file_component_points_proto_rawDescGZIP(), []int{2, 0} +} + +// 道岔转辙机自动开闭器状态 +// 自动开闭器接点位置,默认定位接通1/3排,反位接通2/4排 +// 由定位转反位(1DQJ和1DQJF励磁吸起,2DQJ在反位——即落下),三相电路导通,电机开始反转,转辙机将第3排接点接通第4排,到位锁闭后,转辙机的自动开闭器拉簧将第1排接点拉到第2排,接点到2排后,三相电路断路 +// 由反位转定位(1DQJ和1DQJF励磁吸起,2DQJ在定位——即吸起),三相电路导通,电机开始正转,转辙机将第2排接点接通第1排,到位锁闭后,转辙机的自动开闭器拉簧将第4排接点拉到第3排,接点到3排后,三相电路断路 +type PointsZzjKbqState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 接点在1/2排的位置,false-接点在1排,true-接点在2排 + Jd13 bool `protobuf:"varint,1,opt,name=jd13,proto3" json:"jd13,omitempty"` + // 接点在3/4排的位置,false-接点在3排,true-接点在4排 + Jd24 bool `protobuf:"varint,2,opt,name=jd24,proto3" json:"jd24,omitempty"` +} + +func (x *PointsZzjKbqState) Reset() { + *x = PointsZzjKbqState{} + if protoimpl.UnsafeEnabled { + mi := &file_component_points_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PointsZzjKbqState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PointsZzjKbqState) ProtoMessage() {} + +func (x *PointsZzjKbqState) ProtoReflect() protoreflect.Message { + mi := &file_component_points_proto_msgTypes[0] + 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 PointsZzjKbqState.ProtoReflect.Descriptor instead. +func (*PointsZzjKbqState) Descriptor() ([]byte, []int) { + return file_component_points_proto_rawDescGZIP(), []int{0} +} + +func (x *PointsZzjKbqState) GetJd13() bool { + if x != nil { + return x.Jd13 + } + return false +} + +func (x *PointsZzjKbqState) GetJd24() bool { + if x != nil { + return x.Jd24 + } + return false +} + +// 道岔位置状态表示组件 +type PointsPosition struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 是否定位(实际位置) + Dw bool `protobuf:"varint,1,opt,name=dw,proto3" json:"dw,omitempty"` + // 是否反位(实际位置) + Fw bool `protobuf:"varint,2,opt,name=fw,proto3" json:"fw,omitempty"` + // 定表 + Db bool `protobuf:"varint,3,opt,name=db,proto3" json:"db,omitempty"` + // 反表 + Fb bool `protobuf:"varint,4,opt,name=fb,proto3" json:"fb,omitempty"` +} + +func (x *PointsPosition) Reset() { + *x = PointsPosition{} + if protoimpl.UnsafeEnabled { + mi := &file_component_points_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PointsPosition) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PointsPosition) ProtoMessage() {} + +func (x *PointsPosition) ProtoReflect() protoreflect.Message { + mi := &file_component_points_proto_msgTypes[1] + 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 PointsPosition.ProtoReflect.Descriptor instead. +func (*PointsPosition) Descriptor() ([]byte, []int) { + return file_component_points_proto_rawDescGZIP(), []int{1} +} + +func (x *PointsPosition) GetDw() bool { + if x != nil { + return x.Dw + } + return false +} + +func (x *PointsPosition) GetFw() bool { + if x != nil { + return x.Fw + } + return false +} + +func (x *PointsPosition) GetDb() bool { + if x != nil { + return x.Db + } + return false +} + +func (x *PointsPosition) GetFb() bool { + if x != nil { + return x.Fb + } + return false +} + +// 道岔 +type Points struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *Points) Reset() { + *x = Points{} + if protoimpl.UnsafeEnabled { + mi := &file_component_points_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Points) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Points) ProtoMessage() {} + +func (x *Points) ProtoReflect() protoreflect.Message { + mi := &file_component_points_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 Points.ProtoReflect.Descriptor instead. +func (*Points) Descriptor() ([]byte, []int) { + return file_component_points_proto_rawDescGZIP(), []int{2} +} + +// 道岔失表故障 +type PointsFaultSB struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PointsFaultSB) Reset() { + *x = PointsFaultSB{} + if protoimpl.UnsafeEnabled { + mi := &file_component_points_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PointsFaultSB) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PointsFaultSB) ProtoMessage() {} + +func (x *PointsFaultSB) ProtoReflect() protoreflect.Message { + mi := &file_component_points_proto_msgTypes[3] + 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 PointsFaultSB.ProtoReflect.Descriptor instead. +func (*PointsFaultSB) Descriptor() ([]byte, []int) { + return file_component_points_proto_rawDescGZIP(), []int{3} +} + +// 道岔定位失表故障 +type PointsFaultDwsb struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PointsFaultDwsb) Reset() { + *x = PointsFaultDwsb{} + if protoimpl.UnsafeEnabled { + mi := &file_component_points_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PointsFaultDwsb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PointsFaultDwsb) ProtoMessage() {} + +func (x *PointsFaultDwsb) ProtoReflect() protoreflect.Message { + mi := &file_component_points_proto_msgTypes[4] + 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 PointsFaultDwsb.ProtoReflect.Descriptor instead. +func (*PointsFaultDwsb) Descriptor() ([]byte, []int) { + return file_component_points_proto_rawDescGZIP(), []int{4} +} + +// 道岔反位失表故障 +type PointsFaultFwsb struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PointsFaultFwsb) Reset() { + *x = PointsFaultFwsb{} + if protoimpl.UnsafeEnabled { + mi := &file_component_points_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PointsFaultFwsb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PointsFaultFwsb) ProtoMessage() {} + +func (x *PointsFaultFwsb) ProtoReflect() protoreflect.Message { + mi := &file_component_points_proto_msgTypes[5] + 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 PointsFaultFwsb.ProtoReflect.Descriptor instead. +func (*PointsFaultFwsb) Descriptor() ([]byte, []int) { + return file_component_points_proto_rawDescGZIP(), []int{5} +} + +// 道岔挤岔故障 +type PointsFaultJc struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PointsFaultJc) Reset() { + *x = PointsFaultJc{} + if protoimpl.UnsafeEnabled { + mi := &file_component_points_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PointsFaultJc) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PointsFaultJc) ProtoMessage() {} + +func (x *PointsFaultJc) ProtoReflect() protoreflect.Message { + mi := &file_component_points_proto_msgTypes[6] + 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 PointsFaultJc.ProtoReflect.Descriptor instead. +func (*PointsFaultJc) Descriptor() ([]byte, []int) { + return file_component_points_proto_rawDescGZIP(), []int{6} +} + +// 道岔联锁无法驱动故障 +type PointsFaultCiqd struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PointsFaultCiqd) Reset() { + *x = PointsFaultCiqd{} + if protoimpl.UnsafeEnabled { + mi := &file_component_points_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PointsFaultCiqd) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PointsFaultCiqd) ProtoMessage() {} + +func (x *PointsFaultCiqd) ProtoReflect() protoreflect.Message { + mi := &file_component_points_proto_msgTypes[7] + 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 PointsFaultCiqd.ProtoReflect.Descriptor instead. +func (*PointsFaultCiqd) Descriptor() ([]byte, []int) { + return file_component_points_proto_rawDescGZIP(), []int{7} +} + +var File_component_points_proto protoreflect.FileDescriptor + +var file_component_points_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x22, 0x3b, 0x0a, 0x11, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x5a, 0x7a, 0x6a, + 0x4b, 0x62, 0x71, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6a, 0x64, 0x31, 0x33, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x6a, 0x64, 0x31, 0x33, 0x12, 0x12, 0x0a, 0x04, + 0x6a, 0x64, 0x32, 0x34, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x6a, 0x64, 0x32, 0x34, + 0x22, 0x50, 0x0a, 0x0e, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, + 0x64, 0x77, 0x12, 0x0e, 0x0a, 0x02, 0x66, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, + 0x66, 0x77, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, + 0x64, 0x62, 0x12, 0x0e, 0x0a, 0x02, 0x66, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, + 0x66, 0x62, 0x22, 0x3f, 0x0a, 0x06, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x35, 0x0a, 0x05, + 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x06, 0x0a, 0x02, 0x53, 0x42, 0x10, 0x00, 0x12, 0x08, 0x0a, + 0x04, 0x44, 0x57, 0x53, 0x42, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x57, 0x53, 0x42, 0x10, + 0x02, 0x12, 0x06, 0x0a, 0x02, 0x4a, 0x43, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x49, 0x51, + 0x44, 0x10, 0x04, 0x22, 0x0f, 0x0a, 0x0d, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x46, 0x61, 0x75, + 0x6c, 0x74, 0x53, 0x42, 0x22, 0x11, 0x0a, 0x0f, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x46, 0x61, + 0x75, 0x6c, 0x74, 0x44, 0x77, 0x73, 0x62, 0x22, 0x11, 0x0a, 0x0f, 0x50, 0x6f, 0x69, 0x6e, 0x74, + 0x73, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x77, 0x73, 0x62, 0x22, 0x0f, 0x0a, 0x0d, 0x50, 0x6f, + 0x69, 0x6e, 0x74, 0x73, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x4a, 0x63, 0x22, 0x11, 0x0a, 0x0f, 0x50, + 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x43, 0x69, 0x71, 0x64, 0x42, 0x1c, + 0x5a, 0x1a, 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, + 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_component_points_proto_rawDescOnce sync.Once + file_component_points_proto_rawDescData = file_component_points_proto_rawDesc +) + +func file_component_points_proto_rawDescGZIP() []byte { + file_component_points_proto_rawDescOnce.Do(func() { + file_component_points_proto_rawDescData = protoimpl.X.CompressGZIP(file_component_points_proto_rawDescData) + }) + return file_component_points_proto_rawDescData +} + +var file_component_points_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_component_points_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_component_points_proto_goTypes = []interface{}{ + (Points_Fault)(0), // 0: component.Points.Fault + (*PointsZzjKbqState)(nil), // 1: component.PointsZzjKbqState + (*PointsPosition)(nil), // 2: component.PointsPosition + (*Points)(nil), // 3: component.Points + (*PointsFaultSB)(nil), // 4: component.PointsFaultSB + (*PointsFaultDwsb)(nil), // 5: component.PointsFaultDwsb + (*PointsFaultFwsb)(nil), // 6: component.PointsFaultFwsb + (*PointsFaultJc)(nil), // 7: component.PointsFaultJc + (*PointsFaultCiqd)(nil), // 8: component.PointsFaultCiqd +} +var file_component_points_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_component_points_proto_init() } +func file_component_points_proto_init() { + if File_component_points_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_component_points_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PointsZzjKbqState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_points_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PointsPosition); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_points_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Points); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_points_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PointsFaultSB); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_points_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PointsFaultDwsb); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_points_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PointsFaultFwsb); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_points_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PointsFaultJc); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_component_points_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PointsFaultCiqd); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_component_points_proto_rawDesc, + NumEnums: 1, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_component_points_proto_goTypes, + DependencyIndexes: file_component_points_proto_depIdxs, + EnumInfos: file_component_points_proto_enumTypes, + MessageInfos: file_component_points_proto_msgTypes, + }.Build() + File_component_points_proto = out.File + file_component_points_proto_rawDesc = nil + file_component_points_proto_goTypes = nil + file_component_points_proto_depIdxs = nil +} diff --git a/component/iscs_bas_pipe.go b/component/iscs_bas_pipe.go index 59a83b6..b087c95 100644 --- a/component/iscs_bas_pipe.go +++ b/component/iscs_bas_pipe.go @@ -3,16 +3,22 @@ package component import "joylink.club/ecs" // FluidPipe 流体管线 -// -// 管线内流体流动条件:1、管线内有流体;2、管线两端有压差;3、管线畅通 type FluidPipe struct { - FlowVelocity int32 //流速,大于零从管线A端向B端流动,小于零从管线B端向A端流动,等于零没有流动 + Direction PipeFlowDirection //流动方向 } +// PipeFlowDirection 管线内流体流动方向定义 +type PipeFlowDirection int8 + +const ( + PipeFlowNon PipeFlowDirection = iota //流体未流动 + PipeFlowAb //流体从管线的A->B + PipeFlowBa //流体从管线的B->A +) + // FluidDriver 流体驱动器 type FluidDriver struct { - On bool //true-输出流体驱动力;false-未输出流体驱动力 - Forward bool //true-正转;false-反转 + On bool //true-输出流体驱动力;false-未输出流体驱动力 } var ( diff --git a/component/relation/points.go b/component/relation/points.go new file mode 100644 index 0000000..6b17f8d --- /dev/null +++ b/component/relation/points.go @@ -0,0 +1,166 @@ +package relation + +import ( + "joylink.club/ecs" + "joylink.club/rtsssimulation/modelrepo/model" +) + +var ( + // 道岔模型数据引用组件类型 + PointsModelRelaType = ecs.NewComponentType[PointsModelRela]() + // 道岔转辙机关系组件类型 + PointsZzjRelaType = ecs.NewComponentType[PointsZzjRela]() + // ZDJ9双机电路元器件组件类型 + Zdj9TwoElectronicType = ecs.NewComponentType[Zdj9TwoElectronic]() +) + +// 道岔模型数据引用 +type PointsModelRela struct { + M model.Turnout +} + +func NewPointsModelRela(m model.Turnout) *PointsModelRela { + return &PointsModelRela{ + M: m, + } +} + +// 道岔转辙机关系组件 +type PointsZzjRela struct { + Turnout *ecs.Entry + Zzjs []*ecs.Entry +} + +func NewPointsZzjRela(t *ecs.Entry, zzjs ...*ecs.Entry) *PointsZzjRela { + return &PointsZzjRela{ + Turnout: t, + Zzjs: zzjs, + } +} + +// 获取转辙机一,若没有则panic +func (tz *PointsZzjRela) GetZzj1() *ecs.Entry { + len := len(tz.Zzjs) + if len > 0 { + return tz.Zzjs[0] + } + panic("道岔没有转辙机一") +} + +// 获取转辙机二,若没有则panic +func (tz *PointsZzjRela) GetZzj2() *ecs.Entry { + len := len(tz.Zzjs) + if len > 1 { + return tz.Zzjs[1] + } + panic("道岔没有转辙机二") +} + +// ZDJ9双机电路元器件 +type Zdj9TwoElectronic struct { + TDC_DCJ *ecs.Entry // 定操继电器 + TDC_FCJ *ecs.Entry // 反操继电器 + TDC_YCJ *ecs.Entry // 允许操作继电器 + TDC_ZDBJ *ecs.Entry // 总定表继电器 + TDC_ZFBJ *ecs.Entry // 总反表继电器 + + // 一机 + TDFJ1_1DQJ *ecs.Entry // 一启动继电器 + TDFJ1_BHJ *ecs.Entry // 保护继电器 + TDFJ1_2DQJ *ecs.Entry // 二启动继电器 + TDFJ1_1DQJF *ecs.Entry // 一启动复示继电器 + TDFJ1_DBQ *ecs.Entry // 断相保护器 + TDFJ1_DBJ *ecs.Entry // 定位表示继电器 + TDFJ1_FBJ *ecs.Entry // 反位表示继电器 + TDFJ1_QDJ *ecs.Entry // 切断继电器 + TDFJ1_ZBHJ *ecs.Entry // 总保护继电器 + + TDFJ1_QDJ_Remain int // 切断继电器保持电路保持剩余时间 + + // 二机 + TDFJ2_1DQJ *ecs.Entry // 一启动继电器 + TDFJ2_BHJ *ecs.Entry // 保护继电器 + TDFJ2_2DQJ *ecs.Entry // 二启动继电器 + TDFJ2_1DQJF *ecs.Entry // 一启动复示继电器 + TDFJ2_DBQ *ecs.Entry // 断相保护器 + TDFJ2_DBJ *ecs.Entry // 定位表示继电器 + TDFJ2_FBJ *ecs.Entry // 反位表示继电器 +} + +// 检查空引用,返回空引用字段名称 +func (te *Zdj9TwoElectronic) CheckNilReference() []string { + var nils []string = make([]string, 0) + if te.TDC_DCJ == nil { + nils = append(nils, "TDC_DCJ") + } + if te.TDC_FCJ == nil { + nils = append(nils, "TDC_FCJ") + } + if te.TDC_YCJ == nil { + nils = append(nils, "TDC_YCJ") + } + if te.TDC_ZDBJ == nil { + nils = append(nils, "TDC_ZDBJ") + } + if te.TDC_ZFBJ == nil { + nils = append(nils, "TDC_ZFBJ") + } + // 一机 + if te.TDFJ1_1DQJ == nil { + nils = append(nils, "TDFJ1_1DQJ") + } + if te.TDFJ1_BHJ == nil { + nils = append(nils, "TDFJ1_BHJ") + } + if te.TDFJ1_2DQJ == nil { + nils = append(nils, "TDFJ1_2DQJ") + } + if te.TDFJ1_1DQJF == nil { + nils = append(nils, "TDFJ1_1DQJF") + } + if te.TDFJ1_DBQ == nil { + nils = append(nils, "TDFJ1_DBQ") + } + if te.TDFJ1_DBJ == nil { + nils = append(nils, "TDFJ1_DBJ") + } + if te.TDFJ1_FBJ == nil { + nils = append(nils, "TDFJ1_FBJ") + } + if te.TDFJ1_QDJ == nil { + nils = append(nils, "TDFJ1_QDJ") + } + if te.TDFJ1_ZBHJ == nil { + nils = append(nils, "TDFJ1_ZBHJ") + } + + // 二机 + if te.TDFJ2_1DQJ == nil { + nils = append(nils, "TDFJ2_1DQJ") + } + if te.TDFJ2_BHJ == nil { + nils = append(nils, "TDFJ2_BHJ") + } + if te.TDFJ2_2DQJ == nil { + nils = append(nils, "TDFJ2_2DQJ") + } + if te.TDFJ2_1DQJF == nil { + nils = append(nils, "TDFJ2_1DQJF") + } + if te.TDFJ2_DBQ == nil { + nils = append(nils, "TDFJ2_DBQ") + } + if te.TDFJ2_DBJ == nil { + nils = append(nils, "TDFJ2_DBJ") + } + if te.TDFJ2_FBJ == nil { + nils = append(nils, "TDFJ2_FBJ") + } + return nils +} + +// 是否有空引用 +func (te *Zdj9TwoElectronic) HasNilReference() bool { + nils := te.CheckNilReference() + return len(nils) > 0 +} diff --git a/component/singleton/uid_entity_index.go b/component/singleton/entity_uid_index.go similarity index 93% rename from component/singleton/uid_entity_index.go rename to component/singleton/entity_uid_index.go index 6f39534..913b596 100644 --- a/component/singleton/uid_entity_index.go +++ b/component/singleton/entity_uid_index.go @@ -9,6 +9,7 @@ import ( var EntityUidIndexType = ecs.NewComponentType[EntityUidIndex]() // 对象实体Uid索引 +// 只索引具有uid且不会销毁的实体 type EntityUidIndex struct { mu sync.RWMutex entityMap map[string]ecs.Entity diff --git a/component/singleton/load.go b/component/singleton/load.go index 4b8bf93..8f79bbe 100644 --- a/component/singleton/load.go +++ b/component/singleton/load.go @@ -13,6 +13,9 @@ func LoadSingletons(w ecs.World, r modelrepo.Repo) { loadUidEntityIndex(w) } +type Singleton struct { +} + var worldRepoQuery = ecs.NewQuery(filter.Contains(WorldRepoType)) var worldTimeQuery = ecs.NewQuery(filter.Contains(WorldTimeType)) var uidEntityIndexQuery = ecs.NewQuery(filter.Contains(EntityUidIndexType)) diff --git a/component/singleton/world_time.go b/component/singleton/world_time.go index 3c9ae95..b16f6ee 100644 --- a/component/singleton/world_time.go +++ b/component/singleton/world_time.go @@ -26,7 +26,7 @@ func (w *WorldTime) GetTime() time.Time { return time.UnixMilli(w.time) } -// 获取时间戳 +// 获取时间戳ms func (w *WorldTime) GetMilli() int64 { return w.time } diff --git a/entity/iscs_bas.go b/entity/iscs_bas.go index 41447c7..8633648 100644 --- a/entity/iscs_bas.go +++ b/entity/iscs_bas.go @@ -59,10 +59,10 @@ func NewValveEntity(w ecs.World, id string, valveType proto.Valve_Type) *ecs.Ent wd := GetWorldData(w) e, ok := wd.EntityMap[id] if !ok { - e = w.Entry(w.Create(component.UidType, component.ValveType, component.ValveControllerType, component.TwoPositionTransformType, component.DeviceExceptionType)) + e = w.Entry(w.Create(component.UidType, component.ValveType, component.ValveControllerType, component.FixedPositionTransformType, component.DeviceExceptionType)) component.UidType.SetValue(e, component.Uid{Id: id}) //默认全关位置 - component.TwoPositionTransformType.Set(e, &component.TwoPositionTransform{TwoPositionTransform: component_proto.TwoPositionTransform{Pos: consts.TwoPosMin}}) + component.FixedPositionTransformType.Set(e, &component.FixedPositionTransform{TwoPositionTransform: component_proto.TwoPositionTransform{Pos: consts.TwoPosMin}}) component.ValveControllerType.Set(e, &component.ValveController{TargetOpenRate: 0}) // switch valveType { @@ -101,7 +101,7 @@ func newAirConditioningEntity(w ecs.World, id string, tag *ecs.ComponentType[str wd := GetWorldData(w) e, ok := wd.EntityMap[id] if !ok { - e = w.Entry(w.Create(component.UidType, component.MotorType, component.AirConditioningType, component.FluidDriverType, component.DeviceExceptionType, tag)) + e = w.Entry(w.Create(component.UidType, component.MotorType, component.AirConditioningType, component.DeviceExceptionType, tag)) component.UidType.SetValue(e, component.Uid{Id: id}) wd.EntityMap[id] = e } diff --git a/entity/iscs_load.go b/entity/iscs_load.go index 21f7982..7382cbb 100644 --- a/entity/iscs_load.go +++ b/entity/iscs_load.go @@ -84,7 +84,7 @@ func LoadIscs(w ecs.World) error { NewAirCurtainEntity(w, ac.Id()) } //气体环境 - for _, gasEnv := range data.Repo.GasEnvironmentMap { + for _, gasEnv := range data.Repo.EnvironmentMap { NewGasEnvironmentEntity(w, gasEnv.Id()) } //风机 diff --git a/entity/cg_load.go b/entity/loader.go similarity index 89% rename from entity/cg_load.go rename to entity/loader.go index 0178326..879c14c 100644 --- a/entity/cg_load.go +++ b/entity/loader.go @@ -8,7 +8,7 @@ import ( ) // 加载城轨仿真实体 -func LoadCg(w ecs.World, repo modelrepo.Repo) error { +func Loading(w ecs.World, repo modelrepo.Repo) error { singleton.LoadSingletons(w, repo) for _, s := range repo.GetEcses() { // 加载道岔实体 diff --git a/entity/psd.go b/entity/psd.go index 09c776c..aa1a485 100644 --- a/entity/psd.go +++ b/entity/psd.go @@ -1,16 +1,17 @@ package entity import ( + "strconv" + "joylink.club/ecs" "joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/repository" - "strconv" ) var PsdBaseComponentTypeArr = []ecs.IComponentType{component.PsdTag, component.UidType, component.PsdStateType, component.AsdListType, component.PscType} var AsdBaseComponentTypeArr = []ecs.IComponentType{component.AsdTag, component.UidType, - component.AsdMotorStateType, component.TwoPositionTransformType, component.AsdStateType} + component.AsdMotorStateType, component.FixedPositionTransformType, component.AsdStateType} func LoadPsd(w ecs.World) error { data := GetWorldData(w) diff --git a/entity/turnout.go b/entity/turnout.go index 86635b4..a2446ab 100644 --- a/entity/turnout.go +++ b/entity/turnout.go @@ -52,7 +52,7 @@ func LoadTurnoutZdj9One(w ecs.World, turnout *repository.Turnout, entry *ecs.Ent // 加载道岔ZDJ9双机转辙机 func LoadTurnoutZdj9Two(w ecs.World, turnout *repository.Turnout, entry *ecs.Entry, entityMap map[string]*ecs.Entry) error { // 加载转辙机 - entrys := ecs.Entries(w, w.CreateMany(2, component.ZzjStateType, component.TwoPositionTransformType)) + entrys := ecs.Entries(w, w.CreateMany(2, component.ZzjStateType, component.FixedPositionTransformType)) // 给道岔添加转辙机引用组件 entry.AddComponent(component.TurnoutZzjType, unsafe.Pointer(&component.TurnoutZzj{ ZzjList: entrys, diff --git a/fi/iscs_bas.go b/fi/iscs_bas.go index 453e745..0dedb62 100644 --- a/fi/iscs_bas.go +++ b/fi/iscs_bas.go @@ -2,6 +2,7 @@ package fi import ( "fmt" + "joylink.club/ecs" "joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/consts" @@ -23,7 +24,7 @@ func ValveOperate(w ecs.World, deviceId string, openRate uint8) error { return ecs.NewErrResult(fmt.Errorf("设备[%s]实体不存在", deviceId)) } // - if !(deviceEntry.HasComponent(component.ValveType) && deviceEntry.HasComponent(component.ValveControllerType) && deviceEntry.HasComponent(component.TwoPositionTransformType)) { + if !(deviceEntry.HasComponent(component.ValveType) && deviceEntry.HasComponent(component.ValveControllerType) && deviceEntry.HasComponent(component.FixedPositionTransformType)) { return ecs.NewErrResult(fmt.Errorf("设备[%s]不是阀门", deviceId)) } component.ValveControllerType.Get(deviceEntry).TargetOpenRate = openRate diff --git a/init.go b/init.go index a0207a0..bd96eb8 100644 --- a/init.go +++ b/init.go @@ -25,7 +25,7 @@ func NewSimulation(repo *repository.Repository) (ecs.World, error) { func LoadCgSimulation(repo modelrepo.Repo) (ecs.World, error) { w := ecs.NewWorld(RtssSimulationTick) // 加载组件实体 - err := entity.LoadCg(w, repo) + err := entity.Loading(w, repo) if err != nil { return nil, err } diff --git a/proto/src/component/ci.proto b/proto/src/component/ci.proto index d2251b9..414bb42 100644 --- a/proto/src/component/ci.proto +++ b/proto/src/component/ci.proto @@ -2,12 +2,149 @@ syntax = "proto3"; package component; -option go_package = "./component/component_proto"; +option go_package = "./component/component_data"; + +// 联锁系统内存数据状态 +message CiSysRAM { + map qcStates = 2; + map sectionStates = 3; + map turnoutStates = 4; + map signalStates = 5; + map platformStates = 6; + map routeStates = 7; + map overlapStates = 8; +} // 联锁驱动、采集状态表 message CiQcState { // 驱动bit表 - bytes qbs = 1; + bytes qbs = 2; // 采集bit表 - bytes cbs = 2; + bytes cbs = 3; +} + +// 联锁区段状态 +message CiSectionState { + // 是否物理检测占用 + bool ciOccupied = 2; + // 是否cbtc逻辑占用 + bool cbtcOccupied = 3; + // 是否进路锁闭 + bool routeLock = 4; + // 是否延续保护锁闭 + bool overlapLock = 5; + // 是否封锁 + bool block = 6; + // 是否故障锁闭 + bool failLock = 7; +} + +// 联锁道岔状态 +message CiPointsState { + // 是否物理检测占用 + bool ciOccupied = 1; + // 是否cbtc逻辑占用 + bool cbtcOccupied = 2; + // 是否进路锁闭 + bool routeLock = 3; + // 是否延续保护锁闭 + bool overlapLock = 4; + // 是否封锁 + bool block = 5; + // 是否故障锁闭 + bool failLock = 6; + // 是否定位 + bool normal = 7; + // 是否反位 + bool reverse = 8; + // 是否挤岔 + bool jammed = 9; + // 是否单锁 + bool singleLock = 10; +} + +message Signal { + // 信号显示 + enum Aspect { + // 红灯亮 + H = 0; + // 绿灯亮 + L = 1; + // 黄灯亮 + U = 2; + // 黄红灯亮(引导信号) + UH = 3; + // 白灯亮 + B = 4; + // 蓝灯亮 + A = 5; + } +} + +// 联锁信号机状态 +message CiSignalState { + // 信号显示 + Signal.Aspect aspect = 1; + // 是否逻辑点灯(即室外灭灯) + bool logic = 2; + // 是否封锁 + bool block = 3; + // 是否灯丝断丝 + bool lampFault = 4; +} + +// 联锁站台状态 +message CiPlatformState { + // 车站上行扣车 + bool upwardHold = 1; + // 车站下行扣车 + bool downwardHold = 2; + // 中心上行扣车 + bool occUpwardHold = 3; + // 中心下行扣车 + bool occDownwardHold = 4; + // 屏蔽门开 + bool psdOpen = 5; + // 紧急关闭/停车 + bool emergStop = 6; + // 停站时间 + int32 stopTime = 7; +} + +message RouteSignal { + // 进路信号控制级别 + enum ControlLevel { + // 关闭 + Close = 0; + // 引导信号控制级别 + CallOn = 1; + // 移动闭塞信号控制级别 + CTC = 2; + // 主信号控制级别 + Main = 3; + } +} + +// 联锁进路状态 +message CiRouteState { + // 是否进路锁闭 + bool lock = 1; + // 是否接近锁闭 + bool approachLock = 2; + // 是否车队模式 + bool fleetMode = 3; + // 是否联锁自动触发 + bool ciAutoMode = 4; + // 是否ats自动控 + bool atsAutoMode = 5; + // 是否办理中 + bool setting = 6; + // 进路信号控制级别 + RouteSignal.ControlLevel controlLevel = 7; +} + +// 联锁延续保护进路状态 +message CiOverlapState { + // 是否延续保护锁闭 + bool lock = 1; } diff --git a/proto/src/component/common.proto b/proto/src/component/common.proto index 67d2277..1fa3c00 100644 --- a/proto/src/component/common.proto +++ b/proto/src/component/common.proto @@ -2,15 +2,23 @@ syntax = "proto3"; package component; -option go_package = "./component/component_proto"; +option go_package = "./component/component_data"; -// 两个稳态位置转换组件 -message TwoPositionTransform { +// 电机 +message Motor { + // 是否通电 + bool powerUp = 1; + // 是否正转 + bool forward = 2; +} + +// 固定位置转换组件 +message FixedPositionTransform { int32 pos = 1; // 当前位置百分比,[0, 10000],两位小数 int32 speed = 2; } -// 仅有两状态的组件 +// 开关状态组件 message BitState { bool val = 1; } diff --git a/proto/src/component/points.proto b/proto/src/component/points.proto new file mode 100644 index 0000000..bf2493f --- /dev/null +++ b/proto/src/component/points.proto @@ -0,0 +1,65 @@ +syntax = "proto3"; + +package component; + +option go_package = "./component/component_data"; + +// 道岔转辙机自动开闭器状态 +// 自动开闭器接点位置,默认定位接通1/3排,反位接通2/4排 +// 由定位转反位(1DQJ和1DQJF励磁吸起,2DQJ在反位——即落下),三相电路导通,电机开始反转,转辙机将第3排接点接通第4排,到位锁闭后,转辙机的自动开闭器拉簧将第1排接点拉到第2排,接点到2排后,三相电路断路 +// 由反位转定位(1DQJ和1DQJF励磁吸起,2DQJ在定位——即吸起),三相电路导通,电机开始正转,转辙机将第2排接点接通第1排,到位锁闭后,转辙机的自动开闭器拉簧将第4排接点拉到第3排,接点到3排后,三相电路断路 +message PointsZzjKbqState { + // 接点在1/2排的位置,false-接点在1排,true-接点在2排 + bool jd13 = 1; + // 接点在3/4排的位置,false-接点在3排,true-接点在4排 + bool jd24 = 2; +} + +// 道岔位置状态表示组件 +message PointsPosition { + // 是否定位(实际位置) + bool dw = 1; + // 是否反位(实际位置) + bool fw = 2; + // 定表 + bool db = 3; + // 反表 + bool fb = 4; +} + +// 道岔 +message Points { + // 道岔故障 + enum Fault { + // 失表 + SB = 0; + // 定位失表 + DWSB = 1; + // 反位失表 + FWSB = 2; + // 挤岔 + JC = 3; + // 联锁无法驱动故障 + CIQD = 4; + } +} +// 道岔失表故障 +message PointsFaultSB { + +} +// 道岔定位失表故障 +message PointsFaultDwsb { + +} +// 道岔反位失表故障 +message PointsFaultFwsb { + +} +// 道岔挤岔故障 +message PointsFaultJc { + +} +// 道岔联锁无法驱动故障 +message PointsFaultCiqd { + +} diff --git a/proto/src/component/turnout.proto b/proto/src/component/turnout.proto deleted file mode 100644 index 9118822..0000000 --- a/proto/src/component/turnout.proto +++ /dev/null @@ -1,54 +0,0 @@ -syntax = "proto3"; - -package component; - -option go_package = "./component/component_proto"; - -// 道岔位置状态表示组件 -message TurnoutPosition { - // 是否在定位(实际位置) - bool dw = 1; - // 是否在反位(实际位置) - bool fw = 2; - - // 定表 - bool db = 3; - // 反表 - bool fb = 4; -} - -// 道岔故障 -message Turnout { - enum Fault { - // 失表 - SB = 0; - // 定位失表 - DWSB = 1; - // 反位失表 - FWSB = 2; - // 挤岔 - JC = 3; - // 联锁无法驱动故障 - CIQD = 4; - } -} -// 道岔失表故障 -message TurnoutFaultSB { - -} -// 道岔定位失表故障 -message TurnoutFaultDwsb { - -} -// 道岔反位失表故障 -message TurnoutFaultFwsb { - -} -// 道岔挤岔故障 -message TurnoutFaultJc { - -} -// 道岔联锁无法驱动故障 -message TurnoutFaultCiqd { - -} diff --git a/proto/src/model.proto b/proto/src/model.proto index f69830f..40a83c7 100644 --- a/proto/src/model.proto +++ b/proto/src/model.proto @@ -356,8 +356,8 @@ enum DeviceType { DeviceType_CombinationAirConditioner = 390; //ISCS 净化装置 DeviceType_AirPurificationDevice = 391; - //ISCS 气体环境(正常空气+有害烟雾) - DeviceType_GasEnvironment = 392; + //ISCS 环境(正常空气、有害烟雾、温度、湿度等) + DeviceType_Environment = 392; } diff --git a/repository/iscs_bas_dxt.go b/repository/iscs_bas_dxt.go index 49ebf33..66d3b2c 100644 --- a/repository/iscs_bas_dxt.go +++ b/repository/iscs_bas_dxt.go @@ -45,8 +45,8 @@ type Valve struct { Identity Code string ValveType proto.Valve_Type //阀门子类型 - PortA DevicePort //阀门A端口连接的设备 - PortB DevicePort //阀门B端口连接的设备 + PortA *PipePort //阀门A端口连接的设备 + PortB *PipePort //阀门B端口连接的设备 } func NewValve(id string, code string, valveType proto.Valve_Type) *Valve { @@ -59,6 +59,16 @@ func NewValve(id string, code string, valveType proto.Valve_Type) *Valve { func (p *Valve) PortNum() int { return 2 } +func (p *Valve) Ports() []*PipePort { + var ports []*PipePort + if p.PortA != nil { + ports = append(ports, p.PortA) + } + if p.PortB != nil { + ports = append(ports, p.PortB) + } + return ports +} // ValvePort 阀门端口 // @@ -81,11 +91,9 @@ func (p *ValvePort) Device() PortedDevice { // 有四个端口,ABC三个端口为输入口,D端口为输出口 type GasMixingChamber struct { Identity - Code string - PortA DevicePort //A端口连接的设备 - PortB DevicePort //B端口连接的设备 - PortC DevicePort //C端口连接的设备 - PortD DevicePort //D端口连接的设备 + Code string + PortsA []*PipePort //A端多个输入口 + PortsB []*PipePort //B端多个输出口 } func NewGasMixingChamber(id string, code string) *GasMixingChamber { @@ -97,6 +105,14 @@ func NewGasMixingChamber(id string, code string) *GasMixingChamber { func (p *GasMixingChamber) PortNum() int { return 4 } +func (p *GasMixingChamber) IsInput(pipeId string) bool { + for _, portA := range p.PortsA { + if pipeId == portA.pipe.Id() { + return true + } + } + return false +} // GasMixingChamberPort 混合室静压箱端口 // @@ -121,10 +137,10 @@ func (p *GasMixingChamberPort) Device() PortedDevice { type CombinationAirConditioner struct { Identity Code string - PortA DevicePort //新风输入A端口连接的设备 - PortB DevicePort //工作风输出B端口连接的设备 - PortC DevicePort //C端口连接的设备 - PortD DevicePort //D端口连接的设备 + PortA *PipePort //新风输入A端口连接的设备 + PortB *PipePort //工作风输出B端口连接的设备 + PortC *PipePort //C端口连接的设备 + PortD *PipePort //D端口连接的设备 } func NewCombinationAirConditioner(id string, code string) *CombinationAirConditioner { @@ -136,25 +152,21 @@ func NewCombinationAirConditioner(id string, code string) *CombinationAirConditi func (p *CombinationAirConditioner) PortNum() int { return 4 } -func (p *CombinationAirConditioner) Outputs() []DevicePort { - var out []DevicePort +func (p *CombinationAirConditioner) Ports() []*PipePort { + var ports []*PipePort + if p.PortA != nil { + ports = append(ports, p.PortA) + } if p.PortB != nil { - out = append(out, p.PortB) + ports = append(ports, p.PortB) } if p.PortC != nil { - out = append(out, p.PortC) - } - return out -} -func (p *CombinationAirConditioner) Inputs() []DevicePort { - var in []DevicePort - if p.PortA != nil { - in = append(in, p.PortA) + ports = append(ports, p.PortC) } if p.PortD != nil { - in = append(in, p.PortD) + ports = append(ports, p.PortD) } - return in + return ports } // CombinationAirConditionerPort 组合式空调端口 @@ -179,8 +191,8 @@ func (p *CombinationAirConditionerPort) Device() PortedDevice { type AirPurificationDevice struct { Identity Code string - PortA DevicePort //A端口连接的设备 - PortB DevicePort //B端口连接的设备 + PortA *PipePort //A端口连接的设备 + PortB *PipePort //B端口连接的设备 } func NewAirPurificationDevice(id string, code string) *AirPurificationDevice { @@ -192,6 +204,16 @@ func NewAirPurificationDevice(id string, code string) *AirPurificationDevice { func (p *AirPurificationDevice) PortNum() int { return 2 } +func (p *AirPurificationDevice) Ports() []*PipePort { + var ports []*PipePort + if p.PortA != nil { + ports = append(ports, p.PortA) + } + if p.PortB != nil { + ports = append(ports, p.PortB) + } + return ports +} // AirPurificationDevicePort 净化装置端口 // @@ -231,8 +253,8 @@ type Fan struct { Code string FanType proto.Fan_Type *fanRunningModel - PortA DevicePort //A端口连接的设备,风机出风口即排风口,输出端口 - PortB DevicePort //B端口连接的设备,风机进风口,输入端口 + PortA *PipePort //A端口连接的设备,风机出风口即排风口,输出端口 + PortB *PipePort //B端口连接的设备,风机进风口,输入端口 } func NewFan(id string, code string, fanType proto.Fan_Type) *Fan { @@ -246,18 +268,6 @@ func NewFan(id string, code string, fanType proto.Fan_Type) *Fan { func (p *Fan) PortNum() int { return 2 } -func (p *Fan) Outputs() []DevicePort { - if p.PortA == nil { - return nil - } - return []DevicePort{p.PortA} -} -func (p *Fan) Inputs() []DevicePort { - if p.PortB == nil { - return nil - } - return []DevicePort{p.PortB} -} // FanPort 风机端口 // @@ -302,38 +312,37 @@ func newFanRunningModel(fanType proto.Fan_Type) *fanRunningModel { //////////////////////////////////////////////// -// GasEnvironment 气体环境(正常空气+有害烟雾) -// 有多个输入口,统一为端口A,用来为环境补充新鲜空气; -// 有多个输出口,统一为端口B,用户将环境的混浊气体排除; -// 排出气体动力源为该环境。 -type GasEnvironment struct { +// Environment 环境 +// 有多个输入口,统一为端口A +// 有多个输出口,统一为端口B +type Environment struct { Identity Code string PortsA []DevicePort // 有多个输入口,统一为端口A,用来为环境补充新鲜空气; PortsB []DevicePort // 有多个输出口,统一为端口B,用户将环境的混浊气体排除; } -func NewGasEnvironment(id string, code string) *GasEnvironment { - return &GasEnvironment{ - Identity: &identity{id: id, deviceType: proto.DeviceType_DeviceType_GasEnvironment}, +func NewEnvironment(id string, code string) *Environment { + return &Environment{ + Identity: &identity{id: id, deviceType: proto.DeviceType_DeviceType_Environment}, Code: code, } } -func (p *GasEnvironment) PortNum() int { +func (p *Environment) PortNum() int { return len(p.PortsA) + len(p.PortsB) } -// GasEnvironmentPort 气体环境端口 +// EnvironmentPort 气体环境端口 // // implement DevicePort -type GasEnvironmentPort struct { +type EnvironmentPort struct { port proto.Port - device *GasEnvironment + device *Environment } -func (p *GasEnvironmentPort) Port() proto.Port { +func (p *EnvironmentPort) Port() proto.Port { return p.port } -func (p *GasEnvironmentPort) Device() PortedDevice { +func (p *EnvironmentPort) Device() PortedDevice { return p.device } diff --git a/repository/iscs_pscada_yc.go b/repository/iscs_pscada_yc.go index 5ee3b60..0bdbbf1 100644 --- a/repository/iscs_pscada_yc.go +++ b/repository/iscs_pscada_yc.go @@ -1,6 +1,9 @@ package repository -import "joylink.club/rtsssimulation/repository/model/proto" +import ( + "fmt" + "joylink.club/rtsssimulation/repository/model/proto" +) //电力监控系统车站一次图中相关设备模型 @@ -20,6 +23,18 @@ func (p *Pipe) PortNum() int { return 2 } +// PortDevice 获取管线对应端口连接的设备 +func (p *Pipe) PortDevice(port proto.Port) DevicePort { + switch port { + case proto.Port_A: + return p.PortA + case proto.Port_B: + return p.PortB + default: + panic("管线端口只有A或B") + } +} + // PipePort 管线端口 // // implement DevicePort @@ -34,6 +49,21 @@ func (p *PipePort) Port() proto.Port { func (p *PipePort) Device() PortedDevice { return p.pipe } +func (p *PipePort) PipePortId() string { + return fmt.Sprintf("%s-%d", p.pipe.Id(), p.port) +} + +// ToOtherPort 获取当前管线端口所在管线的另一端 +func (p *PipePort) ToOtherPort() PipePort { + switch p.port { + case proto.Port_A: + return PipePort{port: proto.Port_B, pipe: p.pipe} + case proto.Port_B: + return PipePort{port: proto.Port_A, pipe: p.pipe} + default: + panic("管线的端口只能为A或B") + } +} /////////////////////////////////////////////////// diff --git a/repository/model/proto/model.pb.go b/repository/model/proto/model.pb.go index bd6b4a4..2bf4b26 100644 --- a/repository/model/proto/model.pb.go +++ b/repository/model/proto/model.pb.go @@ -187,8 +187,8 @@ const ( DeviceType_DeviceType_CombinationAirConditioner DeviceType = 390 // ISCS 净化装置 DeviceType_DeviceType_AirPurificationDevice DeviceType = 391 - // ISCS 气体环境(正常空气+有害烟雾) - DeviceType_DeviceType_GasEnvironment DeviceType = 392 + // ISCS 环境(正常空气、有害烟雾、温度、湿度等) + DeviceType_DeviceType_Environment DeviceType = 392 ) // Enum value maps for DeviceType. @@ -286,7 +286,7 @@ var ( 389: "DeviceType_GasMixingChamber", 390: "DeviceType_CombinationAirConditioner", 391: "DeviceType_AirPurificationDevice", - 392: "DeviceType_GasEnvironment", + 392: "DeviceType_Environment", } DeviceType_value = map[string]int32{ "DeviceType_Unknown": 0, @@ -381,7 +381,7 @@ var ( "DeviceType_GasMixingChamber": 389, "DeviceType_CombinationAirConditioner": 390, "DeviceType_AirPurificationDevice": 391, - "DeviceType_GasEnvironment": 392, + "DeviceType_Environment": 392, } ) @@ -5897,7 +5897,7 @@ var file_model_proto_rawDesc = []byte{ 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 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, 0x2a, - 0x84, 0x16, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, + 0x81, 0x16, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, @@ -6071,20 +6071,20 @@ var file_model_proto_rawDesc = []byte{ 0x72, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x65, 0x72, 0x10, 0x86, 0x03, 0x12, 0x25, 0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x69, 0x72, 0x50, 0x75, 0x72, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x10, 0x87, 0x03, 0x12, 0x1e, 0x0a, 0x19, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x5f, 0x47, 0x61, 0x73, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x88, 0x03, 0x2a, 0x2c, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x08, - 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, - 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x43, 0x10, 0x03, 0x12, 0x05, 0x0a, - 0x01, 0x44, 0x10, 0x04, 0x2a, 0x20, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x45, 0x46, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, - 0x49, 0x47, 0x48, 0x54, 0x10, 0x01, 0x2a, 0x43, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, - 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x6f, 0x75, 0x6e, - 0x64, 0x61, 0x72, 0x79, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x75, 0x6c, - 0x61, 0x74, 0x65, 0x64, 0x4a, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x42, 0x1a, 0x5a, 0x18, 0x2e, - 0x2f, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, - 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x63, 0x65, 0x10, 0x87, 0x03, 0x12, 0x1b, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x5f, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x88, 0x03, 0x2a, 0x2c, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x4e, + 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, + 0x42, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x43, 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01, 0x44, 0x10, + 0x04, 0x2a, 0x20, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, + 0x0a, 0x04, 0x4c, 0x45, 0x46, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47, 0x48, + 0x54, 0x10, 0x01, 0x2a, 0x43, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, + 0x79, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x75, 0x6c, 0x61, 0x74, 0x65, + 0x64, 0x4a, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x42, 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x72, 0x65, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/repository/repository.go b/repository/repository.go index 68918de..eddf03a 100644 --- a/repository/repository.go +++ b/repository/repository.go @@ -51,7 +51,7 @@ type Repository struct { AirPurificationDeviceMap map[string]*AirPurificationDevice //ISCS净化装置 AirCurtainMap map[string]*AirCurtain //ISCS空气幕 FanMap map[string]*Fan //ISCS风机 - GasEnvironmentMap map[string]*GasEnvironment //ISCS气体环境 + EnvironmentMap map[string]*Environment //ISCS气体环境 } func newRepository(id string, version string) *Repository { @@ -98,7 +98,7 @@ func newRepository(id string, version string) *Repository { AirPurificationDeviceMap: make(map[string]*AirPurificationDevice), //ISCS净化装置 AirCurtainMap: make(map[string]*AirCurtain), //ISCS空气幕 FanMap: make(map[string]*Fan), //ISCS风机 - GasEnvironmentMap: make(map[string]*GasEnvironment), //ISCS气体环境 + EnvironmentMap: make(map[string]*Environment), //ISCS气体环境 } } @@ -189,7 +189,7 @@ func (repo *Repository) FindById(id string) Identity { if md, ok := repo.FanMap[id]; ok { return md } - if md, ok := repo.GasEnvironmentMap[id]; ok { + if md, ok := repo.EnvironmentMap[id]; ok { return md } //ISCS-end @@ -385,8 +385,8 @@ func (repo *Repository) FindModel(deviceId string, deviceType proto.DeviceType) return repo.AirCurtainMap[deviceId], nil case proto.DeviceType_DeviceType_Fan: return repo.FanMap[deviceId], nil - case proto.DeviceType_DeviceType_GasEnvironment: - return repo.GasEnvironmentMap[deviceId], nil + case proto.DeviceType_DeviceType_Environment: + return repo.EnvironmentMap[deviceId], nil default: return nil, fmt.Errorf("仓库中不存在[%s]类型的模型", deviceType) } diff --git a/repository/repository_iscs.go b/repository/repository_iscs.go index a96b8cc..d7c1f3b 100644 --- a/repository/repository_iscs.go +++ b/repository/repository_iscs.go @@ -104,10 +104,10 @@ func buildIscsModels(source *proto.Repository, repository *Repository) error { m := NewFan(protoData.Id, protoData.Code, protoData.FanType) repository.FanMap[m.Id()] = m } - //ISCS气体环境 + //ISCS环境 for _, protoData := range source.GasEnvironments { - m := NewGasEnvironment(protoData.Id, protoData.Code) - repository.GasEnvironmentMap[m.Id()] = m + m := NewEnvironment(protoData.Id, protoData.Code) + repository.EnvironmentMap[m.Id()] = m } // return nil @@ -160,13 +160,9 @@ func buildIscsPipeModelRelationship(source *proto.Repository, repository *Reposi pipePortRelatedDevice = &GasMixingChamberPort{port: portRelatedDevice.Port, device: gasMixingChamber} switch portRelatedDevice.Port { case proto.Port_A: - gasMixingChamber.PortA = &PipePort{port: pipePort, pipe: pipeModel} + gasMixingChamber.PortsA = append(gasMixingChamber.PortsA, &PipePort{port: pipePort, pipe: pipeModel}) case proto.Port_B: - gasMixingChamber.PortB = &PipePort{port: pipePort, pipe: pipeModel} - case proto.Port_C: - gasMixingChamber.PortC = &PipePort{port: pipePort, pipe: pipeModel} - case proto.Port_D: - gasMixingChamber.PortD = &PipePort{port: pipePort, pipe: pipeModel} + gasMixingChamber.PortsB = append(gasMixingChamber.PortsB, &PipePort{port: pipePort, pipe: pipeModel}) } } case proto.DeviceType_DeviceType_CombinationAirConditioner: @@ -206,10 +202,10 @@ func buildIscsPipeModelRelationship(source *proto.Repository, repository *Reposi fan.PortB = &PipePort{port: pipePort, pipe: pipeModel} } } - case proto.DeviceType_DeviceType_GasEnvironment: + case proto.DeviceType_DeviceType_Environment: { - gasEnvironment := relatedDevice.(*GasEnvironment) - pipePortRelatedDevice = &GasEnvironmentPort{port: portRelatedDevice.Port, device: gasEnvironment} + gasEnvironment := relatedDevice.(*Environment) + pipePortRelatedDevice = &EnvironmentPort{port: portRelatedDevice.Port, device: gasEnvironment} switch portRelatedDevice.Port { case proto.Port_A: gasEnvironment.PortsA = append(gasEnvironment.PortsA, &PipePort{port: pipePort, pipe: pipeModel}) diff --git a/sys/common_sys/two_position_movement.go b/sys/common_sys/two_position_movement.go index 2e1d770..d2b552d 100644 --- a/sys/common_sys/two_position_movement.go +++ b/sys/common_sys/two_position_movement.go @@ -13,14 +13,14 @@ type TwoPositionMovementSys struct { func NewTwoPositionMovementSys() *TwoPositionMovementSys { return &TwoPositionMovementSys{ - query: ecs.NewQuery(filter.Contains(component.TwoPositionTransformType)), + query: ecs.NewQuery(filter.Contains(component.FixedPositionTransformType)), } } // 更新位置 func (tp *TwoPositionMovementSys) Update(w ecs.World) { tp.query.Each(w, func(entry *ecs.Entry) { - position := component.TwoPositionTransformType.Get(entry) + position := component.FixedPositionTransformType.Get(entry) if position.Speed != 0 { pos := position.Pos + position.Speed if pos < consts.TwoPosMin { diff --git a/sys/device_sys/asd.go b/sys/device_sys/asd.go index 99e37d3..191c6e9 100644 --- a/sys/device_sys/asd.go +++ b/sys/device_sys/asd.go @@ -13,7 +13,7 @@ type AsdSys struct { func NewAsdSys() *AsdSys { return &AsdSys{ - query: ecs.NewQuery(filter.Contains(component.AsdMotorStateType, component.TwoPositionTransformType)), + query: ecs.NewQuery(filter.Contains(component.AsdMotorStateType, component.FixedPositionTransformType)), } } @@ -22,7 +22,7 @@ func (s *AsdSys) Update(world ecs.World) { s.query.Each(world, func(entry *ecs.Entry) { //设置两位置转换速度 psdMotorState := component.AsdMotorStateType.Get(entry) - twoPosition := component.TwoPositionTransformType.Get(entry) + twoPosition := component.FixedPositionTransformType.Get(entry) asdState := component.AsdStateType.Get(entry) pos := twoPosition.Pos if entry.HasComponent(component.AsdCannotOpenTag) { diff --git a/sys/device_sys/zzj.go b/sys/device_sys/zzj.go index 404c93d..aa3af67 100644 --- a/sys/device_sys/zzj.go +++ b/sys/device_sys/zzj.go @@ -13,7 +13,7 @@ type ZzjSys struct { func NewZzjSys() *ZzjSys { return &ZzjSys{ - query: ecs.NewQuery(filter.Contains(component.ZzjStateType, component.TwoPositionTransformType)), + query: ecs.NewQuery(filter.Contains(component.ZzjStateType, component.FixedPositionTransformType)), } } @@ -28,7 +28,7 @@ const ( func (z *ZzjSys) Update(w ecs.World) { z.query.Each(w, func(entry *ecs.Entry) { zzj := component.ZzjStateType.Get(entry) - tp := component.TwoPositionTransformType.Get(entry) + tp := component.FixedPositionTransformType.Get(entry) if entry.HasComponent(component.TurnoutFaultJcType) { // 道岔挤岔,设置位置到中间,且不再能转动 tp.Pos = consts.TwoPosMax / 2 diff --git a/sys/iscs_sys/iscs_bas_air_conditioner.go b/sys/iscs_sys/iscs_bas_air_conditioner.go index 8624317..1978bfa 100644 --- a/sys/iscs_sys/iscs_bas_air_conditioner.go +++ b/sys/iscs_sys/iscs_bas_air_conditioner.go @@ -13,17 +13,14 @@ type AirConditionerSystem struct { func NewAirConditionerSystem() *AirConditionerSystem { return &AirConditionerSystem{ - query: ecs.NewQuery(filter.Contains(component.UidType, component.MotorType, component.AirConditioningType, component.FluidDriverType)), + query: ecs.NewQuery(filter.Contains(component.UidType, component.MotorType, component.AirConditioningType)), } } func (s *AirConditionerSystem) Update(w ecs.World) { s.query.Each(w, func(entry *ecs.Entry) { motor := component.MotorType.Get(entry) - fluidDriver := component.FluidDriverType.Get(entry) air := component.AirConditioningType.Get(entry) // air.Running = motor.Speed > 0 - fluidDriver.On = air.Running - fluidDriver.Forward = motor.Forward }) } diff --git a/sys/iscs_sys/iscs_bas_fan.go b/sys/iscs_sys/iscs_bas_fan.go index 5add54d..ab5adba 100644 --- a/sys/iscs_sys/iscs_bas_fan.go +++ b/sys/iscs_sys/iscs_bas_fan.go @@ -50,6 +50,5 @@ func (s *FanSystem) Update(w ecs.World) { } // fluidDriver.On = fan.Speed > 0 - fluidDriver.Forward = fan.Forward }) } diff --git a/sys/iscs_sys/iscs_bas_fluid.go b/sys/iscs_sys/iscs_bas_fluid.go index ac87051..e8c0b4f 100644 --- a/sys/iscs_sys/iscs_bas_fluid.go +++ b/sys/iscs_sys/iscs_bas_fluid.go @@ -8,12 +8,15 @@ import ( "joylink.club/rtsssimulation/entity" "joylink.club/rtsssimulation/repository" "joylink.club/rtsssimulation/repository/model/proto" + "log/slog" ) // FluidDriverSystem 流体驱动系统 // 实现流体在设备、管线中流动 +// 流体驱动源(风机、送风亭、泵) type FluidDriverSystem struct { - query *ecs.Query + query *ecs.Query //流体驱动源 + drivePathMap map[string][]*SearchedPath //key pipePortId,value 驱动源驱动流体的路径 } func NewFluidDriverSystem() *FluidDriverSystem { @@ -22,30 +25,275 @@ func NewFluidDriverSystem() *FluidDriverSystem { } } -// 流体驱动系统依赖的数据 -type fluidDriverModel interface { - Outputs() []repository.DevicePort - Inputs() []repository.DevicePort +// 获取流体流动路径 +func (s *FluidDriverSystem) findFluidPath(fromDevice repository.Identity, fromDevicePortPipe repository.PipePort, fromIsStart bool) []*SearchedPath { + pipePortId := fromDevicePortPipe.PipePortId() + sp, ok := s.drivePathMap[pipePortId] + if !ok { + sp = newFluidDriverPathSearcher(fromDevice, fromDevicePortPipe, fromIsStart).search() + s.drivePathMap[pipePortId] = sp + } + return sp } - func (s *FluidDriverSystem) Update(w ecs.World) { wd := entity.GetWorldData(w) s.query.Each(w, func(entry *ecs.Entry) { fdId := component.UidType.Get(entry).Id fd := component.FluidDriverType.Get(entry) - fdModel, fdModelOk := wd.Repo.FindById(fdId).(fluidDriverModel) - if !fdModelOk { - fmt.Printf("==>>FluidDriverSystem.Update FluidDriver[%s]未实现接口fluidDriverModel\n", fdId) + fluidDriverOn := fd.On + fdModel := wd.Repo.FindById(fdId) + if fdModel == nil { + fmt.Printf("==>>FluidDriver[%s]模型不存在\n", fdId) } else { - s.fluidDrive(entry, fd, fdModel) + switch fdModel.Type() { + case proto.DeviceType_DeviceType_Fan: //风机 + { + fanModel := fdModel.(*repository.Fan) + fanOutPort := *fanModel.PortA + fanInPort := *fanModel.PortB + fanOutPath := s.findFluidPath(fanModel, fanOutPort, true) + fanInPath := s.findFluidPath(fanModel, fanInPort, false) + // + _ = fanOutPath + _ = fanInPath + _ = fluidDriverOn + } + case proto.DeviceType_DeviceType_AirPavilion: //风亭,其中送风亭为动力源 + + } } }) } -func (s *FluidDriverSystem) fluidDrive(entry *ecs.Entry, fd *component.FluidDriver, fdModel fluidDriverModel) { - for _, out := range fdModel.Outputs() { - switch out.Device().Type() { - case proto.DeviceType_DeviceType_Pipe: +// 计算流体在管线中的流动参数 +func (s *FluidDriverSystem) calculateFluid(fluidDriverOn bool, outPath []*SearchedPath, inPath []*SearchedPath) { + +} + +// 判断路径是否畅通 +func (s *FluidDriverSystem) isFluidPathUnblocked(fp *SearchedPath, w ecs.World) bool { + for i := 0; i < len(fp.ViaPipes); i++ { + viaPipe := fp.ViaPipes[i] + viaDevice := viaPipe.Device().(*repository.Pipe).PortDevice(viaPipe.Port()) + switch viaDevice.Device().Type() { + case proto.DeviceType_DeviceType_Environment: //默认畅通 + case proto.DeviceType_DeviceType_PipeFitting: //默认畅通 + case proto.DeviceType_DeviceType_AirPurificationDevice: //默认畅通 + case proto.DeviceType_DeviceType_GasMixingChamber: //默认畅通 + case proto.DeviceType_DeviceType_Valve: + if s.getValveOpenRate(w, viaDevice.Device().Id()) <= 0 { //阀门未开,路径阻塞 + return false + } + case proto.DeviceType_DeviceType_CombinationAirConditioner: + if !s.isCombinationAirConditionerRunning(w, viaDevice.Device().Id()) { //组合式空调未开,路径阻塞 + return false + } + } + } + return true +} + +// 组合式空调是否在运行 +func (s *FluidDriverSystem) isCombinationAirConditionerRunning(w ecs.World, id string) bool { + wd := entity.GetWorldData(w) + entry, ok := wd.EntityMap[id] + if ok { + air := component.AirConditioningType.Get(entry) + return air.Running + } else { + slog.Warn(fmt.Sprintf("World中未找到组合式空调[%s]的实体", id)) + } + + return false +} + +// 获取阀门开度 +func (s *FluidDriverSystem) getValveOpenRate(w ecs.World, valveId string) uint8 { + wd := entity.GetWorldData(w) + entry, ok := wd.EntityMap[valveId] + if ok { + return component.ValveType.Get(entry).OpenRate + } else { + slog.Warn(fmt.Sprintf("World中未找到阀门[%s]的实体", valveId)) + } + return 0 +} + +//////////////////////////流体路径相关///////////////////////////// + +type SearchedPath struct { + ViaPipes []repository.PipePort //路径所经过的有向管线 +} +type fluidDriverPathSearcher struct { + fromDevice repository.Identity //起点设备 + fromDevicePortPipe repository.PipePort //从起点设备的某个端口连接的管线的某个端口开始 + fromIsStart bool //true-以设备输出口为起点;false-以设备输入口为起点 + searchedPaths []*fluidPath //搜索到的路径 + excludePipeIds []string //排除经过这些管线的路径 +} + +func newFluidDriverPathSearcher(fromDevice repository.Identity, fromDevicePortPipe repository.PipePort, fromIsStart bool) *fluidDriverPathSearcher { + return &fluidDriverPathSearcher{fromDevice: fromDevice, fromDevicePortPipe: fromDevicePortPipe, fromIsStart: fromIsStart} +} + +func (s *fluidDriverPathSearcher) search() []*SearchedPath { + var rt []*SearchedPath + if !s.exclude(s.fromDevicePortPipe.Device().Id()) { + searchContext := &fluidPath{} + searchContext.addPipe(s.fromDevicePortPipe) + s.doSearch(searchContext) + } else { + return rt + } + // + for _, fp := range s.searchedPaths { + fpLen := len(fp.viaPipes) + path := &SearchedPath{} + if !s.fromIsStart { //以输入口为起点,须反转搜索结果 + for i := fpLen - 1; i >= 0; i-- { + viaPipe := fp.viaPipes[i] + path.ViaPipes = append(path.ViaPipes, viaPipe.ToOtherPort()) + } + } else { + for _, viaPipe := range fp.viaPipes { + path.ViaPipes = append(path.ViaPipes, viaPipe) + } + } + rt = append(rt, path) + } + + // + return rt +} + +func (s *fluidDriverPathSearcher) exclude(pipeId string) bool { + for _, excludePipeId := range s.excludePipeIds { + if excludePipeId == pipeId { + return true + } + } + return false +} +func (s *fluidDriverPathSearcher) addSearchedPath(searchContext *fluidPath) { + s.searchedPaths = append(s.searchedPaths, searchContext) +} + +// 递归搜索 +func (s *fluidDriverPathSearcher) doSearch(searchContext *fluidPath) { + nextViaPipes := searchContext.nextViaPathPipes() + lenNextPipes := len(nextViaPipes) + if lenNextPipes == 0 { + s.addSearchedPath(searchContext) + } else if lenNextPipes == 1 { + if !searchContext.viaPipe(nextViaPipes[0].Device().Id()) && !s.exclude(nextViaPipes[0].Device().Id()) { + searchContext.addPipe(nextViaPipes[0]) + s.doSearch(searchContext) + } + } else { + for _, nextViaPipe := range nextViaPipes { + if searchContext.viaPipe(nextViaPipe.Device().Id()) { //舍弃回头路径 + continue + } + if s.exclude(nextViaPipe.Device().Id()) { //舍弃排除路径 + continue + } + // + cp := searchContext.clone() + cp.addPipe(nextViaPipe) + s.doSearch(cp) } } } + +func (p *fluidPath) nextViaPathPipes() []repository.PipePort { + nextDevice := p.nextDevice() + switch nextDevice.Type() { + case proto.DeviceType_DeviceType_PipeFitting: + return p.nextDeviceViaPipes(nextDevice.(*repository.PipeFitting).Ports(), p.curPipe) + case proto.DeviceType_DeviceType_Valve: + return p.nextDeviceViaPipes(nextDevice.(*repository.Valve).Ports(), p.curPipe) + case proto.DeviceType_DeviceType_GasMixingChamber: + return p.nextGasMixingChamberViaPipes(nextDevice.(*repository.GasMixingChamber), p.curPipe) + case proto.DeviceType_DeviceType_CombinationAirConditioner: + return p.nextCombinationAirConditionerViaPipes(nextDevice.(*repository.CombinationAirConditioner), p.curPipe) + case proto.DeviceType_DeviceType_AirPurificationDevice: + return p.nextDeviceViaPipes(nextDevice.(*repository.AirPurificationDevice).Ports(), p.curPipe) + default: + slog.Warn("管线路径中的设备[%d]无法处理", nextDevice.Type()) + } + return nil +} + +/////////////////////////////////////////////////////////////////////////////////////////// + +func (p *fluidPath) nextDeviceViaPipes(deviceAllPipePorts []*repository.PipePort, preViaPipe repository.PipePort) []repository.PipePort { + var rt []repository.PipePort + findPreViaPipe := false + for _, pfPort := range deviceAllPipePorts { + if preViaPipe.Device().Id() != pfPort.Device().Id() { + rt = append(rt, *pfPort) + } else { + findPreViaPipe = true + } + } + if !findPreViaPipe { //校验数据 + panic("preViaPipe没有与设备连接") + } + return rt +} + +// 组合式空调 +func (p *fluidPath) nextCombinationAirConditionerViaPipes(nextDevice *repository.CombinationAirConditioner, preViaPipe repository.PipePort) []repository.PipePort { + var rt []repository.PipePort + if preViaPipe.Device().Id() == nextDevice.PortA.Device().Id() { //从组合式空调的A口进入 + rt = append(rt, *nextDevice.PortB) + if nextDevice.PortC != nil { + rt = append(rt, *nextDevice.PortC) + } + return rt + } else if preViaPipe.Device().Id() == nextDevice.PortD.Device().Id() { //从组合式空调的D口进入 + return rt + } + return rt +} + +// 静压箱 +func (p *fluidPath) nextGasMixingChamberViaPipes(nextDevice *repository.GasMixingChamber, preViaPipe repository.PipePort) []repository.PipePort { + var rt []repository.PipePort + if nextDevice.IsInput(preViaPipe.Device().Id()) { + for _, out := range nextDevice.PortsB { + rt = append(rt, *out) + } + } + return rt +} + +type fluidPath struct { + curPipe repository.PipePort //路径中当前有向管线 + viaPipes []repository.PipePort //路径所经过的有向管线 +} + +func (p *fluidPath) addPipe(viaPipe repository.PipePort) { + p.viaPipes = append(p.viaPipes, viaPipe) + p.curPipe = viaPipe +} +func (p *fluidPath) viaPipe(pipeId string) bool { + for _, vp := range p.viaPipes { + if vp.Device().Id() == pipeId { + return true + } + } + return false +} +func (p *fluidPath) clone() *fluidPath { + cp := &fluidPath{viaPipes: make([]repository.PipePort, 0, len(p.viaPipes)), curPipe: p.curPipe} + copy(cp.viaPipes, p.viaPipes) + return cp +} +func (p *fluidPath) nextDevice() repository.Identity { + if p.curPipe.Port() == proto.Port_A { + return p.curPipe.Device().(*repository.Pipe).PortB.Device() + } else { + return p.curPipe.Device().(*repository.Pipe).PortA.Device() + } +} diff --git a/sys/iscs_sys/iscs_bas_valve.go b/sys/iscs_sys/iscs_bas_valve.go index a569913..1d0ad86 100644 --- a/sys/iscs_sys/iscs_bas_valve.go +++ b/sys/iscs_sys/iscs_bas_valve.go @@ -1,12 +1,13 @@ package iscs_sys import ( + "math" + "joylink.club/ecs" "joylink.club/ecs/filter" "joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/consts" "joylink.club/rtsssimulation/entity" - "math" ) // ValveSystem 阀门 @@ -16,16 +17,17 @@ type ValveSystem struct { func NewValveSystem() *ValveSystem { return &ValveSystem{ - query: ecs.NewQuery(filter.Contains(component.UidType, component.ValveType, component.ValveControllerType, component.TwoPositionTransformType)), + query: ecs.NewQuery(filter.Contains(component.UidType, component.ValveType, component.ValveControllerType, component.FixedPositionTransformType)), } } + func (s *ValveSystem) Update(w ecs.World) { wd := entity.GetWorldData(w) s.query.Each(w, func(entry *ecs.Entry) { valveId := component.UidType.Get(entry).Id valve := component.ValveType.Get(entry) valveController := component.ValveControllerType.Get(entry) - position := component.TwoPositionTransformType.Get(entry) + position := component.FixedPositionTransformType.Get(entry) // valve.OpenRate = uint8((float64(position.Pos-consts.TwoPosMin) / float64(consts.TwoPosMax-consts.TwoPosMin)) * float64(100)) valve.Closed = valve.OpenRate <= 0