diff --git a/simulation/components/common.go b/components/common.go similarity index 69% rename from simulation/components/common.go rename to components/common.go index d72b685..6d23c71 100644 --- a/simulation/components/common.go +++ b/components/common.go @@ -28,3 +28,15 @@ var ComSignalState = ecs.NewComponentType[state.SignalState]() // 信号机显示操作组件 var ComSignalDisplayOperating = ecs.NewComponentType[state.SignalDisplayOperating]() + +// 单个屏蔽门状态组件 +var ComPsdCellState = ecs.NewComponentType[state.PsdCellState]() + +// 单个屏蔽门操作组件 +var ComPsdCellOperating = ecs.NewComponentType[state.PsdCellOperating]() + +// 站台单侧所有单个屏蔽门状态组件 +var ComPsdState = ecs.NewComponentType[state.PsdState]() + +// 标记 +var ComPsdStateTag = ecs.NewComponentType[ecs.ComponentType[state.PsdState]]() diff --git a/simulation/examples/main.go b/examples/main.go similarity index 91% rename from simulation/examples/main.go rename to examples/main.go index b834e23..5db30b1 100644 --- a/simulation/examples/main.go +++ b/examples/main.go @@ -49,11 +49,11 @@ func main() { func initDevicesStatus(world ecs.World) { //当组件未显式set值时,world会初始化组件的零值 - switch1Entry := world.Create(components.ComDeviceIdentity, components.ComSwitchState) + switch1Entry := memory.CreateSwitchEntity(world) components.ComDeviceIdentity.Set(switch1Entry, &state.DeviceIdentity{Id: "switch1"}) components.ComSwitchState.Set(switch1Entry, &state.SwitchState{NormalRelay: false, ReverseRelay: false, NormalTable: true, ReverseTable: false}) // - signal1Entry := world.Create(components.ComDeviceIdentity, components.ComSignalState) + signal1Entry := memory.CreateSignalEntity(world) components.ComDeviceIdentity.Set(signal1Entry, &state.DeviceIdentity{Id: "siganl1"}) components.ComSignalState.Set(signal1Entry, &state.SignalState{Display: state.SignalAspect_No}) } diff --git a/simulation/go.mod b/go.mod similarity index 100% rename from simulation/go.mod rename to go.mod diff --git a/simulation/go.sum b/go.sum similarity index 100% rename from simulation/go.sum rename to go.sum diff --git a/go.work b/go.work index 8b31d90..e224206 100644 --- a/go.work +++ b/go.work @@ -2,5 +2,5 @@ go 1.20 use ( ./jl-ecs-go - ./simulation + . ) diff --git a/memory/init_world.go b/memory/init_world.go new file mode 100644 index 0000000..dd2abf3 --- /dev/null +++ b/memory/init_world.go @@ -0,0 +1,55 @@ +package memory + +import ( + "time" + + "github.com/yohamta/donburi/component" + "joylink.club/ecs" + "joylink.club/rtsssimulation/components" + "joylink.club/rtsssimulation/state" + "joylink.club/rtsssimulation/system" +) + +// 实体标签 +type EntityTag = component.IComponentType + +// 初始化world,添加一些内置的组件和系统 +func InitializeWorld(w ecs.World, worldTime time.Time) *system.FaceSystem { + //初始化world时钟 + timeEntry := w.Create(components.ComSystemTimer) + components.ComSystemTimer.Set(timeEntry, state.NewSystemTimer(&worldTime)) + w.AddSystem(system.NewTimerSystem()) + //初始化world与外界交互的门面 + faceSystem := system.NewFaceSystem(w) + w.AddSystem(faceSystem) + //添加调试系统 + w.AddSystem(system.NewDebugSystem()) + // + return faceSystem +} + +// 创建道岔实体 +func CreateSwitchEntity(w ecs.World) *ecs.Entry { + return w.Create(components.ComDeviceIdentity, components.ComSwitchState) +} + +// 创建信号机实体 +func CreateSignalEntity(w ecs.World) *ecs.Entry { + return w.Create(components.ComDeviceIdentity, components.ComSignalState) +} + +// 创建物理区段实体 +func CreatePhysicalSectionEntity(w ecs.World) *ecs.Entry { + return w.Create(components.ComDeviceIdentity, components.ComPhysicalSectionState) +} + +// 创建站台单侧屏蔽门实体 +func CreatePsdEntity(w ecs.World) *ecs.Entry { + return w.Create(components.ComDeviceIdentity, components.ComPsdState) +} + +// 创建单个屏蔽门实体 +// psdTag标记该cell是哪个站的哪侧屏蔽门 +func CreatePsdCellEntity(w ecs.World, psdTag EntityTag) *ecs.Entry { + return w.Create(components.ComDeviceIdentity, components.ComPsdCellState, psdTag) +} diff --git a/simulation/model/axle_model.go b/model/axle_model.go similarity index 100% rename from simulation/model/axle_model.go rename to model/axle_model.go diff --git a/simulation/model/device_model.go b/model/device_model.go similarity index 100% rename from simulation/model/device_model.go rename to model/device_model.go diff --git a/simulation/model/link_model.go b/model/link_model.go similarity index 100% rename from simulation/model/link_model.go rename to model/link_model.go diff --git a/simulation/model/signal_model.go b/model/signal_model.go similarity index 100% rename from simulation/model/signal_model.go rename to model/signal_model.go diff --git a/simulation/model/switch_model.go b/model/switch_model.go similarity index 100% rename from simulation/model/switch_model.go rename to model/switch_model.go diff --git a/simulation/proto/main.go b/proto/main.go similarity index 100% rename from simulation/proto/main.go rename to proto/main.go diff --git a/simulation/proto/protoc-23.1/bin/linux-x86_64/protoc b/proto/protoc-23.1/bin/linux-x86_64/protoc similarity index 100% rename from simulation/proto/protoc-23.1/bin/linux-x86_64/protoc rename to proto/protoc-23.1/bin/linux-x86_64/protoc diff --git a/simulation/proto/protoc-23.1/bin/win64/protoc.exe b/proto/protoc-23.1/bin/win64/protoc.exe similarity index 100% rename from simulation/proto/protoc-23.1/bin/win64/protoc.exe rename to proto/protoc-23.1/bin/win64/protoc.exe diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/any.proto b/proto/protoc-23.1/include/google/protobuf/any.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/any.proto rename to proto/protoc-23.1/include/google/protobuf/any.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/api.proto b/proto/protoc-23.1/include/google/protobuf/api.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/api.proto rename to proto/protoc-23.1/include/google/protobuf/api.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/compiler/plugin.proto b/proto/protoc-23.1/include/google/protobuf/compiler/plugin.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/compiler/plugin.proto rename to proto/protoc-23.1/include/google/protobuf/compiler/plugin.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/descriptor.proto b/proto/protoc-23.1/include/google/protobuf/descriptor.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/descriptor.proto rename to proto/protoc-23.1/include/google/protobuf/descriptor.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/duration.proto b/proto/protoc-23.1/include/google/protobuf/duration.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/duration.proto rename to proto/protoc-23.1/include/google/protobuf/duration.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/empty.proto b/proto/protoc-23.1/include/google/protobuf/empty.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/empty.proto rename to proto/protoc-23.1/include/google/protobuf/empty.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/field_mask.proto b/proto/protoc-23.1/include/google/protobuf/field_mask.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/field_mask.proto rename to proto/protoc-23.1/include/google/protobuf/field_mask.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/source_context.proto b/proto/protoc-23.1/include/google/protobuf/source_context.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/source_context.proto rename to proto/protoc-23.1/include/google/protobuf/source_context.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/struct.proto b/proto/protoc-23.1/include/google/protobuf/struct.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/struct.proto rename to proto/protoc-23.1/include/google/protobuf/struct.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/timestamp.proto b/proto/protoc-23.1/include/google/protobuf/timestamp.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/timestamp.proto rename to proto/protoc-23.1/include/google/protobuf/timestamp.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/type.proto b/proto/protoc-23.1/include/google/protobuf/type.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/type.proto rename to proto/protoc-23.1/include/google/protobuf/type.proto diff --git a/simulation/proto/protoc-23.1/include/google/protobuf/wrappers.proto b/proto/protoc-23.1/include/google/protobuf/wrappers.proto similarity index 100% rename from simulation/proto/protoc-23.1/include/google/protobuf/wrappers.proto rename to proto/protoc-23.1/include/google/protobuf/wrappers.proto diff --git a/simulation/proto/protoc-23.1/readme.txt b/proto/protoc-23.1/readme.txt similarity index 100% rename from simulation/proto/protoc-23.1/readme.txt rename to proto/protoc-23.1/readme.txt diff --git a/simulation/proto/src/status.proto b/proto/src/status.proto similarity index 72% rename from simulation/proto/src/status.proto rename to proto/src/status.proto index 5fcae7f..ab3455b 100644 --- a/simulation/proto/src/status.proto +++ b/proto/src/status.proto @@ -104,4 +104,36 @@ enum SignalAspect{ WF=14; } -////////////////////////////////////////////////// \ No newline at end of file +////////////////////////////////////////////////// + +//单个屏蔽门状态 +message PsdCellState{ + //门关百分比,值范围[0,100],0-全开,100-全关 + int32 closeRate = 1; + //是否锁闭,当门关上且锁闭才是安全的 + bool locked = 2; +} +//站台一侧所有单个屏蔽门状态 +message PsdState{ + //所有单个屏蔽门是否全关 + bool allClosed = 1; + //所有单个屏蔽门是否全开 + bool allOpened = 2; + //是否互锁解除,当互锁解除时ATS不关注该侧屏蔽门的状态 + bool interlockReleased = 3; +} +//单个屏蔽门操作 +message PsdCellOperating{ + // 是否启动操作 + bool start = 1; + //是否关门动作 + //true-关门动作;false-开门动作 + bool closeOperate = 2; + //本次操作共需要多长时间 + int64 sumTime = 3; + //动作剩余时间 + int64 operateTime = 4; +} + + +//////////////////////////////////////////////////////// \ No newline at end of file diff --git a/simulation/memory/init_world.go b/simulation/memory/init_world.go deleted file mode 100644 index 7faebca..0000000 --- a/simulation/memory/init_world.go +++ /dev/null @@ -1,25 +0,0 @@ -package memory - -import ( - "time" - - "joylink.club/ecs" - "joylink.club/rtsssimulation/components" - "joylink.club/rtsssimulation/state" - "joylink.club/rtsssimulation/system" -) - -// 初始化world,添加一些内置的组件和系统 -func InitializeWorld(w ecs.World, worldTime time.Time) *system.FaceSystem { - //初始化world时钟 - timeEntry := w.Create(components.ComSystemTimer) - components.ComSystemTimer.Set(timeEntry, state.NewSystemTimer(&worldTime)) - w.AddSystem(system.NewTimerSystem()) - //初始化world与外界交互的门面 - faceSystem := system.NewFaceSystem(w) - w.AddSystem(faceSystem) - //添加调试系统 - w.AddSystem(system.NewDebugSystem()) - // - return faceSystem -} diff --git a/simulation/state/status.pb.go b/state/status.pb.go similarity index 71% rename from simulation/state/status.pb.go rename to state/status.pb.go index 344018c..e6e0b6d 100644 --- a/simulation/state/status.pb.go +++ b/state/status.pb.go @@ -558,6 +558,208 @@ func (x *SignalDisplayOperating) GetTargetAspect() SignalAspect { return SignalAspect_No } +// 单个屏蔽门状态 +type PsdCellState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 门关百分比,值范围[0,100],0-全开,100-全关 + CloseRate int32 `protobuf:"varint,1,opt,name=closeRate,proto3" json:"closeRate,omitempty"` + // 是否锁闭,当门关上且锁闭才是安全的 + Locked bool `protobuf:"varint,2,opt,name=locked,proto3" json:"locked,omitempty"` +} + +func (x *PsdCellState) Reset() { + *x = PsdCellState{} + if protoimpl.UnsafeEnabled { + mi := &file_status_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PsdCellState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PsdCellState) ProtoMessage() {} + +func (x *PsdCellState) ProtoReflect() protoreflect.Message { + mi := &file_status_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 PsdCellState.ProtoReflect.Descriptor instead. +func (*PsdCellState) Descriptor() ([]byte, []int) { + return file_status_proto_rawDescGZIP(), []int{7} +} + +func (x *PsdCellState) GetCloseRate() int32 { + if x != nil { + return x.CloseRate + } + return 0 +} + +func (x *PsdCellState) GetLocked() bool { + if x != nil { + return x.Locked + } + return false +} + +// 站台一侧所有单个屏蔽门状态 +type PsdState struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 所有单个屏蔽门是否全关 + AllClosed bool `protobuf:"varint,1,opt,name=allClosed,proto3" json:"allClosed,omitempty"` + // 所有单个屏蔽门是否全开 + AllOpened bool `protobuf:"varint,2,opt,name=allOpened,proto3" json:"allOpened,omitempty"` + // 是否互锁解除,当互锁解除时ATS不关注该侧屏蔽门的状态 + InterlockReleased bool `protobuf:"varint,3,opt,name=interlockReleased,proto3" json:"interlockReleased,omitempty"` +} + +func (x *PsdState) Reset() { + *x = PsdState{} + if protoimpl.UnsafeEnabled { + mi := &file_status_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PsdState) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PsdState) ProtoMessage() {} + +func (x *PsdState) ProtoReflect() protoreflect.Message { + mi := &file_status_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 PsdState.ProtoReflect.Descriptor instead. +func (*PsdState) Descriptor() ([]byte, []int) { + return file_status_proto_rawDescGZIP(), []int{8} +} + +func (x *PsdState) GetAllClosed() bool { + if x != nil { + return x.AllClosed + } + return false +} + +func (x *PsdState) GetAllOpened() bool { + if x != nil { + return x.AllOpened + } + return false +} + +func (x *PsdState) GetInterlockReleased() bool { + if x != nil { + return x.InterlockReleased + } + return false +} + +// 单个屏蔽门操作 +type PsdCellOperating struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // 是否启动操作 + Start bool `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` + // 是否关门动作 + // true-关门动作;false-开门动作 + CloseOperate bool `protobuf:"varint,2,opt,name=closeOperate,proto3" json:"closeOperate,omitempty"` + // 本次操作共需要多长时间 + SumTime int64 `protobuf:"varint,3,opt,name=sumTime,proto3" json:"sumTime,omitempty"` + // 动作剩余时间 + OperateTime int64 `protobuf:"varint,4,opt,name=operateTime,proto3" json:"operateTime,omitempty"` +} + +func (x *PsdCellOperating) Reset() { + *x = PsdCellOperating{} + if protoimpl.UnsafeEnabled { + mi := &file_status_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PsdCellOperating) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PsdCellOperating) ProtoMessage() {} + +func (x *PsdCellOperating) ProtoReflect() protoreflect.Message { + mi := &file_status_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 PsdCellOperating.ProtoReflect.Descriptor instead. +func (*PsdCellOperating) Descriptor() ([]byte, []int) { + return file_status_proto_rawDescGZIP(), []int{9} +} + +func (x *PsdCellOperating) GetStart() bool { + if x != nil { + return x.Start + } + return false +} + +func (x *PsdCellOperating) GetCloseOperate() bool { + if x != nil { + return x.CloseOperate + } + return false +} + +func (x *PsdCellOperating) GetSumTime() int64 { + if x != nil { + return x.SumTime + } + return 0 +} + +func (x *PsdCellOperating) GetOperateTime() int64 { + if x != nil { + return x.OperateTime + } + return 0 +} + var File_status_proto protoreflect.FileDescriptor var file_status_proto_rawDesc = []byte{ @@ -605,17 +807,37 @@ var file_status_proto_rawDesc = []byte{ 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, - 0x52, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x2a, 0x81, - 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x12, - 0x06, 0x0a, 0x02, 0x4e, 0x6f, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x52, 0x10, 0x01, 0x12, 0x05, - 0x0a, 0x01, 0x47, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x59, 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01, - 0x57, 0x10, 0x04, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x05, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x59, - 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x57, 0x10, 0x07, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x47, - 0x10, 0x08, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x59, 0x10, 0x09, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x59, - 0x10, 0x0a, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x46, 0x10, 0x0b, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x46, - 0x10, 0x0c, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x46, 0x10, 0x0d, 0x12, 0x06, 0x0a, 0x02, 0x57, 0x46, - 0x10, 0x0e, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x0c, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x22, 0x44, + 0x0a, 0x0c, 0x50, 0x73, 0x64, 0x43, 0x65, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, + 0x0a, 0x09, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x09, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6c, 0x6f, + 0x63, 0x6b, 0x65, 0x64, 0x22, 0x74, 0x0a, 0x08, 0x50, 0x73, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x1c, + 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x09, 0x61, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x12, 0x2c, 0x0a, 0x11, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6c, 0x6f, + 0x63, 0x6b, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x64, 0x22, 0x88, 0x01, 0x0a, 0x10, 0x50, + 0x73, 0x64, 0x43, 0x65, 0x6c, 0x6c, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x12, + 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x63, 0x6c, 0x6f, + 0x73, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, + 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x54, + 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x54, 0x69, 0x6d, 0x65, 0x2a, 0x81, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, + 0x41, 0x73, 0x70, 0x65, 0x63, 0x74, 0x12, 0x06, 0x0a, 0x02, 0x4e, 0x6f, 0x10, 0x00, 0x12, 0x05, + 0x0a, 0x01, 0x52, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x47, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, + 0x59, 0x10, 0x03, 0x12, 0x05, 0x0a, 0x01, 0x57, 0x10, 0x04, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, + 0x05, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x59, 0x10, 0x06, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x57, 0x10, + 0x07, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x47, 0x10, 0x08, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x59, 0x10, + 0x09, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x59, 0x10, 0x0a, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x46, 0x10, + 0x0b, 0x12, 0x06, 0x0a, 0x02, 0x59, 0x46, 0x10, 0x0c, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x46, 0x10, + 0x0d, 0x12, 0x06, 0x0a, 0x02, 0x57, 0x46, 0x10, 0x0e, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -631,7 +853,7 @@ func file_status_proto_rawDescGZIP() []byte { } var file_status_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_status_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_status_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_status_proto_goTypes = []interface{}{ (SignalAspect)(0), // 0: state.SignalAspect (*DeviceIdentity)(nil), // 1: state.DeviceIdentity @@ -641,6 +863,9 @@ var file_status_proto_goTypes = []interface{}{ (*PhysicalSectionState)(nil), // 5: state.PhysicalSectionState (*SignalState)(nil), // 6: state.SignalState (*SignalDisplayOperating)(nil), // 7: state.SignalDisplayOperating + (*PsdCellState)(nil), // 8: state.PsdCellState + (*PsdState)(nil), // 9: state.PsdState + (*PsdCellOperating)(nil), // 10: state.PsdCellOperating } var file_status_proto_depIdxs = []int32{ 0, // 0: state.SignalState.display:type_name -> state.SignalAspect @@ -742,6 +967,42 @@ func file_status_proto_init() { return nil } } + file_status_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PsdCellState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_status_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PsdState); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_status_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PsdCellOperating); 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{ @@ -749,7 +1010,7 @@ func file_status_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_status_proto_rawDesc, NumEnums: 1, - NumMessages: 7, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/simulation/state/system_state.go b/state/system_state.go similarity index 100% rename from simulation/state/system_state.go rename to state/system_state.go diff --git a/simulation/system/debug_system.go b/system/debug_system.go similarity index 100% rename from simulation/system/debug_system.go rename to system/debug_system.go diff --git a/simulation/system/face_system.go b/system/face_system.go similarity index 100% rename from simulation/system/face_system.go rename to system/face_system.go diff --git a/system/psd_system.go b/system/psd_system.go new file mode 100644 index 0000000..197a138 --- /dev/null +++ b/system/psd_system.go @@ -0,0 +1,15 @@ +package system + +import "joylink.club/ecs" + +type PsdSystem struct { +} + +func NewPsdSystem() *PsdSystem { + return &PsdSystem{} +} + +// world 执行 +func (me *PsdSystem) Update(world ecs.World) { + +} diff --git a/simulation/system/signal_system.go b/system/signal_system.go similarity index 100% rename from simulation/system/signal_system.go rename to system/signal_system.go diff --git a/simulation/system/switch_system.go b/system/switch_system.go similarity index 100% rename from simulation/system/switch_system.go rename to system/switch_system.go diff --git a/simulation/system/timer_system.go b/system/timer_system.go similarity index 100% rename from simulation/system/timer_system.go rename to system/timer_system.go