fd_cable
FDCable
FDCable(
conductor: CableConductorProperties,
layer_properties: dict[
CableLayer, CableLayerProperties
],
layer_metrics: CableLayerMetrics,
cable_type: CableType,
grid_counts: dict[CableLayer, int],
)
Bases: AbstractCable
Finite-difference cable model that discretizes cable layers into a radial grid.
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/fd_cable.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
set_calculated_fields
set_calculated_fields() -> None
Initialize derived cable properties.
The properties set in this function depend on the cable layers. When adding soil or pipe layers these need to be reset. This function can be used to do so.
Source code in cable_thermal_model/model/cables/fd_cable.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
construct_radii_grid
construct_radii_grid(
maximal_boundary_distance: float = 0.0001,
) -> ndarray
Construct the radii grid for the cable based on the layer properties and grid counts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
maximal_boundary_distance
|
float
|
The maximal distance to use as a boundary distance between layers [m]. Default is 0.1 mm. |
0.0001
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: A Numpy array representing the radii grid for the cable. |
Source code in cable_thermal_model/model/cables/fd_cable.py
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 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
construct_surface_area_grid
staticmethod
construct_surface_area_grid(radii_grid: ndarray) -> ndarray
Construct the surface area grid for the cable based on the radii grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radii_grid
|
ndarray
|
A Numpy array representing the radii grid for the cable. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: A Numpy array representing the surface area grid for the cable. |
Source code in cable_thermal_model/model/cables/fd_cable.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
update_vector_with_heat_generation
update_vector_with_heat_generation(
vector: ndarray,
heat_generation: float,
start_index: int,
end_index: int,
) -> ndarray
Updates the given vector with the given heat generation value.
The heat generation is distributed over the grid points between the given start and end indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector
|
ndarray
|
The vector to update. |
required |
heat_generation
|
float
|
The heat generation value in W/m to distribute over the grid points. |
required |
start_index
|
int
|
The start index of the grid points to update. |
required |
end_index
|
int
|
The end index of the grid points to update. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The updated vector with the heat generation distributed over the specified grid points. |
Source code in cable_thermal_model/model/cables/fd_cable.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
get_redefined_cable
get_redefined_cable(**kwargs) -> Self
Get a new cable instance based on the current self, but with changed cable attributes.
This method takes the parameters given in the **kwargs and tries to apply those to matching attributes in a copy made of the current self.
Examples:
An example where we create a cable, and then use this method to create a copy of the cable, but with the [rhos] and [capacities] attributes altered from their original values.
>>> cable = Cable()
>>> new_cable = cable.get_redefined_cable(rhos = (1,1,1), capacities = (5,5,5))
(For other applications, please check out the 'add_soil' and 'add_outer_tube' methods.)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
|
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
A completely new cable instance based on the cable the method was called from, but with changed cable properties based on the passed [**kwargs] parameters. |
Notes
There are two reasons this method should be re-evaluated in the future. First of all this method uses kwargs to pass along an unknown combination of parameters, which is only evaluated by parameter name. Secondly this method is found in the FDCable class, but it is not specific to the FDCable class.
Source code in cable_thermal_model/model/cables/fd_cable.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
get_cable_copy_with_added_soil_layer
get_cable_copy_with_added_soil_layer(
soil_rho: float,
soil_capacity: float,
soil_radius: float,
logarithmic_soil_gridpoint_density: float,
) -> Self
This method creates a copy of the current cable object this was run from, but with an extra added soil layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soil_rho
|
float
|
|
required |
soil_capacity
|
float
|
|
required |
soil_radius
|
float
|
|
required |
logarithmic_soil_gridpoint_density
|
float
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
A completely new cable instance based on the cable the method was called from, but with the added soil layers. |
Source code in cable_thermal_model/model/cables/fd_cable.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
get_cable_copy_without_soil
get_cable_copy_without_soil() -> Self
This method returns a new FDCable object with the soil layer removed.
Source code in cable_thermal_model/model/cables/fd_cable.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
get_layer_indices_for_layer
get_layer_indices_for_layer(
layer: CableLayer,
) -> tuple[int, int]
This method fetches the start and end indices of the grid points for a given layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layer
|
CableLayer
|
A CableLayer object representing the layer for which the indices need to be fetched. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, int]
|
tuple[int, int]: A tuple of integers representing the start and end indices of the grid points for the given layer, in that order. |
Source code in cable_thermal_model/model/cables/fd_cable.py
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
get_finite_differences_matrix
get_finite_differences_matrix() -> ndarray
Calculates and returns the finite-differences matrix.
The finite-differences matrix is central to the linearized heat equation. It is a matrix with one base diagonal and two "off" diagonals (one above and one below the base diagonal), and otherwise only zeros. We represent this matrix as a 3xN numpy array, where N is the length of the base diagonal.
Notes
In the finite differences (FD) approximation, this single matrix combined with a vector control the linearized heat equation.
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The (3xN) matrix representing the finite-differences matrix [W/(°C*m³)]. |
Source code in cable_thermal_model/model/cables/fd_cable.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
get_linear_system
get_linear_system(
neglect_dielectric_loss: bool = False,
) -> tuple[ndarray, ndarray]
This method retrieves the two elements that control the linearized heat equation.
These are
- The finite-differences matrix, which contains the linearized interaction terms between grid points defined by material properties.
- The vector, which contains the energy that would be released and internally generated heat terms. In this step, only the time-independent dielectric losses are added.
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
tuple[np.ndarray, np.ndarray]: A tuple of two Numpy arrays, representing the finite-differences matrix and the vector, respectively. |
Source code in cable_thermal_model/model/cables/fd_cable.py
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | |
integrate_timestep
integrate_timestep(
s: ndarray,
A_banded: ndarray,
b: ndarray,
time_step: float,
internal_heating: bool | None = None,
) -> ndarray
This method solves the finite-difference approximation to the heat equation using the imiplicit Euler method.
For optimization purposes, the method uses the scipy.linalg.solve_banded method to solve the linear system. This means the the three diagonals of finite-differences matrix A are instead stored in a (3, N) array, where N is the length of the diagonal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
ndarray
|
The solution of the heat equation [°C] at the previous timestep (t). |
required |
A_banded
|
ndarray
|
The finite-differences matrix [W/(°C*m³)] represented as a banded matrix. |
required |
b
|
ndarray
|
The finite-differences vector [W/m³]. |
required |
time_step
|
float
|
The size of the time steps [s] in the linearized time grid. |
required |
internal_heating
|
bool | None
|
A boolean representing whether internal heating is considered in this timestep. This implementation of the method does not use this parameter, but some child classes do. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The solution [°C] to the heat equation at the next timestep (t+1) for all grid points except the final grid point, at which a boundary condition is enforced. |
Source code in cable_thermal_model/model/cables/fd_cable.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | |
update_soil_resistivity
update_soil_resistivity(
soil_rho: float, dry_soil_radius: float | None = None
)
This method updates the soil resistivity values around a cable.
This is meant to represent the IEC dried-out soil model. The soil will consist of an inner part of dried-out soil around the cable, and then a secondary part of standard soil The inner part has predefined thermal resistivity, which is defined in NPR Norm 3626.
Notes
We do not update the number of layers of the cable, so the rho-grid may consist of a part that corresponds to a single layer, yet has multiple distinct values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soil_rho
|
float
|
An optional float representing the thermal resistivity of the soil that is not dried out. |
required |
dry_soil_radius
|
float | None
|
A float representing the radius of the dried-out soil around the cable. |
None
|
Source code in cable_thermal_model/model/cables/fd_cable.py
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | |
update_pipe_resistivity
update_pipe_resistivity(Tfill: float) -> bool
This method updates the (temperature dependent) thermal resistivity of the medium in the pipe of the cable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Tfill
|
float
|
The mean temperature of the medium within the pipe in degree Celsius. |
required |
Source code in cable_thermal_model/model/cables/fd_cable.py
585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | |
update_soil_capacity
update_soil_capacity(soil_c: float)
This method updates the soil capacity values around a cable.
If multiple soil layers are present, it sets them all (the entire soil).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soil_c
|
float
|
A float representing the thermal capacity of the (entire) soil. |
required |
Source code in cable_thermal_model/model/cables/fd_cable.py
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
get_cable_copy_with_pipe
get_cable_copy_with_pipe(pipe: Pipe) -> Self
Get a new cable instance based on the current self, but with extra added layers that model a pipe.
This method adds two layers
- pipe_fill layer with an empiric resistance value
- PE layer for the pipe
The resistivity of the pipe filling material is updated depending on the temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pipe
|
Pipe
|
A pipe instance |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
A new cable instance based on this instance, but with added pipe layers as if the cable had an outer pipe. |
Source code in cable_thermal_model/model/cables/fd_cable.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | |
FDCableTrefoilCircuitInSinglePipe
FDCableTrefoilCircuitInSinglePipe(
conductor: CableConductorProperties,
layer_properties: dict[
CableLayer, CableLayerProperties
],
layer_metrics: CableLayerMetrics,
cable_type: CableType,
grid_counts: dict[CableLayer, int],
)
Bases: FDCable
Class that represents a finite-difference cable trefoil circuit that lies in a single pipe.
Source code in cable_thermal_model/model/cables/fd_cable.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
integrate_timestep
integrate_timestep(
s: ndarray,
A_banded: ndarray,
b: ndarray,
time_step: float,
internal_heating: bool | None = None,
) -> ndarray
This method solves the finite-difference approximation to the heat equation using the implicit Euler method.
We add a heat source between the pipe and the equivalent cable representing the trefoil circuit in the internal heating step. The amount of heat added equals twice the heat loss at the cable sheath, therefore representing the heat three cables in trefoil would generate together. Because we add an additional heat source between the pipe and the equivalent cable representing the trefoil circuit, the banded array is converted to a sparse matrix and adjusted appropriately before solving the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
ndarray
|
The solution of the heat equation [°C] at the previous timestep (t). |
required |
A_banded
|
ndarray
|
The finite-differences matrix [W/(°C*m³)] represented as a banded matrix. |
required |
b
|
ndarray
|
The finite-differences vector [W/m³]. |
required |
time_step
|
float
|
The size of the time steps [s] in the linearized time grid. |
required |
internal_heating
|
bool
|
A boolean indicating whether internal heating between cables in the trefoil circuit is considered. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The solution [°C] to the heat equation at the next timestep (t+1) for all grid points except the final grid point, at which a boundary condition is enforced. |
Source code in cable_thermal_model/model/cables/fd_cable.py
682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | |
FDCableInAir
FDCableInAir(
conductor: CableConductorProperties,
layer_properties: dict[
CableLayer, CableLayerProperties
],
layer_metrics: CableLayerMetrics,
cable_type: CableType,
grid_counts: dict[CableLayer, int],
)
Bases: FDCable
Class that represents a finite-difference cable installed in air.
This class inherits from FDCable, and only differs in the convection parameters used for the cable.
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/fd_cable.py
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | |
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/fd_cable.py
835 836 837 838 839 840 841 842 843 844 845 846 847 848 | |
integrate_timestep
integrate_timestep(
s: ndarray,
A_banded: ndarray,
b: ndarray,
time_step: float,
internal_heating: bool | None = True,
) -> 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 |
|---|---|---|---|
s
|
ndarray
|
The solution of the heat equation [°C] at the previous timestep (t). |
required |
A_banded
|
ndarray
|
The finite-differences matrix [W/(°C*m³)] represented as a banded matrix. |
required |
b
|
ndarray
|
The finite-differences vector [W/m³]. |
required |
time_step
|
float
|
The size of the time steps [s] in the linearized time grid. |
required |
internal_heating
|
bool | None
|
A boolean representing whether internal heating is considered in this timestep. Must be None for this class. |
True
|
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/fd_cable.py
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | |
FDCableTrefoilCircuitInSinglePipeInAir
FDCableTrefoilCircuitInSinglePipeInAir(
conductor: CableConductorProperties,
layer_properties: dict[
CableLayer, CableLayerProperties
],
layer_metrics: CableLayerMetrics,
cable_type: CableType,
grid_counts: dict[CableLayer, int],
)
Bases: FDCableTrefoilCircuitInSinglePipe, FDCableInAir
Class that represents a finite-difference cable trefoil circuit that lies in a single pipe in air.
Source code in cable_thermal_model/model/cables/fd_cable.py
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | |
integrate_timestep
integrate_timestep(
s: ndarray,
A_banded: ndarray,
b: ndarray,
time_step: float,
internal_heating: bool | None = True,
) -> ndarray
This method solves the finite-difference approximation to the heat equation using the implicit Euler method.
We add a heat source between the pipe and the equivalent cable representing the trefoil circuit in the internal heating step. The amount of heat added equals twice the heat loss at the cable sheath, therefore representing the heat three cables in trefoil would generate together. Because we add an additional heat source between the pipe and the equivalent cable representing the trefoil circuit, the banded array is converted to a sparse matrix and adjusted appropriately before solving the linear system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
ndarray
|
The solution of the heat equation [°C] at the previous timestep (t). |
required |
A_banded
|
ndarray
|
The finite-differences matrix [W/(°C*m³)] represented as a banded matrix. |
required |
b
|
ndarray
|
The finite-differences vector [W/m³]. |
required |
time_step
|
float
|
The size of the time steps [s] in the linearized time grid. |
required |
internal_heating
|
bool | None
|
A boolean indicating whether internal heating between cables in the trefoil circuit is considered. |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the convection parameters have not been set for this cable in air. |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The solution [°C] to the heat equation at the next timestep (t+1) for all grid points except the final grid point, at which a boundary condition is enforced. |
Source code in cable_thermal_model/model/cables/fd_cable.py
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | |