Merge remote-tracking branch 'origin/master'
# Conflicts: # jl-ecs-go # proto/src/model.proto # repository/model/proto/model.pb.go
This commit is contained in:
commit
fe3ce44bdc
@ -26,8 +26,8 @@ type TwoPositionTransform struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
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, 10000],两位小数
|
||||||
Speed int32 `protobuf:"varint,2,opt,name=Speed,proto3" json:"Speed,omitempty"`
|
Speed int32 `protobuf:"varint,2,opt,name=speed,proto3" json:"speed,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *TwoPositionTransform) Reset() {
|
func (x *TwoPositionTransform) Reset() {
|
||||||
@ -82,7 +82,7 @@ type BitState struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Val bool `protobuf:"varint,1,opt,name=Val,proto3" json:"Val,omitempty"`
|
Val bool `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BitState) Reset() {
|
func (x *BitState) Reset() {
|
||||||
@ -130,8 +130,8 @@ type Counter struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Val int32 `protobuf:"varint,1,opt,name=Val,proto3" json:"Val,omitempty"`
|
Val int32 `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"`
|
||||||
Step int32 `protobuf:"varint,2,opt,name=Step,proto3" json:"Step,omitempty"`
|
Step int32 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Counter) Reset() {
|
func (x *Counter) Reset() {
|
||||||
@ -186,8 +186,8 @@ type CounterDown struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Val int32 `protobuf:"varint,1,opt,name=Val,proto3" json:"Val,omitempty"`
|
Val int32 `protobuf:"varint,1,opt,name=val,proto3" json:"val,omitempty"`
|
||||||
Step int32 `protobuf:"varint,2,opt,name=Step,proto3" json:"Step,omitempty"`
|
Step int32 `protobuf:"varint,2,opt,name=step,proto3" json:"step,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CounterDown) Reset() {
|
func (x *CounterDown) Reset() {
|
||||||
@ -242,18 +242,18 @@ var file_component_common_proto_rawDesc = []byte{
|
|||||||
0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d,
|
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,
|
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,
|
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, 0x50,
|
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, 0x50, 0x6f, 0x73, 0x12, 0x14, 0x0a,
|
0x6f, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x70, 0x6f, 0x73, 0x12, 0x14, 0x0a,
|
||||||
0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x53, 0x70,
|
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,
|
0x65, 0x65, 0x64, 0x22, 0x1c, 0x0a, 0x08, 0x42, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
|
||||||
0x10, 0x0a, 0x03, 0x56, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x56, 0x61,
|
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,
|
0x6c, 0x22, 0x2f, 0x0a, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03,
|
||||||
0x56, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x56, 0x61, 0x6c, 0x12, 0x12,
|
0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x12, 0x12,
|
||||||
0x0a, 0x04, 0x53, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x74,
|
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,
|
0x65, 0x70, 0x22, 0x33, 0x0a, 0x0b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x44, 0x6f, 0x77,
|
||||||
0x6e, 0x12, 0x10, 0x0a, 0x03, 0x56, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03,
|
0x6e, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03,
|
||||||
0x56, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28,
|
0x76, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x05, 0x52, 0x04, 0x53, 0x74, 0x65, 0x70, 0x42, 0x1d, 0x5a, 0x1b, 0x2e, 0x2f, 0x63, 0x6f, 0x6d,
|
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,
|
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,
|
0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
513
component/component_proto/turnout.pb.go
Normal file
513
component/component_proto/turnout.pb.go
Normal file
@ -0,0 +1,513 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.31.0
|
||||||
|
// protoc v4.23.1
|
||||||
|
// source: component/turnout.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 Turnout_Fault int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
// 失表
|
||||||
|
Turnout_SB Turnout_Fault = 0
|
||||||
|
// 定位失表
|
||||||
|
Turnout_DWSB Turnout_Fault = 1
|
||||||
|
// 反位失表
|
||||||
|
Turnout_FWSB Turnout_Fault = 2
|
||||||
|
// 挤岔
|
||||||
|
Turnout_JC Turnout_Fault = 3
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for Turnout_Fault.
|
||||||
|
var (
|
||||||
|
Turnout_Fault_name = map[int32]string{
|
||||||
|
0: "SB",
|
||||||
|
1: "DWSB",
|
||||||
|
2: "FWSB",
|
||||||
|
}
|
||||||
|
Turnout_Fault_value = map[string]int32{
|
||||||
|
"SB": 0,
|
||||||
|
"DWSB": 1,
|
||||||
|
"FWSB": 2,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x Turnout_Fault) Enum() *Turnout_Fault {
|
||||||
|
p := new(Turnout_Fault)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Turnout_Fault) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Turnout_Fault) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_component_turnout_proto_enumTypes[0].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (Turnout_Fault) Type() protoreflect.EnumType {
|
||||||
|
return &file_component_turnout_proto_enumTypes[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Turnout_Fault) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Turnout_Fault.Descriptor instead.
|
||||||
|
func (Turnout_Fault) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_component_turnout_proto_rawDescGZIP(), []int{1, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 道岔位置状态表示组件
|
||||||
|
type TurnoutPosition struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
// 是否在定位(实际位置)
|
||||||
|
Dw bool `protobuf:"varint,1,opt,name=dw,proto3" json:"dw,omitempty"`
|
||||||
|
// 是否在反位(实际位置)
|
||||||
|
Fw bool `protobuf:"varint,2,opt,name=fw,proto3" json:"fw,omitempty"`
|
||||||
|
// 定表
|
||||||
|
Db bool `protobuf:"varint,3,opt,name=db,proto3" json:"db,omitempty"`
|
||||||
|
// 反表
|
||||||
|
Fb bool `protobuf:"varint,4,opt,name=fb,proto3" json:"fb,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutPosition) Reset() {
|
||||||
|
*x = TurnoutPosition{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_component_turnout_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutPosition) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*TurnoutPosition) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *TurnoutPosition) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_component_turnout_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 TurnoutPosition.ProtoReflect.Descriptor instead.
|
||||||
|
func (*TurnoutPosition) Descriptor() ([]byte, []int) {
|
||||||
|
return file_component_turnout_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutPosition) GetDw() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Dw
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutPosition) GetFw() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Fw
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutPosition) GetDb() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Db
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutPosition) GetFb() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Fb
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 道岔故障
|
||||||
|
type Turnout struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Fault []Turnout_Fault `protobuf:"varint,1,rep,packed,name=fault,proto3,enum=component.Turnout_Fault" json:"fault,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Turnout) Reset() {
|
||||||
|
*x = Turnout{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_component_turnout_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Turnout) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Turnout) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Turnout) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_component_turnout_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 Turnout.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Turnout) Descriptor() ([]byte, []int) {
|
||||||
|
return file_component_turnout_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Turnout) GetFault() []Turnout_Fault {
|
||||||
|
if x != nil {
|
||||||
|
return x.Fault
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 道岔失表故障
|
||||||
|
type TurnoutFaultSB struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultSB) Reset() {
|
||||||
|
*x = TurnoutFaultSB{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_component_turnout_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultSB) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*TurnoutFaultSB) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultSB) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_component_turnout_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 TurnoutFaultSB.ProtoReflect.Descriptor instead.
|
||||||
|
func (*TurnoutFaultSB) Descriptor() ([]byte, []int) {
|
||||||
|
return file_component_turnout_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 道岔定位失表故障
|
||||||
|
type TurnoutFaultDwsb struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultDwsb) Reset() {
|
||||||
|
*x = TurnoutFaultDwsb{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_component_turnout_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultDwsb) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*TurnoutFaultDwsb) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultDwsb) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_component_turnout_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 TurnoutFaultDwsb.ProtoReflect.Descriptor instead.
|
||||||
|
func (*TurnoutFaultDwsb) Descriptor() ([]byte, []int) {
|
||||||
|
return file_component_turnout_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 道岔反位失表故障
|
||||||
|
type TurnoutFaultFwsb struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultFwsb) Reset() {
|
||||||
|
*x = TurnoutFaultFwsb{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_component_turnout_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultFwsb) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*TurnoutFaultFwsb) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultFwsb) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_component_turnout_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 TurnoutFaultFwsb.ProtoReflect.Descriptor instead.
|
||||||
|
func (*TurnoutFaultFwsb) Descriptor() ([]byte, []int) {
|
||||||
|
return file_component_turnout_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 道岔挤岔故障
|
||||||
|
type TurnoutFaultJc struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultJc) Reset() {
|
||||||
|
*x = TurnoutFaultJc{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_component_turnout_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultJc) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*TurnoutFaultJc) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *TurnoutFaultJc) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_component_turnout_proto_msgTypes[5]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use TurnoutFaultJc.ProtoReflect.Descriptor instead.
|
||||||
|
func (*TurnoutFaultJc) Descriptor() ([]byte, []int) {
|
||||||
|
return file_component_turnout_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_component_turnout_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_component_turnout_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x74, 0x75, 0x72, 0x6e,
|
||||||
|
0x6f, 0x75, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f,
|
||||||
|
0x6e, 0x65, 0x6e, 0x74, 0x22, 0x51, 0x0a, 0x0f, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50,
|
||||||
|
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x77, 0x18, 0x01, 0x20,
|
||||||
|
0x01, 0x28, 0x08, 0x52, 0x02, 0x64, 0x77, 0x12, 0x0e, 0x0a, 0x02, 0x66, 0x77, 0x18, 0x02, 0x20,
|
||||||
|
0x01, 0x28, 0x08, 0x52, 0x02, 0x66, 0x77, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x62, 0x18, 0x03, 0x20,
|
||||||
|
0x01, 0x28, 0x08, 0x52, 0x02, 0x64, 0x62, 0x12, 0x0e, 0x0a, 0x02, 0x66, 0x62, 0x18, 0x04, 0x20,
|
||||||
|
0x01, 0x28, 0x08, 0x52, 0x02, 0x66, 0x62, 0x22, 0x5e, 0x0a, 0x07, 0x54, 0x75, 0x72, 0x6e, 0x6f,
|
||||||
|
0x75, 0x74, 0x12, 0x2e, 0x0a, 0x05, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||||
|
0x0e, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x54, 0x75,
|
||||||
|
0x72, 0x6e, 0x6f, 0x75, 0x74, 0x2e, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x05, 0x66, 0x61, 0x75,
|
||||||
|
0x6c, 0x74, 0x22, 0x23, 0x0a, 0x05, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x06, 0x0a, 0x02, 0x53,
|
||||||
|
0x42, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x57, 0x53, 0x42, 0x10, 0x01, 0x12, 0x08, 0x0a,
|
||||||
|
0x04, 0x46, 0x57, 0x53, 0x42, 0x10, 0x02, 0x22, 0x10, 0x0a, 0x0e, 0x54, 0x75, 0x72, 0x6e, 0x6f,
|
||||||
|
0x75, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x53, 0x42, 0x22, 0x12, 0x0a, 0x10, 0x54, 0x75, 0x72,
|
||||||
|
0x6e, 0x6f, 0x75, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x44, 0x77, 0x73, 0x62, 0x22, 0x12, 0x0a,
|
||||||
|
0x10, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x46, 0x61, 0x75, 0x6c, 0x74, 0x46, 0x77, 0x73,
|
||||||
|
0x62, 0x22, 0x10, 0x0a, 0x0e, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x46, 0x61, 0x75, 0x6c,
|
||||||
|
0x74, 0x4a, 0x63, 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_turnout_proto_rawDescOnce sync.Once
|
||||||
|
file_component_turnout_proto_rawDescData = file_component_turnout_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_component_turnout_proto_rawDescGZIP() []byte {
|
||||||
|
file_component_turnout_proto_rawDescOnce.Do(func() {
|
||||||
|
file_component_turnout_proto_rawDescData = protoimpl.X.CompressGZIP(file_component_turnout_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_component_turnout_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_component_turnout_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
|
var file_component_turnout_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||||
|
var file_component_turnout_proto_goTypes = []interface{}{
|
||||||
|
(Turnout_Fault)(0), // 0: component.Turnout.Fault
|
||||||
|
(*TurnoutPosition)(nil), // 1: component.TurnoutPosition
|
||||||
|
(*Turnout)(nil), // 2: component.Turnout
|
||||||
|
(*TurnoutFaultSB)(nil), // 3: component.TurnoutFaultSB
|
||||||
|
(*TurnoutFaultDwsb)(nil), // 4: component.TurnoutFaultDwsb
|
||||||
|
(*TurnoutFaultFwsb)(nil), // 5: component.TurnoutFaultFwsb
|
||||||
|
(*TurnoutFaultJc)(nil), // 6: component.TurnoutFaultJc
|
||||||
|
}
|
||||||
|
var file_component_turnout_proto_depIdxs = []int32{
|
||||||
|
0, // 0: component.Turnout.fault:type_name -> component.Turnout.Fault
|
||||||
|
1, // [1:1] is the sub-list for method output_type
|
||||||
|
1, // [1:1] is the sub-list for method input_type
|
||||||
|
1, // [1:1] is the sub-list for extension type_name
|
||||||
|
1, // [1:1] is the sub-list for extension extendee
|
||||||
|
0, // [0:1] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_component_turnout_proto_init() }
|
||||||
|
func file_component_turnout_proto_init() {
|
||||||
|
if File_component_turnout_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_component_turnout_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*TurnoutPosition); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_component_turnout_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Turnout); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_component_turnout_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*TurnoutFaultSB); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_component_turnout_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*TurnoutFaultDwsb); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_component_turnout_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*TurnoutFaultFwsb); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_component_turnout_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*TurnoutFaultJc); 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_turnout_proto_rawDesc,
|
||||||
|
NumEnums: 1,
|
||||||
|
NumMessages: 6,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_component_turnout_proto_goTypes,
|
||||||
|
DependencyIndexes: file_component_turnout_proto_depIdxs,
|
||||||
|
EnumInfos: file_component_turnout_proto_enumTypes,
|
||||||
|
MessageInfos: file_component_turnout_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_component_turnout_proto = out.File
|
||||||
|
file_component_turnout_proto_rawDesc = nil
|
||||||
|
file_component_turnout_proto_goTypes = nil
|
||||||
|
file_component_turnout_proto_depIdxs = nil
|
||||||
|
}
|
@ -4,6 +4,10 @@ import "joylink.club/ecs"
|
|||||||
|
|
||||||
// 按钮标签
|
// 按钮标签
|
||||||
var (
|
var (
|
||||||
|
// IBP
|
||||||
|
IBP = ecs.NewTag()
|
||||||
|
// 未知按钮
|
||||||
|
UnknowBtn = ecs.NewTag()
|
||||||
// 非自复式按下接通式按钮
|
// 非自复式按下接通式按钮
|
||||||
NoResetPressBtn = ecs.NewTag()
|
NoResetPressBtn = ecs.NewTag()
|
||||||
// 非自复式拉起接通式按钮
|
// 非自复式拉起接通式按钮
|
||||||
@ -12,87 +16,88 @@ var (
|
|||||||
ResetPressBtn = ecs.NewTag()
|
ResetPressBtn = ecs.NewTag()
|
||||||
// 自复式拉起接通式按钮
|
// 自复式拉起接通式按钮
|
||||||
ResetUpBtn = ecs.NewTag()
|
ResetUpBtn = ecs.NewTag()
|
||||||
|
// 钥匙旋钮
|
||||||
|
KeyKnob = ecs.NewTag()
|
||||||
)
|
)
|
||||||
|
|
||||||
// 蜂鸣器驱动
|
// 蜂鸣器驱动
|
||||||
type FMQDrive struct {
|
type AlarmDrive struct {
|
||||||
Td bool
|
Td bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// 蜂鸣器驱动组件
|
// 蜂鸣器驱动组件
|
||||||
var FMQDriveType = ecs.NewComponentType[FMQDrive]()
|
var AlarmDriveType = ecs.NewComponentType[AlarmDrive]()
|
||||||
|
|
||||||
// SPK继电器控制电路
|
// SPK继电器控制电路
|
||||||
type SpkControlElectronic struct {
|
type SpkElectronic struct {
|
||||||
|
// 控制区
|
||||||
SPKSXPLA_BTN *ecs.Entry
|
SPKSXPLA_BTN *ecs.Entry
|
||||||
SPKSX1J_BTN *ecs.Entry
|
SPKSX1J_KEY *ecs.Entry
|
||||||
SPKSX3J_BTN *ecs.Entry
|
SPKSX3J_KEY *ecs.Entry
|
||||||
SPKSX1J *ecs.Entry
|
|
||||||
SPKSX3J *ecs.Entry
|
|
||||||
|
|
||||||
SPKSSPLA_BTN *ecs.Entry
|
SPKSSPLA_BTN *ecs.Entry
|
||||||
SPKSS2J_BTN *ecs.Entry
|
SPKSS2J_KEY *ecs.Entry
|
||||||
SPKSS4J_BTN *ecs.Entry
|
SPKSS4J_KEY *ecs.Entry
|
||||||
SPKSS2J *ecs.Entry
|
|
||||||
SPKSS4J *ecs.Entry
|
|
||||||
}
|
|
||||||
|
|
||||||
// SPK继电器元器件组件
|
|
||||||
var SpkControlElectronicType = ecs.NewComponentType[SpkControlElectronic]()
|
|
||||||
|
|
||||||
// SPK标识电路
|
|
||||||
type SpksStateElectronic struct {
|
|
||||||
SPKSX1J *ecs.Entry
|
|
||||||
SPKSX3J *ecs.Entry
|
|
||||||
SPKSS2J *ecs.Entry
|
|
||||||
SPKSS4J *ecs.Entry
|
|
||||||
|
|
||||||
|
// 表示区
|
||||||
|
SPKSX1J *ecs.Entry
|
||||||
|
SPKSX3J *ecs.Entry
|
||||||
|
SPKSS2J *ecs.Entry
|
||||||
|
SPKSS4J *ecs.Entry
|
||||||
SPKSXPLAJ *ecs.Entry
|
SPKSXPLAJ *ecs.Entry
|
||||||
SPKSSPLAJ *ecs.Entry
|
SPKSSPLAJ *ecs.Entry
|
||||||
|
|
||||||
SPKSX1D *ecs.Entry
|
SPKSX1D *ecs.Entry
|
||||||
SPKSX3D *ecs.Entry
|
SPKSX3D *ecs.Entry
|
||||||
SPKSS2D *ecs.Entry
|
SPKSS2D *ecs.Entry
|
||||||
SPKSS4D *ecs.Entry
|
SPKSS4D *ecs.Entry
|
||||||
SPKSXPLAD *ecs.Entry
|
SPKSXPLAD *ecs.Entry
|
||||||
SPKSSPLAD *ecs.Entry
|
SPKSSPLAD *ecs.Entry
|
||||||
|
SDA *ecs.Entry
|
||||||
SDA *ecs.Entry
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPK继电器元器件组件
|
// SPK继电器元器件组件
|
||||||
var SpksStateElectronicType = ecs.NewComponentType[SpksStateElectronic]()
|
var SpkElectronicType = ecs.NewComponentType[SpkElectronic]()
|
||||||
|
|
||||||
// EMP 控制电路
|
// SPK采集电路吸起、落下接通状态
|
||||||
type EmpControlElectronic struct {
|
type SpkCollectState struct {
|
||||||
|
SPKSX1J_XQ bool
|
||||||
|
SPKSX3J_XQ bool
|
||||||
|
SPKSS2J_XQ bool
|
||||||
|
SPKSS4J_XQ bool
|
||||||
|
SPKSXPLA_XQ bool
|
||||||
|
SPKSSPLA_XQ bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var SpkCollectStateType = ecs.NewComponentType[SpkCollectState]()
|
||||||
|
|
||||||
|
// EMP 电路
|
||||||
|
type EmpElectronic struct {
|
||||||
|
// 控制区
|
||||||
EMP1_BTN *ecs.Entry
|
EMP1_BTN *ecs.Entry
|
||||||
EMP3_BTN *ecs.Entry
|
EMP3_BTN *ecs.Entry
|
||||||
EMP5_BTN *ecs.Entry
|
EMP5_BTN *ecs.Entry
|
||||||
EMPX_BTN *ecs.Entry
|
EMPX_BTN *ecs.Entry
|
||||||
XEMPFA_BTN *ecs.Entry
|
XEMPFA_BTN *ecs.Entry
|
||||||
XEMPJ *ecs.Entry // 继电器
|
|
||||||
|
|
||||||
EMP2_BTN *ecs.Entry
|
EMP2_BTN *ecs.Entry
|
||||||
EMP4_BTN *ecs.Entry
|
EMP4_BTN *ecs.Entry
|
||||||
EMP6_BTN *ecs.Entry
|
EMP6_BTN *ecs.Entry
|
||||||
EMPS_BTN *ecs.Entry
|
EMPS_BTN *ecs.Entry
|
||||||
SEMPFA_BTN *ecs.Entry
|
SEMPFA_BTN *ecs.Entry
|
||||||
SEMPJ *ecs.Entry // 继电器
|
// 表示区
|
||||||
}
|
|
||||||
|
|
||||||
var EmpControlElectronicType = ecs.NewComponentType[EmpControlElectronic]()
|
|
||||||
|
|
||||||
// EMP 标识状态电路
|
|
||||||
type EmpStateElectronic struct {
|
|
||||||
XEMPJ *ecs.Entry // 继电器
|
XEMPJ *ecs.Entry // 继电器
|
||||||
XEMPD *ecs.Entry
|
XEMPD *ecs.Entry
|
||||||
|
|
||||||
SEMPJ *ecs.Entry // 继电器
|
SEMPJ *ecs.Entry // 继电器
|
||||||
SEMPD *ecs.Entry
|
SEMPD *ecs.Entry
|
||||||
|
SDA *ecs.Entry // 按钮
|
||||||
SDA *ecs.Entry // 按钮
|
QBA *ecs.Entry // 非自复位按钮
|
||||||
QBA *ecs.Entry // 非自复位按钮
|
Alarm *ecs.Entry // 蜂鸣器
|
||||||
FMQ *ecs.Entry // 蜂鸣器
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var EmpStateElectronicType = ecs.NewComponentType[EmpStateElectronic]()
|
var EmpElectronicType = ecs.NewComponentType[EmpElectronic]()
|
||||||
|
|
||||||
|
// EMP 采集电路吸起、落下接通状态
|
||||||
|
type EmpCollectState struct {
|
||||||
|
XEMPJ_XQ bool
|
||||||
|
SEMPJ_XQ bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var EmpCollectStateType = ecs.NewComponentType[EmpCollectState]()
|
||||||
|
@ -7,13 +7,17 @@ type LightDrive struct {
|
|||||||
Td bool
|
Td bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// 灯色标签
|
// DsTag 灯显示标签定义
|
||||||
|
type DsTag = ecs.IComponentType
|
||||||
|
|
||||||
|
// 灯标签
|
||||||
var (
|
var (
|
||||||
LdTag = ecs.NewTag() //绿
|
LdTag DsTag = ecs.NewTag() //绿
|
||||||
HdTag = ecs.NewTag() //红
|
HdTag = ecs.NewTag() //红
|
||||||
UdTag = ecs.NewTag() //黄
|
UdTag = ecs.NewTag() //黄
|
||||||
BdTag = ecs.NewTag() //白
|
BdTag = ecs.NewTag() //白
|
||||||
AdTag = ecs.NewTag() //蓝
|
AdTag = ecs.NewTag() //蓝
|
||||||
|
FdTag = ecs.NewTag() //封,封灯显示
|
||||||
)
|
)
|
||||||
|
|
||||||
// 组件
|
// 组件
|
||||||
|
@ -2,6 +2,25 @@ package component
|
|||||||
|
|
||||||
import "joylink.club/ecs"
|
import "joylink.club/ecs"
|
||||||
|
|
||||||
|
// SignalLights 信号机灯位列表
|
||||||
|
type SignalLights struct {
|
||||||
|
Lights []*ecs.Entry
|
||||||
|
}
|
||||||
|
|
||||||
|
var SignalLightsType = ecs.NewComponentType[SignalLights]()
|
||||||
|
|
||||||
|
// GetLightByTag 根据标签获取灯位列表中的某个灯
|
||||||
|
func (sl *SignalLights) GetLightByTag(dTag DsTag) *ecs.Entry {
|
||||||
|
for _, light := range sl.Lights {
|
||||||
|
if light.HasComponent(dTag) {
|
||||||
|
return light
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
// Signal2XH1Electronic 电路状态:**信号机2XH-1(红-绿) 出段(场)信号机 或 **出站区间阻挡信号机
|
// Signal2XH1Electronic 电路状态:**信号机2XH-1(红-绿) 出段(场)信号机 或 **出站区间阻挡信号机
|
||||||
type Signal2XH1Electronic struct {
|
type Signal2XH1Electronic struct {
|
||||||
// 点灯继电器,true-吸合,常态落下表示逻辑点灯
|
// 点灯继电器,true-吸合,常态落下表示逻辑点灯
|
||||||
@ -10,10 +29,6 @@ type Signal2XH1Electronic struct {
|
|||||||
Z2XH1_DJ *ecs.Entry
|
Z2XH1_DJ *ecs.Entry
|
||||||
//列车信号继电器,true-吸合
|
//列车信号继电器,true-吸合
|
||||||
Z2XH1_LXJ *ecs.Entry
|
Z2XH1_LXJ *ecs.Entry
|
||||||
//物理绿灯,true-亮
|
|
||||||
Z2XH1_L *ecs.Entry
|
|
||||||
// 物理红灯,true-亮
|
|
||||||
Z2XH1_H *ecs.Entry
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal2XH1Lsq 联锁驱
|
// Signal2XH1Lsq 联锁驱
|
||||||
@ -57,16 +72,40 @@ type Signal3XH1Electronic struct {
|
|||||||
Z3XH1_YXJ *ecs.Entry
|
Z3XH1_YXJ *ecs.Entry
|
||||||
//开通正线信号继电器,true-吸合
|
//开通正线信号继电器,true-吸合
|
||||||
Z3XH1_ZXJ *ecs.Entry
|
Z3XH1_ZXJ *ecs.Entry
|
||||||
// 物理黄灯,true-亮
|
}
|
||||||
Z3XH1_U *ecs.Entry
|
|
||||||
// 物理绿灯,true-亮
|
// Signal3XH1Lsq 联锁驱
|
||||||
Z3XH1_L *ecs.Entry
|
type Signal3XH1Lsq struct {
|
||||||
// 物理红灯,true-亮
|
//true-联锁施加励磁电流驱动继电器DDJ
|
||||||
Z3XH1_H *ecs.Entry
|
Z3XH1_DDJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器LXJ
|
||||||
|
Z3XH1_LXJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器LXJ
|
||||||
|
Z3XH1_ZXJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器LXJ
|
||||||
|
Z3XH1_YXJ_Q bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signal3XH1Lsc 联锁采
|
||||||
|
type Signal3XH1Lsc struct {
|
||||||
|
//true-继电器DJ吸起
|
||||||
|
Z3XH1_DJ_Xq bool
|
||||||
|
//true-继电器2DJ吸起
|
||||||
|
Z3XH1_2DJ_Xq bool
|
||||||
|
//true-继电器DDJ落下
|
||||||
|
Z3XH1_DDJ_Lx bool
|
||||||
|
//true-继电器LXJ吸起
|
||||||
|
Z3XH1_LXJ_Xq bool
|
||||||
|
//true-继电器ZXJ吸起
|
||||||
|
Z3XH1_ZXJ_Xq bool
|
||||||
|
//true-继电器YXJ吸起
|
||||||
|
Z3XH1_YXJ_Xq bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Signal3XH1ElectronicType = ecs.NewComponentType[Signal3XH1Electronic]()
|
Signal3XH1ElectronicType = ecs.NewComponentType[Signal3XH1Electronic]()
|
||||||
|
Signal3XH1LsqType = ecs.NewComponentType[Signal3XH1Lsq]()
|
||||||
|
Signal3XH1LscType = ecs.NewComponentType[Signal3XH1Lsc]()
|
||||||
)
|
)
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
@ -84,16 +123,36 @@ type Signal3XH2Electronic struct {
|
|||||||
Z3XH2_LXJ *ecs.Entry
|
Z3XH2_LXJ *ecs.Entry
|
||||||
//引导信号继电器,true-吸合
|
//引导信号继电器,true-吸合
|
||||||
Z3XH2_YXJ *ecs.Entry
|
Z3XH2_YXJ *ecs.Entry
|
||||||
// 物理黄灯,true-亮
|
}
|
||||||
Z3XH2_U *ecs.Entry
|
|
||||||
// 物理绿灯,true-亮
|
// Signal3XH2Lsq 联锁驱
|
||||||
Z3XH2_L *ecs.Entry
|
type Signal3XH2Lsq struct {
|
||||||
// 物理红灯,true-亮
|
//true-联锁施加励磁电流驱动继电器DDJ
|
||||||
Z3XH2_H *ecs.Entry
|
Z3XH2_DDJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器LXJ
|
||||||
|
Z3XH2_LXJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器LXJ
|
||||||
|
Z3XH2_YXJ_Q bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signal3XH2Lsc 联锁采
|
||||||
|
type Signal3XH2Lsc struct {
|
||||||
|
//true-继电器DJ吸起
|
||||||
|
Z3XH2_DJ_Xq bool
|
||||||
|
//true-继电器2DJ吸起
|
||||||
|
Z3XH2_2DJ_Xq bool
|
||||||
|
//true-继电器DDJ落下
|
||||||
|
Z3XH2_DDJ_Lx bool
|
||||||
|
//true-继电器LXJ吸起
|
||||||
|
Z3XH2_LXJ_Xq bool
|
||||||
|
//true-继电器YXJ吸起
|
||||||
|
Z3XH2_YXJ_Xq bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Signal3XH2ElectronicType = ecs.NewComponentType[Signal3XH2Electronic]()
|
Signal3XH2ElectronicType = ecs.NewComponentType[Signal3XH2Electronic]()
|
||||||
|
Signal3XH2LsqType = ecs.NewComponentType[Signal3XH2Lsq]()
|
||||||
|
Signal3XH2LscType = ecs.NewComponentType[Signal3XH2Lsc]()
|
||||||
)
|
)
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -111,12 +170,142 @@ type Signal3XH3Electronic struct {
|
|||||||
Z3XH3_LXJ *ecs.Entry
|
Z3XH3_LXJ *ecs.Entry
|
||||||
//引导信号继电器,true-吸合
|
//引导信号继电器,true-吸合
|
||||||
Z3XH3_YXJ *ecs.Entry
|
Z3XH3_YXJ *ecs.Entry
|
||||||
// 物理黄灯,true-亮
|
}
|
||||||
Z3XH3_U *ecs.Entry
|
|
||||||
// 物理红灯,true-亮
|
// Signal3XH3Lsq 联锁驱
|
||||||
Z3XH3_H *ecs.Entry
|
type Signal3XH3Lsq struct {
|
||||||
|
//true-联锁施加励磁电流驱动继电器DDJ
|
||||||
|
Z3XH3_DDJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器LXJ
|
||||||
|
Z3XH3_LXJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器LXJ
|
||||||
|
Z3XH3_YXJ_Q bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signal3XH3Lsc 联锁采
|
||||||
|
type Signal3XH3Lsc struct {
|
||||||
|
//true-继电器DJ吸起
|
||||||
|
Z3XH3_DJ_Xq bool
|
||||||
|
//true-继电器2DJ吸起
|
||||||
|
Z3XH3_2DJ_Xq bool
|
||||||
|
//true-继电器DDJ落下
|
||||||
|
Z3XH3_DDJ_Lx bool
|
||||||
|
//true-继电器LXJ吸起
|
||||||
|
Z3XH3_LXJ_Xq bool
|
||||||
|
//true-继电器YXJ吸起
|
||||||
|
Z3XH3_YXJ_Xq bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Signal3XH3ElectronicType = ecs.NewComponentType[Signal3XH3Electronic]()
|
Signal3XH3ElectronicType = ecs.NewComponentType[Signal3XH3Electronic]()
|
||||||
|
Signal3XH3LsqType = ecs.NewComponentType[Signal3XH3Lsq]()
|
||||||
|
Signal3XH3LscType = ecs.NewComponentType[Signal3XH3Lsc]()
|
||||||
|
)
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// Signal3XH4Electronic 电路状态:信号机3XH-4(红-绿-黄) 出站兼道岔防护信号机(三显示不封灯、有单黄显示、无引导)
|
||||||
|
type Signal3XH4Electronic struct {
|
||||||
|
// 点灯继电器,true-吸合,常态落下表示逻辑点灯
|
||||||
|
Z3XH4_DDJ *ecs.Entry
|
||||||
|
//灯丝继电器,true-吸合
|
||||||
|
Z3XH4_DJ *ecs.Entry
|
||||||
|
//列车信号继电器,true-吸合
|
||||||
|
Z3XH4_LXJ *ecs.Entry
|
||||||
|
//开通正线信号继电器,true-吸合
|
||||||
|
Z3XH4_ZXJ *ecs.Entry
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signal3XH4Lsq 联锁驱
|
||||||
|
type Signal3XH4Lsq struct {
|
||||||
|
//true-联锁施加励磁电流驱动继电器DDJ
|
||||||
|
Z3XH4_DDJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器LXJ
|
||||||
|
Z3XH4_LXJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器ZXJ
|
||||||
|
Z3XH4_ZXJ_Q bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signal3XH4Lsc 联锁采
|
||||||
|
type Signal3XH4Lsc struct {
|
||||||
|
//true-继电器DJ吸起
|
||||||
|
Z3XH4_DJ_Xq bool
|
||||||
|
//true-继电器DDJ落下
|
||||||
|
Z3XH4_DDJ_Lx bool
|
||||||
|
//true-继电器LXJ吸起
|
||||||
|
Z3XH4_LXJ_Xq bool
|
||||||
|
//true-继电器ZXJ吸起
|
||||||
|
Z3XH4_ZXJ_Xq bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
Signal3XH4ElectronicType = ecs.NewComponentType[Signal3XH4Electronic]()
|
||||||
|
Signal3XH4LsqType = ecs.NewComponentType[Signal3XH4Lsq]()
|
||||||
|
Signal3XH4LscType = ecs.NewComponentType[Signal3XH4Lsc]()
|
||||||
|
)
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// SignalDCXHElectronic 电路状态:信号机DCXH(蓝-白) 调车信号机
|
||||||
|
type SignalDCXHElectronic struct {
|
||||||
|
//灯丝继电器,true-吸合
|
||||||
|
DCXH_DJ *ecs.Entry
|
||||||
|
//调车信号继电器,true-吸合
|
||||||
|
DCXH_DXJ *ecs.Entry
|
||||||
|
}
|
||||||
|
|
||||||
|
// SignalDCXHLsq 联锁驱
|
||||||
|
type SignalDCXHLsq struct {
|
||||||
|
////true-联锁施加励磁电流驱动继电器DXJ
|
||||||
|
DCXH_DXJ_Q bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// SignalDCXHLsc 联锁采
|
||||||
|
type SignalDCXHLsc struct {
|
||||||
|
//true-继电器DJ吸起
|
||||||
|
DCXH_DJ_Xq bool
|
||||||
|
//true-继电器DXJ吸起
|
||||||
|
DCXH_DXJ_Xq bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
SignalDCXHElectronicType = ecs.NewComponentType[SignalDCXHElectronic]()
|
||||||
|
SignalDCXHLsqType = ecs.NewComponentType[SignalDCXHLsq]()
|
||||||
|
SignalDCXHLscType = ecs.NewComponentType[SignalDCXHLsc]()
|
||||||
|
)
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// SignalJCKXHElectronic 电路状态:信号机JCKXH(红-白-黄) 进/出库列车兼调车信号机(三显示不封灯、有单黄显示、无引导)
|
||||||
|
type SignalJCKXHElectronic struct {
|
||||||
|
//灯丝继电器,true-吸合
|
||||||
|
JCKXH_DJ *ecs.Entry
|
||||||
|
//调车信号继电器,true-吸合
|
||||||
|
JCKXH_DXJ *ecs.Entry
|
||||||
|
//列车信号继电器,true-吸合
|
||||||
|
JCKXH_LXJ *ecs.Entry
|
||||||
|
}
|
||||||
|
|
||||||
|
// SignalJCKXHLsq 联锁驱
|
||||||
|
type SignalJCKXHLsq struct {
|
||||||
|
//true-联锁施加励磁电流驱动继电器DXJ
|
||||||
|
JCKXH_DXJ_Q bool
|
||||||
|
////true-联锁施加励磁电流驱动继电器LXJ
|
||||||
|
JCKXH_LXJ_Q bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// SignalJCKXHLsc 联锁采
|
||||||
|
type SignalJCKXHLsc struct {
|
||||||
|
//true-继电器DJ吸起
|
||||||
|
JCKXH_DJ_Xq bool
|
||||||
|
//true-继电器DXJ吸起
|
||||||
|
JCKXH_DXJ_Xq bool
|
||||||
|
//true-继电器LXJ吸起
|
||||||
|
JCKXH_LXJ_Xq bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
SignalJCKXHElectronicType = ecs.NewComponentType[SignalJCKXHElectronic]()
|
||||||
|
SignalJCKXHLsqType = ecs.NewComponentType[SignalJCKXHLsq]()
|
||||||
|
SignalJCKXHLscType = ecs.NewComponentType[SignalJCKXHLsc]()
|
||||||
)
|
)
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
package component
|
|
||||||
|
|
||||||
import "joylink.club/ecs"
|
|
||||||
|
|
||||||
// Signal3XH4Electronic 电路状态:信号机3XH-4(红-绿-黄) 出站兼道岔防护信号机(三显示不封灯、有单黄显示、无引导)
|
|
||||||
type Signal3XH4Electronic struct {
|
|
||||||
// 点灯继电器,true-吸合,常态落下表示逻辑点灯
|
|
||||||
Z3XH4_DDJ *ecs.Entry
|
|
||||||
//灯丝继电器,true-吸合
|
|
||||||
Z3XH4_DJ *ecs.Entry
|
|
||||||
//列车信号继电器,true-吸合
|
|
||||||
Z3XH4_LXJ *ecs.Entry
|
|
||||||
//开通正线信号继电器,true-吸合
|
|
||||||
Z3XH4_ZXJ *ecs.Entry
|
|
||||||
}
|
|
||||||
|
|
||||||
// Signal3XH4Filament 信号机3XH-4 灯丝状态
|
|
||||||
type Signal3XH4Filament struct {
|
|
||||||
// 物理黄灯,true-灯丝正常
|
|
||||||
Uf bool
|
|
||||||
// 物理绿灯,true-灯丝正常
|
|
||||||
Lf bool
|
|
||||||
// 物理红灯,true-灯丝正常
|
|
||||||
Hf bool
|
|
||||||
// 物理黄灯,true-亮
|
|
||||||
U bool
|
|
||||||
// 物理绿灯,true-亮
|
|
||||||
L bool
|
|
||||||
// 物理红灯,true-亮
|
|
||||||
H bool
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
Signal3XH4ElectronicType = ecs.NewComponentType[Signal3XH4Electronic]()
|
|
||||||
Signal3XH4FilamentType = ecs.NewComponentType[Signal3XH4Filament]()
|
|
||||||
)
|
|
@ -1,28 +0,0 @@
|
|||||||
package component
|
|
||||||
|
|
||||||
import "joylink.club/ecs"
|
|
||||||
|
|
||||||
// SignalDCXHElectronic 电路状态:信号机DCXH(蓝-白) 调车信号机
|
|
||||||
type SignalDCXHElectronic struct {
|
|
||||||
//灯丝继电器,true-吸合
|
|
||||||
DCXH_DJ *ecs.Entry
|
|
||||||
//调车信号继电器,true-吸合
|
|
||||||
DCXH_DXJ *ecs.Entry
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignalDCXHFilament 信号机DCXH 灯丝状态
|
|
||||||
type SignalDCXHFilament struct {
|
|
||||||
// 物理白灯,true-灯丝正常
|
|
||||||
Bf bool
|
|
||||||
// 物理蓝灯,true-灯丝正常
|
|
||||||
Af bool
|
|
||||||
// 物理白灯,true-亮
|
|
||||||
B bool
|
|
||||||
// 物理蓝灯,true-亮
|
|
||||||
A bool
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
SignalDCXHElectronicType = ecs.NewComponentType[SignalDCXHElectronic]()
|
|
||||||
SignalDCXHFilamentType = ecs.NewComponentType[SignalDCXHFilament]()
|
|
||||||
)
|
|
@ -1,34 +0,0 @@
|
|||||||
package component
|
|
||||||
|
|
||||||
import "joylink.club/ecs"
|
|
||||||
|
|
||||||
// SignalJCKXHElectronic 电路状态:信号机JCKXH(红-白-黄) 进/出库列车兼调车信号机(三显示不封灯、有单黄显示、无引导)
|
|
||||||
type SignalJCKXHElectronic struct {
|
|
||||||
//灯丝继电器,true-吸合
|
|
||||||
JCKXH_DJ *ecs.Entry
|
|
||||||
//调车信号继电器,true-吸合
|
|
||||||
JCKXH_DXJ *ecs.Entry
|
|
||||||
//列车信号继电器,true-吸合
|
|
||||||
JCKXH_LXJ *ecs.Entry
|
|
||||||
}
|
|
||||||
|
|
||||||
// SignalJCKXHFilament 信号机JCKXH 灯丝状态
|
|
||||||
type SignalJCKXHFilament struct {
|
|
||||||
// 物理黄灯,true-灯丝正常
|
|
||||||
Uf bool
|
|
||||||
// 物理白灯,true-灯丝正常
|
|
||||||
Bf bool
|
|
||||||
// 物理红灯,true-灯丝正常
|
|
||||||
Hf bool
|
|
||||||
// 物理黄灯,true-亮
|
|
||||||
U bool
|
|
||||||
// 物理白灯,true-亮
|
|
||||||
B bool
|
|
||||||
// 物理红灯,true-亮
|
|
||||||
H bool
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
SignalJCKXHElectronicType = ecs.NewComponentType[SignalJCKXHElectronic]()
|
|
||||||
SignalJCKXHFilamentType = ecs.NewComponentType[SignalJCKXHFilament]()
|
|
||||||
)
|
|
@ -2,22 +2,48 @@ package component
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
|
"joylink.club/rtsssimulation/component/component_proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 道岔标签
|
// 道岔标签
|
||||||
var TurnoutTag = ecs.NewTag()
|
var TurnoutTag = ecs.NewTag()
|
||||||
|
|
||||||
// 道岔的实际位置
|
// // 道岔的实际位置
|
||||||
type TurnoutPosition struct {
|
// type TurnoutPosition struct {
|
||||||
Dw bool // 是否定位(实际位置)
|
// Dw bool // 是否定位(实际位置)
|
||||||
Fw bool // 是否反位(实际位置)
|
// Fw bool // 是否反位(实际位置)
|
||||||
|
|
||||||
Db bool // 定位表示(表示位置)
|
// Db bool // 定位表示(表示位置)
|
||||||
Fb bool // 反位表示(表示位置)
|
// Fb bool // 反位表示(表示位置)
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 实际道岔的实际位置组件类型
|
// 实际道岔的实际位置组件类型
|
||||||
var TurnoutPositionType = ecs.NewComponentType[TurnoutPosition]()
|
var TurnoutPositionType = ecs.NewComponentType[component_proto.TurnoutPosition]()
|
||||||
|
|
||||||
|
var (
|
||||||
|
// 失表故障
|
||||||
|
TurnoutFaultSbType = ecs.NewComponentType[component_proto.TurnoutFaultSB]()
|
||||||
|
// 定位失表故障
|
||||||
|
TurnoutFaultDwsbType = ecs.NewComponentType[component_proto.TurnoutFaultDwsb]()
|
||||||
|
// 反位失表故障
|
||||||
|
TurnoutFaultFwsbType = ecs.NewComponentType[component_proto.TurnoutFaultFwsb]()
|
||||||
|
// 挤岔故障类型
|
||||||
|
TurnoutFaultJcType = ecs.NewComponentType[component_proto.TurnoutFaultJc]()
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetTurnoutFaultType(fault component_proto.Turnout_Fault) ecs.IComponentType {
|
||||||
|
switch fault {
|
||||||
|
case component_proto.Turnout_SB:
|
||||||
|
return TurnoutFaultSbType
|
||||||
|
case component_proto.Turnout_DWSB:
|
||||||
|
return TurnoutFaultDwsbType
|
||||||
|
case component_proto.Turnout_FWSB:
|
||||||
|
return TurnoutFaultFwsbType
|
||||||
|
case component_proto.Turnout_JC:
|
||||||
|
return TurnoutFaultJcType
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// ZDJ9单机电路元器件
|
// ZDJ9单机电路元器件
|
||||||
type Zdj9OneElectronic struct {
|
type Zdj9OneElectronic struct {
|
||||||
@ -39,6 +65,7 @@ type Zdj9OneElectronic struct {
|
|||||||
// ZDJ9单机电路元器件组件类型
|
// ZDJ9单机电路元器件组件类型
|
||||||
var Zdj9OneElectronicType = ecs.NewComponentType[Zdj9OneElectronic]()
|
var Zdj9OneElectronicType = ecs.NewComponentType[Zdj9OneElectronic]()
|
||||||
|
|
||||||
|
// ZDJ9双机电路元器件
|
||||||
type Zdj9TwoElectronic struct {
|
type Zdj9TwoElectronic struct {
|
||||||
TDC_DCJ *ecs.Entry // 定操继电器
|
TDC_DCJ *ecs.Entry // 定操继电器
|
||||||
TDC_FCJ *ecs.Entry // 反操继电器
|
TDC_FCJ *ecs.Entry // 反操继电器
|
||||||
@ -147,8 +174,44 @@ func (te *Zdj9TwoElectronic) HasNilReference() bool {
|
|||||||
return len(nils) > 0
|
return len(nils) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZDJ9双机电路元器件组件类型
|
// ZDJ9双机驱动状态组件
|
||||||
var Zdj9TwoElectronicType = ecs.NewComponentType[Zdj9TwoElectronic]()
|
type Zdj9TwoDrive struct {
|
||||||
|
// 定操继电器驱动
|
||||||
|
DCJ bool
|
||||||
|
// 反操继电器驱动
|
||||||
|
FCJ bool
|
||||||
|
// 允操继电器驱动
|
||||||
|
YCJ bool
|
||||||
|
}
|
||||||
|
|
||||||
|
// ZDJ9双机采集状态组件
|
||||||
|
type Zdj9TwoCollect struct {
|
||||||
|
// 总定表继电器吸起采集
|
||||||
|
TDC_ZDBJ_XQ bool
|
||||||
|
// 总反表继电器吸起采集
|
||||||
|
TDC_ZFBJ_XQ bool
|
||||||
|
// 允操继电器吸起采集
|
||||||
|
TDC_YCJ_XQ bool
|
||||||
|
// 总定表继电器和总反表继电器都落下采集
|
||||||
|
TDC_ZDBJ_ZFBJ_LX bool
|
||||||
|
// 1机定表继电器吸起采集
|
||||||
|
TDFJ1_DBJ_XQ bool
|
||||||
|
// 1机反表继电器吸起采集
|
||||||
|
TDFJ1_FBJ_XQ bool
|
||||||
|
// 2机定表继电器吸起采集
|
||||||
|
TDFJ2_DBJ_XQ bool
|
||||||
|
// 2机反表继电器吸起采集
|
||||||
|
TDFJ2_FBJ_XQ bool
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ZDJ9双机电路元器件组件类型
|
||||||
|
Zdj9TwoElectronicType = ecs.NewComponentType[Zdj9TwoElectronic]()
|
||||||
|
// ZDJ9双机驱动状态组件类型
|
||||||
|
Zdj9TwoDriveType = ecs.NewComponentType[Zdj9TwoDrive]()
|
||||||
|
// ZDJ9双机采集状态组件类型
|
||||||
|
Zdj9TwoCollectType = ecs.NewComponentType[Zdj9TwoCollect]()
|
||||||
|
)
|
||||||
|
|
||||||
// 转辙机状态
|
// 转辙机状态
|
||||||
type ZzjState struct {
|
type ZzjState struct {
|
||||||
|
197
entity/ibp.go
Normal file
197
entity/ibp.go
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"joylink.club/ecs"
|
||||||
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/repository"
|
||||||
|
"joylink.club/rtsssimulation/repository/model/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 创建IBP实体
|
||||||
|
func NewIBPEntity(w ecs.World, ibp *repository.IBP, entityMap map[string]*ecs.Entry) {
|
||||||
|
entry := w.Entry(w.Create(component.IBP))
|
||||||
|
loadSPKEntity(w, entry, ibp.Spk, entityMap)
|
||||||
|
loadEMPEntity(w, entry, ibp.Emp, entityMap)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建按钮实体
|
||||||
|
func NewButtonEntity(w ecs.World, data *repository.Button, entityMap map[string]*ecs.Entry) *ecs.Entry {
|
||||||
|
uid := data.Id()
|
||||||
|
entry, ok := entityMap[uid]
|
||||||
|
if !ok {
|
||||||
|
var btnType ecs.IComponentType
|
||||||
|
switch data.GetBtnType() {
|
||||||
|
case proto.Button_NO_Reset_Press:
|
||||||
|
btnType = component.NoResetPressBtn
|
||||||
|
case proto.Button_NO_Reset_Up:
|
||||||
|
btnType = component.NoResetUpBtn
|
||||||
|
case proto.Button_Reset_Press:
|
||||||
|
btnType = component.ResetPressBtn
|
||||||
|
case proto.Button_Reset_Up:
|
||||||
|
btnType = component.ResetUpBtn
|
||||||
|
case proto.Button_Key_Knob:
|
||||||
|
btnType = component.KeyKnob
|
||||||
|
default:
|
||||||
|
btnType = component.UnknowBtn
|
||||||
|
}
|
||||||
|
entry = w.Entry(w.Create(btnType, component.UidType, component.BitStateType))
|
||||||
|
component.UidType.SetValue(entry, component.Uid{Id: uid})
|
||||||
|
entityMap[uid] = entry
|
||||||
|
}
|
||||||
|
return entry
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建蜂鸣器实体
|
||||||
|
func NewAlarmEntity(w ecs.World, alarm *repository.Alarm, entityMap map[string]*ecs.Entry) *ecs.Entry {
|
||||||
|
uid := alarm.Id()
|
||||||
|
entry, ok := entityMap[uid]
|
||||||
|
if !ok {
|
||||||
|
entry = w.Entry(w.Create(component.UidType, component.AlarmDriveType, component.BitStateType))
|
||||||
|
component.UidType.SetValue(entry, component.Uid{Id: uid})
|
||||||
|
entityMap[uid] = entry
|
||||||
|
}
|
||||||
|
return entry
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建人员防护实体
|
||||||
|
func loadSPKEntity(w ecs.World, entry *ecs.Entry, spkData *repository.IBPRefMap, entityMap map[string]*ecs.Entry) error {
|
||||||
|
spk := &component.SpkElectronic{}
|
||||||
|
// 按钮组
|
||||||
|
for _, btn := range spkData.Buttons() {
|
||||||
|
switch btn.GetCode() {
|
||||||
|
case "SPKSXPLA":
|
||||||
|
spk.SPKSXPLA_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "SPKSSPLA":
|
||||||
|
spk.SPKSSPLA_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "SPKS1":
|
||||||
|
spk.SPKSX1J_KEY = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "SPKS3":
|
||||||
|
spk.SPKSX3J_KEY = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "SPKS2":
|
||||||
|
spk.SPKSS2J_KEY = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "SPKS4":
|
||||||
|
spk.SPKSS4J_KEY = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "SDA":
|
||||||
|
spk.SDA = NewButtonEntity(w, btn, entityMap)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 继电器组
|
||||||
|
for _, relay := range spkData.Relays() {
|
||||||
|
switch relay.Code() {
|
||||||
|
case "SPKSX1J":
|
||||||
|
spk.SPKSX1J = NewRelayEntity(w, relay, entityMap)
|
||||||
|
case "SPKSX3J":
|
||||||
|
spk.SPKSX3J = NewRelayEntity(w, relay, entityMap)
|
||||||
|
case "SPKSS2J":
|
||||||
|
spk.SPKSS2J = NewRelayEntity(w, relay, entityMap)
|
||||||
|
case "SPKSS4J":
|
||||||
|
spk.SPKSS4J = NewRelayEntity(w, relay, entityMap)
|
||||||
|
case "SPKSXPLAJ":
|
||||||
|
spk.SPKSXPLAJ = NewRelayEntity(w, relay, entityMap)
|
||||||
|
case "SPKSSPLAJ":
|
||||||
|
spk.SPKSSPLAJ = NewRelayEntity(w, relay, entityMap)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 灯组
|
||||||
|
spk.SPKSX1D = NewLightHEntity(w)
|
||||||
|
spk.SPKSX3D = NewLightHEntity(w)
|
||||||
|
spk.SPKSS2D = NewLightHEntity(w)
|
||||||
|
spk.SPKSS4D = NewLightHEntity(w)
|
||||||
|
spk.SPKSXPLAD = NewLightHEntity(w)
|
||||||
|
spk.SPKSSPLAD = NewLightHEntity(w)
|
||||||
|
// 设置默认值
|
||||||
|
setSpkDefault(spk)
|
||||||
|
// 绑定组件
|
||||||
|
entry.AddComponent(component.SpkElectronicType, unsafe.Pointer(spk))
|
||||||
|
entry.AddComponent(component.SpkCollectStateType, unsafe.Pointer(&component.SpkCollectState{}))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 人员防护设置默认值
|
||||||
|
func setSpkDefault(spk *component.SpkElectronic) {
|
||||||
|
setBtnVal(spk.SPKSX1J_KEY, true)
|
||||||
|
setBtnVal(spk.SPKSX3J_KEY, true)
|
||||||
|
setBtnVal(spk.SPKSS2J_KEY, true)
|
||||||
|
setBtnVal(spk.SPKSS4J_KEY, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建紧急关闭实体
|
||||||
|
func loadEMPEntity(w ecs.World, entry *ecs.Entry, spkData *repository.IBPRefMap, entityMap map[string]*ecs.Entry) error {
|
||||||
|
emp := &component.EmpElectronic{}
|
||||||
|
// 按钮组
|
||||||
|
for _, btn := range spkData.Buttons() {
|
||||||
|
switch btn.GetCode() {
|
||||||
|
case "EMP1":
|
||||||
|
emp.EMP1_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "EMP3":
|
||||||
|
emp.EMP3_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "EMP5":
|
||||||
|
emp.EMP5_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "EMPX":
|
||||||
|
emp.EMPX_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "EMP2":
|
||||||
|
emp.EMP2_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "EMP4":
|
||||||
|
emp.EMP4_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "EMP6":
|
||||||
|
emp.EMP6_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "EMPS":
|
||||||
|
emp.EMPS_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "XEMPFA":
|
||||||
|
emp.XEMPFA_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "SEMPFA":
|
||||||
|
emp.SEMPFA_BTN = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "QBA":
|
||||||
|
emp.QBA = NewButtonEntity(w, btn, entityMap)
|
||||||
|
case "SDA":
|
||||||
|
emp.SDA = NewButtonEntity(w, btn, entityMap)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 继电器组
|
||||||
|
for _, relay := range spkData.Relays() {
|
||||||
|
switch relay.Code() {
|
||||||
|
case "XEMPJ":
|
||||||
|
emp.XEMPJ = NewRelayEntity(w, relay, entityMap)
|
||||||
|
case "SEMPJ":
|
||||||
|
emp.SEMPJ = NewRelayEntity(w, relay, entityMap)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 灯组
|
||||||
|
emp.XEMPD = NewLightHEntity(w)
|
||||||
|
emp.SEMPD = NewLightHEntity(w)
|
||||||
|
// 蜂鸣器
|
||||||
|
for _, alarm := range spkData.Alarms() {
|
||||||
|
switch alarm.Code() {
|
||||||
|
case "蜂鸣器":
|
||||||
|
emp.Alarm = NewAlarmEntity(w, alarm, entityMap)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 设置默认值
|
||||||
|
setEmpDefault(emp)
|
||||||
|
entry.AddComponent(component.EmpElectronicType, unsafe.Pointer(emp))
|
||||||
|
entry.AddComponent(component.EmpCollectStateType, unsafe.Pointer(&component.EmpCollectState{}))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 紧急关闭设置默认值
|
||||||
|
func setEmpDefault(emp *component.EmpElectronic) {
|
||||||
|
setBtnVal(emp.EMP1_BTN, true)
|
||||||
|
setBtnVal(emp.EMP3_BTN, true)
|
||||||
|
setBtnVal(emp.EMP5_BTN, true)
|
||||||
|
setBtnVal(emp.EMPX_BTN, true)
|
||||||
|
setBtnVal(emp.EMP2_BTN, true)
|
||||||
|
setBtnVal(emp.EMP4_BTN, true)
|
||||||
|
setBtnVal(emp.EMP6_BTN, true)
|
||||||
|
setBtnVal(emp.EMPS_BTN, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取按钮状态
|
||||||
|
func setBtnVal(entry *ecs.Entry, val bool) {
|
||||||
|
if entry == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
btn := component.BitStateType.Get(entry)
|
||||||
|
btn.Val = val
|
||||||
|
}
|
@ -44,3 +44,23 @@ func NewLightAEntity(w ecs.World) *ecs.Entry {
|
|||||||
e.AddComponent(component.AdTag)
|
e.AddComponent(component.AdTag)
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewLights 创建灯位列表(灯位顺序与lightTags一致)
|
||||||
|
func NewLights(w ecs.World, lightTags ...component.DsTag) []*ecs.Entry {
|
||||||
|
ls := make([]*ecs.Entry, 0, len(lightTags))
|
||||||
|
for _, lightTag := range lightTags {
|
||||||
|
lightEntry := NewLightEntity(w)
|
||||||
|
lightEntry.AddComponent(lightTag)
|
||||||
|
ls = append(ls, lightEntry)
|
||||||
|
}
|
||||||
|
return ls
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsLightFd 灯是否被封(如Signal 3xh3 红绿黄三显示封绿灯)
|
||||||
|
func IsLightFd(lightEntry *ecs.Entry) bool {
|
||||||
|
if lightEntry.HasComponent(component.LightDriveType) && lightEntry.HasComponent(component.BitStateType) {
|
||||||
|
return lightEntry.HasComponent(component.FdTag)
|
||||||
|
} else {
|
||||||
|
panic("IsLightFd 参数lightEntry的值非灯实体")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -72,3 +72,8 @@ func newSignalEntity(w ecs.World, uid string, worldData *component.WorldData) *e
|
|||||||
}
|
}
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新建灯位列表
|
||||||
|
func newSignalLights(w ecs.World, lightTags ...component.DsTag) *component.SignalLights {
|
||||||
|
return &component.SignalLights{Lights: NewLights(w, lightTags...)}
|
||||||
|
}
|
||||||
|
@ -14,8 +14,9 @@ func loadSignal2xh1(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
signalEntry.AddComponent(component.Signal2XH1ElectronicType)
|
signalEntry.AddComponent(component.Signal2XH1ElectronicType)
|
||||||
signalEntry.AddComponent(component.Signal2XH1LsqType)
|
signalEntry.AddComponent(component.Signal2XH1LsqType)
|
||||||
signalEntry.AddComponent(component.Signal2XH1LscType)
|
signalEntry.AddComponent(component.Signal2XH1LscType)
|
||||||
|
signalEntry.AddComponent(component.SignalLightsType)
|
||||||
//
|
//
|
||||||
elecState := &component.Signal2XH1Electronic{Z2XH1_L: NewLightLEntity(w), Z2XH1_H: NewLightHEntity(w)}
|
elecState := &component.Signal2XH1Electronic{}
|
||||||
for _, elec := range elecs {
|
for _, elec := range elecs {
|
||||||
switch elec.Code() {
|
switch elec.Code() {
|
||||||
case consts.SIGNAL_DDJ:
|
case consts.SIGNAL_DDJ:
|
||||||
@ -32,6 +33,7 @@ func loadSignal2xh1(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
component.Signal2XH1ElectronicType.Set(signalEntry, elecState)
|
component.Signal2XH1ElectronicType.Set(signalEntry, elecState)
|
||||||
component.Signal2XH1LsqType.Set(signalEntry, &component.Signal2XH1Lsq{})
|
component.Signal2XH1LsqType.Set(signalEntry, &component.Signal2XH1Lsq{})
|
||||||
component.Signal2XH1LscType.Set(signalEntry, &component.Signal2XH1Lsc{})
|
component.Signal2XH1LscType.Set(signalEntry, &component.Signal2XH1Lsc{})
|
||||||
|
component.SignalLightsType.Set(signalEntry, newSignalLights(w, component.HdTag, component.LdTag))
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("id=[%s]的信号机2xh1,电子元器件数量须为3", signal.Id())
|
return fmt.Errorf("id=[%s]的信号机2xh1,电子元器件数量须为3", signal.Id())
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,11 @@ func loadSignal3xh1(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
|
|
||||||
if len(elecs) == 6 { //3xh1组合类型包含6个继电器
|
if len(elecs) == 6 { //3xh1组合类型包含6个继电器
|
||||||
signalEntry.AddComponent(component.Signal3XH1ElectronicType)
|
signalEntry.AddComponent(component.Signal3XH1ElectronicType)
|
||||||
|
signalEntry.AddComponent(component.Signal3XH1LsqType)
|
||||||
|
signalEntry.AddComponent(component.Signal3XH1LscType)
|
||||||
|
signalEntry.AddComponent(component.SignalLightsType)
|
||||||
//
|
//
|
||||||
elecState := &component.Signal3XH1Electronic{Z3XH1_L: NewLightLEntity(w), Z3XH1_H: NewLightHEntity(w), Z3XH1_U: NewLightUEntity(w)}
|
elecState := &component.Signal3XH1Electronic{}
|
||||||
for _, elec := range elecs {
|
for _, elec := range elecs {
|
||||||
switch elec.Code() {
|
switch elec.Code() {
|
||||||
case consts.SIGNAL_DDJ:
|
case consts.SIGNAL_DDJ:
|
||||||
@ -34,6 +37,9 @@ func loadSignal3xh1(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
component.Signal3XH1ElectronicType.Set(signalEntry, elecState)
|
component.Signal3XH1ElectronicType.Set(signalEntry, elecState)
|
||||||
|
component.Signal3XH1LsqType.Set(signalEntry, &component.Signal3XH1Lsq{})
|
||||||
|
component.Signal3XH1LscType.Set(signalEntry, &component.Signal3XH1Lsc{})
|
||||||
|
component.SignalLightsType.Set(signalEntry, newSignalLights(w, component.HdTag, component.LdTag, component.UdTag))
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("id=[%s]的信号机3xh1,电子元器件数量须为6", signal.Id())
|
return fmt.Errorf("id=[%s]的信号机3xh1,电子元器件数量须为6", signal.Id())
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,11 @@ func loadSignal3xh2(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
|
|
||||||
if len(elecs) == 5 { //3xh2组合类型包含5个继电器
|
if len(elecs) == 5 { //3xh2组合类型包含5个继电器
|
||||||
signalEntry.AddComponent(component.Signal3XH2ElectronicType)
|
signalEntry.AddComponent(component.Signal3XH2ElectronicType)
|
||||||
|
signalEntry.AddComponent(component.Signal3XH2LsqType)
|
||||||
|
signalEntry.AddComponent(component.Signal3XH2LscType)
|
||||||
|
signalEntry.AddComponent(component.SignalLightsType)
|
||||||
//
|
//
|
||||||
elecState := &component.Signal3XH2Electronic{Z3XH2_L: NewLightLEntity(w), Z3XH2_H: NewLightHEntity(w), Z3XH2_U: NewLightUEntity(w)}
|
elecState := &component.Signal3XH2Electronic{}
|
||||||
for _, elec := range elecs {
|
for _, elec := range elecs {
|
||||||
switch elec.Code() {
|
switch elec.Code() {
|
||||||
case consts.SIGNAL_DDJ:
|
case consts.SIGNAL_DDJ:
|
||||||
@ -32,6 +35,9 @@ func loadSignal3xh2(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
component.Signal3XH2ElectronicType.Set(signalEntry, elecState)
|
component.Signal3XH2ElectronicType.Set(signalEntry, elecState)
|
||||||
|
component.Signal3XH2LsqType.Set(signalEntry, &component.Signal3XH2Lsq{})
|
||||||
|
component.Signal3XH2LscType.Set(signalEntry, &component.Signal3XH2Lsc{})
|
||||||
|
component.SignalLightsType.Set(signalEntry, newSignalLights(w, component.HdTag, component.LdTag, component.UdTag))
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("id=[%s]的信号机3xh2,电子元器件数量须为5", signal.Id())
|
return fmt.Errorf("id=[%s]的信号机3xh2,电子元器件数量须为5", signal.Id())
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@ func loadSignal3xh3(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
|
|
||||||
if len(elecs) == 5 { //3xh3组合类型包含5个继电器
|
if len(elecs) == 5 { //3xh3组合类型包含5个继电器
|
||||||
signalEntry.AddComponent(component.Signal3XH3ElectronicType)
|
signalEntry.AddComponent(component.Signal3XH3ElectronicType)
|
||||||
|
signalEntry.AddComponent(component.Signal3XH3LsqType)
|
||||||
|
signalEntry.AddComponent(component.Signal3XH3LscType)
|
||||||
|
signalEntry.AddComponent(component.SignalLightsType)
|
||||||
//
|
//
|
||||||
elecState := &component.Signal3XH3Electronic{}
|
elecState := &component.Signal3XH3Electronic{}
|
||||||
for _, elec := range elecs {
|
for _, elec := range elecs {
|
||||||
@ -32,6 +35,11 @@ func loadSignal3xh3(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
component.Signal3XH3ElectronicType.Set(signalEntry, elecState)
|
component.Signal3XH3ElectronicType.Set(signalEntry, elecState)
|
||||||
|
component.Signal3XH3LsqType.Set(signalEntry, &component.Signal3XH3Lsq{})
|
||||||
|
component.Signal3XH3LscType.Set(signalEntry, &component.Signal3XH3Lsc{})
|
||||||
|
component.SignalLightsType.Set(signalEntry, newSignalLights(w, component.HdTag, component.LdTag, component.UdTag))
|
||||||
|
//封绿灯,即有绿灯但绿被封
|
||||||
|
component.SignalLightsType.Get(signalEntry).GetLightByTag(component.LdTag).AddComponent(component.FdTag)
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("id=[%s]的信号机3xh3,电子元器件数量须为5", signal.Id())
|
return fmt.Errorf("id=[%s]的信号机3xh3,电子元器件数量须为5", signal.Id())
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,9 @@ func loadSignal3xh4(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
|
|
||||||
if len(elecs) == 4 { //3xh4组合类型包含4个继电器
|
if len(elecs) == 4 { //3xh4组合类型包含4个继电器
|
||||||
signalEntry.AddComponent(component.Signal3XH4ElectronicType)
|
signalEntry.AddComponent(component.Signal3XH4ElectronicType)
|
||||||
signalEntry.AddComponent(component.Signal3XH4FilamentType)
|
signalEntry.AddComponent(component.Signal3XH4LsqType)
|
||||||
|
signalEntry.AddComponent(component.Signal3XH4LscType)
|
||||||
|
signalEntry.AddComponent(component.SignalLightsType)
|
||||||
//
|
//
|
||||||
elecState := &component.Signal3XH4Electronic{}
|
elecState := &component.Signal3XH4Electronic{}
|
||||||
for _, elec := range elecs {
|
for _, elec := range elecs {
|
||||||
@ -31,7 +33,9 @@ func loadSignal3xh4(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
component.Signal3XH4ElectronicType.Set(signalEntry, elecState)
|
component.Signal3XH4ElectronicType.Set(signalEntry, elecState)
|
||||||
component.Signal3XH4FilamentType.Set(signalEntry, &component.Signal3XH4Filament{Uf: true, Lf: true, Hf: true, U: false, L: false, H: false})
|
component.Signal3XH4LsqType.Set(signalEntry, &component.Signal3XH4Lsq{})
|
||||||
|
component.Signal3XH4LscType.Set(signalEntry, &component.Signal3XH4Lsc{})
|
||||||
|
component.SignalLightsType.Set(signalEntry, newSignalLights(w, component.HdTag, component.LdTag, component.UdTag))
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("id=[%s]的信号机3xh4,电子元器件数量须为4", signal.Id())
|
return fmt.Errorf("id=[%s]的信号机3xh4,电子元器件数量须为4", signal.Id())
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,9 @@ func loadSignalDcxh(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
|
|
||||||
if len(elecs) == 2 { //dcxh组合类型包含2个继电器
|
if len(elecs) == 2 { //dcxh组合类型包含2个继电器
|
||||||
signalEntry.AddComponent(component.SignalDCXHElectronicType)
|
signalEntry.AddComponent(component.SignalDCXHElectronicType)
|
||||||
signalEntry.AddComponent(component.SignalDCXHFilamentType)
|
signalEntry.AddComponent(component.SignalDCXHLsqType)
|
||||||
|
signalEntry.AddComponent(component.SignalDCXHLscType)
|
||||||
|
signalEntry.AddComponent(component.SignalLightsType)
|
||||||
//
|
//
|
||||||
elecState := &component.SignalDCXHElectronic{}
|
elecState := &component.SignalDCXHElectronic{}
|
||||||
for _, elec := range elecs {
|
for _, elec := range elecs {
|
||||||
@ -27,7 +29,9 @@ func loadSignalDcxh(w ecs.World, signal *repository.Signal, signalEntry *ecs.Ent
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
component.SignalDCXHElectronicType.Set(signalEntry, elecState)
|
component.SignalDCXHElectronicType.Set(signalEntry, elecState)
|
||||||
component.SignalDCXHFilamentType.Set(signalEntry, &component.SignalDCXHFilament{Bf: true, Af: true, B: false, A: false})
|
component.SignalDCXHLsqType.Set(signalEntry, &component.SignalDCXHLsq{})
|
||||||
|
component.SignalDCXHLscType.Set(signalEntry, &component.SignalDCXHLsc{})
|
||||||
|
component.SignalLightsType.Set(signalEntry, newSignalLights(w, component.AdTag, component.BdTag))
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("id=[%s]的信号机dcxh,电子元器件数量须为2", signal.Id())
|
return fmt.Errorf("id=[%s]的信号机dcxh,电子元器件数量须为2", signal.Id())
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,9 @@ func loadSignalJckxh(w ecs.World, signal *repository.Signal, signalEntry *ecs.En
|
|||||||
|
|
||||||
if len(elecs) == 3 { //jckxh组合类型包含3个继电器
|
if len(elecs) == 3 { //jckxh组合类型包含3个继电器
|
||||||
signalEntry.AddComponent(component.SignalJCKXHElectronicType)
|
signalEntry.AddComponent(component.SignalJCKXHElectronicType)
|
||||||
signalEntry.AddComponent(component.SignalJCKXHFilamentType)
|
signalEntry.AddComponent(component.SignalJCKXHLsqType)
|
||||||
|
signalEntry.AddComponent(component.SignalJCKXHLscType)
|
||||||
|
signalEntry.AddComponent(component.SignalLightsType)
|
||||||
//
|
//
|
||||||
elecState := &component.SignalJCKXHElectronic{}
|
elecState := &component.SignalJCKXHElectronic{}
|
||||||
for _, elec := range elecs {
|
for _, elec := range elecs {
|
||||||
@ -29,7 +31,9 @@ func loadSignalJckxh(w ecs.World, signal *repository.Signal, signalEntry *ecs.En
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
component.SignalJCKXHElectronicType.Set(signalEntry, elecState)
|
component.SignalJCKXHElectronicType.Set(signalEntry, elecState)
|
||||||
component.SignalJCKXHFilamentType.Set(signalEntry, &component.SignalJCKXHFilament{Uf: true, Bf: true, Hf: true, U: false, B: false, H: false})
|
component.SignalJCKXHLsqType.Set(signalEntry, &component.SignalJCKXHLsq{})
|
||||||
|
component.SignalJCKXHLscType.Set(signalEntry, &component.SignalJCKXHLsc{})
|
||||||
|
component.SignalLightsType.Set(signalEntry, newSignalLights(w, component.HdTag, component.BdTag, component.UdTag))
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("id=[%s]的信号机jckxh,电子元器件数量须为3", signal.Id())
|
return fmt.Errorf("id=[%s]的信号机jckxh,电子元器件数量须为3", signal.Id())
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,8 @@ func LoadTurnoutZdj9Two(w ecs.World, turnout *repository.Turnout, entry *ecs.Ent
|
|||||||
} else {
|
} else {
|
||||||
// 给道岔添加电路组件
|
// 给道岔添加电路组件
|
||||||
entry.AddComponent(component.Zdj9TwoElectronicType, unsafe.Pointer(zdj9TwoElectronic))
|
entry.AddComponent(component.Zdj9TwoElectronicType, unsafe.Pointer(zdj9TwoElectronic))
|
||||||
|
entry.AddComponent(component.Zdj9TwoCollectType)
|
||||||
|
entry.AddComponent(component.Zdj9TwoDriveType)
|
||||||
}
|
}
|
||||||
} else if size > 0 && size < 3 {
|
} else if size > 0 && size < 3 {
|
||||||
return fmt.Errorf("id=[%s]的道岔是ZDJ9双机牵引,但继电器组合类型少于3个(应为TDC、TDFJ1、TDFJ2三个组合)", turnout.Id())
|
return fmt.Errorf("id=[%s]的道岔是ZDJ9双机牵引,但继电器组合类型少于3个(应为TDC、TDFJ1、TDFJ2三个组合)", turnout.Id())
|
||||||
|
@ -20,8 +20,11 @@ func (s *SignalDebugSystem) Update(w ecs.World) {
|
|||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
uid := component.UidType.Get(entry)
|
uid := component.UidType.Get(entry)
|
||||||
state := component.Signal2XH1ElectronicType.Get(entry)
|
state := component.Signal2XH1ElectronicType.Get(entry)
|
||||||
ld := component.BitStateType.Get(state.Z2XH1_L)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
hd := component.BitStateType.Get(state.Z2XH1_H)
|
Z2XH1_L := lights.GetLightByTag(component.LdTag)
|
||||||
|
Z2XH1_H := lights.GetLightByTag(component.HdTag)
|
||||||
|
ld := component.BitStateType.Get(Z2XH1_L)
|
||||||
|
hd := component.BitStateType.Get(Z2XH1_H)
|
||||||
//
|
//
|
||||||
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
||||||
|
@ -10,7 +10,8 @@ import (
|
|||||||
"joylink.club/rtsssimulation/fi"
|
"joylink.club/rtsssimulation/fi"
|
||||||
"joylink.club/rtsssimulation/repository"
|
"joylink.club/rtsssimulation/repository"
|
||||||
"joylink.club/rtsssimulation/repository/model/proto"
|
"joylink.club/rtsssimulation/repository/model/proto"
|
||||||
"log"
|
"log/slog"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,6 +21,9 @@ const (
|
|||||||
|
|
||||||
// 信号机测试
|
// 信号机测试
|
||||||
func main() {
|
func main() {
|
||||||
|
logConfig := &slog.HandlerOptions{AddSource: false, Level: slog.LevelDebug}
|
||||||
|
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, logConfig)))
|
||||||
|
//
|
||||||
proto := &proto.Repository{}
|
proto := &proto.Repository{}
|
||||||
proto.Id = "test-for-signal"
|
proto.Id = "test-for-signal"
|
||||||
proto.Version = "v1.0"
|
proto.Version = "v1.0"
|
||||||
@ -27,34 +31,28 @@ func main() {
|
|||||||
repo := repository.BuildRepositoryForSignalTest(proto)
|
repo := repository.BuildRepositoryForSignalTest(proto)
|
||||||
sim := rtss_simulation.NewSimulation(repo)
|
sim := rtss_simulation.NewSimulation(repo)
|
||||||
loadEntities(sim, repo)
|
loadEntities(sim, repo)
|
||||||
sim.SetSpeed(0.1)
|
sim.SetSpeed(1)
|
||||||
sim.AddSystem(sigSys.NewSignalDebugSystem())
|
sim.AddSystem(sigSys.NewSignalDebugSystem())
|
||||||
sim.StartUp()
|
sim.StartUp()
|
||||||
//
|
//
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
worldLog(sim, "===>>灭灯 .....")
|
slog.Debug("灭灯 .....")
|
||||||
fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, false)
|
fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, false)
|
||||||
//
|
//
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
worldLog(sim, "===>>亮灯 .....")
|
slog.Debug("亮灯 .....")
|
||||||
fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, true)
|
fi.DriveSignal3XH1Dd(sim, IdSignal3XH1, true)
|
||||||
//
|
//
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
worldLog(sim, "===>>开通引导信号 .....")
|
slog.Debug("开通引导信号 .....")
|
||||||
fi.DriveSignal3XH1Yx(sim, IdSignal3XH1)
|
fi.DriveSignal3XH1Yx(sim, IdSignal3XH1)
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
worldLog(sim, "===>>开通列车信号 .....")
|
slog.Debug("开通列车信号 .....")
|
||||||
fi.DriveSignal3XH1Lx(sim, IdSignal3XH1, false)
|
fi.DriveSignal3XH1Lx(sim, IdSignal3XH1, false)
|
||||||
//
|
//
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
sim.Close()
|
sim.Close()
|
||||||
}
|
}
|
||||||
func worldLog(w ecs.World, logInfo string) {
|
|
||||||
ecs.Request(w, func() any {
|
|
||||||
log.Println(logInfo)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
}
|
|
||||||
func addProtoSignal3XH1(r *proto.Repository) {
|
func addProtoSignal3XH1(r *proto.Repository) {
|
||||||
//相关继电器
|
//相关继电器
|
||||||
r.Relays = append(r.Relays, &proto.Relay{Id: "3xh1-ddj", Code: consts.SIGNAL_DDJ, Model: proto.Relay_JWXC_1700})
|
r.Relays = append(r.Relays, &proto.Relay{Id: "3xh1-ddj", Code: consts.SIGNAL_DDJ, Model: proto.Relay_JWXC_1700})
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
"log"
|
"log/slog"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SignalDebugSystem struct {
|
type SignalDebugSystem struct {
|
||||||
@ -20,6 +20,10 @@ func (s *SignalDebugSystem) Update(w ecs.World) {
|
|||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
uid := component.UidType.Get(entry)
|
uid := component.UidType.Get(entry)
|
||||||
state := component.Signal3XH1ElectronicType.Get(entry)
|
state := component.Signal3XH1ElectronicType.Get(entry)
|
||||||
|
lights := component.SignalLightsType.Get(entry)
|
||||||
|
Z3XH1_L := lights.GetLightByTag(component.LdTag)
|
||||||
|
Z3XH1_H := lights.GetLightByTag(component.HdTag)
|
||||||
|
Z3XH1_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
//
|
||||||
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
||||||
@ -27,11 +31,12 @@ func (s *SignalDebugSystem) Update(w ecs.World) {
|
|||||||
edj := component.BitStateType.Get(state.Z3XH1_2DJ)
|
edj := component.BitStateType.Get(state.Z3XH1_2DJ)
|
||||||
yxj := component.BitStateType.Get(state.Z3XH1_YXJ)
|
yxj := component.BitStateType.Get(state.Z3XH1_YXJ)
|
||||||
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
||||||
ld := component.BitStateType.Get(state.Z3XH1_L)
|
ld := component.BitStateType.Get(Z3XH1_L)
|
||||||
hd := component.BitStateType.Get(state.Z3XH1_H)
|
hd := component.BitStateType.Get(Z3XH1_H)
|
||||||
ud := component.BitStateType.Get(state.Z3XH1_U)
|
ud := component.BitStateType.Get(Z3XH1_U)
|
||||||
|
//lsq := component.Signal3XH1LsqType.Get(entry)
|
||||||
|
//lsc := component.Signal3XH1LscType.Get(entry)
|
||||||
//
|
//
|
||||||
log.Printf("===>> uid = %s | ddj = %t | lxj = %t zxj = %t yxj = %t | dj = %t 2dj = %t | 绿灯 = %t 红灯 = %t 黄灯 = %t,\n",
|
slog.Debug(uid.Id, "ddj", ddj.Val, "lxj", lxj.Val, "zxj", zxj.Val, "yxj", yxj.Val, "dj", dj.Val, "2dj", edj.Val, "绿灯", ld.Val, "红灯", hd.Val, "黄灯", ud.Val)
|
||||||
uid.Id, ddj.Val, lxj.Val, zxj.Val, yxj.Val, dj.Val, edj.Val, ld.Val, hd.Val, ud.Val)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
77
fi/ibp.go
Normal file
77
fi/ibp.go
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
package fi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"joylink.club/ecs"
|
||||||
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 按下按钮
|
||||||
|
func PressDownButton(w ecs.World, id string) {
|
||||||
|
w.Execute(func() {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
|
entry, ok := wd.EntityMap[id]
|
||||||
|
if ok {
|
||||||
|
state := component.BitStateType.Get(entry)
|
||||||
|
if entry.HasComponent(component.NoResetUpBtn) {
|
||||||
|
state.Val = false
|
||||||
|
} else if entry.HasComponent(component.ResetUpBtn) {
|
||||||
|
state.Val = false
|
||||||
|
} else {
|
||||||
|
state.Val = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("未找到id=%s的按钮\n", id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 抬起拉起按钮
|
||||||
|
func PressUpButton(w ecs.World, id string) {
|
||||||
|
w.Execute(func() {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
|
entry, ok := wd.EntityMap[id]
|
||||||
|
if ok {
|
||||||
|
state := component.BitStateType.Get(entry)
|
||||||
|
if entry.HasComponent(component.NoResetUpBtn) {
|
||||||
|
state.Val = true
|
||||||
|
} else if entry.HasComponent(component.ResetUpBtn) {
|
||||||
|
state.Val = true
|
||||||
|
} else {
|
||||||
|
state.Val = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Printf("未找到id=%s的按钮\n", id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改钥匙旋钮关闭状态
|
||||||
|
func PutKeyOff(w ecs.World, id string) {
|
||||||
|
w.Execute(func() {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
|
entry, ok := wd.EntityMap[id]
|
||||||
|
if ok {
|
||||||
|
state := component.BitStateType.Get(entry)
|
||||||
|
state.Val = false
|
||||||
|
} else {
|
||||||
|
fmt.Printf("未找到id=%s的钥匙开关\n", id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改钥匙旋钮开启状态
|
||||||
|
func PutKeyOn(w ecs.World, id string) {
|
||||||
|
w.Execute(func() {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
|
entry, ok := wd.EntityMap[id]
|
||||||
|
if ok {
|
||||||
|
state := component.BitStateType.Get(entry)
|
||||||
|
state.Val = true
|
||||||
|
} else {
|
||||||
|
fmt.Printf("未找到id=%s的钥匙开关\n", id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
@ -15,11 +15,8 @@ func DriveSignal3XH1Dd(w ecs.World, signalId string, dd bool) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH1ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH1LsqType.Get(signalEntry)
|
||||||
driveDd := component.RelayDriveType.Get(state.Z3XH1_DDJ)
|
lsq.Z3XH1_DDJ_Q = !dd
|
||||||
//点灯继电器落下时才点灯
|
|
||||||
driveDd.Td = !dd
|
|
||||||
driveDd.Xq = !dd
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -31,16 +28,10 @@ func DriveSignal3XH1Lx(w ecs.World, signalId string, zx bool) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH1ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH1LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH1_LXJ)
|
lsq.Z3XH1_LXJ_Q = true
|
||||||
driveLx.Td = true
|
lsq.Z3XH1_ZXJ_Q = zx
|
||||||
driveLx.Xq = true
|
lsq.Z3XH1_YXJ_Q = false
|
||||||
driveZx := component.RelayDriveType.Get(state.Z3XH1_ZXJ)
|
|
||||||
driveZx.Td = zx
|
|
||||||
driveZx.Xq = zx
|
|
||||||
driveYx := component.RelayDriveType.Get(state.Z3XH1_YXJ)
|
|
||||||
driveYx.Td = false
|
|
||||||
driveYx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -51,16 +42,10 @@ func DriveSignal3XH1Yx(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH1ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH1LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH1_LXJ)
|
lsq.Z3XH1_LXJ_Q = false
|
||||||
driveLx.Td = false
|
lsq.Z3XH1_ZXJ_Q = false
|
||||||
driveLx.Xq = false
|
lsq.Z3XH1_YXJ_Q = true
|
||||||
driveZx := component.RelayDriveType.Get(state.Z3XH1_ZXJ)
|
|
||||||
driveZx.Td = false
|
|
||||||
driveZx.Xq = false
|
|
||||||
driveYx := component.RelayDriveType.Get(state.Z3XH1_YXJ)
|
|
||||||
driveYx.Td = true
|
|
||||||
driveYx.Xq = true
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -71,16 +56,10 @@ func DriveSignal3XH1Non(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH1ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH1LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH1_LXJ)
|
lsq.Z3XH1_LXJ_Q = false
|
||||||
driveLx.Td = false
|
lsq.Z3XH1_ZXJ_Q = false
|
||||||
driveLx.Xq = false
|
lsq.Z3XH1_YXJ_Q = false
|
||||||
driveZx := component.RelayDriveType.Get(state.Z3XH1_ZXJ)
|
|
||||||
driveZx.Td = false
|
|
||||||
driveZx.Xq = false
|
|
||||||
driveYx := component.RelayDriveType.Get(state.Z3XH1_YXJ)
|
|
||||||
driveYx.Td = false
|
|
||||||
driveYx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,8 @@ func DriveSignal3XH2Dd(w ecs.World, signalId string, dd bool) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH2ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH2LsqType.Get(signalEntry)
|
||||||
driveDd := component.RelayDriveType.Get(state.Z3XH2_DDJ)
|
lsq.Z3XH2_DDJ_Q = !dd
|
||||||
//点灯继电器落下时才点灯
|
|
||||||
driveDd.Td = !dd
|
|
||||||
driveDd.Xq = !dd
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -30,13 +27,9 @@ func DriveSignal3XH2Lx(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH2ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH2LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH2_LXJ)
|
lsq.Z3XH2_LXJ_Q = true
|
||||||
driveLx.Td = true
|
lsq.Z3XH2_YXJ_Q = false
|
||||||
driveLx.Xq = true
|
|
||||||
driveYx := component.RelayDriveType.Get(state.Z3XH2_YXJ)
|
|
||||||
driveYx.Td = false
|
|
||||||
driveYx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -47,13 +40,9 @@ func DriveSignal3XH2Yx(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH2ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH2LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH2_LXJ)
|
lsq.Z3XH2_LXJ_Q = false
|
||||||
driveLx.Td = false
|
lsq.Z3XH2_YXJ_Q = true
|
||||||
driveLx.Xq = false
|
|
||||||
driveYx := component.RelayDriveType.Get(state.Z3XH2_YXJ)
|
|
||||||
driveYx.Td = true
|
|
||||||
driveYx.Xq = true
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -64,13 +53,9 @@ func DriveSignal3XH2Non(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH2ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH2LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH2_LXJ)
|
lsq.Z3XH2_LXJ_Q = false
|
||||||
driveLx.Td = false
|
lsq.Z3XH2_YXJ_Q = false
|
||||||
driveLx.Xq = false
|
|
||||||
driveYx := component.RelayDriveType.Get(state.Z3XH2_YXJ)
|
|
||||||
driveYx.Td = false
|
|
||||||
driveYx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,8 @@ func DriveSignal3XH3Dd(w ecs.World, signalId string, dd bool) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH3ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH3LsqType.Get(signalEntry)
|
||||||
driveDd := component.RelayDriveType.Get(state.Z3XH3_DDJ)
|
lsq.Z3XH3_DDJ_Q = !dd
|
||||||
//点灯继电器落下时才点灯
|
|
||||||
driveDd.Td = !dd
|
|
||||||
driveDd.Xq = !dd
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -30,13 +27,9 @@ func DriveSignal3XH3Lx(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH3ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH3LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH3_LXJ)
|
lsq.Z3XH3_LXJ_Q = true
|
||||||
driveLx.Td = true
|
lsq.Z3XH3_YXJ_Q = false
|
||||||
driveLx.Xq = true
|
|
||||||
driveYx := component.RelayDriveType.Get(state.Z3XH3_YXJ)
|
|
||||||
driveYx.Td = false
|
|
||||||
driveYx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -47,13 +40,9 @@ func DriveSignal3XH3Yx(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH3ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH3LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH3_LXJ)
|
lsq.Z3XH3_LXJ_Q = false
|
||||||
driveLx.Td = false
|
lsq.Z3XH3_YXJ_Q = true
|
||||||
driveLx.Xq = false
|
|
||||||
driveYx := component.RelayDriveType.Get(state.Z3XH3_YXJ)
|
|
||||||
driveYx.Td = true
|
|
||||||
driveYx.Xq = true
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -64,13 +53,9 @@ func DriveSignal3XH3Non(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH3ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH3LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH3_LXJ)
|
lsq.Z3XH3_LXJ_Q = false
|
||||||
driveLx.Td = false
|
lsq.Z3XH3_YXJ_Q = false
|
||||||
driveLx.Xq = false
|
|
||||||
driveYx := component.RelayDriveType.Get(state.Z3XH3_YXJ)
|
|
||||||
driveYx.Td = false
|
|
||||||
driveYx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,8 @@ func DriveSignal3XH4Dd(w ecs.World, signalId string, dd bool) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH4ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH4LsqType.Get(signalEntry)
|
||||||
driveDd := component.RelayDriveType.Get(state.Z3XH4_DDJ)
|
lsq.Z3XH4_DDJ_Q = !dd
|
||||||
//点灯继电器落下时才点灯
|
|
||||||
driveDd.Td = !dd
|
|
||||||
driveDd.Xq = !dd
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -31,13 +28,9 @@ func DriveSignal3XH4Lx(w ecs.World, signalId string, zx bool) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH4ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH4LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH4_LXJ)
|
lsq.Z3XH4_LXJ_Q = true
|
||||||
driveLx.Td = true
|
lsq.Z3XH4_ZXJ_Q = zx
|
||||||
driveLx.Xq = true
|
|
||||||
driveZx := component.RelayDriveType.Get(state.Z3XH4_ZXJ)
|
|
||||||
driveZx.Td = zx
|
|
||||||
driveZx.Xq = zx
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -48,13 +41,9 @@ func DriveSignal3XH4Non(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.Signal3XH4ElectronicType.Get(signalEntry)
|
lsq := component.Signal3XH4LsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.Z3XH4_LXJ)
|
lsq.Z3XH4_LXJ_Q = false
|
||||||
driveLx.Td = false
|
lsq.Z3XH4_ZXJ_Q = false
|
||||||
driveLx.Xq = false
|
|
||||||
driveZx := component.RelayDriveType.Get(state.Z3XH4_ZXJ)
|
|
||||||
driveZx.Td = false
|
|
||||||
driveZx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,8 @@ func DriveSignalDCXHDx(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.SignalDCXHElectronicType.Get(signalEntry)
|
lsq := component.SignalDCXHLsqType.Get(signalEntry)
|
||||||
driveDx := component.RelayDriveType.Get(state.DCXH_DXJ)
|
lsq.DCXH_DXJ_Q = true
|
||||||
driveDx.Td = true
|
|
||||||
driveDx.Xq = true
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -28,10 +26,8 @@ func DriveSignalDCXHNon(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.SignalDCXHElectronicType.Get(signalEntry)
|
lsq := component.SignalDCXHLsqType.Get(signalEntry)
|
||||||
driveDx := component.RelayDriveType.Get(state.DCXH_DXJ)
|
lsq.DCXH_DXJ_Q = false
|
||||||
driveDx.Td = false
|
|
||||||
driveDx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,9 @@ func DriveSignalJCKXHLx(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.SignalJCKXHElectronicType.Get(signalEntry)
|
lsq := component.SignalJCKXHLsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.JCKXH_LXJ)
|
lsq.JCKXH_LXJ_Q = true
|
||||||
driveLx.Td = true
|
lsq.JCKXH_DXJ_Q = false
|
||||||
driveLx.Xq = true
|
|
||||||
driveDx := component.RelayDriveType.Get(state.JCKXH_DXJ)
|
|
||||||
driveDx.Td = false
|
|
||||||
driveDx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -31,13 +27,9 @@ func DriveSignalJCKXHDx(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.SignalJCKXHElectronicType.Get(signalEntry)
|
lsq := component.SignalJCKXHLsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.JCKXH_LXJ)
|
lsq.JCKXH_LXJ_Q = false
|
||||||
driveLx.Td = false
|
lsq.JCKXH_DXJ_Q = true
|
||||||
driveLx.Xq = false
|
|
||||||
driveDx := component.RelayDriveType.Get(state.JCKXH_DXJ)
|
|
||||||
driveDx.Td = true
|
|
||||||
driveDx.Xq = true
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -48,13 +40,9 @@ func DriveSignalJCKXHNon(w ecs.World, signalId string) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
signalEntry, ok := wd.EntityMap[signalId]
|
signalEntry, ok := wd.EntityMap[signalId]
|
||||||
if ok {
|
if ok {
|
||||||
state := component.SignalJCKXHElectronicType.Get(signalEntry)
|
lsq := component.SignalJCKXHLsqType.Get(signalEntry)
|
||||||
driveLx := component.RelayDriveType.Get(state.JCKXH_LXJ)
|
lsq.JCKXH_LXJ_Q = false
|
||||||
driveLx.Td = false
|
lsq.JCKXH_DXJ_Q = false
|
||||||
driveLx.Xq = false
|
|
||||||
driveDx := component.RelayDriveType.Get(state.JCKXH_DXJ)
|
|
||||||
driveDx.Td = false
|
|
||||||
driveDx.Xq = false
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -5,32 +5,71 @@ import (
|
|||||||
|
|
||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/component/component_proto"
|
||||||
"joylink.club/rtsssimulation/entity"
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 道岔功能接口
|
// 道岔功能接口
|
||||||
|
|
||||||
|
// 设置道岔故障
|
||||||
|
func SetTurnoutFault(w ecs.World, id string, fault component_proto.Turnout_Fault) error {
|
||||||
|
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
|
entry, ok := wd.EntityMap[id]
|
||||||
|
if ok {
|
||||||
|
ct := component.GetTurnoutFaultType(fault)
|
||||||
|
if !entry.HasComponent(ct) {
|
||||||
|
entry.AddComponent(ct)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的道岔", id))
|
||||||
|
}
|
||||||
|
return ecs.NewOkEmptyResult()
|
||||||
|
})
|
||||||
|
return result.Err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消道岔故障
|
||||||
|
func CancleTurnoutFault(w ecs.World, id string, fault component_proto.Turnout_Fault) error {
|
||||||
|
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
|
entry, ok := wd.EntityMap[id]
|
||||||
|
if ok {
|
||||||
|
ct := component.GetTurnoutFaultType(fault)
|
||||||
|
if entry.HasComponent(ct) {
|
||||||
|
entry.RemoveComponent(ct)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的道岔", id))
|
||||||
|
}
|
||||||
|
return ecs.NewOkEmptyResult()
|
||||||
|
})
|
||||||
|
return result.Err
|
||||||
|
}
|
||||||
|
|
||||||
// 驱动道岔转辙机
|
// 驱动道岔转辙机
|
||||||
// id - 道岔uid
|
// id - 道岔uid
|
||||||
// dc - 定操/反操
|
// dc - 定操/反操
|
||||||
// on - 设置/取消
|
// on - 设置/取消
|
||||||
func driveTurnoutZzj(w ecs.World, id string, dc bool, on bool) {
|
func driveTurnoutZzj(w ecs.World, id string, dc bool, on bool) error {
|
||||||
w.Execute(func() {
|
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
entry, ok := wd.EntityMap[id]
|
entry, ok := wd.EntityMap[id]
|
||||||
if ok {
|
if ok {
|
||||||
if entry.HasComponent(component.Zdj9TwoElectronicType) { // 有电路,驱动继电器
|
if entry.HasComponent(component.Zdj9TwoDriveType) { // 有电路,驱动继电器
|
||||||
zdj9 := component.Zdj9TwoElectronicType.Get(entry)
|
drive := component.Zdj9TwoDriveType.Get(entry)
|
||||||
ycj := component.RelayDriveType.Get(zdj9.TDC_YCJ)
|
|
||||||
dcj := component.RelayDriveType.Get(zdj9.TDC_DCJ)
|
|
||||||
fcj := component.RelayDriveType.Get(zdj9.TDC_FCJ)
|
|
||||||
ycj.Td = on
|
|
||||||
if dc {
|
if dc {
|
||||||
dcj.Td = on
|
drive.YCJ = on
|
||||||
fcj.Td = !on
|
drive.DCJ = on
|
||||||
|
if on {
|
||||||
|
drive.FCJ = !on
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dcj.Td = !on
|
drive.YCJ = on
|
||||||
fcj.Td = on
|
drive.FCJ = on
|
||||||
|
if on {
|
||||||
|
drive.DCJ = !on
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else { // 无电路,直接驱动转辙机
|
} else { // 无电路,直接驱动转辙机
|
||||||
tz := component.TurnoutZzjType.Get(entry)
|
tz := component.TurnoutZzjType.Get(entry)
|
||||||
@ -45,27 +84,29 @@ func driveTurnoutZzj(w ecs.World, id string, dc bool, on bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("未找到id=", id, "的道岔")
|
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的道岔", id))
|
||||||
}
|
}
|
||||||
|
return ecs.NewOkEmptyResult()
|
||||||
})
|
})
|
||||||
|
return result.Err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置道岔转辙机定操
|
// 设置道岔转辙机定操
|
||||||
func DriveTurnoutDCOn(w ecs.World, id string) {
|
func DriveTurnoutDCOn(w ecs.World, id string) error {
|
||||||
driveTurnoutZzj(w, id, true /* dc */, true /* on */)
|
return driveTurnoutZzj(w, id, true /* dc */, true /* on */)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消道岔转辙机定操
|
// 取消道岔转辙机定操
|
||||||
func DriveTurnoutDCOff(w ecs.World, id string) {
|
func DriveTurnoutDCOff(w ecs.World, id string) error {
|
||||||
driveTurnoutZzj(w, id, true /* dc */, false /* on */)
|
return driveTurnoutZzj(w, id, true /* dc */, false /* on */)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置道岔转辙机反操
|
// 设置道岔转辙机反操
|
||||||
func DriveTurnoutFCOn(w ecs.World, id string) {
|
func DriveTurnoutFCOn(w ecs.World, id string) error {
|
||||||
driveTurnoutZzj(w, id, false /* dc */, true /* on */)
|
return driveTurnoutZzj(w, id, false /* dc */, true /* on */)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消道岔转辙机反操
|
// 取消道岔转辙机反操
|
||||||
func DriveTurnoutFCOff(w ecs.World, id string) {
|
func DriveTurnoutFCOff(w ecs.World, id string) error {
|
||||||
driveTurnoutZzj(w, id, false /* dc */, false /* on */)
|
return driveTurnoutZzj(w, id, false /* dc */, false /* on */)
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit e7797346722a572814539d9a453789b89ffe6bf4
|
Subproject commit 37e06d2aaf64828da677131dfb790bd0de7cef56
|
@ -6,23 +6,23 @@ option go_package = "./component/component_proto";
|
|||||||
|
|
||||||
// 两个稳态位置转换组件
|
// 两个稳态位置转换组件
|
||||||
message TwoPositionTransform {
|
message TwoPositionTransform {
|
||||||
int32 Pos = 1; // 当前位置百分比,[0, 10000],两位小数
|
int32 pos = 1; // 当前位置百分比,[0, 10000],两位小数
|
||||||
int32 Speed = 2;
|
int32 speed = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 仅有两状态的组件
|
// 仅有两状态的组件
|
||||||
message BitState {
|
message BitState {
|
||||||
bool Val = 1;
|
bool val = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计数/计时组件
|
// 计数/计时组件
|
||||||
message Counter {
|
message Counter {
|
||||||
int32 Val = 1;
|
int32 val = 1;
|
||||||
int32 Step = 2;
|
int32 step = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 倒数/倒计时组件
|
// 倒数/倒计时组件
|
||||||
message CounterDown {
|
message CounterDown {
|
||||||
int32 Val = 1;
|
int32 val = 1;
|
||||||
int32 Step = 2;
|
int32 step = 2;
|
||||||
}
|
}
|
||||||
|
48
proto/src/component/turnout.proto
Normal file
48
proto/src/component/turnout.proto
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package component;
|
||||||
|
|
||||||
|
option go_package = "./component/component_proto";
|
||||||
|
|
||||||
|
// 道岔位置状态表示组件
|
||||||
|
message TurnoutPosition {
|
||||||
|
// 是否在定位(实际位置)
|
||||||
|
bool dw = 1;
|
||||||
|
// 是否在反位(实际位置)
|
||||||
|
bool fw = 2;
|
||||||
|
|
||||||
|
// 定表
|
||||||
|
bool db = 3;
|
||||||
|
// 反表
|
||||||
|
bool fb = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 道岔故障
|
||||||
|
message Turnout {
|
||||||
|
enum Fault {
|
||||||
|
// 失表
|
||||||
|
SB = 0;
|
||||||
|
// 定位失表
|
||||||
|
DWSB = 1;
|
||||||
|
// 反位失表
|
||||||
|
FWSB = 2;
|
||||||
|
}
|
||||||
|
repeated Fault fault = 1;
|
||||||
|
}
|
||||||
|
// 道岔失表故障
|
||||||
|
message TurnoutFaultSB {
|
||||||
|
|
||||||
|
}
|
||||||
|
// 道岔定位失表故障
|
||||||
|
message TurnoutFaultDwsb {
|
||||||
|
|
||||||
|
}
|
||||||
|
// 道岔反位失表故障
|
||||||
|
message TurnoutFaultFwsb {
|
||||||
|
|
||||||
|
}
|
||||||
|
// 道岔挤岔故障
|
||||||
|
message TurnoutFaultJc {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -111,6 +111,8 @@ enum DeviceType {
|
|||||||
DeviceType_Relay = 10;
|
DeviceType_Relay = 10;
|
||||||
DeviceType_PhaseFailureProtector = 11;
|
DeviceType_PhaseFailureProtector = 11;
|
||||||
DeviceType_Button = 12;
|
DeviceType_Button = 12;
|
||||||
|
DeviceType_Light = 13;
|
||||||
|
DeviceType_Alarm = 14;
|
||||||
DeviceType_Psd = 13;
|
DeviceType_Psd = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +180,7 @@ message ElectronicComponentGroup {
|
|||||||
repeated string componentIds = 2; //组合内电子元件的id
|
repeated string componentIds = 2; //组合内电子元件的id
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按钮
|
// 开关、按钮、旋钮
|
||||||
message Button {
|
message Button {
|
||||||
enum ButtonType {
|
enum ButtonType {
|
||||||
Unknown = 0;
|
Unknown = 0;
|
||||||
@ -186,7 +188,9 @@ message Button {
|
|||||||
NO_Reset_Up = 2;
|
NO_Reset_Up = 2;
|
||||||
Reset_Press = 3;
|
Reset_Press = 3;
|
||||||
Reset_Up = 4;
|
Reset_Up = 4;
|
||||||
|
Key_Knob = 5;
|
||||||
}
|
}
|
||||||
string id = 1;
|
string id = 1;
|
||||||
ButtonType buttonType = 2;
|
string code = 2;
|
||||||
|
ButtonType buttonType = 3;
|
||||||
}
|
}
|
@ -4,13 +4,22 @@ import "joylink.club/rtsssimulation/repository/model/proto"
|
|||||||
|
|
||||||
type Button struct {
|
type Button struct {
|
||||||
Identity
|
Identity
|
||||||
|
code string
|
||||||
buttonType proto.Button_ButtonType
|
buttonType proto.Button_ButtonType
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewButton(id string, buttonType proto.Button_ButtonType) *Button {
|
func NewButton(id string, code string, buttonType proto.Button_ButtonType) *Button {
|
||||||
return &Button{
|
return &Button{
|
||||||
Identity: identity{id, proto.DeviceType_DeviceType_Button},
|
Identity: identity{id, proto.DeviceType_DeviceType_Button},
|
||||||
|
code: code,
|
||||||
buttonType: buttonType,
|
buttonType: buttonType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (btn *Button) GetBtnType() proto.Button_ButtonType {
|
||||||
|
return btn.buttonType
|
||||||
|
}
|
||||||
|
|
||||||
|
func (btn *Button) GetCode() string {
|
||||||
|
return btn.code
|
||||||
|
}
|
||||||
|
19
repository/fmq.go
Normal file
19
repository/fmq.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
import "joylink.club/rtsssimulation/repository/model/proto"
|
||||||
|
|
||||||
|
type Alarm struct {
|
||||||
|
Identity
|
||||||
|
code string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAlarm(id string, code string) *Alarm {
|
||||||
|
return &Alarm{
|
||||||
|
Identity: identity{id, proto.DeviceType_DeviceType_Alarm},
|
||||||
|
code: code,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Alarm) Code() string {
|
||||||
|
return a.code
|
||||||
|
}
|
63
repository/ibp.go
Normal file
63
repository/ibp.go
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package repository
|
||||||
|
|
||||||
|
type IBP struct {
|
||||||
|
Spk *IBPRefMap
|
||||||
|
Emp *IBPRefMap
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIBP(id string) *IBP {
|
||||||
|
return &IBP{
|
||||||
|
Spk: &IBPRefMap{
|
||||||
|
buttonMap: make(map[string]*Button),
|
||||||
|
relayMap: make(map[string]*Relay),
|
||||||
|
alarmMap: make(map[string]*Alarm),
|
||||||
|
},
|
||||||
|
Emp: &IBPRefMap{
|
||||||
|
buttonMap: make(map[string]*Button),
|
||||||
|
relayMap: make(map[string]*Relay),
|
||||||
|
alarmMap: make(map[string]*Alarm),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type IBPRefMap struct {
|
||||||
|
buttonMap map[string]*Button
|
||||||
|
relayMap map[string]*Relay
|
||||||
|
alarmMap map[string]*Alarm
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ibp *IBPRefMap) AddButton(btn *Button) {
|
||||||
|
ibp.buttonMap[btn.Id()] = btn
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ibp *IBPRefMap) AddRelay(relay *Relay) {
|
||||||
|
ibp.relayMap[relay.Id()] = relay
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ibp *IBPRefMap) AddAlarm(fmq *Alarm) {
|
||||||
|
ibp.alarmMap[fmq.Id()] = fmq
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ibp *IBPRefMap) Buttons() []*Button {
|
||||||
|
var buttons []*Button
|
||||||
|
for _, b := range ibp.buttonMap {
|
||||||
|
buttons = append(buttons, b)
|
||||||
|
}
|
||||||
|
return buttons
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ibp *IBPRefMap) Relays() []*Relay {
|
||||||
|
var relays []*Relay
|
||||||
|
for _, b := range ibp.relayMap {
|
||||||
|
relays = append(relays, b)
|
||||||
|
}
|
||||||
|
return relays
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ibp *IBPRefMap) Alarms() []*Alarm {
|
||||||
|
var alarms []*Alarm
|
||||||
|
for _, b := range ibp.alarmMap {
|
||||||
|
alarms = append(alarms, b)
|
||||||
|
}
|
||||||
|
return alarms
|
||||||
|
}
|
@ -36,6 +36,8 @@ const (
|
|||||||
DeviceType_DeviceType_Relay DeviceType = 10
|
DeviceType_DeviceType_Relay DeviceType = 10
|
||||||
DeviceType_DeviceType_PhaseFailureProtector DeviceType = 11
|
DeviceType_DeviceType_PhaseFailureProtector DeviceType = 11
|
||||||
DeviceType_DeviceType_Button DeviceType = 12
|
DeviceType_DeviceType_Button DeviceType = 12
|
||||||
|
DeviceType_DeviceType_Light DeviceType = 13
|
||||||
|
DeviceType_DeviceType_Alarm DeviceType = 14
|
||||||
DeviceType_DeviceType_Psd DeviceType = 13
|
DeviceType_DeviceType_Psd DeviceType = 13
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -55,6 +57,8 @@ var (
|
|||||||
10: "DeviceType_Relay",
|
10: "DeviceType_Relay",
|
||||||
11: "DeviceType_PhaseFailureProtector",
|
11: "DeviceType_PhaseFailureProtector",
|
||||||
12: "DeviceType_Button",
|
12: "DeviceType_Button",
|
||||||
|
13: "DeviceType_Light",
|
||||||
|
14: "DeviceType_Alarm",
|
||||||
13: "DeviceType_Psd",
|
13: "DeviceType_Psd",
|
||||||
}
|
}
|
||||||
DeviceType_value = map[string]int32{
|
DeviceType_value = map[string]int32{
|
||||||
@ -71,6 +75,8 @@ var (
|
|||||||
"DeviceType_Relay": 10,
|
"DeviceType_Relay": 10,
|
||||||
"DeviceType_PhaseFailureProtector": 11,
|
"DeviceType_PhaseFailureProtector": 11,
|
||||||
"DeviceType_Button": 12,
|
"DeviceType_Button": 12,
|
||||||
|
"DeviceType_Light": 13,
|
||||||
|
"DeviceType_Alarm": 14,
|
||||||
"DeviceType_Psd": 13,
|
"DeviceType_Psd": 13,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -375,6 +381,7 @@ const (
|
|||||||
Button_NO_Reset_Up Button_ButtonType = 2
|
Button_NO_Reset_Up Button_ButtonType = 2
|
||||||
Button_Reset_Press Button_ButtonType = 3
|
Button_Reset_Press Button_ButtonType = 3
|
||||||
Button_Reset_Up Button_ButtonType = 4
|
Button_Reset_Up Button_ButtonType = 4
|
||||||
|
Button_Key_Knob Button_ButtonType = 5
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for Button_ButtonType.
|
// Enum value maps for Button_ButtonType.
|
||||||
@ -385,6 +392,7 @@ var (
|
|||||||
2: "NO_Reset_Up",
|
2: "NO_Reset_Up",
|
||||||
3: "Reset_Press",
|
3: "Reset_Press",
|
||||||
4: "Reset_Up",
|
4: "Reset_Up",
|
||||||
|
5: "Key_Knob",
|
||||||
}
|
}
|
||||||
Button_ButtonType_value = map[string]int32{
|
Button_ButtonType_value = map[string]int32{
|
||||||
"Unknown": 0,
|
"Unknown": 0,
|
||||||
@ -392,6 +400,7 @@ var (
|
|||||||
"NO_Reset_Up": 2,
|
"NO_Reset_Up": 2,
|
||||||
"Reset_Press": 3,
|
"Reset_Press": 3,
|
||||||
"Reset_Up": 4,
|
"Reset_Up": 4,
|
||||||
|
"Key_Knob": 5,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1524,14 +1533,15 @@ func (x *ElectronicComponentGroup) GetComponentIds() []string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 按钮
|
// 开关、按钮、旋钮
|
||||||
type Button struct {
|
type Button struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
ButtonType Button_ButtonType `protobuf:"varint,2,opt,name=buttonType,proto3,enum=model.Button_ButtonType" json:"buttonType,omitempty"`
|
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
|
||||||
|
ButtonType Button_ButtonType `protobuf:"varint,3,opt,name=buttonType,proto3,enum=model.Button_ButtonType" json:"buttonType,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Button) Reset() {
|
func (x *Button) Reset() {
|
||||||
@ -1573,6 +1583,13 @@ func (x *Button) GetId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Button) GetCode() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Code
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *Button) GetButtonType() Button_ButtonType {
|
func (x *Button) GetButtonType() Button_ButtonType {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.ButtonType
|
return x.ButtonType
|
||||||
@ -1817,6 +1834,124 @@ var file_model_proto_rawDesc = []byte{
|
|||||||
0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x42, 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x72, 0x65, 0x70, 0x6f,
|
0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x42, 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x72, 0x65, 0x70, 0x6f,
|
||||||
0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f,
|
0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f,
|
||||||
0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
0x22, 0x92, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72,
|
||||||
|
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
||||||
|
0x12, 0x20, 0x0a, 0x02, 0x6b, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d,
|
||||||
|
0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x02,
|
||||||
|
0x6b, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18,
|
||||||
|
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64,
|
||||||
|
0x12, 0x33, 0x0a, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x18,
|
||||||
|
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65,
|
||||||
|
0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0b, 0x74, 0x75, 0x72, 0x6e, 0x6f, 0x75,
|
||||||
|
0x74, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x53, 0x0a, 0x05, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x0e,
|
||||||
|
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22,
|
||||||
|
0x0a, 0x03, 0x6b, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f,
|
||||||
|
0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b,
|
||||||
|
0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x18, 0x03, 0x20, 0x01,
|
||||||
|
0x28, 0x05, 0x52, 0x06, 0x64, 0x65, 0x67, 0x72, 0x65, 0x65, 0x22, 0x60, 0x0a, 0x12, 0x53, 0x65,
|
||||||
|
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65,
|
||||||
|
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
|
||||||
|
0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e,
|
||||||
|
0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52,
|
||||||
|
0x03, 0x6b, 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x18, 0x03,
|
||||||
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x22, 0x7c, 0x0a, 0x0a,
|
||||||
|
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65,
|
||||||
|
0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65,
|
||||||
|
0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65,
|
||||||
|
0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64,
|
||||||
|
0x65, 0x6c, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64,
|
||||||
|
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x70, 0x6f, 0x72,
|
||||||
|
0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e,
|
||||||
|
0x50, 0x6f, 0x72, 0x74, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x7d, 0x0a, 0x09, 0x4b, 0x69,
|
||||||
|
0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||||
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a,
|
||||||
|
0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65,
|
||||||
|
0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x69, 0x6e,
|
||||||
|
0x61, 0x74, 0x65, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x12, 0x2e, 0x0a, 0x09, 0x64, 0x69, 0x72,
|
||||||
|
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, 0x2e, 0x6d,
|
||||||
|
0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09,
|
||||||
|
0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x78, 0x0a, 0x10, 0x4b, 0x69, 0x6c,
|
||||||
|
0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x22, 0x0a,
|
||||||
|
0x03, 0x6b, 0x6d, 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64,
|
||||||
|
0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x52, 0x03, 0x6b, 0x6d,
|
||||||
|
0x41, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x6d, 0x42, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10,
|
||||||
|
0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x4b, 0x69, 0x6c, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72,
|
||||||
|
0x52, 0x03, 0x6b, 0x6d, 0x42, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72, 0x65,
|
||||||
|
0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x72,
|
||||||
|
0x65, 0x6e, 0x64, 0x22, 0xeb, 0x01, 0x0a, 0x05, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x0e, 0x0a,
|
||||||
|
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
||||||
|
0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
|
||||||
|
0x65, 0x12, 0x28, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e,
|
||||||
|
0x32, 0x12, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x4d,
|
||||||
|
0x6f, 0x64, 0x65, 0x6c, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x22, 0x93, 0x01, 0x0a, 0x05,
|
||||||
|
0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e,
|
||||||
|
0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x50, 0x58, 0x43, 0x5f, 0x31, 0x30, 0x30, 0x30, 0x10,
|
||||||
|
0x01, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x50, 0x58, 0x43, 0x5f, 0x31, 0x37, 0x30, 0x30, 0x10, 0x02,
|
||||||
|
0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x57, 0x4a, 0x58, 0x43, 0x5f, 0x34, 0x38, 0x30, 0x10, 0x03, 0x12,
|
||||||
|
0x11, 0x0a, 0x0d, 0x4a, 0x57, 0x4a, 0x58, 0x43, 0x5f, 0x48, 0x31, 0x32, 0x35, 0x5f, 0x38, 0x30,
|
||||||
|
0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x57, 0x58, 0x43, 0x5f, 0x31, 0x37, 0x30, 0x30, 0x10,
|
||||||
|
0x05, 0x12, 0x0d, 0x0a, 0x09, 0x4a, 0x57, 0x58, 0x43, 0x5f, 0x48, 0x33, 0x34, 0x30, 0x10, 0x06,
|
||||||
|
0x12, 0x11, 0x0a, 0x0d, 0x4a, 0x59, 0x4a, 0x58, 0x43, 0x5f, 0x31, 0x36, 0x30, 0x5f, 0x32, 0x36,
|
||||||
|
0x30, 0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08, 0x4a, 0x5a, 0x58, 0x43, 0x5f, 0x48, 0x31, 0x38, 0x10,
|
||||||
|
0x08, 0x22, 0x3b, 0x0a, 0x15, 0x50, 0x68, 0x61, 0x73, 0x65, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72,
|
||||||
|
0x65, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||||
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
|
||||||
|
0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x52,
|
||||||
|
0x0a, 0x18, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70,
|
||||||
|
0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f,
|
||||||
|
0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x22,
|
||||||
|
0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x73, 0x18, 0x02,
|
||||||
|
0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49,
|
||||||
|
0x64, 0x73, 0x22, 0xd3, 0x01, 0x0a, 0x06, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x0e, 0x0a,
|
||||||
|
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
||||||
|
0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
|
||||||
|
0x65, 0x12, 0x38, 0x0a, 0x0a, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18,
|
||||||
|
0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x42, 0x75,
|
||||||
|
0x74, 0x74, 0x6f, 0x6e, 0x2e, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52,
|
||||||
|
0x0a, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x6b, 0x0a, 0x0a, 0x42,
|
||||||
|
0x75, 0x74, 0x74, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b,
|
||||||
|
0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x4e, 0x4f, 0x5f, 0x52, 0x65, 0x73,
|
||||||
|
0x65, 0x74, 0x5f, 0x50, 0x72, 0x65, 0x73, 0x73, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f,
|
||||||
|
0x5f, 0x52, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x55, 0x70, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x52,
|
||||||
|
0x65, 0x73, 0x65, 0x74, 0x5f, 0x50, 0x72, 0x65, 0x73, 0x73, 0x10, 0x03, 0x12, 0x0c, 0x0a, 0x08,
|
||||||
|
0x52, 0x65, 0x73, 0x65, 0x74, 0x5f, 0x55, 0x70, 0x10, 0x04, 0x12, 0x0c, 0x0a, 0x08, 0x4b, 0x65,
|
||||||
|
0x79, 0x5f, 0x4b, 0x6e, 0x6f, 0x62, 0x10, 0x05, 0x2a, 0x90, 0x03, 0x0a, 0x0a, 0x44, 0x65, 0x76,
|
||||||
|
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63,
|
||||||
|
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12,
|
||||||
|
0x1e, 0x0a, 0x1a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x68,
|
||||||
|
0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12,
|
||||||
|
0x19, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x68,
|
||||||
|
0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65,
|
||||||
|
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74,
|
||||||
|
0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
|
||||||
|
0x5f, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x65, 0x76,
|
||||||
|
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
|
0x64, 0x65, 0x72, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
|
||||||
|
0x79, 0x70, 0x65, 0x5f, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x10, 0x06, 0x12, 0x21, 0x0a, 0x1d, 0x44,
|
||||||
|
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
||||||
|
0x6e, 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x10, 0x07, 0x12, 0x13,
|
||||||
|
0x0a, 0x0f, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x6e,
|
||||||
|
0x6b, 0x10, 0x08, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
|
||||||
|
0x65, 0x5f, 0x4c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10,
|
||||||
|
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x52, 0x65, 0x6c, 0x61, 0x79,
|
||||||
|
0x10, 0x0a, 0x12, 0x24, 0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
|
||||||
|
0x5f, 0x50, 0x68, 0x61, 0x73, 0x65, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f,
|
||||||
|
0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x10, 0x0b, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69,
|
||||||
|
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x10, 0x0c, 0x12,
|
||||||
|
0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69,
|
||||||
|
0x67, 0x68, 0x74, 0x10, 0x0d, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
|
||||||
|
0x79, 0x70, 0x65, 0x5f, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x10, 0x0e, 0x2a, 0x25, 0x0a, 0x04, 0x50,
|
||||||
|
0x6f, 0x72, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x05, 0x0a,
|
||||||
|
0x01, 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x43,
|
||||||
|
0x10, 0x03, 0x2a, 0x20, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||||
|
0x08, 0x0a, 0x04, 0x4c, 0x45, 0x46, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47,
|
||||||
|
0x48, 0x54, 0x10, 0x01, 0x2a, 0x43, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69,
|
||||||
|
0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x61,
|
||||||
|
0x72, 0x79, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e,
|
||||||
|
0x74, 0x65, 0x72, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x75, 0x6c, 0x61, 0x74,
|
||||||
|
0x65, 0x64, 0x4a, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x42, 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x72,
|
||||||
|
0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f,
|
||||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -87,7 +87,7 @@ func buildModels(source *proto.Repository, repository *Repository) {
|
|||||||
repository.phaseFailureProtectorMap[m.Id()] = m
|
repository.phaseFailureProtectorMap[m.Id()] = m
|
||||||
}
|
}
|
||||||
for _, protoData := range source.Buttons {
|
for _, protoData := range source.Buttons {
|
||||||
m := NewButton(protoData.Id, protoData.ButtonType)
|
m := NewButton(protoData.Id, protoData.Code, protoData.ButtonType)
|
||||||
repository.buttonMap[m.Id()] = m
|
repository.buttonMap[m.Id()] = m
|
||||||
}
|
}
|
||||||
for _, protoData := range source.Psds {
|
for _, protoData := range source.Psds {
|
||||||
|
@ -15,10 +15,8 @@ type IBPSys struct {
|
|||||||
func NewIBPSys() *IBPSys {
|
func NewIBPSys() *IBPSys {
|
||||||
return &IBPSys{
|
return &IBPSys{
|
||||||
query: ecs.NewQuery(filter.Contains(
|
query: ecs.NewQuery(filter.Contains(
|
||||||
component.SpkControlElectronicType,
|
component.SpkElectronicType, component.SpkCollectStateType,
|
||||||
component.SpksStateElectronicType,
|
component.EmpElectronicType, component.EmpCollectStateType,
|
||||||
component.EmpControlElectronicType,
|
|
||||||
component.EmpStateElectronicType,
|
|
||||||
)),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -26,31 +24,33 @@ func NewIBPSys() *IBPSys {
|
|||||||
// 控制电路更新
|
// 控制电路更新
|
||||||
func (ibp *IBPSys) Update(w ecs.World) {
|
func (ibp *IBPSys) Update(w ecs.World) {
|
||||||
ibp.query.Each(w, func(entry *ecs.Entry) {
|
ibp.query.Each(w, func(entry *ecs.Entry) {
|
||||||
ibp.spkControl(entry)
|
spkState := component.SpkElectronicType.Get(entry)
|
||||||
ibp.spksState(entry)
|
ibp.spkControl(entry, spkState)
|
||||||
ibp.empControl(entry)
|
ibp.spksState(entry, spkState)
|
||||||
ibp.empState(entry)
|
ibp.spkCollect(entry, spkState)
|
||||||
|
empState := component.EmpElectronicType.Get(entry)
|
||||||
|
ibp.empControl(entry, empState)
|
||||||
|
ibp.empState(entry, empState)
|
||||||
|
ibp.empCollect(entry, empState)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 人员防护继电器控制电路逻辑
|
// 人员防护继电器控制电路逻辑
|
||||||
func (ibp *IBPSys) spkControl(entry *ecs.Entry) {
|
func (ibp *IBPSys) spkControl(entry *ecs.Entry, spkState *component.SpkElectronic) {
|
||||||
spkState := component.SpkControlElectronicType.Get(entry)
|
|
||||||
spksxplaBtn := getBtnVal(spkState.SPKSXPLA_BTN)
|
spksxplaBtn := getBtnVal(spkState.SPKSXPLA_BTN)
|
||||||
// spksx1j 通电状态
|
// spksx1j 通电状态
|
||||||
setRelayTdVal(spkState.SPKSX1J, spksxplaBtn || getBtnVal(spkState.SPKSX1J_BTN))
|
setRelayTdVal(spkState.SPKSX1J, spksxplaBtn || getBtnVal(spkState.SPKSX1J_KEY))
|
||||||
// spksx3j 通电状态
|
// spksx3j 通电状态
|
||||||
setRelayTdVal(spkState.SPKSX3J, spksxplaBtn || getBtnVal(spkState.SPKSX3J_BTN))
|
setRelayTdVal(spkState.SPKSX3J, spksxplaBtn || getBtnVal(spkState.SPKSX3J_KEY))
|
||||||
spkssplaBtn := getBtnVal(spkState.SPKSSPLA_BTN)
|
spkssplaBtn := getBtnVal(spkState.SPKSSPLA_BTN)
|
||||||
// spkss2j 通电状态
|
// spkss2j 通电状态
|
||||||
setRelayTdVal(spkState.SPKSS2J, spkssplaBtn || getBtnVal(spkState.SPKSS2J_BTN))
|
setRelayTdVal(spkState.SPKSS2J, spkssplaBtn || getBtnVal(spkState.SPKSS2J_KEY))
|
||||||
// spkss4j 通电状态
|
// spkss4j 通电状态
|
||||||
setRelayTdVal(spkState.SPKSS4J, spkssplaBtn || getBtnVal(spkState.SPKSS4J_BTN))
|
setRelayTdVal(spkState.SPKSS4J, spkssplaBtn || getBtnVal(spkState.SPKSS4J_KEY))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 人员防护表示状态电路逻辑
|
// 人员防护表示状态电路逻辑
|
||||||
func (ibp *IBPSys) spksState(entry *ecs.Entry) {
|
func (ibp *IBPSys) spksState(entry *ecs.Entry, spkState *component.SpkElectronic) {
|
||||||
spkState := component.SpksStateElectronicType.Get(entry)
|
|
||||||
sda := getBtnVal(spkState.SDA)
|
sda := getBtnVal(spkState.SDA)
|
||||||
// SPKSXPLAJ
|
// SPKSXPLAJ
|
||||||
spksxplaj := component.RelayDriveType.Get(spkState.SPKSXPLAJ)
|
spksxplaj := component.RelayDriveType.Get(spkState.SPKSXPLAJ)
|
||||||
@ -72,9 +72,19 @@ func (ibp *IBPSys) spksState(entry *ecs.Entry) {
|
|||||||
setLightTdVal(spkState.SPKSS4D, sda || !spkss4j.Xq)
|
setLightTdVal(spkState.SPKSS4D, sda || !spkss4j.Xq)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 人员防护继电器采集电路状态逻辑
|
||||||
|
func (ibp *IBPSys) spkCollect(entry *ecs.Entry, spkState *component.SpkElectronic) {
|
||||||
|
collectState := component.SpkCollectStateType.Get(entry)
|
||||||
|
collectState.SPKSX1J_XQ = getRelayXqVal(spkState.SPKSX1J)
|
||||||
|
collectState.SPKSX3J_XQ = getRelayXqVal(spkState.SPKSX3J)
|
||||||
|
collectState.SPKSS2J_XQ = getRelayXqVal(spkState.SPKSS2J)
|
||||||
|
collectState.SPKSS4J_XQ = getRelayXqVal(spkState.SPKSS4J)
|
||||||
|
collectState.SPKSXPLA_XQ = getRelayXqVal(spkState.SPKSXPLAJ)
|
||||||
|
collectState.SPKSSPLA_XQ = getRelayXqVal(spkState.SPKSSPLAJ)
|
||||||
|
}
|
||||||
|
|
||||||
// 紧急关闭控制电路
|
// 紧急关闭控制电路
|
||||||
func (ibp *IBPSys) empControl(entry *ecs.Entry) {
|
func (ibp *IBPSys) empControl(entry *ecs.Entry, s *component.EmpElectronic) {
|
||||||
s := component.EmpControlElectronicType.Get(entry)
|
|
||||||
xempfab := getBtnVal(s.XEMPFA_BTN)
|
xempfab := getBtnVal(s.XEMPFA_BTN)
|
||||||
xempj := component.RelayDriveType.Get(s.XEMPJ)
|
xempj := component.RelayDriveType.Get(s.XEMPJ)
|
||||||
// xempfab接通或者按钮组接通并且xempj继电器吸起状态
|
// xempfab接通或者按钮组接通并且xempj继电器吸起状态
|
||||||
@ -83,12 +93,10 @@ func (ibp *IBPSys) empControl(entry *ecs.Entry) {
|
|||||||
sempj := component.RelayDriveType.Get(s.SEMPJ)
|
sempj := component.RelayDriveType.Get(s.SEMPJ)
|
||||||
// sempfab接通或者按钮组接通并且sempj继电器吸起状态
|
// sempfab接通或者按钮组接通并且sempj继电器吸起状态
|
||||||
sempj.Td = sempfab || (sempj.Xq && getBtnVal(s.EMP2_BTN) && getBtnVal(s.EMP4_BTN) && getBtnVal(s.EMP6_BTN) && getBtnVal(s.EMPS_BTN))
|
sempj.Td = sempfab || (sempj.Xq && getBtnVal(s.EMP2_BTN) && getBtnVal(s.EMP4_BTN) && getBtnVal(s.EMP6_BTN) && getBtnVal(s.EMPS_BTN))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 紧急关闭表示电路
|
// 紧急关闭表示电路
|
||||||
func (ibp *IBPSys) empState(entry *ecs.Entry) {
|
func (ibp *IBPSys) empState(entry *ecs.Entry, s *component.EmpElectronic) {
|
||||||
s := component.EmpStateElectronicType.Get(entry)
|
|
||||||
sda := getBtnVal(s.SDA)
|
sda := getBtnVal(s.SDA)
|
||||||
xempj := component.RelayDriveType.Get(s.XEMPJ)
|
xempj := component.RelayDriveType.Get(s.XEMPJ)
|
||||||
setLightTdVal(s.XEMPD, sda || !xempj.Xq)
|
setLightTdVal(s.XEMPD, sda || !xempj.Xq)
|
||||||
@ -96,12 +104,19 @@ func (ibp *IBPSys) empState(entry *ecs.Entry) {
|
|||||||
setLightTdVal(s.SEMPD, sda || !sempj.Xq)
|
setLightTdVal(s.SEMPD, sda || !sempj.Xq)
|
||||||
qba := getBtnVal(s.QBA)
|
qba := getBtnVal(s.QBA)
|
||||||
if qba {
|
if qba {
|
||||||
setFMQTdVal(s.FMQ, xempj.Xq && sempj.Xq)
|
setAlarmTdVal(s.Alarm, xempj.Xq && sempj.Xq)
|
||||||
} else {
|
} else {
|
||||||
setFMQTdVal(s.FMQ, (!xempj.Xq) || (!sempj.Xq))
|
setAlarmTdVal(s.Alarm, (!xempj.Xq) || (!sempj.Xq))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 紧急关闭继电器采集电路状态逻辑
|
||||||
|
func (ibp *IBPSys) empCollect(entry *ecs.Entry, s *component.EmpElectronic) {
|
||||||
|
collectState := component.EmpCollectStateType.Get(entry)
|
||||||
|
collectState.XEMPJ_XQ = getRelayXqVal(s.XEMPJ)
|
||||||
|
collectState.SEMPJ_XQ = getRelayXqVal(s.SEMPJ)
|
||||||
|
}
|
||||||
|
|
||||||
// 获取按钮状态
|
// 获取按钮状态
|
||||||
func getBtnVal(entry *ecs.Entry) bool {
|
func getBtnVal(entry *ecs.Entry) bool {
|
||||||
btn := component.BitStateType.Get(entry)
|
btn := component.BitStateType.Get(entry)
|
||||||
@ -114,6 +129,12 @@ func setRelayTdVal(entry *ecs.Entry, val bool) {
|
|||||||
relay.Td = val
|
relay.Td = val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取继电器吸起状态
|
||||||
|
func getRelayXqVal(entry *ecs.Entry) bool {
|
||||||
|
relay := component.RelayDriveType.Get(entry)
|
||||||
|
return relay.Xq
|
||||||
|
}
|
||||||
|
|
||||||
// 设置信号灯通电状态
|
// 设置信号灯通电状态
|
||||||
func setLightTdVal(entry *ecs.Entry, val bool) {
|
func setLightTdVal(entry *ecs.Entry, val bool) {
|
||||||
light := component.LightDriveType.Get(entry)
|
light := component.LightDriveType.Get(entry)
|
||||||
@ -121,7 +142,7 @@ func setLightTdVal(entry *ecs.Entry, val bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置蜂鸣器通电状态
|
// 设置蜂鸣器通电状态
|
||||||
func setFMQTdVal(entry *ecs.Entry, val bool) {
|
func setAlarmTdVal(entry *ecs.Entry, val bool) {
|
||||||
fmq := component.FMQDriveType.Get(entry)
|
fmq := component.AlarmDriveType.Get(entry)
|
||||||
fmq.Td = val
|
fmq.Td = val
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,11 @@ type Signal2XH1System struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewSignal2XH1System() *Signal2XH1System {
|
func NewSignal2XH1System() *Signal2XH1System {
|
||||||
return &Signal2XH1System{query: ecs.NewQuery(filter.Contains(component.Signal2XH1ElectronicType))}
|
return &Signal2XH1System{query: ecs.NewQuery(filter.Contains(
|
||||||
|
component.Signal2XH1ElectronicType,
|
||||||
|
component.Signal2XH1LsqType,
|
||||||
|
component.Signal2XH1LscType,
|
||||||
|
component.SignalLightsType))}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
@ -20,10 +24,13 @@ func (s *Signal2XH1System) Update(w ecs.World) {
|
|||||||
state := component.Signal2XH1ElectronicType.Get(entry)
|
state := component.Signal2XH1ElectronicType.Get(entry)
|
||||||
lsq := component.Signal2XH1LsqType.Get(entry)
|
lsq := component.Signal2XH1LsqType.Get(entry)
|
||||||
lsc := component.Signal2XH1LscType.Get(entry)
|
lsc := component.Signal2XH1LscType.Get(entry)
|
||||||
|
lights := component.SignalLightsType.Get(entry)
|
||||||
|
Z2XH1_L := lights.GetLightByTag(component.LdTag)
|
||||||
|
Z2XH1_H := lights.GetLightByTag(component.HdTag)
|
||||||
s.calculateLsq(state, lsq)
|
s.calculateLsq(state, lsq)
|
||||||
s.calculateL(state)
|
s.calculateL(state, Z2XH1_L)
|
||||||
s.calculateH(state)
|
s.calculateH(state, Z2XH1_H)
|
||||||
s.calculateDJ(state)
|
s.calculateDJ(state, Z2XH1_L, Z2XH1_H)
|
||||||
s.calculateLsc(state, lsc)
|
s.calculateLsc(state, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -52,25 +59,25 @@ func (s *Signal2XH1System) calculateLsc(state *component.Signal2XH1Electronic, l
|
|||||||
lsc.Z2XH1_DJ_Xq = dj.Val
|
lsc.Z2XH1_DJ_Xq = dj.Val
|
||||||
lsc.Z2XH1_LXJ_Xq = lxj.Val
|
lsc.Z2XH1_LXJ_Xq = lxj.Val
|
||||||
}
|
}
|
||||||
func (s *Signal2XH1System) calculateL(state *component.Signal2XH1Electronic) {
|
func (s *Signal2XH1System) calculateL(state *component.Signal2XH1Electronic, Z2XH1_L *ecs.Entry) {
|
||||||
driveL := component.LightDriveType.Get(state.Z2XH1_L)
|
driveL := component.LightDriveType.Get(Z2XH1_L)
|
||||||
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
||||||
isL := !ddj.Val && lxj.Val
|
isL := !ddj.Val && lxj.Val
|
||||||
driveL.Td = isL
|
driveL.Td = isL
|
||||||
}
|
}
|
||||||
func (s *Signal2XH1System) calculateH(state *component.Signal2XH1Electronic) {
|
func (s *Signal2XH1System) calculateH(state *component.Signal2XH1Electronic, Z2XH1_H *ecs.Entry) {
|
||||||
driveH := component.LightDriveType.Get(state.Z2XH1_H)
|
driveH := component.LightDriveType.Get(Z2XH1_H)
|
||||||
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
||||||
isH := !ddj.Val && !lxj.Val
|
isH := !ddj.Val && !lxj.Val
|
||||||
driveH.Td = isH
|
driveH.Td = isH
|
||||||
}
|
}
|
||||||
func (s *Signal2XH1System) calculateDJ(state *component.Signal2XH1Electronic) {
|
func (s *Signal2XH1System) calculateDJ(state *component.Signal2XH1Electronic, Z2XH1_L *ecs.Entry, Z2XH1_H *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z2XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z2XH1_LXJ)
|
||||||
ld := component.BitStateType.Get(state.Z2XH1_L)
|
ld := component.BitStateType.Get(Z2XH1_L)
|
||||||
hd := component.BitStateType.Get(state.Z2XH1_H)
|
hd := component.BitStateType.Get(Z2XH1_H)
|
||||||
isDJ := !ddj.Val && lxj.Val && ld.Val || !ddj.Val && !lxj.Val && hd.Val
|
isDJ := !ddj.Val && lxj.Val && ld.Val || !ddj.Val && !lxj.Val && hd.Val
|
||||||
//通知继电器进行动作
|
//通知继电器进行动作
|
||||||
drive := component.RelayDriveType.Get(state.Z2XH1_DJ)
|
drive := component.RelayDriveType.Get(state.Z2XH1_DJ)
|
||||||
|
@ -11,32 +11,85 @@ type Signal3XH1System struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewSignal3XH1System() *Signal3XH1System {
|
func NewSignal3XH1System() *Signal3XH1System {
|
||||||
return &Signal3XH1System{query: ecs.NewQuery(filter.Contains(component.Signal3XH1ElectronicType))}
|
return &Signal3XH1System{query: ecs.NewQuery(filter.Contains(
|
||||||
|
component.Signal3XH1ElectronicType,
|
||||||
|
component.Signal3XH1LsqType,
|
||||||
|
component.Signal3XH1LscType,
|
||||||
|
component.SignalLightsType))}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *Signal3XH1System) Update(w ecs.World) {
|
func (s *Signal3XH1System) Update(w ecs.World) {
|
||||||
s.query.Each(w, func(e *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
signal3XH1State := component.Signal3XH1ElectronicType.Get(e)
|
state := component.Signal3XH1ElectronicType.Get(entry)
|
||||||
|
lsq := component.Signal3XH1LsqType.Get(entry)
|
||||||
|
lsc := component.Signal3XH1LscType.Get(entry)
|
||||||
|
lights := component.SignalLightsType.Get(entry)
|
||||||
|
Z3XH1_L := lights.GetLightByTag(component.LdTag)
|
||||||
|
Z3XH1_H := lights.GetLightByTag(component.HdTag)
|
||||||
|
Z3XH1_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
//
|
||||||
s.calculateU(signal3XH1State)
|
s.calculateLsq(state, lsq)
|
||||||
s.calculateL(signal3XH1State)
|
s.calculateU(state, Z3XH1_U)
|
||||||
s.calculateH(signal3XH1State)
|
s.calculateL(state, Z3XH1_L)
|
||||||
s.calculateDJ(signal3XH1State)
|
s.calculateH(state, Z3XH1_H)
|
||||||
s.calculate2DJ(signal3XH1State)
|
s.calculateDJ(state, Z3XH1_H, Z3XH1_L, Z3XH1_U)
|
||||||
|
s.calculate2DJ(state, Z3XH1_U)
|
||||||
|
s.calculateLsc(state, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 联锁驱
|
||||||
|
func (s *Signal3XH1System) calculateLsq(state *component.Signal3XH1Electronic, lsq *component.Signal3XH1Lsq) {
|
||||||
|
ddj := component.RelayDriveType.Get(state.Z3XH1_DDJ)
|
||||||
|
lxj := component.RelayDriveType.Get(state.Z3XH1_LXJ)
|
||||||
|
zxj := component.RelayDriveType.Get(state.Z3XH1_ZXJ)
|
||||||
|
yxj := component.RelayDriveType.Get(state.Z3XH1_YXJ)
|
||||||
|
//
|
||||||
|
ddjQ := lsq.Z3XH1_DDJ_Q
|
||||||
|
ddj.Td = ddjQ
|
||||||
|
ddj.Xq = ddjQ
|
||||||
|
//
|
||||||
|
lxjQ := lsq.Z3XH1_LXJ_Q
|
||||||
|
lxj.Td = lxjQ
|
||||||
|
lxj.Xq = lxjQ
|
||||||
|
//
|
||||||
|
zxjQ := lsq.Z3XH1_ZXJ_Q
|
||||||
|
zxj.Td = zxjQ
|
||||||
|
zxj.Xq = zxjQ
|
||||||
|
//
|
||||||
|
yxjQ := lsq.Z3XH1_YXJ_Q
|
||||||
|
yxj.Td = yxjQ
|
||||||
|
yxj.Xq = yxjQ
|
||||||
|
}
|
||||||
|
|
||||||
|
// 联锁采
|
||||||
|
func (s *Signal3XH1System) calculateLsc(state *component.Signal3XH1Electronic, lsc *component.Signal3XH1Lsc) {
|
||||||
|
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
||||||
|
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
||||||
|
dj := component.BitStateType.Get(state.Z3XH1_DJ)
|
||||||
|
edj := component.BitStateType.Get(state.Z3XH1_2DJ)
|
||||||
|
yxj := component.BitStateType.Get(state.Z3XH1_YXJ)
|
||||||
|
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
||||||
|
//
|
||||||
|
lsc.Z3XH1_2DJ_Xq = edj.Val
|
||||||
|
lsc.Z3XH1_DJ_Xq = dj.Val
|
||||||
|
lsc.Z3XH1_DDJ_Lx = !ddj.Val
|
||||||
|
lsc.Z3XH1_LXJ_Xq = lxj.Val
|
||||||
|
lsc.Z3XH1_YXJ_Xq = yxj.Val
|
||||||
|
lsc.Z3XH1_ZXJ_Xq = zxj.Val
|
||||||
|
}
|
||||||
|
|
||||||
// 黄灯点灯电路
|
// 黄灯点灯电路
|
||||||
// 开放引导信号,黄灯亮且红灯亮
|
// 开放引导信号,黄灯亮且红灯亮
|
||||||
// 开放列车信号且开通侧向,只黄灯亮
|
// 开放列车信号且开通侧向,只黄灯亮
|
||||||
func (s *Signal3XH1System) calculateU(state *component.Signal3XH1Electronic) {
|
func (s *Signal3XH1System) calculateU(state *component.Signal3XH1Electronic, Z3XH1_U *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
||||||
dj := component.BitStateType.Get(state.Z3XH1_DJ)
|
dj := component.BitStateType.Get(state.Z3XH1_DJ)
|
||||||
yxj := component.BitStateType.Get(state.Z3XH1_YXJ)
|
yxj := component.BitStateType.Get(state.Z3XH1_YXJ)
|
||||||
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
||||||
driveU := component.LightDriveType.Get(state.Z3XH1_U)
|
driveU := component.LightDriveType.Get(Z3XH1_U)
|
||||||
//引导信号
|
//引导信号
|
||||||
isY := !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
isY := !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
||||||
//侧向行车信号
|
//侧向行车信号
|
||||||
@ -47,33 +100,33 @@ func (s *Signal3XH1System) calculateU(state *component.Signal3XH1Electronic) {
|
|||||||
|
|
||||||
// 绿灯点灯电路
|
// 绿灯点灯电路
|
||||||
// 开放正线行车信号,只亮绿灯
|
// 开放正线行车信号,只亮绿灯
|
||||||
func (s *Signal3XH1System) calculateL(state *component.Signal3XH1Electronic) {
|
func (s *Signal3XH1System) calculateL(state *component.Signal3XH1Electronic, Z3XH1_L *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
||||||
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
||||||
driveL := component.LightDriveType.Get(state.Z3XH1_L)
|
driveL := component.LightDriveType.Get(Z3XH1_L)
|
||||||
isL := !ddj.Val && lxj.Val && zxj.Val
|
isL := !ddj.Val && lxj.Val && zxj.Val
|
||||||
driveL.Td = isL
|
driveL.Td = isL
|
||||||
}
|
}
|
||||||
|
|
||||||
// 红灯点灯电路
|
// 红灯点灯电路
|
||||||
// 列车信号禁止时,亮红灯
|
// 列车信号禁止时,亮红灯
|
||||||
func (s *Signal3XH1System) calculateH(state *component.Signal3XH1Electronic) {
|
func (s *Signal3XH1System) calculateH(state *component.Signal3XH1Electronic, Z3XH1_H *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
||||||
driveH := component.LightDriveType.Get(state.Z3XH1_H)
|
driveH := component.LightDriveType.Get(Z3XH1_H)
|
||||||
isH := !ddj.Val && !lxj.Val
|
isH := !ddj.Val && !lxj.Val
|
||||||
driveH.Td = isH
|
driveH.Td = isH
|
||||||
}
|
}
|
||||||
|
|
||||||
// DJ 灯丝继电器电路
|
// DJ 灯丝继电器电路
|
||||||
func (s *Signal3XH1System) calculateDJ(state *component.Signal3XH1Electronic) {
|
func (s *Signal3XH1System) calculateDJ(state *component.Signal3XH1Electronic, Z3XH1_H *ecs.Entry, Z3XH1_L *ecs.Entry, Z3XH1_U *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
||||||
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
zxj := component.BitStateType.Get(state.Z3XH1_ZXJ)
|
||||||
ld := component.BitStateType.Get(state.Z3XH1_L)
|
ld := component.BitStateType.Get(Z3XH1_L)
|
||||||
hd := component.BitStateType.Get(state.Z3XH1_H)
|
hd := component.BitStateType.Get(Z3XH1_H)
|
||||||
ud := component.BitStateType.Get(state.Z3XH1_U)
|
ud := component.BitStateType.Get(Z3XH1_U)
|
||||||
isDj := ld.Val && !ddj.Val && lxj.Val && zxj.Val || //绿灯亮
|
isDj := ld.Val && !ddj.Val && lxj.Val && zxj.Val || //绿灯亮
|
||||||
ud.Val && !ddj.Val && lxj.Val && !zxj.Val || //黄灯亮
|
ud.Val && !ddj.Val && lxj.Val && !zxj.Val || //黄灯亮
|
||||||
hd.Val && !ddj.Val && !lxj.Val //红灯亮
|
hd.Val && !ddj.Val && !lxj.Val //红灯亮
|
||||||
@ -84,12 +137,12 @@ func (s *Signal3XH1System) calculateDJ(state *component.Signal3XH1Electronic) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2DJ 灯丝继电器电路
|
// 2DJ 灯丝继电器电路
|
||||||
func (s *Signal3XH1System) calculate2DJ(state *component.Signal3XH1Electronic) {
|
func (s *Signal3XH1System) calculate2DJ(state *component.Signal3XH1Electronic, Z3XH1_U *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH1_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH1_LXJ)
|
||||||
dj := component.BitStateType.Get(state.Z3XH1_DJ)
|
dj := component.BitStateType.Get(state.Z3XH1_DJ)
|
||||||
yxj := component.BitStateType.Get(state.Z3XH1_YXJ)
|
yxj := component.BitStateType.Get(state.Z3XH1_YXJ)
|
||||||
ud := component.BitStateType.Get(state.Z3XH1_U)
|
ud := component.BitStateType.Get(Z3XH1_U)
|
||||||
//
|
//
|
||||||
is2DJ := ud.Val && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
is2DJ := ud.Val && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
||||||
//通知继电器进行动作
|
//通知继电器进行动作
|
||||||
|
@ -11,52 +11,97 @@ type Signal3XH2System struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewSignal3XH2System() *Signal3XH2System {
|
func NewSignal3XH2System() *Signal3XH2System {
|
||||||
return &Signal3XH2System{query: ecs.NewQuery(filter.Contains(component.Signal3XH2ElectronicType))}
|
return &Signal3XH2System{query: ecs.NewQuery(filter.Contains(
|
||||||
|
component.Signal3XH2ElectronicType,
|
||||||
|
component.Signal3XH2LsqType,
|
||||||
|
component.Signal3XH2LscType,
|
||||||
|
component.SignalLightsType))}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *Signal3XH2System) Update(w ecs.World) {
|
func (s *Signal3XH2System) Update(w ecs.World) {
|
||||||
s.query.Each(w, func(e *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.Signal3XH2ElectronicType.Get(e)
|
state := component.Signal3XH2ElectronicType.Get(entry)
|
||||||
s.calculateU(state)
|
lsq := component.Signal3XH2LsqType.Get(entry)
|
||||||
s.calculateL(state)
|
lsc := component.Signal3XH2LscType.Get(entry)
|
||||||
s.calculateH(state)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
s.calculateDJ(state)
|
Z3XH2_L := lights.GetLightByTag(component.LdTag)
|
||||||
s.calculate2DJ(state)
|
Z3XH2_H := lights.GetLightByTag(component.HdTag)
|
||||||
|
Z3XH2_U := lights.GetLightByTag(component.UdTag)
|
||||||
|
s.calculateLsq(state, lsq)
|
||||||
|
s.calculateU(state, Z3XH2_U)
|
||||||
|
s.calculateL(state, Z3XH2_L)
|
||||||
|
s.calculateH(state, Z3XH2_H)
|
||||||
|
s.calculateDJ(state, Z3XH2_L, Z3XH2_H)
|
||||||
|
s.calculate2DJ(state, Z3XH2_U)
|
||||||
|
s.calculateLsc(state, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Signal3XH2System) calculateU(state *component.Signal3XH2Electronic) {
|
// 联锁驱
|
||||||
|
func (s *Signal3XH2System) calculateLsq(state *component.Signal3XH2Electronic, lsq *component.Signal3XH2Lsq) {
|
||||||
|
ddj := component.RelayDriveType.Get(state.Z3XH2_DDJ)
|
||||||
|
lxj := component.RelayDriveType.Get(state.Z3XH2_LXJ)
|
||||||
|
yxj := component.RelayDriveType.Get(state.Z3XH2_YXJ)
|
||||||
|
//
|
||||||
|
ddjQ := lsq.Z3XH2_DDJ_Q
|
||||||
|
ddj.Td = ddjQ
|
||||||
|
ddj.Xq = ddjQ
|
||||||
|
//
|
||||||
|
lxjQ := lsq.Z3XH2_LXJ_Q
|
||||||
|
lxj.Td = lxjQ
|
||||||
|
lxj.Xq = lxjQ
|
||||||
|
//
|
||||||
|
yxjQ := lsq.Z3XH2_YXJ_Q
|
||||||
|
yxj.Td = yxjQ
|
||||||
|
yxj.Xq = yxjQ
|
||||||
|
}
|
||||||
|
|
||||||
|
// 联锁采
|
||||||
|
func (s *Signal3XH2System) calculateLsc(state *component.Signal3XH2Electronic, lsc *component.Signal3XH2Lsc) {
|
||||||
|
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
||||||
|
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
||||||
|
dj := component.BitStateType.Get(state.Z3XH2_DJ)
|
||||||
|
edj := component.BitStateType.Get(state.Z3XH2_2DJ)
|
||||||
|
yxj := component.BitStateType.Get(state.Z3XH2_YXJ)
|
||||||
|
//
|
||||||
|
lsc.Z3XH2_2DJ_Xq = edj.Val
|
||||||
|
lsc.Z3XH2_DJ_Xq = dj.Val
|
||||||
|
lsc.Z3XH2_DDJ_Lx = !ddj.Val
|
||||||
|
lsc.Z3XH2_LXJ_Xq = lxj.Val
|
||||||
|
lsc.Z3XH2_YXJ_Xq = yxj.Val
|
||||||
|
}
|
||||||
|
func (s *Signal3XH2System) calculateU(state *component.Signal3XH2Electronic, Z3XH2_U *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
||||||
dj := component.BitStateType.Get(state.Z3XH2_DJ)
|
dj := component.BitStateType.Get(state.Z3XH2_DJ)
|
||||||
yxj := component.BitStateType.Get(state.Z3XH2_YXJ)
|
yxj := component.BitStateType.Get(state.Z3XH2_YXJ)
|
||||||
driveU := component.LightDriveType.Get(state.Z3XH2_U)
|
driveU := component.LightDriveType.Get(Z3XH2_U)
|
||||||
isU := !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
isU := !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
||||||
driveU.Td = isU
|
driveU.Td = isU
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Signal3XH2System) calculateL(state *component.Signal3XH2Electronic) {
|
func (s *Signal3XH2System) calculateL(state *component.Signal3XH2Electronic, Z3XH2_L *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
||||||
driveL := component.LightDriveType.Get(state.Z3XH2_L)
|
driveL := component.LightDriveType.Get(Z3XH2_L)
|
||||||
isL := !ddj.Val && lxj.Val
|
isL := !ddj.Val && lxj.Val
|
||||||
driveL.Td = isL
|
driveL.Td = isL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Signal3XH2System) calculateH(state *component.Signal3XH2Electronic) {
|
func (s *Signal3XH2System) calculateH(state *component.Signal3XH2Electronic, Z3XH2_H *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
||||||
driveH := component.LightDriveType.Get(state.Z3XH2_H)
|
driveH := component.LightDriveType.Get(Z3XH2_H)
|
||||||
isH := !ddj.Val && !lxj.Val
|
isH := !ddj.Val && !lxj.Val
|
||||||
driveH.Td = isH
|
driveH.Td = isH
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Signal3XH2System) calculateDJ(state *component.Signal3XH2Electronic) {
|
func (s *Signal3XH2System) calculateDJ(state *component.Signal3XH2Electronic, Z3XH2_L *ecs.Entry, Z3XH2_H *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
||||||
ld := component.BitStateType.Get(state.Z3XH2_L)
|
ld := component.BitStateType.Get(Z3XH2_L)
|
||||||
hd := component.BitStateType.Get(state.Z3XH2_H)
|
hd := component.BitStateType.Get(Z3XH2_H)
|
||||||
isDJ := ld.Val && !ddj.Val && lxj.Val || hd.Val && !ddj.Val && !lxj.Val
|
isDJ := ld.Val && !ddj.Val && lxj.Val || hd.Val && !ddj.Val && !lxj.Val
|
||||||
//通知继电器进行动作
|
//通知继电器进行动作
|
||||||
drive := component.RelayDriveType.Get(state.Z3XH2_DJ)
|
drive := component.RelayDriveType.Get(state.Z3XH2_DJ)
|
||||||
@ -64,12 +109,12 @@ func (s *Signal3XH2System) calculateDJ(state *component.Signal3XH2Electronic) {
|
|||||||
drive.Xq = isDJ
|
drive.Xq = isDJ
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Signal3XH2System) calculate2DJ(state *component.Signal3XH2Electronic) {
|
func (s *Signal3XH2System) calculate2DJ(state *component.Signal3XH2Electronic, Z3XH2_U *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH2_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH2_LXJ)
|
||||||
dj := component.BitStateType.Get(state.Z3XH2_DJ)
|
dj := component.BitStateType.Get(state.Z3XH2_DJ)
|
||||||
yxj := component.BitStateType.Get(state.Z3XH2_YXJ)
|
yxj := component.BitStateType.Get(state.Z3XH2_YXJ)
|
||||||
ud := component.BitStateType.Get(state.Z3XH2_U)
|
ud := component.BitStateType.Get(Z3XH2_U)
|
||||||
is2DJ := ud.Val && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
is2DJ := ud.Val && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
||||||
//通知继电器进行动作
|
//通知继电器进行动作
|
||||||
drive := component.RelayDriveType.Get(state.Z3XH2_2DJ)
|
drive := component.RelayDriveType.Get(state.Z3XH2_2DJ)
|
||||||
|
@ -11,54 +11,98 @@ type Signal3XH3System struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewSignal3XH3System() *Signal3XH3System {
|
func NewSignal3XH3System() *Signal3XH3System {
|
||||||
return &Signal3XH3System{query: ecs.NewQuery(filter.Contains(component.Signal3XH3ElectronicType))}
|
return &Signal3XH3System{query: ecs.NewQuery(filter.Contains(
|
||||||
|
component.Signal3XH3ElectronicType,
|
||||||
|
component.Signal3XH3LsqType,
|
||||||
|
component.Signal3XH3LscType,
|
||||||
|
component.SignalLightsType))}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *Signal3XH3System) Update(w ecs.World) {
|
func (s *Signal3XH3System) Update(w ecs.World) {
|
||||||
s.query.Each(w, func(e *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.Signal3XH3ElectronicType.Get(e)
|
state := component.Signal3XH3ElectronicType.Get(entry)
|
||||||
|
lsq := component.Signal3XH3LsqType.Get(entry)
|
||||||
|
lsc := component.Signal3XH3LscType.Get(entry)
|
||||||
|
lights := component.SignalLightsType.Get(entry)
|
||||||
|
Z3XH3_H := lights.GetLightByTag(component.HdTag)
|
||||||
|
Z3XH3_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
//
|
||||||
s.calculateU(state)
|
s.calculateLsq(state, lsq)
|
||||||
s.calculateH(state)
|
s.calculateU(state, Z3XH3_U)
|
||||||
s.calculateDJ(state)
|
s.calculateH(state, Z3XH3_H)
|
||||||
s.calculate2DJ(state)
|
s.calculateDJ(state, Z3XH3_U, Z3XH3_H)
|
||||||
|
s.calculate2DJ(state, Z3XH3_U)
|
||||||
|
s.calculateLsc(state, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Signal3XH3System) calculateU(state *component.Signal3XH3Electronic) {
|
// 联锁驱
|
||||||
|
func (s *Signal3XH3System) calculateLsq(state *component.Signal3XH3Electronic, lsq *component.Signal3XH3Lsq) {
|
||||||
|
ddj := component.RelayDriveType.Get(state.Z3XH3_DDJ)
|
||||||
|
lxj := component.RelayDriveType.Get(state.Z3XH3_LXJ)
|
||||||
|
yxj := component.RelayDriveType.Get(state.Z3XH3_YXJ)
|
||||||
|
//
|
||||||
|
ddjQ := lsq.Z3XH3_DDJ_Q
|
||||||
|
ddj.Td = ddjQ
|
||||||
|
ddj.Xq = ddjQ
|
||||||
|
//
|
||||||
|
lxjQ := lsq.Z3XH3_LXJ_Q
|
||||||
|
lxj.Td = lxjQ
|
||||||
|
lxj.Xq = lxjQ
|
||||||
|
//
|
||||||
|
yxjQ := lsq.Z3XH3_YXJ_Q
|
||||||
|
yxj.Td = yxjQ
|
||||||
|
yxj.Xq = yxjQ
|
||||||
|
}
|
||||||
|
|
||||||
|
// 联锁采
|
||||||
|
func (s *Signal3XH3System) calculateLsc(state *component.Signal3XH3Electronic, lsc *component.Signal3XH3Lsc) {
|
||||||
|
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
|
||||||
|
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
|
||||||
|
dj := component.BitStateType.Get(state.Z3XH3_DJ)
|
||||||
|
edj := component.BitStateType.Get(state.Z3XH3_2DJ)
|
||||||
|
yxj := component.BitStateType.Get(state.Z3XH3_YXJ)
|
||||||
|
//
|
||||||
|
lsc.Z3XH3_2DJ_Xq = edj.Val
|
||||||
|
lsc.Z3XH3_DJ_Xq = dj.Val
|
||||||
|
lsc.Z3XH3_DDJ_Lx = !ddj.Val
|
||||||
|
lsc.Z3XH3_LXJ_Xq = lxj.Val
|
||||||
|
lsc.Z3XH3_YXJ_Xq = yxj.Val
|
||||||
|
}
|
||||||
|
func (s *Signal3XH3System) calculateU(state *component.Signal3XH3Electronic, Z3XH3_U *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
|
||||||
dj := component.BitStateType.Get(state.Z3XH3_DJ)
|
dj := component.BitStateType.Get(state.Z3XH3_DJ)
|
||||||
yxj := component.BitStateType.Get(state.Z3XH3_YXJ)
|
yxj := component.BitStateType.Get(state.Z3XH3_YXJ)
|
||||||
isU := !ddj.Val && !lxj.Val && dj.Val && yxj.Val || !ddj.Val && lxj.Val
|
isU := !ddj.Val && !lxj.Val && dj.Val && yxj.Val || !ddj.Val && lxj.Val
|
||||||
driveU := component.LightDriveType.Get(state.Z3XH3_U)
|
driveU := component.LightDriveType.Get(Z3XH3_U)
|
||||||
driveU.Td = isU
|
driveU.Td = isU
|
||||||
|
|
||||||
}
|
}
|
||||||
func (s *Signal3XH3System) calculateH(state *component.Signal3XH3Electronic) {
|
func (s *Signal3XH3System) calculateH(state *component.Signal3XH3Electronic, Z3XH3_H *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
|
||||||
isH := !ddj.Val && !lxj.Val
|
isH := !ddj.Val && !lxj.Val
|
||||||
driveH := component.LightDriveType.Get(state.Z3XH3_H)
|
driveH := component.LightDriveType.Get(Z3XH3_H)
|
||||||
driveH.Td = isH
|
driveH.Td = isH
|
||||||
}
|
}
|
||||||
func (s *Signal3XH3System) calculateDJ(state *component.Signal3XH3Electronic) {
|
func (s *Signal3XH3System) calculateDJ(state *component.Signal3XH3Electronic, Z3XH3_U *ecs.Entry, Z3XH3_H *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
|
||||||
ud := component.BitStateType.Get(state.Z3XH3_U)
|
ud := component.BitStateType.Get(Z3XH3_U)
|
||||||
hd := component.BitStateType.Get(state.Z3XH3_H)
|
hd := component.BitStateType.Get(Z3XH3_H)
|
||||||
isDJ := ud.Val && !ddj.Val && lxj.Val || hd.Val && !ddj.Val && !lxj.Val
|
isDJ := ud.Val && !ddj.Val && lxj.Val || hd.Val && !ddj.Val && !lxj.Val
|
||||||
drive := component.RelayDriveType.Get(state.Z3XH3_DJ)
|
drive := component.RelayDriveType.Get(state.Z3XH3_DJ)
|
||||||
drive.Td = isDJ
|
drive.Td = isDJ
|
||||||
drive.Xq = isDJ
|
drive.Xq = isDJ
|
||||||
}
|
}
|
||||||
func (s *Signal3XH3System) calculate2DJ(state *component.Signal3XH3Electronic) {
|
func (s *Signal3XH3System) calculate2DJ(state *component.Signal3XH3Electronic, Z3XH3_U *ecs.Entry) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH3_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH3_LXJ)
|
||||||
dj := component.BitStateType.Get(state.Z3XH3_DJ)
|
dj := component.BitStateType.Get(state.Z3XH3_DJ)
|
||||||
yxj := component.BitStateType.Get(state.Z3XH3_YXJ)
|
yxj := component.BitStateType.Get(state.Z3XH3_YXJ)
|
||||||
ud := component.BitStateType.Get(state.Z3XH3_U)
|
ud := component.BitStateType.Get(Z3XH3_U)
|
||||||
is2DJ := ud.Val && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
is2DJ := ud.Val && !ddj.Val && !lxj.Val && dj.Val && yxj.Val
|
||||||
drive := component.RelayDriveType.Get(state.Z3XH3_2DJ)
|
drive := component.RelayDriveType.Get(state.Z3XH3_2DJ)
|
||||||
drive.Td = is2DJ
|
drive.Td = is2DJ
|
||||||
|
@ -11,56 +11,101 @@ type Signal3XH4System struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewSignal3XH4System() *Signal3XH4System {
|
func NewSignal3XH4System() *Signal3XH4System {
|
||||||
return &Signal3XH4System{query: ecs.NewQuery(filter.Contains(component.Signal3XH4ElectronicType, component.Signal3XH4FilamentType))}
|
return &Signal3XH4System{query: ecs.NewQuery(filter.Contains(
|
||||||
|
component.Signal3XH4ElectronicType,
|
||||||
|
component.Signal3XH4LsqType,
|
||||||
|
component.Signal3XH4LscType,
|
||||||
|
component.SignalLightsType))}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *Signal3XH4System) Update(w ecs.World) {
|
func (s *Signal3XH4System) Update(w ecs.World) {
|
||||||
s.query.Each(w, func(e *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.Signal3XH4ElectronicType.Get(e)
|
state := component.Signal3XH4ElectronicType.Get(entry)
|
||||||
filament := component.Signal3XH4FilamentType.Get(e)
|
lsq := component.Signal3XH4LsqType.Get(entry)
|
||||||
|
lsc := component.Signal3XH4LscType.Get(entry)
|
||||||
|
lights := component.SignalLightsType.Get(entry)
|
||||||
|
Z3XH4_H := lights.GetLightByTag(component.HdTag)
|
||||||
|
Z3XH4_L := lights.GetLightByTag(component.LdTag)
|
||||||
|
Z3XH4_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
//
|
||||||
s.calculateU(state, filament)
|
s.calculateLsq(state, lsq)
|
||||||
s.calculateL(state, filament)
|
s.calculateU(state, Z3XH4_U)
|
||||||
s.calculateH(w, state, filament)
|
s.calculateL(state, Z3XH4_L)
|
||||||
s.calculateDJ(w, e, state, filament)
|
s.calculateH(state, Z3XH4_H)
|
||||||
|
s.calculateDJ(state, Z3XH4_H, Z3XH4_L, Z3XH4_U)
|
||||||
|
s.calculateLsc(state, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Signal3XH4System) calculateU(state *component.Signal3XH4Electronic, filament *component.Signal3XH4Filament) {
|
// 联锁驱
|
||||||
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
|
func (s *Signal3XH4System) calculateLsq(state *component.Signal3XH4Electronic, lsq *component.Signal3XH4Lsq) {
|
||||||
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
|
ddj := component.RelayDriveType.Get(state.Z3XH4_DDJ)
|
||||||
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
|
lxj := component.RelayDriveType.Get(state.Z3XH4_LXJ)
|
||||||
isU := filament.Uf && !ddj.Val && lxj.Val && !zxj.Val
|
zxj := component.RelayDriveType.Get(state.Z3XH4_ZXJ)
|
||||||
filament.U = isU
|
//
|
||||||
|
ddjQ := lsq.Z3XH4_DDJ_Q
|
||||||
|
ddj.Td = ddjQ
|
||||||
|
ddj.Xq = ddjQ
|
||||||
|
//
|
||||||
|
lxjQ := lsq.Z3XH4_LXJ_Q
|
||||||
|
lxj.Td = lxjQ
|
||||||
|
lxj.Xq = lxjQ
|
||||||
|
//
|
||||||
|
zxjQ := lsq.Z3XH4_ZXJ_Q
|
||||||
|
zxj.Td = zxjQ
|
||||||
|
zxj.Xq = zxjQ
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Signal3XH4System) calculateL(state *component.Signal3XH4Electronic, filament *component.Signal3XH4Filament) {
|
// 联锁采
|
||||||
|
func (s *Signal3XH4System) calculateLsc(state *component.Signal3XH4Electronic, lsc *component.Signal3XH4Lsc) {
|
||||||
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
|
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
|
||||||
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
|
|
||||||
isL := filament.Lf && !ddj.Val && lxj.Val && zxj.Val
|
|
||||||
filament.L = isL
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Signal3XH4System) calculateH(w ecs.World, state *component.Signal3XH4Electronic, filament *component.Signal3XH4Filament) {
|
|
||||||
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
|
|
||||||
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
|
|
||||||
isH := filament.Hf && !ddj.Val && !lxj.Val
|
|
||||||
filament.H = isH
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Signal3XH4System) calculateDJ(w ecs.World, e *ecs.Entry, state *component.Signal3XH4Electronic, filament *component.Signal3XH4Filament) {
|
|
||||||
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
|
|
||||||
dj := component.BitStateType.Get(state.Z3XH4_DJ)
|
dj := component.BitStateType.Get(state.Z3XH4_DJ)
|
||||||
|
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
|
||||||
|
//
|
||||||
|
lsc.Z3XH4_DJ_Xq = dj.Val
|
||||||
|
lsc.Z3XH4_DDJ_Lx = !ddj.Val
|
||||||
|
lsc.Z3XH4_LXJ_Xq = lxj.Val
|
||||||
|
lsc.Z3XH4_ZXJ_Xq = zxj.Val
|
||||||
|
}
|
||||||
|
func (s *Signal3XH4System) calculateU(state *component.Signal3XH4Electronic, Z3XH4_U *ecs.Entry) {
|
||||||
|
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
|
||||||
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
|
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
|
||||||
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
|
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
|
||||||
isDJ := filament.Uf && !ddj.Val && lxj.Val && !zxj.Val ||
|
isU := !ddj.Val && lxj.Val && !zxj.Val
|
||||||
filament.Lf && !ddj.Val && lxj.Val && zxj.Val ||
|
driveU := component.LightDriveType.Get(Z3XH4_U)
|
||||||
filament.Hf && !ddj.Val && !lxj.Val
|
driveU.Td = isU
|
||||||
if isDJ != dj.Val {
|
}
|
||||||
drive := component.RelayDriveType.Get(state.Z3XH4_DJ)
|
|
||||||
drive.Td = isDJ
|
func (s *Signal3XH4System) calculateL(state *component.Signal3XH4Electronic, Z3XH4_L *ecs.Entry) {
|
||||||
drive.Xq = isDJ
|
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
|
||||||
}
|
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
|
||||||
|
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
|
||||||
|
isL := !ddj.Val && lxj.Val && zxj.Val
|
||||||
|
driveL := component.LightDriveType.Get(Z3XH4_L)
|
||||||
|
driveL.Td = isL
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Signal3XH4System) calculateH(state *component.Signal3XH4Electronic, Z3XH4_H *ecs.Entry) {
|
||||||
|
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
|
||||||
|
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
|
||||||
|
isH := !ddj.Val && !lxj.Val
|
||||||
|
driveH := component.LightDriveType.Get(Z3XH4_H)
|
||||||
|
driveH.Td = isH
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Signal3XH4System) calculateDJ(state *component.Signal3XH4Electronic, Z3XH4_H *ecs.Entry, Z3XH4_L *ecs.Entry, Z3XH4_U *ecs.Entry) {
|
||||||
|
ddj := component.BitStateType.Get(state.Z3XH4_DDJ)
|
||||||
|
lxj := component.BitStateType.Get(state.Z3XH4_LXJ)
|
||||||
|
zxj := component.BitStateType.Get(state.Z3XH4_ZXJ)
|
||||||
|
hd := component.BitStateType.Get(Z3XH4_H)
|
||||||
|
ld := component.BitStateType.Get(Z3XH4_L)
|
||||||
|
ud := component.BitStateType.Get(Z3XH4_U)
|
||||||
|
isDJ := ud.Val && !ddj.Val && lxj.Val && !zxj.Val ||
|
||||||
|
ld.Val && !ddj.Val && lxj.Val && zxj.Val ||
|
||||||
|
hd.Val && !ddj.Val && !lxj.Val
|
||||||
|
drive := component.RelayDriveType.Get(state.Z3XH4_DJ)
|
||||||
|
drive.Td = isDJ
|
||||||
|
drive.Xq = isDJ
|
||||||
}
|
}
|
||||||
|
@ -11,41 +11,69 @@ type SignalDCXHSystem struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewSignalDCXHSystem() *SignalDCXHSystem {
|
func NewSignalDCXHSystem() *SignalDCXHSystem {
|
||||||
return &SignalDCXHSystem{query: ecs.NewQuery(filter.Contains(component.SignalDCXHElectronicType, component.SignalDCXHFilamentType))}
|
return &SignalDCXHSystem{query: ecs.NewQuery(filter.Contains(
|
||||||
|
component.SignalDCXHElectronicType,
|
||||||
|
component.SignalDCXHLsqType,
|
||||||
|
component.SignalDCXHLscType,
|
||||||
|
component.SignalLightsType))}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *SignalDCXHSystem) Update(w ecs.World) {
|
func (s *SignalDCXHSystem) Update(w ecs.World) {
|
||||||
s.query.Each(w, func(e *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.SignalDCXHElectronicType.Get(e)
|
state := component.SignalDCXHElectronicType.Get(entry)
|
||||||
filament := component.SignalDCXHFilamentType.Get(e)
|
lsq := component.SignalDCXHLsqType.Get(entry)
|
||||||
|
lsc := component.SignalDCXHLscType.Get(entry)
|
||||||
|
lights := component.SignalLightsType.Get(entry)
|
||||||
|
DCXH_A := lights.GetLightByTag(component.AdTag)
|
||||||
|
DCXH_B := lights.GetLightByTag(component.BdTag)
|
||||||
//
|
//
|
||||||
s.calculateA(state, filament)
|
s.calculateLsq(state, lsq)
|
||||||
s.calculateB(state, filament)
|
s.calculateA(state, DCXH_A)
|
||||||
s.calculateDJ(state, filament)
|
s.calculateB(state, DCXH_B)
|
||||||
|
s.calculateDJ(state, DCXH_B, DCXH_A)
|
||||||
|
s.calculateLsc(state, lsc)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SignalDCXHSystem) calculateB(state *component.SignalDCXHElectronic, filament *component.SignalDCXHFilament) {
|
// 联锁驱
|
||||||
dxj := component.BitStateType.Get(state.DCXH_DXJ)
|
func (s *SignalDCXHSystem) calculateLsq(state *component.SignalDCXHElectronic, lsq *component.SignalDCXHLsq) {
|
||||||
isB := filament.Bf && dxj.Val
|
dxj := component.RelayDriveType.Get(state.DCXH_DXJ)
|
||||||
filament.B = isB
|
//
|
||||||
|
dxjQ := lsq.DCXH_DXJ_Q
|
||||||
|
dxj.Td = dxjQ
|
||||||
|
dxj.Xq = dxjQ
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SignalDCXHSystem) calculateA(state *component.SignalDCXHElectronic, filament *component.SignalDCXHFilament) {
|
// 联锁采
|
||||||
dxj := component.BitStateType.Get(state.DCXH_DXJ)
|
func (s *SignalDCXHSystem) calculateLsc(state *component.SignalDCXHElectronic, lsc *component.SignalDCXHLsc) {
|
||||||
isA := filament.Af && !dxj.Val
|
|
||||||
filament.A = isA
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SignalDCXHSystem) calculateDJ(state *component.SignalDCXHElectronic, filament *component.SignalDCXHFilament) {
|
|
||||||
dxj := component.BitStateType.Get(state.DCXH_DXJ)
|
dxj := component.BitStateType.Get(state.DCXH_DXJ)
|
||||||
dj := component.BitStateType.Get(state.DCXH_DJ)
|
dj := component.BitStateType.Get(state.DCXH_DJ)
|
||||||
isDJ := filament.Bf && dxj.Val || filament.Af && !dxj.Val
|
//
|
||||||
if isDJ != dj.Val {
|
lsc.DCXH_DJ_Xq = dj.Val
|
||||||
drive := component.RelayDriveType.Get(state.DCXH_DJ)
|
lsc.DCXH_DXJ_Xq = dxj.Val
|
||||||
drive.Td = isDJ
|
}
|
||||||
drive.Xq = isDJ
|
func (s *SignalDCXHSystem) calculateB(state *component.SignalDCXHElectronic, DCXH_B *ecs.Entry) {
|
||||||
}
|
dxj := component.BitStateType.Get(state.DCXH_DXJ)
|
||||||
|
isB := dxj.Val
|
||||||
|
driveB := component.LightDriveType.Get(DCXH_B)
|
||||||
|
driveB.Td = isB
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SignalDCXHSystem) calculateA(state *component.SignalDCXHElectronic, DCXH_A *ecs.Entry) {
|
||||||
|
dxj := component.BitStateType.Get(state.DCXH_DXJ)
|
||||||
|
isA := !dxj.Val
|
||||||
|
driveA := component.LightDriveType.Get(DCXH_A)
|
||||||
|
driveA.Td = isA
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SignalDCXHSystem) calculateDJ(state *component.SignalDCXHElectronic, DCXH_B *ecs.Entry, DCXH_A *ecs.Entry) {
|
||||||
|
dxj := component.BitStateType.Get(state.DCXH_DXJ)
|
||||||
|
ad := component.BitStateType.Get(DCXH_A)
|
||||||
|
bd := component.BitStateType.Get(DCXH_B)
|
||||||
|
isDJ := bd.Val && dxj.Val || ad.Val && !dxj.Val
|
||||||
|
drive := component.RelayDriveType.Get(state.DCXH_DJ)
|
||||||
|
drive.Td = isDJ
|
||||||
|
drive.Xq = isDJ
|
||||||
}
|
}
|
||||||
|
@ -11,50 +11,88 @@ type SignalJCKXHSystem struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewSignalJCKXHSystem() *SignalJCKXHSystem {
|
func NewSignalJCKXHSystem() *SignalJCKXHSystem {
|
||||||
return &SignalJCKXHSystem{query: ecs.NewQuery(filter.Contains(component.SignalJCKXHElectronicType, component.SignalJCKXHFilamentType))}
|
return &SignalJCKXHSystem{query: ecs.NewQuery(filter.Contains(
|
||||||
|
component.SignalJCKXHElectronicType,
|
||||||
|
component.SignalJCKXHLsqType,
|
||||||
|
component.SignalJCKXHLscType,
|
||||||
|
component.SignalLightsType))}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *SignalJCKXHSystem) Update(w ecs.World) {
|
func (s *SignalJCKXHSystem) Update(w ecs.World) {
|
||||||
s.query.Each(w, func(e *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.SignalJCKXHElectronicType.Get(e)
|
state := component.SignalJCKXHElectronicType.Get(entry)
|
||||||
filament := component.SignalJCKXHFilamentType.Get(e)
|
lsq := component.SignalJCKXHLsqType.Get(entry)
|
||||||
|
lsc := component.SignalJCKXHLscType.Get(entry)
|
||||||
|
lights := component.SignalLightsType.Get(entry)
|
||||||
|
JCKXH_H := lights.GetLightByTag(component.HdTag)
|
||||||
|
JCKXH_B := lights.GetLightByTag(component.BdTag)
|
||||||
|
JCKXH_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
//
|
||||||
s.calculateU(state, filament)
|
s.calculateLsq(state, lsq)
|
||||||
s.calculateB(state, filament)
|
s.calculateU(state, JCKXH_U)
|
||||||
s.calculateH(state, filament)
|
s.calculateB(state, JCKXH_B)
|
||||||
s.calculateDJ(state, filament)
|
s.calculateH(state, JCKXH_H)
|
||||||
|
s.calculateDJ(state, JCKXH_H, JCKXH_B, JCKXH_U)
|
||||||
|
s.calculateLsc(state, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SignalJCKXHSystem) calculateU(state *component.SignalJCKXHElectronic, filament *component.SignalJCKXHFilament) {
|
// 联锁驱
|
||||||
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
|
func (s *SignalJCKXHSystem) calculateLsq(state *component.SignalJCKXHElectronic, lsq *component.SignalJCKXHLsq) {
|
||||||
isU := filament.Uf && lxj.Val
|
dxj := component.RelayDriveType.Get(state.JCKXH_DXJ)
|
||||||
filament.U = isU
|
lxj := component.RelayDriveType.Get(state.JCKXH_LXJ)
|
||||||
|
//
|
||||||
|
dxjQ := lsq.JCKXH_DXJ_Q
|
||||||
|
dxj.Td = dxjQ
|
||||||
|
dxj.Xq = dxjQ
|
||||||
|
//
|
||||||
|
lxjQ := lsq.JCKXH_LXJ_Q
|
||||||
|
lxj.Td = lxjQ
|
||||||
|
lxj.Xq = lxjQ
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SignalJCKXHSystem) calculateB(state *component.SignalJCKXHElectronic, filament *component.SignalJCKXHFilament) {
|
// 联锁采
|
||||||
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
|
func (s *SignalJCKXHSystem) calculateLsc(state *component.SignalJCKXHElectronic, lsc *component.SignalJCKXHLsc) {
|
||||||
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
|
|
||||||
isB := filament.Bf && !lxj.Val && dxj.Val
|
|
||||||
filament.B = isB
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SignalJCKXHSystem) calculateH(state *component.SignalJCKXHElectronic, filament *component.SignalJCKXHFilament) {
|
|
||||||
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
|
|
||||||
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
|
|
||||||
isH := filament.Bf && !lxj.Val && dxj.Val
|
|
||||||
filament.H = isH
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SignalJCKXHSystem) calculateDJ(state *component.SignalJCKXHElectronic, filament *component.SignalJCKXHFilament) {
|
|
||||||
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
|
|
||||||
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
|
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
|
||||||
dj := component.BitStateType.Get(state.JCKXH_DJ)
|
dj := component.BitStateType.Get(state.JCKXH_DJ)
|
||||||
isDJ := filament.Uf && lxj.Val || filament.Bf && !lxj.Val && dxj.Val || filament.Bf && !lxj.Val && dxj.Val
|
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
|
||||||
if isDJ != dj.Val {
|
//
|
||||||
drive := component.RelayDriveType.Get(state.JCKXH_DJ)
|
lsc.JCKXH_DJ_Xq = dj.Val
|
||||||
drive.Td = isDJ
|
lsc.JCKXH_LXJ_Xq = lxj.Val
|
||||||
drive.Xq = isDJ
|
lsc.JCKXH_DXJ_Xq = dxj.Val
|
||||||
}
|
}
|
||||||
|
func (s *SignalJCKXHSystem) calculateU(state *component.SignalJCKXHElectronic, JCKXH_U *ecs.Entry) {
|
||||||
|
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
|
||||||
|
isU := lxj.Val
|
||||||
|
driveU := component.LightDriveType.Get(JCKXH_U)
|
||||||
|
driveU.Td = isU
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SignalJCKXHSystem) calculateB(state *component.SignalJCKXHElectronic, JCKXH_B *ecs.Entry) {
|
||||||
|
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
|
||||||
|
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
|
||||||
|
isB := !lxj.Val && dxj.Val
|
||||||
|
driveB := component.LightDriveType.Get(JCKXH_B)
|
||||||
|
driveB.Td = isB
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SignalJCKXHSystem) calculateH(state *component.SignalJCKXHElectronic, JCKXH_H *ecs.Entry) {
|
||||||
|
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
|
||||||
|
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
|
||||||
|
isH := !lxj.Val && dxj.Val
|
||||||
|
driveH := component.LightDriveType.Get(JCKXH_H)
|
||||||
|
driveH.Td = isH
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SignalJCKXHSystem) calculateDJ(state *component.SignalJCKXHElectronic, JCKXH_H *ecs.Entry, JCKXH_B *ecs.Entry, JCKXH_U *ecs.Entry) {
|
||||||
|
lxj := component.BitStateType.Get(state.JCKXH_LXJ)
|
||||||
|
dxj := component.BitStateType.Get(state.JCKXH_DXJ)
|
||||||
|
hd := component.BitStateType.Get(JCKXH_H)
|
||||||
|
bd := component.BitStateType.Get(JCKXH_B)
|
||||||
|
ud := component.BitStateType.Get(JCKXH_U)
|
||||||
|
isDJ := ud.Val && lxj.Val || bd.Val && !lxj.Val && dxj.Val || hd.Val && !lxj.Val && dxj.Val
|
||||||
|
drive := component.RelayDriveType.Get(state.JCKXH_DJ)
|
||||||
|
drive.Td = isDJ
|
||||||
|
drive.Xq = isDJ
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,11 @@ type ZDJ9TwoDragSys struct {
|
|||||||
|
|
||||||
func NewZdj9TwoDragSys() *ZDJ9TwoDragSys {
|
func NewZdj9TwoDragSys() *ZDJ9TwoDragSys {
|
||||||
return &ZDJ9TwoDragSys{
|
return &ZDJ9TwoDragSys{
|
||||||
query: ecs.NewQuery(filter.Contains(component.Zdj9TwoElectronicType, component.TurnoutZzjType)),
|
query: ecs.NewQuery(filter.Contains(
|
||||||
|
component.Zdj9TwoElectronicType,
|
||||||
|
component.Zdj9TwoDriveType,
|
||||||
|
component.Zdj9TwoCollectType,
|
||||||
|
component.TurnoutZzjType)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,6 +28,9 @@ func NewZdj9TwoDragSys() *ZDJ9TwoDragSys {
|
|||||||
func (zdj9 *ZDJ9TwoDragSys) Update(w ecs.World) {
|
func (zdj9 *ZDJ9TwoDragSys) Update(w ecs.World) {
|
||||||
zdj9.query.Each(w, func(entry *ecs.Entry) {
|
zdj9.query.Each(w, func(entry *ecs.Entry) {
|
||||||
elec := component.Zdj9TwoElectronicType.Get(entry)
|
elec := component.Zdj9TwoElectronicType.Get(entry)
|
||||||
|
drive := component.Zdj9TwoDriveType.Get(entry)
|
||||||
|
collect := component.Zdj9TwoCollectType.Get(entry)
|
||||||
|
zdj9.exciteDriveElectronic(elec, drive)
|
||||||
// 转辙机一机电路相关动作
|
// 转辙机一机电路相关动作
|
||||||
// 1DQJ励磁状态控制
|
// 1DQJ励磁状态控制
|
||||||
zdj9.exciteM1_TDFJ_1DQJ(elec)
|
zdj9.exciteM1_TDFJ_1DQJ(elec)
|
||||||
@ -57,25 +64,67 @@ func (zdj9 *ZDJ9TwoDragSys) Update(w ecs.World) {
|
|||||||
zdj9.exciteM2_TDFJ1_DFBJ(entry, elec)
|
zdj9.exciteM2_TDFJ1_DFBJ(entry, elec)
|
||||||
|
|
||||||
// 总定表/反表继电器
|
// 总定表/反表继电器
|
||||||
zdj9.exciteZDFBJ(elec)
|
zdj9.exciteZDFBJ(entry, elec)
|
||||||
|
|
||||||
|
zdj9.exciteCollectElectronic(entry, elec, collect)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理采集电路状态
|
||||||
|
func (zdj9 *ZDJ9TwoDragSys) exciteCollectElectronic(entry *ecs.Entry, elec *component.Zdj9TwoElectronic, collect *component.Zdj9TwoCollect) {
|
||||||
|
zdbj := component.BitStateType.Get(elec.TDC_ZDBJ)
|
||||||
|
zfbj := component.BitStateType.Get(elec.TDC_ZFBJ)
|
||||||
|
ycj := component.BitStateType.Get(elec.TDC_YCJ)
|
||||||
|
tdfj1_dbj := component.BitStateType.Get(elec.TDFJ1_DBJ)
|
||||||
|
tdfj1_fbj := component.BitStateType.Get(elec.TDFJ1_FBJ)
|
||||||
|
tdfj2_dbj := component.BitStateType.Get(elec.TDFJ2_DBJ)
|
||||||
|
tdfj2_fbj := component.BitStateType.Get(elec.TDFJ2_FBJ)
|
||||||
|
|
||||||
|
collect.TDC_ZDBJ_XQ = zdbj.Val
|
||||||
|
collect.TDC_ZFBJ_XQ = zfbj.Val
|
||||||
|
collect.TDC_YCJ_XQ = ycj.Val
|
||||||
|
collect.TDC_ZDBJ_ZFBJ_LX = !zdbj.Val && !zfbj.Val
|
||||||
|
collect.TDFJ1_DBJ_XQ = tdfj1_dbj.Val
|
||||||
|
collect.TDFJ1_FBJ_XQ = tdfj1_fbj.Val
|
||||||
|
collect.TDFJ2_DBJ_XQ = tdfj2_dbj.Val
|
||||||
|
collect.TDFJ2_FBJ_XQ = tdfj2_fbj.Val
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理驱动电路励磁相关继电器
|
||||||
|
func (zdj9 *ZDJ9TwoDragSys) exciteDriveElectronic(elec *component.Zdj9TwoElectronic, driveElec *component.Zdj9TwoDrive) {
|
||||||
|
dcj_drive := component.RelayDriveType.Get(elec.TDC_DCJ)
|
||||||
|
fcj_drive := component.RelayDriveType.Get(elec.TDC_FCJ)
|
||||||
|
ycj_drive := component.RelayDriveType.Get(elec.TDC_YCJ)
|
||||||
|
|
||||||
|
if dcj_drive.Td != driveElec.DCJ {
|
||||||
|
dcj_drive.Td = driveElec.DCJ
|
||||||
|
}
|
||||||
|
if fcj_drive.Td != driveElec.FCJ {
|
||||||
|
fcj_drive.Td = driveElec.FCJ
|
||||||
|
}
|
||||||
|
if ycj_drive.Td != driveElec.YCJ {
|
||||||
|
ycj_drive.Td = driveElec.YCJ
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 总定表、反表继电器控制
|
// 总定表、反表继电器控制
|
||||||
func (zdj9 *ZDJ9TwoDragSys) exciteZDFBJ(elec *component.Zdj9TwoElectronic) {
|
func (zdj9 *ZDJ9TwoDragSys) exciteZDFBJ(entry *ecs.Entry, elec *component.Zdj9TwoElectronic) {
|
||||||
tdfj1_dbj := component.BitStateType.Get(elec.TDFJ1_DBJ)
|
tdfj1_dbj := component.BitStateType.Get(elec.TDFJ1_DBJ)
|
||||||
tdfj2_dbj := component.BitStateType.Get(elec.TDFJ2_DBJ)
|
tdfj2_dbj := component.BitStateType.Get(elec.TDFJ2_DBJ)
|
||||||
tdfj1_fbj := component.BitStateType.Get(elec.TDFJ1_FBJ)
|
tdfj1_fbj := component.BitStateType.Get(elec.TDFJ1_FBJ)
|
||||||
tdfj2_fbj := component.BitStateType.Get(elec.TDFJ2_FBJ)
|
tdfj2_fbj := component.BitStateType.Get(elec.TDFJ2_FBJ)
|
||||||
zdbj_drive := component.RelayDriveType.Get(elec.TDC_ZDBJ)
|
zdbj_drive := component.RelayDriveType.Get(elec.TDC_ZDBJ)
|
||||||
zfbj_drive := component.RelayDriveType.Get(elec.TDC_ZFBJ)
|
zfbj_drive := component.RelayDriveType.Get(elec.TDC_ZFBJ)
|
||||||
|
|
||||||
// 总定表
|
// 总定表
|
||||||
if zdbj_drive.Td { // 总定表继电器通电,监测电路是否断开
|
if zdbj_drive.Td { // 总定表继电器通电,监测电路是否断开
|
||||||
if !(tdfj1_dbj.Val && tdfj2_dbj.Val) {
|
if !(tdfj1_dbj.Val && tdfj2_dbj.Val) {
|
||||||
zdbj_drive.Td = false
|
zdbj_drive.Td = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if tdfj1_dbj.Val && tdfj2_dbj.Val {
|
if tdfj1_dbj.Val && tdfj2_dbj.Val &&
|
||||||
|
!entry.HasComponent(component.TurnoutFaultSbType) &&
|
||||||
|
!entry.HasComponent(component.TurnoutFaultDwsbType) {
|
||||||
zdbj_drive.Td = true
|
zdbj_drive.Td = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,7 +134,9 @@ func (zdj9 *ZDJ9TwoDragSys) exciteZDFBJ(elec *component.Zdj9TwoElectronic) {
|
|||||||
zfbj_drive.Td = false
|
zfbj_drive.Td = false
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if tdfj1_fbj.Val && tdfj2_fbj.Val {
|
if tdfj1_fbj.Val && tdfj2_fbj.Val &&
|
||||||
|
!entry.HasComponent(component.TurnoutFaultSbType) &&
|
||||||
|
!entry.HasComponent(component.TurnoutFaultFwsbType) {
|
||||||
zfbj_drive.Td = true
|
zfbj_drive.Td = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
sys/device_sys/alarm.go
Normal file
26
sys/device_sys/alarm.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package device_sys
|
||||||
|
|
||||||
|
import (
|
||||||
|
"joylink.club/ecs"
|
||||||
|
"joylink.club/ecs/filter"
|
||||||
|
"joylink.club/rtsssimulation/component"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FMQSys 蜂鸣系统
|
||||||
|
type AlarmSys struct {
|
||||||
|
query *ecs.Query
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAlarmSys() *AlarmSys {
|
||||||
|
return &AlarmSys{query: ecs.NewQuery(filter.Contains(component.AlarmDriveType, component.BitStateType))}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (alarm *AlarmSys) Update(w ecs.World) {
|
||||||
|
alarm.query.Each(w, func(entry *ecs.Entry) {
|
||||||
|
drive := component.AlarmDriveType.Get(entry)
|
||||||
|
state := component.BitStateType.Get(entry)
|
||||||
|
if drive.Td != state.Val {
|
||||||
|
state.Val = drive.Td
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
@ -1,26 +0,0 @@
|
|||||||
package device_sys
|
|
||||||
|
|
||||||
import (
|
|
||||||
"joylink.club/ecs"
|
|
||||||
"joylink.club/ecs/filter"
|
|
||||||
"joylink.club/rtsssimulation/component"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FMQSys 蜂鸣系统
|
|
||||||
type FMQSys struct {
|
|
||||||
query *ecs.Query
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewFMQSys() *FMQSys {
|
|
||||||
return &FMQSys{query: ecs.NewQuery(filter.Contains(component.FMQDriveType, component.BitStateType))}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (fmq *FMQSys) Update(w ecs.World) {
|
|
||||||
fmq.query.Each(w, func(entry *ecs.Entry) {
|
|
||||||
drive := component.FMQDriveType.Get(entry)
|
|
||||||
state := component.BitStateType.Get(entry)
|
|
||||||
if drive.Td != state.Val {
|
|
||||||
state.Val = drive.Td
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
@ -4,6 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/component/component_proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 道岔位置更新系统
|
// 道岔位置更新系统
|
||||||
@ -40,17 +41,20 @@ func (s *TurnoutSys) Update(w ecs.World) {
|
|||||||
zdj9 := component.Zdj9TwoElectronicType.Get(entry)
|
zdj9 := component.Zdj9TwoElectronicType.Get(entry)
|
||||||
zdbj := component.BitStateType.Get(zdj9.TDC_ZDBJ)
|
zdbj := component.BitStateType.Get(zdj9.TDC_ZDBJ)
|
||||||
zfbj := component.BitStateType.Get(zdj9.TDC_ZFBJ)
|
zfbj := component.BitStateType.Get(zdj9.TDC_ZFBJ)
|
||||||
tp.Db = zdbj.Val
|
setTurnoutBs(entry, tp, zdbj.Val, zfbj.Val)
|
||||||
tp.Fb = zfbj.Val
|
|
||||||
} else if entry.HasComponent(component.Zdj9OneElectronicType) {
|
} else if entry.HasComponent(component.Zdj9OneElectronicType) {
|
||||||
zdj9 := component.Zdj9OneElectronicType.Get(entry)
|
zdj9 := component.Zdj9OneElectronicType.Get(entry)
|
||||||
dbj := component.BitStateType.Get(zdj9.TDFJ_DBJ)
|
dbj := component.BitStateType.Get(zdj9.TDFJ_DBJ)
|
||||||
fbj := component.BitStateType.Get(zdj9.TDFJ_FBJ)
|
fbj := component.BitStateType.Get(zdj9.TDFJ_FBJ)
|
||||||
tp.Db = dbj.Val
|
setTurnoutBs(entry, tp, dbj.Val, fbj.Val)
|
||||||
tp.Fb = fbj.Val
|
|
||||||
} else {
|
} else {
|
||||||
tp.Db = dw
|
setTurnoutBs(entry, tp, dw, fw)
|
||||||
tp.Fb = fw
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置道岔定表
|
||||||
|
func setTurnoutBs(entry *ecs.Entry, tp *component_proto.TurnoutPosition, db bool, fb bool) {
|
||||||
|
tp.Db = db && !entry.HasComponent(component.TurnoutFaultSbType) && !entry.HasComponent(component.TurnoutFaultDwsbType)
|
||||||
|
tp.Fb = fb && !entry.HasComponent(component.TurnoutFaultSbType) && !entry.HasComponent(component.TurnoutFaultFwsbType)
|
||||||
|
}
|
||||||
|
@ -29,17 +29,24 @@ func (z *ZzjSys) Update(w ecs.World) {
|
|||||||
z.query.Each(w, func(entry *ecs.Entry) {
|
z.query.Each(w, func(entry *ecs.Entry) {
|
||||||
zzj := component.ZzjStateType.Get(entry)
|
zzj := component.ZzjStateType.Get(entry)
|
||||||
tp := component.TwoPositionTransformType.Get(entry)
|
tp := component.TwoPositionTransformType.Get(entry)
|
||||||
if zzj.Td { // 通电
|
if entry.HasComponent(component.TurnoutFaultJcType) {
|
||||||
if tp.Speed >= 0 && tp.Pos > consts.TwoPosMin && zzj.Dw { // 转到定位
|
// 道岔挤岔,设置位置到中间,且不再能转动
|
||||||
tp.Speed = -component.CalculateTwoPositionAvgSpeed(TurnTime, w.Tick())
|
tp.Pos = consts.TwoPosMax / 2
|
||||||
} else if tp.Speed <= 0 && tp.Pos < consts.TwoPosMax && !zzj.Dw { // 转到反位
|
tp.Speed = 0
|
||||||
tp.Speed = component.CalculateTwoPositionAvgSpeed(TurnTime, w.Tick())
|
} else { // 正常转辙机带动
|
||||||
}
|
if zzj.Td { // 通电
|
||||||
} else { // 未通电
|
if tp.Speed >= 0 && tp.Pos > consts.TwoPosMin && zzj.Dw { // 转到定位
|
||||||
if tp.Speed != 0 { // 停止
|
tp.Speed = -component.CalculateTwoPositionAvgSpeed(TurnTime, w.Tick())
|
||||||
tp.Speed = 0
|
} else if tp.Speed <= 0 && tp.Pos < consts.TwoPosMax && !zzj.Dw { // 转到反位
|
||||||
|
tp.Speed = component.CalculateTwoPositionAvgSpeed(TurnTime, w.Tick())
|
||||||
|
}
|
||||||
|
} else { // 未通电
|
||||||
|
if tp.Speed != 0 { // 停止
|
||||||
|
tp.Speed = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if tp.Pos == consts.TwoPosMax { // 到反位
|
if tp.Pos == consts.TwoPosMax { // 到反位
|
||||||
if !zzj.JD12 {
|
if !zzj.JD12 {
|
||||||
zzj.JD12 = true
|
zzj.JD12 = true
|
||||||
|
Loading…
Reference in New Issue
Block a user