From 8b32cfa4c77632cd3e551871b483f918cea078d4 Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Mon, 11 Dec 2023 18:09:28 +0800 Subject: [PATCH] =?UTF-8?q?ISCS=E7=8E=AF=E5=A2=83=E4=B8=8E=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=9B=91=E6=8E=A7=E7=B3=BB=E7=BB=9Fecs=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- component/iscs_bas.go | 9 +++++++++ entity/iscs_bas.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) 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 +}