Solver3TL
Solver3TL
Solver3TL(
dic: Optional[dict[str, Any]] = None,
joule: Type[PowerTerm] = PowerTerm,
solar: Type[PowerTerm] = PowerTerm,
convective: Type[PowerTerm] = PowerTerm,
radiative: Type[PowerTerm] = PowerTerm,
precipitation: Type[PowerTerm] = PowerTerm,
)
Bases: Solver3T
Source code in src/thermohl/solver/slv3t_legacy.py
22 23 24 25 26 27 28 29 30 31 32 | |
average
average(surface_temperature, core_temperature)
Compute average temperature given surface and core temperature.
Unlike Solver3T, always use a regular mean even for non-homogeneous conductors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
Source code in src/thermohl/solver/slv3t_legacy.py
62 63 64 65 66 67 68 69 70 71 72 73 | |
balance_3t
balance_3t(
surface_temperature: floatArray,
core_temperature: floatArray,
joule_value: Optional[floatArrayLike] = None,
) -> floatArrayLike
Calculate the thermal balance.
This method computes the thermal balance by summing the joule heating, specific heat, and subtracting the contributions from the cooling components (convection, radiation, and conduction).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
|
float | ndarray
|
Precomputed joule heating value. If None, it will be computed from the given temperatures. |
None
|
Returns:
| Type | Description |
|---|---|
floatArrayLike
|
float | numpy.ndarray: The resulting thermal balance. |
Source code in src/thermohl/solver/slv3t.py
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 | |
balance_and_morgan
balance_and_morgan(
surface_temperature: floatArray,
core_temperature: floatArray,
) -> tuple[floatArrayLike, floatArray]
Compute both balance and morgan efficiently by sharing computations.
This is the optimized version used by steady-state solvers to avoid redundant joule heating calculations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
Returns:
| Type | Description |
|---|---|
tuple[floatArrayLike, floatArray]
|
tuple[float | numpy.ndarray, numpy.ndarray]: The thermal balance and the Morgan function result. |
Source code in src/thermohl/solver/slv3t.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
joule
joule(
surface_temperature: floatArray,
core_temperature: floatArray,
) -> floatArrayLike
Calculate the Joule heating effect.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
Returns:
| Type | Description |
|---|---|
floatArrayLike
|
float | numpy.ndarray: The calculated Joule heating values. |
Notes:
- The function computes the average temperature temperature.
- Returns the Joule heating values based on the adjusted temperatures.
Source code in src/thermohl/solver/slv3t.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
morgan_3t
morgan_3t(
surface_temperature: floatArray,
core_temperature: floatArray,
joule_value: Optional[floatArrayLike] = None,
) -> floatArray
Computes the Morgan function for given temperature arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
Array of surface temperatures. |
required |
|
ndarray
|
Array of core temperatures. |
required |
|
float | ndarray
|
Precomputed joule heating value. |
None
|
Returns:
| Type | Description |
|---|---|
floatArray
|
numpy.ndarray: Resulting array after applying the Morgan function. |
Source code in src/thermohl/solver/slv3t_legacy.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
steady_intensity
steady_intensity(
max_conductor_temperature: floatArrayLike = np.array(
[]
),
target: CableLocationListLike = None,
cable_type: CableTypeListLike = None,
tol: float = default.tol,
maxiter: int = default.maxiter,
return_err: bool = False,
return_temp: bool = True,
return_power: bool = True,
) -> dict[str, np.ndarray]
Compute the steady-state intensity for a given temperature profile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float | ndarray
|
Initial temperature profile. Default is an empty numpy array. |
array([])
|
|
TargetType | list[CableLocation]
|
Target specification for the solver. Default is None. |
None
|
|
CableType | list[CableType]
|
Cable type specification for the solver. Default is None. If provided, it overrides the target specification. |
None
|
|
float
|
Tolerance for the solver. Default is DP.tol. |
tol
|
|
int
|
Maximum number of iterations for the solver. Default is DP.maxiter. |
maxiter
|
|
bool
|
If True, return the error in the output DataFrame. Default is False. |
False
|
|
bool
|
If True, return the temperature profiles in the output DataFrame. Default is True. |
True
|
|
bool
|
If True, return the power profiles in the output DataFrame. Default is True. |
True
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
dict[str, np.ndarray]: Dictionary containing the steady-state intensity and optionally the error, temperature profiles, and power profiles, |
dict[str, ndarray]
|
along with input data. |
Source code in src/thermohl/solver/slv3t.py
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 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 677 678 679 680 681 682 683 684 685 686 | |
steady_temperature
steady_temperature(return_uncertainty=False, **kwargs)
Compute the steady-state temperature distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float | ndarray | None
|
Initial guess for the surface temperature. If None, ambient temperature is used. |
required |
|
float | ndarray | None
|
Initial guess for the core temperature. If None, 1.5 times the absolute value of ambient temperature is used. |
required |
|
float
|
Tolerance for the quasi-Newton solver. |
required |
|
int
|
Maximum number of iterations for the quasi-Newton solver. |
required |
|
bool
|
If True, the error of the solution is included in the returned dict. |
required |
|
bool
|
If True, power-related values are included in the returned dict. |
required |
|
bool
|
If True, the uncertainty on computed average temperature is included in the returned dict. This is the uncertainty due to uncertainties on transit, ambient temperature, wind speed and direction, and solar irradiance. Uncertainties on other parameters (e.g. albedo) are ignored. |
False
|
Returns:
| Type | Description |
|---|---|
|
dict[str, np.ndarray]: Dictionary containing the steady-state temperatures and optionally the error and power-related values and uncertainty, along with input data. |
Source code in src/thermohl/solver/slv3t_legacy.py
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 278 279 | |
transient_temperature
transient_temperature(
offset: floatArray = np.array([]),
surface_temperature_0: Optional[floatArrayLike] = None,
core_temperature_0: Optional[floatArrayLike] = None,
return_power: bool = False,
) -> Dict[str, Any]
Compute transient-state temperature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
A 1D array with times (in seconds) when the temperature needs to be computed. The array must contain increasing values (undefined behaviour otherwise). |
array([])
|
|
float | ndarray | None
|
Initial surface temperature. If None, the ambient temperature from the internal dict will be used. The default is None. |
None
|
|
float | ndarray | None
|
Initial core temperature. If None, the ambient temperature from the internal dict will be used. The default is None. |
None
|
|
bool
|
Return power term values. The default is False. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: A dictionary with temperature and other results (depending on inputs) in the keys, |
Dict[str, Any]
|
along with input data. |
Source code in src/thermohl/solver/slv3t.py
443 444 445 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 473 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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
transient_temperature_legacy
transient_temperature_legacy(
offset: floatArray = np.array([]),
surface_temperature_0: Optional[floatArrayLike] = None,
core_temperature_0: Optional[floatArrayLike] = None,
time_constant: float = 600.0,
return_power: bool = False,
) -> Dict[str, Any]
Compute transient-state temperature with legacy method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ndarray
|
A 1D array with times (in seconds) when the temperature needs to be computed. The array must contain increasing values (undefined behaviour otherwise). |
array([])
|
|
float
|
Initial surface temperature. If set to None, the ambient temperature from internal dict will be used. The default is None. |
None
|
|
float
|
Initial core temperature. If set to None, the ambient temperature from internal dict will be used. The default is None. |
None
|
|
float
|
A time-constant to add some inertia. The default is 600. |
600.0
|
|
bool
|
Return power term values. The default is False. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: A dictionary with temperature and other results (depending on inputs) in the keys, along with input data. |
Source code in src/thermohl/solver/slv3t_legacy.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 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 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
update
update() -> None
Updates the solver's internal state by reinitializing several components
and recalculating the Morgan coefficients.
This method performs the following steps:
1. Extends the arguments to their maximum length.
2. Reinitializes the joule_heating, solar_heating, convective_cooling, radiative_cooling, and precipitation_cooling components using the updated arguments.
3. Recalculates the Morgan coefficients using the updated dimensions.
4. Compresses the arguments.
Returns:
None
Source code in src/thermohl/solver/slv3t.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |