rts-sim-module/entity/iscs_pscada.go

127 lines
4.7 KiB
Go
Raw Normal View History

2023-12-07 16:28:29 +08:00
package entity
import (
"joylink.club/ecs"
"joylink.club/rtsssimulation/component"
)
2023-12-08 17:44:25 +08:00
// 电力监控系统相关实体创建
// 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
2023-12-08 17:44:25 +08:00
}
return e
2023-12-08 17:44:25 +08:00
}
///////////////////////////////////////////通用/////////////////////////////////////////////////////////
2023-12-07 16:28:29 +08:00
// 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
}
2023-12-07 16:28:29 +08:00
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
}
2023-12-07 16:28:29 +08:00
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
}
2023-12-07 16:28:29 +08:00
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
}
2023-12-07 16:28:29 +08:00
return e
}