Skip to content

cable_air

CableAir

CableAir(conductor: CableConductorProperties, layer_properties: dict[CableLayer, CableLayerProperties], layer_metrics: CableLayerMetrics, cable_type: CableType, grid_counts: dict[CableLayer, int])

Bases: Cable

Finite difference cable model with air discretization.

Attributes:

Name Type Description
_bottomright_index tuple[int, int]

Index tuple (row, col) for accessing the bottom-right element of the banded matrix used in convection boundary condition updates.

Parameters:

Name Type Description Default
conductor CableConductorProperties

Conductor properties of the cable.

required
layer_properties dict[CableLayer, CableLayerProperties]

Mapping of cable layers to their properties.

required
layer_metrics CableLayerMetrics

Geometric and calculated metrics for the cable layers.

required
cable_type CableType

The type of the cable.

required
grid_counts dict[CableLayer, int]

Number of grid points per cable layer.

required
Source code in cable_thermal_model/model/cables/cable_air.py
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def __init__(
    self,
    conductor: CableConductorProperties,
    layer_properties: dict[CableLayer, CableLayerProperties],
    layer_metrics: CableLayerMetrics,
    cable_type: CableType,
    grid_counts: dict[CableLayer, int],
):
    """Initialize CableAir with convection parameters set to None until explicitly configured.

    Args:
        conductor (CableConductorProperties): Conductor properties of the cable.
        layer_properties (dict[CableLayer, CableLayerProperties]): Mapping of cable layers to their properties.
        layer_metrics (CableLayerMetrics): Geometric and calculated metrics for the cable layers.
        cable_type (CableType): The type of the cable.
        grid_counts (dict[CableLayer, int]): Number of grid points per cable layer.

    """
    self.convection_params: CableConvectionParams | None = None
    self.convection_coefficient: float | None = None
    super().__init__(conductor, layer_properties, layer_metrics, cable_type, grid_counts)

set_convection_parameters

set_convection_parameters(Z: float, E: float, Cg: float)

Set the convection parameters used to compute the convection coefficient.

Parameters:

Name Type Description Default
Z float

Convection parameter Z.

required
E float

Convection parameter E.

required
Cg float

Convection parameter Cg.

required
References
  • NEN-IEC 60287-2-1 (2023) Section 4.2.1.
Source code in cable_thermal_model/model/cables/cable_air.py
57
58
59
60
61
62
63
64
65
66
67
68
69
70
def set_convection_parameters(self, Z: float, E: float, Cg: float):
    """Set the convection parameters used to compute the convection coefficient.

    Args:
        Z: Convection parameter Z.
        E: Convection parameter E.
        Cg: Convection parameter Cg.

    References:
        - NEN-IEC 60287-2-1 (2023) Section 4.2.1.

    """
    self.convection_params = CableConvectionParams(Z=Z, E=E, Cg=Cg)
    self.convection_coefficient = Z / (self.layer_metrics.outer_radius * 2) ** Cg + E

integrate_timestep

integrate_timestep(previous_solution: ndarray, time_step: float) -> ndarray

Computes the temperature solution for the next time step.

Computes the temperature solution at time step [t+1] given the solution at the current time step [t], the finite difference matrix, and the vector for [t].

Parameters:

Name Type Description Default
previous_solution ndarray

The solution of the heat equation [°C] at the previous timestep (t).

required
time_step float

The size of the time steps [s] in the linearized time grid.

required

Returns:

Type Description
ndarray

np.ndarray: The updated temperature solution at the new time step [t+1] for the cable.

Source code in cable_thermal_model/model/cables/cable_air.py
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
def integrate_timestep(
    self,
    previous_solution: np.ndarray,
    time_step: float,
) -> np.ndarray:
    """Computes the temperature solution for the next time step.

    Computes the temperature solution at time step [t+1] given the solution at the
    current time step [t], the finite difference matrix, and the vector for [t].

    Args:
        previous_solution (np.ndarray): The solution of the heat equation [°C] at the
            previous timestep (t).
        time_step (float): The size of the time steps [s] in the linearized
            time grid.

    Returns:
        np.ndarray: The updated temperature solution at the new time step
            [t+1] for the cable.

    """
    A = self._get_processed_matrix(time_step=time_step)

    b = self._heating_vector * time_step + self._capacity_grid * previous_solution

    temp_solution = previous_solution.copy()
    theta_N = temp_solution[-1]

    iteration = 0
    while True:
        iteration += 1

        A[self._bottomright_index] += self._boundary_condition_coefficient * theta_N ** (1 / 4) * time_step
        temp_solution = self._solve_system(A=A, b=b)

        if abs(temp_solution[-1] - theta_N) <= self.MAX_ERROR_SHEATH:
            break
        elif iteration >= self.MAX_ITERATIONS_PER_TIMESTEP:
            raise ValueError(f"Solution did not converge after {self.MAX_ITERATIONS_PER_TIMESTEP} iterations")

        A[self._bottomright_index] -= self._boundary_condition_coefficient * theta_N ** (1 / 4) * time_step
        theta_N = temp_solution[-1]

    return temp_solution