ISCS火警系统ecs定义
This commit is contained in:
parent
9d1cc70a87
commit
2b1d332918
36
fi/iscs_fas.go
Normal file
36
fi/iscs_fas.go
Normal file
@ -0,0 +1,36 @@
|
||||
package fi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
)
|
||||
|
||||
// SmokeDetectorIsolateOperate 烟感隔离设置
|
||||
func SmokeDetectorIsolateOperate(w ecs.World, deviceId string, isolate bool) error {
|
||||
r := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||
wd := entity.GetWorldData(w)
|
||||
deviceEntry, ok := wd.EntityMap[deviceId]
|
||||
if !ok {
|
||||
return ecs.NewErrResult(fmt.Errorf("设备[%s]实体不存在", deviceId))
|
||||
}
|
||||
//
|
||||
if !(deviceEntry.HasComponent(component.SmokeDetectorType)) {
|
||||
return ecs.NewErrResult(fmt.Errorf("设备[%s]不是烟感", deviceId))
|
||||
}
|
||||
detector := component.SmokeDetectorType.Get(deviceEntry)
|
||||
if isolate {
|
||||
detector.Act = component.StaIsolate
|
||||
} else {
|
||||
if detector.Act == component.StaIsolate {
|
||||
detector.Act = component.StaNon
|
||||
} else {
|
||||
return ecs.NewErrResult(fmt.Errorf("烟感[%s]当前不处于隔离态,不能执行取消隔离操作", deviceId))
|
||||
}
|
||||
}
|
||||
//
|
||||
return ecs.NewOkEmptyResult()
|
||||
})
|
||||
return r.Err
|
||||
}
|
36
sys/iscs_sys/iscs_fas_manual_fire_alarm_button.go
Normal file
36
sys/iscs_sys/iscs_fas_manual_fire_alarm_button.go
Normal file
@ -0,0 +1,36 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// ManualFireAlarmButtonSystem 手动火灾报警按钮
|
||||
type ManualFireAlarmButtonSystem struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewManualFireAlarmButtonSystem() *ManualFireAlarmButtonSystem {
|
||||
return &ManualFireAlarmButtonSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.UidType, component.ManualFireAlarmButtonType)),
|
||||
}
|
||||
}
|
||||
func (s *ManualFireAlarmButtonSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
button := component.ManualFireAlarmButtonType.Get(entry)
|
||||
//
|
||||
button.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
button.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
button.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
//todo act
|
||||
|
||||
//
|
||||
button.Normal = button.Exception == consts.DeviceExceptionNon && button.Act == component.MfabNon
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user