iscs pscada 一次图

This commit is contained in:
xzb 2023-12-19 17:10:30 +08:00
parent b5467e0139
commit c6c1f5559d
6 changed files with 208 additions and 0 deletions

3
component/iscs_pipe.go Normal file
View File

@ -0,0 +1,3 @@
package component
//ISCS 管线相关

View File

@ -79,6 +79,48 @@ type VoltageTransformer struct {
OutputV uint32 //输出电压值单位V
}
////////////////////////////////////////////////////////////
// PowerPipe 电力母线
type PowerPipe struct {
Voltage uint32 //母线当前电压
Ac bool //true-交流电false-直流电
Sources map[string]ElePower //key-电源PowerSource实体id
}
// ElePower 传输中的电力
type ElePower struct {
Fresh int64 //该电力值更新的时间戳
Voltage uint32 //电压
Ac bool //true-交流电false-直流电
}
// PscadaVoltageLevel 电力母线当前电压等级定义
type PscadaVoltageLevel = uint8
const (
PscadaVoltageNon PscadaVoltageLevel = iota //未受电
PscadaVoltage110kV //110KV交流
PscadaVoltage35kV //35KV交流
PscadaVoltage400V //400V交流
PscadaVoltageDc1500V //1500V直流
)
// PowerTransmission 电力传输
// 如断路器、隔离开关两端间电力传输
type PowerTransmission struct {
PipeA *ecs.Entry
PipeB *ecs.Entry
}
// PowerSource 电源(国家电网)
type PowerSource struct {
Voltage uint32 //电压
Ac bool //true-交流电false-直流电
}
//////////////////////////////////////////////////////////////////////////////////
var (
CircuitBreakerType = ecs.NewComponentType[CircuitBreaker]() //断路器
ThreePositionSwitchType = ecs.NewComponentType[ThreePositionSwitch]() //三工位隔离开关
@ -88,6 +130,8 @@ var (
LightningArresterType = ecs.NewComponentType[LightningArrester]() //避雷器
RectifierType = ecs.NewComponentType[Rectifier]() //整流器
VoltageTransformerType = ecs.NewComponentType[VoltageTransformer]() //变压器
PowerPipeType = ecs.NewComponentType[PowerPipe]() //电力母线
PowerSourceType = ecs.NewComponentType[PowerSource]()
)
// BackupZiTouInputTag 备自投投入、退出标签

View File

@ -102,3 +102,28 @@ func NewVoltageTransformerEntity(w ecs.World, id string) *ecs.Entry {
}
return e
}
// NewPowerPipeEntity 创建PSCADA电力母线实体
func NewPowerPipeEntity(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.PowerPipeType))
component.UidType.SetValue(e, component.Uid{Id: id})
wd.EntityMap[id] = e
}
return e
}
// NewPowerSourceEntity 创建PSCADA电源实体
func NewPowerSourceEntity(w ecs.World, id string, ac bool, voltage uint32) *ecs.Entry {
wd := GetWorldData(w)
e, ok := wd.EntityMap[id]
if !ok {
e := w.Entry(w.Create(component.UidType, component.PowerSourceType))
component.UidType.SetValue(e, component.Uid{Id: id})
component.PowerSourceType.Set(e, &component.PowerSource{Ac: ac, Voltage: voltage})
wd.EntityMap[id] = e
}
return e
}

View File

@ -292,6 +292,12 @@ enum DeviceType {
DeviceType_LightningArrester = 81;
//ISCS
DeviceType_Disconnector = 82;
//ISCS 线
DeviceType_Pipe = 83;
//ISCS
DeviceType_PipeFitting = 84;
//ISCS
DeviceType_PowerSource = 85;
}
@ -301,6 +307,7 @@ enum Port {
A = 1;
B = 2;
C = 3;
D = 4;
}
//
@ -493,4 +500,86 @@ message AsdGroup {
message CiSectionCodePoint{
int32 row = 1;//
string sectionId = 2;//id
}
//////////////////////////ISCS///////////////////////////////////
//ISCS -
message IscsPscadaYcLayout{
//线
repeated Pipe pipes = 1;
//
repeated PipeFitting pipeFittings = 2;
//
repeated CircuitBreaker circuitBreakers = 3;
//
repeated ThreePositionSwitch threePositionSwitches = 4;
//
repeated HandcartSwitch handcartSwitches = 5;
//
repeated Rectifier rectifiers = 6;
//
repeated Disconnector disconnectors = 7;
//
repeated VoltageTransformer voltageTransformers = 8;
//
repeated PowerSource powerSources = 9;
}
//线
//线A端和B端
//线
message Pipe{
string id = 1;
DevicePort portA = 2;//线A端连接的设备
DevicePort portB = 3;//线B端连接的设备
}
//
message PipeFitting{
string id = 1;
int32 sum = 2;//3 4
}
//
//A和B
message CircuitBreaker{
string id = 1;
}
//
//A,B,C
message ThreePositionSwitch{
string id = 1;
}
//
//A和B
message HandcartSwitch{
string id = 1;
}
//
//PSCADA中整流器有两个交流输入端分别为A和B;C和直流负极端口D
message Rectifier{
string id = 1;
}
//
//A和B
message Disconnector{
string id = 1;
}
//
//A,B或C
message VoltageTransformer{
string id = 1;
}
//
//A
message PowerSource{
string id = 1;
//true-false-
bool ac = 2;
//
uint32 voltage = 3;
}

View File

@ -0,0 +1,36 @@
package iscs_sys
import (
"joylink.club/ecs"
"joylink.club/ecs/filter"
"joylink.club/rtsssimulation/component"
"time"
)
// PowerPipeSystem 电力母线,计算母线中的电压
type PowerPipeSystem struct {
query *ecs.Query
}
func NewPowerPipeSystem() *PowerPipeSystem {
return &PowerPipeSystem{query: ecs.NewQuery(filter.Contains(component.PowerPipeType))}
}
func (s *PowerPipeSystem) Update(w ecs.World) {
//计算电力母线中的电压
s.query.Each(w, func(entry *ecs.Entry) {
pipe := component.PowerPipeType.Get(entry)
voltage := uint32(0)
ac := false
for _, power := range pipe.Sources {
if time.Now().UnixMilli()-power.Fresh <= int64(w.Tick()*2) {
if power.Voltage > voltage {
voltage = power.Voltage
ac = power.Ac
}
}
}
//
pipe.Voltage = voltage
pipe.Ac = ac
})
}

View File

@ -0,0 +1,11 @@
package iscs_sys
import "joylink.club/ecs"
// PowerTransmissionSystem 电力传递
type PowerTransmissionSystem struct {
}
func (s *PowerTransmissionSystem) Update(w ecs.World) {
}