【spk、emp采集电路】
This commit is contained in:
parent
b6bdcc8748
commit
8f59554b2e
@ -63,6 +63,18 @@ type SpksStateElectronic struct {
|
||||
// SPK继电器元器件组件
|
||||
var SpksStateElectronicType = ecs.NewComponentType[SpksStateElectronic]()
|
||||
|
||||
// SPK采集电路吸起、落下接通状态
|
||||
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 EmpControlElectronic struct {
|
||||
EMP1_BTN *ecs.Entry
|
||||
@ -96,3 +108,11 @@ type EmpStateElectronic struct {
|
||||
}
|
||||
|
||||
var EmpStateElectronicType = ecs.NewComponentType[EmpStateElectronic]()
|
||||
|
||||
// EMP 采集电路吸起、落下接通状态
|
||||
type EmpCollectState struct {
|
||||
XEMPJ_XQ bool
|
||||
SEMPJ_XQ bool
|
||||
}
|
||||
|
||||
var EmpCollectStateType = ecs.NewComponentType[EmpCollectState]()
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit af605020f1bccf1f1b2ab5a4ae4966d1c6c9776c
|
||||
Subproject commit e7797346722a572814539d9a453789b89ffe6bf4
|
@ -15,10 +15,8 @@ type IBPSys struct {
|
||||
func NewIBPSys() *IBPSys {
|
||||
return &IBPSys{
|
||||
query: ecs.NewQuery(filter.Contains(
|
||||
component.SpkControlElectronicType,
|
||||
component.SpksStateElectronicType,
|
||||
component.EmpControlElectronicType,
|
||||
component.EmpStateElectronicType,
|
||||
component.SpkControlElectronicType, component.SpksStateElectronicType, component.SpkCollectStateType,
|
||||
component.EmpControlElectronicType, component.EmpStateElectronicType, component.EmpCollectStateType,
|
||||
)),
|
||||
}
|
||||
}
|
||||
@ -28,8 +26,10 @@ func (ibp *IBPSys) Update(w ecs.World) {
|
||||
ibp.query.Each(w, func(entry *ecs.Entry) {
|
||||
ibp.spkControl(entry)
|
||||
ibp.spksState(entry)
|
||||
ibp.spkCollect(entry)
|
||||
ibp.empControl(entry)
|
||||
ibp.empState(entry)
|
||||
ibp.empCollect(entry)
|
||||
})
|
||||
}
|
||||
|
||||
@ -72,6 +72,18 @@ func (ibp *IBPSys) spksState(entry *ecs.Entry) {
|
||||
setLightTdVal(spkState.SPKSS4D, sda || !spkss4j.Xq)
|
||||
}
|
||||
|
||||
// 人员防护继电器采集电路状态逻辑
|
||||
func (ibp *IBPSys) spkCollect(entry *ecs.Entry) {
|
||||
relayState := component.SpksStateElectronicType.Get(entry)
|
||||
collectState := component.SpkCollectStateType.Get(entry)
|
||||
collectState.SPKSX1J_XQ = getRelayXqVal(relayState.SPKSX1J)
|
||||
collectState.SPKSX3J_XQ = getRelayXqVal(relayState.SPKSX3J)
|
||||
collectState.SPKSS2J_XQ = getRelayXqVal(relayState.SPKSS2J)
|
||||
collectState.SPKSS4J_XQ = getRelayXqVal(relayState.SPKSS4J)
|
||||
collectState.SPKSXPLA_XQ = getRelayXqVal(relayState.SPKSXPLAJ)
|
||||
collectState.SPKSSPLA_XQ = getRelayXqVal(relayState.SPKSSPLAJ)
|
||||
}
|
||||
|
||||
// 紧急关闭控制电路
|
||||
func (ibp *IBPSys) empControl(entry *ecs.Entry) {
|
||||
s := component.EmpControlElectronicType.Get(entry)
|
||||
@ -83,7 +95,6 @@ func (ibp *IBPSys) empControl(entry *ecs.Entry) {
|
||||
sempj := component.RelayDriveType.Get(s.SEMPJ)
|
||||
// sempfab接通或者按钮组接通并且sempj继电器吸起状态
|
||||
sempj.Td = sempfab || (sempj.Xq && getBtnVal(s.EMP2_BTN) && getBtnVal(s.EMP4_BTN) && getBtnVal(s.EMP6_BTN) && getBtnVal(s.EMPS_BTN))
|
||||
|
||||
}
|
||||
|
||||
// 紧急关闭表示电路
|
||||
@ -102,6 +113,14 @@ func (ibp *IBPSys) empState(entry *ecs.Entry) {
|
||||
}
|
||||
}
|
||||
|
||||
// 紧急关闭继电器采集电路状态逻辑
|
||||
func (ibp *IBPSys) empCollect(entry *ecs.Entry) {
|
||||
empState := component.EmpStateElectronicType.Get(entry)
|
||||
collectState := component.EmpCollectStateType.Get(entry)
|
||||
collectState.XEMPJ_XQ = getRelayXqVal(empState.XEMPJ)
|
||||
collectState.SEMPJ_XQ = getRelayXqVal(empState.SEMPJ)
|
||||
}
|
||||
|
||||
// 获取按钮状态
|
||||
func getBtnVal(entry *ecs.Entry) bool {
|
||||
btn := component.BitStateType.Get(entry)
|
||||
@ -114,6 +133,12 @@ func setRelayTdVal(entry *ecs.Entry, val bool) {
|
||||
relay.Td = val
|
||||
}
|
||||
|
||||
// 获取继电器吸起状态
|
||||
func getRelayXqVal(entry *ecs.Entry) bool {
|
||||
relay := component.RelayDriveType.Get(entry)
|
||||
return relay.Xq
|
||||
}
|
||||
|
||||
// 设置信号灯通电状态
|
||||
func setLightTdVal(entry *ecs.Entry, val bool) {
|
||||
light := component.LightDriveType.Get(entry)
|
||||
|
Loading…
Reference in New Issue
Block a user