2023-12-07 16:28:29 +08:00
|
|
|
|
package component
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"joylink.club/ecs"
|
|
|
|
|
)
|
|
|
|
|
|
2023-12-08 17:44:25 +08:00
|
|
|
|
//ISCS 电力系统相关组件定义
|
|
|
|
|
|
2023-12-18 18:04:37 +08:00
|
|
|
|
// CircuitBreaker 电路断路器
|
2023-12-19 11:11:27 +08:00
|
|
|
|
// 具体异常-通信中断
|
2023-12-18 18:04:37 +08:00
|
|
|
|
type CircuitBreaker struct {
|
2023-12-19 11:11:27 +08:00
|
|
|
|
Closed bool //true-合闸;false-分闸
|
2023-12-08 17:44:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-07 16:28:29 +08:00
|
|
|
|
// ThreePositionSwitch 三工位开关
|
2023-12-19 11:11:27 +08:00
|
|
|
|
// 具体异常-异常、通信中断
|
2023-12-07 16:28:29 +08:00
|
|
|
|
type ThreePositionSwitch struct {
|
2023-12-19 13:05:08 +08:00
|
|
|
|
Position SwitchThreePosition
|
2023-12-07 16:28:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-11 11:09:07 +08:00
|
|
|
|
// SwitchThreePosition 三工位开关位置定义
|
2023-12-22 15:00:34 +08:00
|
|
|
|
type SwitchThreePosition uint8
|
2023-12-11 11:09:07 +08:00
|
|
|
|
|
|
|
|
|
const (
|
2023-12-19 11:21:00 +08:00
|
|
|
|
StpOpened SwitchThreePosition = iota //开关分闸,线路断开,未与任何位置接通
|
|
|
|
|
StpClosedWorking //隔离开关合闸
|
|
|
|
|
StpClosedLanding //接地开关合闸
|
2023-12-11 11:09:07 +08:00
|
|
|
|
)
|
|
|
|
|
|
2023-12-22 15:00:34 +08:00
|
|
|
|
func (p *SwitchThreePosition) Opened() bool {
|
|
|
|
|
return *p == StpOpened
|
|
|
|
|
}
|
|
|
|
|
func (p *SwitchThreePosition) ClosedWorking() bool {
|
|
|
|
|
return *p == StpClosedWorking
|
|
|
|
|
}
|
|
|
|
|
func (p *SwitchThreePosition) ClosedLanding() bool {
|
|
|
|
|
return *p == StpClosedLanding
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-18 18:04:37 +08:00
|
|
|
|
/////////////////////////
|
2023-12-07 16:28:29 +08:00
|
|
|
|
|
|
|
|
|
// HandcartSwitch 手车式开关
|
2023-12-19 11:11:27 +08:00
|
|
|
|
// 具体异常-通信中断
|
2023-12-07 16:28:29 +08:00
|
|
|
|
type HandcartSwitch struct {
|
2023-12-19 11:11:27 +08:00
|
|
|
|
Position HandcarPosition
|
2023-12-07 16:28:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-11 11:09:07 +08:00
|
|
|
|
// HandcarPosition 手车式开关位置定义
|
2023-12-22 15:00:34 +08:00
|
|
|
|
type HandcarPosition uint8
|
2023-12-11 11:09:07 +08:00
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
HpOpened HandcarPosition = iota //工作位分闸
|
|
|
|
|
HpClosed //工作位合闸
|
|
|
|
|
HpTest //实验位
|
|
|
|
|
)
|
|
|
|
|
|
2023-12-22 15:00:34 +08:00
|
|
|
|
func (p *HandcarPosition) Opened() bool {
|
|
|
|
|
return *p == HpOpened
|
|
|
|
|
}
|
|
|
|
|
func (p *HandcarPosition) Closed() bool {
|
|
|
|
|
return *p == HpClosed
|
|
|
|
|
}
|
|
|
|
|
func (p *HandcarPosition) Test() bool {
|
|
|
|
|
return *p == HpTest
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-18 18:04:37 +08:00
|
|
|
|
////////////////////
|
|
|
|
|
|
|
|
|
|
// Rectifier 整流器
|
2023-12-19 11:11:27 +08:00
|
|
|
|
// 具体异常-故障、报警、通信中断
|
2023-12-18 18:04:37 +08:00
|
|
|
|
type Rectifier struct {
|
2023-12-22 09:46:11 +08:00
|
|
|
|
Normal bool //true-正常
|
2023-12-18 18:04:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Disconnector 隔离开关
|
2023-12-19 11:11:27 +08:00
|
|
|
|
// 具体异常-异常、通信中断
|
2023-12-18 18:04:37 +08:00
|
|
|
|
type Disconnector struct {
|
2023-12-19 11:11:27 +08:00
|
|
|
|
Closed bool //true-合闸;false-分闸
|
2023-12-18 18:04:37 +08:00
|
|
|
|
}
|
2023-12-07 16:28:29 +08:00
|
|
|
|
|
2023-12-18 18:04:37 +08:00
|
|
|
|
// WireCabinet 线柜
|
2023-12-19 11:11:27 +08:00
|
|
|
|
// 具体异常-故障、报警、异常、通信中断
|
2023-12-18 18:04:37 +08:00
|
|
|
|
type WireCabinet struct {
|
2023-12-19 11:11:27 +08:00
|
|
|
|
Normal bool //true-正常
|
2023-12-18 18:04:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// LightningArrester 避雷器
|
|
|
|
|
type LightningArrester struct {
|
2023-12-08 17:44:25 +08:00
|
|
|
|
Normal bool //true-正常
|
2023-12-07 16:28:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-18 18:04:37 +08:00
|
|
|
|
// VoltageTransformer 变压器
|
2023-12-19 11:11:27 +08:00
|
|
|
|
// 具体异常-故障、报警、通信中断
|
2023-12-18 18:04:37 +08:00
|
|
|
|
type VoltageTransformer struct {
|
2023-12-22 09:46:11 +08:00
|
|
|
|
Normal bool //true-正常
|
2023-12-18 18:04:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-12-22 13:20:06 +08:00
|
|
|
|
// EarthingDevice 接地装置
|
|
|
|
|
type EarthingDevice struct {
|
|
|
|
|
Voltage uint32 //接地装置电压
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-19 17:10:30 +08:00
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
// PowerPipe 电力母线
|
|
|
|
|
type PowerPipe struct {
|
2023-12-21 15:36:02 +08:00
|
|
|
|
Voltage uint32 //母线当前电压
|
|
|
|
|
Ac bool //true-交流电;false-直流电
|
|
|
|
|
Sources map[string]*ElePower //key-电源PowerSource实体id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (p *PowerPipe) TransPower(powerSourceId string, power *ElePower) {
|
|
|
|
|
ep, ok := p.Sources[powerSourceId]
|
|
|
|
|
if ok {
|
|
|
|
|
*ep = *power
|
2023-12-22 09:46:11 +08:00
|
|
|
|
ep.Fresh -= 1
|
2023-12-21 15:36:02 +08:00
|
|
|
|
} else {
|
2023-12-22 09:46:11 +08:00
|
|
|
|
p.Sources[powerSourceId] = &ElePower{}
|
|
|
|
|
*p.Sources[powerSourceId] = *power
|
|
|
|
|
p.Sources[powerSourceId].Fresh -= 1
|
2023-12-21 15:36:02 +08:00
|
|
|
|
}
|
2023-12-19 17:10:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ElePower 传输中的电力
|
|
|
|
|
type ElePower struct {
|
|
|
|
|
Fresh int64 //该电力值更新的时间戳
|
|
|
|
|
Voltage uint32 //电压
|
|
|
|
|
Ac bool //true-交流电;false-直流电
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PscadaVoltageLevel 电力母线当前电压等级定义
|
2023-12-22 15:00:34 +08:00
|
|
|
|
type PscadaVoltageLevel uint8
|
2023-12-19 17:10:30 +08:00
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
PscadaVoltageNon PscadaVoltageLevel = iota //未受电
|
|
|
|
|
PscadaVoltage110kV //110KV交流
|
|
|
|
|
PscadaVoltage35kV //35KV交流
|
|
|
|
|
PscadaVoltage400V //400V交流
|
|
|
|
|
PscadaVoltageDc1500V //1500V直流
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// PowerSource 电源(国家电网)
|
|
|
|
|
type PowerSource struct {
|
|
|
|
|
Voltage uint32 //电压
|
|
|
|
|
Ac bool //true-交流电;false-直流电
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2023-12-08 17:44:25 +08:00
|
|
|
|
var (
|
2023-12-18 18:04:37 +08:00
|
|
|
|
CircuitBreakerType = ecs.NewComponentType[CircuitBreaker]() //断路器
|
|
|
|
|
ThreePositionSwitchType = ecs.NewComponentType[ThreePositionSwitch]() //三工位隔离开关
|
|
|
|
|
HandcartSwitchType = ecs.NewComponentType[HandcartSwitch]() //手车
|
|
|
|
|
DisconnectorType = ecs.NewComponentType[Disconnector]() //隔离开关
|
|
|
|
|
WireCabinetType = ecs.NewComponentType[WireCabinet]() //线柜
|
|
|
|
|
LightningArresterType = ecs.NewComponentType[LightningArrester]() //避雷器
|
2023-12-19 13:25:18 +08:00
|
|
|
|
RectifierType = ecs.NewComponentType[Rectifier]() //整流器
|
|
|
|
|
VoltageTransformerType = ecs.NewComponentType[VoltageTransformer]() //变压器
|
2023-12-19 17:10:30 +08:00
|
|
|
|
PowerPipeType = ecs.NewComponentType[PowerPipe]() //电力母线
|
2023-12-22 13:20:06 +08:00
|
|
|
|
PowerSourceType = ecs.NewComponentType[PowerSource]() //电源
|
|
|
|
|
EarthingDeviceType = ecs.NewComponentType[EarthingDevice]() //接地装置
|
2023-12-08 17:44:25 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// BackupZiTouInputTag 备自投投入、退出标签
|
|
|
|
|
var BackupZiTouInputTag = ecs.NewTag() //备自投投入标签
|