rts-sim-module/entity/iscs_pscada.go

127 lines
4.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package entity
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
// 电力监控系统相关实体创建
// NewIscsWireCabinetEntity ISCS创建线柜实体
//
// 35kV进线柜、35kV出线柜、1500V直流进线柜、配电变馈线柜、整流变馈线柜、35kV母联柜、500V直流馈线柜、1500V直流馈线柜、1500V直流负极柜
// 400V进线柜、400V母联柜、三级负荷总开关、上网隔离开关柜、接口柜
func NewIscsWireCabinetEntity(w ecs.World, id string) *ecs.Entry {
entry := NewElectricPowerDeviceEntity(w, id)
entry.AddComponent(component.IscsWireCabinetStateType)
return entry
}
// NewIscsCircuitBreakerEntity ISCS创建断路器实体
// 断路器PT、负极柜隔离开关、轨电位、上网隔离开关、隔离开关
func NewIscsCircuitBreakerEntity(w ecs.World, id string) *ecs.Entry {
entry := NewTwoPositionSwitchEntity(w, id)
entry.AddComponent(component.IscsCircuitBreakerStateType)
return entry
}
// NewIscsRectifierEntity ISCS创建整流器实体
func NewIscsRectifierEntity(w ecs.World, id string) *ecs.Entry {
entry := NewElectricPowerDeviceEntity(w, id)
entry.AddComponent(component.IscsRectifierStateType)
return entry
}
// NewIscsHandcartSwitchEntity ISCS创建手车实体
func NewIscsHandcartSwitchEntity(w ecs.World, id string) *ecs.Entry {
entry := NewHandcartSwitchEntity(w, id)
entry.AddComponent(component.IscsHandcartSwitchStateType)
return entry
}
// NewIscsVoltageTransformerEntity ISCS创建变压器实体
func NewIscsVoltageTransformerEntity(w ecs.World, id string) *ecs.Entry {
entry := NewElectricPowerDeviceEntity(w, id)
entry.AddComponent(component.IscsVoltageTransformerStateType)
return entry
}
// NewIscsThreePositionSwitchEntity ISCS创建三工位开关实体
func NewIscsThreePositionSwitchEntity(w ecs.World, id string) *ecs.Entry {
entry := NewThreePositionSwitchEntity(w, id)
entry.AddComponent(component.IscsIscsThreePositionSwitchStateType)
return entry
}
// 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 e
}
///////////////////////////////////////////通用/////////////////////////////////////////////////////////
// NewTwoPositionSwitchEntity 创建两工位开关实体
// 如断路器
// 如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
}
// NewElectricPowerDeviceEntity 创建一般电力设备实体
// 如:变压器、整流器
// 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})
wd.EntityMap[id] = e
}
return e
}