Skip to main content

Calculations relative to temperature and ampacity in overhead conductors.

Project description

ThermOHL

MPL-2.0 License Quality Gate Status Lines of Code Coverage

pyodide

Temperature estimation of overhead line conductors is an important topic for TSOs for technical, economic, and safety-related reasons (DLR/ampacity, sag management ...). It depends on several factors, mainly transit, weather and the conductor properties. ThermOHL is a python package to compute temperature and/or ampacity in overhead line conductors.

Features

The temperature of a conductor is estimated by solving a heat equation which describes how temperature evolves over time, taking into account different power terms that either heat or cold the conductor (see next picture from CIGRE[1]).

image

Two heat equations (a more complete, third one is under development) are available:

  • one with a single temperature for the cable;
  • another with three temperatures (core, average and surface temperature) for more precise computations.

Each of these equations can be used with a set of pre-coded power terms from the literature :

  • one using CIGRE recommendations [1];
  • one using the IEEE standard [2];
  • two others from RTE departments.

Solvers derivated from heat equations can compute steady-state temperature or ampacity, and transient temperature. The set of parameter required depends on the power terms used, and default values are provided.

References

Users


Environment

ThermOHL is using pip for project and dependencies management. You need a compatible version of python (3.8 or higher). You may have to install it manually (e.g. with pyenv). Then you may create a virtualenv and activate it.

Set up thermohl

To install the package using uv, execute the following command:

    uv pip install "thermohl @ git+https://github.com/phlowers/thermohl"

Use it ! You can report to the user guide section.

    import thermohl
    print(thermohl.__version__)

Developers


Install the development dependencies and program scripts via

  uv sync --group dev

Then install the pre-commit hooks:

  uv run pre-commit install

Build a new wheel via

  uv build --wheel

This build a wheel in newly-created dist/ directory

Pre-commit

This project uses pre-commit to ensure code quality through ruff. Hooks are automatically run on git commit.

You can also run them manually on all files:

  uv run pre-commit run --all-files

Building the documentation with mkdocs

First, make sure you have mkdocs and the Readthedocs theme installed.

If you use uv, open a terminal and enter the following commands:

  uv sync --group docs

Then, in the same terminal, in the thermohl-docs folder, build the doc with:

  • mkdocs serve (or uv run mkdocs serve) - Start the live-reloading docs server.
  • mkdocs build (or uv run mkdocs build) - Build the documentation site.
  • mkdocs -h (or uv run mkdocs -h) - Print help message and exit.

The documentation can then be accessed locally from http://127.0.0.1:8000.

Logging

By default, the thermohl logger is silent (it uses a logging.NullHandler).

To enable log messages in the console, you can use the provided utility function:

import thermohl.utils
import logging

thermohl.utils.add_stderr_logger(level=logging.INFO)

Alternatively, you can manually configure the thermohl logger using Python's standard logging module:

import logging

logger = logging.getLogger("thermohl")
logger.setLevel(logging.INFO)
handler = logging.StreamHandler()
logger.addHandler(handler)

Simple usage

Solvers in thermOHL take a dictionary as an argument, where all keys are strings and all values are either integers, floats or 1D numpy.ndarray of integers or floats. It is important to note that all arrays should have the same size. Missing or None values in the input dictionary are replaced with a default value, available using solver.default_values(), which are read from thermohl/default_values.yaml.

Example 1

This example uses the single-temperature heat equation (1t) with IEEE power terms and default values to compute the surface temperature (°C) of a conductor in steady-state regime along with the corresponding power terms (W.m-1).

from thermohl import solver
from thermohl.solver.entities import HeatEquationType

slvr = solver.ieee(dic=None, heat_equation=HeatEquationType.ONE_TEMPERATURE)
temp = slvr.steady_temperature() 

Results from the solver are returned in a dict where values are numpy arrays:

>>> temp
{'temperature': array([27.3325034]),
 'joule_power': array([0.27314919]),
 'solar_power': array([9.73237776]),
 'convection_power': array([6.65130481]),
 'radiation_power': array([3.35422215]),
 'precipitation_power': array([0.]),
 'input_latitude': 45.0,
  ...
 }

Input data can be accessed with the input_ prefix (e.g. temp["input_latitude"]).

Example 2

This example uses the same heat equation and power terms, but to compute the line ampacity (A), ie the maximum power intensity that can be used in a conductor without exceeding a specified maximal temperature (°C), along with the corresponding power terms (W.m-1). We can see that, for three different ambient temperature, we have three distinct ampacities (and the lower the ambient temperature, the higher the ampacity).

import numpy as np
from thermohl import solver
from thermohl.solver.entities import HeatEquationType

slvr = solver.ieee(dict(ambient_temperature=np.array([0., 15., 30.])), heat_equation=HeatEquationType.ONE_TEMPERATURE)
Tmax = 80.
imax = slvr.steady_intensity(Tmax)
>>> imax
{'transit': array([1605.51693463, 1407.02006847, 1183.54643897]),
 'joule_power': array([83.64586616, 64.2414426 , 45.45538152]),
 'solar_power': array([9.73237776, 9.73237776, 9.73237776]),
 'convection_power': array([66.75078505, 50.88447273, 36.23473652]),
 'radiation_power': array([26.62745888, 23.08934764, 18.95302277]),
 'precipitation_power': 0.0,
 'input_latitude': array([45., 45., 45.]),
  ...
 }

Input data can be accessed with the input_ prefix (e.g. imax["input_latitude"]).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thermohl-1.8.1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thermohl-1.8.1-py3-none-any.whl (79.1 kB view details)

Uploaded Python 3

File details

Details for the file thermohl-1.8.1.tar.gz.

File metadata

  • Download URL: thermohl-1.8.1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for thermohl-1.8.1.tar.gz
Algorithm Hash digest
SHA256 fc9b9522628b302ab38ce1048bd81be19484f80431aef2c181a92b961c69c6c6
MD5 0376b9815be95e9f6ff5b742c026cbf4
BLAKE2b-256 39b2d39b90c6f75133556d43bb5c1e6e373937ff2a15af34edf6bfe5f59e387e

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermohl-1.8.1.tar.gz:

Publisher: cd-pypi.yml on phlowers/thermohl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file thermohl-1.8.1-py3-none-any.whl.

File metadata

  • Download URL: thermohl-1.8.1-py3-none-any.whl
  • Upload date:
  • Size: 79.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for thermohl-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 81311e6360c7d7ddef2d53ae546f1e3856ba9979aa6da491d1ec814756581490
MD5 70cb0522a493e589831e07fa948bf041
BLAKE2b-256 3110bb08ded1e17b8ad3bad0c70a6c46309e746b4f39d60ac151421dd4a24fe9

See more details on using hashes here.

Provenance

The following attestation bundles were made for thermohl-1.8.1-py3-none-any.whl:

Publisher: cd-pypi.yml on phlowers/thermohl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page