Line¶
Create Function¶
Lines can be either created from the standard type library (create_line) or with custom values (create_line_from_parameters).

pandapower.
create_line
(net, from_bus, to_bus, length_km, std_type, name=None, index=None, geodata=None, df=1., parallel=1, in_service=True, max_loading_percent=nan)¶ Creates a line element in net[“line”] The line parameters are defined through the standard type library.
 INPUT:
net  The net within this line should be created
from_bus (int)  ID of the bus on one side which the line will be connected with
to_bus (int)  ID of the bus on the other side which the line will be connected with
length_km (float)  The line length in km
std_type (string)  The linetype of a standard line predefined in standard_linetypes.
 OPTIONAL:
name (string, None)  A custom name for this line
index (int, None)  Force a specified ID if it is available. If None, the index one higher than the highest already existing index is selected.
geodata (array, default None, shape= (,2L))  The linegeodata of the line. The first row should be the coordinates of bus a and the last should be the coordinates of bus b. The points in the middle represent the bending points of the line
in_service (boolean, True)  True for in_service or False for out of service
df (float, 1)  derating factor: maximal current of line in relation to nominal current of line (from 0 to 1)
parallel (integer, 1)  number of parallel line systems
max_loading_percent (float)  maximum current loading (only needed for OPF)
 OUTPUT:
 index (int)  The unique ID of the created line
 EXAMPLE:
 create_line(net, “line1”, from_bus = 0, to_bus = 1, length_km=0.1, std_type=”NAYY 4x50 SE”)

pandapower.
create_line_from_parameters
(net, from_bus, to_bus, length_km, r_ohm_per_km, x_ohm_per_km, c_nf_per_km, max_i_ka, name=None, index=None, type=None, geodata=None, in_service=True, df=1., parallel=1, g_us_per_km=0., max_loading_percent=nan, **kwargs)¶ Creates a line element in net[“line”] from line parameters.
 INPUT:
net  The net within this line should be created
from_bus (int)  ID of the bus on one side which the line will be connected with
to_bus (int)  ID of the bus on the other side which the line will be connected with
length_km (float)  The line length in km
r_ohm_per_km (float)  line resistance in ohm per km
x_ohm_per_km (float)  line reactance in ohm per km
c_nf_per_km (float)  line capacitance in nano Farad per km
max_i_ka (float)  maximum thermal current in kilo Ampere
 OPTIONAL:
name (string, None)  A custom name for this line
index (int, None)  Force a specified ID if it is available. If None, the index one higher than the highest already existing index is selected.
in_service (boolean, True)  True for in_service or False for out of service
type (str, None)  type of line (“ol” for overhead line or “cs” for cable system)
df (float, 1)  derating factor: maximal current of line in relation to nominal current of line (from 0 to 1)
g_us_per_km (float, 0)  dielectric conductance in micro Siemens per km
parallel (integer, 1)  number of parallel line systems
geodata (array, default None, shape= (,2L))  The linegeodata of the line. The first row should be the coordinates of bus a and the last should be the coordinates of bus b. The points in the middle represent the bending points of the line
max_loading_percent (float)  maximum current loading (only needed for OPF)
 OUTPUT:
 index (int)  The unique ID of the created line
 EXAMPLE:
 create_line_from_parameters(net, “line1”, from_bus = 0, to_bus = 1, lenght_km=0.1, r_ohm_per_km = .01, x_ohm_per_km = 0.05, c_nf_per_km = 10, max_i_ka = 0.4)
Input Parameters¶
net.line
Parameter  Datatype  Value Range  Explanation 
name  string  name of the line  
std_type  string  standard type which can be used to easily define line parameters with the pandapower standard type library  
from_bus*  integer  Index of bus where the line starts  
to_bus*  integer  Index of bus where the line ends  
length_km*  float  \(>\) 0  length of the line [km] 
r_ohm_per_km*  float  \(\geq\) 0  resistance of the line [Ohm per km] 
x_ohm_per_km*  float  \(\geq\) 0  inductance of the line [Ohm per km] 
c_nf_per_km*  float  \(\geq\) 0  capacitance of the line [nano Farad per km] 
g_us_per_km*  float  \(\geq\) 0  dielectric conductance of the line [micro Siemens per km] 
max_i_ka*  float  \(>\) 0  maximal thermal current [kilo Ampere] 
parallel*  integer  \(\geq\) 1  number of parallel line systems 
df*  float  0…1  derating factor (scaling) for max_i_ka 
type  string  Naming conventions:
“ol”  overhead line
“cs”  underground cable system

type of line 
max_loading_percent**  float  \(>\) 0  Maximum loading of the line 
endtemp_degree***  float  \(>\) 0  ShortCircuit end temperature of the line 
in_service*  boolean  True / False  specifies if the line is in service. 
*necessary for executing a power flow calculation
**optimal power flow parameter
***shortcircuit calculation parameter
Note
Defining a line with length zero leads to a division by zero in the power flow and is therefore not allowed. Lines with a very low impedance might lead to convergence problems in the power flow for the same reason. If you want to directly connect two buses, please use the switch element instead of a line with a small impedance!
net.line_geodata
Parameter  Datatype  Explanation 
coords  list  List of (x,y) tuples that mark the inflexion points of the line 
Electric Model¶
Lines are modelled with the \(\pi\)equivalent circuit:
The elements in the equivalent circuit are calculated from the parameters in the net.line dataframe as:
The power system frequency \(f\) is defined when creating an empty network, the default value is \(f = 50 Hz\).
The parameters are then transformed in the per unit system:
Where the reference voltage \(V_{N}\) is the nominal voltage at the from bus and the rated apparent power \(S_{N}\) is defined system wide in the net object (see Unit Systems and Conventions).
Note
pandapower assumes that nominal voltage of from bus and to bus are equal, which means pandapower does not support lines that connect different voltage levels. If you want to connect different voltage levels, either use a transformer or an impedance element.
Result Parameters¶
net.res_line
Parameter  Datatype  Explanation 
p_from_kw  float  active power flow into the line at “from” bus [kW] 
q_from_kvar  float  reactive power flow into the line at “from” bus [kVar] 
p_to_kw  float  active power flow into the line at “to” bus [kW] 
q_to_kvar  float  reactive power flow into the line at “to” bus [kVar] 
pl_kw  float  active power losses of the line [kW] 
ql_kvar  float  reactive power consumption of the line [kVar] 
i_from_ka  float  Current at to bus [kA] 
i_to_ka  float  Current at from bus [kA] 
i_ka  float  Maximum of i_from_ka and i_to_ka [kA] 
loading_percent  float  line loading [%] 
The power flow results in the net.res_line table are defined as:
net.res_line_est
The state estimation results are put into net.res_line_est with the same definition as in net.res_line.
Parameter  Datatype  Explanation 
p_from_kw  float  active power flow into the line at “from” bus [kW] 
q_from_kvar  float  reactive power flow into the line at “from” bus [kVar] 
p_to_kw  float  active power flow into the line at “to” bus [kW] 
q_to_kvar  float  reactive power flow into the line at “to” bus [kVar] 
pl_kw  float  active power losses of the line [kW] 
ql_kvar  float  reactive power consumption of the line [kVar] 
i_from_ka  float  Current at to bus [kA] 
i_to_ka  float  Current at from bus [kA] 
i_ka  float  Maximum of i_from_ka and i_to_ka [kA] 
loading_percent  float  line loading [%] 