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% }) }