Lines¶
Definition¶
Lines are modeled using passive components lumped in a PI section. The lumped parameters are defined using the series impedance matrix \(\underline{Z}\) and the shunt admittance matrix \(\underline{Y}\).
Matrices definition¶
Before diving into the different line models, lets define the series impedance matrix \(\underline{Z}\), and the shunt admittance matrix \(\underline{Y}\) used to model the lines.
Series impedance matrix¶
The series impedance matrix \(\underline{Z}\), in \(\Omega\), consists of the series resistance of the conductors (\(R\in{\mathbb{R}^+}^4\)), the self-inductances (\(L\in\mathbb{R}^4\)) and the mutual inductances (\(M\in\mathbb{R}^{12}\)).
Admittance matrix¶
Warning
The admittance matrix \(\underline{y}\) shouldn’t be confused with the shunt admittance matrix \(\underline{Y}\) defined below.
\(\underline{y}\) represents the admittances between each node, while \(\underline{Y}\) is used to compute the currents and voltages.
with \(G\in\mathbb{R}^4\) the conductance of the line, \(B\in\mathbb{R}^4\) the susceptance of the line and \(C\in\mathbb{R}^{16}\) the transverse susceptances of the line.
Shunt admittance matrix¶
The shunt admittance matrix \(\underline{Y}\) is defined from the admittance matrix \(\underline{y}\) as:
Line parameters¶
The parameters of the lines are defined using the LineParameters
class. It takes the series
impedance matrix \(\underline{Z}\) and optionally, the shunt admittance matrix \(\underline{Y}\). The
first one must be given in \(\Omega\)/km (or an equivalent unit) and the second must be given in
\(S/km\) (or an equivalent unit).
import numpy as np
import roseau.load_flow as rlf
# An impedance matrix
z_line = rlf.Q_(
np.array(
[
[0.3 + 0.35j, 0.25j, 0.25j, 0.25j],
[0.25j, 0.3 + 0.35j, 0.25j, 0.25j],
[0.25j, 0.25j, 0.3 + 0.35j, 0.25j],
[0.25j, 0.25j, 0.25j, 0.3 + 0.35j],
]
),
"ohm/km",
)
# A shunt admittance matrix
y_shunt = rlf.Q_(
np.array(
[
[20 + 475j, -68j, -10j, -68j],
[-68j, 20 + 475j, -68j, -10j],
[-10j, -68j, 20 + 475j, -68j],
[-68j, -10j, -68j, 20 + 475j],
]
),
"uS/km", # micro Siemens per kilometer
)
# The line parameter for a simple line (no shunt)
simple_line_parameters = rlf.LineParameters(id="simple_line_parameters", z_line=z_line)
# The line parameter for a line with a shunt
shunt_line_parameters = rlf.LineParameters(
id="shunt_line_parameters", z_line=z_line, y_shunt=y_shunt
)
Tip
The Line
instance itself has the z_line
and y_shunt
properties. They retrieve the line impedance in \(\Omega\)
and the line shunt admittance in Siemens (taking into account the length of the line).
There are several alternative constructors for LineParameters
objects. The description of them can be found in the
dedicated Line parameters page.
Available models¶
The following line models are available in Roseau Load Flow. Please also have a look at the parameters page to define the parameters of lines.
API Reference¶
- class LineParameters(id: Id, z_line: ComplexArrayLike2D, y_shunt: ComplexArrayLike2D | None = None, ampacities: roseau.load_flow.typing.FloatScalarOrArrayLike1D | None = None, line_type: LineType | None = None, materials: Material | Sequence[Material] | None = None, insulators: Insulator | Sequence[Insulator] | None = None, sections: roseau.load_flow.typing.FloatScalarOrArrayLike1D | None = None)
Bases:
roseau.load_flow.utils.Identifiable
,roseau.load_flow.utils.JsonMixin
,roseau.load_flow.utils.CatalogueMixin[pandas.DataFrame]
Parameters that define electrical models of lines.
LineParameters constructor.
- Parameters:
id – A unique ID of the line parameters, typically its canonical name.
z_line – The Z matrix of the line (Ohm/km).
y_shunt – The Y matrix of the line (Siemens/km). This field is optional if the line has no shunt part.
ampacities –
The ampacities of the line (A). The ampacities are optional, they are not used in the load flow but can be used to check for overloading. See also
Line.res_violated
.When a scalar value is provided, it creates an array with the same ampacity for each conductor. The scalar value passed is assumed to be the ampacity of each conductor. To create a different ampacity per conductor, provide a vector of current values with the same length as the number of conductor of the line.
line_type – The type of the line (overhead, underground, twisted). The line type is optional, it is informative only and is not used in the load flow. This field gets automatically filled when the line parameters are created from a geometric model or from the catalogue.
materials – The types of the conductor material (Aluminum, Copper, …). The materials are optional, they are informative only and are not used in the load flow. This field gets automatically filled when the line parameters are created from a geometric model or from the catalogue.
insulators – The types of the cable insulator (PVC, XLPE, …). The insulators are optional, they are informative only and are not used in the load flow. This field gets automatically filled when the line parameters are created from a geometric model or from the catalogue.
sections –
The sections of the conductor. The sections are optional, thy are informative only and are not used in the load flow. This field gets automatically filled when the line parameters are created from a geometric model or from the catalogue.
When a scalar value is provided, it creates an array with the same section for each conductor. To create different sections per conductor, provide a vector of section values with the same length as the number of conductor of the line.
- property ampacities: Q_[roseau.load_flow.typing.FloatArray] | None
The ampacities of the line (A) if it is set.
- property materials: MaterialArray | None
The materials of the conductors. Informative only, it has no impact on the load flow.
- property insulators: InsulatorArray | None
The insulators of the conductors. Informative only, it has no impact on the load flow.
- property sections: Q_[roseau.load_flow.typing.FloatArray] | None
The cross-section areas of the cable (in mm²). Informative only, it has no impact on the load flow.
- property z_line: Q_[ComplexArray]
- property y_shunt: Q_[ComplexArray]
- property with_shunt: bool
- property line_type: LineType | None
The type of the line. Informative only, it has no impact on the load flow.
- classmethod from_sym(id: Id, z0: complex | Q_[complex], z1: complex | Q_[complex], y0: complex | Q_[complex], y1: complex | Q_[complex], zn: complex | Q_[complex] | None = None, xpn: float | Q_[float] | None = None, bn: float | Q_[float] | None = None, bpn: float | Q_[float] | None = None, ampacities: roseau.load_flow.typing.FloatScalarOrArrayLike1D | None = None) typing_extensions.Self
Create line parameters from a symmetric model.
- Parameters:
id – A unique ID of the line parameters, typically its canonical name.
z0 – Impedance - zero sequence - \(r_0+x_0\cdot j\) (ohms/km)
z1 – Impedance - direct sequence - \(r_1+x_1\cdot j\) (ohms/km)
y0 – Admittance - zero sequence - \(g_0+b_0\cdot j\) (Siemens/km)
y1 – Conductance - direct sequence - \(g_1+b_1\cdot j\) (Siemens/km)
zn – Neutral impedance - \(r_{\mathrm{n}}+x_{\mathrm{n}}\cdot j\) (ohms/km)
xpn – Phase-to-neutral reactance (ohms/km)
bn – Neutral susceptance (siemens/km)
bpn – Phase-to-neutral susceptance (siemens/km)
ampacities – An optional ampacities loading of the line (A). It is not used in the load flow.
- Returns:
The created line parameters.
Notes
As explained in the Line parameters alternative constructor documentation, the model may be “degraded” if the computed impedance matrix is not invertible.
- classmethod from_geometry(id: Id, *, line_type: LineType, material: Material | None = None, material_neutral: Material | None = None, insulator: Insulator | None = None, insulator_neutral: Insulator | None = None, section: float | Q_[float], section_neutral: float | Q_[float] | None = None, height: float | Q_[float], external_diameter: float | Q_[float], ampacity: float | Q_[float] | None = None, ampacity_neutral: float | Q_[float] | None = None) typing_extensions.Self
Create line parameters from its geometry.
- Parameters:
id – The id of the line parameters type.
line_type – Overhead or underground. See also
LineType
.material – Material of the conductor. If
None
,ACSR
is used for overhead lines andAL
for underground or twisted lines. See alsoMaterial
.material_neutral – Material of the conductor If
None
, it will be the same as the insulator of the other phases.insulator – Type of insulator. If
None
,XLPE
is used for twisted lines andPVC
for underground lines. See alsoInsulator
. Please provideNONE
for cable without insulator.insulator_neutral – Type of insulator. If
None
, it will be the same as the insulator of the other phases. See alsoInsulator
. Please provideNONE
for cable without insulator.section – Cross-section surface area of the phases (mm²).
section_neutral – Cross-section surface area of the neutral (mm²). If
None
it will be the same as the section of the other phases.height – Height of the line (m). It must be positive for overhead lines and negative for underground lines.
external_diameter – External diameter of the cable (m).
ampacity – An optional ampacity of the phases of the line (A). It is not used in the load flow.
ampacity_neutral – An optional ampacity of the neutral of the line (A). It is not used in the load flow. If
None
it will be the same as the ampacity of the other phases.
- Returns:
The created line parameters.
- classmethod from_coiffier_model(name: str, nb_phases: int = 3, id: Id | None = None) typing_extensions.Self
Get the electrical parameters of a MV line using Alain Coiffier’s method (France specific model).
- Parameters:
name – The canonical name of the line parameters. It must be in the format LineType_Material_CrossSection. E.g. “U_AL_150”.
nb_phases – The number of phases of the line between 1 and 4, defaults to 3. It represents the size of the
z_line
andy_shunt
matrices.id – A unique ID for the created line parameters object (optional). If
None
(default), the id of the created object will be the canonical name.
- Returns:
The corresponding line parameters.
- classmethod from_power_factory(id: Id, *, r0: float | Q_[float], r1: float | Q_[float], x0: float | Q_[float], x1: float | Q_[float], b0: float | Q_[float], b1: float | Q_[float], rn: float | Q_[float] | None = None, xn: float | Q_[float] | None = None, bn: float | Q_[float] | None = None, rpn: float | Q_[float] | None = None, xpn: float | Q_[float] | None = None, bpn: float | Q_[float] | None = None, nphase: int = 3, nneutral: int = 0, inom: float | Q_[float] | None = None, cohl: Literal[0, 'Cable', 1, 'OHL'] = 'Cable', conductor: Literal['Al', 'Cu', 'Ad', 'As', 'Ds'] | None = None, insulation: Literal[0, 'PVC', 1, 'XLPE', 2, 'Mineral', 3, 'Paper', 4, 'EPR'] | None = None, section: float | Q_[float] | None = None) typing_extensions.Self
Create a line parameters object from PowerFactory “TypLne” data.
- Parameters:
id – A unique ID of the line parameters.
r0 – PwF parameter rline0 (AC-Resistance R0’). Zero sequence resistance in (ohms/km).
r1 – PwF parameter rline (AC-Resistance R1’). Direct sequence resistance in (ohms/km).
x0 – PwF parameter xline0 (Reactance X0’). Zero sequence reactance in (ohms/km).
x1 – PwF parameter xline (Reactance X1’). Direct sequence reactance in (ohms/km).
b0 – PwF parameter bline0 (Susceptance B0’). Zero sequence susceptance in (µS/km).
b1 – PwF parameter bline (Susceptance B’). Direct sequence susceptance in (µS/km).
rn – PwF parameter rnline (AC-Resistance Rn’). Neutral resistance in (ohms/km).
xn – PwF parameter xnline (Reactance Xn’). Neutral reactance in (ohms/km).
bn – PwF parameter bnline (Susceptance Bn’). Neutral susceptance in (µS/km).
rpn – PwF parameter rnpline (AC-Resistance Rpn’). Phase-Neutral coupling resistance in (ohms/km).
xpn – PwF parameter xnpline (Reactance Xpn’). Phase-Neutral coupling reactance in (ohms/km).
bpn – PwF parameter bnpline (Susceptance Bpn’). Phase-Neutral coupling susceptance in (µS/km).
nphase – PwF parameter nlnph (Phases). The number of phases of the line between 1 and 3. This should not count the neutral conductor.
nneutral – PwF parameter nneutral (Number of Neutrals). The number of neutrals of the line. It can be either 0 or 1.
cohl – PwF parameter cohl_ (Cable/OHL). The type of the line; ‘Cable’ or 0 mean an underground cable and ‘OHL’ or 1 mean an overhead line.
inom – PwF parameter sline or InomAir (Rated Current in ground or in air). The rated current in (kA) of the line. It is used as the ampacity for analysis of network constraint violations. Pass the sline parameter if the line is an underground cable (cohl=’Cable’) or the InomAir parameter if the line is an overhead line (cohl=’OHL’).
conductor – PwF parameter mlei (Conductor Material). The material used for the conductors. It can be one of: ‘Al’ (Aluminium), ‘Cu’ (Copper), ‘Ad’ (Aldrey AlMgSi), ‘As’ (Aluminium-Steel), ‘Ds’ (Aldrey-Steel).
insulation – PwF parameter imiso (Insulation Material). The material used for the conductor’s insulation. It can be one of ‘PVC’ (0), ‘XLPE’ (1), ‘Mineral’ (2), ‘Paper’ (3) or ‘EPR’ (4). If
None
is provided, the insulation is not filled in the resulting instance.section – PwF parameter qurs (Nominal Cross-Section). The nominal cross-sectional area of the conductors in (mm²).
- Returns:
The created line parameters.
- classmethod from_open_dss(id: Id, *, nphases: int, r1: float | Q_[float], r0: float | Q_[float], x1: float | Q_[float], x0: float | Q_[float], c1: float | Q_[float] = 3.4, c0: float | Q_[float] = 1.6, basefreq: float | Q_[float] = F, normamps: roseau.load_flow.typing.FloatScalarOrArrayLike1D | None = None, linetype: str | None = None) typing_extensions.Self
Create a line parameters object from OpenDSS “LineCode” data.
- Parameters:
id – The unique ID of the line parameters.
nphases – OpenDSS parameter: NPhases. Number of phases in the line this line code represents. To create single-phase lines with a neutral pass nphases=2, for three-phase lines with a neutral nphases=4, etc.
r1 – OpenDSS parameter: R1. Positive-sequence resistance in (ohm/km).
r0 – OpenDSS parameter: R0. Positive-sequence resistance in (ohm/km).
x1 – OpenDSS parameter: X1. Positive-sequence reactance in (ohm/km).
x0 – OpenDSS parameter: X0. Positive-sequence reactance in (ohm/km).
c1 – OpenDSS parameter: C1. Positive-sequence capacitance in (nF/km).
c0 – OpenDSS parameter: C0. Positive-sequence capacitance in (nF/km).
basefreq – OpenDSS parameter: BaseFreq. Frequency at which impedances are specified (Hz). Defaults to 50 Hz.
normamps – OpenDSS parameter: NormAmps. Normal ampere limit on line (A). This is the so-called Planning Limit. It may also be the value above which load will have to be dropped in a contingency. Usually about 75% - 80% of the emergency (one-hour) rating. This value is passed to ampacities and used for violation checks.
linetype – OpenDSS parameter: LineType. Code designating the type of line. Only
"OH"
(overhead) and"UG"
(underground) are currently supported.
- Returns:
The corresponding line parameters object.
Example usage:
# DSS command: `New linecode.240sq nphases=3 R1=0.127 X1=0.072 R0=0.342 X0=0.089 units=km` lp = LineParameters.from_open_dss( id="linecode-240sq", nphases=3, # creates 3x3 Z,Y matrices r1=Q_(0.127, "ohm/km"), x1=Q_(0.072, "ohm/km"), r0=Q_(0.342, "ohm/km"), x0=Q_(0.089, "ohm/km"), c1=Q_(3.4, "nF/km"), # default value used in OpenDSS code c0=Q_(1.6, "nF/km"), # default value used in OpenDSS code ) # DSS command: `New LineCode.16sq NPhases=1 R1=0.350, X1=0.025, R0=0.366, X0=0.025, C1=1.036, C0=0.488 Units=kft NormAmps=400` lp = LineParameters.from_open_dss( id="linecode-16sq", nphases=1, # creates 1x1 Z,Y matrices r1=Q_(0.350, "ohm/kft"), x1=Q_(0.025, "ohm/kft"), r0=Q_(0.366, "ohm/kft"), x0=Q_(0.025, "ohm/kft"), c1=Q_(1.036, "nF/kft"), c0=Q_(0.488, "nF/kft"), normamps=Q_(400, "A"), )
- classmethod catalogue_path() Path
Get the path to the catalogue.
- classmethod catalogue_data() DataFrame
Get the catalogue data.
- classmethod from_catalogue(name: str | Pattern[str] | None = None, line_type: str | None = None, material: str | None = None, material_neutral: str | None = None, insulator: str | None = None, insulator_neutral: str | None = None, section: float | Q_[float] | None = None, section_neutral: float | Q_[float] | None = None, id: Id | None = None, nb_phases: int = 3) typing_extensions.Self
Create line parameters from a catalogue.
- Parameters:
name – The name of the line parameters to get from the catalogue. It can be a regular expression.
line_type – The type of the line parameters to get. It can be
"overhead"
,"twisted"
, or"underground"
. See alsoLineType
.material – The type of the conductor material (Al, Cu, …) of the phases. See also
Material
.material_neutral – The type of the conductor material (Al, Cu, …) of the neutral. See also
Material
.insulator – The insulator of the phases. See also
Insulator
. Please provideNONE
for cable without insulator.insulator_neutral – The insulator of the neutral. See also
Insulator
. Please provideNONE
for cable without insulator.section – The cross-section surface area of the phases (mm²).
section_neutral – The cross-section surface area of the neutral (mm²).
id – A unique ID for the created line parameters object (optional). If
None
(default), the id of the created object will be its name in the catalogue. Note that this parameter is not used in the data filtering.nb_phases – The number of phases of the line between 1 and 4, defaults to 3. It represents the size of the
z_line
andy_shunt
matrices.
- Returns:
The created line parameters.
- classmethod get_catalogue(name: str | Pattern[str] | None = None, line_type: str | None = None, material: str | None = None, material_neutral: str | None = None, insulator: str | None = None, insulator_neutral: str | None = None, section: float | Q_[float] | None = None, section_neutral: float | Q_[float] | None = None) DataFrame
Get the catalogue of available lines.
You can use the parameters below to filter the catalogue. If you do not specify any parameter, all the catalogue will be returned.
- Parameters:
name – The name of the line parameters to get from the catalogue. It can be a regular expression.
line_type – The type of the line parameters to get. It can be
"overhead"
,"twisted"
, or"underground"
. See alsoLineType
.material – The type of the conductor material (Al, Cu, …) of the phases. See also
Material
.material_neutral – The type of the conductor material (Al, Cu, …) of the neutral. See also
Material
.insulator – The insulator of the phases. See also
Insulator
. Please provideNONE
for cable without insulator.insulator_neutral – The insulator of the neutral. See also
Insulator
. Please provideNONE
for cable without insulator.section – The cross-section surface area of the phases (mm²).
section_neutral – The cross-section surface area of the neutral (mm²).
- Returns:
The catalogue data as a dataframe.
- classmethod from_dict(data: JsonDict, *, include_results: bool = True) typing_extensions.Self
Line parameters constructor from dict.
- Parameters:
data – The dictionary data of the line parameters.
include_results – If True (default) and the results of the load flow are included in the dictionary, the results are also loaded into the element. Useless here as line parameters don’t contain results.
- Returns:
The created line parameters.
- class Line(id: Id, bus1: roseau.load_flow.models.buses.Bus, bus2: roseau.load_flow.models.buses.Bus, *, parameters: roseau.load_flow.models.lines.parameters.LineParameters, length: float | Q_[float], phases: str | None = None, ground: roseau.load_flow.models.grounds.Ground | None = None, max_loading: float | Q_[float] = 1, geometry: shapely.geometry.base.BaseGeometry | None = None)
Bases:
roseau.load_flow.models.branches.AbstractBranch
An electrical line PI model with series impedance and optional shunt admittance.
Line constructor.
- Parameters:
id – A unique ID of the line in the network branches.
bus1 – The first bus (aka “from_bus”) to connect to the line.
bus2 – The second bus (aka “to_bus”) to connect to the line.
parameters – Parameters defining the electric model of the line using its impedance and shunt admittance matrices. This is an instance of the
LineParameters
class and can be used by multiple lines.length – The length of the line (in km).
phases – The phases of the line. A string like
"abc"
or"an"
etc. The order of the phases is important. For a full list of supported phases, see the class attributeallowed_phases
. All phases of the line must be present in the phases of both connected buses. By default, the phases common to both buses are used.ground – The ground element attached to the line if it has shunt admittance.
max_loading – The maximum loading of the line (unitless). It is not used in the load flow. It is used with the ampacities of the
LineParameters
to compute themax_currents()
of the line.geometry – The geometry of the line i.e. the linestring.
- allowed_phases: Final
The allowed phases for a line are:
P-P-P or P-P-P-N:
"abc"
,"abcn"
P-P or P-P-N:
"ab"
,"bc"
,"ca"
,"abn"
,"bcn"
,"can"
P or P-N:
"a"
,"b"
,"c"
,"an"
,"bn"
,"cn"
N:
"n"
- ground = None
- property parameters: roseau.load_flow.models.lines.parameters.LineParameters
The parameters defining the impedance and shunt admittance matrices of line model.
- property phases: str
The phases of the line. This is an alias for
phases1
andphases2
.
- property z_line: Q_[ComplexArray]
Impedance of the line (in Ohm).
- property y_shunt: Q_[ComplexArray]
Shunt admittance of the line (in Siemens).
- property ampacities: Q_[roseau.load_flow.typing.FloatArray] | None
The ampacities of the line (in A).
- property max_currents: Q_[roseau.load_flow.typing.FloatArray] | None
The maximum current of the line defined as max_loading * parameters.ampacities (in A).
- property with_shunt: bool
- property res_series_currents: Q_[ComplexArray]
Get the current in the series elements of the line (in A).
- property res_series_power_losses: Q_[ComplexArray]
Get the power losses in the series elements of the line (in VA).
- property res_shunt_currents: tuple[Q_[ComplexArray], Q_[ComplexArray]]
Get the currents in the shunt elements of the line (in A).
- property res_shunt_power_losses: Q_[ComplexArray]
Get the power losses in the shunt elements of the line (in VA).
- property res_power_losses: Q_[ComplexArray]
Get the power losses in the line (in VA).