ISCS火警系统ecs定义
This commit is contained in:
parent
73501bf793
commit
a7dba63f4e
@ -7,10 +7,18 @@ import (
|
||||
|
||||
// NetworkHost 网络设备、网络主机等
|
||||
type NetworkHost struct {
|
||||
Normal bool //true-正常
|
||||
State HostState //状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、通信中断
|
||||
}
|
||||
|
||||
// HostState 主机状态定义
|
||||
type HostState = uint8
|
||||
|
||||
const (
|
||||
HostNormal HostState = iota //正常
|
||||
HostFireAlarm //火警
|
||||
)
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
// SmokeDetector 烟感
|
||||
|
48
component/iscs_tfds.go
Normal file
48
component/iscs_tfds.go
Normal file
@ -0,0 +1,48 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// TFDSHost TFDS主机-与感温光纤有关状态
|
||||
type TFDSHost struct {
|
||||
State TofState //一整条感温光纤状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-异常、通信中断
|
||||
}
|
||||
|
||||
// TofState 一整条感温光纤状态定义
|
||||
type TofState = uint8
|
||||
|
||||
const (
|
||||
TofNormal TofState = iota //正常
|
||||
TofBroken //断纤
|
||||
TofFireAlarm //火警
|
||||
)
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
// TofCheckPoint 分布式感温光纤上的温度检测点
|
||||
// 实际上感温光纤上的每个点都可以传回温度,工程上选取每隔一段距离的来检测温度
|
||||
type TofCheckPoint struct {
|
||||
T int16 //检测点温度
|
||||
State TofcpState //状态,通过检测点温度计算得到
|
||||
Exception consts.DeviceExceptionEnum //具体异常-通信中断
|
||||
}
|
||||
|
||||
// TofcpState 感温关系检测点状态定义
|
||||
type TofcpState = uint8
|
||||
|
||||
const (
|
||||
TofcpNormal TofcpState = iota //正常
|
||||
TofcpNon //未知,当通信中断时
|
||||
TofcpEarlyWarn //预警
|
||||
TofcpFireAlarm //火警
|
||||
)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
var (
|
||||
TFDSHostType = ecs.NewComponentType[TFDSHost]()
|
||||
TofCheckPointType = ecs.NewComponentType[TofCheckPoint]()
|
||||
)
|
32
entity/iscs_tfds.go
Normal file
32
entity/iscs_tfds.go
Normal file
@ -0,0 +1,32 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
)
|
||||
|
||||
// NewTFDSHostEntity 创建TFDS主机实体
|
||||
func NewTFDSHostEntity(w ecs.World, id string, checkPoints []*ecs.Entry) *ecs.Entry {
|
||||
wd := GetWorldData(w)
|
||||
e, ok := wd.EntityMap[id]
|
||||
if !ok {
|
||||
//TFDS主机状态:网络主机状态+被监控的感温光纤的状态
|
||||
//被监控的感温光纤的状态:有被监控的光纤上的所有检测点的状态综合计算得到
|
||||
e := w.Entry(w.Create(component.UidType, component.NetworkHostType, component.TFDSHostType))
|
||||
component.UidType.SetValue(e, component.Uid{Id: id})
|
||||
wd.EntityMap[id] = e
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
// NewTofCheckPointEntity 创建感温光纤工程检测点实体
|
||||
func NewTofCheckPointEntity(w ecs.World, id string) *ecs.Entry {
|
||||
wd := GetWorldData(w)
|
||||
e, ok := wd.EntityMap[id]
|
||||
if !ok {
|
||||
e := w.Entry(w.Create(component.UidType, component.TofCheckPointType))
|
||||
component.UidType.SetValue(e, component.Uid{Id: id})
|
||||
wd.EntityMap[id] = e
|
||||
}
|
||||
return e
|
||||
}
|
Loading…
Reference in New Issue
Block a user