2023-12-12 18:07:38 +08:00
|
|
|
package iscs_sys
|
|
|
|
|
|
|
|
import (
|
|
|
|
"joylink.club/ecs"
|
|
|
|
"joylink.club/ecs/filter"
|
|
|
|
"joylink.club/rtsssimulation/component"
|
|
|
|
"joylink.club/rtsssimulation/consts"
|
|
|
|
)
|
|
|
|
|
|
|
|
// ChillerUnitSystem 冷水机组
|
|
|
|
type ChillerUnitSystem struct {
|
|
|
|
query *ecs.Query
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewChillerUnitSystem() *ChillerUnitSystem {
|
|
|
|
return &ChillerUnitSystem{
|
2023-12-19 11:11:27 +08:00
|
|
|
query: ecs.NewQuery(filter.Contains(component.ChillerUnitType, component.DeviceExceptionType)),
|
2023-12-12 18:07:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
func (s *ChillerUnitSystem) Update(w ecs.World) {
|
|
|
|
s.query.Each(w, func(entry *ecs.Entry) {
|
|
|
|
device := component.ChillerUnitType.Get(entry)
|
2023-12-19 11:11:27 +08:00
|
|
|
de := component.DeviceExceptionType.Get(entry)
|
2023-12-13 18:03:00 +08:00
|
|
|
//异常停止运行
|
2023-12-19 11:11:27 +08:00
|
|
|
if de.Exception != consts.DeviceExceptionNon {
|
2023-12-13 18:03:00 +08:00
|
|
|
device.Running = false
|
|
|
|
}
|
2023-12-12 18:07:38 +08:00
|
|
|
|
|
|
|
})
|
|
|
|
}
|