// Package orm define database data struct package orm import "github.com/gofrs/uuid" // BusbarSection define busbar section model type BusbarSection struct { // 母线基本参数 ComponentID int64 // compoent表ID BusbarName string // 母线端名称,默认值BusX BusbarNumber int // 母线编号,默认值1 UUID uuid.UUID `gorm:"column:global_uuid;primaryKey"` StandardVoltage float32 // 标准电压,单位kV,范围值在000.01~500.00 BusbarDesc string // 描述 IsService bool // 是否服役,值为运行/退出 Status string // 状态,值为现役/新建/计划/检修/库存可用/库存报废 PowerGridName string // 当前工程电网的顶层建模时的电网名称 RegionName string // 当前工程电网的顶层建模时的区域电网名称 FactoryStationName string // 当前工程电网的顶层建模时的厂站名称 // 母线模型参数 VoltagePercentValue float32 // 以母线标称电压为基准的百分数,默认值1.00~200.00 VoltageCalculcatedValue float32 // 通过StandardVoltage与VoltagePercentValtage计算得出的电压值,默认值0.01~1000.00 PhaseAngle float32 // 面向三相对称电网的属性值,可按A相电压考虑即可,默认值-180.00~180.00 RatedCurrent float32 // 母线额定电流,范围值0.01~65536 DynamicStableCurrent float32 // 母线动稳定电流,范围值0.01~65536 MinLoadAdjustmentCoefficient int // 最小母线负荷调整系数,范围值0-100 MaxLoadAdjustmentCoefficient int // 最大母线负荷调整系数,范围值0-500 BusbarType string // 母线类型,默认值PQ ReferenceVoltage float32 // 基准电压,单位kV,默认值37 ReferenceCurrent float32 // 基准电流,单位MVA,默认值100 MinS3Capacities float32 // 最小三项短路容量,范围值0.00~65536.00 MaxS3Capacities float32 // 最大三项短路容量,范围值0.00~65536.00 MinS3Current float32 // 最小三项短路电流,范围值0.00~65536.00 MaxS3Current float32 // 最大三项短路电流,范围值0.00~65536.00 MinZ3Impedance float32 // 最小三项短路阻抗,默认值 0.1,范围值0.0000~100.0000 MaxZ3Impedance float32 // 最大三项短路阻抗,默认值 0.05,范围值0.0000~100.0000 MinS1Capacity float32 // 最小单项短路容量,范围值0.00~65536.00 MaxS1Capacity float32 // 最大单项短路容量,范围值0.00~65536.00 MinS1Current float32 // 最小单项短路电流,范围值0.00~65536.00 MaxS1Current float32 // 最大单项短路电流,范围值0.00~65536.00 MinZ1Impedance float32 // 最小单项短路阻抗,默认值 0.1,范围值0.0000~100.0000 MaxZ1Impedance float32 // 最大单项短路阻抗,默认值 0.05,范围值0.0000~100.0000 // 母线稳定参数 UnderVoltageWarningThreshold int // 欠压预警阈值 UnderVoltageWarningRunningTime int // 欠压预警运行时间,默认值 10s,默认单位秒,默认范围值0s-100s UnderVoltageAlarmThreshold int // 欠压告警阈值 UnderVoltageAlarmRunningTime int // 欠压告警运行时间,默认值 10s,默认单位秒,默认范围值0s-100s OverVoltageWarningThreshold int // 过压预警阈值 OverVoltageWarningRunningTime int // 过压预警运行时间,默认值 10s,默认单位秒,默认范围值0s-100s OverVoltageAlarmThreshold int // 过压告警阈值 OverVoltageAlarmRunningTime int // 过压告警运行时间,默认值 10s,默认单位秒,默认范围值0s-100s PMax float32 // 有功储备裕度最大值 QMax float32 // 无功储备裕度最大值 Ulim float32 // 电压裕度 Plim float32 // 实时有功安全裕度限值,默认值30%,范围 0-100% Qlim float32 // 实时无功安全裕度限值,默认值30%,范围 0-100% // 母线间隔信息 MeasurementLevelCurrent []string // 测量级电流测点 MeasurementLevelVoltage []string // 测量级电压测点 ProtectionLevelCurrent []string // 保护级电流测点 ProtectionLevelVoltaget []string // 保护级电压测点 Trend []string // 潮流测点 Frequency []string // 频率测点 StatusMeasurementPoint []string // 状态测点测点 } // TableName func respresent return table name of busbar section func (b *BusbarSection) TableName() string { return "BusbarSection" } // SetComponentID func implement BasicModelInterface interface func (b *BusbarSection) SetComponentID(componentID int64) { b.ComponentID = componentID return } // ReturnTableName func implement BasicModelInterface interface func (b *BusbarSection) ReturnTableName() string { return "BusbarSection" } func NewBusbarSection(name string) (*BusbarSection, error) { uuid, err := uuid.NewV4() if err != nil { return nil, err } return &BusbarSection{ BusbarName: name, UUID: uuid, }, nil } func (b *BusbarSection) BusNameLenCheck() bool { if len([]rune(b.BusbarName)) > 20 { return false } return true } func (b *BusbarSection) BusVoltageCheck() bool { if b.StandardVoltage > 500.00 || b.StandardVoltage < 000.01 { return false } return true } func (b *BusbarSection) BusDescLenCheck() bool { if len([]rune(b.BusbarDesc)) > 100 { return false } return true }