**Package with load models for one phase AC systems**

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

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

Name | Description |
---|---|

Capacitive | Model of a capacitive and resistive load |

Impedance | Model of a generic impedance |

Inductive | Model of an inductive and resistive load |

Resistive | Model of a resistive load |

Examples | Package with example models |

**Model of a capacitive and resistive load**

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

i_{1} = (P V_{1} + Q V_{2})/(V_{1}^{2} + V_{2}^{2}),

i_{2} = (P V_{2} - Q V_{1})/(V_{1}^{2} + V_{2}^{2}),

where *i _{1}*,

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.

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

i_{1} = (P V_{1} + Q V_{2})/V_{RMS}^{2},

i_{2} = (P V_{2} - Q V_{1})/V_{RMS}^{2},

where *V _{RMS}* 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 contraints related to the ratio of the
active and reactive powers.

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).

Type | Name | Default | Description |
---|---|---|---|

replaceable package PhaseSystem | PartialPhaseSystem | Phase system | |

Modelling assumption | |||

Boolean | linearized | false | If true, the load model is linearized |

Load | mode | Buildings.Electrical.Types.L... | Type of load model (e.g., steady state, dynamic, prescribed power consumption, etc.) |

Boolean | use_pf_in | false | If true, the power factor is defined by an input |

Nominal conditions | |||

Power | P_nominal | Nominal power (negative if consumed, positive if generated) [W] | |

Voltage | V_nominal.start | 110 | Nominal voltage (V_nominal >= 0) [V] |

Real | pf | 0.8 | Power factor |

Initialization | |||

InitMode | initMode | Buildings.Electrical.Types.I... | Initialization mode for homotopy operator |

Type | Name | Description |
---|---|---|

replaceable package PhaseSystem | Phase system | |

input RealInput | y | Fraction of the nominal power consumed [1] |

input RealInput | Pow | Power consumed [W] |

input RealInput | pf_in | Power factor [1] |

model Capacitive "Model of a capacitive and resistive load"
extends Buildings.Electrical.Interfaces.CapacitiveLoad(
redeclare package PhaseSystem = PhaseSystems.OnePhase,
redeclare Interfaces.Terminal_n terminal,
V_nominal(start = 110));
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
omega = der(PhaseSystem.thetaRef(terminal.theta));
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;

**Model of a generic impedance**

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).

Type | Name | Default | Description |
---|---|---|---|

replaceable package PhaseSystem | PartialPhaseSystem | Phase system | |

Boolean | inductive | true | If true, the load is inductive, otherwise it is capacitive |

Resistance | R | 1 | Resistance [Ohm] |

Inductance | L | 0 | Inductance [H] |

Capacitance | C | 0 | Capacitance [F] |

Initialization | |||

InitMode | initMode | Buildings.Electrical.Types.I... | Initialization mode for homotopy operator |

Variable load | |||

Resistance | |||

Boolean | use_R_in | false | If true, R is specified by an input |

Resistance | RMin | 1e-4 | Minimum value of the resistance [Ohm] |

Resistance | RMax | 1e2 | Maximum value of the resistance [Ohm] |

Capacitance | |||

Boolean | use_C_in | false | If true, C is specified by an input |

Capacitance | CMin | 1e-4 | Minimum value of the capacitance [F] |

Capacitance | CMax | 1e2 | Maximum value of the capacitance [F] |

Inductance | |||

Boolean | use_L_in | false | If true, L is specified by an input |

Inductance | LMin | 1e-4 | Minimum value of the inductance [H] |

Inductance | LMax | 1e2 | Maximum value of the inductance [H] |

Type | Name | Description |
---|---|---|

replaceable package PhaseSystem | Phase system | |

input RealInput | y | Fraction of the nominal power consumed [1] |

input RealInput | Pow | Power consumed [W] |

input RealInput | y_R | Input that sepecify variable R |

input RealInput | y_C | Input that sepecify variable C |

input RealInput | y_L | Input that sepecify variable L |

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.SIunits.AngularVelocity omega
"Frequency of the quasi-stationary sine waves";
Modelica.SIunits.Reactance X(start = 1) "Complex component of the impedance";
equation
omega = der(PhaseSystem.thetaRef(terminal.theta));
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;

**Model of an inductive and resistive load**

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

i_{1} = (P V_{1} + Q V_{2})/(V_{1}^{2} + V_{2}^{2}),

i_{2} = (P V_{2} - Q V_{1})/(V_{1}^{2} + V_{2}^{2}),

where *i _{1}*,

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.

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

i_{1} = (P V_{1} + Q V_{2})/V_{RMS}^{2},

i_{2} = (P V_{2} - Q V_{1})/V_{RMS}^{2},

where *V _{RMS}* 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 contraints related to the ratio of the
active and reactive powers.

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).

Type | Name | Default | Description |
---|---|---|---|

replaceable package PhaseSystem | PartialPhaseSystem | Phase system | |

Modelling assumption | |||

Boolean | linearized | false | If true, the load model is linearized |

Load | mode | Buildings.Electrical.Types.L... | Type of load model (e.g., steady state, dynamic, prescribed power consumption, etc.) |

Boolean | use_pf_in | false | If true, the power factor is defined by an input |

Nominal conditions | |||

Power | P_nominal | Nominal power (negative if consumed, positive if generated) [W] | |

Voltage | V_nominal.start | 110 | Nominal voltage (V_nominal >= 0) [V] |

Real | pf | 0.8 | Power factor |

Initialization | |||

InitMode | initMode | Buildings.Electrical.Types.I... | Initialization mode for homotopy operator |

Type | Name | Description |
---|---|---|

replaceable package PhaseSystem | Phase system | |

input RealInput | y | Fraction of the nominal power consumed [1] |

input RealInput | Pow | Power consumed [W] |

input RealInput | pf_in | Power factor [1] |

model Inductive "Model of an inductive and resistive load"
extends Buildings.Electrical.Interfaces.InductiveLoad(
redeclare package PhaseSystem = PhaseSystems.OnePhase,
redeclare Interfaces.Terminal_n terminal,
V_nominal(start = 110));
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
omega = der(PhaseSystem.thetaRef(terminal.theta));
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;

**Model of a resistive load**

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

i_{1} = (P V_{1} + Q V_{2})/(V_{1}^{2} + V_{2}^{2}),

i_{2} = (P V_{2} - Q V_{1})/(V_{1}^{2} + V_{2}^{2}),

where *i _{1}*,

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

i_{1} = P V_{1}/(V_{1}^{2} + V_{2}^{2})

i_{2} = P V_{2}/(V_{1}^{2} + V_{2}^{2})

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.

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.

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

i_{1} = P V_{1}/V_{RMS}^{2}

i_{2} = P V_{2}/V_{RMS}^{2}

where *V _{RMS}* 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 contraints related to the ratio of the
active and reactive powers.

The image below show the linearized function

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.Load (Partial model for a generic load).

Type | Name | Default | Description |
---|---|---|---|

replaceable package PhaseSystem | PartialPhaseSystem | Phase system | |

Modelling assumption | |||

Boolean | linearized | false | If true, the load model is linearized |

Load | mode | Buildings.Electrical.Types.L... | Type of load model (e.g., steady state, dynamic, prescribed power consumption, etc.) |

Nominal conditions | |||

Power | P_nominal | Nominal power (negative if consumed, positive if generated) [W] | |

Voltage | V_nominal.start | 110 | Nominal voltage (V_nominal >= 0) [V] |

Initialization | |||

InitMode | initMode | Buildings.Electrical.Types.I... | Initialization mode for homotopy operator |

Type | Name | Description |
---|---|---|

replaceable package PhaseSystem | Phase system | |

input RealInput | y | Fraction of the nominal power consumed [1] |

input RealInput | Pow | Power consumed [W] |

model Resistive "Model of a resistive load"
extends Buildings.Electrical.Interfaces.Load(
redeclare package PhaseSystem = PhaseSystems.OnePhase,
redeclare 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;

Automatically generated Mon May 4 10:18:43 2015.