iscs pscada 自动化系统
This commit is contained in:
parent
19f14ec506
commit
6275d879a2
@ -15,6 +15,16 @@ type DevicePlacing struct {
|
|||||||
Placing consts.DevicePlacingEnum
|
Placing consts.DevicePlacingEnum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetworkSwitch 交换机
|
||||||
|
// 具体异常-通信中断、异常
|
||||||
|
type NetworkSwitch struct {
|
||||||
|
Normal bool //true-正常
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
NetworkSwitchType = ecs.NewComponentType[NetworkSwitch]()
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
DeviceExceptionType = ecs.NewComponentType[DeviceException]() //设备异常组件
|
DeviceExceptionType = ecs.NewComponentType[DeviceException]() //设备异常组件
|
||||||
DevicePlacingType = ecs.NewComponentType[DevicePlacing]() //设备置牌组件
|
DevicePlacingType = ecs.NewComponentType[DevicePlacing]() //设备置牌组件
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
package component
|
|
||||||
|
|
||||||
import (
|
|
||||||
"joylink.club/ecs"
|
|
||||||
)
|
|
||||||
|
|
||||||
// NetworkSwitch 交换机
|
|
||||||
// 具体异常-通信中断、异常
|
|
||||||
type NetworkSwitch struct {
|
|
||||||
Normal bool //true-正常
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
NetworkSwitchType = ecs.NewComponentType[NetworkSwitch]()
|
|
||||||
)
|
|
@ -19,7 +19,7 @@ type ThreePositionSwitch struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SwitchThreePosition 三工位开关位置定义
|
// SwitchThreePosition 三工位开关位置定义
|
||||||
type SwitchThreePosition = uint8
|
type SwitchThreePosition uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
StpOpened SwitchThreePosition = iota //开关分闸,线路断开,未与任何位置接通
|
StpOpened SwitchThreePosition = iota //开关分闸,线路断开,未与任何位置接通
|
||||||
@ -27,6 +27,16 @@ const (
|
|||||||
StpClosedLanding //接地开关合闸
|
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 手车式开关
|
// HandcartSwitch 手车式开关
|
||||||
@ -36,7 +46,7 @@ type HandcartSwitch struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HandcarPosition 手车式开关位置定义
|
// HandcarPosition 手车式开关位置定义
|
||||||
type HandcarPosition = uint8
|
type HandcarPosition uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
HpOpened HandcarPosition = iota //工作位分闸
|
HpOpened HandcarPosition = iota //工作位分闸
|
||||||
@ -44,6 +54,16 @@ const (
|
|||||||
HpTest //实验位
|
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 整流器
|
// Rectifier 整流器
|
||||||
@ -109,7 +129,7 @@ type ElePower struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PscadaVoltageLevel 电力母线当前电压等级定义
|
// PscadaVoltageLevel 电力母线当前电压等级定义
|
||||||
type PscadaVoltageLevel = uint8
|
type PscadaVoltageLevel uint8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PscadaVoltageNon PscadaVoltageLevel = iota //未受电
|
PscadaVoltageNon PscadaVoltageLevel = iota //未受电
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package consts
|
package consts
|
||||||
|
|
||||||
// DeviceExceptionEnum 设备例外枚举定义
|
// DeviceExceptionEnum 设备例外枚举定义
|
||||||
type DeviceExceptionEnum = int8
|
type DeviceExceptionEnum int8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DeviceExceptionNon DeviceExceptionEnum = iota
|
DeviceExceptionNon DeviceExceptionEnum = iota
|
||||||
@ -14,7 +14,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// DevicePlacingEnum 设备置牌枚举定义
|
// DevicePlacingEnum 设备置牌枚举定义
|
||||||
type DevicePlacingEnum = int8
|
type DevicePlacingEnum int8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DevicePlacingNon DevicePlacingEnum = iota
|
DevicePlacingNon DevicePlacingEnum = iota
|
||||||
|
@ -50,6 +50,10 @@ message Repository {
|
|||||||
repeated LightningArrester lightningArresters = 309;
|
repeated LightningArrester lightningArresters = 309;
|
||||||
//ISCS接地装置
|
//ISCS接地装置
|
||||||
repeated EarthingDevice earthingDevices = 310;
|
repeated EarthingDevice earthingDevices = 310;
|
||||||
|
//ISCS网络交换机
|
||||||
|
repeated NetworkSwitch networkSwitches = 311;
|
||||||
|
//ISCS线柜
|
||||||
|
repeated WireCabinet wireCabinets = 312;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 信号布置数据
|
// 信号布置数据
|
||||||
@ -301,7 +305,7 @@ enum DeviceType {
|
|||||||
DeviceType_FireInterconnectionSignal = 373;
|
DeviceType_FireInterconnectionSignal = 373;
|
||||||
//ISCS 防淹门
|
//ISCS 防淹门
|
||||||
DeviceType_FloodGate = 374;
|
DeviceType_FloodGate = 374;
|
||||||
//ISCS 电力线柜
|
//ISCS 线柜
|
||||||
DeviceType_WireCabinet = 375;
|
DeviceType_WireCabinet = 375;
|
||||||
//ISCS 电力断路器
|
//ISCS 电力断路器
|
||||||
DeviceType_CircuitBreaker = 376;
|
DeviceType_CircuitBreaker = 376;
|
||||||
@ -618,3 +622,14 @@ message EarthingDevice{
|
|||||||
string id = 1;
|
string id = 1;
|
||||||
string code = 2;
|
string code = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//网络交换机
|
||||||
|
message NetworkSwitch{
|
||||||
|
string id = 1;
|
||||||
|
string code = 2;
|
||||||
|
}
|
||||||
|
//线柜
|
||||||
|
message WireCabinet{
|
||||||
|
string id = 1;
|
||||||
|
string code = 2;
|
||||||
|
}
|
31
repository/iscs_pscada_auto_system.go
Normal file
31
repository/iscs_pscada_auto_system.go
Normal 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
@ -42,6 +42,8 @@ type Repository struct {
|
|||||||
PowerSourceMap map[string]*PowerSource //ISCS 电源
|
PowerSourceMap map[string]*PowerSource //ISCS 电源
|
||||||
LightningArresterMap map[string]*LightningArrester //ISCS 避雷器
|
LightningArresterMap map[string]*LightningArrester //ISCS 避雷器
|
||||||
EarthingDeviceMap map[string]*EarthingDevice //ISCS 接地装置
|
EarthingDeviceMap map[string]*EarthingDevice //ISCS 接地装置
|
||||||
|
NetworkSwitchMap map[string]*NetworkSwitch //ISCS 网络交换机
|
||||||
|
WireCabinetMap map[string]*WireCabinet //ISCS 线柜
|
||||||
}
|
}
|
||||||
|
|
||||||
func newRepository(id string, version string) *Repository {
|
func newRepository(id string, version string) *Repository {
|
||||||
@ -79,6 +81,8 @@ func newRepository(id string, version string) *Repository {
|
|||||||
PowerSourceMap: make(map[string]*PowerSource), //ISCS 电源
|
PowerSourceMap: make(map[string]*PowerSource), //ISCS 电源
|
||||||
LightningArresterMap: make(map[string]*LightningArrester), //ISCS 避雷器
|
LightningArresterMap: make(map[string]*LightningArrester), //ISCS 避雷器
|
||||||
EarthingDeviceMap: make(map[string]*EarthingDevice), //ISCS 接地装置
|
EarthingDeviceMap: make(map[string]*EarthingDevice), //ISCS 接地装置
|
||||||
|
NetworkSwitchMap: make(map[string]*NetworkSwitch), //ISCS网络交换机
|
||||||
|
WireCabinetMap: make(map[string]*WireCabinet), //ISCS线柜
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ func (s *HandcartSystem) handcartTransPower(w ecs.World) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
breakerId := component.UidType.Get(entry).Id
|
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)
|
breakerModel := (wd.Repo.FindById(breakerId)).(*repository.HandcartSwitch)
|
||||||
breakerPortA := breakerModel.PortA
|
breakerPortA := breakerModel.PortA
|
||||||
breakerPortB := breakerModel.PortB
|
breakerPortB := breakerModel.PortB
|
||||||
|
@ -27,7 +27,7 @@ func (s *ThreePositionSwitchSystem) threePositionSwitchTransPower(w ecs.World) {
|
|||||||
wd := entity.GetWorldData(w)
|
wd := entity.GetWorldData(w)
|
||||||
s.query.Each(w, func(entry *ecs.Entry) {
|
s.query.Each(w, func(entry *ecs.Entry) {
|
||||||
breakerId := component.UidType.Get(entry).Id
|
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)
|
breakerModel := (wd.Repo.FindById(breakerId)).(*repository.ThreePositionSwitch)
|
||||||
breakerPortA := breakerModel.PortA
|
breakerPortA := breakerModel.PortA
|
||||||
breakerPortB := breakerModel.PortB
|
breakerPortB := breakerModel.PortB
|
||||||
|
Loading…
Reference in New Issue
Block a user