iscs pscada 一次图
This commit is contained in:
parent
b5467e0139
commit
c6c1f5559d
3
component/iscs_pipe.go
Normal file
3
component/iscs_pipe.go
Normal file
@ -0,0 +1,3 @@
|
||||
package component
|
||||
|
||||
//ISCS 管线相关
|
@ -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 备自投投入、退出标签
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
36
sys/iscs_sys/iscs_pscada_power_pipe.go
Normal file
36
sys/iscs_sys/iscs_pscada_power_pipe.go
Normal 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
|
||||
})
|
||||
}
|
11
sys/iscs_sys/iscs_pscada_power_transmission.go
Normal file
11
sys/iscs_sys/iscs_pscada_power_transmission.go
Normal file
@ -0,0 +1,11 @@
|
||||
package iscs_sys
|
||||
|
||||
import "joylink.club/ecs"
|
||||
|
||||
// PowerTransmissionSystem 电力传递
|
||||
type PowerTransmissionSystem struct {
|
||||
}
|
||||
|
||||
func (s *PowerTransmissionSystem) Update(w ecs.World) {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user