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

View File

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