[bug]信号机电路系统逻辑没有正确处理驱动状态
This commit is contained in:
parent
3182e867c1
commit
8d19129ec6
@ -4,6 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Signal2XH1System struct {
|
type Signal2XH1System struct {
|
||||||
@ -20,21 +21,35 @@ func NewSignal2XH1System() *Signal2XH1System {
|
|||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *Signal2XH1System) Update(w ecs.World) {
|
func (s *Signal2XH1System) Update(w ecs.World) {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.Signal2XH1ElectronicType.Get(entry)
|
circuit := component.Signal2XH1ElectronicType.Get(entry)
|
||||||
lsq := component.Signal2XH1LsqType.Get(entry)
|
excite2xh1ByCiDrive(circuit, wd)
|
||||||
lsc := component.Signal2XH1LscType.Get(entry)
|
//lsq := component.Signal2XH1LsqType.Get(entry)
|
||||||
|
//lsc := component.Signal2XH1LscType.Get(entry)
|
||||||
lights := component.SignalLightsType.Get(entry)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
Z2XH1_L := lights.GetLightByTag(component.LdTag)
|
Z2XH1_L := lights.GetLightByTag(component.LdTag)
|
||||||
Z2XH1_H := lights.GetLightByTag(component.HdTag)
|
Z2XH1_H := lights.GetLightByTag(component.HdTag)
|
||||||
s.calculateLsq(state, lsq)
|
//s.calculateLsq(circuit, lsq)
|
||||||
s.calculateL(state, Z2XH1_L)
|
s.calculateL(circuit, Z2XH1_L)
|
||||||
s.calculateH(state, Z2XH1_H)
|
s.calculateH(circuit, Z2XH1_H)
|
||||||
s.calculateDJ(state, Z2XH1_L, Z2XH1_H)
|
s.calculateDJ(circuit, Z2XH1_L, Z2XH1_H)
|
||||||
s.calculateLsc(state, lsc)
|
//s.calculateLsc(circuit, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func excite2xh1ByCiDrive(circuit *component.Signal2XH1Electronic, wd *component.WorldData) {
|
||||||
|
bit, err := wd.QueryQdBit(component.UidType.Get(circuit.Z2XH1_DDJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z2XH1_DDJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z2XH1_LXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z2XH1_LXJ).Td = bit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 联锁驱
|
// 联锁驱
|
||||||
func (s *Signal2XH1System) calculateLsq(state *component.Signal2XH1Electronic, lsq *component.Signal2XH1Lsq) {
|
func (s *Signal2XH1System) calculateLsq(state *component.Signal2XH1Electronic, lsq *component.Signal2XH1Lsq) {
|
||||||
ddj := component.RelayDriveType.Get(state.Z2XH1_DDJ)
|
ddj := component.RelayDriveType.Get(state.Z2XH1_DDJ)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Signal3XH1System struct {
|
type Signal3XH1System struct {
|
||||||
@ -20,25 +21,49 @@ func NewSignal3XH1System() *Signal3XH1System {
|
|||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *Signal3XH1System) Update(w ecs.World) {
|
func (s *Signal3XH1System) Update(w ecs.World) {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.Signal3XH1ElectronicType.Get(entry)
|
circuit := component.Signal3XH1ElectronicType.Get(entry)
|
||||||
lsq := component.Signal3XH1LsqType.Get(entry)
|
excite3xh1ByCiDrive(circuit, wd)
|
||||||
lsc := component.Signal3XH1LscType.Get(entry)
|
//lsq := component.Signal3XH1LsqType.Get(entry)
|
||||||
|
//lsc := component.Signal3XH1LscType.Get(entry)
|
||||||
lights := component.SignalLightsType.Get(entry)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
Z3XH1_L := lights.GetLightByTag(component.LdTag)
|
Z3XH1_L := lights.GetLightByTag(component.LdTag)
|
||||||
Z3XH1_H := lights.GetLightByTag(component.HdTag)
|
Z3XH1_H := lights.GetLightByTag(component.HdTag)
|
||||||
Z3XH1_U := lights.GetLightByTag(component.UdTag)
|
Z3XH1_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
|
||||||
s.calculateLsq(state, lsq)
|
//s.calculateLsq(circuit, lsq)
|
||||||
s.calculateU(state, Z3XH1_U)
|
s.calculateU(circuit, Z3XH1_U)
|
||||||
s.calculateL(state, Z3XH1_L)
|
s.calculateL(circuit, Z3XH1_L)
|
||||||
s.calculateH(state, Z3XH1_H)
|
s.calculateH(circuit, Z3XH1_H)
|
||||||
s.calculateDJ(state, Z3XH1_H, Z3XH1_L, Z3XH1_U)
|
s.calculateDJ(circuit, Z3XH1_H, Z3XH1_L, Z3XH1_U)
|
||||||
s.calculate2DJ(state, Z3XH1_U)
|
s.calculate2DJ(circuit, Z3XH1_U)
|
||||||
s.calculateLsc(state, lsc)
|
//s.calculateLsc(circuit, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func excite3xh1ByCiDrive(circuit *component.Signal3XH1Electronic, wd *component.WorldData) {
|
||||||
|
bit, err := wd.QueryQdBit(component.UidType.Get(circuit.Z3XH1_DDJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH1_DDJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z3XH1_LXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH1_LXJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z3XH1_ZXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH1_ZXJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z3XH1_YXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH1_YXJ).Td = bit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 联锁驱
|
// 联锁驱
|
||||||
func (s *Signal3XH1System) calculateLsq(state *component.Signal3XH1Electronic, lsq *component.Signal3XH1Lsq) {
|
func (s *Signal3XH1System) calculateLsq(state *component.Signal3XH1Electronic, lsq *component.Signal3XH1Lsq) {
|
||||||
ddj := component.RelayDriveType.Get(state.Z3XH1_DDJ)
|
ddj := component.RelayDriveType.Get(state.Z3XH1_DDJ)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Signal3XH2System struct {
|
type Signal3XH2System struct {
|
||||||
@ -20,24 +21,44 @@ func NewSignal3XH2System() *Signal3XH2System {
|
|||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *Signal3XH2System) Update(w ecs.World) {
|
func (s *Signal3XH2System) Update(w ecs.World) {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.Signal3XH2ElectronicType.Get(entry)
|
circuit := component.Signal3XH2ElectronicType.Get(entry)
|
||||||
lsq := component.Signal3XH2LsqType.Get(entry)
|
excite3xh2ByCiDrive(circuit, wd)
|
||||||
lsc := component.Signal3XH2LscType.Get(entry)
|
//lsq := component.Signal3XH2LsqType.Get(entry)
|
||||||
|
//lsc := component.Signal3XH2LscType.Get(entry)
|
||||||
lights := component.SignalLightsType.Get(entry)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
Z3XH2_L := lights.GetLightByTag(component.LdTag)
|
Z3XH2_L := lights.GetLightByTag(component.LdTag)
|
||||||
Z3XH2_H := lights.GetLightByTag(component.HdTag)
|
Z3XH2_H := lights.GetLightByTag(component.HdTag)
|
||||||
Z3XH2_U := lights.GetLightByTag(component.UdTag)
|
Z3XH2_U := lights.GetLightByTag(component.UdTag)
|
||||||
s.calculateLsq(state, lsq)
|
//s.calculateLsq(circuit, lsq)
|
||||||
s.calculateU(state, Z3XH2_U)
|
s.calculateU(circuit, Z3XH2_U)
|
||||||
s.calculateL(state, Z3XH2_L)
|
s.calculateL(circuit, Z3XH2_L)
|
||||||
s.calculateH(state, Z3XH2_H)
|
s.calculateH(circuit, Z3XH2_H)
|
||||||
s.calculateDJ(state, Z3XH2_L, Z3XH2_H)
|
s.calculateDJ(circuit, Z3XH2_L, Z3XH2_H)
|
||||||
s.calculate2DJ(state, Z3XH2_U)
|
s.calculate2DJ(circuit, Z3XH2_U)
|
||||||
s.calculateLsc(state, lsc)
|
//s.calculateLsc(circuit, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据联锁驱动给继电器励磁
|
||||||
|
func excite3xh2ByCiDrive(circuit *component.Signal3XH2Electronic, wd *component.WorldData) {
|
||||||
|
bit, err := wd.QueryQdBit(component.UidType.Get(circuit.Z3XH2_DDJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH2_DDJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z3XH2_LXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH2_LXJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z3XH2_YXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH2_YXJ).Td = bit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 联锁驱
|
// 联锁驱
|
||||||
func (s *Signal3XH2System) calculateLsq(state *component.Signal3XH2Electronic, lsq *component.Signal3XH2Lsq) {
|
func (s *Signal3XH2System) calculateLsq(state *component.Signal3XH2Electronic, lsq *component.Signal3XH2Lsq) {
|
||||||
ddj := component.RelayDriveType.Get(state.Z3XH2_DDJ)
|
ddj := component.RelayDriveType.Get(state.Z3XH2_DDJ)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Signal3XH3System struct {
|
type Signal3XH3System struct {
|
||||||
@ -20,23 +21,42 @@ func NewSignal3XH3System() *Signal3XH3System {
|
|||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *Signal3XH3System) Update(w ecs.World) {
|
func (s *Signal3XH3System) Update(w ecs.World) {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.Signal3XH3ElectronicType.Get(entry)
|
circuit := component.Signal3XH3ElectronicType.Get(entry)
|
||||||
lsq := component.Signal3XH3LsqType.Get(entry)
|
excite3xh3ByCiDrive(circuit, wd)
|
||||||
lsc := component.Signal3XH3LscType.Get(entry)
|
//lsq := component.Signal3XH3LsqType.Get(entry)
|
||||||
|
//lsc := component.Signal3XH3LscType.Get(entry)
|
||||||
lights := component.SignalLightsType.Get(entry)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
Z3XH3_H := lights.GetLightByTag(component.HdTag)
|
Z3XH3_H := lights.GetLightByTag(component.HdTag)
|
||||||
Z3XH3_U := lights.GetLightByTag(component.UdTag)
|
Z3XH3_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
|
||||||
s.calculateLsq(state, lsq)
|
//s.calculateLsq(circuit, lsq)
|
||||||
s.calculateU(state, Z3XH3_U)
|
s.calculateU(circuit, Z3XH3_U)
|
||||||
s.calculateH(state, Z3XH3_H)
|
s.calculateH(circuit, Z3XH3_H)
|
||||||
s.calculateDJ(state, Z3XH3_U, Z3XH3_H)
|
s.calculateDJ(circuit, Z3XH3_U, Z3XH3_H)
|
||||||
s.calculate2DJ(state, Z3XH3_U)
|
s.calculate2DJ(circuit, Z3XH3_U)
|
||||||
s.calculateLsc(state, lsc)
|
//s.calculateLsc(circuit, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func excite3xh3ByCiDrive(circuit *component.Signal3XH3Electronic, wd *component.WorldData) {
|
||||||
|
bit, err := wd.QueryQdBit(component.UidType.Get(circuit.Z3XH3_DDJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH3_DDJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z3XH3_LXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH3_LXJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z3XH3_YXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH3_YXJ).Td = bit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 联锁驱
|
// 联锁驱
|
||||||
func (s *Signal3XH3System) calculateLsq(state *component.Signal3XH3Electronic, lsq *component.Signal3XH3Lsq) {
|
func (s *Signal3XH3System) calculateLsq(state *component.Signal3XH3Electronic, lsq *component.Signal3XH3Lsq) {
|
||||||
ddj := component.RelayDriveType.Get(state.Z3XH3_DDJ)
|
ddj := component.RelayDriveType.Get(state.Z3XH3_DDJ)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Signal3XH4System struct {
|
type Signal3XH4System struct {
|
||||||
@ -20,24 +21,43 @@ func NewSignal3XH4System() *Signal3XH4System {
|
|||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *Signal3XH4System) Update(w ecs.World) {
|
func (s *Signal3XH4System) Update(w ecs.World) {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.Signal3XH4ElectronicType.Get(entry)
|
circuit := component.Signal3XH4ElectronicType.Get(entry)
|
||||||
lsq := component.Signal3XH4LsqType.Get(entry)
|
excite3xh4ByCiDrive(circuit, wd)
|
||||||
lsc := component.Signal3XH4LscType.Get(entry)
|
//lsq := component.Signal3XH4LsqType.Get(entry)
|
||||||
|
//lsc := component.Signal3XH4LscType.Get(entry)
|
||||||
lights := component.SignalLightsType.Get(entry)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
Z3XH4_H := lights.GetLightByTag(component.HdTag)
|
Z3XH4_H := lights.GetLightByTag(component.HdTag)
|
||||||
Z3XH4_L := lights.GetLightByTag(component.LdTag)
|
Z3XH4_L := lights.GetLightByTag(component.LdTag)
|
||||||
Z3XH4_U := lights.GetLightByTag(component.UdTag)
|
Z3XH4_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
//
|
||||||
s.calculateLsq(state, lsq)
|
//s.calculateLsq(circuit, lsq)
|
||||||
s.calculateU(state, Z3XH4_U)
|
s.calculateU(circuit, Z3XH4_U)
|
||||||
s.calculateL(state, Z3XH4_L)
|
s.calculateL(circuit, Z3XH4_L)
|
||||||
s.calculateH(state, Z3XH4_H)
|
s.calculateH(circuit, Z3XH4_H)
|
||||||
s.calculateDJ(state, Z3XH4_H, Z3XH4_L, Z3XH4_U)
|
s.calculateDJ(circuit, Z3XH4_H, Z3XH4_L, Z3XH4_U)
|
||||||
s.calculateLsc(state, lsc)
|
//s.calculateLsc(circuit, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func excite3xh4ByCiDrive(circuit *component.Signal3XH4Electronic, wd *component.WorldData) {
|
||||||
|
bit, err := wd.QueryQdBit(component.UidType.Get(circuit.Z3XH4_DDJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH4_DDJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z3XH4_LXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH4_LXJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.Z3XH4_ZXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.Z3XH4_ZXJ).Td = bit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 联锁驱
|
// 联锁驱
|
||||||
func (s *Signal3XH4System) calculateLsq(state *component.Signal3XH4Electronic, lsq *component.Signal3XH4Lsq) {
|
func (s *Signal3XH4System) calculateLsq(state *component.Signal3XH4Electronic, lsq *component.Signal3XH4Lsq) {
|
||||||
ddj := component.RelayDriveType.Get(state.Z3XH4_DDJ)
|
ddj := component.RelayDriveType.Get(state.Z3XH4_DDJ)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SignalDCXHSystem struct {
|
type SignalDCXHSystem struct {
|
||||||
@ -20,23 +21,32 @@ func NewSignalDCXHSystem() *SignalDCXHSystem {
|
|||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *SignalDCXHSystem) Update(w ecs.World) {
|
func (s *SignalDCXHSystem) Update(w ecs.World) {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.SignalDCXHElectronicType.Get(entry)
|
circuit := component.SignalDCXHElectronicType.Get(entry)
|
||||||
lsq := component.SignalDCXHLsqType.Get(entry)
|
exciteDcxhByCiDrive(circuit, wd)
|
||||||
lsc := component.SignalDCXHLscType.Get(entry)
|
//lsq := component.SignalDCXHLsqType.Get(entry)
|
||||||
|
//lsc := component.SignalDCXHLscType.Get(entry)
|
||||||
lights := component.SignalLightsType.Get(entry)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
DCXH_A := lights.GetLightByTag(component.AdTag)
|
DCXH_A := lights.GetLightByTag(component.AdTag)
|
||||||
DCXH_B := lights.GetLightByTag(component.BdTag)
|
DCXH_B := lights.GetLightByTag(component.BdTag)
|
||||||
//
|
|
||||||
s.calculateLsq(state, lsq)
|
//s.calculateLsq(circuit, lsq)
|
||||||
s.calculateA(state, DCXH_A)
|
s.calculateA(circuit, DCXH_A)
|
||||||
s.calculateB(state, DCXH_B)
|
s.calculateB(circuit, DCXH_B)
|
||||||
s.calculateDJ(state, DCXH_B, DCXH_A)
|
s.calculateDJ(circuit, DCXH_B, DCXH_A)
|
||||||
s.calculateLsc(state, lsc)
|
//s.calculateLsc(circuit, lsc)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func exciteDcxhByCiDrive(circuit *component.SignalDCXHElectronic, wd *component.WorldData) {
|
||||||
|
bit, err := wd.QueryQdBit(component.UidType.Get(circuit.DCXH_DXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.DCXH_DXJ).Td = bit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 联锁驱
|
// 联锁驱
|
||||||
func (s *SignalDCXHSystem) calculateLsq(state *component.SignalDCXHElectronic, lsq *component.SignalDCXHLsq) {
|
func (s *SignalDCXHSystem) calculateLsq(state *component.SignalDCXHElectronic, lsq *component.SignalDCXHLsq) {
|
||||||
dxj := component.RelayDriveType.Get(state.DCXH_DXJ)
|
dxj := component.RelayDriveType.Get(state.DCXH_DXJ)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SignalJCKXHSystem struct {
|
type SignalJCKXHSystem struct {
|
||||||
@ -20,24 +21,38 @@ func NewSignalJCKXHSystem() *SignalJCKXHSystem {
|
|||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *SignalJCKXHSystem) Update(w ecs.World) {
|
func (s *SignalJCKXHSystem) Update(w ecs.World) {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.SignalJCKXHElectronicType.Get(entry)
|
circuit := component.SignalJCKXHElectronicType.Get(entry)
|
||||||
lsq := component.SignalJCKXHLsqType.Get(entry)
|
exciteJckxhByCiDrive(circuit, wd)
|
||||||
lsc := component.SignalJCKXHLscType.Get(entry)
|
//lsq := component.SignalJCKXHLsqType.Get(entry)
|
||||||
|
//lsc := component.SignalJCKXHLscType.Get(entry)
|
||||||
lights := component.SignalLightsType.Get(entry)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
JCKXH_H := lights.GetLightByTag(component.HdTag)
|
JCKXH_H := lights.GetLightByTag(component.HdTag)
|
||||||
JCKXH_B := lights.GetLightByTag(component.BdTag)
|
JCKXH_B := lights.GetLightByTag(component.BdTag)
|
||||||
JCKXH_U := lights.GetLightByTag(component.UdTag)
|
JCKXH_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
|
||||||
s.calculateLsq(state, lsq)
|
//s.calculateLsq(circuit, lsq)
|
||||||
s.calculateU(state, JCKXH_U)
|
s.calculateU(circuit, JCKXH_U)
|
||||||
s.calculateB(state, JCKXH_B)
|
s.calculateB(circuit, JCKXH_B)
|
||||||
s.calculateH(state, JCKXH_H)
|
s.calculateH(circuit, JCKXH_H)
|
||||||
s.calculateDJ(state, JCKXH_H, JCKXH_B, JCKXH_U)
|
s.calculateDJ(circuit, JCKXH_H, JCKXH_B, JCKXH_U)
|
||||||
s.calculateLsc(state, lsc)
|
//s.calculateLsc(circuit, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func exciteJckxhByCiDrive(circuit *component.SignalJCKXHElectronic, wd *component.WorldData) {
|
||||||
|
bit, err := wd.QueryQdBit(component.UidType.Get(circuit.JCKXH_LXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.JCKXH_LXJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.JCKXH_DXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.JCKXH_DXJ).Td = bit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 联锁驱
|
// 联锁驱
|
||||||
func (s *SignalJCKXHSystem) calculateLsq(state *component.SignalJCKXHElectronic, lsq *component.SignalJCKXHLsq) {
|
func (s *SignalJCKXHSystem) calculateLsq(state *component.SignalJCKXHElectronic, lsq *component.SignalJCKXHLsq) {
|
||||||
dxj := component.RelayDriveType.Get(state.JCKXH_DXJ)
|
dxj := component.RelayDriveType.Get(state.JCKXH_DXJ)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"joylink.club/rtsssimulation/entity"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SignalJDXHSystem struct {
|
type SignalJDXHSystem struct {
|
||||||
@ -20,25 +21,39 @@ func NewSignalJDXHSystem() *SignalJDXHSystem {
|
|||||||
|
|
||||||
// Update world 执行
|
// Update world 执行
|
||||||
func (s *SignalJDXHSystem) Update(w ecs.World) {
|
func (s *SignalJDXHSystem) Update(w ecs.World) {
|
||||||
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
state := component.SignalJDXHElectronicType.Get(entry)
|
circuit := component.SignalJDXHElectronicType.Get(entry)
|
||||||
lsq := component.SignalJDXHLsqType.Get(entry)
|
exciteJdxhByCiDrive(circuit, wd)
|
||||||
lsc := component.SignalJDXHLscType.Get(entry)
|
//lsq := component.SignalJDXHLsqType.Get(entry)
|
||||||
|
//lsc := component.SignalJDXHLscType.Get(entry)
|
||||||
lights := component.SignalLightsType.Get(entry)
|
lights := component.SignalLightsType.Get(entry)
|
||||||
JDXH_H := lights.GetLightByTag(component.HdTag)
|
JDXH_H := lights.GetLightByTag(component.HdTag)
|
||||||
JDXH_L := lights.GetLightByTag(component.LdTag)
|
JDXH_L := lights.GetLightByTag(component.LdTag)
|
||||||
JDXH_U := lights.GetLightByTag(component.UdTag)
|
JDXH_U := lights.GetLightByTag(component.UdTag)
|
||||||
//
|
|
||||||
s.calculateLsq(state, lsq)
|
//s.calculateLsq(circuit, lsq)
|
||||||
s.calculateL(state, JDXH_L)
|
s.calculateL(circuit, JDXH_L)
|
||||||
s.calculateU(state, JDXH_U)
|
s.calculateU(circuit, JDXH_U)
|
||||||
s.calculateH(state, JDXH_H)
|
s.calculateH(circuit, JDXH_H)
|
||||||
s.calculateDJ(state, JDXH_L, JDXH_H)
|
s.calculateDJ(circuit, JDXH_L, JDXH_H)
|
||||||
s.calculate2DJ(state, JDXH_U)
|
s.calculate2DJ(circuit, JDXH_U)
|
||||||
s.calculateLsc(state, lsc)
|
//s.calculateLsc(circuit, lsc)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func exciteJdxhByCiDrive(circuit *component.SignalJDXHElectronic, wd *component.WorldData) {
|
||||||
|
bit, err := wd.QueryQdBit(component.UidType.Get(circuit.JDXH_LXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.JDXH_LXJ).Td = bit
|
||||||
|
}
|
||||||
|
|
||||||
|
bit, err = wd.QueryQdBit(component.UidType.Get(circuit.JDXH_YXJ).Id)
|
||||||
|
if err == nil {
|
||||||
|
component.RelayDriveType.Get(circuit.JDXH_YXJ).Td = bit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 联锁驱
|
// 联锁驱
|
||||||
func (s *SignalJDXHSystem) calculateLsq(state *component.SignalJDXHElectronic, lsq *component.SignalJDXHLsq) {
|
func (s *SignalJDXHSystem) calculateLsq(state *component.SignalJDXHElectronic, lsq *component.SignalJDXHLsq) {
|
||||||
lxj := component.RelayDriveType.Get(state.JDXH_LXJ)
|
lxj := component.RelayDriveType.Get(state.JDXH_LXJ)
|
||||||
|
Loading…
Reference in New Issue
Block a user