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

Partial model of a capacitive load

Buildings.Electrical.Interfaces.CapacitiveLoad

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

TypeNameDefaultDescription
replaceable package PhaseSystemPartialPhaseSystemPhase system
Terminalterminalredeclare Buildings.Electric...Generalized electric terminal
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 Nominal voltage (V_nominal >= 0) [V]
Realpf0.8Power factor
Initialization
InitModeinitModeBuildings.Electrical.Types.I...Initialization mode for homotopy operator

Connectors

TypeNameDescription
input RealInputyFraction of the nominal power consumed [1]
input RealInputPowPower consumed [W]
TerminalterminalGeneralized electric terminal
input RealInputpf_inPower 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 Buildings.Electrical.Interfaces.Ground

Generalized model of a ground connection.

Buildings.Electrical.Interfaces.Ground

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

TypeNameDefaultDescription
replaceable package PhaseSystemBuildings.Electrical.PhaseSy...Phase system
Terminalterminalredeclare Buildings.Electric...Generalized terminal

Connectors

TypeNameDescription
replaceable package PhaseSystemPhase system
TerminalterminalGeneralized 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 Buildings.Electrical.Interfaces.Impedance

Partial model representing a generalized impedance

Buildings.Electrical.Interfaces.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

TypeNameDefaultDescription
replaceable package PhaseSystemPartialPhaseSystemPhase system
Terminalterminalredeclare Buildings.Electric...Generalized electric terminal
BooleaninductivetrueIf true, the load is inductive, otherwise it is capacitive
ResistanceR1Resistance [Ohm]
InductanceL0Inductance [H]
CapacitanceC0Capacitance [F]
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.)
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
input RealInputyFraction of the nominal power consumed [1]
input RealInputPowPower consumed [W]
TerminalterminalGeneralized 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 "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 Buildings.Electrical.Interfaces.InductiveLoad

Partial model of an inductive load

Buildings.Electrical.Interfaces.InductiveLoad

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

TypeNameDefaultDescription
replaceable package PhaseSystemPartialPhaseSystemPhase system
Terminalterminalredeclare Buildings.Electric...Generalized electric terminal
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 Nominal voltage (V_nominal >= 0) [V]
Realpf0.8Power factor
Initialization
InitModeinitModeBuildings.Electrical.Types.I...Initialization mode for homotopy operator

Connectors

TypeNameDescription
input RealInputyFraction of the nominal power consumed [1]
input RealInputPowPower consumed [W]
TerminalterminalGeneralized electric terminal
input RealInputpf_inPower 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 Buildings.Electrical.Interfaces.Load

Partial model for a generic load

Buildings.Electrical.Interfaces.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

TypeNameDefaultDescription
replaceable package PhaseSystemBuildings.Electrical.PhaseSy...Phase system
Terminalterminalredeclare Buildings.Electric...Generalized electric terminal
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 Nominal voltage (V_nominal >= 0) [V]
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]
TerminalterminalGeneralized 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 = 0 "Nominal power (negative if consumed, positive if generated). Used if mode <> Buildings.Electrical.Types.Load.VariableZ_P_input"; 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[:] = 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"; initial equation if mode == Buildings.Electrical.Types.Load.VariableZ_P_input then assert(abs(P_nominal) < 1E-10, "*** Warning: P_nominal = " + String(P_nominal) + ", but this value will be ignored.", AssertionLevel.warning); end if; 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 = 0; 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 Buildings.Electrical.Interfaces.PartialBaseTwoPort

Model of a generic two port component

Buildings.Electrical.Interfaces.PartialBaseTwoPort

Information

This model declares connectors for electrical components with two terminals.

Parameters

TypeNameDefaultDescription
BaseTerminalterminal_nredeclare Buildings.Electric...Electric terminal side p
BaseTerminalterminal_predeclare Buildings.Electric...Electric terminal side n

Connectors

TypeNameDescription
BaseTerminalterminal_nElectric terminal side p
BaseTerminalterminal_pElectric 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 Buildings.Electrical.Interfaces.PartialConversion

Model representing a generic two port system for conversion

Buildings.Electrical.Interfaces.PartialConversion

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

TypeNameDefaultDescription
replaceable package PhaseSystem_pPartialPhaseSystemPhase system of terminal p
replaceable package PhaseSystem_nPartialPhaseSystemPhase system of terminal n
Terminalterminal_nredeclare replaceable Buildi...Electric terminal side p
Terminalterminal_predeclare replaceable Buildi...Electric terminal side n

Connectors

TypeNameDescription
Terminalterminal_nElectric terminal side p
Terminalterminal_pElectric 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 Buildings.Electrical.Interfaces.PartialPV

Base model for a PV system

Buildings.Electrical.Interfaces.PartialPV

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

TypeNameDefaultDescription
AreaA Net surface area [m2]
RealfAct0.9Fraction of surface area with active solar cells [1]
Realeta0.12Module conversion efficiency [1]
replaceable package PhaseSystemBuildings.Electrical.PhaseSy...Phase system
Terminalterminalredeclare Buildings.Electric...Generalized terminal
Nominal conditions
VoltageV_nominal Nominal voltage (V_nominal >= 0) [V]

Connectors

TypeNameDescription
output RealOutputPGenerated power [W]
replaceable package PhaseSystemPhase system
input RealInputGTotal solar irradiation per unit area [W/m2]
TerminalterminalGeneralized 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 Buildings.Electrical.Interfaces.PartialPVOriented

Base model of a PV system with orientation

Buildings.Electrical.Interfaces.PartialPVOriented

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

TypeNameDefaultDescription
AreaA Net surface area [m2]
RealfAct0.9Fraction of surface area with active solar cells [1]
Realeta0.12Module conversion efficiency [1]
replaceable package PhaseSystemBuildings.Electrical.PhaseSy...Phase system
Terminalterminalredeclare Buildings.Electric...Generalized terminal
PartialPVpanelredeclare PartialPV panelPV panel
Orientation
Angletil Surface tilt [rad]
Anglelat Latitude [rad]
Angleazi Surface azimuth [rad]
Nominal conditions
VoltageV_nominal Nominal voltage (V_nominal >= 0) [V]

Connectors

TypeNameDescription
output RealOutputPGenerated power [W]
replaceable package PhaseSystemPhase system
TerminalterminalGeneralized terminal
BusweaBusWeather 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 Buildings.Electrical.Interfaces.PartialPvBase

Partial model with basic parameters for PVs

Buildings.Electrical.Interfaces.PartialPvBase

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

TypeNameDefaultDescription
AreaA Net surface area [m2]
RealfAct0.9Fraction of surface area with active solar cells [1]
Realeta0.12Module conversion efficiency [1]

Connectors

TypeNameDescription
output RealOutputPGenerated 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 Buildings.Electrical.Interfaces.PartialTwoPort

Model of a generic two port component with phase systems

Buildings.Electrical.Interfaces.PartialTwoPort

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

TypeNameDefaultDescription
replaceable package PhaseSystem_pBuildings.Electrical.PhaseSy...Phase system of terminal p
replaceable package PhaseSystem_nBuildings.Electrical.PhaseSy...Phase system of terminal n

Connectors

TypeNameDescription
replaceable package PhaseSystem_pPhase system of terminal p
replaceable package PhaseSystem_nPhase 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 Buildings.Electrical.Interfaces.PartialWindTurbine

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

Buildings.Electrical.Interfaces.PartialWindTurbine

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.

alt-image

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

Parameters

TypeNameDefaultDescription
Realscale1Scaling factor, used to allow adjusting the power output without changing the table
BooleantableOnFilefalsetrue, if table is defined on file or in function usertab
Realtable[:, 2][3.5, 0; 5.5, 0.1; 12, 0.9; ...Table of generated power (first column is wind speed, second column is power)
StringtableName"NoName"Table name on file or in function usertab (see documentation)
StringfileName"NoName"File where matrix is stored
replaceable package PhaseSystemBuildings.Electrical.PhaseSy...Phase system
Terminalterminalredeclare Buildings.Electric...Generalized terminal
Wind correction
Realh Height over ground
HeighthRef10Reference height for wind measurement [m]
RealnWin0.4Height exponent for wind profile calculation
Nominal conditions
VoltageV_nominal Nominal voltage (V_nominal >= 0) [V]

Connectors

TypeNameDescription
input RealInputvWinSteady wind speed [m/s]
output RealOutputPGenerated power [W]
replaceable package PhaseSystemPhase system
TerminalterminalGeneralized 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]) < Modelica.Constants.eps, "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 Buildings.Electrical.Interfaces.PartialWindTurbineBase

Base class for turbine model that contains basic parameters

Buildings.Electrical.Interfaces.PartialWindTurbineBase

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

TypeNameDefaultDescription
Realscale1Scaling factor, used to allow adjusting the power output without changing the table
BooleantableOnFilefalsetrue, if table is defined on file or in function usertab
Realtable[:, 2][3.5, 0; 5.5, 0.1; 12, 0.9; ...Table of generated power (first column is wind speed, second column is power)
StringtableName"NoName"Table name on file or in function usertab (see documentation)
StringfileName"NoName"File where matrix is stored
Wind correction
Realh Height over ground
HeighthRef10Reference height for wind measurement [m]
RealnWin0.4Height exponent for wind profile calculation
Nominal conditions
VoltageV_nominal Nominal voltage (V_nominal >= 0) [V]

Connectors

TypeNameDescription
input RealInputvWinSteady wind speed [m/s]
output RealOutputPGenerated 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.ResistiveLoad Buildings.Electrical.Interfaces.ResistiveLoad

Partial model of a resistive load

Buildings.Electrical.Interfaces.ResistiveLoad

Information

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

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

Parameters

TypeNameDefaultDescription
replaceable package PhaseSystemPartialPhaseSystemPhase system
Terminalterminalredeclare Buildings.Electric...Generalized electric terminal
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 Nominal voltage (V_nominal >= 0) [V]
Initialization
InitModeinitModeBuildings.Electrical.Types.I...Initialization mode for homotopy operator

Connectors

TypeNameDescription
input RealInputyFraction of the nominal power consumed [1]
input RealInputPowPower consumed [W]
TerminalterminalGeneralized electric terminal

Modelica definition

partial model ResistiveLoad "Partial model of a resistive load" extends Load; end ResistiveLoad;

Buildings.Electrical.Interfaces.Source Buildings.Electrical.Interfaces.Source

Partial model of a generic source.

Buildings.Electrical.Interfaces.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 theta 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

TypeNameDefaultDescription
replaceable package PhaseSystemBuildings.Electrical.PhaseSy...Phase system
Terminalterminalredeclare Buildings.Electric...Generalized terminal
Reference Parameters
BooleanpotentialReferencetrueServe as potential root for the reference angle theta
BooleandefiniteReferencefalseServe as definite root for the reference angle theta

Connectors

TypeNameDescription
replaceable package PhaseSystemPhase system
TerminalterminalGeneralized 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 for the reference angle theta"; parameter Boolean definiteReference = false "Serve as definite root for the reference angle theta"; 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:

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

TypeNameDefaultDescription
replaceable package PhaseSystemPhaseSystems.PartialPhaseSys...Phase system

Contents

TypeNameDescription
replaceable package PhaseSystemPhase system
Voltagev[PhaseSystem.n]Voltage vector [V]
flow Currenti[PhaseSystem.n]Current vector [A]
ReferenceAngletheta[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 Buildings.Electrical.Interfaces.VariableVoltageSource

Partial model of a generic variable voltage source.

Buildings.Electrical.Interfaces.VariableVoltageSource

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

TypeNameDefaultDescription
replaceable package PhaseSystemOnePhasePhase system
Terminalterminalredeclare Buildings.Electric...Generalized terminal
Booleanuse_V_intrueIf true, the voltage is an input
VoltageV1Value of constant voltage [V]
Reference Parameters
BooleanpotentialReferencetrueServe as potential root for the reference angle theta
BooleandefiniteReferencefalseServe as definite root for the reference angle theta

Connectors

TypeNameDescription
TerminalterminalGeneralized terminal
input RealInputV_inInput 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

TypeNameDefaultDescription
AC-Conversion
Realpf0.9Power factor
Realeta_DCAC0.9Efficiency 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

TypeNameDefaultDescription
BooleanplugPhase1trueIf true, phase 1 is connected
BooleanplugPhase2trueIf true, phase 2 is connected
BooleanplugPhase3trueIf 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;