init async motor table and busbar section table create sql

This commit is contained in:
douxu 2024-12-10 16:36:59 +08:00
parent 829279b22b
commit d9cc5f3738
6 changed files with 166 additions and 44 deletions

View File

@ -6,6 +6,6 @@ const (
NullableType = iota
// BusbarType 母线类型
BusbarType
// AsynchronousMotorType 异步电动机类型
AsynchronousMotorType
// AsyncMotorType 异步电动机类型
AsyncMotorType
)

View File

@ -10,7 +10,7 @@ import (
func SelectModelByType(modelType int) BasicModelInterface {
if modelType == constant.BusbarType {
return &orm.BusbarSection{}
} else if modelType == constant.AsynchronousMotorType {
} else if modelType == constant.AsyncMotorType {
return &orm.AsyncMotor{}
}
return nil

View File

@ -5,19 +5,21 @@ import "github.com/gofrs/uuid"
// AsyncMotor define asynchronous motor model
type AsyncMotor struct {
UUID uuid.UUID `gorm:"column:uuid;primaryKey"`
UUID uuid.UUID `gorm:"column:global_uuid;primaryKey"`
NoLoadVoltage float64 // 空载电压
NoLoadElectricCurrent float64 // 空载电流
NoLoadPower float64 // 空载电功率
BlockageF1Frequency float64 // 堵转 f1 频率
BlockageF1Voltage float64 // 堵转 f1 频率电压
BlockageF1ElectricCurrent float64 // 堵转 f1 频率电流
BlockageF1Power float64 // 堵转 f1 频率电功率
BlockageF2Frequency float64 // 堵转 f2 频率
BlockageF2Voltage float64 // 堵转 f2 频率电压
BlockageF2ElectricCurrent float64 // 堵转 f2 频率电流
BlockageF2Power float64 // 堵转 f2 频率电功率
APhaseDCResistor float64 // A相直流电阻
BPhaseDCResistor float64 // B相直流电阻
CPhaseDCResistor float64 // C相直流电阻
APhaseDCResistance float64 // A相直流电阻
BPhaseDCResistance float64 // B相直流电阻
CPhaseDCResistance float64 // C相直流电阻
RunningStatorResistance float64 // 运行定子电阻r1
StartUpStatorResistance float64 // 启动定子电阻r1
ColdStateStatorResistance float64 // 冷态定子电阻r1
@ -30,9 +32,9 @@ type AsyncMotor struct {
RunningEquivalentReactanceOfRotor float64 // 运行转子等值电抗x2
StartUpEquivalentReactanceOfRotor float64 // 启动转子等值电抗x2
ColdStateEquivalentReactanceOfRotor float64 // 冷态转子等值电抗x2
RunningExcitationResistor float64 // 运行励磁电阻Rfe
StartUpExcitationResistor float64 // 启动励磁电阻Rfe
ColdStateExcitationResistor float64 // 冷态励磁电阻Rfe
RunningExcitationResistance float64 // 运行励磁电阻Rfe
StartUpExcitationResistance float64 // 启动励磁电阻Rfe
ColdStateExcitationResistance float64 // 冷态励磁电阻Rfe
RunningExcitationReactance float64 // 运行励磁电抗Xm
StartUpExcitationReactance float64 // 启动励磁电抗Xm
ColdStateExcitationReactance float64 // 冷态励磁电抗Xm
@ -52,9 +54,9 @@ type AsyncMotor struct {
ElectricMotorHeatingTimeConstant float64 // 电动机发热时间常数Twu
ElectricMotorHeatDissipationTimeConstant float64 // 电动机散热时间常数Tcd
ThermalLoadCurve []float64 // 热载曲线坐标点
CompensationForEnvironmentalConditions int // 环境条件补偿环境温度
LowerLimitOfTerminalVoltage int // 机端电压下限
MaximumNumberOfStarts int // 起动次数上限
CompensationForEnvConditions int // 环境条件补偿环境温度
MinLimitOfTerminalVoltage int // 机端电压下限
MaxLimitOfStarts int // 起动次数上限
StartingStrategy string // 起动策略
NormalStartUpTime int // 起动转正常时间
RestartBatch int // 再起动批次
@ -66,23 +68,9 @@ type AsyncMotor struct {
Trend string // 潮流
Frequency string // 频率
StatusMeasurementPoint string // 状态测点
Mechanics string // 机械
Machinery string // 机械
}
/*
电流-测量级 Ia/Ib/Ic/I1/I2/I0
电压-测量级 "Ua/Ub/Uc/U1/U2/U0
Uab/Ubc/Uca/U^"
电流-保护级1 IA/IB/IC/I1/I2/I0/In
电流-保护级2 I'A/I'B/I'C
电压-保护级 "UA/UB/UC/U1/U2/U0
UAB/UBC/UCA/U^"
潮流 P/Q/S/PF
频率 f,df/dt
状态测点 Temp./PD/Vsp
机械 TL/n/s
*/
/*
(1)温度的格式为正整数0~500
(2)电阻和电抗的参数为正实数三位整数五位小数的格式XXX.XXXXX

View File

@ -6,11 +6,11 @@ import "github.com/gofrs/uuid"
// BusbarSection define busbar section model
type BusbarSection struct {
// 母线基本参数
Name string // 母线端名称,默认值BusX
BusbarName string // 母线端名称,默认值BusX
BusbarNumber int // 母线编号,默认值1
UUID uuid.UUID `gorm:"column:uuid;primaryKey"`
UUID uuid.UUID `gorm:"column:global_uuid;primaryKey"`
StandardVoltage float32 // 标准电压,单位kV,范围值在000.01~500.00
Desc string // 描述
BusbarDesc string // 描述
IsService bool // 是否服役,值为运行/退出
Status string // 状态,值为现役/新建/计划/检修/库存可用/库存报废
PowerGridName string // 当前工程电网的顶层建模时的电网名称
@ -24,9 +24,9 @@ type BusbarSection struct {
DynamicStableCurrent float32 // 母线动稳定电流,范围值0.01~65536
MinLoadAdjustmentCoefficient int // 最小母线负荷调整系数,范围值0-100
MaxLoadAdjustmentCoefficient int // 最大母线负荷调整系数,范围值0-500
BusbarType int // 母线类型,默认值PQ
ReferenceVoltage float32 // 母线类型,单位kV,默认值37
ReferenceVCurrent float32 // 母线类型,单位MVA,默认值100
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
@ -37,17 +37,17 @@ type BusbarSection struct {
MaxS1Capacity float32 // 最大单项短路容量,范围值0.00~65536.00
MinS1Current float32 // 最小单项短路电流,范围值0.00~65536.00
MaxS1Current float32 // 最大单项短路电流,范围值0.00~65536.00
MinS1Impedance float32 // 最小单项短路阻抗,默认值 0.1,范围值0.0000~100.0000
MaxS1Impedance float32 // 最大单项短路阻抗,默认值 0.05,范围值0.0000~100.0000
MinZ1Impedance float32 // 最小单项短路阻抗,默认值 0.1,范围值0.0000~100.0000
MaxZ1Impedance float32 // 最大单项短路阻抗,默认值 0.05,范围值0.0000~100.0000
// 母线稳定参数
UnderVoltageWarningThreshold int // 欠压预警阈值
UnderVoltageWarningRunningTime float32 // 欠压预警运行时间,默认值 10s,默认单位秒默认范围值0s-100s
UnderVoltageWarningRunningTime int // 欠压预警运行时间,默认值 10s,默认单位秒默认范围值0s-100s
UnderVoltageAlarmThreshold int // 欠压告警阈值
UnderVoltageAlarmRunningTime float32 // 欠压告警运行时间,默认值 10s,默认单位秒默认范围值0s-100s
UnderVoltageAlarmRunningTime int // 欠压告警运行时间,默认值 10s,默认单位秒默认范围值0s-100s
OverVoltageWarningThreshold int // 过压预警阈值
OverVoltageWarningRunningTime float32 // 过压预警运行时间,默认值 10s,默认单位秒默认范围值0s-100s
OverVoltageWarningRunningTime int // 过压预警运行时间,默认值 10s,默认单位秒默认范围值0s-100s
OverVoltageAlarmThreshold int // 过压告警阈值
OverVoltageAlarmRunningTime float32 // 过压告警运行时间,默认值 10s,默认单位秒默认范围值0s-100s
OverVoltageAlarmRunningTime int // 过压告警运行时间,默认值 10s,默认单位秒默认范围值0s-100s
PMax float32 // 有功储备裕度最大值
QMax float32 // 无功储备裕度最大值
Ulim float32 // 电压裕度
@ -85,13 +85,13 @@ func NewBusbarSection(name string) (*BusbarSection, error) {
return nil, err
}
return &BusbarSection{
Name: name,
UUID: uuid,
BusbarName: name,
UUID: uuid,
}, nil
}
func (b *BusbarSection) BusNameLenCheck() bool {
if len([]rune(b.Name)) > 20 {
if len([]rune(b.BusbarName)) > 20 {
return false
}
return true
@ -105,7 +105,7 @@ func (b *BusbarSection) BusVoltageCheck() bool {
}
func (b *BusbarSection) BusDescLenCheck() bool {
if len([]rune(b.Desc)) > 100 {
if len([]rune(b.BusbarDesc)) > 100 {
return false
}
return true

72
sql/async_motor.sql Normal file
View File

@ -0,0 +1,72 @@
CREATE TABLE public."AsyncMotor" (
id serial NOT NULL,
global_uuid uuid NOT NULL,
noload_voltage decimal(7, 2) NOT NULL,
noload_electric_current decimal(7, 2) NOT NULL,
noload_power decimal(7, 2) NOT NULL,
blockage_f1_frequency decimal(5, 2) NOT NULL,
blockage_f1_voltage decimal(7, 2) NOT NULL,
blockage_f1_electric_current decimal(7, 2) NOT NULL,
blockage_f1_power decimal(7, 2) NOT NULL,
blockage_f2_frequency decimal(5, 2) NOT NULL,
blockage_f2_voltage decimal(7, 2) NOT NULL,
blockage_f2_electric_current decimal(7, 2) NOT NULL,
blockage_f2_power decimal(7, 2) NOT NULL,
a_phase_dc_resistance decimal(7, 2) NOT NULL,
b_phase_dc_resistance decimal(7, 2) NOT NULL,
c_phase_dc_resistance decimal(7, 2) NOT NULL,
running_stator_resistance decimal(8, 5) NOT NULL,
startup_stator_resistance decimal(8, 5) NOT NULL,
coldstate_stator_resistance decimal(8, 5) NOT NULL,
running_stator_reactance decimal(8, 5) NOT NULL,
startup_stator_reactance decimal(8, 5) NOT NULL,
coldstate_stator_reactance decimal(8, 5) NOT NULL,
running_equivalent_resistance_of_rotor decimal(8, 5) NOT NULL,
startup_equivalent_resistance_of_rotor decimal(8, 5) NOT NULL,
coldstate_equivalent_resistance_of_rotor decimal(8, 5) NOT NULL,
running_equivalent_reactance_of_rotor decimal(8, 5) NOT NULL,
startup_equivalent_reactance_of_rotor decimal(8, 5) NOT NULL,
coldtsate_equivalent_reactance_of_rotor decimal(8, 5) NOT NULL,
running_excitation_resistance decimal(8, 5) NOT NULL,
startup_excitation_resistance decimal(8, 5) NOT NULL,
coldstate_excitation_resistance decimal(8, 5) NOT NULL,
running_excitation_reactance decimal(8, 5) NOT NULL,
startup_excitation_reactance decimal(8, 5) NOT NULL,
coldstate_excitation_reactance decimal(8, 5) NOT NULL,
running_temperature integer NOT NULL,
startup_temperature integer NOT NULL,
coldstate_temperature integer NOT NULL,
eis character varying(10) default 'f' NOT NULL,
temperature_limit integer NOT NULL,
temperature_rise_limit integer NOT NULL,
coldstate_allows_continuous_starting_times integer default 2 NOT NULL,
hotstate_allows_continuous_starting_times integer default 1 NOT NULL,
prohibition_of_restart_for_shortest_time decimal(4, 1) default 30 NOT NULL,
hotstate_allows_blockage_time decimal(5, 2) default 10 NOT NULL,
coldstate_allows_blockage_time decimal(5, 2) default 6 NOT NULL,
electric_motor_heating_time_constant decimal(5, 2) default 100 NOT NULL,
electric_motor_heat_dissipation_time_constant decimal(5, 2) default 300 NOT NULL,
thermal_load_curve decimal(5, 2) [] NOT NULL,
compensation_for_env_conditions decimal(5, 2) NOT NULL,
min_limit_of_terminal_voltage integer default 80 NOT NULL,
max_limit_of_tarts integer NOT NULL,
starting_strategy character varying(10) NOT NULL,
normal_startup_time integer NOT NULL,
restart_batch integer NOT NULL,
electric_current_measurement_level character varying(10) NOT NULL,
voltage_measurement_level character varying(10) NOT NULL,
electric_current_protection_level1 character varying(10) NOT NULL,
electric_current_protection_level2 character varying(10) NOT NULL,
voltage_protection_level character varying(10) NOT NULL,
trend character varying(10) NOT NULL,
frequency character varying(10) NOT NULL,
status_measurement_point character varying(10) NOT NULL,
machinery character varying(10) NOT NULL,
context jsonb NULL,
comment character varying(4096) NULL
);
ALTER TABLE
public."AsyncMotor"
ADD
CONSTRAINT "AsyncMotor_pkey" PRIMARY KEY (global_uuid)

62
sql/busbar_section.sql Normal file
View File

@ -0,0 +1,62 @@
CREATE TABLE public."BusbarSection" (
id serial NOT NULL,
global_uuid uuid NOT NULL,
busbar_number integer NOT NULL,
busbar_name character varying(20) default 'Busx' NOT NULL,
standard_voltage decimal(5, 2) NOT NULL,
busbar_desc character varying(100) NOT NULL,
is_service boolean NULL default false,
status character varying(10) NOT NULL,
power_grid_name character varying(10) NOT NULL,
region_name character varying(10) NOT NULL,
factory_station_name character varying(10) NOT NULL,
voltage_percent_value decimal(5, 2) default 100 NOT NULL,
voltage_calculcated_value decimal(5, 2) default 35 NOT NULL,
phase_angle decimal(5, 2) default 0 NOT NULL,
rated_current decimal(7, 2) default 1000 NOT NULL,
dynamic_stable_current decimal(7, 2) default 40 NOT NULL,
min_load_adjustment_coefficient integer default 100 NOT NULL,
max_load_adjustment_coefficient integer default 100 NOT NULL,
busbar_type character varying(10) NOT NULL,
min_s3_capacities decimal(7, 2) default 0 NOT NULL,
max_s3_capacities decimal(7, 2) default 0 NOT NULL,
min_s3_current decimal(7, 2) default 0 NOT NULL,
max_s3_current decimal(7, 2) default 0 NOT NULL,
max_z3_impedance decimal(6, 3) default 0.05 NOT NULL,
min_z3_impedance decimal(6, 3) default 0.1 NOT NULL,
min_s1_capacity decimal(7, 2) default 0 NOT NULL,
max_s1_capacity decimal(7, 2) default 0 NOT NULL,
min_s1_current decimal(7, 2) default 0 NOT NULL,
max_s1_current decimal(7, 2) default 0 NOT NULL,
min_z1_impedance decimal(7, 4) default 0 NOT NULL,
max_z1_impedance decimal(7, 4) default 0 NOT NULL,
reference_voltage decimal(5, 2) default 37 NOT NULL,
reference_current decimal(7, 2) default 100 NOT NULL,
under_voltage_warning_threshold integer default 95 NOT NULL,
under_voltage_warning_running_time integer default 10 NOT NULL,
under_voltage_alarm_threshold integer default 90 NOT NULL,
under_voltage_alarm_running_time integer default 10 NOT NULL,
over_voltage_warning_threshold integer default 105 NOT NULL,
over_voltage_warning_running_time integer default 60 NOT NULL,
over_voltage_alarm_threshold integer default 110 NOT NULL,
over_voltage_alarm_running_time integer default 10 NOT NULL,
p_max decimal(7, 2) default 0 NOT NULL,
q_max decimal(7, 2) default 0 NOT NULL,
ulim decimal(5, 2) default 90 NOT NULL,
plim decimal(5, 2) default 30 NOT NULL,
qlim decimal(5, 2) default 30 NOT NULL,
measurement_level_current character varying(10) NOT NULL,
measurement_level_voltage character varying(10) NOT NULL,
protection_level_current character varying(10) NOT NULL,
protection_level_voltage_t character varying(10) NOT NULL,
trend character varying(10) NOT NULL,
frequency character varying(10) NOT NULL,
status_measurement_point character varying(10) NOT NULL,
context jsonb NULL,
comment character varying(4096) NULL
);
ALTER TABLE
public."BusbarSection"
ADD
CONSTRAINT "BusbarSection_pkey" PRIMARY KEY (global_uuid)