Buildings.Electrical.AC.OnePhase.Loads

Package with load models for one phase AC systems

Information

This package contains models that represent different types of AC single phase loads.

Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).

Package Content

Name Description
Buildings.Electrical.AC.OnePhase.Loads.Capacitive Capacitive Model of a capacitive and resistive load
Buildings.Electrical.AC.OnePhase.Loads.Impedance Impedance Model of a generic impedance
Buildings.Electrical.AC.OnePhase.Loads.Inductive Inductive Model of an inductive and resistive load
Buildings.Electrical.AC.OnePhase.Loads.Resistive Resistive Model of a resistive load
Buildings.Electrical.AC.OnePhase.Loads.Examples Examples Package with example models

Buildings.Electrical.AC.OnePhase.Loads.Capacitive Buildings.Electrical.AC.OnePhase.Loads.Capacitive

Model of a capacitive and resistive load

Buildings.Electrical.AC.OnePhase.Loads.Capacitive

Information

Model of an capacitive load. It may be used to model a bank of capacitors.

The model computes the complex power vector as

S = P + jQ = V ⋅ i*

where V is the voltage phasor and i* is the complex conjugate of the current phasor. The voltage and current phasors are shifted by an angle φ.

The load model takes as input the power consumed by the inductive load and the power factor pf=cos(φ). The power can be either fixed using the parameter P_nominal, or it is possible to specify a variable power using the inputs y or Pow. The power factor can be either specified by the parameter pf or using the input variable pf_in. The different modes can be selected with the parameter mode and use_pf_in, see Buildings.Electrical.Interfaces.Load and Buildings.Electrical.Interfaces.CapacitiveLoad for more information.

Given the active power P and the power factor pf the complex power Q is computed as

Q = - P tan(arccos(pf)).

The equations of the model can be rewritten as

i1 = (P V1 + Q V2)/(V12 + V22),

i2 = (P V2 - Q V1)/(V12 + V22),

where i1, i2, V1, and V2 are the real and imaginary parts of the current and voltage phasors.

The nonlinearity of the model is due to the fact that the load consumes the power specified by the variables P and Q irrespectively of the voltage of the load.

When multiple loads are connected in a grid through cables that cause voltage drops, the dimension of the system of nonlinear equations increases linearly with the number of loads. This nonlinear system of equations introduces challenges during the initialization, as Newton solvers may diverge if initialized far from a solution, as well during the simulation. In this situation, the model can be parameterized to use a linear approximation as discussed in the next section.

Linearized model

Given the constraints and the two-dimensional nature of the problem, it is difficult to find a linearized version of the AC load model. A solution could be to divide the voltage domain into sectors, and for each sector compute the best linear approximation. However the selection of the proper approximation depending on the value of the voltage can generate events that increase the simulation time. For these reasons, the linearized model assumes a voltage that is equal to the nominal value

i1 = (P V1 + Q V2)/VRMS2,

i2 = (P V2 - Q V1)/VRMS2,

where VRMS is the Root Mean Square voltage os the AC system. Even though this linearized version of the load model introduces an approximation error in the current, it satisfies the constraints related to the ratio of the active and reactive powers.

Initialization

The initialization problem can be simplified using the homotopy operator. The homotopy operator uses two different types of equations to compute the value of a variable: the actual one and a simplified one. The actual equation is the one used during the normal operation. During initialization, the simplified equation is first solved and then slowly replaced with the actual equation to compute the initial values for the nonlinear systems of equations. The load model uses the homotopy operator, with the linearized model being used as the simplified equation. This numerical expedient has proven useful when simulating models with more than ten connected loads.

The load model has a parameter initMode that can be used to select the assumption to use during the initialization phase by the homotopy operator. The choices are between a null current or the linearized model.

Extends from Buildings.Electrical.Interfaces.CapacitiveLoad (Partial model of a capacitive load).

Parameters

TypeNameDefaultDescription
replaceable package PhaseSystemPartialPhaseSystemPhase system
Modeling assumption
BooleanlinearizedfalseIf true, the load model is linearized
LoadmodeBuildings.Electrical.Types.L...Type of load model (e.g., steady state, dynamic, prescribed power consumption, etc.)
Booleanuse_pf_infalseIf true, the power factor is defined by an input
Nominal conditions
PowerP_nominal0Nominal power (negative if consumed, positive if generated). Used if mode <> Buildings.Electrical.Types.Load.VariableZ_P_input [W]
VoltageV_nominal.start110Nominal voltage (V_nominal >= 0) [V]
Realpf0.8Power factor
Initialization
Currenti.start[:]0Current vector [A]
PowerP.start0Power of the load (negative if consumed, positive if fed into the electrical grid) [W]
Initialization
InitModeinitModeBuildings.Electrical.Types.I...Initialization mode for homotopy operator

Connectors

TypeNameDescription
replaceable package PhaseSystemPhase system
input RealInputyFraction of the nominal power consumed [1]
input RealInputPowPower consumed [W]
Terminal_nterminalGeneralized electric terminal
input RealInputpf_inPower factor [1]

Modelica definition

model Capacitive "Model of a capacitive and resistive load" extends Buildings.Electrical.Interfaces.CapacitiveLoad( redeclare package PhaseSystem = PhaseSystems.OnePhase, redeclare replaceable Interfaces.Terminal_n terminal, V_nominal(start = 110)); protected Modelica.Units.SI.Angle theRef "Absolute angle of rotating reference system"; initial equation if mode == Buildings.Electrical.Types.Load.FixedZ_dynamic then // q = Y[2]*{V_nominal, 0}/omega; // Steady state initialization der(q) = zeros(PhaseSystem.n); end if; equation theRef = PhaseSystem.thetaRef(terminal.theta); omega = der(theRef); if mode == Buildings.Electrical.Types.Load.FixedZ_dynamic then // Use the dynamic phasorial representation Y[1] = -(P_nominal/pf)*pf/V_nominal^2; Y[2] = -(P_nominal/pf)*Modelica.Fluid.Utilities.regRoot(1 - pf^2, delta=0.001)/V_nominal^2; // Electric charge q = Y[2]*{v[1], v[2]}/omega; // Dynamics of the system der(q) + omega*j(q) + Y[1]*v = i; else // Use the power specified by the parameter or inputs if linearized then i[1] = -homotopy(actual= (v[2]*Q + v[1]*P)/(V_nominal^2), simplified= v[1]*Modelica.Constants.eps*1e3); i[2] = -homotopy(actual= (v[2]*P - v[1]*Q)/(V_nominal^2), simplified= v[2]*Modelica.Constants.eps*1e3); else if initMode == Buildings.Electrical.Types.InitMode.zero_current then i[1] = -homotopy(actual=(v[2]*Q + v[1]*P)/(v[1]^2 + v[2]^2), simplified=0.0); i[2] = -homotopy(actual=(v[2]*P - v[1]*Q)/(v[1]^2 + v[2]^2), simplified=0.0); else i[1] = -homotopy(actual=(v[2]*Q + v[1]*P)/(v[1]^2 + v[2]^2), simplified=(v[2]*Q + v[1]*P)/(V_nominal^2)); i[2] = -homotopy(actual=(v[2]*P - v[1]*Q)/(v[1]^2 + v[2]^2), simplified=(v[2]*P - v[1]*Q)/(V_nominal^2)); end if; end if; Y = {0, 0}; q = {0, 0}; end if; end Capacitive;

Buildings.Electrical.AC.OnePhase.Loads.Impedance Buildings.Electrical.AC.OnePhase.Loads.Impedance

Model of a generic impedance

Buildings.Electrical.AC.OnePhase.Loads.Impedance

Information

Model of an impedance. This model can be used to represent any type of resistive, inductive or capacitive load.

Note that the power consumed by the impedance model will drecrease if its voltage decreases.

The model of the impedance is

V = Z i,

where Z = R + j X is the impedance. The value of the resistance R and the reactance X depend on the type of impedance. Different types of impedances can be selected using the boolean parameters inductive, use_R_in, use_L_in, and use_C_in. See Buildings.Electrical.Interfaces.Impedance for more details.

Extends from Buildings.Electrical.Interfaces.Impedance (Partial model representing a generalized impedance).

Parameters

TypeNameDefaultDescription
replaceable package PhaseSystemPartialPhaseSystemPhase system
BooleaninductivetrueIf true, the load is inductive, otherwise it is capacitive
ResistanceR1Resistance [Ohm]
InductanceL0Inductance [H]
CapacitanceC0Capacitance [F]
Initialization
Currenti.start[:]0Current vector [A]
PowerP.start0Power of the load (negative if consumed, positive if fed into the electrical grid) [W]
Initialization
InitModeinitModeBuildings.Electrical.Types.I...Initialization mode for homotopy operator
Variable load
Resistance
Booleanuse_R_infalseIf true, R is specified by an input
ResistanceRMin1e-4Minimum value of the resistance [Ohm]
ResistanceRMax1e2Maximum value of the resistance [Ohm]
Capacitance
Booleanuse_C_infalseIf true, C is specified by an input
CapacitanceCMin1e-4Minimum value of the capacitance [F]
CapacitanceCMax1e2Maximum value of the capacitance [F]
Inductance
Booleanuse_L_infalseIf true, L is specified by an input
InductanceLMin1e-4Minimum value of the inductance [H]
InductanceLMax1e2Maximum value of the inductance [H]

Connectors

TypeNameDescription
replaceable package PhaseSystemPhase system
input RealInputyFraction of the nominal power consumed [1]
input RealInputPowPower consumed [W]
Terminal_nterminalGeneralized electric terminal
input RealInputy_RInput that sepecify variable R
input RealInputy_CInput that sepecify variable C
input RealInputy_LInput that sepecify variable L

Modelica definition

model Impedance "Model of a generic impedance" extends Buildings.Electrical.Interfaces.Impedance( redeclare replaceable package PhaseSystem = PhaseSystems.OnePhase, redeclare replaceable Interfaces.Terminal_n terminal); protected Modelica.Units.SI.Angle theRef "Absolute angle of rotating reference system"; Modelica.Units.SI.AngularVelocity omega "Frequency of the quasi-stationary sine waves"; Modelica.Units.SI.Reactance X(start=1) "Complex component of the impedance"; equation theRef = PhaseSystem.thetaRef(terminal.theta); omega = der(theRef); if inductive then X = omega*L_internal; else X = -1/(omega*C_internal); end if; terminal.v = {{R_internal,-X}*terminal.i, {X,R_internal}*terminal.i}; end Impedance;

Buildings.Electrical.AC.OnePhase.Loads.Inductive Buildings.Electrical.AC.OnePhase.Loads.Inductive

Model of an inductive and resistive load

Buildings.Electrical.AC.OnePhase.Loads.Inductive

Information

Model of an inductive load. It may be used to model an inductive motor.

The model computes the complex power vector as

S = P + jQ = V ⋅ i*,

where V is the voltage phasor and i* is the complex conjugate of the current phasor. The voltage and current phasors are shifted by an angle φ.

The load model takes as input the power consumed by the inductive load and the power factor pf=cos(φ). The power can be either fixed using the parameter P_nominal, or it is possible to specify a variable power using the inputs y or Pow. The power factor can be either specified by the parameter pf or using the input connector pf_in. The different modes can be selected with the parameter mode and use_pf_in, see Buildings.Electrical.Interfaces.Load and Buildings.Electrical.Interfaces.InductiveLoad for more information.

Given the active power P and the power factor pf, the complex power Q is computed as

Q = P tan(arccos(pf)).

The equations of the model can be rewritten as

i1 = (P V1 + Q V2)/(V12 + V22),

i2 = (P V2 - Q V1)/(V12 + V22),

where i1, i2, V1, and V2 are the real and imaginary parts of the current and voltage phasors.

The nonlinearity of the model is due to the fact that the load consumes the power specified by the variables P and Q, irrespectively of the voltage of the load.

When multiple loads are connected in a grid through cables that cause voltage drops, the dimension of the system of nonlinear equations increases linearly with the number of loads. This nonlinear system of equations introduces challenges during the initialization, as Newton solvers may diverge if initialized far from a solution, as well during the simulation. In this situation, the model can be parameterized to use a linear approximation as discussed in the next section.

Linearized model

Given the constraints and the two-dimensional nature of the problem, it is difficult to find a linearized version of the AC load model. A solution could be to divide the voltage domain into sectors, and for each sector compute the best linear approximation. However the selection of the proper approximation depending on the value of the voltage can generate events that increase the simulation time. For these reasons, the linearized model assumes a voltage that is equal to the nominal value

i1 = (P V1 + Q V2)/VRMS2,

i2 = (P V2 - Q V1)/VRMS2,

where VRMS is the Root Mean Square voltage of the AC system. Even though this linearized version of the load model introduces an approximation error in the current, it satisfies the constraints related to the ratio of the active and reactive powers.

Initialization

The initialization problem can be simplified using the homotopy operator. The homotopy operator uses two different types of equations to compute the value of a variable: the actual one and a simplified one. The actual equation is the one used during the normal operation. During initialization, the simplified equation is first solved and then slowly replaced with the actual equation to compute the initial values for the nonlinear systems of equations. The load model uses the homotopy operator, with the linearized model being used as the simplified equation. This numerical expedient has proven useful when simulating models with more than ten connected loads.

The load model has a parameter initMode that can be used to select the assumption to use during the initialization phase by the homotopy operator. The choices are between a null current or the linearized model.

Extends from Buildings.Electrical.Interfaces.InductiveLoad (Partial model of an inductive load).

Parameters

TypeNameDefaultDescription
replaceable package PhaseSystemPartialPhaseSystemPhase system
Modeling assumption
BooleanlinearizedfalseIf true, the load model is linearized
LoadmodeBuildings.Electrical.Types.L...Type of load model (e.g., steady state, dynamic, prescribed power consumption, etc.)
Booleanuse_pf_infalseIf true, the power factor is defined by an input
Nominal conditions
PowerP_nominal0Nominal power (negative if consumed, positive if generated). Used if mode <> Buildings.Electrical.Types.Load.VariableZ_P_input [W]
VoltageV_nominal.start110Nominal voltage (V_nominal >= 0) [V]
Realpf0.8Power factor
Initialization
Currenti.start[:]0Current vector [A]
PowerP.start0Power of the load (negative if consumed, positive if fed into the electrical grid) [W]
Initialization
InitModeinitModeBuildings.Electrical.Types.I...Initialization mode for homotopy operator

Connectors

TypeNameDescription
replaceable package PhaseSystemPhase system
input RealInputyFraction of the nominal power consumed [1]
input RealInputPowPower consumed [W]
Terminal_nterminalGeneralized electric terminal
input RealInputpf_inPower factor [1]

Modelica definition

model Inductive "Model of an inductive and resistive load" extends Buildings.Electrical.Interfaces.InductiveLoad( redeclare package PhaseSystem = PhaseSystems.OnePhase, redeclare replaceable Interfaces.Terminal_n terminal, V_nominal(start = 110)); protected Modelica.Units.SI.Angle theRef "Absolute angle of rotating reference system"; initial equation if mode == Buildings.Electrical.Types.Load.FixedZ_dynamic then // psi = Z[2]*{P_nominal/V_nominal, 0}/omega; // Steady state initialization der(psi) = zeros(PhaseSystem.n); end if; equation theRef = PhaseSystem.thetaRef(terminal.theta); omega = der(theRef); if mode == Buildings.Electrical.Types.Load.FixedZ_dynamic then // Use the dynamic phasorial representation Z[1] = -pf*(V_nominal^2)/(P_nominal/pf); Z[2] = -Modelica.Fluid.Utilities.regRoot(1-pf^2, delta=0.001)*(V_nominal^2)/(P_nominal/pf); // Dynamics of the system der(psi) + omega*j(psi) + Z[1]*i = v; // Magnetic flux psi = Z[2]*{i[1], i[2]}/omega; else // Use the power specified by the parameter or inputs if linearized then i[1] = -homotopy(actual= (v[2]*Q + v[1]*P)/(V_nominal^2), simplified= v[1]*Modelica.Constants.eps*1e3); i[2] = -homotopy(actual= (v[2]*P - v[1]*Q)/(V_nominal^2), simplified= v[2]*Modelica.Constants.eps*1e3); else //PhaseSystem.phasePowers_vi(terminal.v, terminal.i) = PhaseSystem.phasePowers(P, Q); if initMode == Buildings.Electrical.Types.InitMode.zero_current then i[1] = -homotopy(actual = (v[2]*Q + v[1]*P)/(v[1]^2 + v[2]^2), simplified= 0.0); i[2] = -homotopy(actual = (v[2]*P - v[1]*Q)/(v[1]^2 + v[2]^2), simplified= 0.0); else i[1] = -homotopy(actual = (v[2]*Q + v[1]*P)/(v[1]^2 + v[2]^2), simplified= (v[2]*Q + v[1]*P)/(V_nominal^2)); i[2] = -homotopy(actual = (v[2]*P - v[1]*Q)/(v[1]^2 + v[2]^2), simplified= (v[2]*P - v[1]*Q)/(V_nominal^2)); end if; end if; Z = {0,0}; psi = {0,0}; end if; end Inductive;

Buildings.Electrical.AC.OnePhase.Loads.Resistive Buildings.Electrical.AC.OnePhase.Loads.Resistive

Model of a resistive load

Buildings.Electrical.AC.OnePhase.Loads.Resistive

Information

Model of a resistive load. It may be used to model a load that has a power factor of one.

The model computes the complex power vector as

S = P + jQ = V ⋅ i*

where V is the voltage phasor and i* is the complex conjugate of the current phasor.

The load model takes as input the power consumed by the inductive load and the power factor pf=cos(φ). The power can be either fixed using the parameter P_nominal, or it is possible to specify a variable power using the inputs y or Pow. The different modes can be selected with the parameter mode, see Buildings.Electrical.Interfaces.Load for more information.

The equations of the model can be rewritten as

i1 = (P V1 + Q V2)/(V12 + V22),

i2 = (P V2 - Q V1)/(V12 + V22),

where i1, i2, V1, and V2 are the real and imaginary parts of the current and voltage phasors.

Since the model represents a load with a power factor of one, the complex power is Q = 0. This leads to the following equations where there are nonlinear equations that relate the current to the voltage

i1 = P V1/(V12 + V22)

i2 = P V2/(V12 + V22)

The non-linearity is due to the fact that the load consumes the power specified by the variable P, irrespectively of the voltage of the load. The figure below shows the relationship between the real part of the current phasor and the real and imaginary voltages of the load.

image

When multiple loads are connected in a grid through cables that cause voltage drops, the dimension of the system of nonlinear equations increases linearly with the number of loads. This nonlinear system of equations introduces challenges during the initialization, as Newton solvers may diverge if initialized far from a solution, as well during the simulation. In this situation, the model can be parameterized to use a linear approximation as discussed in the next section.

Linearized model

Given the constraints and the two-dimensional nature of the problem, it is difficult to find a linearized version of the AC load model. A solution could be to divide the voltage domain into sectors, and for each sector compute the best linear approximation. However, the selection of the proper approximation depending on the value of the voltage can generate events that increase the simulation time. For these reasons, the linearized model assumes a voltage that is equal to the nominal value

i1 = P V1/VRMS2

i2 = P V2/VRMS2

where VRMS is the Root Mean Square voltage of the AC system. Even though this linearized version of the load model introduces an approximation error in the current, it satisfies the constraints related to the ratio of the active and reactive powers.

The image below show the linearized function

image

Initialization

The initialization problem can be simplified using the homotopy operator. The homotopy operator uses two different types of equations to compute the value of a variable: the actual one and a simplified one. The actual equation is the one used during the normal operation. During initialization, the simplified equation is first solved and then slowly replaced with the actual equation to compute the initial values for the nonlinear system of equations. The load model uses the homotopy operator, with the linearized model being used as the simplified equation. This numerical expedient has proven useful when simulating models with more than ten connected loads.

The load model has a parameter initMode that can be used to select the assumption to use during the initialization phase by the homotopy operator. The choices are between a null current or the linearized model.

Extends from Buildings.Electrical.Interfaces.ResistiveLoad (Partial model of a resistive load).

Parameters

TypeNameDefaultDescription
replaceable package PhaseSystemPartialPhaseSystemPhase system
Modeling assumption
BooleanlinearizedfalseIf true, the load model is linearized
LoadmodeBuildings.Electrical.Types.L...Type of load model (e.g., steady state, dynamic, prescribed power consumption, etc.)
Nominal conditions
PowerP_nominal0Nominal power (negative if consumed, positive if generated). Used if mode <> Buildings.Electrical.Types.Load.VariableZ_P_input [W]
VoltageV_nominal.start110Nominal voltage (V_nominal >= 0) [V]
Initialization
Currenti.start[:]0Current vector [A]
PowerP.start0Power of the load (negative if consumed, positive if fed into the electrical grid) [W]
Initialization
InitModeinitModeBuildings.Electrical.Types.I...Initialization mode for homotopy operator

Connectors

TypeNameDescription
replaceable package PhaseSystemPhase system
input RealInputyFraction of the nominal power consumed [1]
input RealInputPowPower consumed [W]
Terminal_nterminalGeneralized electric terminal

Modelica definition

model Resistive "Model of a resistive load" extends Buildings.Electrical.Interfaces.ResistiveLoad( redeclare package PhaseSystem = PhaseSystems.OnePhase, redeclare replaceable Interfaces.Terminal_n terminal, V_nominal(start = 110)); equation if linearized then i[1] = -homotopy(actual = v[1]*P/V_nominal^2, simplified = v[1]*Modelica.Constants.eps*1e3); i[2] = -homotopy(actual = v[2]*P/V_nominal^2, simplified = v[2]*Modelica.Constants.eps*1e3); else if initMode == Buildings.Electrical.Types.InitMode.zero_current then i[1] = -homotopy(actual= v[1]*P/(v[1]^2 + v[2]^2), simplified= 0.0); i[2] = -homotopy(actual= v[2]*P/(v[1]^2 + v[2]^2), simplified= 0.0); else i[1] = -homotopy(actual= v[1]*P/(v[1]^2 + v[2]^2), simplified= v[1]*P/V_nominal^2); i[2] = -homotopy(actual= v[2]*P/(v[1]^2 + v[2]^2), simplified= v[2]*P/V_nominal^2); end if; end if; end Resistive;