rts-sim-module/component/iscs_pscada.go

140 lines
4.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package component
import (
"joylink.club/ecs"
)
//ISCS 电力系统相关组件定义
// CircuitBreaker 电路断路器
// 具体异常-通信中断
type CircuitBreaker struct {
Closed bool //true-合闸false-分闸
}
// ThreePositionSwitch 三工位开关
// 具体异常-异常、通信中断
type ThreePositionSwitch struct {
Position SwitchThreePosition
}
// SwitchThreePosition 三工位开关位置定义
type SwitchThreePosition = uint8
const (
StpOpened SwitchThreePosition = iota //开关分闸,线路断开,未与任何位置接通
StpClosedWorking //隔离开关合闸
StpClosedLanding //接地开关合闸
)
/////////////////////////
// HandcartSwitch 手车式开关
// 具体异常-通信中断
type HandcartSwitch struct {
Position HandcarPosition
}
// HandcarPosition 手车式开关位置定义
type HandcarPosition = uint8
const (
HpOpened HandcarPosition = iota //工作位分闸
HpClosed //工作位合闸
HpTest //实验位
)
////////////////////
// Rectifier 整流器
// 具体异常-故障、报警、通信中断
type Rectifier struct {
Normal bool //true-正常
}
// Disconnector 隔离开关
// 具体异常-异常、通信中断
type Disconnector struct {
Closed bool //true-合闸false-分闸
}
// WireCabinet 线柜
// 具体异常-故障、报警、异常、通信中断
type WireCabinet struct {
Normal bool //true-正常
}
// LightningArrester 避雷器
type LightningArrester struct {
Normal bool //true-正常
}
// VoltageTransformer 变压器
// 具体异常-故障、报警、通信中断
type VoltageTransformer struct {
Normal bool //true-正常
}
////////////////////////////////////////////////////////////
// PowerPipe 电力母线
type PowerPipe struct {
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
ep.Fresh -= 1
} else {
p.Sources[powerSourceId] = &ElePower{}
*p.Sources[powerSourceId] = *power
p.Sources[powerSourceId].Fresh -= 1
}
}
// 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直流
)
// PowerSource 电源(国家电网)
type PowerSource struct {
Voltage uint32 //电压
Ac bool //true-交流电false-直流电
}
//////////////////////////////////////////////////////////////////////////////////
var (
CircuitBreakerType = ecs.NewComponentType[CircuitBreaker]() //断路器
ThreePositionSwitchType = ecs.NewComponentType[ThreePositionSwitch]() //三工位隔离开关
HandcartSwitchType = ecs.NewComponentType[HandcartSwitch]() //手车
DisconnectorType = ecs.NewComponentType[Disconnector]() //隔离开关
WireCabinetType = ecs.NewComponentType[WireCabinet]() //线柜
LightningArresterType = ecs.NewComponentType[LightningArrester]() //避雷器
RectifierType = ecs.NewComponentType[Rectifier]() //整流器
VoltageTransformerType = ecs.NewComponentType[VoltageTransformer]() //变压器
PowerPipeType = ecs.NewComponentType[PowerPipe]() //电力母线
PowerSourceType = ecs.NewComponentType[PowerSource]()
)
// BackupZiTouInputTag 备自投投入、退出标签
var BackupZiTouInputTag = ecs.NewTag() //备自投投入标签