diff --git a/model/model_select.go b/model/model_select.go index 5921a69..d1b22fe 100644 --- a/model/model_select.go +++ b/model/model_select.go @@ -10,14 +10,13 @@ import ( func SelectModelByType(modelType int) BasicModelInterface { if modelType == constant.BusbarType { return &orm.BusbarSection{} + } else if modelType == constant.AsynchronousMotorType { + return &orm.AsyncMotor{} } return nil } // SelectModelNameByType define select the data structure name for parsing based on the input model type func SelectModelNameByType(modelType int) string { - if modelType == constant.BusbarType { - return "BusBarSection" - } - return "" + return SelectModelByType(modelType).ReturnTableName() } diff --git a/orm/async_motor.go b/orm/async_motor.go new file mode 100644 index 0000000..a53cf61 --- /dev/null +++ b/orm/async_motor.go @@ -0,0 +1,105 @@ +// Package orm define database data struct +package orm + +import "github.com/gofrs/uuid" + +// AsyncMotor define asynchronous motor model +type AsyncMotor struct { + UUID uuid.UUID `gorm:"column:uuid;primaryKey"` + NoLoadVoltage float64 // 空载电压 + NoLoadElectricCurrent float64 // 空载电流 + NoLoadPower float64 // 空载电功率 + BlockageF1Voltage float64 // 堵转 f1 频率电压 + BlockageF1ElectricCurrent float64 // 堵转 f1 频率电流 + BlockageF1Power float64 // 堵转 f1 频率电功率 + BlockageF2Voltage float64 // 堵转 f2 频率电压 + BlockageF2ElectricCurrent float64 // 堵转 f2 频率电流 + BlockageF2Power float64 // 堵转 f2 频率电功率 + APhaseDCResistor float64 // A相直流电阻 + BPhaseDCResistor float64 // B相直流电阻 + CPhaseDCResistor float64 // C相直流电阻 + RunningStatorResistance float64 // 运行定子电阻r1 + StartUpStatorResistance float64 // 启动定子电阻r1 + ColdStateStatorResistance float64 // 冷态定子电阻r1 + RunningStatorReactance float64 // 运行定子电抗x1 + StartUpStatorReactance float64 // 启动定子电抗x1 + ColdStateStatorReactance float64 // 冷态定子电抗x1 + RunningEquivalentResistanceOfRotor float64 // 运行转子等值电阻r2 + StartUpEquivalentResistanceOfRotor float64 // 启动转子等值电阻r2 + ColdStateEquivalentResistanceOfRotor float64 // 冷态转子等值电阻r2 + RunningEquivalentReactanceOfRotor float64 // 运行转子等值电抗x2 + StartUpEquivalentReactanceOfRotor float64 // 启动转子等值电抗x2 + ColdStateEquivalentReactanceOfRotor float64 // 冷态转子等值电抗x2 + RunningExcitationResistor float64 // 运行励磁电阻Rfe + StartUpExcitationResistor float64 // 启动励磁电阻Rfe + ColdStateExcitationResistor float64 // 冷态励磁电阻Rfe + RunningExcitationReactance float64 // 运行励磁电抗Xm + StartUpExcitationReactance float64 // 启动励磁电抗Xm + ColdStateExcitationReactance float64 // 冷态励磁电抗Xm + RunningTemperature int // 运行温度 + StartUpTemperature int // 启动温度 + ColdStateTemperature int // 冷态温度 + + // 热限制曲线参数 + EIS string // 电动机定子绕组绝缘结构热分级,枚举值类型105(A)/120(E)/130(B)/155(F)/180(H),默认值155(F) + TemperatureLimit int // 温度限值,范围值0-1000 + TemperatureRiseLimit int // 温升限值,范围值0-1000 + ColdStateAllowsContinuousStartingTimes int // 冷态允许连续起动次数 + HotStateAllowsContinuousStartingtimes int // 热态允许连续起动次数 + ProhibitionOfRestartForShortestTime float64 // 禁止重起动最短时间 + HotStateAllowsBlockageTime float64 // 热态允许堵转时间Ta + ColdStateAllowsBlockageTime float64 // 冷态允许堵转时间To + ElectricMotorHeatingTimeConstant float64 // 电动机发热时间常数Twu + ElectricMotorHeatDissipationTimeConstant float64 // 电动机散热时间常数Tcd + ThermalLoadCurve []float64 // 热载曲线坐标点 + CompensationForEnvironmentalConditions int // 环境条件补偿环境温度 + LowerLimitOfTerminalVoltage int // 机端电压下限 + MaximumNumberOfStarts int // 起动次数上限 + StartingStrategy string // 起动策略 + NormalStartUpTime int // 起动转正常时间 + RestartBatch int // 再起动批次 + ElectricCurrentMeasurementLevel string // 电流测量级 + VoltageMeasurementLevel string // 电压测量级 + ElectricCurrentProtectionLevel1 string // 电流保护级1 + ElectricCurrentProtectionLevel2 string // 电流保护级1 + VoltageProtectionLevel string // 电压保护级 + Trend string // 潮流 + Frequency string // 频率 + StatusMeasurementPoint string // 状态测点 + Mechanics 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 +*/ + +// TableName func respresent return table name of asynchronous motor +func (a *AsyncMotor) TableName() string { + return "AsyncMotor" +} + +// SetUUID func implement BasicModelInterface interface +func (a *AsyncMotor) SetUUID(uuid uuid.UUID) { + a.UUID = uuid + return +} + +// ReturnTableName func implement BasicModelInterface interface +func (a *AsyncMotor) ReturnTableName() string { + return "AsyncMotor" +} diff --git a/orm/busbar_section.go b/orm/busbar_section.go index edf2e8d..e251224 100644 --- a/orm/busbar_section.go +++ b/orm/busbar_section.go @@ -3,6 +3,7 @@ package orm import "github.com/gofrs/uuid" +// BusbarSection define busbar section model type BusbarSection struct { // 母线基本参数 Name string // 母线端名称,默认值BusX @@ -62,7 +63,7 @@ type BusbarSection struct { StatusMeasurementPoint []string // 状态测点测点 } -// TableName func respresent return table name of BusbarSection +// TableName func respresent return table name of busbar section func (b *BusbarSection) TableName() string { return "BusbarSection" }