iscs ecs 调整
This commit is contained in:
parent
c00ec9a7e3
commit
5317c03689
@ -1,6 +1,24 @@
|
||||
package component
|
||||
|
||||
import "joylink.club/ecs"
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// DeviceException 设备异常
|
||||
type DeviceException struct {
|
||||
Exception consts.DeviceExceptionEnum //具体异常
|
||||
}
|
||||
|
||||
// DevicePlacing 设备置牌
|
||||
type DevicePlacing struct {
|
||||
Placing consts.DevicePlacingEnum
|
||||
}
|
||||
|
||||
var (
|
||||
DeviceExceptionType = ecs.NewComponentType[DeviceException]() //设备异常组件
|
||||
DevicePlacingType = ecs.NewComponentType[DevicePlacing]() //设备置牌组件
|
||||
)
|
||||
|
||||
// 设备例外标签定义
|
||||
var (
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// DoorSensor 门磁
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type DoorSensor struct {
|
||||
State DsState //门磁状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
State DsState //门磁状态
|
||||
}
|
||||
|
||||
// DsState 门磁状态
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// AfcGate AFC闸机
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type AfcGate struct {
|
||||
State AgsState //闸机状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
State AgsState //闸机状态
|
||||
}
|
||||
|
||||
// AgsState AFC闸机状态定义
|
||||
@ -22,9 +21,9 @@ const (
|
||||
//////////////////////////////////////////
|
||||
|
||||
// TicketMachine 票机(自动售票机、半自动售票机、验票机)
|
||||
// 具体异常-故障、通信中断
|
||||
type TicketMachine struct {
|
||||
State TmState //票机状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、通信中断
|
||||
State TmState //票机状态
|
||||
}
|
||||
|
||||
// TmState 票机状态定义
|
||||
|
@ -1 +1,7 @@
|
||||
package component
|
||||
|
||||
// SpaceAreaEnv 空间区域BAS环境(如站厅、设备室等的温度、湿度、烟雾浓度、CO2浓度等)
|
||||
type SpaceAreaEnv struct {
|
||||
T int16 //温度
|
||||
|
||||
}
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// AirCurtain 空气幕
|
||||
// 具体异常-故障、报警、异常、通信中断
|
||||
type AirCurtain struct {
|
||||
Running bool //true-运行;false-停止
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、报警、异常、通信中断
|
||||
Running bool //true-运行;false-停止
|
||||
}
|
||||
|
||||
var AirCurtainType = ecs.NewComponentType[AirCurtain]()
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// ChillerUnit 冷水机组
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type ChillerUnit struct {
|
||||
Running bool //true-正常运行;false-停机
|
||||
Exception consts.DeviceExceptionEnum //具体异常
|
||||
Running bool //true-正常运行;false-停机
|
||||
}
|
||||
|
||||
var ChillerUnitType = ecs.NewComponentType[ChillerUnit]() //冷水机组
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// CivilDefenseDoor 人防门
|
||||
// 具体异常-通信中断、故障、报警、异常
|
||||
type CivilDefenseDoor struct {
|
||||
Open bool //true-开;false-关
|
||||
Exception consts.DeviceExceptionEnum //具体异常-通信中断、故障、报警、异常
|
||||
Open bool //true-开;false-关
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -2,20 +2,19 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// Escalator 自动扶梯
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type Escalator struct {
|
||||
Running int8 //0-停止;1-上行;-1-下行
|
||||
EmergencyStop bool //true-急停
|
||||
Exception consts.DeviceExceptionEnum //具体异常
|
||||
Running int8 //0-停止;1-上行;-1-下行
|
||||
EmergencyStop bool //true-急停
|
||||
}
|
||||
|
||||
// Elevator 垂直电梯
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type Elevator struct {
|
||||
Running bool //true-运行;false-停止
|
||||
Exception consts.DeviceExceptionEnum //具体异常
|
||||
Running bool //true-运行;false-停止
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// EmergencyLighting 应急照明
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type EmergencyLighting struct {
|
||||
Mode EmergencyLightingMode
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Mode EmergencyLightingMode
|
||||
}
|
||||
|
||||
// EmergencyLightingMode 应急照明模式定义
|
||||
|
@ -2,7 +2,6 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
//环境与设备监控系统BAS 相关组件定义
|
||||
@ -17,23 +16,22 @@ type Fan struct {
|
||||
}
|
||||
|
||||
// FanState 面向用户的风机状态
|
||||
// 具体异常-故障、报警、异常、通信中断
|
||||
type FanState struct {
|
||||
Forward bool //true-正转;false-反转
|
||||
Running bool //true-运行;false-停止
|
||||
Fc bool //true-变频器开启
|
||||
Bypass bool //true-旁路开启
|
||||
SoftStart bool //true-软启开启
|
||||
HighSpeed bool //true-双速风机之扇叶高速运转
|
||||
SlowSpeed bool //true-双速风机之扇叶低速运转
|
||||
Exception consts.DeviceExceptionEnum //风机异常
|
||||
Hand bool //true-设备旁有手型图标
|
||||
Forward bool //true-正转;false-反转
|
||||
Running bool //true-运行;false-停止
|
||||
Fc bool //true-变频器开启
|
||||
Bypass bool //true-旁路开启
|
||||
SoftStart bool //true-软启开启
|
||||
HighSpeed bool //true-双速风机之扇叶高速运转
|
||||
SlowSpeed bool //true-双速风机之扇叶低速运转
|
||||
}
|
||||
|
||||
// AirConditionerGroup 空调群控系统
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type AirConditionerGroup struct {
|
||||
Acs []*ecs.Entry //空调群
|
||||
GroupRunning bool //true-空调群中所有空调正常运行
|
||||
Exception consts.DeviceExceptionEnum //空调群异常
|
||||
Acs []*ecs.Entry //空调群
|
||||
GroupRunning bool //true-空调群中所有空调正常运行
|
||||
}
|
||||
|
||||
var (
|
||||
@ -47,6 +45,4 @@ var (
|
||||
AirConditionerTag = ecs.NewTag() //空调、空调器
|
||||
CombinedAirConditionerTag = ecs.NewTag() //组合式空调
|
||||
|
||||
// HandTag 设备旁边的手型图标,手动含义?
|
||||
HandTag = ecs.NewTag()
|
||||
)
|
||||
|
@ -2,17 +2,16 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// FlowSwitch 流量开关
|
||||
// 具体异常-通信中断
|
||||
//
|
||||
// 主要是在水、气、油等介质管路中在线或者插入式安装监控水系统中水流量的大小。
|
||||
// 在水流量高于或者低于某一个设定点时候触发输出报警信号传递给机组,
|
||||
// 系统获取信号后即可作出相应的指示动作。避免或减少主机“干烧”。
|
||||
type FlowSwitch struct {
|
||||
Open bool //true-开启;false-关闭
|
||||
Exception consts.DeviceExceptionEnum //具体异常-通信中断
|
||||
Open bool //true-开启;false-关闭
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// NetworkSwitch 交换机
|
||||
// 具体异常-通信中断、异常
|
||||
type NetworkSwitch struct {
|
||||
Normal bool //true-正常
|
||||
Exception consts.DeviceExceptionEnum //具体异常-通信中断、异常
|
||||
Normal bool //true-正常
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// PlcController PLC控制器
|
||||
// 具体异常-通信中断、故障、异常
|
||||
type PlcController struct {
|
||||
Normal bool //true-正常
|
||||
Exception consts.DeviceExceptionEnum //具体异常-通信中断、故障、异常
|
||||
Normal bool //true-正常
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -2,16 +2,15 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
//水泵相关
|
||||
|
||||
// WaterPump 水泵
|
||||
// 具体异常-故障、异常、通信中断
|
||||
// 如:冷冻水泵、冷却水循环泵、超声波型水泵、浮球型水泵、火警相关水泵
|
||||
type WaterPump struct {
|
||||
Running bool //true-正常运行;false-停止
|
||||
Exception consts.DeviceExceptionEnum //具体异常
|
||||
Running bool //true-正常运行;false-停止
|
||||
}
|
||||
|
||||
// FloatBallSwitch 浮球控制的开关,用于浮球型水泵
|
||||
@ -21,10 +20,10 @@ type FloatBallSwitch struct {
|
||||
}
|
||||
|
||||
// WaterTank 水池、水箱
|
||||
// 具体异常-通信中断
|
||||
type WaterTank struct {
|
||||
Value int32 //水位,单位mm
|
||||
Level WaterLevel //当前水位级别
|
||||
Exception consts.DeviceExceptionEnum //具体异常-通信中断
|
||||
Value int32 //水位,单位mm
|
||||
Level WaterLevel //当前水位级别
|
||||
}
|
||||
|
||||
// WaterLevel 水位定义
|
||||
|
@ -2,14 +2,13 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// PurificationDevice 净化装置
|
||||
// 具体异常-启动超时、异常、通信中断
|
||||
type PurificationDevice struct {
|
||||
Running bool //true-运行;false-停止
|
||||
Starting bool //true-正在启动
|
||||
Exception consts.DeviceExceptionEnum //具体异常
|
||||
Running bool //true-运行;false-停止
|
||||
Starting bool //true-正在启动
|
||||
}
|
||||
|
||||
const PurificationDeviceStartTime int = 3000 //净化装置启动耗时,ms
|
||||
|
@ -2,26 +2,25 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// 阀门开关
|
||||
|
||||
// ElectricControlValve 电动调节阀
|
||||
// 具体异常
|
||||
//
|
||||
// 电动风阀、电动调节阀、组合式风阀、电动两通调节阀、电动蝶阀
|
||||
type ElectricControlValve struct {
|
||||
Opened bool //true-开到位
|
||||
Closed bool //true-关到位
|
||||
Moving bool //true-正在动作
|
||||
OpenRate uint8 //开度
|
||||
Exception consts.DeviceExceptionEnum //具体异常
|
||||
Opened bool //true-开到位
|
||||
Closed bool //true-关到位
|
||||
Moving bool //true-正在动作
|
||||
OpenRate uint8 //开度
|
||||
}
|
||||
|
||||
// ElectricControlValveOperationTime 电动调节阀动作耗时,ms
|
||||
const ElectricControlValveOperationTime int = 4000
|
||||
|
||||
// ControlValve 调节阀
|
||||
// ControlValve 调节阀(手动)
|
||||
type ControlValve struct {
|
||||
OpenRate uint8 //开度,0-100%
|
||||
}
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// WaterClosedContainer 水封闭式容器,如冷却塔、水处理器
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type WaterClosedContainer struct {
|
||||
Running bool //true-正常运行;false-停止
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Running bool //true-正常运行;false-停止
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// NetworkHost 网络设备、网络主机等
|
||||
// 具体异常-故障、通信中断
|
||||
type NetworkHost struct {
|
||||
State HostState //状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、通信中断
|
||||
State HostState //状态
|
||||
}
|
||||
|
||||
// HostState 主机状态定义
|
||||
@ -22,6 +21,7 @@ const (
|
||||
///////////////////////////////
|
||||
|
||||
// SmokeDetector 烟感
|
||||
// 具体异常-故障、通信中断
|
||||
//
|
||||
// 隔离模块可以防止其他设备的故障或干扰对烟感系统的正常运行产生影响;
|
||||
// 当消防主机外部设备(探测器、模块或火灾显示盘)发生故障时,可将它隔离掉,待修理或更换后,再利用取消隔离功能将设备恢复
|
||||
@ -30,9 +30,8 @@ const (
|
||||
//
|
||||
// 输出模块可以控制其他设备(如声光报警器、喷淋系统等)的操作,以及向其他系统发送报警信息
|
||||
type SmokeDetector struct {
|
||||
State StaState //烟感状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、通信中断
|
||||
Density uint16 //烟感周围烟气浓度,1=0.01%;一般为0.15-0.3%时会触发警报
|
||||
State StaState //烟感状态
|
||||
Density uint16 //烟感周围烟气浓度,1=0.01%;一般为0.15-0.3%时会触发警报
|
||||
}
|
||||
|
||||
// StaState 烟感或温感状态
|
||||
@ -48,15 +47,16 @@ const (
|
||||
/////////////////////////////////////
|
||||
|
||||
// TemperatureDetector 温感
|
||||
// 具体异常-故障、通信中断
|
||||
type TemperatureDetector struct {
|
||||
State StaState //温感动作
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、通信中断
|
||||
Temperature int16 //温感周围温度,1=1摄氏度
|
||||
State StaState //温感动作
|
||||
Temperature int16 //温感周围温度,1=1摄氏度
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
|
||||
// ManualFireAlarmButton 手动火灾报警按钮
|
||||
// 具体异常-故障、通信中断
|
||||
// 报警按钮有红色报警确认灯,报警按钮启动零件动作,报警确认灯点亮,并保持至报警状态被复位。
|
||||
// 报警按钮形状有方形和长方形,颜色为红色(正常工作状态为闪烁状态,如果不闪烁说明设备损坏;如场所内所有设备都不亮说明消防系统被停用
|
||||
//
|
||||
@ -65,9 +65,8 @@ type TemperatureDetector struct {
|
||||
//
|
||||
// 报警后,如控制器在自动工作状态,声光报警器、消防广播、防火卷帘、防排烟系统等设备会动作,非消防电梯停止运行,切断该区域非消防用电……因此,非警勿动;
|
||||
type ManualFireAlarmButton struct {
|
||||
State MfabState //手动火灾报警按钮状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、通信中断
|
||||
Pressed bool //按钮按下
|
||||
State MfabState //手动火灾报警按钮状态
|
||||
Pressed bool //按钮按下
|
||||
}
|
||||
|
||||
// MfabState 手动火灾报警按钮状态
|
||||
@ -83,11 +82,11 @@ const (
|
||||
/////////////////////////////////////
|
||||
|
||||
// GasFireExtinguisher 气体灭火
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type GasFireExtinguisher struct {
|
||||
State GfeState //气体灭火器状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Release bool //true-气体释放
|
||||
Auto bool //true-自动;false-手动
|
||||
State GfeState //气体灭火器状态
|
||||
Release bool //true-气体释放
|
||||
Auto bool //true-自动;false-手动
|
||||
}
|
||||
|
||||
// GfeState 气体灭火器状态
|
||||
@ -103,9 +102,9 @@ const (
|
||||
////////////////////////////////////////
|
||||
|
||||
// AlarmBell 警铃
|
||||
// 具体异常-模块故障、异常、通信中断
|
||||
type AlarmBell struct {
|
||||
State AbState //警铃状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-模块故障、异常、通信中断
|
||||
State AbState //警铃状态
|
||||
}
|
||||
|
||||
// AbState 警铃状态
|
||||
@ -120,9 +119,9 @@ const (
|
||||
////////////////////////////////////////
|
||||
|
||||
// FireRollerShutter 防火卷帘(隔断型防火卷帘、疏散型防火卷帘)
|
||||
// 具体异常-异常、通信中断
|
||||
type FireRollerShutter struct {
|
||||
State FrsState //防火卷帘状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-异常、通信中断
|
||||
State FrsState //防火卷帘状态
|
||||
}
|
||||
|
||||
// FrsState 防火卷帘状态
|
||||
@ -138,80 +137,80 @@ const (
|
||||
/////////////////////////////////////////
|
||||
|
||||
// FasAcs 火警ACS联动
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type FasAcs struct {
|
||||
Normal bool //true-正常
|
||||
Release bool //true-紧急释放
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Normal bool //true-正常
|
||||
Release bool //true-紧急释放
|
||||
}
|
||||
|
||||
// FasAfc 火警AFC联动
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type FasAfc struct {
|
||||
Normal bool //true-正常
|
||||
Release bool //true-紧急释放
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Normal bool //true-正常
|
||||
Release bool //true-紧急释放
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
// NonFirePowerSource 非消防电源
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type NonFirePowerSource struct {
|
||||
Normal bool //true-正常
|
||||
TurnOff bool //true-切除,关闭非消防电源,防止在救火时触电或漏电引起二次事故
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Normal bool //true-正常
|
||||
TurnOff bool //true-切除,关闭非消防电源,防止在救火时触电或漏电引起二次事故
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
|
||||
// WaterFlowIndicator 水流指示器
|
||||
// 具体异常-故障、异常、通信中断
|
||||
//
|
||||
// 水流指示器是用于自动喷水灭火系统中将水流信号转换成电信号的一种水流报警装置。水流指示器的作用是能够及时报告火灾发生的部位。
|
||||
type WaterFlowIndicator struct {
|
||||
Normal bool //true-正常
|
||||
Flowing bool //true-发出有水流动信号,表示某处有火灾
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Normal bool //true-正常
|
||||
Flowing bool //true-发出有水流动信号,表示某处有火灾
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
|
||||
// PumpStartButton 启泵按钮
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type PumpStartButton struct {
|
||||
Normal bool //true-正常
|
||||
Pressed bool //true-动作,按钮按下
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Normal bool //true-正常
|
||||
Pressed bool //true-动作,按钮按下
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
// TemperatureSensingCable 感温电缆
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type TemperatureSensingCable struct {
|
||||
State FdState //正常、火警故障
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
State FdState //正常、火警故障
|
||||
}
|
||||
|
||||
// ElevatorToOriginalPosModule 电梯归首功能模块
|
||||
// 具体异常-故障、异常、通信中断
|
||||
//
|
||||
// 1、一般电梯应有的消防功能。归首的意思是指回归首层。2、该功能也就是说电梯在上行过程中,如果一旦触发了消防开关,电梯就立即返回基站(也就是归首层)
|
||||
type ElevatorToOriginalPosModule struct {
|
||||
State FdState //正常、火警故障
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
State FdState //正常、火警故障
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
// FireDamper 防火阀
|
||||
// 具体异常-故障、异常、通信中断
|
||||
//
|
||||
// 当烟气温度达到280℃时,人已基本疏散完毕,排烟已无实际意义,而烟气中此时已带火,阀门自动关闭,以避免火势蔓延
|
||||
type FireDamper struct {
|
||||
State FdState //正常、隔离、火警故障
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Closed bool //true-防火阀关闭;false-防火阀打开(常态)
|
||||
State FdState //正常、隔离、火警故障
|
||||
Closed bool //true-防火阀关闭;false-防火阀打开(常态)
|
||||
}
|
||||
|
||||
// ElectricSmokeFireDamper 电动防烟防火阀
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type ElectricSmokeFireDamper struct {
|
||||
State FdState //正常、火警故障
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
Closed bool //true-防火阀关闭;false-防火阀打开(常态)
|
||||
State FdState //正常、火警故障
|
||||
Closed bool //true-防火阀关闭;false-防火阀打开(常态)
|
||||
}
|
||||
|
||||
// FdState 防火阀状态定义
|
||||
@ -226,9 +225,9 @@ const (
|
||||
////////////////////////////////////////////
|
||||
|
||||
// FireInterconnectionSignal 火灾互联互通信号
|
||||
// 具体异常-故障、异常、通信中断
|
||||
type FireInterconnectionSignal struct {
|
||||
State FdState //正常、火警故障
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、异常、通信中断
|
||||
State FdState //正常、火警故障
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
|
@ -2,22 +2,21 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
//ISCS 电力系统相关组件定义
|
||||
|
||||
// CircuitBreaker 电路断路器
|
||||
// 具体异常-通信中断
|
||||
type CircuitBreaker struct {
|
||||
Closed bool //true-合闸;false-分闸
|
||||
Exception consts.DeviceExceptionEnum //具体异常-通信中断
|
||||
Closed bool //true-合闸;false-分闸
|
||||
}
|
||||
|
||||
// ThreePositionSwitch 三工位开关
|
||||
// 对于三工位隔离开关,规定:ClosedPosition1-合闸到工作位,ClosedPosition2-合闸到接地位
|
||||
// 具体异常-异常、通信中断
|
||||
type ThreePositionSwitch struct {
|
||||
Position SwitchThreePosition //合闸到位置1,与位置1线路导通;合闸到位置2,与位置2线路导通;分闸,线路断开,未与任何位置接通
|
||||
Exception consts.DeviceExceptionEnum //具体异常-异常、通信中断
|
||||
Position SwitchThreePosition //合闸到位置1,与位置1线路导通;合闸到位置2,与位置2线路导通;分闸,线路断开,未与任何位置接通
|
||||
}
|
||||
|
||||
// SwitchThreePosition 三工位开关位置定义
|
||||
@ -32,9 +31,9 @@ const (
|
||||
/////////////////////////
|
||||
|
||||
// HandcartSwitch 手车式开关
|
||||
// 具体异常-通信中断
|
||||
type HandcartSwitch struct {
|
||||
Position HandcarPosition
|
||||
Exception consts.DeviceExceptionEnum //具体异常-通信中断
|
||||
Position HandcarPosition
|
||||
}
|
||||
|
||||
// HandcarPosition 手车式开关位置定义
|
||||
@ -49,23 +48,23 @@ const (
|
||||
////////////////////
|
||||
|
||||
// Rectifier 整流器
|
||||
// 具体异常-故障、报警、通信中断
|
||||
type Rectifier struct {
|
||||
Normal bool //true-正常
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、报警、通信中断
|
||||
InputAcV uint32 //输入交流电压
|
||||
OutputDcV uint32 //输出直流电压
|
||||
Normal bool //true-正常
|
||||
InputAcV uint32 //输入交流电压
|
||||
OutputDcV uint32 //输出直流电压
|
||||
}
|
||||
|
||||
// Disconnector 隔离开关
|
||||
// 具体异常-异常、通信中断
|
||||
type Disconnector struct {
|
||||
Closed bool //true-合闸;false-分闸
|
||||
Exception consts.DeviceExceptionEnum //具体异常-异常、通信中断
|
||||
Closed bool //true-合闸;false-分闸
|
||||
}
|
||||
|
||||
// WireCabinet 线柜
|
||||
// 具体异常-故障、报警、异常、通信中断
|
||||
type WireCabinet struct {
|
||||
Normal bool //true-正常
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、报警、异常、通信中断
|
||||
Normal bool //true-正常
|
||||
}
|
||||
|
||||
// LightningArrester 避雷器
|
||||
@ -77,17 +76,14 @@ type LightningArrester struct {
|
||||
//
|
||||
// 35KV 1#和2#进线连接的国家电网可以视作电压源,为整个一次图中最终电的来源
|
||||
type AbcVoltageSource struct {
|
||||
Ua uint32 //A相电压,单位V
|
||||
Ub uint32 //B相电压,单位V
|
||||
Uc uint32 //C相电压,单位V
|
||||
}
|
||||
|
||||
// VoltageTransformer 变压器
|
||||
// 具体异常-故障、报警、通信中断
|
||||
type VoltageTransformer struct {
|
||||
Normal bool //true-正常
|
||||
Exception consts.DeviceExceptionEnum //具体异常-故障、报警、通信中断
|
||||
InputV uint32 //输入电压值,单位V
|
||||
OutputV uint32 //输出电压值,单位V
|
||||
Normal bool //true-正常
|
||||
InputV uint32 //输入电压值,单位V
|
||||
OutputV uint32 //输出电压值,单位V
|
||||
}
|
||||
|
||||
// VoltageABTransmission 电压传递,从A传递到B,如断路器闭合时,电压会从断路器一端传递到另一端
|
||||
|
@ -2,13 +2,12 @@ package component
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// TFDSHost TFDS主机-与感温光纤有关状态
|
||||
// 具体异常-异常、通信中断
|
||||
type TFDSHost struct {
|
||||
State TofState //一整条感温光纤状态
|
||||
Exception consts.DeviceExceptionEnum //具体异常-异常、通信中断
|
||||
State TofState //一整条感温光纤状态
|
||||
}
|
||||
|
||||
// TofState 一整条感温光纤状态定义
|
||||
@ -23,11 +22,11 @@ const (
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
// TofCheckPoint 分布式感温光纤上的温度检测点
|
||||
// 具体异常-通信中断
|
||||
// 实际上感温光纤上的每个点都可以传回温度,工程上选取每隔一段距离的来检测温度
|
||||
type TofCheckPoint struct {
|
||||
T int16 //检测点温度
|
||||
State TofcpState //状态,通过检测点温度计算得到
|
||||
Exception consts.DeviceExceptionEnum //具体异常-通信中断
|
||||
T int16 //检测点温度
|
||||
State TofcpState //状态,通过检测点温度计算得到
|
||||
}
|
||||
|
||||
// TofcpState 感温关系检测点状态定义
|
||||
|
@ -12,3 +12,14 @@ const (
|
||||
DeviceStartTimeout //启动超时
|
||||
DeviceModuleFault //模块故障
|
||||
)
|
||||
|
||||
// DevicePlacingEnum 设备置牌枚举定义
|
||||
type DevicePlacingEnum = int8
|
||||
|
||||
const (
|
||||
DevicePlacingNon DevicePlacingEnum = iota
|
||||
DevicePlacingOverhaulCard //设备置牌:检修
|
||||
DevicePlacingLandingCard //设备置牌:接地
|
||||
DevicePlacingHand //设备置牌:就地(手型牌)
|
||||
DevicePlacingOtherCard //设备置牌:其他
|
||||
)
|
116
fi/iscs.go
Normal file
116
fi/iscs.go
Normal file
@ -0,0 +1,116 @@
|
||||
package fi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
)
|
||||
|
||||
// PlacingCardOptEnum 设备置牌操作枚举定义
|
||||
type PlacingCardOptEnum = uint8
|
||||
|
||||
// 设备置牌操作枚举定义
|
||||
const (
|
||||
PlacingNonCard PlacingCardOptEnum = iota
|
||||
PlacingOverhaulCard
|
||||
PlacingLandingCard
|
||||
PlacingHandCard
|
||||
PlacingOtherCard
|
||||
)
|
||||
|
||||
// DevicePlacingCardOperate 设备置牌操作
|
||||
func DevicePlacingCardOperate(w ecs.World, deviceId string, placingCard PlacingCardOptEnum) 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))
|
||||
}
|
||||
clearAllPlacingTags := func(deviceEntry *ecs.Entry) {
|
||||
deviceEntry.RemoveComponent(component.DevicePlacingLandingCardTag)
|
||||
deviceEntry.RemoveComponent(component.DevicePlacingOverhaulCardTag)
|
||||
deviceEntry.RemoveComponent(component.DevicePlacingOtherCardTag)
|
||||
deviceEntry.RemoveComponent(component.DevicePlacingHandTag)
|
||||
}
|
||||
switch placingCard {
|
||||
case PlacingLandingCard:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DevicePlacingLandingCardTag)
|
||||
case PlacingOverhaulCard:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DevicePlacingOverhaulCardTag)
|
||||
case PlacingOtherCard:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DevicePlacingOtherCardTag)
|
||||
case PlacingHandCard:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DevicePlacingHandTag)
|
||||
default:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
}
|
||||
//
|
||||
return ecs.NewOkEmptyResult()
|
||||
})
|
||||
return r.Err
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// DeviceExceptionOptEnum 设备例外操作枚举定义
|
||||
type DeviceExceptionOptEnum = uint8
|
||||
|
||||
const (
|
||||
DeviceExceptionNon DeviceExceptionOptEnum = iota //无例外
|
||||
DeviceExceptionCommunicationInterrupt //通信中断
|
||||
DeviceExceptionAbnormal //异常
|
||||
DeviceExceptionFault //故障 有预告信号产生
|
||||
DeviceExceptionAlarm //报警 有事故信号产生
|
||||
DeviceExceptionStartTimeout //启动超时
|
||||
DeviceExceptionModuleFault //模块故障
|
||||
)
|
||||
|
||||
// DeviceExceptionOperate 设备例外操作
|
||||
func DeviceExceptionOperate(w ecs.World, deviceId string, opt DeviceExceptionOptEnum) 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))
|
||||
}
|
||||
clearAllExceptions := func(deviceEntry *ecs.Entry) {
|
||||
deviceEntry.RemoveComponent(component.DeviceCommunicationInterruptTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceAbnormalTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceFaultTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceAlarmTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceStartTimeoutTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceModuleFaultTag)
|
||||
}
|
||||
//
|
||||
switch opt {
|
||||
case DeviceExceptionCommunicationInterrupt:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceCommunicationInterruptTag)
|
||||
case DeviceExceptionAlarm:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceAlarmTag)
|
||||
case DeviceExceptionAbnormal:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceAbnormalTag)
|
||||
case DeviceExceptionFault:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceFaultTag)
|
||||
case DeviceExceptionStartTimeout:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceStartTimeoutTag)
|
||||
case DeviceExceptionModuleFault:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceModuleFaultTag)
|
||||
default:
|
||||
clearAllExceptions(deviceEntry)
|
||||
}
|
||||
//
|
||||
return ecs.NewOkEmptyResult()
|
||||
})
|
||||
return r.Err
|
||||
}
|
@ -383,12 +383,13 @@ func emergencyLightingOperate(w ecs.World, deviceId string, opt component.Emerge
|
||||
if !(deviceEntry.HasComponent(component.EmergencyLightingType)) {
|
||||
return ecs.NewErrResult(fmt.Errorf("设备[%s]不是应急照明", deviceId))
|
||||
}
|
||||
el := component.EmergencyLightingType.Get(deviceEntry)
|
||||
if el.Exception != consts.DeviceExceptionNon {
|
||||
de := component.DeviceExceptionType.Get(deviceEntry)
|
||||
if de.Exception != consts.DeviceExceptionNon {
|
||||
return ecs.NewErrResult(fmt.Errorf("应急照明[%s]有故障,不能设置工作模式", deviceId))
|
||||
}
|
||||
//
|
||||
el.Mode = opt
|
||||
device := component.EmergencyLightingType.Get(deviceEntry)
|
||||
device.Mode = opt
|
||||
//
|
||||
return ecs.NewOkEmptyResult()
|
||||
})
|
||||
@ -422,12 +423,13 @@ func AirCurtainOperate(w ecs.World, deviceId string, optRun bool) error {
|
||||
if !(deviceEntry.HasComponent(component.AirCurtainType)) {
|
||||
return ecs.NewErrResult(fmt.Errorf("设备[%s]不是空气幕", deviceId))
|
||||
}
|
||||
ac := component.AirCurtainType.Get(deviceEntry)
|
||||
if optRun && ac.Exception != consts.DeviceExceptionNon {
|
||||
device := component.AirCurtainType.Get(deviceEntry)
|
||||
de := component.DeviceExceptionType.Get(deviceEntry)
|
||||
if optRun && de.Exception != consts.DeviceExceptionNon {
|
||||
return ecs.NewErrResult(fmt.Errorf("空气幕[%s]有故障,不能开启", deviceId))
|
||||
}
|
||||
//
|
||||
ac.Running = optRun
|
||||
device.Running = optRun
|
||||
//
|
||||
return ecs.NewOkEmptyResult()
|
||||
})
|
||||
|
@ -7,56 +7,6 @@ import (
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
)
|
||||
|
||||
// PlacingCardOptEnum 设备置牌操作枚举定义
|
||||
type PlacingCardOptEnum = uint8
|
||||
|
||||
// 设备置牌操作枚举定义
|
||||
const (
|
||||
PlacingNonCard PlacingCardOptEnum = iota
|
||||
PlacingOverhaulCard
|
||||
PlacingLandingCard
|
||||
PlacingHandCard
|
||||
PlacingOtherCard
|
||||
)
|
||||
|
||||
// DevicePlacingCardOperate 设备置牌操作
|
||||
func DevicePlacingCardOperate(w ecs.World, deviceId string, placingCard PlacingCardOptEnum) 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))
|
||||
}
|
||||
clearAllPlacingTags := func(deviceEntry *ecs.Entry) {
|
||||
deviceEntry.RemoveComponent(component.DevicePlacingLandingCardTag)
|
||||
deviceEntry.RemoveComponent(component.DevicePlacingOverhaulCardTag)
|
||||
deviceEntry.RemoveComponent(component.DevicePlacingOtherCardTag)
|
||||
deviceEntry.RemoveComponent(component.DevicePlacingHandTag)
|
||||
}
|
||||
switch placingCard {
|
||||
case PlacingLandingCard:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DevicePlacingLandingCardTag)
|
||||
case PlacingOverhaulCard:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DevicePlacingOverhaulCardTag)
|
||||
case PlacingOtherCard:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DevicePlacingOtherCardTag)
|
||||
case PlacingHandCard:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DevicePlacingHandTag)
|
||||
default:
|
||||
clearAllPlacingTags(deviceEntry)
|
||||
}
|
||||
//
|
||||
return ecs.NewOkEmptyResult()
|
||||
})
|
||||
return r.Err
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
// TransBusbarBackupOperate 母线备自投投入操作
|
||||
func TransBusbarBackupOperate(w ecs.World, deviceId string, input bool) error {
|
||||
r := <-ecs.Request[ecs.EmptyType](w, func() ecs.Result[ecs.EmptyType] {
|
||||
@ -82,66 +32,6 @@ func TransBusbarBackupOperate(w ecs.World, deviceId string, input bool) error {
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// DeviceExceptionOptEnum 设备例外操作枚举定义
|
||||
type DeviceExceptionOptEnum = uint8
|
||||
|
||||
const (
|
||||
DeviceExceptionNon DeviceExceptionOptEnum = iota //无例外
|
||||
DeviceExceptionCommunicationInterrupt //通信中断
|
||||
DeviceExceptionAbnormal //异常
|
||||
DeviceExceptionFault //故障 有预告信号产生
|
||||
DeviceExceptionAlarm //报警 有事故信号产生
|
||||
DeviceExceptionStartTimeout //启动超时
|
||||
DeviceExceptionModuleFault //模块故障
|
||||
)
|
||||
|
||||
// DeviceExceptionOperate 设备例外操作
|
||||
func DeviceExceptionOperate(w ecs.World, deviceId string, opt DeviceExceptionOptEnum) 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))
|
||||
}
|
||||
clearAllExceptions := func(deviceEntry *ecs.Entry) {
|
||||
deviceEntry.RemoveComponent(component.DeviceCommunicationInterruptTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceAbnormalTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceFaultTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceAlarmTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceStartTimeoutTag)
|
||||
deviceEntry.RemoveComponent(component.DeviceModuleFaultTag)
|
||||
}
|
||||
//
|
||||
switch opt {
|
||||
case DeviceExceptionCommunicationInterrupt:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceCommunicationInterruptTag)
|
||||
case DeviceExceptionAlarm:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceAlarmTag)
|
||||
case DeviceExceptionAbnormal:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceAbnormalTag)
|
||||
case DeviceExceptionFault:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceFaultTag)
|
||||
case DeviceExceptionStartTimeout:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceStartTimeoutTag)
|
||||
case DeviceExceptionModuleFault:
|
||||
clearAllExceptions(deviceEntry)
|
||||
deviceEntry.AddComponent(component.DeviceModuleFaultTag)
|
||||
default:
|
||||
clearAllExceptions(deviceEntry)
|
||||
}
|
||||
//
|
||||
return ecs.NewOkEmptyResult()
|
||||
})
|
||||
return r.Err
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
// SwitchThreePositionOptEnum 三工位开关操作枚举定义
|
||||
type SwitchThreePositionOptEnum = uint8
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// AirCurtainSystem 空气幕
|
||||
type AirCurtainSystem struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewAirCurtainSystem() *AirCurtainSystem {
|
||||
return &AirCurtainSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.AirCurtainType)),
|
||||
}
|
||||
}
|
||||
func (s *AirCurtainSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
ac := component.AirCurtainType.Get(entry)
|
||||
//
|
||||
ac.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
ac.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAlarmTag) {
|
||||
ac.Exception = consts.DeviceAlarm
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
ac.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
ac.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
//异常停止运行
|
||||
if ac.Exception != consts.DeviceExceptionNon {
|
||||
ac.Running = false
|
||||
}
|
||||
})
|
||||
}
|
@ -14,26 +14,15 @@ type ChillerUnitSystem struct {
|
||||
|
||||
func NewChillerUnitSystem() *ChillerUnitSystem {
|
||||
return &ChillerUnitSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.ChillerUnitType)),
|
||||
query: ecs.NewQuery(filter.Contains(component.ChillerUnitType, component.DeviceExceptionType)),
|
||||
}
|
||||
}
|
||||
func (s *ChillerUnitSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
device := component.ChillerUnitType.Get(entry)
|
||||
//
|
||||
device.Exception = consts.DeviceExceptionNon
|
||||
//
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
device.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
device.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
device.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
de := component.DeviceExceptionType.Get(entry)
|
||||
//异常停止运行
|
||||
if device.Exception != consts.DeviceExceptionNon {
|
||||
if de.Exception != consts.DeviceExceptionNon {
|
||||
device.Running = false
|
||||
}
|
||||
|
||||
|
@ -1,37 +0,0 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
type IscsDoorSystem struct {
|
||||
queryCivilDefenseDoor *ecs.Query
|
||||
}
|
||||
|
||||
func NewIscsDoorSystem() *IscsDoorSystem {
|
||||
return &IscsDoorSystem{
|
||||
queryCivilDefenseDoor: ecs.NewQuery(filter.Contains(component.CivilDefenseDoorType)),
|
||||
}
|
||||
}
|
||||
func (s *IscsDoorSystem) Update(w ecs.World) {
|
||||
s.queryCivilDefenseDoor.Each(w, func(entry *ecs.Entry) {
|
||||
door := component.CivilDefenseDoorType.Get(entry)
|
||||
//
|
||||
door.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
door.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAlarmTag) {
|
||||
door.Exception = consts.DeviceAlarm
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
door.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
door.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
})
|
||||
}
|
@ -26,15 +26,5 @@ func (s *ElectricControlValveSystem) Update(w ecs.World) {
|
||||
valve.Opened = tps.Pos >= consts.TwoPosMax
|
||||
valve.Closed = tps.Pos <= consts.TwoPosMin
|
||||
valve.OpenRate = uint8(tps.Percentage() * 100) //xxx%
|
||||
valve.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
valve.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
valve.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
valve.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// ElevatorSystem 电梯(自动扶梯、垂直电梯)
|
||||
type ElevatorSystem struct {
|
||||
queryElevator *ecs.Query //垂直电梯
|
||||
queryEscalator *ecs.Query //自动扶梯
|
||||
}
|
||||
|
||||
func NewElevatorSystem() *ElevatorSystem {
|
||||
return &ElevatorSystem{
|
||||
queryElevator: ecs.NewQuery(filter.Contains(component.ElevatorType)),
|
||||
queryEscalator: ecs.NewQuery(filter.Contains(component.EscalatorType)),
|
||||
}
|
||||
}
|
||||
func (s *ElevatorSystem) Update(w ecs.World) {
|
||||
s.queryElevator.Each(w, func(entry *ecs.Entry) {
|
||||
elevator := component.ElevatorType.Get(entry)
|
||||
elevator.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
elevator.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
elevator.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
elevator.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
})
|
||||
//
|
||||
s.queryElevator.Each(w, func(entry *ecs.Entry) {
|
||||
escalator := component.EscalatorType.Get(entry)
|
||||
if escalator.EmergencyStop { //急停
|
||||
escalator.Running = 0
|
||||
}
|
||||
escalator.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
escalator.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
escalator.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
escalator.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
})
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// EmergencyLightingSystem 应急照明
|
||||
type EmergencyLightingSystem struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewEmergencyLightingSystem() *EmergencyLightingSystem {
|
||||
return &EmergencyLightingSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.EmergencyLightingType)),
|
||||
}
|
||||
}
|
||||
func (s *EmergencyLightingSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
el := component.EmergencyLightingType.Get(entry)
|
||||
//
|
||||
el.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
el.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
el.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
el.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
//
|
||||
if el.Exception != consts.DeviceExceptionNon {
|
||||
el.Mode = component.ElmNon
|
||||
} else {
|
||||
//当应急照明异常解除后,自动恢复到正常模式
|
||||
if el.Mode == component.ElmNon {
|
||||
el.Mode = component.ElmAuto
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
@ -4,7 +4,6 @@ import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// BasFanSystem ISCS BAS 风机
|
||||
@ -29,16 +28,5 @@ func (s *BasFanSystem) Update(w ecs.World) {
|
||||
fanState.SoftStart = fan.SoftStart
|
||||
fanState.HighSpeed = fanState.Running && entry.HasComponent(component.HighSpeedModeFanTag)
|
||||
fanState.SlowSpeed = fanState.Running && entry.HasComponent(component.LowSpeedModeFanTag)
|
||||
fanState.Hand = entry.HasComponent(component.HandTag)
|
||||
//
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
fanState.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
fanState.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
fanState.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
type NetworkSystem struct {
|
||||
queryNetworkSwitch *ecs.Query
|
||||
}
|
||||
|
||||
func NewNetworkSystem() *NetworkSystem {
|
||||
|
||||
return &NetworkSystem{
|
||||
queryNetworkSwitch: ecs.NewQuery(filter.Contains(component.NetworkSwitchType)),
|
||||
}
|
||||
}
|
||||
func (s *NetworkSystem) Update(w ecs.World) {
|
||||
s.queryNetworkSwitch.Each(w, func(entry *ecs.Entry) {
|
||||
ns := component.NetworkSwitchType.Get(entry)
|
||||
//
|
||||
ns.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
ns.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
ns.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
//正常
|
||||
ns.Normal = ns.Exception == consts.DeviceExceptionNon
|
||||
})
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
type PlcControllerSystem struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewPlcControllerSystem() *PlcControllerSystem {
|
||||
return &PlcControllerSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.PlcControllerType)),
|
||||
}
|
||||
}
|
||||
func (s *PlcControllerSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
plc := component.PlcControllerType.Get(entry)
|
||||
//
|
||||
plc.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
plc.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
plc.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
plc.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
//正常
|
||||
plc.Normal = plc.Exception == consts.DeviceExceptionNon
|
||||
})
|
||||
}
|
@ -4,7 +4,6 @@ import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// PurificationDeviceSystem 净化装置
|
||||
@ -33,16 +32,5 @@ func (s *PurificationDeviceSystem) Update(w ecs.World) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
pd.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceStartTimeoutTag) {
|
||||
pd.Exception = consts.DeviceStartTimeout
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
pd.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
pd.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// WaterClosedContainerSystem 封闭冷却塔、水处理器
|
||||
type WaterClosedContainerSystem struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewWaterClosedContainerSystem() *WaterClosedContainerSystem {
|
||||
return &WaterClosedContainerSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.WaterClosedContainerType)),
|
||||
}
|
||||
}
|
||||
func (s *WaterClosedContainerSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
container := component.WaterClosedContainerType.Get(entry)
|
||||
//
|
||||
container.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
container.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
container.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
container.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
//异常停止运行
|
||||
if container.Exception != consts.DeviceExceptionNon {
|
||||
container.Running = false
|
||||
}
|
||||
})
|
||||
}
|
@ -16,7 +16,7 @@ type WaterPumpSystem struct {
|
||||
|
||||
func NewWaterPumpSystem() *WaterPumpSystem {
|
||||
return &WaterPumpSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.WaterPumpType)),
|
||||
query: ecs.NewQuery(filter.Contains(component.WaterPumpType, component.DeviceExceptionType)),
|
||||
}
|
||||
}
|
||||
func (s *WaterPumpSystem) Update(w ecs.World) {
|
||||
@ -28,18 +28,9 @@ func (s *WaterPumpSystem) Update(w ecs.World) {
|
||||
pump.Running = fbs.On
|
||||
}
|
||||
//
|
||||
pump.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
pump.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
pump.Exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
pump.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
de := component.DeviceExceptionType.Get(entry)
|
||||
//异常停止运行
|
||||
if pump.Exception != consts.DeviceExceptionNon {
|
||||
if de.Exception != consts.DeviceExceptionNon {
|
||||
pump.Running = false
|
||||
}
|
||||
})
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// WaterTankSystem 水池水箱
|
||||
@ -23,11 +22,6 @@ func (s *WaterTankSystem) Update(w ecs.World) {
|
||||
waterTank := component.WaterTankType.Get(entry)
|
||||
waterTank.Level = s.calculateWaterLevel(w, waterTankId, waterTank.Value)
|
||||
//
|
||||
waterTank.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
waterTank.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
//
|
||||
waterPumps := s.findWaterPumps(w, waterTankId)
|
||||
for _, waterPump := range waterPumps {
|
||||
//浮球型水泵,通过水箱水位等级来控制浮球开关从而控制水泵开关
|
||||
|
48
sys/iscs_sys/iscs_exception.go
Normal file
48
sys/iscs_sys/iscs_exception.go
Normal file
@ -0,0 +1,48 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// IscsExceptionSystem 设备故障异常等例外处理
|
||||
type IscsExceptionSystem struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewIscsExceptionSystem() *IscsExceptionSystem {
|
||||
return &IscsExceptionSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.DeviceExceptionType)),
|
||||
}
|
||||
}
|
||||
func (s *IscsExceptionSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
device := component.DeviceExceptionType.Get(entry)
|
||||
//
|
||||
exception := consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAlarmTag) {
|
||||
exception = consts.DeviceAlarm
|
||||
}
|
||||
if entry.HasComponent(component.DeviceStartTimeoutTag) {
|
||||
exception = consts.DeviceStartTimeout
|
||||
}
|
||||
if entry.HasComponent(component.DeviceModuleFaultTag) {
|
||||
exception = consts.DeviceModuleFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceAbnormalTag) {
|
||||
exception = consts.DeviceAbnormal
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
//
|
||||
if device.Exception != exception {
|
||||
device.Exception = exception
|
||||
}
|
||||
})
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// NetworkHostSystem 网络设备、网络主机等
|
||||
type NetworkHostSystem struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewNetworkHostSystem() *NetworkHostSystem {
|
||||
return &NetworkHostSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.NetworkHostType)),
|
||||
}
|
||||
}
|
||||
func (s *NetworkHostSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
host := component.NetworkHostType.Get(entry)
|
||||
//
|
||||
host.Exception = consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
host.Exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
host.Exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
//
|
||||
host.Normal = host.Exception == consts.DeviceExceptionNon
|
||||
})
|
||||
}
|
@ -22,23 +22,15 @@ type ManualFireAlarmButtonSystem struct {
|
||||
|
||||
func NewManualFireAlarmButtonSystem() *ManualFireAlarmButtonSystem {
|
||||
return &ManualFireAlarmButtonSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.UidType, component.ManualFireAlarmButtonType)),
|
||||
query: ecs.NewQuery(filter.Contains(component.UidType, component.ManualFireAlarmButtonType, component.DeviceExceptionType)),
|
||||
}
|
||||
}
|
||||
func (s *ManualFireAlarmButtonSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
button := component.ManualFireAlarmButtonType.Get(entry)
|
||||
//故障、通信中断
|
||||
exception := consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
button.Exception = exception
|
||||
de := component.DeviceExceptionType.Get(entry)
|
||||
//没有异常且没有被按下且没有被隔离,此时按钮处于正常状态
|
||||
if button.Exception == consts.DeviceExceptionNon && !button.Pressed && button.State == component.MfabNon {
|
||||
if de.Exception == consts.DeviceExceptionNon && !button.Pressed && button.State == component.MfabNon {
|
||||
button.State = component.MfabNormal
|
||||
}
|
||||
//如果按钮处于正常工作状态且被按下,则向火灾报警控制器发送火警信号
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// SmokeDetectorSystem 烟感
|
||||
@ -26,15 +25,6 @@ func (s *SmokeDetectorSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
detector := component.SmokeDetectorType.Get(entry)
|
||||
detectorId := component.UidType.Get(entry).Id
|
||||
//例外处理
|
||||
exception := consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
detector.Exception = exception
|
||||
//烟感探测所在环境
|
||||
detector.Density = s.detectSmoke(w, detectorId)
|
||||
if detector.State != component.StaIsolate {
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// TemperatureDetectorSystem 温感
|
||||
@ -26,15 +25,6 @@ func (s *TemperatureDetectorSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
detector := component.TemperatureDetectorType.Get(entry)
|
||||
detectorId := component.UidType.Get(entry).Id
|
||||
//例外处理
|
||||
exception := consts.DeviceExceptionNon
|
||||
if entry.HasComponent(component.DeviceFaultTag) {
|
||||
exception = consts.DeviceFault
|
||||
}
|
||||
if entry.HasComponent(component.DeviceCommunicationInterruptTag) {
|
||||
exception = consts.DeviceCommunicationInterrupt
|
||||
}
|
||||
detector.Exception = exception
|
||||
//温感探测所在环境
|
||||
temperature := s.detectTemperature(w, detectorId)
|
||||
if detector.State != component.StaIsolate {
|
||||
|
42
sys/iscs_sys/iscs_placing.go
Normal file
42
sys/iscs_sys/iscs_placing.go
Normal file
@ -0,0 +1,42 @@
|
||||
package iscs_sys
|
||||
|
||||
import (
|
||||
"joylink.club/ecs"
|
||||
"joylink.club/ecs/filter"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/consts"
|
||||
)
|
||||
|
||||
// DevicePlacingSystem 设备置牌
|
||||
type DevicePlacingSystem struct {
|
||||
query *ecs.Query
|
||||
}
|
||||
|
||||
func NewDevicePlacingSystem() *DevicePlacingSystem {
|
||||
return &DevicePlacingSystem{
|
||||
query: ecs.NewQuery(filter.Contains(component.DevicePlacingType)),
|
||||
}
|
||||
}
|
||||
func (s *DevicePlacingSystem) Update(w ecs.World) {
|
||||
s.query.Each(w, func(entry *ecs.Entry) {
|
||||
device := component.DevicePlacingType.Get(entry)
|
||||
//
|
||||
placing := consts.DevicePlacingNon
|
||||
if entry.HasComponent(component.DevicePlacingOverhaulCardTag) {
|
||||
placing = consts.DevicePlacingOverhaulCard
|
||||
}
|
||||
if entry.HasComponent(component.DevicePlacingLandingCardTag) {
|
||||
placing = consts.DevicePlacingLandingCard
|
||||
}
|
||||
if entry.HasComponent(component.DevicePlacingHandTag) {
|
||||
placing = consts.DevicePlacingHand
|
||||
}
|
||||
if entry.HasComponent(component.DevicePlacingOtherCardTag) {
|
||||
placing = consts.DevicePlacingOtherCard
|
||||
}
|
||||
//
|
||||
if device.Placing != placing {
|
||||
device.Placing = placing
|
||||
}
|
||||
})
|
||||
}
|
9
sys/iscs_sys/iscs_pscada_switch.go
Normal file
9
sys/iscs_sys/iscs_pscada_switch.go
Normal file
@ -0,0 +1,9 @@
|
||||
package iscs_sys
|
||||
|
||||
import "joylink.club/ecs"
|
||||
|
||||
// PscadaSwitchSystem ISCS 电力监控系统开关相关
|
||||
type PscadaSwitchSystem struct {
|
||||
queryCircuitBreaker *ecs.Query
|
||||
queryThreePositionSwitch *ecs.Query
|
||||
}
|
Loading…
Reference in New Issue
Block a user