2023-12-12 18:07:38 +08:00
|
|
|
|
package component
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"joylink.club/ecs"
|
|
|
|
|
"joylink.club/rtsssimulation/consts"
|
|
|
|
|
)
|
|
|
|
|
|
2023-12-13 10:21:02 +08:00
|
|
|
|
//水泵相关
|
|
|
|
|
|
2023-12-12 18:07:38 +08:00
|
|
|
|
// WaterPump 水泵
|
|
|
|
|
// 如:冷冻水泵、冷却水循环泵、超声波型水泵、浮球型水泵
|
|
|
|
|
type WaterPump struct {
|
|
|
|
|
Running bool //true-正常运行;false-停止
|
|
|
|
|
Exception consts.DeviceExceptionEnum //具体异常
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FloatBallSwitch 浮球控制的开关,用于浮球型水泵
|
|
|
|
|
// 浮球由水箱水位控制
|
|
|
|
|
type FloatBallSwitch struct {
|
|
|
|
|
On bool //true-水位超过某个限度后,开关开启;false-开关关闭
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WaterTank 水池、水箱
|
|
|
|
|
type WaterTank struct {
|
2023-12-13 10:21:02 +08:00
|
|
|
|
Value int32 //水位,单位mm
|
|
|
|
|
Level WaterLevel //当前水位级别
|
|
|
|
|
Exception consts.DeviceExceptionEnum //具体异常-通信中断
|
2023-12-12 18:07:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-13 10:21:02 +08:00
|
|
|
|
// WaterLevel 水位定义
|
|
|
|
|
type WaterLevel = uint8
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
WaterLevelNormal WaterLevel = iota //正常安全水位
|
|
|
|
|
WaterLevelHigh //水位过高
|
|
|
|
|
WaterLevelLow //水位过低
|
|
|
|
|
)
|
|
|
|
|
|
2023-12-12 18:07:38 +08:00
|
|
|
|
var (
|
|
|
|
|
WaterPumpType = ecs.NewComponentType[WaterPump]()
|
|
|
|
|
FloatBallSwitchType = ecs.NewComponentType[FloatBallSwitch]()
|
|
|
|
|
WaterTankType = ecs.NewComponentType[WaterTank]()
|
|
|
|
|
)
|