iscs pscada 自动化系统

This commit is contained in:
xzb 2023-12-22 15:00:34 +08:00
parent 19f14ec506
commit 6275d879a2
10 changed files with 862 additions and 625 deletions

View File

@ -15,6 +15,16 @@ type DevicePlacing struct {
Placing consts.DevicePlacingEnum
}
// NetworkSwitch 交换机
// 具体异常-通信中断、异常
type NetworkSwitch struct {
Normal bool //true-正常
}
var (
NetworkSwitchType = ecs.NewComponentType[NetworkSwitch]()
)
var (
DeviceExceptionType = ecs.NewComponentType[DeviceException]() //设备异常组件
DevicePlacingType = ecs.NewComponentType[DevicePlacing]() //设备置牌组件

View File

@ -1,15 +0,0 @@
package component
import (
"joylink.club/ecs"
)
// NetworkSwitch 交换机
// 具体异常-通信中断、异常
type NetworkSwitch struct {
Normal bool //true-正常
}
var (
NetworkSwitchType = ecs.NewComponentType[NetworkSwitch]()
)

View File

@ -19,7 +19,7 @@ type ThreePositionSwitch struct {
}
// SwitchThreePosition 三工位开关位置定义
type SwitchThreePosition = uint8
type SwitchThreePosition uint8
const (
StpOpened SwitchThreePosition = iota //开关分闸,线路断开,未与任何位置接通
@ -27,6 +27,16 @@ const (
StpClosedLanding //接地开关合闸
)
func (p *SwitchThreePosition) Opened() bool {
return *p == StpOpened
}
func (p *SwitchThreePosition) ClosedWorking() bool {
return *p == StpClosedWorking
}
func (p *SwitchThreePosition) ClosedLanding() bool {
return *p == StpClosedLanding
}
/////////////////////////
// HandcartSwitch 手车式开关
@ -36,7 +46,7 @@ type HandcartSwitch struct {
}
// HandcarPosition 手车式开关位置定义
type HandcarPosition = uint8
type HandcarPosition uint8
const (
HpOpened HandcarPosition = iota //工作位分闸
@ -44,6 +54,16 @@ const (
HpTest //实验位
)
func (p *HandcarPosition) Opened() bool {
return *p == HpOpened
}
func (p *HandcarPosition) Closed() bool {
return *p == HpClosed
}
func (p *HandcarPosition) Test() bool {
return *p == HpTest
}
////////////////////
// Rectifier 整流器
@ -109,7 +129,7 @@ type ElePower struct {
}
// PscadaVoltageLevel 电力母线当前电压等级定义
type PscadaVoltageLevel = uint8
type PscadaVoltageLevel uint8
const (
PscadaVoltageNon PscadaVoltageLevel = iota //未受电

View File

@ -1,7 +1,7 @@
package consts
// DeviceExceptionEnum 设备例外枚举定义
type DeviceExceptionEnum = int8
type DeviceExceptionEnum int8
const (
DeviceExceptionNon DeviceExceptionEnum = iota
@ -14,7 +14,7 @@ const (
)
// DevicePlacingEnum 设备置牌枚举定义
type DevicePlacingEnum = int8
type DevicePlacingEnum int8
const (
DevicePlacingNon DevicePlacingEnum = iota

View File

@ -50,6 +50,10 @@ message Repository {
repeated LightningArrester lightningArresters = 309;
//ISCS接地装置
repeated EarthingDevice earthingDevices = 310;
//ISCS网络交换机
repeated NetworkSwitch networkSwitches = 311;
//ISCS线柜
repeated WireCabinet wireCabinets = 312;
}
//
@ -301,7 +305,7 @@ enum DeviceType {
DeviceType_FireInterconnectionSignal = 373;
//ISCS
DeviceType_FloodGate = 374;
//ISCS 线
//ISCS 线
DeviceType_WireCabinet = 375;
//ISCS
DeviceType_CircuitBreaker = 376;
@ -617,4 +621,15 @@ message LightningArrester{
message EarthingDevice{
string id = 1;
string code = 2;
}
//
message NetworkSwitch{
string id = 1;
string code = 2;
}
//线
message WireCabinet{
string id = 1;
string code = 2;
}

View File

@ -0,0 +1,31 @@
package repository
import "joylink.club/rtsssimulation/repository/model/proto"
//PSCADA 自动化系统图
// NetworkSwitch 网络交换机
type NetworkSwitch struct {
Identity
Code string
}
func NewNetworkSwitch(id string, code string) *NetworkSwitch {
return &NetworkSwitch{
Identity: &identity{id: id, deviceType: proto.DeviceType_DeviceType_NetworkSwitch},
Code: code,
}
}
// WireCabinet 线柜
type WireCabinet struct {
Identity
Code string
}
func NewWireCabinet(id string, code string) *WireCabinet {
return &WireCabinet{
Identity: &identity{id: id, deviceType: proto.DeviceType_DeviceType_WireCabinet},
Code: code,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,8 @@ type Repository struct {
PowerSourceMap map[string]*PowerSource //ISCS 电源
LightningArresterMap map[string]*LightningArrester //ISCS 避雷器
EarthingDeviceMap map[string]*EarthingDevice //ISCS 接地装置
NetworkSwitchMap map[string]*NetworkSwitch //ISCS 网络交换机
WireCabinetMap map[string]*WireCabinet //ISCS 线柜
}
func newRepository(id string, version string) *Repository {
@ -79,6 +81,8 @@ func newRepository(id string, version string) *Repository {
PowerSourceMap: make(map[string]*PowerSource), //ISCS 电源
LightningArresterMap: make(map[string]*LightningArrester), //ISCS 避雷器
EarthingDeviceMap: make(map[string]*EarthingDevice), //ISCS 接地装置
NetworkSwitchMap: make(map[string]*NetworkSwitch), //ISCS网络交换机
WireCabinetMap: make(map[string]*WireCabinet), //ISCS线柜
}
}

View File

@ -26,7 +26,7 @@ func (s *HandcartSystem) handcartTransPower(w ecs.World) {
wd := entity.GetWorldData(w)
s.query.Each(w, func(entry *ecs.Entry) {
breakerId := component.UidType.Get(entry).Id
closed := component.HandcartSwitchType.Get(entry).Position == component.HpClosed
closed := component.HandcartSwitchType.Get(entry).Position.Closed()
breakerModel := (wd.Repo.FindById(breakerId)).(*repository.HandcartSwitch)
breakerPortA := breakerModel.PortA
breakerPortB := breakerModel.PortB

View File

@ -27,7 +27,7 @@ func (s *ThreePositionSwitchSystem) threePositionSwitchTransPower(w ecs.World) {
wd := entity.GetWorldData(w)
s.query.Each(w, func(entry *ecs.Entry) {
breakerId := component.UidType.Get(entry).Id
closed := component.ThreePositionSwitchType.Get(entry).Position == component.StpClosedWorking
closed := component.ThreePositionSwitchType.Get(entry).Position.ClosedWorking()
breakerModel := (wd.Repo.FindById(breakerId)).(*repository.ThreePositionSwitch)
breakerPortA := breakerModel.PortA
breakerPortB := breakerModel.PortB