iscs bas 大系统

This commit is contained in:
xzb 2023-12-25 17:37:41 +08:00
parent db37e0fc83
commit da68a3af26
3 changed files with 1 additions and 61 deletions

View File

@ -1,30 +0,0 @@
package iscs_sys
import (
"joylink.club/ecs"
"joylink.club/ecs/filter"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/consts"
)
// ElectricControlValveSystem 电动调节阀、电动风阀、组合式风阀、电动两通调节阀
type ElectricControlValveSystem struct {
query *ecs.Query
}
func NewElectricControlValveSystem() *ElectricControlValveSystem {
return &ElectricControlValveSystem{
query: ecs.NewQuery(filter.Contains(component.ElectricControlValveType, component.TwoPositionTransformType)),
}
}
func (s *ElectricControlValveSystem) Update(w ecs.World) {
s.query.Each(w, func(entry *ecs.Entry) {
valve := component.ElectricControlValveType.Get(entry)
tps := component.TwoPositionTransformType.Get(entry) //最小表示全关,最大表示全开
//
valve.Moving = tps.Pos > consts.TwoPosMin && tps.Pos < consts.TwoPosMax
valve.Opened = tps.Pos >= consts.TwoPosMax
valve.Closed = tps.Pos <= consts.TwoPosMin
valve.OpenRate = uint8(tps.Percentage() * 100) //xxx%
})
}

View File

@ -1,32 +1 @@
package iscs_sys
import (
"joylink.club/ecs"
"joylink.club/ecs/filter"
"joylink.club/rtsssimulation/component"
)
// BasFanSystem ISCS BAS 风机
type BasFanSystem struct {
query *ecs.Query
}
func NewBasFanSystem() *BasFanSystem {
return &BasFanSystem{
query: ecs.NewQuery(filter.Contains(component.FanType)),
}
}
func (s *BasFanSystem) Update(w ecs.World) {
s.query.Each(w, func(entry *ecs.Entry) {
fan := component.FanType.Get(entry)
//
fanState := component.FanStateType.Get(entry)
fanState.Fc = fan.Fc
fanState.Bypass = fan.Bypass
fanState.Running = fan.Power != 0
fanState.Forward = fan.Power > 0
fanState.SoftStart = fan.SoftStart
fanState.HighSpeed = fanState.Running && entry.HasComponent(component.HighSpeedModeFanTag)
fanState.SlowSpeed = fanState.Running && entry.HasComponent(component.LowSpeedModeFanTag)
})
}

View File

@ -0,0 +1 @@
package iscs_sys