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

This commit is contained in:
xzb 2023-12-12 13:23:51 +08:00
parent 495002a16a
commit c06743297f
2 changed files with 56 additions and 34 deletions

View File

@ -7,8 +7,13 @@ import (
// NewIscsFanEntity 创建风机实体 // NewIscsFanEntity 创建风机实体
func NewIscsFanEntity(w ecs.World, id string) *ecs.Entry { func NewIscsFanEntity(w ecs.World, id string) *ecs.Entry {
e := w.Entry(w.Create(component.UidType, component.FanType, component.FanStateType)) wd := GetWorldData(w)
component.UidType.SetValue(e, component.Uid{Id: id}) e, ok := wd.EntityMap[id]
if !ok {
e := w.Entry(w.Create(component.UidType, component.FanType, component.FanStateType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e return e
} }
@ -38,8 +43,13 @@ func NewCombinedAirConditioner(w ecs.World, id string) *ecs.Entry {
// NewElectricControlValve 创建电动调节阀实体 // NewElectricControlValve 创建电动调节阀实体
func NewElectricControlValve(w ecs.World, id string) *ecs.Entry { func NewElectricControlValve(w ecs.World, id string) *ecs.Entry {
e := w.Entry(w.Create(component.UidType, component.ElectricControlValveType, component.TwoPositionTransformType)) wd := GetWorldData(w)
component.UidType.SetValue(e, component.Uid{Id: id}) e, ok := wd.EntityMap[id]
if !ok {
e := w.Entry(w.Create(component.UidType, component.ElectricControlValveType, component.TwoPositionTransformType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e return e
} }

View File

@ -53,17 +53,17 @@ func NewIscsThreePositionSwitchEntity(w ecs.World, id string) *ecs.Entry {
return entry return entry
} }
// NewIscsTransBusbarEntity ISCS创建输电母线 // NewIscsTransBusbarEntity 创建输电母线实体
func NewIscsTransBusbarEntity(w ecs.World, id string, haveBackupZiTou bool) *ecs.Entry { func NewIscsTransBusbarEntity(w ecs.World, id string) *ecs.Entry {
entry := w.Entry(w.Create(component.UidType, component.TransBusbarType)) wd := GetWorldData(w)
component.UidType.SetValue(entry, component.Uid{Id: id}) e, ok := wd.EntityMap[id]
component.TransBusbarType.Set(entry, &component.TransBusbar{Vl: component.VlNon, Elec: component.EywLossing}) if !ok {
// e := w.Entry(w.Create(component.UidType, component.TransBusbarType))
if haveBackupZiTou { component.UidType.SetValue(e, component.Uid{Id: id})
entry.AddComponent(component.IscsTransBackupZiTouStateType) component.TransBusbarType.Set(e, &component.TransBusbar{Vl: component.VlNon, Elec: component.EywLossing})
wd.EntityMap[id] = e
} }
// return e
return entry
} }
///////////////////////////////////////////通用///////////////////////////////////////////////////////// ///////////////////////////////////////////通用/////////////////////////////////////////////////////////
@ -72,17 +72,27 @@ func NewIscsTransBusbarEntity(w ecs.World, id string, haveBackupZiTou bool) *ecs
// 如断路器 // 如断路器
// 如PT、负极柜隔离开关、轨电位、上网隔离开关、隔离开关 // 如PT、负极柜隔离开关、轨电位、上网隔离开关、隔离开关
func NewTwoPositionSwitchEntity(w ecs.World, id string) *ecs.Entry { func NewTwoPositionSwitchEntity(w ecs.World, id string) *ecs.Entry {
e := w.Entry(w.Create(component.UidType, component.TwoPositionSwitchType)) wd := GetWorldData(w)
component.UidType.SetValue(e, component.Uid{Id: id}) e, ok := wd.EntityMap[id]
component.TwoPositionSwitchType.Set(e, &component.TwoPositionSwitch{Closed: false}) if !ok {
e := w.Entry(w.Create(component.UidType, component.TwoPositionSwitchType))
component.UidType.SetValue(e, component.Uid{Id: id})
component.TwoPositionSwitchType.Set(e, &component.TwoPositionSwitch{Closed: false})
wd.EntityMap[id] = e
}
return e return e
} }
// NewThreePositionSwitchEntity 创建三工位隔离开关实体 // NewThreePositionSwitchEntity 创建三工位隔离开关实体
func NewThreePositionSwitchEntity(w ecs.World, id string) *ecs.Entry { func NewThreePositionSwitchEntity(w ecs.World, id string) *ecs.Entry {
e := w.Entry(w.Create(component.UidType, component.ThreePositionSwitchType)) wd := GetWorldData(w)
component.UidType.SetValue(e, component.Uid{Id: id}) e, ok := wd.EntityMap[id]
component.ThreePositionSwitchType.Set(e, &component.ThreePositionSwitch{Position: component.StpOpened}) if !ok {
e := w.Entry(w.Create(component.UidType, component.ThreePositionSwitchType))
component.UidType.SetValue(e, component.Uid{Id: id})
component.ThreePositionSwitchType.Set(e, &component.ThreePositionSwitch{Position: component.StpOpened})
wd.EntityMap[id] = e
}
return e return e
} }
@ -91,24 +101,26 @@ func NewThreePositionSwitchEntity(w ecs.World, id string) *ecs.Entry {
// Epu所有状态如35kV进线柜、35kV出线柜、1500V直流进线柜、配电变馈线柜、整流变馈线柜、35kV母联柜、500V直流馈线柜、1500V直流馈线柜、1500V直流负极柜 // Epu所有状态如35kV进线柜、35kV出线柜、1500V直流进线柜、配电变馈线柜、整流变馈线柜、35kV母联柜、500V直流馈线柜、1500V直流馈线柜、1500V直流负极柜
// Epu状态中除去报警400V进线柜、400V母联柜、三级负荷总开关、上网隔离开关柜、接口柜 // Epu状态中除去报警400V进线柜、400V母联柜、三级负荷总开关、上网隔离开关柜、接口柜
func NewElectricPowerDeviceEntity(w ecs.World, id string) *ecs.Entry { func NewElectricPowerDeviceEntity(w ecs.World, id string) *ecs.Entry {
e := w.Entry(w.Create(component.UidType, component.ElecDeviceType)) wd := GetWorldData(w)
component.UidType.SetValue(e, component.Uid{Id: id}) e, ok := wd.EntityMap[id]
component.ElecDeviceType.Set(e, &component.ElecDevice{Normal: true}) if !ok {
e := w.Entry(w.Create(component.UidType, component.ElecDeviceType))
component.UidType.SetValue(e, component.Uid{Id: id})
component.ElecDeviceType.Set(e, &component.ElecDevice{Normal: true})
wd.EntityMap[id] = e
}
return e return e
} }
// NewHandcartSwitchEntity 创建手车实体 // NewHandcartSwitchEntity 创建手车实体
func NewHandcartSwitchEntity(w ecs.World, id string) *ecs.Entry { func NewHandcartSwitchEntity(w ecs.World, id string) *ecs.Entry {
e := w.Entry(w.Create(component.UidType, component.HandcartSwitchType)) wd := GetWorldData(w)
component.UidType.SetValue(e, component.Uid{Id: id}) e, ok := wd.EntityMap[id]
component.HandcartSwitchType.Set(e, &component.HandcartSwitch{Position: component.HpOpened}) if !ok {
return e e := w.Entry(w.Create(component.UidType, component.HandcartSwitchType))
} component.UidType.SetValue(e, component.Uid{Id: id})
component.HandcartSwitchType.Set(e, &component.HandcartSwitch{Position: component.HpOpened})
// NewTransBusbarEntity 创建输电母线实体 wd.EntityMap[id] = e
func NewTransBusbarEntity(w ecs.World, id string) *ecs.Entry { }
e := w.Entry(w.Create(component.UidType, component.TransBusbarType))
component.UidType.SetValue(e, component.Uid{Id: id})
component.TransBusbarType.Set(e, &component.TransBusbar{Vl: component.VlNon, Elec: component.EywLossing})
return e return e
} }