Description: "Package with models for AC electrical lines"

- Home > Modelica

## Buildings.Electrical.AC.OnePhase.Lines

Package with models for AC electrical lines

### Information

This package contains models for transmission lines and electrical networks.

Extends from Modelica.Icons.Package (Icon for standard packages).

### Package Content

Name | Description
--- | ---
Line | Model of an electrical line
Network | Single phase AC network
TwoPortInductance | Model of an inductive element with two electrical ports
TwoPortRL | Model of a resistive-inductive element with two electrical ports
TwoPortRLC | Model of an RLC element with two electrical ports
TwoPortResistance | Model of a resistance with two electrical ports
Examples | Package with example models

## Buildings.Electrical.AC.OnePhase.Lines.Line

Model of an electrical line

### Information

This model represents an AC single phase cable. The model is based on Buildings.Electrical.AC.OnePhase.Lines.TwoPortRLC and provides functionalities to parametrize the values of R, L and C, either using commercial cables or using default values.

Extends from Buildings.Electrical.Transmission.BaseClasses.PartialLine (Partial cable line dispersion model).

### 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
Length | l |  | Length of the line [m]
Power | P_nominal |  | Nominal power of the line [W]
Model
Assumptions
Boolean | use_C | false | Set to true to add a capacitance in the center of the line
Load | modelMode | Buildings.Electrical.Types.L... | Select between steady state and dynamic model
Thermal
Boolean | use_T | false | If true, enables the input for the temperature of the cable
Temperature | TCable | T_ref | Fixed temperature of the cable [K]
Tech. specification
Auto/Manual mode
CableMode | mode | Buildings.Electrical.Types.C... | Select if choosing the cable automatically or between a list of commercial options
Manual mode
Generic | commercialCable | Buildings.Electrical.Transmi... | Commercial cables options

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package PhaseSystem_p | Phase system of terminal p
replaceable package PhaseSystem_n | Phase system of terminal n
input RealInput | T | Temperature of the cable

### Modelica definition

model Line "Model of an electrical line" extends Buildings.Electrical.Transmission.BaseClasses.PartialLine( V_nominal(start = 110), redeclare package PhaseSystem_p = PhaseSystems.OnePhase, redeclare package PhaseSystem_n = PhaseSystems.OnePhase, redeclare Interfaces.Terminal_n terminal_n, redeclare Interfaces.Terminal_p terminal_p, commercialCable = Buildings.Electrical.Transmission.Functions.selectCable_low(P_nominal, V_nominal)); protected replaceable TwoPortRL line(R=R/3,L=L/3) constrainedby Buildings.Electrical.Transmission.BaseClasses.PartialTwoPortRLC( useHeatPort=true, mode=modelMode, M=M, T_ref=T_ref) "Model of the line"; equation connect(cableTemp.port, line.heatPort); connect(line.terminal_n, terminal_n); connect(terminal_p, line.terminal_p); end Line;

## Buildings.Electrical.AC.OnePhase.Lines.Network

Single phase AC network

### Information

This model represents a generalized electrical AC single phase network.

See Buildings.Electrical.Transmission.BaseClasses.PartialNetwork for information about the network model.

See Buildings.Electrical.Transmission.Grids.PartialGrid for more information about the topology of the network, such as the number of nodes, how they are connected, and the length of each connection.

Extends from Buildings.Electrical.Transmission.BaseClasses.PartialNetwork (Partial model that represent an electric network).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Model
Assumptions
Boolean | use_C | false | If true, model the cable capacity
Load | modelMode | Types.Load.FixedZ_steady_state | Select between steady state and dynamic model

### Modelica definition

model Network "Single phase AC network" extends Buildings.Electrical.Transmission.BaseClasses.PartialNetwork( V_nominal(start = 110), redeclare Interfaces.Terminal_p terminal, redeclare replaceable Transmission.Grids.TestGrid2Nodes grid, redeclare Line lines( commercialCable=grid.cables, each use_C=use_C, each modelMode=modelMode)); parameter Boolean use_C = false "If true, model the cable capacity"; parameter Buildings.Electrical.Types.Load modelMode=Types.Load.FixedZ_steady_state "Select between steady state and dynamic model"; Modelica.SIunits.Voltage VAbs[grid.nNodes] "RMS voltage of the grid nodes"; equation for i in 1:grid.nLinks loop connect(lines[i].terminal_p, terminal[grid.fromTo[i,1]]); connect(lines[i].terminal_n, terminal[grid.fromTo[i,2]]); end for; for i in 1:grid.nNodes loop VAbs[i] = Buildings.Electrical.PhaseSystems.OnePhase.systemVoltage(terminal[i].v); end for; end Network;

## Buildings.Electrical.AC.OnePhase.Lines.TwoPortInductance

Model of an inductive element with two electrical ports

### Information

This model represents an inductance that connects two AC one phase interfaces. This model can be used to represent a single phase cable in a AC grid.

The model represents the lumped inductance as shown in the figure below.

Extends from Buildings.Electrical.Transmission.BaseClasses.PartialTwoPortInductance (Partial model of an inductive element that links two electrical connectors).

### 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
Inductance | L |  | Inductance [H]
Modelling assumption
Load | mode | Buildings.Electrical.Types.L... | Type of model (e.g., steady state, dynamic, prescribed power consumption, etc.)

### 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 TwoPortInductance "Model of an inductive element with two electrical ports" extends Buildings.Electrical.Transmission.BaseClasses.PartialTwoPortInductance ( redeclare package PhaseSystem_p = PhaseSystems.OnePhase, redeclare package PhaseSystem_n = PhaseSystems.OnePhase, redeclare Interfaces.Terminal_n terminal_n, redeclare Interfaces.Terminal_p terminal_p); 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 model (e.g., steady state, dynamic, prescribed power consumption, etc.)"; protected Modelica.SIunits.AngularVelocity omega "Frequency of the quasi-stationary sine waves"; equation omega = der(PhaseSystem_p.thetaRef(terminal_p.theta)); if mode==Buildings.Electrical.Types.Load.FixedZ_dynamic then // Dynamics of the system der(L*terminal_p.i) + L*omega*PhaseSystem_p.j(terminal_p.i) = terminal_p.v - terminal_n.v; else // Steady state relationship L*omega*PhaseSystem_p.j(terminal_p.i) = terminal_p.v - terminal_n.v; end if; end TwoPortInductance;

## Buildings.Electrical.AC.OnePhase.Lines.TwoPortRL

Model of a resistive-inductive element with two electrical ports

### Information

This model represents a resistance and an inductance connected in series with two AC one phase interfaces. This model can be used to represent a single phase cable in a AC grid.

The model represents the lumped RL cable as shown in the figure below.

Extends from Buildings.Electrical.Transmission.BaseClasses.PartialTwoPortRLC (Partial model of an RLC element that links two electrical connectors).

### 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
Boolean | useHeatPort | false | =true, if HeatPort is enabled
Temperature | T | T_ref | Fixed device temperature if useHeatPort = false [K]
Resistance | R |  | Resistance at temperature T_ref [Ohm]
Temperature | T_ref | 298.15 | Reference temperature [K]
Temperature | M | 507.65 | Temperature constant (R_actual = R*(M + T_heatPort)/(M + T_ref)) [K]
Capacitance | C | 0 | Capacity [F]
Inductance | L |  | Inductance [H]
Current | i_start[PhaseSystem_p.n] | zeros(PhaseSystem_p.n) | Initial current phasor of the line (positive if entering from terminal p) [A]
Nominal conditions
Voltage | V_nominal | 0 | Nominal voltage (V_nominal >= 0) [V]
Modelling assumption
Load | mode | Buildings.Electrical.Types.L... | Type of model (e.g., steady state, dynamic, prescribed power consumption, etc.)

### Connectors

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

### Modelica definition

model TwoPortRL "Model of a resistive-inductive element with two electrical ports" extends Buildings.Electrical.Transmission.BaseClasses.PartialTwoPortRLC( final V_nominal=0, redeclare package PhaseSystem_p = PhaseSystems.OnePhase, redeclare package PhaseSystem_n = PhaseSystems.OnePhase, redeclare Interfaces.Terminal_n terminal_n, redeclare Interfaces.Terminal_p terminal_p, final C=0); parameter Modelica.SIunits.Current i_start[PhaseSystem_p.n] = zeros(PhaseSystem_p.n) "Initial current phasor of the line (positive if entering from terminal p)"; parameter Buildings.Electrical.Types.Load mode( min=Buildings.Electrical.Types.Load.FixedZ_steady_state, max=Buildings.Electrical.Types.Load.FixedZ_dynamic)= Buildings.Electrical.Types.Load.FixedZ_steady_state "Type of model (e.g., steady state, dynamic, prescribed power consumption, etc.)"; protected Modelica.SIunits.Current i_p[2](start = i_start, each stateSelect=StateSelect.prefer) "Current phasor at terminal p"; Modelica.SIunits.AngularVelocity omega "Frequency of the quasi-stationary sine waves"; initial equation if mode==Buildings.Electrical.Types.Load.FixedZ_dynamic then i_p = i_start; end if; equation omega = der(PhaseSystem_p.thetaRef(terminal_p.theta)); terminal_p.i = - terminal_n.i; i_p = terminal_p.i; if mode==Buildings.Electrical.Types.Load.FixedZ_dynamic then // Dynamics of the system der(L*i_p) + L*omega*PhaseSystem_p.j(i_p) + i_p*diagonal(ones(PhaseSystem_p.n)*R_actual) = terminal_p.v - terminal_n.v; else // steady state relationship L*omega*PhaseSystem_p.j(i_p) + i_p*diagonal(ones(PhaseSystem_p.n)*R_actual) = terminal_p.v - terminal_n.v; end if; // Joule losses LossPower = R_actual*(i_p[1]^2 + i_p[2]^2); end TwoPortRL;

## Buildings.Electrical.AC.OnePhase.Lines.TwoPortRLC

Model of an RLC element with two electrical ports

### Information

This model represents a series of two resistive-inductive impedances and a capacitance that connects two AC single phase interfaces. This model can be used to represent a cable in a AC grid.

The model represents the lumped resistances and capacity, as a T-model, as shown in the figure below.

As can be seen in the figure, the resistance R and the inductance L are split in two halves and the capacitance is located in the center. The capacitance in the center is optional. If it is not present, set the parameter `C=0`. The model is either dynamic or static depending on the presence of the capacitive effect.

Extends from Buildings.Electrical.Transmission.BaseClasses.PartialTwoPortRLC (Partial model of an RLC element that links two electrical connectors).

### 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
Boolean | useHeatPort | false | =true, if HeatPort is enabled
Temperature | T | T_ref | Fixed device temperature if useHeatPort = false [K]
Resistance | R |  | Resistance at temperature T_ref [Ohm]
Temperature | T_ref | 298.15 | Reference temperature [K]
Temperature | M | 507.65 | Temperature constant (R_actual = R*(M + T_heatPort)/(M + T_ref)) [K]
Capacitance | C |  | Capacity [F]
Inductance | L |  | Inductance [H]
Voltage | Vc_start[2] | {V_nominal,0} | Initial voltage phasor of the capacitance located in the middle of the line [V]
Modelling assumption
Load | mode | Buildings.Electrical.Types.L... | Type of model (e.g., steady state, dynamic, prescribed power consumption, etc.)

### Connectors

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

### Modelica definition

model TwoPortRLC "Model of an RLC element with two electrical ports" extends Buildings.Electrical.Transmission.BaseClasses.PartialTwoPortRLC( V_nominal(start = 110), redeclare package PhaseSystem_p = PhaseSystems.OnePhase, redeclare package PhaseSystem_n = PhaseSystems.OnePhase, redeclare Interfaces.Terminal_n terminal_n( redeclare package PhaseSystem = PhaseSystem_n), redeclare Interfaces.Terminal_p terminal_p( redeclare package PhaseSystem = PhaseSystem_p)); parameter Modelica.SIunits.Voltage Vc_start[2] = {V_nominal,0} "Initial voltage phasor of the capacitance located in the middle of the line"; parameter Buildings.Electrical.Types.Load mode( min=Buildings.Electrical.Types.Load.FixedZ_steady_state, max=Buildings.Electrical.Types.Load.FixedZ_dynamic)= Buildings.Electrical.Types.Load.FixedZ_steady_state "Type of model (e.g., steady state, dynamic, prescribed power consumption, etc.)"; protected Modelica.SIunits.Voltage Vc[2](start = Vc_start, each stateSelect=StateSelect.prefer) "Voltage of the Capacitance located in the middle of the line"; Modelica.SIunits.Current Ic[2] "Currenbt of the capacitance located in the middle of the line"; Modelica.SIunits.AngularVelocity omega "Frequency of the quasi-stationary sine waves"; initial equation if C > 0 and mode == Buildings.Electrical.Types.Load.FixedZ_dynamic then Vc = Vc_start; end if; equation omega = der(PhaseSystem_p.thetaRef(terminal_p.theta)); terminal_p.i + terminal_n.i = Ic; L/2*omega*Buildings.Electrical.PhaseSystems.OnePhase.j(terminal_p.i) + terminal_p.i*diagonal(ones(PhaseSystem_p.n)*R_actual/2) = terminal_p.v - Vc; L/2*omega*Buildings.Electrical.PhaseSystems.OnePhase.j(terminal_n.i) + terminal_n.i*diagonal(ones(PhaseSystem_n.n)*R_actual/2) = terminal_n.v - Vc; if C > 0 then if mode == Buildings.Electrical.Types.Load.FixedZ_dynamic then // Dynamics of the system C*der(Vc) + omega*C*Buildings.Electrical.PhaseSystems.OnePhase.j(Vc) = Ic; else // steady state relationship omega*C*Buildings.Electrical.PhaseSystems.OnePhase.j(Vc) = Ic; end if; else // No capacitive effect, the voltage in the middle of the line is the linear // interpolation of the two phasors Vc = (terminal_p.v + terminal_n.v)/2; end if; // Joule losses LossPower = R_actual/2*(terminal_p.i[1]^2 + terminal_p.i[2]^2) + R_actual/2*(terminal_n.i[1]^2 + terminal_n.i[2]^2); end TwoPortRLC;

## Buildings.Electrical.AC.OnePhase.Lines.TwoPortResistance

Model of a resistance with two electrical ports

### Information

This model represents a resistance that connects two AC one phase interfaces. This model can be used to represent a single phase cable in a AC grid.

The model represents the lumped resistance as shown in the figure below.

Extends from Buildings.Electrical.Transmission.BaseClasses.PartialTwoPortResistance (Partial model of a resistive element that links two electrical connectors).

### 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
Boolean | useHeatPort | false | =true, if HeatPort is enabled
Temperature | T | T_ref | Fixed device temperature if useHeatPort = false [K]
Resistance | R |  | Resistance at temperature T_ref [Ohm]
Temperature | T_ref | 298.15 | Reference temperature [K]
Temperature | M | 507.65 | Temperature constant (R_actual = R*(M + T_heatPort)/(M + T_ref)) [K]

### Connectors

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

### Modelica definition

model TwoPortResistance "Model of a resistance with two electrical ports" extends Buildings.Electrical.Transmission.BaseClasses.PartialTwoPortResistance ( redeclare package PhaseSystem_p = PhaseSystems.OnePhase, redeclare package PhaseSystem_n = PhaseSystems.OnePhase, redeclare Interfaces.Terminal_n terminal_n, redeclare Interfaces.Terminal_p terminal_p); equation terminal_p.v - terminal_n.v = terminal_p.i*diagonal(ones(PhaseSystem_p.n)*R_actual); // Joule losses LossPower = R_actual*(terminal_p.i[1]^2 + terminal_p.i[2]^2); end TwoPortResistance;