2023-12-11 17:16:51 +08:00
|
|
|
|
package component
|
|
|
|
|
|
2023-12-25 17:31:35 +08:00
|
|
|
|
import "joylink.club/ecs"
|
2023-12-11 17:16:51 +08:00
|
|
|
|
|
2023-12-25 17:31:35 +08:00
|
|
|
|
// FanDevice 风机设备
|
2023-12-11 17:16:51 +08:00
|
|
|
|
// 正转即顺时针转-排风;反转即逆时针转-进风
|
2023-12-25 17:31:35 +08:00
|
|
|
|
type FanDevice struct {
|
2023-12-26 10:59:07 +08:00
|
|
|
|
Speed float32 //风机转速,r/min
|
|
|
|
|
Forward bool //true-正转;false-反转
|
|
|
|
|
Fs FanSwitch //风机开关
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FanSwitch 风机电源开关定义
|
|
|
|
|
type FanSwitch uint8
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
Off FanSwitch = iota
|
|
|
|
|
OnForward //正转
|
|
|
|
|
OnReverse //反转
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (f *FanSwitch) Off() bool {
|
|
|
|
|
return *f == Off
|
|
|
|
|
}
|
|
|
|
|
func (f *FanSwitch) OnForward() bool {
|
|
|
|
|
return *f == OnForward
|
|
|
|
|
}
|
|
|
|
|
func (f *FanSwitch) OnReverse() bool {
|
|
|
|
|
return *f == OnReverse
|
|
|
|
|
}
|
|
|
|
|
func (f *FanSwitch) On() bool {
|
|
|
|
|
return *f == OnReverse || *f == OnForward
|
2023-12-11 17:16:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-25 17:31:35 +08:00
|
|
|
|
// FanFcUnit 风机变频器
|
2023-12-26 10:59:07 +08:00
|
|
|
|
// 电机转速与变频器频率关系 计算公式:n=60f/p(其中n是同步转速,f是频率,P是磁极对数)
|
|
|
|
|
// 变频器的额定输出频率一般为0-100HZ
|
2023-12-25 17:31:35 +08:00
|
|
|
|
type FanFcUnit struct {
|
2023-12-26 13:13:30 +08:00
|
|
|
|
F uint16 //变频器频率(0-100HZ)
|
2023-12-11 17:16:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-25 17:31:35 +08:00
|
|
|
|
// FanBypassUnit 风机旁路装置
|
|
|
|
|
type FanBypassUnit struct {
|
|
|
|
|
Bypass bool //true-风机旁路已开启
|
2023-12-11 18:09:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-25 17:31:35 +08:00
|
|
|
|
// FanSoftStartUnit 风机软启装置
|
|
|
|
|
type FanSoftStartUnit struct {
|
|
|
|
|
SoftStart bool //true-风机软启已开启
|
|
|
|
|
}
|
2023-12-11 18:09:28 +08:00
|
|
|
|
|
2023-12-25 17:31:35 +08:00
|
|
|
|
// FanHighLowSpeedMode 风机双速模式控制
|
|
|
|
|
type FanHighLowSpeedMode struct {
|
|
|
|
|
HighMode bool //true-风机高速模式;false-风机低速模式
|
|
|
|
|
}
|
2023-12-12 13:08:37 +08:00
|
|
|
|
|
2023-12-25 17:31:35 +08:00
|
|
|
|
var (
|
|
|
|
|
FanDeviceType = ecs.NewComponentType[FanDevice]() //风机设备
|
|
|
|
|
FanFcUnitType = ecs.NewComponentType[FanFcUnit]() //风机变频装置
|
|
|
|
|
FanBypassUnitType = ecs.NewComponentType[FanBypassUnit]() //风机旁路装置
|
|
|
|
|
FanSoftStartUnitType = ecs.NewComponentType[FanSoftStartUnit]() //风机软启装置
|
|
|
|
|
FanHighLowSpeedModeType = ecs.NewComponentType[FanHighLowSpeedMode]() //风机双速模式控制
|
|
|
|
|
|
2023-12-25 17:33:51 +08:00
|
|
|
|
CommonFanTag = ecs.NewTag() //一般风机
|
|
|
|
|
FcBypassFanTag = ecs.NewTag() //变频旁路风机
|
|
|
|
|
SoftStartFanTag = ecs.NewTag() //软启动风机
|
|
|
|
|
HighLowSpeedFanTag = ecs.NewTag() //双速风机
|
2023-12-11 17:16:51 +08:00
|
|
|
|
)
|