继电器强制前/后位及取消强制功能实现

This commit is contained in:
walker 2024-01-10 10:57:47 +08:00
parent 9b16941d2f
commit a9ea711f00
14 changed files with 513 additions and 670 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"
)
@ -12,7 +11,7 @@ var (
// 固定位置转换组件类型
FixedPositionTransformType = ecs.NewComponentType[FixedPositionTransform]()
// 电机状态组件类型
MotorStateType = ecs.NewComponentType[component_data.Motor]()
MotorStateType = ecs.NewComponentType[component_data.MotorState]()
BitStateType = ecs.NewComponentType[BitState]()
)
@ -28,7 +27,7 @@ type Uid struct {
// }
type FixedPositionTransform struct {
component_proto.TwoPositionTransform
component_data.FixedPositionTransform
}
// 当前位置百分比值

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 {
@ -251,7 +373,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[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -264,7 +386,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[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -277,7 +399,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{6}
}
func (x *CounterDown) GetVal() int32 {
@ -299,25 +421,32 @@ 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, 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 +461,15 @@ 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, 7)
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
(*CounterDown)(nil), // 6: component.CounterDown
}
var file_component_common_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@ -348,14 +479,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 +498,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 +510,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 +522,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 +534,30 @@ 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.(*CounterDown); i {
case 0:
return &v.state
@ -421,7 +576,7 @@ func file_component_common_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_component_common_proto_rawDesc,
NumEnums: 0,
NumMessages: 5,
NumMessages: 7,
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,361 +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
}
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, 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, 4)
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
}
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
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_component_common_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
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

@ -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"
)
@ -62,7 +62,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 {

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
}

@ -1 +1 @@
Subproject commit f25027e20535e0ae4940a34b80276c56597517fb
Subproject commit 2757e2c4e06b03afab94727cee9d948dae6d1754

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

@ -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