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

This commit is contained in:
xzb 2023-12-13 18:03:00 +08:00
parent 1d183dfa12
commit 914cb25599
4 changed files with 14 additions and 0 deletions

View File

@ -32,6 +32,10 @@ func (s *ChillerUnitSystem) Update(w ecs.World) {
if entry.HasComponent(component.DeviceCommunicationInterruptTag) { if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
device.Exception = consts.DeviceCommunicationInterrupt device.Exception = consts.DeviceCommunicationInterrupt
} }
//异常停止运行
if device.Exception != consts.DeviceExceptionNon {
device.Running = false
}
}) })
} }

View File

@ -7,6 +7,7 @@ import (
"joylink.club/rtsssimulation/consts" "joylink.club/rtsssimulation/consts"
) )
// PurificationDeviceSystem 净化装置
type PurificationDeviceSystem struct { type PurificationDeviceSystem struct {
query *ecs.Query query *ecs.Query
} }

View File

@ -20,6 +20,7 @@ func NewWaterClosedContainerSystem() *WaterClosedContainerSystem {
func (s *WaterClosedContainerSystem) Update(w ecs.World) { func (s *WaterClosedContainerSystem) Update(w ecs.World) {
s.query.Each(w, func(entry *ecs.Entry) { s.query.Each(w, func(entry *ecs.Entry) {
container := component.WaterClosedContainerType.Get(entry) container := component.WaterClosedContainerType.Get(entry)
//
container.Exception = consts.DeviceExceptionNon container.Exception = consts.DeviceExceptionNon
if entry.HasComponent(component.DeviceFaultTag) { if entry.HasComponent(component.DeviceFaultTag) {
container.Exception = consts.DeviceFault container.Exception = consts.DeviceFault
@ -30,5 +31,9 @@ func (s *WaterClosedContainerSystem) Update(w ecs.World) {
if entry.HasComponent(component.DeviceCommunicationInterruptTag) { if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
container.Exception = consts.DeviceCommunicationInterrupt container.Exception = consts.DeviceCommunicationInterrupt
} }
//异常停止运行
if container.Exception != consts.DeviceExceptionNon {
container.Running = false
}
}) })
} }

View File

@ -38,5 +38,9 @@ func (s *WaterPumpSystem) Update(w ecs.World) {
if entry.HasComponent(component.DeviceCommunicationInterruptTag) { if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
pump.Exception = consts.DeviceCommunicationInterrupt pump.Exception = consts.DeviceCommunicationInterrupt
} }
//异常停止运行
if pump.Exception != consts.DeviceExceptionNon {
pump.Running = false
}
}) })
} }