Description: "This package contains interfaces and partial models that are inherited by other components"

- Home > Modelica

## Buildings.Electrical.Interfaces

This package contains interfaces and partial models that are inherited by other components

### Information

This package contains basic classes that are used to build component models for electrical systems. The classes are not directly usable, but can be extended when building a new model.

Extends from Modelica.Icons.InterfacesPackage (Icon for packages containing interfaces).

### Package Content

Name | Description
--- | ---
BaseTerminal | Empty connector used by partial models
CapacitiveLoad | Partial model of a capacitive load
Ground | Generalized model of a ground connection.
Impedance | Partial model representing a generalized impedance
InductiveLoad | Partial model of an inductive load
Load | Partial model for a generic load
PartialBaseTwoPort | Model of a generic two port component
PartialConversion | Model representing a generic two port system for conversion
PartialPV | Base model for a PV system
PartialPVOriented | Base model of a PV system with orientation
PartialPvBase | Partial model with basic parameters for PVs
PartialTwoPort | Model of a generic two port component with phase systems
PartialWindTurbine | Partial model of a wind turbine with power output based on table as a function of wind speed
PartialWindTurbineBase | Base class for turbine model that contains basic parameters
Source | Partial model of a generic source.
Terminal | Generalized electric terminal
VariableVoltageSource | Partial model of a generic variable voltage source.
PartialAcDcParameters | Partial model that contains basic parameters for a DC/AC conversion system
PartialPluggableUnbalanced | Partial interface for unbalanced loads

## Buildings.Electrical.Interfaces.BaseTerminal

Empty connector used by partial models

### Information

This empty connector represents the base class extended by every electric connector of type Buildings.Electrical.Interfaces.Terminal.

### Modelica definition

connector BaseTerminal "Empty connector used by partial models" end BaseTerminal;

## Buildings.Electrical.Interfaces.CapacitiveLoad

Partial model of a capacitive load

### Information

This is a model of a generic capacitive load. This model is an extension of the base load model Buildings.Electrical.Interfaces.PartialLoad.

This model assumes a fixed power factor `pf` when the flag `use_pf_in = false` otherwise it uses the power factor specified by the input `pf_in`.

The power factor (either the input or the parameter) is used to compute the reactive power `Q` given the active power `P`

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

Extends from Load (Partial model for a generic load).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem | PartialPhaseSystem | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized electric terminal
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 |  | Nominal voltage (V_nominal >= 0) [V]
Real | pf | 0.8 | Power factor
Initialization
InitMode | initMode | Buildings.Electrical.Types.I... | Initialization mode for homotopy operator

### Connectors

Type | Name | Description
--- | --- | ---
input RealInput | y | Fraction of the nominal power consumed [1]
input RealInput | Pow | Power consumed [W]
Terminal | terminal | Generalized electric terminal
input RealInput | pf_in | Power factor [1]

### Modelica definition

partial model CapacitiveLoad "Partial model of a capacitive load" extends Load; parameter Boolean use_pf_in = false "If true, the power factor is defined by an input"; parameter Real pf(min=0, max=1) = 0.8 "Power factor"; Modelica.Blocks.Interfaces.RealInput pf_in( min=0, max=1, unit="1") if (use_pf_in) "Power factor"; protected function j = PhaseSystem.j "J operator that rotates of 90 degrees"; Modelica.Blocks.Interfaces.RealInput pf_internal "Hidden value of the input load for the conditional connector"; Modelica.SIunits.ElectricCharge q[2](each stateSelect=StateSelect.prefer) "Electric charge"; Modelica.SIunits.Admittance[2] Y "Admittance"; Modelica.SIunits.AngularVelocity omega "Angular velocity"; Modelica.SIunits.Power Q = P*tan(-acos(pf_internal)) "Reactive power (negative because capacitive load)"; equation connect(pf_in, pf_internal); if not use_pf_in then pf_internal = pf; end if; end CapacitiveLoad;

## Buildings.Electrical.Interfaces.Ground

Generalized model of a ground connection.

### Information

Given a generic electric connector Buildings.Electrical.Interfaces.Terminal this model imposes the following condition on the voltage `V[PhaseSystem.n]`

V = 0,

where 0 is a null vector of length `PhaseSystem.n`.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem | Buildings.Electrical.PhaseSy... | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized terminal

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package PhaseSystem | Phase system
Terminal | terminal | Generalized terminal

### Modelica definition

model Ground "Generalized model of a ground connection." replaceable package PhaseSystem = Buildings.Electrical.PhaseSystems.PartialPhaseSystem constrainedby Buildings.Electrical.PhaseSystems.PartialPhaseSystem "Phase system"; replaceable Buildings.Electrical.Interfaces.Terminal terminal(redeclare package PhaseSystem = PhaseSystem) "Generalized terminal"; equation terminal.v = zeros(PhaseSystem.n); end Ground;

## Buildings.Electrical.Interfaces.Impedance

Partial model representing a generalized impedance

### Information

This model represents a generalized interface for an impedance.

The model has a single generalized electric terminal of type Buildings.Electrical.Interfaces.Terminal that can be redeclared. The impedance can be of different types:

1. resistive,
2. inductive,
3. resistive and inductive,
4. capacitive, and
5. resistive and capacitive.

The values of the resistance `R`, capacitance `C` and inductance `L` can be specified as parameters of the model.

The values of the resistance `R`, capacitance `C` and inductance `L` can also be specified by using the input variables `y_R`, `y_C`, and `y_L` that are Real values between [0,1].
These input values are enabled by the boolean flags `use_R_in`, `use_L_in`, and `use_C_in`.

##### Example

If the flag `use_R_in = true`, the value of `R` is computed as

R = Rmin + yR (Rmax - Rmin)

Extends from Buildings.Electrical.Interfaces.Load (Partial model for a generic load).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem | PartialPhaseSystem | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized electric terminal
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]
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.)
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]

### Connectors

Type | Name | Description
--- | --- | ---
input RealInput | y | Fraction of the nominal power consumed [1]
input RealInput | Pow | Power consumed [W]
Terminal | terminal | Generalized electric terminal
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

### Modelica definition

model Impedance "Partial model representing a generalized impedance" extends Buildings.Electrical.Interfaces.Load( final linearized = false, final mode=Buildings.Electrical.Types.Load.FixedZ_steady_state, final P_nominal(fixed = true)=0, final V_nominal(fixed = true)=1); parameter Boolean inductive=true "If true, the load is inductive, otherwise it is capacitive"; parameter Modelica.SIunits.Resistance R(start = 1,min=0) = 1 "Resistance"; parameter Modelica.SIunits.Inductance L(start=0, min=0) = 0 "Inductance"; parameter Modelica.SIunits.Capacitance C(start=0,min=0) = 0 "Capacitance"; parameter Boolean use_R_in = false "If true, R is specified by an input"; parameter Modelica.SIunits.Resistance RMin(start = R, min=Modelica.Constants.eps) = 1e-4 "Minimum value of the resistance"; parameter Modelica.SIunits.Resistance RMax(start = R, min=Modelica.Constants.eps) = 1e2 "Maximum value of the resistance"; parameter Boolean use_C_in = false "If true, C is specified by an input"; parameter Modelica.SIunits.Capacitance CMin(start = C, min=Modelica.Constants.eps) = 1e-4 "Minimum value of the capacitance"; parameter Modelica.SIunits.Capacitance CMax(start = C, min=Modelica.Constants.eps) = 1e2 "Maximum value of the capacitance"; parameter Boolean use_L_in = false "If true, L is specified by an input"; parameter Modelica.SIunits.Inductance LMin(start = L, min=Modelica.Constants.eps) = 1e-4 "Minimum value of the inductance"; parameter Modelica.SIunits.Inductance LMax(start = L, min=Modelica.Constants.eps) = 1e2 "Maximum value of the inductance"; Modelica.Blocks.Interfaces.RealInput y_R(min=0, max=1) if use_R_in "Input that sepecify variable R"; Modelica.Blocks.Interfaces.RealInput y_C(min=0, max=1) if use_C_in "Input that sepecify variable C"; Modelica.Blocks.Interfaces.RealInput y_L(min=0, max=1) if use_L_in "Input that sepecify variable L"; protected Modelica.Blocks.Interfaces.RealOutput y_R_internal "Internal signal used to compute the variable R_internal"; Modelica.Blocks.Interfaces.RealOutput y_C_internal "Internal signal used to compute the variable C_internal"; Modelica.Blocks.Interfaces.RealOutput y_L_internal "Internal signal used to compute the variable L_internal"; Modelica.SIunits.Resistance R_internal "Actual resistance used to compute the impedance"; Modelica.SIunits.Inductance L_internal "Actual inductance used to compute the impedance"; Modelica.SIunits.Capacitance C_internal "Actual capacitance used to compute the impedance"; equation // These assertions ensures that if the variable R, L or C is computed using the inputs // the parameters min and max are sorted assert((not use_R_in) or RMin < RMax, "The value of RMin has to be lower than RMax"); assert((not use_L_in) or LMin < LMax, "The value of Lmin has to be lower than Lmax"); assert((not use_C_in) or CMin < CMax, "The value of Cmin has to be lower than Cmax"); // Connections to internal connectors connect(y_R, y_R_internal); connect(y_C, y_C_internal); connect(y_L, y_L_internal); // Default assignment when connectors are conditionally removed if not use_R_in then y_R_internal = 0; end if; if not use_C_in then y_C_internal = 0; end if; if not use_L_in then y_L_internal = 0; end if; // Retrieve the value of the R,L,C either if fixed or // varying if not use_R_in then R_internal = R; else R_internal = RMin + y_R_internal*(RMax - RMin); end if; if not use_C_in then C_internal = C; else C_internal = CMin + y_C_internal*(CMax - CMin); end if; if not use_L_in then L_internal = L; else L_internal = LMin + y_L_internal*(LMax - LMin); end if; end Impedance;

## Buildings.Electrical.Interfaces.InductiveLoad

Partial model of an inductive load

### Information

This is a model of a generic inductive load. This model is an extension of the base load model Buildings.Electrical.Interfaces.PartialLoad.

This model assumes a fixed power factor `pf` when the flag `use_pf_in = false` otherwise it uses the power factor specified by the input `pf_in`.

The power factor (either the input or the parameter) is used to compute the reactive power `Q` given the active power `P`

Q = P tan(arccos(pf))

Extends from Load (Partial model for a generic load).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem | PartialPhaseSystem | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized electric terminal
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 |  | Nominal voltage (V_nominal >= 0) [V]
Real | pf | 0.8 | Power factor
Initialization
InitMode | initMode | Buildings.Electrical.Types.I... | Initialization mode for homotopy operator

### Connectors

Type | Name | Description
--- | --- | ---
input RealInput | y | Fraction of the nominal power consumed [1]
input RealInput | Pow | Power consumed [W]
Terminal | terminal | Generalized electric terminal
input RealInput | pf_in | Power factor [1]

### Modelica definition

partial model InductiveLoad "Partial model of an inductive load" extends Load; parameter Boolean use_pf_in = false "If true, the power factor is defined by an input"; parameter Real pf(min=0, max=1) = 0.8 "Power factor"; Modelica.Blocks.Interfaces.RealInput pf_in( min=0, max=1, unit="1") if (use_pf_in) "Power factor"; protected function j = PhaseSystem.j "J operator that rotates of 90 degrees"; Modelica.Blocks.Interfaces.RealInput pf_internal "Hidden value of the input load for the conditional connector"; Modelica.SIunits.MagneticFlux psi[2](each stateSelect=StateSelect.prefer) "Magnetic flux"; Modelica.SIunits.Impedance Z[2] "Impedance of the load"; Modelica.SIunits.AngularVelocity omega "Angular frequency"; Modelica.SIunits.Power Q = P*tan(acos(pf_internal)) "Reactive power (positive because inductive load)"; equation connect(pf_in, pf_internal); if not use_pf_in then pf_internal = pf; end if; end InductiveLoad;

## Buildings.Electrical.Interfaces.Load

Partial model for a generic load

### Information

This model represents a generic load that can be extended to represent either a DC or an AC load.

The model has a single generalized electric terminal of type Buildings.Electrical.Interfaces.Terminal that can be redeclared. The generalized load is modeled as an impedance whose value can change. The value of the impedance can change depending on the value of the parameter `mode`, which is of type Buildings.Electrical.Types.Load:

Mode | Description | Explanation
--- | --- | ---
Buildings.Electrical.Types.Load.FixedZ_steady_state | fixed Z steady state | The load consumes exactly the power specified by the parameter `P_nominal`.
Buildings.Electrical.Types.Load.FixedZ_dynamic | fixed Z dynamic | The load consumes exactly the power specified by the parameter `P_nominal` at steady state. Depending on the type of load (e.g., inductive or capacitive) different dynamics are represented.
Buildings.Electrical.Types.Load.VariableZ_P_input | variable Z P input | The load consumes exactly the power specified by the input variable `Pow`.
Buildings.Electrical.Types.Load.VariableZ_y_input | variable Z y input | The load consumes exactly the a fraction of the nominal power `P_nominal` specified by the input variable `y`.

#### Conventions

It is assumed that the power `P` of the load is positive when produced (e.g., the load acts like a source) and negative when consumed (e.g., the source acts like a utilizer).

#### Linearized models

The model has a Boolean parameter `linearized` that by default is equal to `false`. When the power consumption of the load is imposed, this introduces a nonlinear equation between the voltage and the current of the load. This flag is used to select between a linearized version of the equations or the original nonlinear ones.
When the linearized version of the model is used, the parameter `V_nominal` has to be specified. The nominal voltage is needed to linearize the nonlinear equations.

Note: A linearized model will not consume the nominal power if the voltage at the terminal differs from the nominal voltage.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem | Buildings.Electrical.PhaseSy... | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized electric terminal
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 |  | Nominal voltage (V_nominal >= 0) [V]
Initialization
InitMode | initMode | Buildings.Electrical.Types.I... | Initialization mode for homotopy operator

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package PhaseSystem | Phase system
input RealInput | y | Fraction of the nominal power consumed [1]
input RealInput | Pow | Power consumed [W]
Terminal | terminal | Generalized electric terminal

### Modelica definition

model Load "Partial model for a generic load" replaceable package PhaseSystem = Buildings.Electrical.PhaseSystems.PartialPhaseSystem constrainedby Buildings.Electrical.PhaseSystems.PartialPhaseSystem "Phase system"; parameter Boolean linearized = false "If true, the load model is linearized"; parameter Buildings.Electrical.Types.Load mode( min=Buildings.Electrical.Types.Load.FixedZ_steady_state, max=Buildings.Electrical.Types.Load.VariableZ_y_input) = Buildings.Electrical.Types.Load.FixedZ_steady_state "Type of load model (e.g., steady state, dynamic, prescribed power consumption, etc.)"; parameter Modelica.SIunits.Power P_nominal "Nominal power (negative if consumed, positive if generated)"; parameter Modelica.SIunits.Voltage V_nominal(min=0, start=110) "Nominal voltage (V_nominal >= 0)"; parameter Buildings.Electrical.Types.InitMode initMode( min=Buildings.Electrical.Types.InitMode.zero_current, max=Buildings.Electrical.Types.InitMode.linearized) = Buildings.Electrical.Types.InitMode.zero_current "Initialization mode for homotopy operator"; Modelica.SIunits.Voltage v[:](start = PhaseSystem.phaseVoltages(V_nominal)) = terminal.v "Voltage vector"; Modelica.SIunits.Current i[:](start = PhaseSystem.phaseCurrents(0.0)) = terminal.i "Current vector"; Modelica.SIunits.Power S[PhaseSystem.n] = PhaseSystem.phasePowers_vi(v, -i) "Phase powers"; Modelica.SIunits.Power P "Power of the load (negative if consumed, positive if fed into the electrical grid)"; Modelica.Blocks.Interfaces.RealInput y(min=0, max=1, unit="1") if (mode == Buildings.Electrical.Types.Load.VariableZ_y_input) "Fraction of the nominal power consumed"; Modelica.Blocks.Interfaces.RealInput Pow(unit="W") if (mode == Buildings.Electrical.Types.Load.VariableZ_P_input) "Power consumed"; replaceable Buildings.Electrical.Interfaces.Terminal terminal( redeclare replaceable package PhaseSystem = PhaseSystem) "Generalized electric terminal"; protected Modelica.Blocks.Interfaces.RealInput y_internal "Hidden value of the input load for the conditional connector"; Modelica.Blocks.Interfaces.RealInput P_internal "Hidden value of the input power for the conditional connector"; Real load(min=eps, max=1) "Internal representation of control signal, used to avoid singularity"; constant Real eps = 1E-10 "Small number used to avoid a singularity if the power is zero"; constant Real oneEps = 1-eps "Small number used to avoid a singularity if the power is zero"; equation assert(y_internal>=0 and y_internal<=1+eps, "The power load fraction P (input of the model) must be within [0,1]"); // Connection between the conditional and inner connector connect(y,y_internal); connect(Pow,P_internal); // If the power is fixed, inner connector value is equal to 1 if mode==Buildings.Electrical.Types.Load.FixedZ_steady_state or mode==Buildings.Electrical.Types.Load.FixedZ_dynamic then y_internal = 1; P_internal = P_nominal; elseif mode==Buildings.Electrical.Types.Load.VariableZ_y_input then P_internal = 0; elseif mode==Buildings.Electrical.Types.Load.VariableZ_P_input then y_internal = 1; end if; // Value of the load, depending on the type: fixed or variable if mode==Buildings.Electrical.Types.Load.VariableZ_y_input then load = eps + oneEps*y_internal; else load = 1; end if; // Power consumption if mode==Buildings.Electrical.Types.Load.FixedZ_steady_state or mode==Buildings.Electrical.Types.Load.FixedZ_dynamic then P = P_nominal; elseif mode==Buildings.Electrical.Types.Load.VariableZ_P_input then P = P_internal; else P = P_nominal*load; end if; end Load;

## Buildings.Electrical.Interfaces.PartialBaseTwoPort

Model of a generic two port component

### Information

This model declares connectors for electrical components with two terminals.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
BaseTerminal | terminal_n | redeclare Buildings.Electric... | Electric terminal side p
BaseTerminal | terminal_p | redeclare Buildings.Electric... | Electric terminal side n

### Connectors

Type | Name | Description
--- | --- | ---
BaseTerminal | terminal_n | Electric terminal side p
BaseTerminal | terminal_p | Electric terminal side n

### Modelica definition

model PartialBaseTwoPort "Model of a generic two port component" replaceable Buildings.Electrical.Interfaces.BaseTerminal terminal_n "Electric terminal side p"; replaceable Buildings.Electrical.Interfaces.BaseTerminal terminal_p "Electric terminal side n"; end PartialBaseTwoPort;

## Buildings.Electrical.Interfaces.PartialConversion

Model representing a generic two port system for conversion

### Information

This model extends the base class Buildings.Electrical.Interfaces.PartialTwoPort model and declares the variables `v_p` and `i_p` that represents the voltage and the current at the `terminal_p`, and the variables `v_n` and `i_n` that represents the voltage and the current at the `terminal_n`. These variables are used in conversion models such as transformers and AC/DC converters.

Extends from Buildings.Electrical.Interfaces.PartialTwoPort (Model of a generic two port component with phase systems).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem_p | PartialPhaseSystem | Phase system of terminal p
replaceable package PhaseSystem_n | PartialPhaseSystem | Phase system of terminal n
Terminal | terminal_n | redeclare replaceable Buildi... | Electric terminal side p
Terminal | terminal_p | redeclare replaceable Buildi... | Electric terminal side n

### Connectors

Type | Name | Description
--- | --- | ---
Terminal | terminal_n | Electric terminal side p
Terminal | terminal_p | Electric terminal side n

### Modelica definition

model PartialConversion "Model representing a generic two port system for conversion" extends Buildings.Electrical.Interfaces.PartialTwoPort; Modelica.SIunits.Voltage v_p "Voltage drop between the two positive pins"; Modelica.SIunits.Voltage v_n "Voltage drop between the two negative pins"; Modelica.SIunits.Current i_p "Current flowing through the positive pins"; Modelica.SIunits.Current i_n "Current flowing through the negative pins"; equation i_p = PhaseSystem_p.systemCurrent(terminal_p.i); i_n = PhaseSystem_n.systemCurrent(terminal_n.i); v_p = PhaseSystem_p.systemVoltage(terminal_p.v); v_n = PhaseSystem_n.systemVoltage(terminal_n.v); end PartialConversion;

## Buildings.Electrical.Interfaces.PartialPV

Base model for a PV system

### Information

Partial model of a simple photovoltaic array.

This model computes the power as P=A fact η G, where A is the panel area, fact is the fraction of the aperture area, η is the panel efficiency and G is the total solar irradiation.

Note: This model takes as input the total solar irradiation on the panel. This has to be computed converting the incoming radiation to take tilt and azimuth into account.

The electrical connector is a general electrical interface.

Extends from Buildings.Electrical.Interfaces.PartialPvBase (Partial model with basic parameters for PVs).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Area | A |  | Net surface area [m2]
Real | fAct | 0.9 | Fraction of surface area with active solar cells [1]
Real | eta | 0.12 | Module conversion efficiency [1]
replaceable package PhaseSystem | Buildings.Electrical.PhaseSy... | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized terminal
Nominal conditions
Voltage | V_nominal |  | Nominal voltage (V_nominal >= 0) [V]

### Connectors

Type | Name | Description
--- | --- | ---
output RealOutput | P | Generated power [W]
replaceable package PhaseSystem | Phase system
input RealInput | G | Total solar irradiation per unit area [W/m2]
Terminal | terminal | Generalized terminal

### Modelica definition

model PartialPV "Base model for a PV system" extends Buildings.Electrical.Interfaces.PartialPvBase; replaceable package PhaseSystem = Buildings.Electrical.PhaseSystems.PartialPhaseSystem constrainedby Buildings.Electrical.PhaseSystems.PartialPhaseSystem "Phase system"; parameter Modelica.SIunits.Voltage V_nominal(min=0, start=110) "Nominal voltage (V_nominal >= 0)"; Modelica.Blocks.Interfaces.RealInput G(unit="W/m2") "Total solar irradiation per unit area"; replaceable Buildings.Electrical.Interfaces.Terminal terminal( redeclare final package PhaseSystem = PhaseSystem) "Generalized terminal"; protected Modelica.Blocks.Sources.RealExpression solarPower(y=A*fAct*eta*G); equation assert(solarPower.y>=0, "Solar power must be positive"); connect(solarPower.y, P); end PartialPV;

## Buildings.Electrical.Interfaces.PartialPVOriented

Base model of a PV system with orientation

### Information

Partial model of a simple photovoltaic array.

This model takes as an input the direct and diffuse solar radiation from the weather data bus.

This model computes the power as P=A fact η G, where A is the panel area, fact is the fraction of the aperture area, η is the panel efficiency and G is the total solar irradiation, which is the sum of direct and diffuse irradiation. The model takes into account the location and the orientation of the PV panel, specified by the surface tilt, latitude and azimuth.

Extends from Buildings.Electrical.Interfaces.PartialPvBase (Partial model with basic parameters for PVs).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Area | A |  | Net surface area [m2]
Real | fAct | 0.9 | Fraction of surface area with active solar cells [1]
Real | eta | 0.12 | Module conversion efficiency [1]
replaceable package PhaseSystem | Buildings.Electrical.PhaseSy... | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized terminal
PartialPV | panel | redeclare PartialPV panel | PV panel
Orientation
Angle | til |  | Surface tilt [rad]
Angle | lat |  | Latitude [rad]
Angle | azi |  | Surface azimuth [rad]
Nominal conditions
Voltage | V_nominal |  | Nominal voltage (V_nominal >= 0) [V]

### Connectors

Type | Name | Description
--- | --- | ---
output RealOutput | P | Generated power [W]
replaceable package PhaseSystem | Phase system
Terminal | terminal | Generalized terminal
Bus | weaBus | Weather data

### Modelica definition

model PartialPVOriented "Base model of a PV system with orientation" extends Buildings.Electrical.Interfaces.PartialPvBase; replaceable package PhaseSystem = Buildings.Electrical.PhaseSystems.PartialPhaseSystem constrainedby Buildings.Electrical.PhaseSystems.PartialPhaseSystem "Phase system"; parameter Modelica.SIunits.Angle til "Surface tilt"; parameter Modelica.SIunits.Angle lat "Latitude"; parameter Modelica.SIunits.Angle azi "Surface azimuth"; parameter Modelica.SIunits.Voltage V_nominal(min=0, start=110) "Nominal voltage (V_nominal >= 0)"; replaceable Buildings.Electrical.Interfaces.Terminal terminal( redeclare final package PhaseSystem = PhaseSystem) "Generalized terminal"; replaceable PartialPV panel constrainedby PartialPV( redeclare final package PhaseSystem = PhaseSystem, final A=A, final fAct=fAct, final eta=eta) "PV panel"; BoundaryConditions.WeatherData.Bus weaBus "Weather data"; protected BoundaryConditions.SolarIrradiation.DiffusePerez HDifTil( final til=til, final lat=lat, final azi=azi) "Diffuse irradiation on tilted surface"; BoundaryConditions.SolarIrradiation.DirectTiltedSurface HDirTil( final til=til, final lat=lat, final azi=azi) "Direct irradiation on tilted surface"; Modelica.Blocks.Math.Add G "Total irradiation on tilted surface"; equation connect(panel.P, P); connect(terminal, panel.terminal); connect(HDifTil.H,G. u1); connect(HDirTil.H,G. u2); connect(G.y, panel.G); connect(HDifTil.weaBus, weaBus); connect(weaBus, HDirTil.weaBus); end PartialPVOriented;

## Buildings.Electrical.Interfaces.PartialPvBase

Partial model with basic parameters for PVs

### Information

This model contains the minimum set of parameters necessary to describe a PV system. The model defines also an output `P` for the power generated by the PVs.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Area | A |  | Net surface area [m2]
Real | fAct | 0.9 | Fraction of surface area with active solar cells [1]
Real | eta | 0.12 | Module conversion efficiency [1]

### Connectors

Type | Name | Description
--- | --- | ---
output RealOutput | P | Generated power [W]

### Modelica definition

partial model PartialPvBase "Partial model with basic parameters for PVs" parameter Modelica.SIunits.Area A "Net surface area"; parameter Real fAct(min=0, max=1, unit="1") = 0.9 "Fraction of surface area with active solar cells"; parameter Real eta(min=0, max=1, unit="1") = 0.12 "Module conversion efficiency"; Modelica.Blocks.Interfaces.RealOutput P(unit="W") "Generated power"; end PartialPvBase;

## Buildings.Electrical.Interfaces.PartialTwoPort

Model of a generic two port component with phase systems

### Information

This is a model of a component with two electric terminals. It represents a common interface that is extended by other models.

Extends from Buildings.Electrical.Interfaces.PartialBaseTwoPort (Model of a generic two port component).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem_p | Buildings.Electrical.PhaseSy... | Phase system of terminal p
replaceable package PhaseSystem_n | Buildings.Electrical.PhaseSy... | Phase system of terminal n

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package PhaseSystem_p | Phase system of terminal p
replaceable package PhaseSystem_n | Phase system of terminal n

### Modelica definition

model PartialTwoPort "Model of a generic two port component with phase systems" replaceable package PhaseSystem_p = Buildings.Electrical.PhaseSystems.PartialPhaseSystem constrainedby Buildings.Electrical.PhaseSystems.PartialPhaseSystem "Phase system of terminal p"; replaceable package PhaseSystem_n = Buildings.Electrical.PhaseSystems.PartialPhaseSystem constrainedby Buildings.Electrical.PhaseSystems.PartialPhaseSystem "Phase system of terminal n"; extends Buildings.Electrical.Interfaces.PartialBaseTwoPort( redeclare replaceable Buildings.Electrical.Interfaces.Terminal terminal_n(redeclare replaceable package PhaseSystem = PhaseSystem_n), redeclare replaceable Buildings.Electrical.Interfaces.Terminal terminal_p(redeclare replaceable package PhaseSystem=PhaseSystem_p)); end PartialTwoPort;

## Buildings.Electrical.Interfaces.PartialWindTurbine

Partial model of a wind turbine with power output based on table as a function of wind speed

### Information

Model of a wind turbine whose power is computed as a function of wind-speed as defined in a table.

Input to the model is the local wind speed. The model requires the specification of a table that maps wind speed in meters per second to generated power Pt in Watts. The model has a parameter called `scale` with a default value of one that can be used to scale the power generated by the wind turbine. The generated electrical power is

P = Pt scale

For example, the following specification (with default `scale=1`) of a wind turbine

      WindTurbine_Table tur(
        table=[3.5, 0;
               5.5,   100;
               12, 900;
               14, 1000;
               25, 1000]) "Wind turbine";

yields the performance shown below. In this example, the cut-in wind speed is 3.5 meters per second, and the cut-out wind speed is 25 meters per second, as entered by the first and last entry of the wind speed column. Below and above these wind speeds, the generated power is zero.

Extends from Buildings.Electrical.Interfaces.PartialWindTurbineBase (Base class for turbine model that contains basic parameters).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Real | scale | 1 | Scaling factor, used to allow adjusting the power output without changing the table
Boolean | tableOnFile | false | true, if table is defined on file or in function usertab
Real | table[:, 2] | [3.5, 0; 5.5, 0.1; 12, 0.9; ... | Table of generated power (first column is wind speed, second column is power)
String | tableName | "NoName" | Table name on file or in function usertab (see documentation)
String | fileName | "NoName" | File where matrix is stored
replaceable package PhaseSystem | Buildings.Electrical.PhaseSy... | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized terminal
Wind correction
Real | h |  | Height over ground
Height | hRef | 10 | Reference height for wind measurement [m]
Real | nWin | 0.4 | Height exponent for wind profile calculation
Nominal conditions
Voltage | V_nominal |  | Nominal voltage (V_nominal >= 0) [V]

### Connectors

Type | Name | Description
--- | --- | ---
input RealInput | vWin | Steady wind speed [m/s]
output RealOutput | P | Generated power [W]
replaceable package PhaseSystem | Phase system
Terminal | terminal | Generalized terminal

### Modelica definition

model PartialWindTurbine "Partial model of a wind turbine with power output based on table as a function of wind speed" extends Buildings.Electrical.Interfaces.PartialWindTurbineBase; replaceable package PhaseSystem = Buildings.Electrical.PhaseSystems.PartialPhaseSystem constrainedby Buildings.Electrical.PhaseSystems.PartialPhaseSystem "Phase system"; replaceable Buildings.Electrical.Interfaces.Terminal terminal( redeclare package PhaseSystem = PhaseSystem) "Generalized terminal"; protected Modelica.Blocks.Tables.CombiTable1Ds per( final tableOnFile=tableOnFile, final table=cat(1, cat(1, [0, 0], table), [vOut+10*Modelica.Constants.eps, 0; vOut+20*Modelica.Constants.eps, 0]), final tableName=tableName, final fileName=fileName, final columns=2:2, final smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments) "Performance table that maps wind speed to electrical power output"; Modelica.Blocks.Math.Gain gain(final k=scale) "Gain, used to allow a user to easily scale the power"; DC.Sources.BaseClasses.WindCorrection cor( final h=h, final hRef=hRef, final n=nWin) "Correction for wind"; initial equation assert(abs(table[1,2]) == 0, "First data point of performance table must be at cut-in wind speed, and be equal to 0 Watts. Received + " + String(table[1,1]) + " m/s with " + String(table[1,2]) + " Watts"); equation assert(gain.y>=0, "Wind power must be positive"); connect(per.y[1],gain. u); connect(vWin,cor. vRef); connect(cor.vLoc,per. u); connect(gain.y, P); end PartialWindTurbine;

## Buildings.Electrical.Interfaces.PartialWindTurbineBase

Base class for turbine model that contains basic parameters

### Information

This partial model contains the minimum set of parameters necessary to describe a wind turbine. The model defines also an output `P` for the power generated by the wind turbine.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Real | scale | 1 | Scaling factor, used to allow adjusting the power output without changing the table
Boolean | tableOnFile | false | true, if table is defined on file or in function usertab
Real | table[:, 2] | [3.5, 0; 5.5, 0.1; 12, 0.9; ... | Table of generated power (first column is wind speed, second column is power)
String | tableName | "NoName" | Table name on file or in function usertab (see documentation)
String | fileName | "NoName" | File where matrix is stored
Wind correction
Real | h |  | Height over ground
Height | hRef | 10 | Reference height for wind measurement [m]
Real | nWin | 0.4 | Height exponent for wind profile calculation
Nominal conditions
Voltage | V_nominal |  | Nominal voltage (V_nominal >= 0) [V]

### Connectors

Type | Name | Description
--- | --- | ---
input RealInput | vWin | Steady wind speed [m/s]
output RealOutput | P | Generated power [W]

### Modelica definition

partial model PartialWindTurbineBase "Base class for turbine model that contains basic parameters" final parameter Modelica.SIunits.Velocity vIn = table[1,1] "Cut-in steady wind speed"; final parameter Modelica.SIunits.Velocity vOut = table[size(table,1), 1] "Cut-out steady wind speed"; parameter Real scale(min=0)=1 "Scaling factor, used to allow adjusting the power output without changing the table"; parameter Real h "Height over ground"; parameter Modelica.SIunits.Height hRef = 10 "Reference height for wind measurement"; parameter Real nWin(min=0) = 0.4 "Height exponent for wind profile calculation"; parameter Boolean tableOnFile=false "true, if table is defined on file or in function usertab"; parameter Real table[:,2]= [3.5, 0; 5.5, 0.1; 12, 0.9; 14, 1; 25, 1] "Table of generated power (first column is wind speed, second column is power)"; parameter String tableName="NoName" "Table name on file or in function usertab (see documentation)"; parameter String fileName="NoName" "File where matrix is stored"; parameter Modelica.SIunits.Voltage V_nominal(min=0, start=110) "Nominal voltage (V_nominal >= 0)"; Modelica.Blocks.Interfaces.RealInput vWin(unit="m/s") "Steady wind speed"; Modelica.Blocks.Interfaces.RealOutput P(unit="W") "Generated power"; end PartialWindTurbineBase;

## Buildings.Electrical.Interfaces.Source

Partial model of a generic source.

### Information

This model represents a generic source.

In case the phase system has `PhaseSystem.m > 0` and thus the connectors are over determined, the source can be selected to serve as reference point. The parameters `potentialReference` and `definiteReference` are used to define if the source model should be selected as source for the reference angles or not. More information about overdetermined connectors can be found in Olsson Et Al. (2008).

#### References

Hans Olsson, Martin Otter, Sven Erik Mattson and Hilding Elmqvist.
Balanced Models in Modelica 3.0 for Increased Model Quality.
Proc. of the 7th Modelica Conference, Bielefeld, Germany, March 2008.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem | Buildings.Electrical.PhaseSy... | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized terminal
Reference Parameters
Boolean | potentialReference | true | Serve as potential root
Boolean | definiteReference | false | Serve as definite root

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package PhaseSystem | Phase system
Terminal | terminal | Generalized terminal

### Modelica definition

model Source "Partial model of a generic source." replaceable package PhaseSystem = Buildings.Electrical.PhaseSystems.OnePhase constrainedby Buildings.Electrical.PhaseSystems.PartialPhaseSystem "Phase system"; parameter Boolean potentialReference = true "Serve as potential root"; parameter Boolean definiteReference = false "Serve as definite root"; Modelica.SIunits.Power S[PhaseSystem.n]= PhaseSystem.phasePowers_vi(terminal.v, terminal.i) "Complex power S[1] = P, S[2]= Q"; Modelica.SIunits.Angle phi= PhaseSystem.phase(terminal.v) - PhaseSystem.phase(-terminal.i) "Phase shift with respect to reference angle"; replaceable Buildings.Electrical.Interfaces.Terminal terminal( redeclare final replaceable package PhaseSystem = PhaseSystem) "Generalized terminal"; protected function j = PhaseSystem.j; equation if potentialReference then if definiteReference then Connections.root(terminal.theta); else Connections.potentialRoot(terminal.theta); end if; end if; end Source;

## Buildings.Electrical.Interfaces.Terminal

Generalized electric terminal

### Information

This connector represents a generalized electric terminal. The generalization is made possible by the replaceable package Buildings.Electrical.Interfaces.Terminal.PhaseSystem. The package `PhaseSystem` can be one of the packages contained in Buildings.Electrical.PhaseSystems. Using this approach allows to represent DC, single phase AC and multi phases balanced and unbalanced AC systems with the same connector.

This connector is compatible with the following Modelica libraries:

- Electric Power Library developed by Modelon, and
- Power Systems Library developed by Ruediger Franke (ABB).

The connector is overdetermined since the number of effort variables is higher than the number of flow variables. This happens when the phase system has a number of reference angles `PhaseSystem.m > 0`. The over-determined connectors are defined and used in such a way that a Modelica tool is able to remove the superfluous but consistent equations arriving at a balanced set of equations, based on a graph analysis of the connection structure. The models have to use ad-hoc constructs specified by the Modelica language to handle this situation. More information can be found in Olsson Et Al. (2008).

More details about the generalized electrical terminal can be found in Franke and Wiesmann (2014).

#### References

Hans Olsson, Martin Otter, Sven Erik Mattson and Hilding Elmqvist.
Balanced Models in Modelica 3.0 for Increased Model Quality.
Proc. of the 7th Modelica Conference, Bielefeld, Germany, March 2008.

Ruediger Franke and Hansjurg Wiesmann.
Flexible modeling of electrical power systems - the Modelica PowerSystems library.
Proc. of the 10th Modelica Conference, Lund, Sweden, March 2014.

Extends from Buildings.Electrical.Interfaces.BaseTerminal (Empty connector used by partial models).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem | PhaseSystems.PartialPhaseSys... | Phase system

### Contents

Type | Name | Description
--- | --- | ---
replaceable package PhaseSystem | Phase system
Voltage | v[PhaseSystem.n] | Voltage vector [V]
flow Current | i[PhaseSystem.n] | Current vector [A]
ReferenceAngle | theta[PhaseSystem.m] | Optional vector of phase angles [rad]

### Modelica definition

connector Terminal "Generalized electric terminal" extends Buildings.Electrical.Interfaces.BaseTerminal; replaceable package PhaseSystem = PhaseSystems.PartialPhaseSystem "Phase system"; PhaseSystem.Voltage v[PhaseSystem.n] "Voltage vector"; flow PhaseSystem.Current i[PhaseSystem.n] "Current vector"; PhaseSystem.ReferenceAngle theta[PhaseSystem.m] "Optional vector of phase angles"; end Terminal;

## Buildings.Electrical.Interfaces.VariableVoltageSource

Partial model of a generic variable voltage source.

### Information

This model represents a generic variable voltage source. The model has a boolean flag `use_V_in`, when this flag is equal to `true` the voltage of the source is imposed by the input variable `V_in`. When the flag is equal to `false` the voltage source is equal to the parameter `V`.

In case the phase system adopted has `PhaseSystem.m > 0` and thus the connectors are over determined, the source can be selected to serve as reference point. The parameters `potentialReference` and `definiteReference` are used to define if the source model should be selected as source for the reference angles or not. More information about overdetermined connectors can be found in Olsson Et Al. (2008).

#### References

Hans Olsson, Martin Otter, Sven Erik Mattson and Hilding Elmqvist.
Balanced Models in Modelica 3.0 for Increased Model Quality.
Proc. of the 7th Modelica Conference, Bielefeld, Germany, March 2008.

Extends from Buildings.Electrical.Interfaces.Source (Partial model of a generic source.).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package PhaseSystem | OnePhase | Phase system
Terminal | terminal | redeclare Buildings.Electric... | Generalized terminal
Boolean | use_V_in | true | If true, the voltage is an input
Voltage | V | 1 | Value of constant voltage [V]
Reference Parameters
Boolean | potentialReference | true | Serve as potential root
Boolean | definiteReference | false | Serve as definite root

### Connectors

Type | Name | Description
--- | --- | ---
Terminal | terminal | Generalized terminal
input RealInput | V_in | Input voltage [V]

### Modelica definition

model VariableVoltageSource "Partial model of a generic variable voltage source." extends Buildings.Electrical.Interfaces.Source; parameter Boolean use_V_in = true "If true, the voltage is an input"; parameter Modelica.SIunits.Voltage V = 1 "Value of constant voltage"; Modelica.Blocks.Interfaces.RealInput V_in(unit="V", min=0, start = 1) if use_V_in "Input voltage"; protected Modelica.Blocks.Interfaces.RealInput V_in_internal(unit="V") "Hidden value of the input voltage for the conditional connector"; equation // Connection between the conditional and inner connector connect(V_in,V_in_internal); // If the voltage is fixed, inner connector value is equal to parameter V if use_V_in == false then V_in_internal = V; end if; end VariableVoltageSource;

## Buildings.Electrical.Interfaces.PartialAcDcParameters

Partial model that contains basic parameters for a DC/AC conversion system

### Information

This model contains the minimum set of parameters necessary to describe an AC/DC converter.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
AC-Conversion
Real | pf | 0.9 | Power factor
Real | eta_DCAC | 0.9 | Efficiency of DC/AC conversion

### Modelica definition

record PartialAcDcParameters "Partial model that contains basic parameters for a DC/AC conversion system" parameter Real pf(min=0, max=1) = 0.9 "Power factor"; parameter Real eta_DCAC(min=0, max=1) = 0.9 "Efficiency of DC/AC conversion"; end PartialAcDcParameters;

## Buildings.Electrical.Interfaces.PartialPluggableUnbalanced

Partial interface for unbalanced loads

### Information

This record contains a set of parameters that are used when modeling three-phase unbalanced systems. The record contains three boolean flags that are used to determine which of the three-phase are connected to the network.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Boolean | plugPhase1 | true | If true, phase 1 is connected
Boolean | plugPhase2 | true | If true, phase 2 is connected
Boolean | plugPhase3 | true | If true, phase 3 is connected

### Modelica definition

record PartialPluggableUnbalanced "Partial interface for unbalanced loads" parameter Boolean plugPhase1 = true "If true, phase 1 is connected"; parameter Boolean plugPhase2 = true "If true, phase 2 is connected"; parameter Boolean plugPhase3 = true "If true, phase 3 is connected"; end PartialPluggableUnbalanced;