cable module
Module: cable.py
Description
Cable data structures and cable database loading helpers for PyPacity ampacity studies.
Copyright
Copyright (c) 2026 Group of Advanced Electro-Technologies (GTEA). Universidad de Cantabria. All rights reserved.
License
SPDX-License-Identifier: GPL-3.0-only
Notes
This module is part of the PyPacity project.
References
IEEE Std 738-2012, IEEE Standard for Calculating the Current-Temperature Relationship of Bare Overhead Conductors
CIGRE Technical Brochure 601, Guide for Thermal Rating Calculations of Overhead Lines
CIGRE Technical Brochure 207, Thermal Rating of Overhead Lines
- class pypacity.cable.cable.Cable
Bases:
objectElectrical and thermal data for an overhead conductor.
Stores the physical, electrical, and thermal properties of a bare overhead conductor. Properties are loaded from the built-in cable database via
set_cable()or assigned directly by the caller.Attributes
Attribute
Type
Description
IDstr
Conductor identifier.
Dfloat
Outside conductor diameter in millimeters.
D1float
Equivalent steel-core tube diameter in millimeters.
dfloat
Wire diameter in the outermost layer in millimeters.
TLOfloat
Low reference temperature for resistance in deg C.
THIfloat
High reference temperature for resistance in deg C.
TCDRMAXfloat
Maximum allowable conductor temperature in deg C.
RLOfloat
Conductor resistance at
TLOin ohm/m.RHIfloat
Conductor resistance at
THIin ohm/m.Bfloat
Slope of the linear resistance-temperature equation in ohm/(m.deg C). Computed as
(RHI - RLO) / (THI - TLO).B1float
Intercept of the linear resistance-temperature equation in ohm/m. Computed as
RLO - B * TLO.EMISSfloat
Surface emissivity coefficient.
ABSORPfloat
Solar absorptivity coefficient.
HNHint
Number of aluminum layers.
Strandedint
1 for stranded conductors, 0 for smooth conductors.
CrossSectionfloat
Conductor cross-sectional area in mm².
MASSCOREfloat
Steel core mass per unit length in kg/m.
MASSOUTfloat
Aluminum outer layer mass per unit length in kg/m.
HEATOUTfloat
Aluminum heat capacity contribution in W.s/(m.deg C).
HEATCOREfloat
Steel-core heat capacity contribution in W.s/(m.deg C).
HEATCAPfloat
Total heat capacity per unit length in W.s/(m.deg C), equal to
HEATOUT + HEATCORE. Set byset_cable().deltaTcTs_valuefloat
Temperature difference between conductor core and surface in deg C.
CSteel20float
Steel specific heat at 20 deg C in J/(kg.K).
CAlum20float
Aluminum specific heat at 20 deg C in J/(kg.K).
BetaSteel20float
Steel specific-heat temperature coefficient.
BetaAlum20float
Aluminum specific-heat temperature coefficient.
mSteelfloat
Steel mass per unit length in kg/m.
mAlumfloat
Aluminum mass per unit length in kg/m.
lambda_ertcfloat
Effective radial thermal conductivity in W/(m.K).
- load_cable_db()
Load the cable database distributed with this package.
Reads
cable_db.csvfrom the same directory as this module. The file uses a semicolon separator and contains one row per conductor with the columns:ID,D,D1,d,TLO,THI,TCDRMAX,RLO,RHI,HNH,HEATOUT,HEATCORE.- Returns:
A tuple
(cable_db, error)wherecable_dbis apandas.DataFramewith one row per conductor, anderroris0if at least one conductor was loaded or1if the database file is empty.- Return type:
tuple
- Raises:
FileNotFoundError – If
cable_db.csvis not found in the package directory.
- set_cable(NSELECT, conductor='DRAKE')
Load one conductor definition from the cable database.
Reads the conductor identified by
conductorfromcable_db.csv, applies default material and surface properties, and then adjusts temperature limits and heat capacity values according to the analysis modeNSELECT. Conductor matching is case-insensitive.- Parameters:
NSELECT (int) –
Analysis mode selector:
1: steady-state conductor temperature.2: steady-state ampacity; setsTCDRPRELOADto 101.1 deg C.3: high-temperature transient; overridesHEATOUT,HEATCORE, andTCDRMAX.4: limited-temperature transient; overridesTCDRMAX,HEATOUT, andHEATCORE.
conductor (str) – Conductor identifier as listed in
cable_db.csv. Defaults to'DRAKE'.
- Raises:
ValueError – If the cable database is empty or
conductoris not found incable_db.csv.
Note
Results are stored directly in the instance attributes (see class docstring) rather than returned. After this call,
HEATCAPis set toHEATOUT + HEATCORE.
- _get_cable_data(conductor)
Return the database row that matches a conductor ID.
Strips leading and trailing whitespace from
conductorbefore matching. Matching is case-insensitive, sodrake,DRAKE, andDrakeall select the same conductor.- Parameters:
conductor (str) – Conductor identifier to look up in
cable_db.csv.- Returns:
Row from
cable_db.csvcorresponding to the requested conductor.- Return type:
pandas.Series
- Raises:
ValueError – If the cable database is empty, or if
conductoris not found incable_db.csv. The error message lists the available conductor IDs when the conductor is unknown.
- _apply_cable_data(data)
Copy conductor-specific database values to this cable object.
Assigns the values from a single database row to the corresponding instance attributes.
RLOandRHIare converted from ohm/km (as stored incable_db.csv) to ohm/m by dividing by 1000.- Parameters:
data (pandas.Series) – Row from
cable_db.csvfor one conductor, as returned by_get_cable_data().
Note
Sets the following attributes:
ID,D,D1,d,TLO,THI,TCDRMAX,HEATOUT,HEATCORE,HNH,RLO,RHI.
- _set_common_properties()
Set default material, surface, and thermal properties.
Assigns the default values used by the built-in standard examples. These assumptions follow the IEEE 738 and CIGRE TB 601 reference cases and may be overwritten after
set_cable()if a study requires different conductor properties.Note
Sets the following attributes with their default values:
EMISS = 0.5,ABSORP = 0.5,CSteel20 = 481.0J/(kg.K),CAlum20 = 897.0J/(kg.K),BetaSteel20 = 1.00e-4,BetaAlum20 = 3.80e-4,mSteel = 0.5119kg/m,mAlum = 1.116kg/m,lambda_ertc = 0.7W/(m.K).
- _apply_analysis_mode_overrides(NSELECT)
Apply mode-specific overrides for built-in ampacity examples.
Adjusts conductor temperature limits and heat capacity values according to the analysis mode before the solver runs. Values not covered by a given mode are left unchanged.
- Parameters:
NSELECT (int) –
Analysis mode selector. Recognised values:
2: steady-state ampacity; setsTCDRPRELOADto 101.1 deg C.3: high-temperature transient; setsHEATOUT = 1066W.s/(m.deg C),HEATCORE = 243W.s/(m.deg C), andTCDRMAX = 1000deg C.4: limited-temperature transient; setsTCDRMAX = 150deg C,HEATOUT = 1066W.s/(m.deg C), andHEATCORE = 243W.s/(m.deg C).Any other value: no overrides are applied.
Note
For
NSELECT = 3andNSELECT = 4, theHEATOUTandHEATCOREvalues loaded from the database are replaced by fixed values from the IEEE 738 standard examples.
- print_ver()
Print the module name and release date to standard output.