diff --git a/component/iscs_bas.go b/component/iscs_bas.go index 7f3df42..b0a6be8 100644 --- a/component/iscs_bas.go +++ b/component/iscs_bas.go @@ -28,6 +28,13 @@ type FanState struct { Exception consts.DeviceExceptionEnum //风机异常 } +// AirConditionerGroup 空调群控系统 +type AirConditionerGroup struct { + Acs []*ecs.Entry //空调群 + GroupRunning bool //true-空调群中所有空调正常运行 + Exception consts.DeviceExceptionEnum //空调群异常 +} + var ( FanType = ecs.NewComponentType[Fan]() //风机 FanStateType = ecs.NewComponentType[FanState]() @@ -35,4 +42,6 @@ var ( TwoSpeedFanTag = ecs.NewTag() //双速风机标签 LowSpeedModeFanTag = ecs.NewTag() //双速风机低速运行模式标签 HighSpeedModeFanTag = ecs.NewTag() //双速风机高速运行模式标签 + + AirConditionerTag = ecs.NewTag() //空调 ) diff --git a/entity/iscs_bas.go b/entity/iscs_bas.go index 9356433..ec1f257 100644 --- a/entity/iscs_bas.go +++ b/entity/iscs_bas.go @@ -1 +1,30 @@ package entity + +import ( + "joylink.club/ecs" + "joylink.club/rtsssimulation/component" +) + +// NewIscsFanEntity 创建风机实体 +func NewIscsFanEntity(w ecs.World, id string) *ecs.Entry { + e := w.Entry(w.Create(component.UidType, component.FanType, component.FanStateType)) + component.UidType.SetValue(e, component.Uid{Id: id}) + return e +} + +// NewIscsTwoSpeedFanEntity 创建双速风机实体 +func NewIscsTwoSpeedFanEntity(w ecs.World, id string) *ecs.Entry { + entry := NewIscsFanEntity(w, id) + entry.AddComponent(component.TwoSpeedFanTag) + return entry +} + +// NewAirConditioner 创建空调实体/空调器实体 +// +// fc-true变频空调; +func NewAirConditioner(w ecs.World, id string, fc bool) *ecs.Entry { + entry := NewIscsFanEntity(w, id) + entry.HasComponent(component.AirConditionerTag) + component.FanType.Get(entry).Fc = fc + return entry +}