Skip to content

Commit ea15961

Browse files
authored
Merge pull request #294 from RoseauTechnologies/develop
Version 0.11.0
2 parents 382deaa + d46de73 commit ea15961

File tree

321 files changed

+30033
-179848
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+30033
-179848
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ on:
1616

1717
env:
1818
CI: true
19+
UV_SYSTEM_PYTHON: 1
1920

2021
jobs:
2122
build:
2223
runs-on: ubuntu-latest
2324

2425
strategy:
2526
matrix:
26-
python-version: ["3.10", "3.11", "3.12"]
27+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2728

2829
steps:
2930
- uses: actions/checkout@v4
@@ -49,24 +50,23 @@ jobs:
4950
git lfs pull
5051
git lfs prune --verify-remote
5152
52-
- name: Install poetry
53-
run: pipx install poetry
53+
- name: Install uv
54+
uses: astral-sh/setup-uv@v4
55+
with:
56+
enable-cache: true
5457

5558
- name: Set up Python ${{ matrix.python-version }}
5659
uses: actions/setup-python@v5
5760
with:
5861
python-version: ${{ matrix.python-version }}
59-
cache: "poetry"
6062

6163
- name: Install dependencies
6264
run: |
63-
poetry env use "${{ matrix.python-version }}"
64-
poetry install --without dev
65+
uv sync --frozen --all-extras
6566
6667
- name: Test with pytest
6768
run: |
68-
poetry run pytest -vv -n=auto --durations=25 --cov-report html \
69-
--cov-config pyproject.toml roseau
69+
uv run pytest -vv -n=auto --durations=25 --cov-report html --cov-config pyproject.toml roseau
7070
env:
7171
ROSEAU_LOAD_FLOW_LICENSE_KEY: ${{ secrets.ROSEAU_LOAD_FLOW_LICENSE_KEY }}
7272

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ jobs:
2323
lfs: false
2424
- uses: actions/setup-python@v5
2525
with:
26-
python-version: "3.12"
26+
python-version: "3.13"
2727
- uses: pre-commit/[email protected]

.latexindent.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ indentRules:
3939
modifyLineBreaks:
4040
textWrapOptions:
4141
columns: 120
42+
when: after
4243
environments:
4344
BeginStartsOnOwnLine: 1
4445
BodyStartsOnOwnLine: 1

.pre-commit-config.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
exclude: ^.idea/|.vscode/
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.6.0
4+
rev: v5.0.0
55
hooks:
66
- id: check-json
77
- id: check-merge-conflict
@@ -10,26 +10,24 @@ repos:
1010
- id: detect-private-key
1111
- id: end-of-file-fixer
1212
- id: trailing-whitespace
13-
- repo: https://github.com/python-poetry/poetry
14-
rev: 1.8.0
13+
- repo: https://github.com/astral-sh/uv-pre-commit
14+
rev: 0.5.5
1515
hooks:
16-
- id: poetry-check
16+
- id: uv-lock
1717
- repo: https://github.com/astral-sh/ruff-pre-commit
18-
rev: v0.6.3
18+
rev: v0.8.1
1919
hooks:
2020
- id: ruff
21-
types_or: [python, pyi, jupyter]
2221
args: [--fix]
2322
- id: ruff-format
24-
types_or: [python, pyi, jupyter]
2523
- repo: https://github.com/adamchainz/blacken-docs
26-
rev: 1.18.0
24+
rev: 1.19.1
2725
hooks:
2826
- id: blacken-docs
2927
files: ^doc/.*\.md$
3028
args: [-l 90]
3129
- repo: https://github.com/rbubley/mirrors-prettier
32-
rev: v3.3.3
30+
rev: v3.4.1
3331
hooks:
3432
- id: prettier
3533
args: ["--print-width", "120"]

.readthedocs.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
version: 2
4+
build:
5+
os: ubuntu-24.04
6+
tools:
7+
python: "3.12"
8+
commands:
9+
#
10+
# Install git-lfs
11+
#
12+
# Download and uncompress the binary
13+
# https://git-lfs.github.com/
14+
- wget https://github.com/git-lfs/git-lfs/releases/download/v3.6.0/git-lfs-linux-amd64-v3.6.0.tar.gz
15+
- tar xvfz git-lfs-linux-amd64-v3.6.0.tar.gz
16+
# Modify LFS config paths to point where git-lfs binary was downloaded
17+
- git config filter.lfs.process "`pwd`/git-lfs filter-process"
18+
- git config filter.lfs.smudge "`pwd`/git-lfs smudge -- %f"
19+
- git config filter.lfs.clean "`pwd`/git-lfs clean -- %f"
20+
# Make LFS available in current repository
21+
- ./git-lfs-3.6.0/git-lfs install
22+
# Download content from remote
23+
- ./git-lfs-3.6.0/git-lfs fetch
24+
# Make local files to have the real content on them
25+
- ./git-lfs-3.6.0/git-lfs checkout
26+
#
27+
# Build using uv
28+
#
29+
- asdf plugin add uv
30+
- asdf install uv latest
31+
- asdf global uv latest
32+
- uv sync --only-group doc --frozen
33+
- uv run -m sphinx -T -b html -d doc/_build/doctrees doc $READTHEDOCS_OUTPUT/html

README.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,35 @@
22

33
![CI](https://github.com/RoseauTechnologies/Roseau_Load_Flow/workflows/CI/badge.svg)
44
![pre-commit](https://github.com/RoseauTechnologies/Roseau_Load_Flow/actions/workflows/pre-commit.yml/badge.svg)
5+
[![Documentation Status](https://readthedocs.org/projects/roseau-load-flow/badge/?version=latest)](https://roseau-load-flow.readthedocs.io/en/latest/?badge=latest)
56

6-
_Roseau Load Flow_ is a highly capable three-phase load flow solver with an ergonomic Python API
7-
for unbalanced power flow analysis.
7+
_Roseau Load Flow_ is a powerful multi-phase load flow solver for unbalanced power flow analysis that
8+
offers:
9+
10+
- Multi-phase, unbalanced power flow analysis
11+
- Performance optimized solver written in C++
12+
- A catalogue of real-world transformer and line models
13+
- An ergonomic object-oriented Python interface
14+
- A comprehensive documentation with code examples
15+
- Real-world distribution network data samples in the library (with more available on request)
16+
17+
In addition to the following _unique_ set of features:
18+
19+
- Support for floating neutrals for loads and sources
20+
- Four-wire multi-phase modelling with no Kron's reduction, no transformations, no assumptions on the
21+
network topology and no implicit earthing everywhere
22+
- Support for flexible, voltage-dependent, loads directly in the Newton algorithm for better convergence
823

924
This project is compatible with Python version 3.10 and newer. The
1025
[installation instructions](https://roseau-load-flow.roseautechnologies.com/Installation.html)
11-
will guide you through the installation process. If you are new to _Roseau Load Flow_, we recommend you start with the
26+
will guide you through the installation process. If you are new to _Roseau Load Flow_, we recommend
27+
you start with the
1228
[getting started tutorial](https://roseau-load-flow.roseautechnologies.com/usage/Getting_Started.html).
1329
You can find the complete documentation at https://roseau-load-flow.roseautechnologies.com/.
1430

15-
> [!IMPORTANT]
16-
> Starting with version 0.7.0, Roseau Load Flow is no longer supplied as a SaaS. The software is now
17-
> available as a standalone Python library.
18-
1931
## License
2032

21-
The project is _partially_ open source but using the solver requires a license. The license key
33+
This project is _partially_ open source but using the solver requires a license. The license key
2234
`A8C6DA-9405FB-E74FB9-C71C3C-207661-V3` can be used free of charge with networks containing up to 10
2335
buses. To obtain a personal or commercial license, please contact us
2436
@@ -31,21 +43,25 @@ Read more at [License](https://roseau-load-flow.roseautechnologies.com/License.h
3143

3244
## Network data
3345

34-
With this library, there is a sample of 20 low-voltage and 20 medium-voltage feeders included for an easy
35-
start! Each network is given with its summer and winter load point. At _Roseau Technologies_, we are able to provide
36-
the major part of the French medium and low voltage networks. For more information, please contact us at
37-
46+
_Roseau Load Flow_ ships with a sample of 20 low-voltage and 20 medium-voltage feeder networks. Each
47+
network is provided with its summer and winter load points. At _Roseau Technologies_, we can provide
48+
the major part of the French medium and low voltage networks on demand. For more information, please
49+
contact us at contact@roseautechnologies.com.
3850

39-
![Catalogue of networks](https://github.com/RoseauTechnologies/Roseau_Load_Flow/blob/main/doc/_static/Network/Catalogue.png?raw=True)
51+
<div align="center">
52+
<img alt="Catalogue of networks" src="https://github.com/RoseauTechnologies/Roseau_Load_Flow/blob/main/doc/_static/Network/Catalogue.png?raw=True" />
53+
</div>
4054

4155
## Bug reports / Feature requests
4256

43-
If you find a bug or have a feature request, please open an issue on
57+
For bug reports, feature requests, or questions, please open an issue on
4458
[GitHub](https://github.com/RoseauTechnologies/Roseau_Load_Flow/issues)
4559

4660
## Credits
4761

4862
This software is developed by [Roseau Technologies](https://www.roseautechnologies.com/en).
49-
[![Linkedin](https://i.stack.imgur.com/gVE0j.png) LinkedIn](https://www.linkedin.com/company/roseau-technologies/)
63+
64+
Follow us on:
65+
[![Linkedin](https://i.sstatic.net/gVE0j.png) LinkedIn](https://www.linkedin.com/company/roseau-technologies/)
5066
&nbsp;
51-
[![GitHub](https://i.stack.imgur.com/tskMh.png) GitHub](https://github.com/RoseauTechnologies)
67+
[![GitHub](https://i.sstatic.net/tskMh.png) GitHub](https://github.com/RoseauTechnologies)

doc/Changelog.md

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,106 @@ og:description: See what's new in the latest release of Roseau Load Flow !
1717

1818
# Changelog
1919

20+
## Version 0.11.0
21+
22+
This release adds official support for Python 3.13 and adds a new experimental backward-forward solver.
23+
24+
### Breaking changes
25+
26+
- The `min_voltage` and `max_voltage` of `Bus` have been replaced by `nominal_voltage` (phase-to-phase,
27+
in V), a `min_voltage_level` (unitless) and a `max_voltage_level` (unitless).
28+
- The `type` parameter of `TransformerParameters` constructors becomes `vg` for vector group. Replace
29+
`type="single"` by `vg="Ii0"` and `type="center"` by `vg="Iii0"`.
30+
- The `type` attribute of `TransformerParameters` now returns `three-phase`, `single-phase` or
31+
`center-tapped`. Use `TransformerParameters.vg` to get the vector group.
32+
- The names of the transformers in the catalogue have been modified to add voltage levels and vector
33+
groups. Use `rlf.TransformerParameters.get_catalogue()` to see the updated catalogue.
34+
- The `max_current`, `section`, `insulator_type` and `conductor_type` parameters of the `LineParameters`
35+
class are renamed to `ampacities`, `sections`, `insulators` and `materials` respectively. The new
36+
parameters accept arrays of values, one per conductor.
37+
- The enumeration `InsulatorType.UNKNOWN` is removed. Please use `None` if the insulator is unknown.
38+
- The definition of constant-current loads is modified to be the magnitudes of the currents and their
39+
phase shift from the voltages instead of the absolute phase shift. Currents should no longer be
40+
rotated by 120° to be in sync with the voltages.
41+
42+
### Deprecations
43+
44+
- The enumerated classes `InsulatorType` and `ConductorType` are renamed to `Insulator` and `Material`
45+
respectively. Their old names are deprecated and will be removed in a future release.
46+
- The deprecated method `LineParameters.from_name_mv` is removed.
47+
48+
### Detailed changes
49+
50+
- {gh-pr}`293` Fixed `loading` calculation for lines and transformers
51+
- {gh-pr}`291` Fixed several bugs in JSON serialization and deserialization.
52+
- {gh-pr}`289` {gh-issue}`264` Improve the `TransformerParameters` class and the transformers catalogue
53+
54+
- Add 15kV transformers to the catalogue (SE and FT)
55+
- Add single-phase transformers to the catalogue (Schneider Imprego)
56+
- Add step-up transformers to the catalogue (Cahors "Serie Jaune")
57+
- Use the correct LV side no-load voltage as defined in the datasheets (some 400V became 410V)
58+
- Revert {gh-pr}`282` to keep the IEC 600076 names `uhv` and `ulv` for the transformer voltages.
59+
- Replace the `type` parameter of `TransformerParameters` constructors by `vg` for vector group.
60+
- `TransformerParameters.type` now returns `three-phase`, `single-phase` or `center-tapped`. Use
61+
`TransformerParameters.vg` to get vector group.
62+
- Modify the names of the transformers in the catalogue to add voltage levels and vector groups
63+
64+
- {gh-pr}`285` {gh-issue}`279` Add maximum loading for lines and transformers.
65+
66+
- The constructors of `Transformer` and `Line` now accept a unitless `max_loading` parameter equal
67+
to 1 (=100%) by default.
68+
- The parameter `max_currents` of `LineParameters` is now called `ampacities`.
69+
- The `Line` class gained a new property `max_currents` that returns the maximal admissible currents
70+
(in Amps) for each conductor: `line.max_current = line.parameters.ampacity * line.max_loading`.
71+
- The `res_violated` property of `Transformer` and `Line` now take into account this `max_loading`.
72+
- The `Line` and `Transformer` classes have a new `res_loading` property to compute the loading of
73+
the element:
74+
- `line.res_loading = line.res_currents / line.parameters.ampacities`
75+
- `transformer.res_loading = sum(transformer.res_powers) / transformer.parameters.sn`
76+
77+
- {gh-pr}`286` The deprecated method `LineParameters.from_name_mv` is removed.
78+
- {gh-pr}`283` Several changes related to the `LineParameters`:
79+
80+
- The `max_current`, `section`, `insulator_type` and `conductor_type` parameters are renamed to
81+
`max_currents`, `sections`, `insulators` and `materials` respectively. The new parameters accept
82+
arrays of values, one per conductor.
83+
- The class method `from_geometry` now accepts several additional arguments related to the neutral
84+
(`material_neutral`, `insulator_neutral`, `max_current_neutral`)
85+
- The enumerated classes `InsulatorType` and `ConductorType` are renamed to `Insulator` and `Material`.
86+
Their old names are deprecated and will be removed in a future release.
87+
- The insulator `UNKNOWN` is removed. Please use `None` if the insulator is unknown.
88+
- The insulator `NONE` is added. It must be used to describe conductors without insulator.
89+
- The catalogue has now several additional columns related to the neutral parameters (resistance,
90+
reactance, susceptance, material, insulator, maximal current). The `get_catalogue` and the
91+
`from_catalogue` methods have been changed to accept filter on the columns (`material_neutral`,
92+
`insulator_neutral`, `section_neutral`)
93+
94+
- {gh-pr}`281` Add official support for Python 3.13.
95+
- {gh-issue}`278` {gh-pr}`280` Modify the `Bus` voltage limits:
96+
97+
- The `min_voltage` and `max_voltage` parameters and attributes of `Bus` have been replaced by
98+
`nominal_voltage` (phase-to-phase, in V), a `min_voltage_level` (unitless) and a `max_voltage_level`
99+
(unitless).
100+
- `Bus` gained a new property `res_voltage_levels` that returns the voltage levels of the bus
101+
as a percentage of the nominal voltage;
102+
- The JSON file format also changed to take into account these changes. If a `min_voltage` or
103+
`max_voltage` existed in a file of a previous version, they are lost when upgrading the file.
104+
105+
- {gh-pr}`277` Fix the definition of constant current loads to be the magnitudes of the currents
106+
and their phase shift from the voltages instead of the absolute phase shift. Currents should no
107+
longer be rotated by 120° to be in sync with the voltages.
108+
- {gh-pr}`276` Add a backward-forward solver (experimental).
109+
- {gh-pr}`275` Use [uv](https://docs.astral.sh/uv/) instead of [Rye](https://rye.astral.sh/) as dependency manager.
110+
- {gh-pr}`273` Dynamically calculate the stacklevel of the first frame outside of `roseau.load_flow` for warnings
111+
- {gh-pr}`272` {gh-issue}`271`: Fix segfault when phases of a potential reference are not the same as the bus phases.
112+
- {gh-pr}`270` Use [Rye](https://rye.astral.sh/) instead of [Poetry](https://python-poetry.org/) as dependency manager.
113+
- {gh-pr}`269` Optimize the SVG files of the documentation.
114+
- {gh-pr}`268` Set up ReadTheDoc to automatically compile the documentation.
115+
- {gh-pr}`267` Add a section in the documentation on Google Colab secrets.
116+
20117
## Version 0.10.0
21118

22-
- A wheel for Python 3.13 is also available.
119+
- A wheel for Python 3.13 is available.
23120
- The wheels for Windows are now available. The problem was the same as the one of the
24121
[issue 28551](https://github.com/matplotlib/matplotlib/issues/28551) of the Matplotlib repository.
25122
- {gh-pr}`237` Improvements of the Sphinx configuration.

doc/Installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ the corresponding functions. They can be installed with the
114114
If you are using Jupyter Notebooks, you can install `roseau-load-flow` directly from a notebook
115115
cell with:
116116

117-
```ipython3
117+
```python-console
118118
In [1]: %pip install roseau-load-flow
119119
```
120120

doc/License.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,26 @@ the license key from versioning by adding it to your `.gitignore` file.
9393
## How to set an environment variable?
9494

9595
If you are not sure how to set an environment variable, [this article](https://www.bitecode.dev/p/environment-variables-for-beginners)
96-
has instructions for Windows, MacOS and Linux. The section [Persisting an environment variable](https://www.bitecode.dev/i/121864947/persisting-an-environment-variable)
96+
has instructions for Windows, macOS and Linux. The section [Persisting an environment variable](https://www.bitecode.dev/i/121864947/persisting-an-environment-variable)
9797
explains how to make the environment variable persistent on your machine so that you don't have to
9898
set it every time you open a new terminal.
9999

100+
### For Google Colab users
101+
102+
The "Secrets" feature in Google Colab is very useful for defining local variables. In the left panel, open the 'Secrets' section. Create a new variable called `ROSEAU_LOAD_FLOW_LICENSE_KEY`, with the value being your license key. This variable is personal to you, and the toggle will allow you to enable access to the license key for notebooks of your choice.
103+
104+
```{image} /_static/2024_09_16_Google_Colab_Environment_Variable.png
105+
:alt: Google Colab environment variable
106+
:align: center
107+
```
108+
109+
To set the environment variable, add the following in a cell at the beginning of your notebook:
110+
111+
```
112+
from google.colab import userdata
113+
os.environ['ROSEAU_LOAD_FLOW_LICENSE_KEY'] = userdata.get('ROSEAU_LOAD_FLOW_LICENSE_KEY')
114+
```
115+
100116
### For Jupyter Notebook users
101117

102118
If you are using a _Jupyter Notebook_, you can follow these instructions to set the environment
@@ -108,7 +124,7 @@ variable:
108124
ROSEAU_LOAD_FLOW_LICENSE_KEY="A8C6DA-9405FB-E74FB9-C71C3C-207661-V3"
109125
```
110126
2. Add a cell to the beginning of your notebook with the following content and execute it:
111-
```ipython3
127+
```python-console
112128
%pip install python-dotenv
113129
%load_ext dotenv
114130
%dotenv
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)