iscs pscada 一次图 电力传递实现

This commit is contained in:
xzb 2023-12-21 18:10:51 +08:00
parent b4fbfaad78
commit f0433ef838
6 changed files with 15 additions and 6 deletions

View File

@ -14,7 +14,7 @@ type CircuitBreakerSystem struct {
func NewCircuitBreakerSystem() *CircuitBreakerSystem { func NewCircuitBreakerSystem() *CircuitBreakerSystem {
return &CircuitBreakerSystem{ return &CircuitBreakerSystem{
query: ecs.NewQuery(filter.Contains(component.UidType, component.CircuitBreakerType)), query: ecs.NewQuery(filter.Contains(component.UidType, component.CircuitBreakerType, component.DeviceExceptionType)),
} }
} }
func (s *CircuitBreakerSystem) Update(w ecs.World) { func (s *CircuitBreakerSystem) Update(w ecs.World) {

View File

@ -14,7 +14,7 @@ type DisconnectorSystem struct {
func NewDisconnectorSystem() *DisconnectorSystem { func NewDisconnectorSystem() *DisconnectorSystem {
return &DisconnectorSystem{ return &DisconnectorSystem{
query: ecs.NewQuery(filter.Contains(component.UidType, component.DisconnectorType)), query: ecs.NewQuery(filter.Contains(component.UidType, component.DisconnectorType, component.DeviceExceptionType)),
} }
} }
func (s *DisconnectorSystem) Update(w ecs.World) { func (s *DisconnectorSystem) Update(w ecs.World) {

View File

@ -14,7 +14,7 @@ type HandcartSystem struct {
func NewHandcartSystem() *HandcartSystem { func NewHandcartSystem() *HandcartSystem {
return &HandcartSystem{ return &HandcartSystem{
query: ecs.NewQuery(filter.Contains(component.UidType, component.HandcartSwitchType)), query: ecs.NewQuery(filter.Contains(component.UidType, component.HandcartSwitchType, component.DeviceExceptionType)),
} }
} }
func (s *HandcartSystem) Update(w ecs.World) { func (s *HandcartSystem) Update(w ecs.World) {

View File

@ -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/consts"
"joylink.club/rtsssimulation/entity" "joylink.club/rtsssimulation/entity"
"joylink.club/rtsssimulation/repository" "joylink.club/rtsssimulation/repository"
) )
@ -14,10 +15,18 @@ type RectifierSystem struct {
func NewRectifierSystem() *RectifierSystem { func NewRectifierSystem() *RectifierSystem {
return &RectifierSystem{ return &RectifierSystem{
query: ecs.NewQuery(filter.Contains(component.UidType, component.RectifierType)), query: ecs.NewQuery(filter.Contains(component.UidType, component.RectifierType, component.DeviceExceptionType)),
} }
} }
func (s *RectifierSystem) Update(w ecs.World) { func (s *RectifierSystem) Update(w ecs.World) {
s.query.Each(w, func(entry *ecs.Entry) {
rectifier := component.RectifierType.Get(entry)
exception := component.DeviceExceptionType.Get(entry)
//
rectifier.Normal = exception.Exception == consts.DeviceExceptionNon
})
//
s.rectifierTransPower(w) s.rectifierTransPower(w)
} }

View File

@ -14,7 +14,7 @@ type ThreePositionSwitchSystem struct {
func NewThreePositionSwitchSystem() *ThreePositionSwitchSystem { func NewThreePositionSwitchSystem() *ThreePositionSwitchSystem {
return &ThreePositionSwitchSystem{ return &ThreePositionSwitchSystem{
query: ecs.NewQuery(filter.Contains(component.UidType, component.ThreePositionSwitchType)), query: ecs.NewQuery(filter.Contains(component.UidType, component.ThreePositionSwitchType, component.DeviceExceptionType)),
} }
} }

View File

@ -14,7 +14,7 @@ type VoltageTransformerSystem struct {
func NewVoltageTransformerSystem() *VoltageTransformerSystem { func NewVoltageTransformerSystem() *VoltageTransformerSystem {
return &VoltageTransformerSystem{ return &VoltageTransformerSystem{
query: ecs.NewQuery(filter.Contains(component.UidType, component.VoltageTransformerType)), query: ecs.NewQuery(filter.Contains(component.UidType, component.VoltageTransformerType, component.DeviceExceptionType)),
} }
} }
func (s *VoltageTransformerSystem) Update(w ecs.World) { func (s *VoltageTransformerSystem) Update(w ecs.World) {