iscs ecs pscada

This commit is contained in:
xzb 2023-12-19 13:25:18 +08:00
parent 86f3cf203d
commit b5467e0139
2 changed files with 76 additions and 17 deletions

View File

@ -71,12 +71,6 @@ type LightningArrester struct {
Normal bool //true-正常
}
// AbcVoltageSource 三相电压源
//
// 35KV 1#和2#进线连接的国家电网可以视作电压源,为整个一次图中最终电的来源
type AbcVoltageSource struct {
}
// VoltageTransformer 变压器
// 具体异常-故障、报警、通信中断
type VoltageTransformer struct {
@ -85,14 +79,6 @@ type VoltageTransformer struct {
OutputV uint32 //输出电压值单位V
}
// VoltageABTransmission 电压传递从A传递到B,如断路器闭合时,电压会从断路器一端传递到另一端
type VoltageABTransmission struct {
}
// VoltageANTransmission 电压传递电源从A点传递到N个点
type VoltageANTransmission struct {
}
var (
CircuitBreakerType = ecs.NewComponentType[CircuitBreaker]() //断路器
ThreePositionSwitchType = ecs.NewComponentType[ThreePositionSwitch]() //三工位隔离开关
@ -100,7 +86,8 @@ var (
DisconnectorType = ecs.NewComponentType[Disconnector]() //隔离开关
WireCabinetType = ecs.NewComponentType[WireCabinet]() //线柜
LightningArresterType = ecs.NewComponentType[LightningArrester]() //避雷器
AbcVoltageSourceType = ecs.NewComponentType[AbcVoltageSource]() //三相电压源
RectifierType = ecs.NewComponentType[Rectifier]() //整流器
VoltageTransformerType = ecs.NewComponentType[VoltageTransformer]() //变压器
)
// BackupZiTouInputTag 备自投投入、退出标签

View File

@ -5,12 +5,24 @@ import (
"joylink.club/rtsssimulation/component"
)
// NewCircuitBreakerEntity 创建断路器
func NewCircuitBreakerEntity(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.CircuitBreakerType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
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))
e := w.Entry(w.Create(component.UidType, component.ThreePositionSwitchType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
component.ThreePositionSwitchType.Set(e, &component.ThreePositionSwitch{Position: component.StpOpened})
wd.EntityMap[id] = e
@ -23,10 +35,70 @@ 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))
e := w.Entry(w.Create(component.UidType, component.HandcartSwitchType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
component.HandcartSwitchType.Set(e, &component.HandcartSwitch{Position: component.HpOpened})
wd.EntityMap[id] = e
}
return e
}
// NewRectifierEntity 创建整流器实体
func NewRectifierEntity(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.RectifierType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}
// NewDisconnectorEntity 创建隔离开关实体
func NewDisconnectorEntity(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.DisconnectorType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}
// NewWireCabinetEntity 创建线柜实体
func NewWireCabinetEntity(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.WireCabinetType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}
// NewLightningArresterEntity 创建避雷器实体
func NewLightningArresterEntity(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.LightningArresterType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}
// NewVoltageTransformerEntity 创建变压器实体
func NewVoltageTransformerEntity(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.VoltageTransformerType, component.DeviceExceptionType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}