Merge remote-tracking branch 'origin/master'

# Conflicts:
#	component/common.go
#	entity/balise.go
This commit is contained in:
joylink_zhangsai 2024-01-10 14:08:19 +08:00
commit ef48c7ba0b
22 changed files with 686 additions and 820 deletions

View File

@ -4,7 +4,7 @@ import (
"fmt"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/component/component_data"
"joylink.club/rtsssimulation/repository/model/proto"
)
@ -55,7 +55,7 @@ func (qc *CiQcTable) QueryQdIndex(uid string) (int, bool) {
}
type CiQcState struct {
component_proto.CiQcState
component_data.CiQcState
}
func NewCiQcState(qlen int, clen int) *CiQcState {
@ -68,7 +68,7 @@ func NewCiQcState(qlen int, clen int) *CiQcState {
cbl++
}
return &CiQcState{
component_proto.CiQcState{
component_data.CiQcState{
Qbs: make([]byte, qbl),
Cbs: make([]byte, cbl),
},

View File

@ -3,7 +3,6 @@ package component
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component/component_data"
"joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/repository/model/proto"
)
@ -13,7 +12,7 @@ var (
// 固定位置转换组件类型
FixedPositionTransformType = ecs.NewComponentType[FixedPositionTransform]()
// 电机状态组件类型
MotorStateType = ecs.NewComponentType[component_data.Motor]()
MotorStateType = ecs.NewComponentType[component_data.MotorState]()
BitStateType = ecs.NewComponentType[BitState]()
)
@ -29,7 +28,7 @@ type Uid struct {
// }
type FixedPositionTransform struct {
component_proto.TwoPositionTransform
component_data.FixedPositionTransform
}
// 当前位置百分比值
@ -65,5 +64,5 @@ type Counter struct {
var CounterType = ecs.NewComponentType[Counter]()
var LinkPositionType = ecs.NewComponentType[component_proto.LinkPosition]()
var LinkPositionType = ecs.NewComponentType[component_data.LinkPosition]()
var KmType = ecs.NewComponentType[proto.Kilometer]()

View File

@ -21,26 +21,26 @@ const (
)
// 信号显示
type Signal_Aspect int32
type CiSignal_Aspect int32
const (
// 红灯亮
Signal_H Signal_Aspect = 0
CiSignal_H CiSignal_Aspect = 0
// 绿灯亮
Signal_L Signal_Aspect = 1
CiSignal_L CiSignal_Aspect = 1
// 黄灯亮
Signal_U Signal_Aspect = 2
CiSignal_U CiSignal_Aspect = 2
// 黄红灯亮(引导信号)
Signal_UH Signal_Aspect = 3
CiSignal_UH CiSignal_Aspect = 3
// 白灯亮
Signal_B Signal_Aspect = 4
CiSignal_B CiSignal_Aspect = 4
// 蓝灯亮
Signal_A Signal_Aspect = 5
CiSignal_A CiSignal_Aspect = 5
)
// Enum value maps for Signal_Aspect.
// Enum value maps for CiSignal_Aspect.
var (
Signal_Aspect_name = map[int32]string{
CiSignal_Aspect_name = map[int32]string{
0: "H",
1: "L",
2: "U",
@ -48,7 +48,7 @@ var (
4: "B",
5: "A",
}
Signal_Aspect_value = map[string]int32{
CiSignal_Aspect_value = map[string]int32{
"H": 0,
"L": 1,
"U": 2,
@ -58,30 +58,30 @@ var (
}
)
func (x Signal_Aspect) Enum() *Signal_Aspect {
p := new(Signal_Aspect)
func (x CiSignal_Aspect) Enum() *CiSignal_Aspect {
p := new(CiSignal_Aspect)
*p = x
return p
}
func (x Signal_Aspect) String() string {
func (x CiSignal_Aspect) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Signal_Aspect) Descriptor() protoreflect.EnumDescriptor {
func (CiSignal_Aspect) Descriptor() protoreflect.EnumDescriptor {
return file_component_ci_proto_enumTypes[0].Descriptor()
}
func (Signal_Aspect) Type() protoreflect.EnumType {
func (CiSignal_Aspect) Type() protoreflect.EnumType {
return &file_component_ci_proto_enumTypes[0]
}
func (x Signal_Aspect) Number() protoreflect.EnumNumber {
func (x CiSignal_Aspect) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Signal_Aspect.Descriptor instead.
func (Signal_Aspect) EnumDescriptor() ([]byte, []int) {
// Deprecated: Use CiSignal_Aspect.Descriptor instead.
func (CiSignal_Aspect) EnumDescriptor() ([]byte, []int) {
return file_component_ci_proto_rawDescGZIP(), []int{4, 0}
}
@ -520,14 +520,14 @@ func (x *CiPointsState) GetSingleLock() bool {
return false
}
type Signal struct {
type CiSignal struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Signal) Reset() {
*x = Signal{}
func (x *CiSignal) Reset() {
*x = CiSignal{}
if protoimpl.UnsafeEnabled {
mi := &file_component_ci_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -535,13 +535,13 @@ func (x *Signal) Reset() {
}
}
func (x *Signal) String() string {
func (x *CiSignal) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Signal) ProtoMessage() {}
func (*CiSignal) ProtoMessage() {}
func (x *Signal) ProtoReflect() protoreflect.Message {
func (x *CiSignal) ProtoReflect() protoreflect.Message {
mi := &file_component_ci_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -553,8 +553,8 @@ func (x *Signal) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Signal.ProtoReflect.Descriptor instead.
func (*Signal) Descriptor() ([]byte, []int) {
// Deprecated: Use CiSignal.ProtoReflect.Descriptor instead.
func (*CiSignal) Descriptor() ([]byte, []int) {
return file_component_ci_proto_rawDescGZIP(), []int{4}
}
@ -565,7 +565,7 @@ type CiSignalState struct {
unknownFields protoimpl.UnknownFields
// 信号显示
Aspect Signal_Aspect `protobuf:"varint,1,opt,name=aspect,proto3,enum=component.Signal_Aspect" json:"aspect,omitempty"`
Aspect CiSignal_Aspect `protobuf:"varint,1,opt,name=aspect,proto3,enum=component.CiSignal_Aspect" json:"aspect,omitempty"`
// 是否逻辑点灯(即室外灭灯)
Logic bool `protobuf:"varint,2,opt,name=logic,proto3" json:"logic,omitempty"`
// 是否封锁
@ -606,11 +606,11 @@ func (*CiSignalState) Descriptor() ([]byte, []int) {
return file_component_ci_proto_rawDescGZIP(), []int{5}
}
func (x *CiSignalState) GetAspect() Signal_Aspect {
func (x *CiSignalState) GetAspect() CiSignal_Aspect {
if x != nil {
return x.Aspect
}
return Signal_H
return CiSignal_H
}
func (x *CiSignalState) GetLogic() bool {
@ -1040,61 +1040,61 @@ var file_component_ci_proto_rawDesc = []byte{
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,
0x6b, 0x22, 0x3f, 0x0a, 0x08, 0x43, 0x69, 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, 0x8d, 0x01, 0x0a, 0x0d, 0x43, 0x69, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x53,
0x74, 0x61, 0x74, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x61, 0x73, 0x70, 0x65, 0x63, 0x74, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
0x2e, 0x43, 0x69, 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 (
@ -1112,13 +1112,13 @@ func file_component_ci_proto_rawDescGZIP() []byte {
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
(CiSignal_Aspect)(0), // 0: component.CiSignal.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
(*CiSignal)(nil), // 6: component.CiSignal
(*CiSignalState)(nil), // 7: component.CiSignalState
(*CiPlatformState)(nil), // 8: component.CiPlatformState
(*RouteSignal)(nil), // 9: component.RouteSignal
@ -1140,7 +1140,7 @@ var file_component_ci_proto_depIdxs = []int32{
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
0, // 7: component.CiSignalState.aspect:type_name -> component.CiSignal.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
@ -1156,7 +1156,7 @@ var file_component_ci_proto_depIdxs = []int32{
0, // [0:16] is the sub-list for field type_name
}
//func init() { file_component_ci_proto_init() }
func init() { file_component_ci_proto_init() }
func file_component_ci_proto_init() {
if File_component_ci_proto != nil {
return
@ -1211,7 +1211,7 @@ func file_component_ci_proto_init() {
}
}
file_component_ci_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Signal); i {
switch v := v.(*CiSignal); i {
case 0:
return &v.state
case 1:

View File

@ -21,7 +21,7 @@ const (
)
// 电机
type Motor struct {
type MotorState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -32,8 +32,8 @@ type Motor struct {
Forward bool `protobuf:"varint,2,opt,name=forward,proto3" json:"forward,omitempty"`
}
func (x *Motor) Reset() {
*x = Motor{}
func (x *MotorState) Reset() {
*x = MotorState{}
if protoimpl.UnsafeEnabled {
mi := &file_component_common_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -41,13 +41,13 @@ func (x *Motor) Reset() {
}
}
func (x *Motor) String() string {
func (x *MotorState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Motor) ProtoMessage() {}
func (*MotorState) ProtoMessage() {}
func (x *Motor) ProtoReflect() protoreflect.Message {
func (x *MotorState) ProtoReflect() protoreflect.Message {
mi := &file_component_common_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -59,39 +59,161 @@ func (x *Motor) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use Motor.ProtoReflect.Descriptor instead.
func (*Motor) Descriptor() ([]byte, []int) {
// Deprecated: Use MotorState.ProtoReflect.Descriptor instead.
func (*MotorState) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{0}
}
func (x *Motor) GetPowerUp() bool {
func (x *MotorState) GetPowerUp() bool {
if x != nil {
return x.PowerUp
}
return false
}
func (x *Motor) GetForward() bool {
func (x *MotorState) GetForward() bool {
if x != nil {
return x.Forward
}
return false
}
// 无极继电器和偏极继电器稳态为落下,也就是后接点(8组采集接点中的1,3接点,1为中接点),吸气为前接点1,2接点
// 有极继电器是定位反位双稳态(有永久磁钢),前接点为定位,后接点为反位
// 有极继电器对于道岔中的2DQJ,励磁接点1,2接通为反位;3,4接通为定位
// 定义继电器状态时false表示落下/反位/后接点,true表示吸起/定位/前接点
// 缓动继电器:指从通电或断电起,至接点转接止所需时间在0.3s以上的继电器。可分为缓放继电器(如无极缓放继电器等)和缓吸继电器(如热力继电器和时间继电器等)。
// 偏极继电器:只有通过规定方向的电流时,才吸起
// 继电器状态
type RelayState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 是否通电
PowerUp bool `protobuf:"varint,1,opt,name=powerUp,proto3" json:"powerUp,omitempty"`
// 是否励磁到前接点
Qq bool `protobuf:"varint,2,opt,name=qq,proto3" json:"qq,omitempty"`
// 是否在前接点位置
Q bool `protobuf:"varint,3,opt,name=q,proto3" json:"q,omitempty"`
}
func (x *RelayState) Reset() {
*x = RelayState{}
if protoimpl.UnsafeEnabled {
mi := &file_component_common_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RelayState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RelayState) ProtoMessage() {}
func (x *RelayState) 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 RelayState.ProtoReflect.Descriptor instead.
func (*RelayState) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{1}
}
func (x *RelayState) GetPowerUp() bool {
if x != nil {
return x.PowerUp
}
return false
}
func (x *RelayState) GetQq() bool {
if x != nil {
return x.Qq
}
return false
}
func (x *RelayState) GetQ() bool {
if x != nil {
return x.Q
}
return false
}
// 开关类设备状态
type SwitchState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 是否按下(按钮式开关true表示按下,旋钮开关true非常态位)
Pressed bool `protobuf:"varint,2,opt,name=pressed,proto3" json:"pressed,omitempty"`
}
func (x *SwitchState) Reset() {
*x = SwitchState{}
if protoimpl.UnsafeEnabled {
mi := &file_component_common_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SwitchState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SwitchState) ProtoMessage() {}
func (x *SwitchState) 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 SwitchState.ProtoReflect.Descriptor instead.
func (*SwitchState) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{2}
}
func (x *SwitchState) GetPressed() bool {
if x != nil {
return x.Pressed
}
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],两位小数
Pos int32 `protobuf:"varint,1,opt,name=pos,proto3" json:"pos,omitempty"` // 当前位置百分比,[0, 100]
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]
mi := &file_component_common_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -104,7 +226,7 @@ func (x *FixedPositionTransform) String() string {
func (*FixedPositionTransform) ProtoMessage() {}
func (x *FixedPositionTransform) ProtoReflect() protoreflect.Message {
mi := &file_component_common_proto_msgTypes[1]
mi := &file_component_common_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -117,7 +239,7 @@ func (x *FixedPositionTransform) ProtoReflect() protoreflect.Message {
// Deprecated: Use FixedPositionTransform.ProtoReflect.Descriptor instead.
func (*FixedPositionTransform) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{1}
return file_component_common_proto_rawDescGZIP(), []int{3}
}
func (x *FixedPositionTransform) GetPos() int32 {
@ -146,7 +268,7 @@ type BitState struct {
func (x *BitState) Reset() {
*x = BitState{}
if protoimpl.UnsafeEnabled {
mi := &file_component_common_proto_msgTypes[2]
mi := &file_component_common_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -159,7 +281,7 @@ func (x *BitState) String() string {
func (*BitState) ProtoMessage() {}
func (x *BitState) ProtoReflect() protoreflect.Message {
mi := &file_component_common_proto_msgTypes[2]
mi := &file_component_common_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -172,7 +294,7 @@ func (x *BitState) ProtoReflect() protoreflect.Message {
// Deprecated: Use BitState.ProtoReflect.Descriptor instead.
func (*BitState) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{2}
return file_component_common_proto_rawDescGZIP(), []int{4}
}
func (x *BitState) GetVal() bool {
@ -195,7 +317,7 @@ type Counter struct {
func (x *Counter) Reset() {
*x = Counter{}
if protoimpl.UnsafeEnabled {
mi := &file_component_common_proto_msgTypes[3]
mi := &file_component_common_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -208,7 +330,7 @@ func (x *Counter) String() string {
func (*Counter) ProtoMessage() {}
func (x *Counter) ProtoReflect() protoreflect.Message {
mi := &file_component_common_proto_msgTypes[3]
mi := &file_component_common_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -221,7 +343,7 @@ func (x *Counter) ProtoReflect() protoreflect.Message {
// Deprecated: Use Counter.ProtoReflect.Descriptor instead.
func (*Counter) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{3}
return file_component_common_proto_rawDescGZIP(), []int{5}
}
func (x *Counter) GetVal() int32 {
@ -238,6 +360,64 @@ func (x *Counter) GetStep() int32 {
return 0
}
// Link位置
type LinkPosition struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Link的ID
LinkId string `protobuf:"bytes,1,opt,name=linkId,proto3" json:"linkId,omitempty"`
// Link的偏移量
Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"`
}
func (x *LinkPosition) Reset() {
*x = LinkPosition{}
if protoimpl.UnsafeEnabled {
mi := &file_component_common_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinkPosition) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinkPosition) ProtoMessage() {}
func (x *LinkPosition) ProtoReflect() protoreflect.Message {
mi := &file_component_common_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 LinkPosition.ProtoReflect.Descriptor instead.
func (*LinkPosition) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{6}
}
func (x *LinkPosition) GetLinkId() string {
if x != nil {
return x.LinkId
}
return ""
}
func (x *LinkPosition) GetOffset() int64 {
if x != nil {
return x.Offset
}
return 0
}
// 倒数/倒计时组件
type CounterDown struct {
state protoimpl.MessageState
@ -251,7 +431,7 @@ type CounterDown struct {
func (x *CounterDown) Reset() {
*x = CounterDown{}
if protoimpl.UnsafeEnabled {
mi := &file_component_common_proto_msgTypes[4]
mi := &file_component_common_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -264,7 +444,7 @@ func (x *CounterDown) String() string {
func (*CounterDown) ProtoMessage() {}
func (x *CounterDown) ProtoReflect() protoreflect.Message {
mi := &file_component_common_proto_msgTypes[4]
mi := &file_component_common_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -277,7 +457,7 @@ func (x *CounterDown) ProtoReflect() protoreflect.Message {
// Deprecated: Use CounterDown.ProtoReflect.Descriptor instead.
func (*CounterDown) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{4}
return file_component_common_proto_rawDescGZIP(), []int{7}
}
func (x *CounterDown) GetVal() int32 {
@ -299,25 +479,36 @@ 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,
0x65, 0x6e, 0x74, 0x22, 0x40, 0x0a, 0x0a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74,
0x65, 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, 0x44, 0x0a, 0x0a, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x53, 0x74,
0x61, 0x74, 0x65, 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, 0x0e, 0x0a,
0x02, 0x71, 0x71, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x71, 0x71, 0x12, 0x0c, 0x0a,
0x01, 0x71, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x01, 0x71, 0x22, 0x27, 0x0a, 0x0b, 0x53,
0x77, 0x69, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72,
0x65, 0x73, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x70, 0x72, 0x65,
0x73, 0x73, 0x65, 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, 0x3e, 0x0a, 0x0c, 0x4c, 0x69, 0x6e, 0x6b, 0x50, 0x6f, 0x73,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x12, 0x16, 0x0a,
0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f,
0x66, 0x66, 0x73, 0x65, 0x74, 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 (
@ -332,13 +523,16 @@ func file_component_common_proto_rawDescGZIP() []byte {
return file_component_common_proto_rawDescData
}
var file_component_common_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_component_common_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
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
(*MotorState)(nil), // 0: component.MotorState
(*RelayState)(nil), // 1: component.RelayState
(*SwitchState)(nil), // 2: component.SwitchState
(*FixedPositionTransform)(nil), // 3: component.FixedPositionTransform
(*BitState)(nil), // 4: component.BitState
(*Counter)(nil), // 5: component.Counter
(*LinkPosition)(nil), // 6: component.LinkPosition
(*CounterDown)(nil), // 7: component.CounterDown
}
var file_component_common_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@ -348,14 +542,14 @@ var file_component_common_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for field type_name
}
//func init() { file_component_common_proto_init() }
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 {
switch v := v.(*MotorState); i {
case 0:
return &v.state
case 1:
@ -367,7 +561,7 @@ func file_component_common_proto_init() {
}
}
file_component_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FixedPositionTransform); i {
switch v := v.(*RelayState); i {
case 0:
return &v.state
case 1:
@ -379,7 +573,7 @@ func file_component_common_proto_init() {
}
}
file_component_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BitState); i {
switch v := v.(*SwitchState); i {
case 0:
return &v.state
case 1:
@ -391,7 +585,7 @@ func file_component_common_proto_init() {
}
}
file_component_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Counter); i {
switch v := v.(*FixedPositionTransform); i {
case 0:
return &v.state
case 1:
@ -403,6 +597,42 @@ func file_component_common_proto_init() {
}
}
file_component_common_proto_msgTypes[4].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[5].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[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinkPosition); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_component_common_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CounterDown); i {
case 0:
return &v.state
@ -421,7 +651,7 @@ func file_component_common_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_component_common_proto_rawDesc,
NumEnums: 0,
NumMessages: 5,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -0,0 +1,144 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.31.0
// protoc v4.23.1
// source: component/equipment.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 RelayFaultForce struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Q bool `protobuf:"varint,1,opt,name=q,proto3" json:"q,omitempty"` // 是否强制到前接点(吸起)位置
}
func (x *RelayFaultForce) Reset() {
*x = RelayFaultForce{}
if protoimpl.UnsafeEnabled {
mi := &file_component_equipment_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RelayFaultForce) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RelayFaultForce) ProtoMessage() {}
func (x *RelayFaultForce) ProtoReflect() protoreflect.Message {
mi := &file_component_equipment_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 RelayFaultForce.ProtoReflect.Descriptor instead.
func (*RelayFaultForce) Descriptor() ([]byte, []int) {
return file_component_equipment_proto_rawDescGZIP(), []int{0}
}
func (x *RelayFaultForce) GetQ() bool {
if x != nil {
return x.Q
}
return false
}
var File_component_equipment_proto protoreflect.FileDescriptor
var file_component_equipment_proto_rawDesc = []byte{
0x0a, 0x19, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d,
0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x22, 0x1f, 0x0a, 0x0f, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x46,
0x61, 0x75, 0x6c, 0x74, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x71, 0x18, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x01, 0x71, 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_equipment_proto_rawDescOnce sync.Once
file_component_equipment_proto_rawDescData = file_component_equipment_proto_rawDesc
)
func file_component_equipment_proto_rawDescGZIP() []byte {
file_component_equipment_proto_rawDescOnce.Do(func() {
file_component_equipment_proto_rawDescData = protoimpl.X.CompressGZIP(file_component_equipment_proto_rawDescData)
})
return file_component_equipment_proto_rawDescData
}
var file_component_equipment_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_component_equipment_proto_goTypes = []interface{}{
(*RelayFaultForce)(nil), // 0: component.RelayFaultForce
}
var file_component_equipment_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_equipment_proto_init() }
func file_component_equipment_proto_init() {
if File_component_equipment_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_component_equipment_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RelayFaultForce); 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_equipment_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_component_equipment_proto_goTypes,
DependencyIndexes: file_component_equipment_proto_depIdxs,
MessageInfos: file_component_equipment_proto_msgTypes,
}.Build()
File_component_equipment_proto = out.File
file_component_equipment_proto_rawDesc = nil
file_component_equipment_proto_goTypes = nil
file_component_equipment_proto_depIdxs = nil
}

View File

@ -1,155 +0,0 @@
// 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_proto
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 CiQcState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// 驱动bit表
Qbs []byte `protobuf:"bytes,1,opt,name=qbs,proto3" json:"qbs,omitempty"`
// 采集bit表
Cbs []byte `protobuf:"bytes,2,opt,name=cbs,proto3" json:"cbs,omitempty"`
}
func (x *CiQcState) Reset() {
*x = CiQcState{}
if protoimpl.UnsafeEnabled {
mi := &file_component_ci_proto_msgTypes[0]
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[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 CiQcState.ProtoReflect.Descriptor instead.
func (*CiQcState) Descriptor() ([]byte, []int) {
return file_component_ci_proto_rawDescGZIP(), []int{0}
}
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
}
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,
0x2f, 0x0a, 0x09, 0x43, 0x69, 0x51, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03,
0x71, 0x62, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x71, 0x62, 0x73, 0x12, 0x10,
0x0a, 0x03, 0x63, 0x62, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x63, 0x62, 0x73,
0x42, 0x1d, 0x5a, 0x1b, 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f,
0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_component_ci_proto_goTypes = []interface{}{
(*CiQcState)(nil), // 0: component.CiQcState
}
var file_component_ci_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_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.(*CiQcState); 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: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_component_ci_proto_goTypes,
DependencyIndexes: file_component_ci_proto_depIdxs,
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
}

View File

@ -1,436 +0,0 @@
// 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_proto
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 TwoPositionTransform 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 *TwoPositionTransform) Reset() {
*x = TwoPositionTransform{}
if protoimpl.UnsafeEnabled {
mi := &file_component_common_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TwoPositionTransform) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TwoPositionTransform) ProtoMessage() {}
func (x *TwoPositionTransform) 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 TwoPositionTransform.ProtoReflect.Descriptor instead.
func (*TwoPositionTransform) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{0}
}
func (x *TwoPositionTransform) GetPos() int32 {
if x != nil {
return x.Pos
}
return 0
}
func (x *TwoPositionTransform) 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[1]
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[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 BitState.ProtoReflect.Descriptor instead.
func (*BitState) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{1}
}
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[2]
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[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 Counter.ProtoReflect.Descriptor instead.
func (*Counter) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{2}
}
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[3]
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[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 CounterDown.ProtoReflect.Descriptor instead.
func (*CounterDown) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{3}
}
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
}
// Link位置
type LinkPosition struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Link的ID
LinkId string `protobuf:"bytes,1,opt,name=linkId,proto3" json:"linkId,omitempty"`
// Link的偏移量
Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"`
}
func (x *LinkPosition) Reset() {
*x = LinkPosition{}
if protoimpl.UnsafeEnabled {
mi := &file_component_common_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LinkPosition) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LinkPosition) ProtoMessage() {}
func (x *LinkPosition) 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 LinkPosition.ProtoReflect.Descriptor instead.
func (*LinkPosition) Descriptor() ([]byte, []int) {
return file_component_common_proto_rawDescGZIP(), []int{4}
}
func (x *LinkPosition) GetLinkId() string {
if x != nil {
return x.LinkId
}
return ""
}
func (x *LinkPosition) GetOffset() int64 {
if x != nil {
return x.Offset
}
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, 0x3e, 0x0a, 0x14, 0x54, 0x77, 0x6f, 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, 0x22, 0x3e, 0x0a, 0x0c, 0x4c, 0x69, 0x6e, 0x6b, 0x50,
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x69, 0x6e, 0x6b, 0x49, 0x64, 0x12,
0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x1d, 0x5a, 0x1b, 0x2e, 0x2f, 0x63, 0x6f, 0x6d,
0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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{}{
(*TwoPositionTransform)(nil), // 0: component.TwoPositionTransform
(*BitState)(nil), // 1: component.BitState
(*Counter)(nil), // 2: component.Counter
(*CounterDown)(nil), // 3: component.CounterDown
(*LinkPosition)(nil), // 4: component.LinkPosition
}
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.(*TwoPositionTransform); 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.(*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[2].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[3].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
}
}
file_component_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LinkPosition); 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
}

20
component/equipment.go Normal file
View File

@ -0,0 +1,20 @@
package component
import (
"unsafe"
"joylink.club/ecs"
"joylink.club/rtsssimulation/component/component_data"
)
var (
RelayFaultForceType = ecs.NewComponentType[component_data.RelayFaultForce]()
)
func AddOrUpdateRelayFaultForce(entry *ecs.Entry, q bool) {
if entry.HasComponent(RelayFaultForceType) {
entry.SetComponent(RelayFaultForceType, unsafe.Pointer(&component_data.RelayFaultForce{Q: q}))
} else {
entry.AddComponent(RelayFaultForceType, unsafe.Pointer(&component_data.RelayFaultForce{Q: q}))
}
}

View File

@ -9,8 +9,4 @@ type AirConditioning struct {
var (
AirConditioningType = ecs.NewComponentType[AirConditioning]() //空调
CombinationAirConditionerTag = ecs.NewTag() //组合式空调(变频空调)
AirConditioningGroupTag = ecs.NewTag() //空调群控系统
AirConditionerTag = ecs.NewTag() //空调器
)

View File

@ -9,6 +9,4 @@ type AirPavilion struct {
var (
AirPavilionType = ecs.NewComponentType[AirPavilion]() //风亭
ExhaustPavilionTag = ecs.NewTag() //排风亭
AirSupplyPavilionTag = ecs.NewTag() //送风亭
)

View File

@ -118,7 +118,6 @@ var (
PipeType = ecs.NewComponentType[Pipe]() //电线
PipeElectricityType = ecs.NewComponentType[PipeElectricity]() //电线电力
PipeFluidType = ecs.NewComponentType[PipeFluid]() //管线流体
ElectricitySourceType = ecs.NewComponentType[ElectricitySource]() //电源
)

View File

@ -3,7 +3,7 @@ package entity
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/component/component_data"
"joylink.club/rtsssimulation/consts"
"joylink.club/rtsssimulation/repository/model/proto"
)
@ -34,19 +34,12 @@ func NewNetworkSwitchEntity(w ecs.World, id string) *ecs.Entry {
}
// NewAirPavilionEntity 创建风亭实体
func NewAirPavilionEntity(w ecs.World, id string, apType proto.AirPavilion_Type) *ecs.Entry {
func NewAirPavilionEntity(w ecs.World, id string) *ecs.Entry {
wd := GetWorldData(w)
e, ok := wd.EntityMap[id]
if !ok {
e = w.Entry(w.Create(component.UidType, component.AirPavilionType))
//
switch apType {
case proto.AirPavilion_ExhaustPavilion:
e.AddComponent(component.ExhaustPavilionTag)
case proto.AirPavilion_AirSupplyPavilion:
e.AddComponent(component.AirSupplyPavilionTag)
}
//
component.UidType.SetValue(e, component.Uid{Id: id})
component.AirPavilionType.Set(e, &component.AirPavilion{Normal: true})
wd.EntityMap[id] = e
@ -62,7 +55,7 @@ func NewValveEntity(w ecs.World, id string, valveType proto.Valve_Type) *ecs.Ent
e = w.Entry(w.Create(component.UidType, component.ValveType, component.ValveControllerType, component.FixedPositionTransformType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
//默认全关位置
component.FixedPositionTransformType.Set(e, &component.FixedPositionTransform{TwoPositionTransform: component_proto.TwoPositionTransform{Pos: consts.TwoPosMin}})
component.FixedPositionTransformType.Set(e, &component.FixedPositionTransform{FixedPositionTransform: component_data.FixedPositionTransform{Pos: consts.TwoPosMin}})
component.ValveControllerType.Set(e, &component.ValveController{TargetOpenRate: 0})
//
switch valveType {
@ -93,15 +86,24 @@ func NewGasMixingChamberEntity(w ecs.World, id string) *ecs.Entry {
return e
}
// NewCombinationAirConditionerEntity 创建组合式空调实体
// NewCombinationAirConditionerEntity 创建组合式空调(变频)实体
func NewCombinationAirConditionerEntity(w ecs.World, id string) *ecs.Entry {
return newAirConditioningEntity(w, id, component.CombinationAirConditionerTag)
}
func newAirConditioningEntity(w ecs.World, id string, tag *ecs.ComponentType[struct{}]) *ecs.Entry {
wd := GetWorldData(w)
e, ok := wd.EntityMap[id]
if !ok {
e = w.Entry(w.Create(component.UidType, component.MotorType, component.AirConditioningType, component.DeviceExceptionType, tag))
e = w.Entry(w.Create(component.UidType, component.MotorType, component.MotorFcType, component.FluidDriverType, component.AirConditioningType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}
// NewAirConditionerEntity 创建空调实体
func NewAirConditionerEntity(w ecs.World, id string) *ecs.Entry {
wd := GetWorldData(w)
e, ok := wd.EntityMap[id]
if !ok {
e = w.Entry(w.Create(component.UidType, component.MotorType, component.AirConditioningType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}

View File

@ -57,7 +57,7 @@ func LoadIscs(w ecs.World) error {
}
//风亭(排风亭、送风亭)
for _, ap := range data.Repo.AirPavilionMap {
NewAirPavilionEntity(w, ap.Id(), ap.PavilionType)
NewAirPavilionEntity(w, ap.Id())
}
//阀门
for _, valve := range data.Repo.ValveMap {

View File

@ -66,3 +66,31 @@ func DriveRelayDown(w ecs.World, id string) error {
})
return result.Err
}
// 设置继电器强制故障
func SetRelayFaultForce(w ecs.World, id string, q bool) error {
return updateRelayFault(w, id, func(entry *ecs.Entry) {
component.AddOrUpdateRelayFaultForce(entry, q)
})
}
// 取消继电器强制故障
func CancelRelayFaultForce(w ecs.World, id string) error {
return updateRelayFault(w, id, func(entry *ecs.Entry) {
entry.RemoveComponent(component.RelayFaultForceType)
})
}
func updateRelayFault(w ecs.World, id string, faultHandle func(entry *ecs.Entry)) error {
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
wd := entity.GetWorldData(w)
entry, ok := wd.EntityMap[id]
if ok {
faultHandle(entry)
} else {
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的继电器", id))
}
return ecs.NewOkEmptyResult()
})
return result.Err
}

View File

@ -63,7 +63,7 @@ message CiPointsState {
bool singleLock = 10;
}
message Signal {
message CiSignal {
//
enum Aspect {
//
@ -84,7 +84,7 @@ message Signal {
//
message CiSignalState {
//
Signal.Aspect aspect = 1;
CiSignal.Aspect aspect = 1;
// ()
bool logic = 2;
//

View File

@ -0,0 +1,9 @@
syntax = "proto3";
package component;
option go_package = "./component/component_data";
// ()
message RelayFaultForce {
bool q = 1; // ()
}

View File

@ -15,7 +15,7 @@ type Repository struct {
checkPointMap map[string]*CheckPoint
turnoutMap map[string]*Turnout
signalMap map[string]*Signal
transponderMap map[string]*Transponder
responderMap map[string]*Transponder
slopeMap map[string]*Slope
sectionalCurvatureMap map[string]*SectionalCurvature
kilometerConvertMap map[string]*proto.KilometerConvert
@ -62,7 +62,7 @@ func newRepository(id string, version string) *Repository {
checkPointMap: make(map[string]*CheckPoint),
turnoutMap: make(map[string]*Turnout),
signalMap: make(map[string]*Signal),
transponderMap: make(map[string]*Transponder),
responderMap: make(map[string]*Transponder),
slopeMap: make(map[string]*Slope),
sectionalCurvatureMap: make(map[string]*SectionalCurvature),
kilometerConvertMap: make(map[string]*proto.KilometerConvert),
@ -119,7 +119,7 @@ func (repo *Repository) FindById(id string) Identity {
if md, ok := repo.checkPointMap[id]; ok {
return md
}
if md, ok := repo.transponderMap[id]; ok {
if md, ok := repo.responderMap[id]; ok {
return md
}
if md, ok := repo.stationMap[id]; ok {
@ -225,16 +225,16 @@ func (repo *Repository) SignalList() []*Signal {
}
return list
}
func (repo *Repository) TransponderList() []*Transponder {
func (repo *Repository) ResponderList() []*Transponder {
var list []*Transponder
for _, model := range repo.transponderMap {
for _, model := range repo.responderMap {
list = append(list, model)
}
return list
}
func (repo *Repository) ResponderListByLink(linkId string) []*Transponder {
var list []*Transponder
for _, model := range repo.transponderMap {
for _, model := range repo.responderMap {
if model.linkPosition.link.Id() == linkId {
list = append(list, model)
}
@ -336,7 +336,7 @@ func (repo *Repository) FindModel(deviceId string, deviceType proto.DeviceType)
case proto.DeviceType_DeviceType_Signal:
return repo.signalMap[deviceId], nil
case proto.DeviceType_DeviceType_Transponder:
return repo.transponderMap[deviceId], nil
return repo.responderMap[deviceId], nil
case proto.DeviceType_DeviceType_Slope:
return repo.slopeMap[deviceId], nil
case proto.DeviceType_DeviceType_SectionalCurvature:
@ -396,7 +396,7 @@ func (repo *Repository) FindLink(id string) *Link {
return repo.linkMap[id]
}
func (repo *Repository) FindTransponder(id string) *Transponder {
return repo.transponderMap[id]
return repo.responderMap[id]
}
func (repo *Repository) FindTurnout(id string) *Turnout {
return repo.turnoutMap[id]
@ -419,7 +419,7 @@ func (repo *Repository) FindPsd(id string) *Psd {
return repo.psdMap[id]
}
func (repo *Repository) FindPlatform(id string) *Platform {
func (repo *Repository) FindPlatfrom(id string) *Platform {
return repo.platformMap[id]
}
@ -499,7 +499,7 @@ func (repo *Repository) generateCoordinateInfo(coordinateSystem string) error {
return nil
}
func (repo *Repository) GetCoordinateInfo() *MapCoordinate {
func (repo Repository) GetCoordinateInfo() *MapCoordinate {
return repo.coordinate
}

View File

@ -85,7 +85,7 @@ func buildModels(source *proto.Repository, repository *Repository) error {
}
for _, protoData := range source.Transponders {
m := NewTransponder(protoData.Id, protoData.Km, protoData.FixedTelegram, protoData.Type)
repository.transponderMap[m.Id()] = m
repository.responderMap[m.Id()] = m
}
for _, protoData := range source.Slopes {
m := NewSlope(protoData.Id, protoData.Kms, protoData.Degree)
@ -346,7 +346,7 @@ func buildCheckPointRelationShip(source *proto.Repository, repo *Repository) err
func buildResponderRelationShip(source *proto.Repository, repository *Repository) error {
for _, protoData := range source.Transponders {
responder := repository.transponderMap[protoData.Id]
responder := repository.responderMap[protoData.Id]
//应答器和区段相互关联
if protoData.SectionId != "" {
interrelateResponderAndPhysicalSection(responder, repository.physicalSectionMap[protoData.SectionId])

View File

@ -24,6 +24,10 @@ func (rs *RelaySys) Update(w ecs.World) {
// 查询实体是哪种继电器类型,根据继电器类型处理继电器吸起落下逻辑(暂时先简化直接处理)
rd := component.RelayDriveType.Get(entry)
state := component.BitStateType.Get(entry)
if entry.HasComponent(component.RelayFaultForceType) {
state.Val = component.RelayFaultForceType.Get(entry).Q
return
}
if entry.HasComponent(component.WjRelayTag) { // 无极继电器
if rd.Td && !state.Val { // 通电吸起
state.Val = true

View File

@ -22,5 +22,10 @@ func (s *AirConditionerSystem) Update(w ecs.World) {
air := component.AirConditioningType.Get(entry)
//
air.Running = motor.Speed > 0
//
if entry.HasComponent(component.FluidDriverType) {
fd := component.FluidDriverType.Get(entry)
fd.On = motor.Speed > 0
}
})
}

View File

@ -13,16 +13,16 @@ import (
// FluidDriverSystem 流体驱动系统
// 实现流体在设备、管线中流动
// 流体驱动源(风机、送风亭、泵)
// 流体驱动源(风机、泵、组合式空调)
type FluidDriverSystem struct {
query *ecs.Query //流体驱动源
queryFluidDriver *ecs.Query //流体驱动源
drivePathMap map[string][]*SearchedPath //key pipePortId,value 驱动源驱动流体的路径
queryFluidPipe *ecs.Query
}
func NewFluidDriverSystem() *FluidDriverSystem {
return &FluidDriverSystem{
query: ecs.NewQuery(filter.Contains(component.UidType, component.FluidDriverType)),
queryFluidDriver: ecs.NewQuery(filter.Contains(component.UidType, component.FluidDriverType)),
queryFluidPipe: ecs.NewQuery(filter.Contains(component.UidType, component.PipeFluidType)),
}
}
@ -38,7 +38,9 @@ func (s *FluidDriverSystem) findFluidPath(fromDevice repository.Identity, fromDe
return sp
}
func (s *FluidDriverSystem) Update(w ecs.World) {
s.queryFluidDriver.Each(w, func(entry *ecs.Entry) {
//fdId := component.UidType.Get(entry).Id
})
}
// 判断路径是否畅通
@ -110,7 +112,7 @@ func newFluidDriverPathSearcher(fromDevice repository.Identity, fromDevicePortPi
func (s *fluidDriverPathSearcher) search() []*SearchedPath {
var rt []*SearchedPath
if !s.exclude(s.fromDevicePortPipe.Device().Id()) {
searchContext := &fluidPath{}
searchContext := &fluidPath{viaPipeFittings: make(map[string]string)}
searchContext.addPipe(s.fromDevicePortPipe)
s.doSearch(searchContext)
} else {
@ -149,13 +151,14 @@ func (s *fluidDriverPathSearcher) addSearchedPath(searchContext *fluidPath) {
s.searchedPaths = append(s.searchedPaths, searchContext)
}
// 递归搜索
// 搜索
func (s *fluidDriverPathSearcher) doSearch(searchContext *fluidPath) {
nextViaPipes := searchContext.nextViaPathPipes()
nextViaPipes, end := searchContext.nextViaPathPipes()
lenNextPipes := len(nextViaPipes)
if lenNextPipes == 0 {
if end {
s.addSearchedPath(searchContext)
} else if lenNextPipes == 1 {
} else {
if lenNextPipes == 1 {
if !searchContext.viaPipe(nextViaPipes[0].Device().Id()) && !s.exclude(nextViaPipes[0].Device().Id()) {
searchContext.addPipe(nextViaPipes[0])
s.doSearch(searchContext)
@ -174,25 +177,41 @@ func (s *fluidDriverPathSearcher) doSearch(searchContext *fluidPath) {
s.doSearch(cp)
}
}
}
}
func (p *fluidPath) nextViaPathPipes() []repository.PipePort {
// 从当前管线找下一个管线
// 泵、风机、空调 提供驱动力,承接进出
// 返回bool : true-搜索达终点
func (p *fluidPath) nextViaPathPipes() ([]repository.PipePort, bool) {
nextDevice := p.nextDevice()
//
switch nextDevice.Type() {
case proto.DeviceType_DeviceType_PipeFitting:
return p.nextDeviceViaPipes(nextDevice.(*repository.PipeFitting).Ports(), p.curPipe)
{
if _, has := p.viaPipeFittings[nextDevice.Id()]; has { //排除已经经过的管件的路径
return nil, false
} else {
p.viaPipeFittings[nextDevice.Id()] = nextDevice.Id()
return p.nextDeviceViaPipes(nextDevice.(*repository.PipeFitting).Ports(), p.curPipe), false
}
}
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)
return p.nextDeviceViaPipes(nextDevice.(*repository.Valve).Ports(), p.curPipe), false
case proto.DeviceType_DeviceType_GasMixingChamber: //静压箱
return p.nextGasMixingChamberViaPipes(nextDevice.(*repository.GasMixingChamber), p.curPipe), false
case proto.DeviceType_DeviceType_AirPurificationDevice: //净化装置
return p.nextDeviceViaPipes(nextDevice.(*repository.AirPurificationDevice).Ports(), p.curPipe), false
case proto.DeviceType_DeviceType_Environment: //环境
fallthrough
case proto.DeviceType_DeviceType_AirPavilion: //风亭
fallthrough
case proto.DeviceType_DeviceType_CombinationAirConditioner: //组合式空调
return nil, true //路径搜索终点
default:
slog.Warn("管线路径中的设备[%d]无法处理", nextDevice.Type())
}
return nil
return nil, false //排除(舍弃)该路径搜索
}
///////////////////////////////////////////////////////////////////////////////////////////
@ -242,6 +261,7 @@ func (p *fluidPath) nextGasMixingChamberViaPipes(nextDevice *repository.GasMixin
type fluidPath struct {
curPipe repository.PipePort //路径中当前有向管线
viaPipes []repository.PipePort //路径所经过的有向管线
viaPipeFittings map[string]string //经过的管件用于排除闭环路径key和value均为deviceId
}
func (p *fluidPath) addPipe(viaPipe repository.PipePort) {
@ -257,8 +277,11 @@ func (p *fluidPath) viaPipe(pipeId string) bool {
return false
}
func (p *fluidPath) clone() *fluidPath {
cp := &fluidPath{viaPipes: make([]repository.PipePort, 0, len(p.viaPipes)), curPipe: p.curPipe}
cp := &fluidPath{viaPipes: make([]repository.PipePort, 0, len(p.viaPipes)), curPipe: p.curPipe, viaPipeFittings: make(map[string]string)}
copy(cp.viaPipes, p.viaPipes)
for k, v := range p.viaPipeFittings {
cp.viaPipeFittings[k] = v
}
return cp
}
func (p *fluidPath) nextDevice() repository.Identity {