实现联锁驱采卡系统功能
调整道岔驱动电路逻辑
This commit is contained in:
parent
8cf9e419b8
commit
a0352ee5e8
@ -1,29 +0,0 @@
|
|||||||
package component
|
|
||||||
|
|
||||||
import (
|
|
||||||
"joylink.club/ecs"
|
|
||||||
"joylink.club/rtsssimulation/component/component_proto"
|
|
||||||
"joylink.club/rtsssimulation/repository"
|
|
||||||
"joylink.club/rtsssimulation/repository/model/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
// 联锁驱动状态表
|
|
||||||
CiQdStateType = ecs.NewComponentType[component_proto.CiQdState]()
|
|
||||||
// 联锁采集状态表
|
|
||||||
CiCjStateType = ecs.NewComponentType[component_proto.CiCjState]()
|
|
||||||
)
|
|
||||||
|
|
||||||
// 联锁驱采数据表
|
|
||||||
type CiQcTable struct {
|
|
||||||
// 所属集中站
|
|
||||||
station *repository.Station
|
|
||||||
// 驱动码表
|
|
||||||
QdBits []proto.CjDataItem
|
|
||||||
// 采集码表
|
|
||||||
CjBits []proto.CjData
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetCiQdBitOfRelay(ci *ecs.Entry, uid string) (bool, error) {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
63
component/ci_qc.go
Normal file
63
component/ci_qc.go
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package component
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"joylink.club/ecs"
|
||||||
|
"joylink.club/rtsssimulation/component/component_proto"
|
||||||
|
"joylink.club/rtsssimulation/repository/model/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// 驱采表引用
|
||||||
|
CiQcTableType = ecs.NewComponentType[CiQcTable]()
|
||||||
|
// 联锁驱动、采集状态表
|
||||||
|
CiQcStateType = ecs.NewComponentType[CiQcState]()
|
||||||
|
)
|
||||||
|
|
||||||
|
// 联锁驱采数据表
|
||||||
|
type CiQcTable struct {
|
||||||
|
// 驱动码表
|
||||||
|
QdBits []*proto.QdData
|
||||||
|
// 采集码表
|
||||||
|
CjBits []*proto.CjData
|
||||||
|
// 驱动索引
|
||||||
|
QdIndex map[string]int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (qc *CiQcTable) BuildQcIndex() error {
|
||||||
|
qc.QdIndex = make(map[string]int)
|
||||||
|
for i, qd := range qc.QdBits {
|
||||||
|
if len(qd.RefRelays) > 0 {
|
||||||
|
key := qd.RefRelays[0]
|
||||||
|
if _, ok := qc.QdIndex[key]; ok {
|
||||||
|
return fmt.Errorf("联锁驱动数据重复,驱动码表存在多个相同继电器: '%s'", key)
|
||||||
|
} else {
|
||||||
|
qc.QdIndex[key] = i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (qc *CiQcTable) QueryQdIndex(uid string) (int, bool) {
|
||||||
|
idx, ok := qc.QdIndex[uid]
|
||||||
|
return idx, ok
|
||||||
|
}
|
||||||
|
|
||||||
|
type CiQcState struct {
|
||||||
|
component_proto.CiQcState
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCiQcState(qlen int, clen int) *CiQcState {
|
||||||
|
return &CiQcState{
|
||||||
|
component_proto.CiQcState{
|
||||||
|
Qbs: make([]byte, qlen),
|
||||||
|
Cbs: make([]byte, clen),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetCiQdBitOfRelay(ci *ecs.Entry, uid string) (bool, error) {
|
||||||
|
return false, nil
|
||||||
|
}
|
@ -20,18 +20,20 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
// 联锁驱动状态表
|
// 联锁驱动、采集状态表
|
||||||
type CiQdState struct {
|
type CiQcState struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
// 驱动bit列表
|
// 驱动bit表
|
||||||
Bits []bool `protobuf:"varint,1,rep,packed,name=bits,proto3" json:"bits,omitempty"`
|
Qbs []byte `protobuf:"bytes,1,opt,name=qbs,proto3" json:"qbs,omitempty"`
|
||||||
|
// 采集bit表
|
||||||
|
Cbs []byte `protobuf:"bytes,2,opt,name=cbs,proto3" json:"cbs,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CiQdState) Reset() {
|
func (x *CiQcState) Reset() {
|
||||||
*x = CiQdState{}
|
*x = CiQcState{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_component_ci_proto_msgTypes[0]
|
mi := &file_component_ci_proto_msgTypes[0]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -39,13 +41,13 @@ func (x *CiQdState) Reset() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CiQdState) String() string {
|
func (x *CiQcState) String() string {
|
||||||
return protoimpl.X.MessageStringOf(x)
|
return protoimpl.X.MessageStringOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*CiQdState) ProtoMessage() {}
|
func (*CiQcState) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *CiQdState) ProtoReflect() protoreflect.Message {
|
func (x *CiQcState) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_component_ci_proto_msgTypes[0]
|
mi := &file_component_ci_proto_msgTypes[0]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
@ -57,62 +59,21 @@ func (x *CiQdState) ProtoReflect() protoreflect.Message {
|
|||||||
return mi.MessageOf(x)
|
return mi.MessageOf(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated: Use CiQdState.ProtoReflect.Descriptor instead.
|
// Deprecated: Use CiQcState.ProtoReflect.Descriptor instead.
|
||||||
func (*CiQdState) Descriptor() ([]byte, []int) {
|
func (*CiQcState) Descriptor() ([]byte, []int) {
|
||||||
return file_component_ci_proto_rawDescGZIP(), []int{0}
|
return file_component_ci_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CiQdState) GetBits() []bool {
|
func (x *CiQcState) GetQbs() []byte {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Bits
|
return x.Qbs
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 联锁采集状态表
|
func (x *CiQcState) GetCbs() []byte {
|
||||||
type CiCjState struct {
|
|
||||||
state protoimpl.MessageState
|
|
||||||
sizeCache protoimpl.SizeCache
|
|
||||||
unknownFields protoimpl.UnknownFields
|
|
||||||
|
|
||||||
Bits []bool `protobuf:"varint,1,rep,packed,name=bits,proto3" json:"bits,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CiCjState) Reset() {
|
|
||||||
*x = CiCjState{}
|
|
||||||
if protoimpl.UnsafeEnabled {
|
|
||||||
mi := &file_component_ci_proto_msgTypes[1]
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CiCjState) String() string {
|
|
||||||
return protoimpl.X.MessageStringOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*CiCjState) ProtoMessage() {}
|
|
||||||
|
|
||||||
func (x *CiCjState) ProtoReflect() protoreflect.Message {
|
|
||||||
mi := &file_component_ci_proto_msgTypes[1]
|
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
||||||
if ms.LoadMessageInfo() == nil {
|
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
return ms
|
|
||||||
}
|
|
||||||
return mi.MessageOf(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use CiCjState.ProtoReflect.Descriptor instead.
|
|
||||||
func (*CiCjState) Descriptor() ([]byte, []int) {
|
|
||||||
return file_component_ci_proto_rawDescGZIP(), []int{1}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *CiCjState) GetBits() []bool {
|
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Bits
|
return x.Cbs
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -122,13 +83,12 @@ var File_component_ci_proto protoreflect.FileDescriptor
|
|||||||
var file_component_ci_proto_rawDesc = []byte{
|
var file_component_ci_proto_rawDesc = []byte{
|
||||||
0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x69, 0x2e, 0x70,
|
0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x69, 0x2e, 0x70,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x22,
|
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x22,
|
||||||
0x1f, 0x0a, 0x09, 0x43, 0x69, 0x51, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04,
|
0x2f, 0x0a, 0x09, 0x43, 0x69, 0x51, 0x63, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03,
|
||||||
0x62, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x08, 0x52, 0x04, 0x62, 0x69, 0x74, 0x73,
|
0x71, 0x62, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x71, 0x62, 0x73, 0x12, 0x10,
|
||||||
0x22, 0x1f, 0x0a, 0x09, 0x43, 0x69, 0x43, 0x6a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a,
|
0x0a, 0x03, 0x63, 0x62, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x63, 0x62, 0x73,
|
||||||
0x04, 0x62, 0x69, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x08, 0x52, 0x04, 0x62, 0x69, 0x74,
|
0x42, 0x1d, 0x5a, 0x1b, 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f,
|
||||||
0x73, 0x42, 0x1d, 0x5a, 0x1b, 0x2e, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
|
0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||||
0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -143,10 +103,9 @@ func file_component_ci_proto_rawDescGZIP() []byte {
|
|||||||
return file_component_ci_proto_rawDescData
|
return file_component_ci_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_component_ci_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
var file_component_ci_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
var file_component_ci_proto_goTypes = []interface{}{
|
var file_component_ci_proto_goTypes = []interface{}{
|
||||||
(*CiQdState)(nil), // 0: component.CiQdState
|
(*CiQcState)(nil), // 0: component.CiQcState
|
||||||
(*CiCjState)(nil), // 1: component.CiCjState
|
|
||||||
}
|
}
|
||||||
var file_component_ci_proto_depIdxs = []int32{
|
var file_component_ci_proto_depIdxs = []int32{
|
||||||
0, // [0:0] is the sub-list for method output_type
|
0, // [0:0] is the sub-list for method output_type
|
||||||
@ -163,19 +122,7 @@ func file_component_ci_proto_init() {
|
|||||||
}
|
}
|
||||||
if !protoimpl.UnsafeEnabled {
|
if !protoimpl.UnsafeEnabled {
|
||||||
file_component_ci_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
file_component_ci_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*CiQdState); i {
|
switch v := v.(*CiQcState); i {
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_component_ci_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
|
||||||
switch v := v.(*CiCjState); i {
|
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@ -193,7 +140,7 @@ func file_component_ci_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_component_ci_proto_rawDesc,
|
RawDescriptor: file_component_ci_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 2,
|
NumMessages: 1,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
@ -1,18 +1,104 @@
|
|||||||
package component
|
package component
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
|
"joylink.club/rtsssimulation/consts"
|
||||||
"joylink.club/rtsssimulation/repository"
|
"joylink.club/rtsssimulation/repository"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 世界公共数据
|
||||||
|
var WorldDataType = ecs.NewComponentType[WorldData]()
|
||||||
|
|
||||||
// 世界数据单例组件
|
// 世界数据单例组件
|
||||||
type WorldData struct {
|
type WorldData struct {
|
||||||
Repo *repository.Repository
|
Repo *repository.Repository
|
||||||
// 世界时间,时间戳,单位ms
|
// 世界时间,时间戳,单位ms
|
||||||
Time int64
|
Time int64
|
||||||
|
|
||||||
|
// uid为key的实体对象map
|
||||||
EntityMap map[string]*ecs.Entry
|
EntityMap map[string]*ecs.Entry
|
||||||
|
// 联锁驱采卡实体
|
||||||
|
CiQcEntities []*ecs.Entry
|
||||||
}
|
}
|
||||||
|
|
||||||
// 世界公共数据
|
// 是否在驱动码表中
|
||||||
var WorldDataType = ecs.NewComponentType[WorldData]()
|
func (wd *WorldData) IsDefinedInQdTable(uid string) bool {
|
||||||
|
for _, entry := range wd.CiQcEntities {
|
||||||
|
qc := CiQcTableType.Get(entry)
|
||||||
|
_, ok := qc.QueryQdIndex(uid)
|
||||||
|
if ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询驱动位值
|
||||||
|
func (wd *WorldData) QueryQdBit(uid string) (bool, error) {
|
||||||
|
for _, entry := range wd.CiQcEntities {
|
||||||
|
qc := CiQcTableType.Get(entry)
|
||||||
|
idx, ok := qc.QueryQdIndex(uid)
|
||||||
|
if ok {
|
||||||
|
states := CiQcStateType.Get(entry)
|
||||||
|
return consts.GetBitOfBytes(states.Qbs, idx), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false, fmt.Errorf("没有定义id=%s的继电器的驱动码表", uid)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据uid获取对应设备的驱动位值
|
||||||
|
// 注意: 若找不到uid驱动码位会panic
|
||||||
|
func (wd *WorldData) GetQdBit(uid string) bool {
|
||||||
|
bit, err := wd.QueryQdBit(uid)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return bit
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取继电器驱动位值
|
||||||
|
// 注意: 若没有uid组件或者找不到uid驱动码位会panic
|
||||||
|
func (wd *WorldData) GetRelayEntityQdBit(entry *ecs.Entry) bool {
|
||||||
|
if !entry.HasComponent(UidType) {
|
||||||
|
panic(fmt.Errorf("获取继电器实体驱动位值异常,实体没有uid组件"))
|
||||||
|
}
|
||||||
|
return wd.GetQdBit(UidType.Get(entry).Id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据uid获取对应设备的驱动位值
|
||||||
|
func (wd *WorldData) SetQdBit(uid string, v bool) error {
|
||||||
|
for _, entry := range wd.CiQcEntities {
|
||||||
|
qc := CiQcTableType.Get(entry)
|
||||||
|
idx, ok := qc.QueryQdIndex(uid)
|
||||||
|
if ok {
|
||||||
|
states := CiQcStateType.Get(entry)
|
||||||
|
consts.SetBitOfBytes(states.Qbs, idx, v)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fmt.Errorf("没有定义id=%s的继电器的驱动码表", uid)
|
||||||
|
}
|
||||||
|
|
||||||
|
type QdBitParam struct {
|
||||||
|
Uid string
|
||||||
|
Val bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewQdBitParam(uid string, v bool) *QdBitParam {
|
||||||
|
return &QdBitParam{
|
||||||
|
Uid: uid,
|
||||||
|
Val: v,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wd *WorldData) SetQdBits(params []*QdBitParam) error {
|
||||||
|
for _, param := range params {
|
||||||
|
err := wd.SetQdBit(param.Uid, param.Val)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -177,43 +177,43 @@ func (te *Zdj9TwoElectronic) HasNilReference() bool {
|
|||||||
return len(nils) > 0
|
return len(nils) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZDJ9双机驱动状态组件
|
// // ZDJ9双机驱动状态组件
|
||||||
type Zdj9TwoDrive struct {
|
// type Zdj9TwoDrive struct {
|
||||||
// 定操继电器驱动
|
// // 定操继电器驱动
|
||||||
DCJ bool
|
// DCJ bool
|
||||||
// 反操继电器驱动
|
// // 反操继电器驱动
|
||||||
FCJ bool
|
// FCJ bool
|
||||||
// 允操继电器驱动
|
// // 允操继电器驱动
|
||||||
YCJ bool
|
// YCJ bool
|
||||||
}
|
// }
|
||||||
|
|
||||||
// ZDJ9双机采集状态组件
|
// // ZDJ9双机采集状态组件
|
||||||
type Zdj9TwoCollect struct {
|
// type Zdj9TwoCollect struct {
|
||||||
// 总定表继电器吸起采集
|
// // 总定表继电器吸起采集
|
||||||
TDC_ZDBJ_XQ bool
|
// TDC_ZDBJ_XQ bool
|
||||||
// 总反表继电器吸起采集
|
// // 总反表继电器吸起采集
|
||||||
TDC_ZFBJ_XQ bool
|
// TDC_ZFBJ_XQ bool
|
||||||
// 允操继电器吸起采集
|
// // 允操继电器吸起采集
|
||||||
TDC_YCJ_XQ bool
|
// TDC_YCJ_XQ bool
|
||||||
// 总定表继电器和总反表继电器都落下采集
|
// // 总定表继电器和总反表继电器都落下采集
|
||||||
TDC_ZDBJ_ZFBJ_LX bool
|
// TDC_ZDBJ_ZFBJ_LX bool
|
||||||
// 1机定表继电器吸起采集
|
// // 1机定表继电器吸起采集
|
||||||
TDFJ1_DBJ_XQ bool
|
// TDFJ1_DBJ_XQ bool
|
||||||
// 1机反表继电器吸起采集
|
// // 1机反表继电器吸起采集
|
||||||
TDFJ1_FBJ_XQ bool
|
// TDFJ1_FBJ_XQ bool
|
||||||
// 2机定表继电器吸起采集
|
// // 2机定表继电器吸起采集
|
||||||
TDFJ2_DBJ_XQ bool
|
// TDFJ2_DBJ_XQ bool
|
||||||
// 2机反表继电器吸起采集
|
// // 2机反表继电器吸起采集
|
||||||
TDFJ2_FBJ_XQ bool
|
// TDFJ2_FBJ_XQ bool
|
||||||
}
|
// }
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ZDJ9双机电路元器件组件类型
|
// ZDJ9双机电路元器件组件类型
|
||||||
Zdj9TwoElectronicType = ecs.NewComponentType[Zdj9TwoElectronic]()
|
Zdj9TwoElectronicType = ecs.NewComponentType[Zdj9TwoElectronic]()
|
||||||
// ZDJ9双机驱动状态组件类型
|
// // ZDJ9双机驱动状态组件类型
|
||||||
Zdj9TwoDriveType = ecs.NewComponentType[Zdj9TwoDrive]()
|
// Zdj9TwoDriveType = ecs.NewComponentType[Zdj9TwoDrive]()
|
||||||
// ZDJ9双机采集状态组件类型
|
// // ZDJ9双机采集状态组件类型
|
||||||
Zdj9TwoCollectType = ecs.NewComponentType[Zdj9TwoCollect]()
|
// Zdj9TwoCollectType = ecs.NewComponentType[Zdj9TwoCollect]()
|
||||||
)
|
)
|
||||||
|
|
||||||
// 转辙机状态
|
// 转辙机状态
|
||||||
|
37
consts/bit.go
Normal file
37
consts/bit.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package consts
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
// 获取字节数组中的位值
|
||||||
|
// bs - 原始字节数组
|
||||||
|
// bitIndex - 位索引
|
||||||
|
func GetBitOfBytes(bs []byte, bitIndex int) bool {
|
||||||
|
bi := bitIndex / 8
|
||||||
|
i := bitIndex % 8
|
||||||
|
if bi >= len(bs) {
|
||||||
|
panic(fmt.Errorf("从字节数组获取位值错误,位索引超出字节数组范围: 数组len=%d,位索引=%d", len(bs), bitIndex))
|
||||||
|
}
|
||||||
|
by := bs[bi]
|
||||||
|
v := byte(1 << (7 - i))
|
||||||
|
return (by & v) == v
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置字节数组中的位值
|
||||||
|
// bs - 原始字节数组
|
||||||
|
// bitIndex - 位索引
|
||||||
|
// v - 位值
|
||||||
|
func SetBitOfBytes(bs []byte, bitIndex int, v bool) []byte {
|
||||||
|
bi := bitIndex / 8
|
||||||
|
i := bitIndex % 8
|
||||||
|
if bi >= len(bs) {
|
||||||
|
panic(fmt.Errorf("设置字节数组位值错误,位索引超出字节数组范围: 数组len=%d,位索引=%d", len(bs), bitIndex))
|
||||||
|
}
|
||||||
|
by := bs[bi]
|
||||||
|
if v {
|
||||||
|
by |= (1 << (7 - i))
|
||||||
|
} else {
|
||||||
|
by &= ((1 << (7 - i)) ^ byte(0xff))
|
||||||
|
}
|
||||||
|
bs[bi] = by
|
||||||
|
return bs
|
||||||
|
}
|
117
consts/bit_test.go
Normal file
117
consts/bit_test.go
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
package consts
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetBitOfBytes(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
give []byte
|
||||||
|
giveBitIndex int
|
||||||
|
want bool
|
||||||
|
wantPanic bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 2,
|
||||||
|
want: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 6,
|
||||||
|
want: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 8,
|
||||||
|
want: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 10,
|
||||||
|
want: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 11,
|
||||||
|
want: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 16,
|
||||||
|
wantPanic: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, v := range tests {
|
||||||
|
t.Run(string(v.give), func(t *testing.T) {
|
||||||
|
if v.wantPanic {
|
||||||
|
assert.Panics(t, func() { GetBitOfBytes(v.give, v.giveBitIndex) })
|
||||||
|
} else {
|
||||||
|
assert.Equal(t, v.want, GetBitOfBytes(v.give, v.giveBitIndex))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestSetBitOfBytes(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
give []byte
|
||||||
|
giveBitIndex int
|
||||||
|
giveVal bool
|
||||||
|
want []byte
|
||||||
|
wantPanic bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 2,
|
||||||
|
giveVal: true,
|
||||||
|
want: []byte{0b00100010, 0b00011111},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 6,
|
||||||
|
giveVal: false,
|
||||||
|
want: []byte{0b00000000, 0b00011111},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 8,
|
||||||
|
giveVal: false,
|
||||||
|
want: []byte{0b00000010, 0b00011111},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 10,
|
||||||
|
giveVal: true,
|
||||||
|
want: []byte{0b00000010, 0b00111111},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 11,
|
||||||
|
giveVal: false,
|
||||||
|
want: []byte{0b00000010, 0b00001111},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
give: []byte{0b00000010, 0b00011111},
|
||||||
|
giveBitIndex: 16,
|
||||||
|
wantPanic: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, v := range tests {
|
||||||
|
t.Run(strconv.Itoa(v.giveBitIndex), func(t *testing.T) {
|
||||||
|
if v.wantPanic {
|
||||||
|
assert.Panics(t, func() { SetBitOfBytes(v.give, v.giveBitIndex, v.giveVal) })
|
||||||
|
} else {
|
||||||
|
assert.Equal(t, v.want, SetBitOfBytes(v.give, v.giveBitIndex, v.giveVal))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestBitOperation(t *testing.T) {
|
||||||
|
assert.Equal(t, fmt.Sprintf("%b", 0b11111101), fmt.Sprintf("%b", (1<<(7-6))^0xff))
|
||||||
|
}
|
44
entity/ci_qc.go
Normal file
44
entity/ci_qc.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package entity
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
|
"joylink.club/ecs"
|
||||||
|
"joylink.club/rtsssimulation/component"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newCiQC(w ecs.World, data *component.WorldData) *ecs.Entry {
|
||||||
|
entry := w.Entry(w.Create(component.CiQcTableType, component.CiQcStateType))
|
||||||
|
data.CiQcEntities = append(data.CiQcEntities, entry)
|
||||||
|
return entry
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载联锁驱动、采集卡
|
||||||
|
func LoadCiQC(w ecs.World) error {
|
||||||
|
data := GetWorldData(w)
|
||||||
|
for _, csr := range data.Repo.CiQcList() {
|
||||||
|
// if len(csr.CjList) == 0 {
|
||||||
|
// return fmt.Errorf("加载联锁驱采卡实体失败,车站'%s'无采集码表数据", csr.StationId)
|
||||||
|
// }
|
||||||
|
// if len(csr.QdList) == 0 {
|
||||||
|
// return fmt.Errorf("加载联锁驱采卡实体失败,车站'%s'无驱动码表数据", csr.StationId)
|
||||||
|
// }
|
||||||
|
if len(csr.CjList) == 0 || len(csr.QdList) == 0 {
|
||||||
|
slog.Warn("加载联锁驱采卡实体失败,无驱动/采集码表数据", "车站", csr.StationId)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
entry := newCiQC(w, data)
|
||||||
|
qctable := &component.CiQcTable{
|
||||||
|
QdBits: csr.QdList,
|
||||||
|
CjBits: csr.CjList,
|
||||||
|
}
|
||||||
|
err := qctable.BuildQcIndex()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
component.CiQcTableType.Set(entry, qctable)
|
||||||
|
component.CiQcStateType.Set(entry, component.NewCiQcState(len(csr.QdList), len(csr.CjList)))
|
||||||
|
}
|
||||||
|
// TODO: 不同联锁驱动码位索引唯一检查
|
||||||
|
return nil
|
||||||
|
}
|
@ -9,8 +9,12 @@ import (
|
|||||||
func Load(w ecs.World, repo *repository.Repository) error {
|
func Load(w ecs.World, repo *repository.Repository) error {
|
||||||
// 初始化世界数据单例组件
|
// 初始化世界数据单例组件
|
||||||
LoadWorldData(w, repo)
|
LoadWorldData(w, repo)
|
||||||
|
err := LoadCiQC(w)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
// 加载道岔相关实体
|
// 加载道岔相关实体
|
||||||
err := LoadTurnouts(w)
|
err = LoadTurnouts(w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,17 @@ import (
|
|||||||
"joylink.club/rtsssimulation/repository/model/proto"
|
"joylink.club/rtsssimulation/repository/model/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 新建道岔实体
|
||||||
|
func NewTurnoutEntity(w ecs.World, uid string, worldData *component.WorldData) *ecs.Entry {
|
||||||
|
entry, ok := worldData.EntityMap[uid]
|
||||||
|
if !ok {
|
||||||
|
entry = w.Entry(w.Create(component.TurnoutTag, component.UidType, component.TurnoutPositionType))
|
||||||
|
component.UidType.SetValue(entry, component.Uid{Id: uid})
|
||||||
|
worldData.EntityMap[uid] = entry
|
||||||
|
}
|
||||||
|
return entry
|
||||||
|
}
|
||||||
|
|
||||||
// 加载道岔实体
|
// 加载道岔实体
|
||||||
func LoadTurnouts(w ecs.World) error {
|
func LoadTurnouts(w ecs.World) error {
|
||||||
data := GetWorldData(w)
|
data := GetWorldData(w)
|
||||||
@ -133,22 +144,9 @@ 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个,现有%d个", turnout.Id(), size)
|
return fmt.Errorf("id=[%s]的道岔是ZDJ9双机牵引,继电器组合类型应为3个,现有%d个", turnout.Id(), size)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新建道岔实体
|
|
||||||
func NewTurnoutEntity(w ecs.World, uid string, worldData *component.WorldData) *ecs.Entry {
|
|
||||||
entry, ok := worldData.EntityMap[uid]
|
|
||||||
if !ok {
|
|
||||||
entry = w.Entry(w.Create(component.TurnoutTag, component.UidType, component.TurnoutPositionType))
|
|
||||||
component.UidType.SetValue(entry, component.Uid{Id: uid})
|
|
||||||
worldData.EntityMap[uid] = entry
|
|
||||||
}
|
|
||||||
return entry
|
|
||||||
}
|
|
||||||
|
@ -62,23 +62,40 @@ func updateTurnoutFault(w ecs.World, id string, fault component_proto.Turnout_Fa
|
|||||||
// on - 设置/取消
|
// on - 设置/取消
|
||||||
func driveTurnoutZzj(w ecs.World, id string, dc bool, on bool) error {
|
func driveTurnoutZzj(w ecs.World, id string, dc bool, on bool) error {
|
||||||
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
result := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
|
||||||
|
}
|
||||||
|
}()
|
||||||
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.Zdj9TwoDriveType) { // 有电路,驱动继电器
|
if entry.HasComponent(component.Zdj9TwoElectronicType) { // 有电路,驱动继电器
|
||||||
drive := component.Zdj9TwoDriveType.Get(entry)
|
elec := component.Zdj9TwoElectronicType.Get(entry)
|
||||||
if dc {
|
var err error
|
||||||
drive.YCJ = on
|
|
||||||
drive.DCJ = on
|
|
||||||
if on {
|
if on {
|
||||||
drive.FCJ = !on
|
if dc {
|
||||||
|
err = wd.SetQdBits([]*component.QdBitParam{
|
||||||
|
component.NewQdBitParam(component.UidType.Get(elec.TDC_FCJ).Id, false),
|
||||||
|
component.NewQdBitParam(component.UidType.Get(elec.TDC_DCJ).Id, true),
|
||||||
|
component.NewQdBitParam(component.UidType.Get(elec.TDC_YCJ).Id, true),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
err = wd.SetQdBits([]*component.QdBitParam{
|
||||||
|
component.NewQdBitParam(component.UidType.Get(elec.TDC_DCJ).Id, false),
|
||||||
|
component.NewQdBitParam(component.UidType.Get(elec.TDC_FCJ).Id, true),
|
||||||
|
component.NewQdBitParam(component.UidType.Get(elec.TDC_YCJ).Id, true),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
drive.YCJ = on
|
err = wd.SetQdBits([]*component.QdBitParam{
|
||||||
drive.FCJ = on
|
component.NewQdBitParam(component.UidType.Get(elec.TDC_DCJ).Id, false),
|
||||||
if on {
|
component.NewQdBitParam(component.UidType.Get(elec.TDC_FCJ).Id, false),
|
||||||
drive.DCJ = !on
|
component.NewQdBitParam(component.UidType.Get(elec.TDC_YCJ).Id, false),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
if err != nil {
|
||||||
|
return ecs.NewErrResult(err)
|
||||||
}
|
}
|
||||||
} else { // 无电路,直接驱动转辙机
|
} else { // 无电路,直接驱动转辙机
|
||||||
if entry.HasComponent(component.TurnoutFaultCiqdType) {
|
if entry.HasComponent(component.TurnoutFaultCiqdType) {
|
||||||
@ -167,7 +184,7 @@ func forceTurnout(w ecs.World, id string, pos ForceTurnoutPos) error {
|
|||||||
if !entry.HasComponent(component.TurnoutFaultCiqdType) {
|
if !entry.HasComponent(component.TurnoutFaultCiqdType) {
|
||||||
entry.AddComponent(component.TurnoutFaultCiqdType)
|
entry.AddComponent(component.TurnoutFaultCiqdType)
|
||||||
}
|
}
|
||||||
if entry.HasComponent(component.Zdj9TwoDriveType) { // 有电路,驱动继电器
|
if entry.HasComponent(component.Zdj9TwoElectronicType) { // 有电路,驱动继电器
|
||||||
elec := component.Zdj9TwoElectronicType.Get(entry)
|
elec := component.Zdj9TwoElectronicType.Get(entry)
|
||||||
if pos == TurnoutForceDw {
|
if pos == TurnoutForceDw {
|
||||||
component.RelayDriveType.Get(elec.TDC_FCJ).Td = false
|
component.RelayDriveType.Get(elec.TDC_FCJ).Td = false
|
||||||
@ -178,9 +195,6 @@ func forceTurnout(w ecs.World, id string, pos ForceTurnoutPos) error {
|
|||||||
component.RelayDriveType.Get(elec.TDC_YCJ).Td = true
|
component.RelayDriveType.Get(elec.TDC_YCJ).Td = true
|
||||||
component.RelayDriveType.Get(elec.TDC_FCJ).Td = true
|
component.RelayDriveType.Get(elec.TDC_FCJ).Td = true
|
||||||
}
|
}
|
||||||
// else if pos == ForceTurnoutSb {
|
|
||||||
// elec.Sb = true
|
|
||||||
// }
|
|
||||||
} else { // 无电路,直接驱动转辙机
|
} else { // 无电路,直接驱动转辙机
|
||||||
tz := component.TurnoutZzjType.Get(entry)
|
tz := component.TurnoutZzjType.Get(entry)
|
||||||
for _, zzj := range tz.ZzjList {
|
for _, zzj := range tz.ZzjList {
|
||||||
|
@ -4,13 +4,10 @@ package component;
|
|||||||
|
|
||||||
option go_package = "./component/component_proto";
|
option go_package = "./component/component_proto";
|
||||||
|
|
||||||
// 联锁驱动状态表
|
// 联锁驱动、采集状态表
|
||||||
message CiQdState {
|
message CiQcState {
|
||||||
// 驱动bit列表
|
// 驱动bit表
|
||||||
repeated bool bits = 1;
|
bytes qbs = 1;
|
||||||
}
|
// 采集bit表
|
||||||
|
bytes cbs = 2;
|
||||||
// 联锁采集状态表
|
|
||||||
message CiCjState {
|
|
||||||
repeated bool bits = 1;
|
|
||||||
}
|
}
|
||||||
|
@ -309,12 +309,8 @@ message CjData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message CjDataItem {
|
message CjDataItem {
|
||||||
enum PostionType {
|
|
||||||
Q=0;
|
|
||||||
H=1;
|
|
||||||
}
|
|
||||||
string relayId = 1;//采集对应的继电器Id
|
string relayId = 1;//采集对应的继电器Id
|
||||||
PostionType position = 2;//继电器的位置,QH对应着吸合
|
bool q = 2;//继电器的位置,是否前接点(即吸起位/定位)
|
||||||
}
|
}
|
||||||
|
|
||||||
message QdData {
|
message QdData {
|
||||||
|
@ -561,52 +561,6 @@ func (Light_LightAspect) EnumDescriptor() ([]byte, []int) {
|
|||||||
return file_model_proto_rawDescGZIP(), []int{16, 0}
|
return file_model_proto_rawDescGZIP(), []int{16, 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
type CjDataItem_PostionType int32
|
|
||||||
|
|
||||||
const (
|
|
||||||
CjDataItem_Q CjDataItem_PostionType = 0
|
|
||||||
CjDataItem_H CjDataItem_PostionType = 1
|
|
||||||
)
|
|
||||||
|
|
||||||
// Enum value maps for CjDataItem_PostionType.
|
|
||||||
var (
|
|
||||||
CjDataItem_PostionType_name = map[int32]string{
|
|
||||||
0: "Q",
|
|
||||||
1: "H",
|
|
||||||
}
|
|
||||||
CjDataItem_PostionType_value = map[string]int32{
|
|
||||||
"Q": 0,
|
|
||||||
"H": 1,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
func (x CjDataItem_PostionType) Enum() *CjDataItem_PostionType {
|
|
||||||
p := new(CjDataItem_PostionType)
|
|
||||||
*p = x
|
|
||||||
return p
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x CjDataItem_PostionType) String() string {
|
|
||||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (CjDataItem_PostionType) Descriptor() protoreflect.EnumDescriptor {
|
|
||||||
return file_model_proto_enumTypes[9].Descriptor()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (CjDataItem_PostionType) Type() protoreflect.EnumType {
|
|
||||||
return &file_model_proto_enumTypes[9]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x CjDataItem_PostionType) Number() protoreflect.EnumNumber {
|
|
||||||
return protoreflect.EnumNumber(x)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deprecated: Use CjDataItem_PostionType.Descriptor instead.
|
|
||||||
func (CjDataItem_PostionType) EnumDescriptor() ([]byte, []int) {
|
|
||||||
return file_model_proto_rawDescGZIP(), []int{26, 0}
|
|
||||||
}
|
|
||||||
|
|
||||||
type Repository struct {
|
type Repository struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -2571,7 +2525,7 @@ type CjDataItem struct {
|
|||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
RelayId string `protobuf:"bytes,1,opt,name=relayId,proto3" json:"relayId,omitempty"` //采集对应的继电器Id
|
RelayId string `protobuf:"bytes,1,opt,name=relayId,proto3" json:"relayId,omitempty"` //采集对应的继电器Id
|
||||||
Position CjDataItem_PostionType `protobuf:"varint,2,opt,name=position,proto3,enum=model.CjDataItem_PostionType" json:"position,omitempty"` //继电器的位置,QH对应着吸合
|
Q bool `protobuf:"varint,2,opt,name=q,proto3" json:"q,omitempty"` //继电器的位置,是否前接点(即吸起位/定位)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CjDataItem) Reset() {
|
func (x *CjDataItem) Reset() {
|
||||||
@ -2613,11 +2567,11 @@ func (x *CjDataItem) GetRelayId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *CjDataItem) GetPosition() CjDataItem_PostionType {
|
func (x *CjDataItem) GetQ() bool {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Position
|
return x.Q
|
||||||
}
|
}
|
||||||
return CjDataItem_Q
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
type QdData struct {
|
type QdData struct {
|
||||||
@ -3067,67 +3021,62 @@ var file_model_proto_rawDesc = []byte{
|
|||||||
0x2f, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03,
|
0x2f, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03,
|
||||||
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74,
|
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74,
|
||||||
0x61, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73,
|
0x61, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73,
|
||||||
0x22, 0x7e, 0x0a, 0x0a, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x18,
|
0x22, 0x34, 0x0a, 0x0a, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x18,
|
||||||
0x0a, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x0a, 0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x12, 0x39, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69,
|
0x07, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x64, 0x12, 0x0c, 0x0a, 0x01, 0x71, 0x18, 0x02, 0x20,
|
||||||
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x6d, 0x6f, 0x64,
|
0x01, 0x28, 0x08, 0x52, 0x01, 0x71, 0x22, 0x4a, 0x0a, 0x06, 0x51, 0x64, 0x44, 0x61, 0x74, 0x61,
|
||||||
0x65, 0x6c, 0x2e, 0x43, 0x6a, 0x44, 0x61, 0x74, 0x61, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x50, 0x6f,
|
0x12, 0x10, 0x0a, 0x03, 0x72, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x72,
|
||||||
0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74,
|
0x6f, 0x77, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||||
0x69, 0x6f, 0x6e, 0x22, 0x1b, 0x0a, 0x0b, 0x50, 0x6f, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79,
|
0x03, 0x63, 0x6f, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79,
|
||||||
0x70, 0x65, 0x12, 0x05, 0x0a, 0x01, 0x51, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x48, 0x10, 0x01,
|
0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61,
|
||||||
0x22, 0x4a, 0x0a, 0x06, 0x51, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x6f,
|
0x79, 0x73, 0x22, 0x48, 0x0a, 0x08, 0x41, 0x73, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x14,
|
||||||
0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x6f, 0x77, 0x12, 0x10, 0x0a, 0x03,
|
0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67,
|
||||||
0x63, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x6f, 0x6c, 0x12, 0x1c,
|
0x72, 0x6f, 0x75, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20,
|
||||||
0x0a, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
|
0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e,
|
||||||
0x09, 0x52, 0x09, 0x72, 0x65, 0x66, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x73, 0x22, 0x48, 0x0a, 0x08,
|
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x2a, 0xfd, 0x03, 0x0a,
|
||||||
0x41, 0x73, 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75,
|
0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x44,
|
||||||
0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x14,
|
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77,
|
||||||
0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73,
|
0x6e, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
|
||||||
0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
|
0x65, 0x5f, 0x50, 0x68, 0x79, 0x73, 0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
||||||
0x05, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x2a, 0xfd, 0x03, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63,
|
0x6e, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
|
||||||
0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
|
0x65, 0x5f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x16,
|
||||||
0x79, 0x70, 0x65, 0x5f, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x1e, 0x0a,
|
0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x75, 0x72,
|
||||||
0x1a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x68, 0x79, 0x73,
|
0x6e, 0x6f, 0x75, 0x74, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
|
||||||
0x69, 0x63, 0x61, 0x6c, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x19, 0x0a,
|
0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x10, 0x04, 0x12, 0x1a, 0x0a,
|
||||||
0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x43, 0x68, 0x65, 0x63,
|
0x16, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x72, 0x61, 0x6e,
|
||||||
0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69,
|
0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76,
|
||||||
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x75, 0x72, 0x6e, 0x6f, 0x75, 0x74, 0x10, 0x03,
|
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x10, 0x06, 0x12,
|
||||||
0x12, 0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53,
|
0x21, 0x0a, 0x1d, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65,
|
||||||
0x69, 0x67, 0x6e, 0x61, 0x6c, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x65, 0x76, 0x69, 0x63,
|
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65,
|
||||||
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65,
|
0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
|
||||||
0x72, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
|
0x5f, 0x4c, 0x69, 0x6e, 0x6b, 0x10, 0x08, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63,
|
||||||
0x65, 0x5f, 0x53, 0x6c, 0x6f, 0x70, 0x65, 0x10, 0x06, 0x12, 0x21, 0x0a, 0x1d, 0x44, 0x65, 0x76,
|
0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x09,
|
||||||
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x61,
|
0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x52,
|
||||||
0x6c, 0x43, 0x75, 0x72, 0x76, 0x61, 0x74, 0x75, 0x72, 0x65, 0x10, 0x07, 0x12, 0x13, 0x0a, 0x0f,
|
0x65, 0x6c, 0x61, 0x79, 0x10, 0x0a, 0x12, 0x24, 0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
|
||||||
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x6e, 0x6b, 0x10,
|
0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x68, 0x61, 0x73, 0x65, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72,
|
||||||
0x08, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f,
|
0x65, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x10, 0x0b, 0x12, 0x15, 0x0a, 0x11,
|
||||||
0x4c, 0x69, 0x6e, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x10, 0x09, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65,
|
0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x42, 0x75, 0x74, 0x74, 0x6f,
|
||||||
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x10, 0x0a,
|
0x6e, 0x10, 0x0c, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
|
||||||
0x12, 0x24, 0x0a, 0x20, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50,
|
0x65, 0x5f, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x10, 0x0d, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76,
|
||||||
0x68, 0x61, 0x73, 0x65, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x65,
|
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x10, 0x0e, 0x12,
|
||||||
0x63, 0x74, 0x6f, 0x72, 0x10, 0x0b, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65,
|
0x12, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x73,
|
||||||
0x54, 0x79, 0x70, 0x65, 0x5f, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x10, 0x0c, 0x12, 0x14, 0x0a,
|
0x64, 0x10, 0x0f, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
|
||||||
0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4c, 0x69, 0x67, 0x68,
|
0x65, 0x5f, 0x53, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x10, 0x12, 0x12, 0x0a, 0x0e, 0x44,
|
||||||
0x74, 0x10, 0x0d, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
|
0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4d, 0x6b, 0x78, 0x10, 0x11, 0x12,
|
||||||
0x65, 0x5f, 0x41, 0x6c, 0x61, 0x72, 0x6d, 0x10, 0x0e, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x65, 0x76,
|
0x12, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4b, 0x65,
|
||||||
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x73, 0x64, 0x10, 0x0f, 0x12, 0x16, 0x0a,
|
0x79, 0x10, 0x12, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70,
|
||||||
0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x74, 0x61, 0x74,
|
0x65, 0x5f, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x10, 0x13, 0x2a, 0x25, 0x0a, 0x04,
|
||||||
0x69, 0x6f, 0x6e, 0x10, 0x10, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54,
|
0x50, 0x6f, 0x72, 0x74, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x05,
|
||||||
0x79, 0x70, 0x65, 0x5f, 0x4d, 0x6b, 0x78, 0x10, 0x11, 0x12, 0x12, 0x0a, 0x0e, 0x44, 0x65, 0x76,
|
0x0a, 0x01, 0x41, 0x10, 0x01, 0x12, 0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01,
|
||||||
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x4b, 0x65, 0x79, 0x10, 0x12, 0x12, 0x17, 0x0a,
|
0x43, 0x10, 0x03, 0x2a, 0x20, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||||
0x13, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x50, 0x6c, 0x61, 0x74,
|
0x12, 0x08, 0x0a, 0x04, 0x4c, 0x45, 0x46, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49,
|
||||||
0x66, 0x6f, 0x72, 0x6d, 0x10, 0x13, 0x2a, 0x25, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x08,
|
0x47, 0x48, 0x54, 0x10, 0x01, 0x2a, 0x43, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f,
|
||||||
0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x05, 0x0a, 0x01, 0x41, 0x10, 0x01, 0x12,
|
0x69, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x6f, 0x75, 0x6e, 0x64,
|
||||||
0x05, 0x0a, 0x01, 0x42, 0x10, 0x02, 0x12, 0x05, 0x0a, 0x01, 0x43, 0x10, 0x03, 0x2a, 0x20, 0x0a,
|
0x61, 0x72, 0x79, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x41, 0x78, 0x6c, 0x65, 0x43, 0x6f, 0x75,
|
||||||
0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4c, 0x45,
|
0x6e, 0x74, 0x65, 0x72, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x6e, 0x73, 0x75, 0x6c, 0x61,
|
||||||
0x46, 0x54, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x49, 0x47, 0x48, 0x54, 0x10, 0x01, 0x2a,
|
0x74, 0x65, 0x64, 0x4a, 0x6f, 0x69, 0x6e, 0x74, 0x10, 0x02, 0x42, 0x1a, 0x5a, 0x18, 0x2e, 0x2f,
|
||||||
0x43, 0x0a, 0x0e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x54, 0x79, 0x70,
|
0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
|
||||||
0x65, 0x12, 0x0c, 0x0a, 0x08, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x10, 0x00, 0x12,
|
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
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 (
|
||||||
@ -3142,7 +3091,7 @@ func file_model_proto_rawDescGZIP() []byte {
|
|||||||
return file_model_proto_rawDescData
|
return file_model_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 10)
|
var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 9)
|
||||||
var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 29)
|
var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 29)
|
||||||
var file_model_proto_goTypes = []interface{}{
|
var file_model_proto_goTypes = []interface{}{
|
||||||
(DeviceType)(0), // 0: model.DeviceType
|
(DeviceType)(0), // 0: model.DeviceType
|
||||||
@ -3154,98 +3103,96 @@ var file_model_proto_goTypes = []interface{}{
|
|||||||
(Relay_Model)(0), // 6: model.Relay.Model
|
(Relay_Model)(0), // 6: model.Relay.Model
|
||||||
(Button_ButtonType)(0), // 7: model.Button.ButtonType
|
(Button_ButtonType)(0), // 7: model.Button.ButtonType
|
||||||
(Light_LightAspect)(0), // 8: model.Light.LightAspect
|
(Light_LightAspect)(0), // 8: model.Light.LightAspect
|
||||||
(CjDataItem_PostionType)(0), // 9: model.CjDataItem.PostionType
|
(*Repository)(nil), // 9: model.Repository
|
||||||
(*Repository)(nil), // 10: model.Repository
|
(*PhysicalSection)(nil), // 10: model.PhysicalSection
|
||||||
(*PhysicalSection)(nil), // 11: model.PhysicalSection
|
(*CheckPoint)(nil), // 11: model.CheckPoint
|
||||||
(*CheckPoint)(nil), // 12: model.CheckPoint
|
(*Turnout)(nil), // 12: model.Turnout
|
||||||
(*Turnout)(nil), // 13: model.Turnout
|
(*Signal)(nil), // 13: model.Signal
|
||||||
(*Signal)(nil), // 14: model.Signal
|
(*Psd)(nil), // 14: model.Psd
|
||||||
(*Psd)(nil), // 15: model.Psd
|
(*Transponder)(nil), // 15: model.Transponder
|
||||||
(*Transponder)(nil), // 16: model.Transponder
|
(*Slope)(nil), // 16: model.Slope
|
||||||
(*Slope)(nil), // 17: model.Slope
|
(*SectionalCurvature)(nil), // 17: model.SectionalCurvature
|
||||||
(*SectionalCurvature)(nil), // 18: model.SectionalCurvature
|
(*DevicePort)(nil), // 18: model.DevicePort
|
||||||
(*DevicePort)(nil), // 19: model.DevicePort
|
(*Kilometer)(nil), // 19: model.Kilometer
|
||||||
(*Kilometer)(nil), // 20: model.Kilometer
|
(*KilometerConvert)(nil), // 20: model.KilometerConvert
|
||||||
(*KilometerConvert)(nil), // 21: model.KilometerConvert
|
(*Relay)(nil), // 21: model.Relay
|
||||||
(*Relay)(nil), // 22: model.Relay
|
(*PhaseFailureProtector)(nil), // 22: model.PhaseFailureProtector
|
||||||
(*PhaseFailureProtector)(nil), // 23: model.PhaseFailureProtector
|
(*ElectronicComponentGroup)(nil), // 23: model.ElectronicComponentGroup
|
||||||
(*ElectronicComponentGroup)(nil), // 24: model.ElectronicComponentGroup
|
(*Button)(nil), // 24: model.Button
|
||||||
(*Button)(nil), // 25: model.Button
|
(*Light)(nil), // 25: model.Light
|
||||||
(*Light)(nil), // 26: model.Light
|
(*Alarm)(nil), // 26: model.Alarm
|
||||||
(*Alarm)(nil), // 27: model.Alarm
|
(*Station)(nil), // 27: model.Station
|
||||||
(*Station)(nil), // 28: model.Station
|
(*ElectronicGroup)(nil), // 28: model.ElectronicGroup
|
||||||
(*ElectronicGroup)(nil), // 29: model.ElectronicGroup
|
(*ElectronicComponent)(nil), // 29: model.ElectronicComponent
|
||||||
(*ElectronicComponent)(nil), // 30: model.ElectronicComponent
|
(*Mkx)(nil), // 30: model.Mkx
|
||||||
(*Mkx)(nil), // 31: model.Mkx
|
(*Platform)(nil), // 31: model.Platform
|
||||||
(*Platform)(nil), // 32: model.Platform
|
(*Key)(nil), // 32: model.Key
|
||||||
(*Key)(nil), // 33: model.Key
|
(*CentralizedStationRef)(nil), // 33: model.CentralizedStationRef
|
||||||
(*CentralizedStationRef)(nil), // 34: model.CentralizedStationRef
|
(*CjData)(nil), // 34: model.CjData
|
||||||
(*CjData)(nil), // 35: model.CjData
|
(*CjDataItem)(nil), // 35: model.CjDataItem
|
||||||
(*CjDataItem)(nil), // 36: model.CjDataItem
|
(*QdData)(nil), // 36: model.QdData
|
||||||
(*QdData)(nil), // 37: model.QdData
|
(*AsdGroup)(nil), // 37: model.AsdGroup
|
||||||
(*AsdGroup)(nil), // 38: model.AsdGroup
|
|
||||||
}
|
}
|
||||||
var file_model_proto_depIdxs = []int32{
|
var file_model_proto_depIdxs = []int32{
|
||||||
11, // 0: model.Repository.physicalSections:type_name -> model.PhysicalSection
|
10, // 0: model.Repository.physicalSections:type_name -> model.PhysicalSection
|
||||||
12, // 1: model.Repository.checkPoints:type_name -> model.CheckPoint
|
11, // 1: model.Repository.checkPoints:type_name -> model.CheckPoint
|
||||||
13, // 2: model.Repository.turnouts:type_name -> model.Turnout
|
12, // 2: model.Repository.turnouts:type_name -> model.Turnout
|
||||||
14, // 3: model.Repository.signals:type_name -> model.Signal
|
13, // 3: model.Repository.signals:type_name -> model.Signal
|
||||||
16, // 4: model.Repository.transponders:type_name -> model.Transponder
|
15, // 4: model.Repository.transponders:type_name -> model.Transponder
|
||||||
17, // 5: model.Repository.slopes:type_name -> model.Slope
|
16, // 5: model.Repository.slopes:type_name -> model.Slope
|
||||||
18, // 6: model.Repository.sectionalCurvatures:type_name -> model.SectionalCurvature
|
17, // 6: model.Repository.sectionalCurvatures:type_name -> model.SectionalCurvature
|
||||||
21, // 7: model.Repository.kilometerConverts:type_name -> model.KilometerConvert
|
20, // 7: model.Repository.kilometerConverts:type_name -> model.KilometerConvert
|
||||||
22, // 8: model.Repository.relays:type_name -> model.Relay
|
21, // 8: model.Repository.relays:type_name -> model.Relay
|
||||||
23, // 9: model.Repository.phaseFailureProtectors:type_name -> model.PhaseFailureProtector
|
22, // 9: model.Repository.phaseFailureProtectors:type_name -> model.PhaseFailureProtector
|
||||||
25, // 10: model.Repository.buttons:type_name -> model.Button
|
24, // 10: model.Repository.buttons:type_name -> model.Button
|
||||||
15, // 11: model.Repository.psds:type_name -> model.Psd
|
14, // 11: model.Repository.psds:type_name -> model.Psd
|
||||||
26, // 12: model.Repository.lights:type_name -> model.Light
|
25, // 12: model.Repository.lights:type_name -> model.Light
|
||||||
27, // 13: model.Repository.alarms:type_name -> model.Alarm
|
26, // 13: model.Repository.alarms:type_name -> model.Alarm
|
||||||
28, // 14: model.Repository.stations:type_name -> model.Station
|
27, // 14: model.Repository.stations:type_name -> model.Station
|
||||||
31, // 15: model.Repository.mkxs:type_name -> model.Mkx
|
30, // 15: model.Repository.mkxs:type_name -> model.Mkx
|
||||||
32, // 16: model.Repository.platforms:type_name -> model.Platform
|
31, // 16: model.Repository.platforms:type_name -> model.Platform
|
||||||
33, // 17: model.Repository.Keys:type_name -> model.Key
|
32, // 17: model.Repository.Keys:type_name -> model.Key
|
||||||
34, // 18: model.Repository.CentralizedStationRefs:type_name -> model.CentralizedStationRef
|
33, // 18: model.Repository.CentralizedStationRefs:type_name -> model.CentralizedStationRef
|
||||||
19, // 19: model.PhysicalSection.aDevicePort:type_name -> model.DevicePort
|
18, // 19: model.PhysicalSection.aDevicePort:type_name -> model.DevicePort
|
||||||
19, // 20: model.PhysicalSection.bDevicePort:type_name -> model.DevicePort
|
18, // 20: model.PhysicalSection.bDevicePort:type_name -> model.DevicePort
|
||||||
20, // 21: model.CheckPoint.km:type_name -> model.Kilometer
|
19, // 21: model.CheckPoint.km:type_name -> model.Kilometer
|
||||||
3, // 22: model.CheckPoint.type:type_name -> model.CheckPointType
|
3, // 22: model.CheckPoint.type:type_name -> model.CheckPointType
|
||||||
19, // 23: model.CheckPoint.devicePorts:type_name -> model.DevicePort
|
18, // 23: model.CheckPoint.devicePorts:type_name -> model.DevicePort
|
||||||
20, // 24: model.Turnout.km:type_name -> model.Kilometer
|
19, // 24: model.Turnout.km:type_name -> model.Kilometer
|
||||||
19, // 25: model.Turnout.aDevicePort:type_name -> model.DevicePort
|
18, // 25: model.Turnout.aDevicePort:type_name -> model.DevicePort
|
||||||
19, // 26: model.Turnout.bDevicePort:type_name -> model.DevicePort
|
18, // 26: model.Turnout.bDevicePort:type_name -> model.DevicePort
|
||||||
19, // 27: model.Turnout.cDevicePort:type_name -> model.DevicePort
|
18, // 27: model.Turnout.cDevicePort:type_name -> model.DevicePort
|
||||||
4, // 28: model.Turnout.switchMachineType:type_name -> model.Turnout.SwitchMachineType
|
4, // 28: model.Turnout.switchMachineType:type_name -> model.Turnout.SwitchMachineType
|
||||||
24, // 29: model.Turnout.electronicComponentGroups:type_name -> model.ElectronicComponentGroup
|
23, // 29: model.Turnout.electronicComponentGroups:type_name -> model.ElectronicComponentGroup
|
||||||
20, // 30: model.Signal.km:type_name -> model.Kilometer
|
19, // 30: model.Signal.km:type_name -> model.Kilometer
|
||||||
19, // 31: model.Signal.turnoutPort:type_name -> model.DevicePort
|
18, // 31: model.Signal.turnoutPort:type_name -> model.DevicePort
|
||||||
24, // 32: model.Signal.electronicComponentGroups:type_name -> model.ElectronicComponentGroup
|
23, // 32: model.Signal.electronicComponentGroups:type_name -> model.ElectronicComponentGroup
|
||||||
5, // 33: model.Signal.model:type_name -> model.Signal.Model
|
5, // 33: model.Signal.model:type_name -> model.Signal.Model
|
||||||
38, // 34: model.Psd.asdGroups:type_name -> model.AsdGroup
|
37, // 34: model.Psd.asdGroups:type_name -> model.AsdGroup
|
||||||
24, // 35: model.Psd.electronicComponentGroups:type_name -> model.ElectronicComponentGroup
|
23, // 35: model.Psd.electronicComponentGroups:type_name -> model.ElectronicComponentGroup
|
||||||
20, // 36: model.Transponder.km:type_name -> model.Kilometer
|
19, // 36: model.Transponder.km:type_name -> model.Kilometer
|
||||||
19, // 37: model.Transponder.turnoutPort:type_name -> model.DevicePort
|
18, // 37: model.Transponder.turnoutPort:type_name -> model.DevicePort
|
||||||
20, // 38: model.Slope.kms:type_name -> model.Kilometer
|
19, // 38: model.Slope.kms:type_name -> model.Kilometer
|
||||||
20, // 39: model.SectionalCurvature.kms:type_name -> model.Kilometer
|
19, // 39: model.SectionalCurvature.kms:type_name -> model.Kilometer
|
||||||
0, // 40: model.DevicePort.deviceType:type_name -> model.DeviceType
|
0, // 40: model.DevicePort.deviceType:type_name -> model.DeviceType
|
||||||
1, // 41: model.DevicePort.port:type_name -> model.Port
|
1, // 41: model.DevicePort.port:type_name -> model.Port
|
||||||
2, // 42: model.Kilometer.direction:type_name -> model.Direction
|
2, // 42: model.Kilometer.direction:type_name -> model.Direction
|
||||||
20, // 43: model.KilometerConvert.kmA:type_name -> model.Kilometer
|
19, // 43: model.KilometerConvert.kmA:type_name -> model.Kilometer
|
||||||
20, // 44: model.KilometerConvert.kmB:type_name -> model.Kilometer
|
19, // 44: model.KilometerConvert.kmB:type_name -> model.Kilometer
|
||||||
6, // 45: model.Relay.model:type_name -> model.Relay.Model
|
6, // 45: model.Relay.model:type_name -> model.Relay.Model
|
||||||
7, // 46: model.Button.buttonType:type_name -> model.Button.ButtonType
|
7, // 46: model.Button.buttonType:type_name -> model.Button.ButtonType
|
||||||
8, // 47: model.Light.aspect:type_name -> model.Light.LightAspect
|
8, // 47: model.Light.aspect:type_name -> model.Light.LightAspect
|
||||||
29, // 48: model.Station.electronicGroup:type_name -> model.ElectronicGroup
|
28, // 48: model.Station.electronicGroup:type_name -> model.ElectronicGroup
|
||||||
30, // 49: model.ElectronicGroup.components:type_name -> model.ElectronicComponent
|
29, // 49: model.ElectronicGroup.components:type_name -> model.ElectronicComponent
|
||||||
0, // 50: model.ElectronicComponent.deviceType:type_name -> model.DeviceType
|
0, // 50: model.ElectronicComponent.deviceType:type_name -> model.DeviceType
|
||||||
35, // 51: model.CentralizedStationRef.cjList:type_name -> model.CjData
|
34, // 51: model.CentralizedStationRef.cjList:type_name -> model.CjData
|
||||||
37, // 52: model.CentralizedStationRef.qdList:type_name -> model.QdData
|
36, // 52: model.CentralizedStationRef.qdList:type_name -> model.QdData
|
||||||
36, // 53: model.CjData.refRelays:type_name -> model.CjDataItem
|
35, // 53: model.CjData.refRelays:type_name -> model.CjDataItem
|
||||||
9, // 54: model.CjDataItem.position:type_name -> model.CjDataItem.PostionType
|
54, // [54:54] is the sub-list for method output_type
|
||||||
55, // [55:55] is the sub-list for method output_type
|
54, // [54:54] is the sub-list for method input_type
|
||||||
55, // [55:55] is the sub-list for method input_type
|
54, // [54:54] is the sub-list for extension type_name
|
||||||
55, // [55:55] is the sub-list for extension type_name
|
54, // [54:54] is the sub-list for extension extendee
|
||||||
55, // [55:55] is the sub-list for extension extendee
|
0, // [0:54] is the sub-list for field type_name
|
||||||
0, // [0:55] is the sub-list for field type_name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_model_proto_init() }
|
func init() { file_model_proto_init() }
|
||||||
@ -3608,7 +3555,7 @@ func file_model_proto_init() {
|
|||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_model_proto_rawDesc,
|
RawDescriptor: file_model_proto_rawDesc,
|
||||||
NumEnums: 10,
|
NumEnums: 9,
|
||||||
NumMessages: 29,
|
NumMessages: 29,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
|
@ -183,7 +183,7 @@ func (repo *Repository) KeyList() []*Key {
|
|||||||
return list
|
return list
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo *Repository) CentralizedList() []*proto.CentralizedStationRef {
|
func (repo *Repository) CiQcList() []*proto.CentralizedStationRef {
|
||||||
var list []*proto.CentralizedStationRef
|
var list []*proto.CentralizedStationRef
|
||||||
for _, model := range repo.centralizedMap {
|
for _, model := range repo.centralizedMap {
|
||||||
list = append(list, model)
|
list = append(list, model)
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
"joylink.club/rtsssimulation/consts"
|
"joylink.club/rtsssimulation/consts"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ZDJ9双机牵引道岔电路系统
|
// ZDJ9双机牵引道岔电路系统
|
||||||
@ -19,19 +20,16 @@ func NewZdj9TwoDragSys() *ZDJ9TwoDragSys {
|
|||||||
return &ZDJ9TwoDragSys{
|
return &ZDJ9TwoDragSys{
|
||||||
query: ecs.NewQuery(filter.Contains(
|
query: ecs.NewQuery(filter.Contains(
|
||||||
component.Zdj9TwoElectronicType,
|
component.Zdj9TwoElectronicType,
|
||||||
component.Zdj9TwoDriveType,
|
|
||||||
component.Zdj9TwoCollectType,
|
|
||||||
component.TurnoutZzjType)),
|
component.TurnoutZzjType)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 电路更新
|
// 电路更新
|
||||||
func (zdj9 *ZDJ9TwoDragSys) Update(w ecs.World) {
|
func (zdj9 *ZDJ9TwoDragSys) Update(w ecs.World) {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
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)
|
zdj9.exciteDriveElectronic(entry, elec, wd)
|
||||||
collect := component.Zdj9TwoCollectType.Get(entry)
|
|
||||||
zdj9.exciteDriveElectronic(entry, elec, drive)
|
|
||||||
// 转辙机一机电路相关动作
|
// 转辙机一机电路相关动作
|
||||||
// 1DQJ励磁状态控制
|
// 1DQJ励磁状态控制
|
||||||
zdj9.exciteM1_TDFJ_1DQJ(elec)
|
zdj9.exciteM1_TDFJ_1DQJ(elec)
|
||||||
@ -66,49 +64,31 @@ func (zdj9 *ZDJ9TwoDragSys) Update(w ecs.World) {
|
|||||||
|
|
||||||
// 总定表/反表继电器
|
// 总定表/反表继电器
|
||||||
zdj9.exciteZDFBJ(entry, elec)
|
zdj9.exciteZDFBJ(entry, elec)
|
||||||
|
|
||||||
zdj9.exciteCollectElectronic(entry, elec, collect)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理采集电路状态
|
func (zdj9 *ZDJ9TwoDragSys) handleCiQdRelay(entry *ecs.Entry, wd *component.WorldData) {
|
||||||
func (zdj9 *ZDJ9TwoDragSys) exciteCollectElectronic(entry *ecs.Entry, elec *component.Zdj9TwoElectronic, collect *component.Zdj9TwoCollect) {
|
if entry.HasComponent(component.UidType) {
|
||||||
zdbj := component.BitStateType.Get(elec.TDC_ZDBJ)
|
bit, err := wd.QueryQdBit(component.UidType.Get(entry).Id)
|
||||||
zfbj := component.BitStateType.Get(elec.TDC_ZFBJ)
|
if err != nil {
|
||||||
ycj := component.BitStateType.Get(elec.TDC_YCJ)
|
// slog.Debug(err.Error())
|
||||||
tdfj1_dbj := component.BitStateType.Get(elec.TDFJ1_DBJ)
|
return
|
||||||
tdfj1_fbj := component.BitStateType.Get(elec.TDFJ1_FBJ)
|
}
|
||||||
tdfj2_dbj := component.BitStateType.Get(elec.TDFJ2_DBJ)
|
dcj_drive := component.RelayDriveType.Get(entry)
|
||||||
tdfj2_fbj := component.BitStateType.Get(elec.TDFJ2_FBJ)
|
if dcj_drive.Td != bit {
|
||||||
|
dcj_drive.Td = bit
|
||||||
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(entry *ecs.Entry, elec *component.Zdj9TwoElectronic, driveElec *component.Zdj9TwoDrive) {
|
func (zdj9 *ZDJ9TwoDragSys) exciteDriveElectronic(entry *ecs.Entry, elec *component.Zdj9TwoElectronic, wd *component.WorldData) {
|
||||||
if entry.HasComponent(component.TurnoutFaultCiqdType) { // 联锁驱动失效
|
if entry.HasComponent(component.TurnoutFaultCiqdType) { // 联锁驱动失效
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dcj_drive := component.RelayDriveType.Get(elec.TDC_DCJ)
|
zdj9.handleCiQdRelay(elec.TDC_DCJ, wd)
|
||||||
fcj_drive := component.RelayDriveType.Get(elec.TDC_FCJ)
|
zdj9.handleCiQdRelay(elec.TDC_FCJ, wd)
|
||||||
ycj_drive := component.RelayDriveType.Get(elec.TDC_YCJ)
|
zdj9.handleCiQdRelay(elec.TDC_YCJ, wd)
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 总定表、反表继电器控制
|
// 总定表、反表继电器控制
|
||||||
|
52
sys/device_sys/ci_qc.go
Normal file
52
sys/device_sys/ci_qc.go
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
package device_sys
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"joylink.club/ecs"
|
||||||
|
"joylink.club/ecs/filter"
|
||||||
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/consts"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CiQcSys struct {
|
||||||
|
query *ecs.Query
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCiQcSys() *CiQcSys {
|
||||||
|
return &CiQcSys{
|
||||||
|
query: ecs.NewQuery(filter.Contains(component.CiQcTableType, component.CiQcStateType)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *CiQcSys) Update(w ecs.World) {
|
||||||
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
|
// 采集设备状态
|
||||||
|
data := entity.GetWorldData(w)
|
||||||
|
table := component.CiQcTableType.Get(entry)
|
||||||
|
state := component.CiQcStateType.Get(entry)
|
||||||
|
for i, cj := range table.CjBits {
|
||||||
|
bit := true
|
||||||
|
if len(cj.RefRelays) > 0 {
|
||||||
|
for _, cdi := range cj.RefRelays {
|
||||||
|
re, ok := data.EntityMap[cdi.RelayId]
|
||||||
|
if !ok {
|
||||||
|
panic(fmt.Errorf("联锁码位采集系统运行异常,没有id=%s的继电器实体", cdi.RelayId))
|
||||||
|
}
|
||||||
|
if !re.HasComponent(component.BitStateType) {
|
||||||
|
panic(fmt.Errorf("联锁码位采集系统运行异常,id=%s的继电器实体没有BitState组件", cdi.RelayId))
|
||||||
|
}
|
||||||
|
s := component.BitStateType.Get(re)
|
||||||
|
if cdi.Q != s.Val {
|
||||||
|
bit = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bit = false
|
||||||
|
}
|
||||||
|
consts.SetBitOfBytes(state.Cbs, i, bit)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user