ISCS环境与设备监控系统ecs定义

This commit is contained in:
xzb 2023-12-11 18:09:28 +08:00
parent d6ada1d1ff
commit 8b32cfa4c7
2 changed files with 38 additions and 0 deletions

View File

@ -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() //空调
)

View File

@ -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
}