【调整按钮,spk系统,emp系统】
This commit is contained in:
parent
cc578a30bb
commit
27a07ade5a
@ -19,40 +19,10 @@ var (
|
||||
|
||||
// 按钮的实际转台
|
||||
type ButtonState struct {
|
||||
Tq bool // 是否抬起(位置信息)
|
||||
|
||||
Jt bool // 是否接通(状态信息)
|
||||
Tq bool // 是否抬起(位置信息)
|
||||
Jt bool // 是否接通(状态信息)
|
||||
Remain int // 接通保持时间
|
||||
}
|
||||
|
||||
// 实际按钮的实际位置组件类型
|
||||
var ButtonStateType = ecs.NewComponentType[ButtonState]()
|
||||
|
||||
// 按钮关联继电器
|
||||
type ButtonRelay struct {
|
||||
Relays []*ecs.Entry
|
||||
}
|
||||
|
||||
var ButtonRelayType = ecs.NewComponentType[ButtonRelay]()
|
||||
|
||||
// SPK元器件组件
|
||||
type SpksElectronic struct {
|
||||
SPKSX1J *ecs.Entry
|
||||
SPKSX3J *ecs.Entry
|
||||
SPKSS2J *ecs.Entry
|
||||
SPKSS4J *ecs.Entry
|
||||
|
||||
SPKSXPLAJ *ecs.Entry
|
||||
SPKSSPLAJ *ecs.Entry
|
||||
|
||||
SPKSX1D bool
|
||||
SPKSX3D bool
|
||||
SPKSS2D bool
|
||||
SPKSS4D bool
|
||||
SPKSXPLAD bool
|
||||
SPKSSPLAD bool
|
||||
|
||||
SDA *ecs.Entry
|
||||
}
|
||||
|
||||
// SPK继电器元器件组件
|
||||
var SpksElectronicType = ecs.NewComponentType[SpksElectronic]()
|
||||
|
79
component/ibp.go
Normal file
79
component/ibp.go
Normal file
@ -0,0 +1,79 @@
|
||||
package component
|
||||
|
||||
import "joylink.club/ecs"
|
||||
|
||||
// SPK继电器控制电路
|
||||
type SpkControlElectronic struct {
|
||||
SPKSXPLA_BTN *ecs.Entry
|
||||
SPKSX1J_BTN *ecs.Entry
|
||||
SPKSX3J_BTN *ecs.Entry
|
||||
SPKSX1J *ecs.Entry
|
||||
SPKSX3J *ecs.Entry
|
||||
|
||||
SPKSSPLA_BTN *ecs.Entry
|
||||
SPKSS2J_BTN *ecs.Entry
|
||||
SPKSS4J_BTN *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
|
||||
|
||||
SPKSXPLAJ *ecs.Entry
|
||||
SPKSSPLAJ *ecs.Entry
|
||||
|
||||
SPKSX1D bool
|
||||
SPKSX3D bool
|
||||
SPKSS2D bool
|
||||
SPKSS4D bool
|
||||
SPKSXPLAD bool
|
||||
SPKSSPLAD bool
|
||||
|
||||
SDA *ecs.Entry
|
||||
}
|
||||
|
||||
// SPK继电器元器件组件
|
||||
var SpksStateElectronicType = ecs.NewComponentType[SpksStateElectronic]()
|
||||
|
||||
// EMP 控制电路
|
||||
type EmpControlElectronic struct {
|
||||
EMP1_BTN *ecs.Entry
|
||||
EMP3_BTN *ecs.Entry
|
||||
EMP5_BTN *ecs.Entry
|
||||
EMPX_BTN *ecs.Entry
|
||||
XEMPFA_BTN *ecs.Entry
|
||||
XEMPJ *ecs.Entry // 继电器
|
||||
|
||||
EMP2_BTN *ecs.Entry
|
||||
EMP4_BTN *ecs.Entry
|
||||
EMP6_BTN *ecs.Entry
|
||||
EMPS_BTN *ecs.Entry
|
||||
SEMPFA_BTN *ecs.Entry
|
||||
SEMPJ *ecs.Entry // 继电器
|
||||
}
|
||||
|
||||
var EmpControlElectronicType = ecs.NewComponentType[EmpControlElectronic]()
|
||||
|
||||
// EMP 标识状态电路
|
||||
type EmpStateElectronic struct {
|
||||
XEMPJ *ecs.Entry // 继电器
|
||||
XEMPD bool
|
||||
XEMPD_SDA *ecs.Entry // 按钮
|
||||
|
||||
SEMPJ *ecs.Entry // 继电器
|
||||
SEMPD bool
|
||||
SEMPD_SDA *ecs.Entry // 按钮
|
||||
|
||||
QBA *ecs.Entry // 非自复位按钮
|
||||
FMQ bool // 蜂鸣器
|
||||
}
|
||||
|
||||
var EmpStateElectronicType = ecs.NewComponentType[EmpStateElectronic]()
|
@ -181,5 +181,4 @@ message Button {
|
||||
}
|
||||
string id = 1;
|
||||
ButtonType buttonType = 2;
|
||||
repeated ElectronicComponentGroup electronicComponentGroups = 3; //关联的电子元件组合
|
||||
}
|
@ -6,8 +6,6 @@ type Button struct {
|
||||
Identity
|
||||
|
||||
buttonType proto.Button_ButtonType
|
||||
|
||||
componentGroups []*ElectronicComponentGroup
|
||||
}
|
||||
|
||||
func NewButton(id string, buttonType proto.Button_ButtonType) *Button {
|
||||
|
@ -1456,9 +1456,8 @@ type Button struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
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"`
|
||||
ElectronicComponentGroups []*ElectronicComponentGroup `protobuf:"bytes,3,rep,name=electronicComponentGroups,proto3" json:"electronicComponentGroups,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"`
|
||||
}
|
||||
|
||||
func (x *Button) Reset() {
|
||||
@ -1507,13 +1506,6 @@ func (x *Button) GetButtonType() Button_ButtonType {
|
||||
return Button_Unknown
|
||||
}
|
||||
|
||||
func (x *Button) GetElectronicComponentGroups() []*ElectronicComponentGroup {
|
||||
if x != nil {
|
||||
return x.ElectronicComponentGroups
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_model_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_model_proto_rawDesc = []byte{
|
||||
@ -1693,57 +1685,51 @@ var file_model_proto_rawDesc = []byte{
|
||||
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, 0x90, 0x02, 0x0a, 0x06, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x0e, 0x0a,
|
||||
0x64, 0x73, 0x22, 0xb1, 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, 0x38, 0x0a,
|
||||
0x0a, 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 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, 0x12, 0x5d, 0x0a, 0x19, 0x65, 0x6c, 0x65, 0x63, 0x74,
|
||||
0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x47, 0x72,
|
||||
0x6f, 0x75, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x6f, 0x64,
|
||||
0x65, 0x6c, 0x2e, 0x45, 0x6c, 0x65, 0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d,
|
||||
0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x19, 0x65, 0x6c, 0x65,
|
||||
0x63, 0x74, 0x72, 0x6f, 0x6e, 0x69, 0x63, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74,
|
||||
0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x5d, 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, 0x2a, 0xe4, 0x02, 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, 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,
|
||||
0x74, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x5d, 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, 0x2a, 0xe4, 0x02, 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, 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 (
|
||||
@ -1821,12 +1807,11 @@ var file_model_proto_depIdxs = []int32{
|
||||
16, // 33: model.KilometerConvert.kmB:type_name -> model.Kilometer
|
||||
5, // 34: model.Relay.model:type_name -> model.Relay.Model
|
||||
6, // 35: model.Button.buttonType:type_name -> model.Button.ButtonType
|
||||
20, // 36: model.Button.electronicComponentGroups:type_name -> model.ElectronicComponentGroup
|
||||
37, // [37:37] is the sub-list for method output_type
|
||||
37, // [37:37] is the sub-list for method input_type
|
||||
37, // [37:37] is the sub-list for extension type_name
|
||||
37, // [37:37] is the sub-list for extension extendee
|
||||
0, // [0:37] is the sub-list for field type_name
|
||||
36, // [36:36] is the sub-list for method output_type
|
||||
36, // [36:36] is the sub-list for method input_type
|
||||
36, // [36:36] is the sub-list for extension type_name
|
||||
36, // [36:36] is the sub-list for extension extendee
|
||||
0, // [0:36] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_model_proto_init() }
|
||||
|
@ -118,10 +118,6 @@ func buildModelRelationship(source *proto.Repository, repository *Repository) er
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = buildButtonRelationShip(source, repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@ -374,29 +370,6 @@ func buildDevicePort(device Identity, port proto.Port) (DevicePort, error) {
|
||||
return dp, nil
|
||||
}
|
||||
|
||||
func buildButtonRelationShip(source *proto.Repository, repository *Repository) error {
|
||||
for _, protoData := range source.Buttons {
|
||||
button := repository.buttonMap[protoData.Id]
|
||||
|
||||
//关联继电器组
|
||||
for _, group := range protoData.ElectronicComponentGroups {
|
||||
var components []IGroupedElectronicComponent
|
||||
for _, id := range group.GetComponentIds() {
|
||||
if relay := repository.relayMap[id]; relay != nil {
|
||||
components = append(components, relay)
|
||||
} else if pfp := repository.phaseFailureProtectorMap[id]; pfp != nil {
|
||||
components = append(components, pfp)
|
||||
}
|
||||
}
|
||||
button.componentGroups = append(button.componentGroups, &ElectronicComponentGroup{
|
||||
code: group.Code,
|
||||
components: components,
|
||||
})
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 相互关联道岔和检测点
|
||||
func interrelateTurnoutAndCheckPoints(turnout *Turnout, point *CheckPoint, port proto.Port) {
|
||||
turnout.bindDevice(point, port)
|
||||
|
80
sys/circuit_sys/emp.go
Normal file
80
sys/circuit_sys/emp.go
Normal file
@ -0,0 +1,80 @@
|
||||
package circuit_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
)
|
||||
|
||||
// emp 继电器控制电路
|
||||
type EmpControlSys struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewEmpControl() *EmpControlSys {
|
||||
return &EmpControlSys{
|
||||
query: ecs.NewQuery(filter.Contains(component.EmpControlElectronicType)),
|
||||
}
|
||||
}
|
||||
|
||||
// 控制电路更新
|
||||
func (emp *EmpControlSys) Update(w ecs.World) {
|
||||
emp.query.Each(w, func(entry *ecs.Entry) {
|
||||
s := component.EmpControlElectronicType.Get(entry)
|
||||
xempfab := component.ButtonStateType.Get(s.XEMPFA_BTN)
|
||||
xempj := component.RelayDriveType.Get(s.XEMPJ)
|
||||
if xempfab.Jt {
|
||||
xempj.Td = true
|
||||
} else {
|
||||
emp1 := component.ButtonStateType.Get(s.EMP1_BTN)
|
||||
emp3 := component.ButtonStateType.Get(s.EMP3_BTN)
|
||||
emp5 := component.ButtonStateType.Get(s.EMP5_BTN)
|
||||
empx := component.ButtonStateType.Get(s.EMPX_BTN)
|
||||
xempj.Td = emp1.Jt && emp3.Jt && emp5.Jt && empx.Jt
|
||||
}
|
||||
|
||||
sempfab := component.ButtonStateType.Get(s.SEMPFA_BTN)
|
||||
sempj := component.RelayDriveType.Get(s.SEMPJ)
|
||||
if sempfab.Jt {
|
||||
sempj.Td = true
|
||||
} else {
|
||||
emp2 := component.ButtonStateType.Get(s.EMP2_BTN)
|
||||
emp4 := component.ButtonStateType.Get(s.EMP4_BTN)
|
||||
emp6 := component.ButtonStateType.Get(s.EMP6_BTN)
|
||||
emps := component.ButtonStateType.Get(s.EMPS_BTN)
|
||||
sempj.Td = emp2.Jt && emp4.Jt && emp6.Jt && emps.Jt
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// emp 继电器状态电路
|
||||
type EmpStateSys struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewEmpState() *EmpStateSys {
|
||||
return &EmpStateSys{
|
||||
query: ecs.NewQuery(filter.Contains(component.EmpStateElectronicType)),
|
||||
}
|
||||
}
|
||||
|
||||
// 控制电路更新
|
||||
func (emp *EmpStateSys) Update(w ecs.World) {
|
||||
emp.query.Each(w, func(entry *ecs.Entry) {
|
||||
s := component.EmpStateElectronicType.Get(entry)
|
||||
xempSda := component.ButtonStateType.Get(s.XEMPD_SDA)
|
||||
xempj := component.RelayDriveType.Get(s.XEMPJ)
|
||||
s.XEMPD = xempSda.Jt || !xempj.Xq
|
||||
|
||||
sempSda := component.ButtonStateType.Get(s.SEMPD_SDA)
|
||||
sempj := component.RelayDriveType.Get(s.SEMPJ)
|
||||
s.SEMPD = sempSda.Jt || !sempj.Xq
|
||||
|
||||
qba := component.ButtonStateType.Get(s.QBA)
|
||||
if qba.Jt {
|
||||
s.FMQ = xempj.Xq && sempj.Xq
|
||||
} else {
|
||||
s.FMQ = (!xempj.Xq) || (!sempj.Xq)
|
||||
}
|
||||
})
|
||||
}
|
@ -6,20 +6,63 @@ import (
|
||||
"joylink.club/rtsssimulation/component"
|
||||
)
|
||||
|
||||
type SPKSys struct {
|
||||
type SpkControlSys struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewSPKSys() *SPKSys {
|
||||
return &SPKSys{
|
||||
query: ecs.NewQuery(filter.Contains(component.SpksElectronicType)),
|
||||
func NewSpkControl() *SpkControlSys {
|
||||
return &SpkControlSys{
|
||||
query: ecs.NewQuery(filter.Contains(component.SpkControlElectronicType)),
|
||||
}
|
||||
}
|
||||
|
||||
// 电路更新
|
||||
func (spk *SPKSys) Update(w ecs.World) {
|
||||
// 控制电路更新
|
||||
func (spk *SpkControlSys) Update(w ecs.World) {
|
||||
spk.query.Each(w, func(entry *ecs.Entry) {
|
||||
spkState := component.SpksElectronicType.Get(entry)
|
||||
spkState := component.SpkControlElectronicType.Get(entry)
|
||||
spksxplaBtn := component.ButtonStateType.Get(spkState.SPKSXPLA_BTN)
|
||||
spksx1j := component.RelayDriveType.Get(spkState.SPKSX1J)
|
||||
spksx3j := component.RelayDriveType.Get(spkState.SPKSX3J)
|
||||
if spksxplaBtn.Jt {
|
||||
spksx1j.Td = true
|
||||
spksx3j.Td = true
|
||||
} else {
|
||||
spksx1jBtn := component.ButtonStateType.Get(spkState.SPKSX1J_BTN)
|
||||
spksx3jBtn := component.ButtonStateType.Get(spkState.SPKSX3J_BTN)
|
||||
spksx1j.Td = spksx1jBtn.Jt
|
||||
spksx3j.Td = spksx3jBtn.Jt
|
||||
}
|
||||
|
||||
spkssplaBtn := component.ButtonStateType.Get(spkState.SPKSSPLA_BTN)
|
||||
spkss2j := component.RelayDriveType.Get(spkState.SPKSS2J)
|
||||
spkss4j := component.RelayDriveType.Get(spkState.SPKSS4J)
|
||||
if spkssplaBtn.Jt {
|
||||
spkss2j.Td = true
|
||||
spkss4j.Td = true
|
||||
} else {
|
||||
spkss2jBtn := component.ButtonStateType.Get(spkState.SPKSS2J_BTN)
|
||||
spkss4jBtn := component.ButtonStateType.Get(spkState.SPKSS4J_BTN)
|
||||
spkss2j.Td = spkss2jBtn.Jt
|
||||
spkss4j.Td = spkss4jBtn.Jt
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 人员防护状态系统
|
||||
type SpksStateSys struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewSpksStateSys() *SpksStateSys {
|
||||
return &SpksStateSys{
|
||||
query: ecs.NewQuery(filter.Contains(component.SpksStateElectronicType)),
|
||||
}
|
||||
}
|
||||
|
||||
// 状态电路更新
|
||||
func (spk *SpksStateSys) Update(w ecs.World) {
|
||||
spk.query.Each(w, func(entry *ecs.Entry) {
|
||||
spkState := component.SpksStateElectronicType.Get(entry)
|
||||
sda := component.ButtonStateType.Get(spkState.SDA)
|
||||
|
||||
// SPKSXPLAJ
|
||||
@ -51,6 +94,5 @@ func (spk *SPKSys) Update(w ecs.World) {
|
||||
spkss4j := component.RelayDriveType.Get(spkState.SPKSS4J)
|
||||
spkss4j.Xq = spkss4j.Td || spkssplaj.Xq
|
||||
spkState.SPKSS4D = sda.Jt || !spkss4j.Xq
|
||||
|
||||
})
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
package device_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
)
|
||||
|
||||
// 按钮更新系统
|
||||
type ButtonSys struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewButtonSys() *ButtonSys {
|
||||
return &ButtonSys{
|
||||
query: ecs.NewQuery(filter.Contains(component.ButtonStateType, component.ButtonRelayType)),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ButtonSys) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
btnState := component.ButtonStateType.Get(entry)
|
||||
btnRelays := component.ButtonRelayType.Get(entry)
|
||||
for _, relay := range btnRelays.Relays {
|
||||
state := component.RelayDriveType.Get(relay)
|
||||
state.Td = btnState.Jt
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user