Conversation
Fixes a regression introduced in #280
Add more unbalance calculations
Fix in DGS export
BUG: ground not added by `add_short_circuit`
- Fix the constant-impedance equation to become V²/Z instead of V².Z - Fix the constant-current equation to become V.I* instead of V.I - Mention the constant variable in each equation
Detect duplicate IDs for line and transformer parameters and raise an error if they are found. The duplicate ID checks in `to_dict` are no longer needed. The equality comparisons using the fields of the parameters are replaced by identity comparisons. Resolves #300
- Add nominal frequency (`fn`), cooling class (`cooling`) and insulation type (`insulation`) to the `TransformerParameters` class. - The transformers catalogue has been updated accordingly. - The manufacturer names in the catalogue have been expanded to better accomodate new transformers (`SE` -> `Schneider Electric`, `FT` -> `France Transfo`, ...). - More HV/MV transformers have been added to the catalogue. - The cooling and insulation are described in the new enumeration types `TransformerCooling` and `TransformerInsulation` respectively.
This is a purely cosmetic change to improve the readability of the results so that when we introspect the results in an interactive console like a notebook cell we see something like `(-43.17581696+81.68999335j)` instead of `np.complex128(-43.17581696+81.68999335j)` which is even more annoying when seen in the dict of a network. Performance is not affected by this change.
This PR has no user facing changes. --------- Co-authored-by: Saelyos <seb.vallet@gmail.com>
Co-authored-by: Ali Hamdan <ali.hamdan@roseautechnologies.com>
Add debuging methods to the solver
This uses the newly added C++ branch methods to access the potential of the ground port of a line with shunt componenets. This makes the line results accessible independent of the Python ground element. No breaking changes are made to the line results interface but the network JSON format needed to be updated to store the new results. This work will be essential later when we simplify ground handling in RLF.
Use faster methods to get scalar C++ results and a few minor improvements. This makes hosting capacity calculation from 25% faster for small networks to 300% faster for larger networks.
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 5 to 6. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/astral-sh/setup-uv/releases">astral-sh/setup-uv's releases</a>.</em></p> <blockquote> <h2>v6.0.0 🌈 activate-environment and working-directory</h2> <h2>Changes</h2> <p>This version contains some breaking changes which have been gathering up for a while. Lets dive into them:</p> <ul> <li><a href="https://github.com/astral-sh/setup-uv/blob/HEAD/#activate-environment">Activate environment</a></li> <li><a href="https://github.com/astral-sh/setup-uv/blob/HEAD/#working-directory">Working Directory</a></li> <li><a href="https://github.com/astral-sh/setup-uv/blob/HEAD/#default-cache-dependency-glob">Default <code>cache-dependency-glob</code></a></li> <li><a href="https://github.com/astral-sh/setup-uv/blob/HEAD/#use-default-cache-dir-on-self-hosted-runners">Use default cache dir on self hosted runners</a></li> </ul> <h3>Activate environment</h3> <p>In previous versions using the input <code>python-version</code> automatically activated a venv at the repository root. This led to some unwanted side-effects, was sometimes unexpected and not flexible enough.</p> <p>The venv activation is now explicitly controlled with the new input <code>activate-environment</code> (false by default):</p> <pre lang="yaml"><code>- name: Install the latest version of uv and activate the environment uses: astral-sh/setup-uv@v6 with: activate-environment: true - run: uv pip install pip </code></pre> <p>The venv gets created by the <a href="https://docs.astral.sh/uv/pip/environments/"><code>uv venv</code></a> command so the python version is controlled by the <code>python-version</code> input or the files <code>pyproject.toml</code>, <code>uv.toml</code>, <code>.python-version</code> in the <code>working-directory</code>.</p> <h3>Working Directory</h3> <p>The new input <code>working-directory</code> controls where we look for <code>pyproject.toml</code>, <code>uv.toml</code> and <code>.python-version</code> files which are used to determine the version of uv and python to install.</p> <p>It can also be used to control where the venv gets created.</p> <pre lang="yaml"><code>- name: Install uv based on the config files in the working-directory uses: astral-sh/setup-uv@v6 with: working-directory: my/subproject/dir </code></pre> <blockquote> <p>[!CAUTION]</p> <p>The inputs <code>pyproject-file</code> and <code>uv-file</code> have been removed.</p> </blockquote> <h3>Default <code>cache-dependency-glob</code></h3> <p><a href="https://github.com/ssbarnea"><code>@ssbarnea</code></a> found out that the default <code>cache-dependency-glob</code> was not suitable for a lot of users.</p> <p>The old default</p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/astral-sh/setup-uv/commit/6b9c6063abd6010835644d4c2e1bef4cf5cd0fca"><code>6b9c606</code></a> Bump dependencies (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/389">#389</a>)</li> <li><a href="https://github.com/astral-sh/setup-uv/commit/ef6bcdff59f18584d3ff2d6733fe1ffb9b7545c1"><code>ef6bcdf</code></a> Fix default cache dependency glob (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/388">#388</a>)</li> <li><a href="https://github.com/astral-sh/setup-uv/commit/9a311713f4acad0acceb25fb016307e47c3887b6"><code>9a31171</code></a> chore: update known checksums for 0.6.17 (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/384">#384</a>)</li> <li><a href="https://github.com/astral-sh/setup-uv/commit/c7f87aa956e4c323abf06d5dec078e358f6b4d04"><code>c7f87aa</code></a> bump to v6 in README (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/382">#382</a>)</li> <li><a href="https://github.com/astral-sh/setup-uv/commit/aadfaf08d64f83cdd98eea14fdab8eb08f73656c"><code>aadfaf0</code></a> Change default cache-dependency-glob (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/352">#352</a>)</li> <li><a href="https://github.com/astral-sh/setup-uv/commit/a0f9da6273a171f2d94cce2036eaf5a07fefa23c"><code>a0f9da6</code></a> No default UV_CACHE_DIR on selfhosted runners (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/380">#380</a>)</li> <li><a href="https://github.com/astral-sh/setup-uv/commit/ec4c6916287cf1471f9f803d79ef6a0a04520e81"><code>ec4c691</code></a> new inputs activate-environment and working-directory (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/381">#381</a>)</li> <li><a href="https://github.com/astral-sh/setup-uv/commit/aa1290542ebcd3b6932d825ed2b40807f82b2fdd"><code>aa12905</code></a> chore: update known checksums for 0.6.16 (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/378">#378</a>)</li> <li><a href="https://github.com/astral-sh/setup-uv/commit/fcaddda076a8158a712b6d64986baf606c446694"><code>fcaddda</code></a> chore: update known checksums for 0.6.15 (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/377">#377</a>)</li> <li><a href="https://github.com/astral-sh/setup-uv/commit/fb3a0a97fac846cb3395265a3087ab94ad3ca2a0"><code>fb3a0a9</code></a> log info on venv activation (<a href="https://redirect.github.com/astral-sh/setup-uv/issues/375">#375</a>)</li> <li>See full diff in <a href="https://github.com/astral-sh/setup-uv/compare/v5...v6">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- User facing changes: - Rename `ElectricalNetwork.from_dgs` to `from_dgs_file` and add `ElectricalNetwork.from_dgs_dict`. The old method is deprecated. - Internal changes: - Refactor common parts of electrical network classes into an abstract base class. - Refactor common parts of element classes into an abstract base class. - Streamline abstract classes handling - Avoid setting `_cy_element` to `None` and prefer deleting the disconnected object to avoid segfaults similar to #346 - Emit a clear error when mixing rlf and rlfs objects
Internal changes only: - Simplify warnings filtering by applying `action` directly in `catch_warnings` - Simplify `ImportError` traceback with exception notes instead of chaining exceptions
Also add preliminary support for python 3.14 development version and for free-threaded python 3.13t. Full support is waiting on our dependencies to release relevant wheels.
- Fix an error when plotting a network with all its geometries on the same longitude or latitude and `zoom_start` is not provided - Add more information to the hover over lines and buses - Emit a clear error if an rlfs element was passed to plotting functions that accept rlf elements only - [single] Support plotting rlfs networks and add `rlfs.plotting` module
This makes the common case much more ergonomic.
- Add `rlfs.ElectricalNetwork.from_rlf` - Add `rlfs.ElectricalNetwork` catalogue methods that reuse `rlfs.ElectricalNetwork.from_rlf` - Add conversion of transformer and flexible params from rlf to rlfs similar to line params
…398) This PR brings many performance improvements for results access on the network and for network serialization. The optimization is mainly based on looping over lists instead of numpy arrays which is much more performant for small sized arrays like in our case. Iterating over a small list, of say voltages, is 4X faster than iterating over an array: ```ipy [In]: %%timeit [[v.real, v.imag] for v in voltages] [Out]: 1.62 μs ± 32 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each) ``` vs ```ipy [In]: %%timeit [[v.real, v.imag] for v in voltages.tolist()] [Out]: 429 ns ± 6.77 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each) ``` Similarly, computing the complex power in a list is 2X faster than using array multiplication. This resulted in a measured speedup of 20% when accessing `en.res_buses`, `en.res_buses_voltages`, `en.res_lines`, `en.res_transformers` and `en.res_loads` in an MV feeder with 351 buses, 318 lines, 31 transformers and 498 loads. The same network showed a 15% speedup when serialized to a dict with the results.
Similar structure to rlfs. The nesting is no longer needed as we don't have the C++ code anymore.
Added `rlfs.plotting.plot_results_interactive_map` which plots a network colored by its results. I had this function lying around in my local repo and thought it makes sense to share it. This function shares a lot of code with `plot_interactive_map` so I factorized the common parts into a helper function. After the factorization, it became easy to separate `plot_interactive_map` for rlfs from rlf so I separated them.
I am getting a `TypeError: Object of type Point is not JSON serializable` when trying to plot the graph of the network with pyviz. This is because we store the geometries as shapely objects in the graph. This PR changes the geometries to geojson-like format so that they are JSON serializable for better compatibility with the networkx ecosystem. I also noticed that the buses were missing some data so I added them.
…ates Fixes and network updates
Fix ValueError: cannot process flags argument with a compiled pattern
|
Maybe add the |
|
@benoit9126 I wrote blog-style release notes that better organize the changes and highlight important ones. Please use it in the GitHub release when it is out. This is the release notes for Roseau Load Flow version 0.13.0. This version introduces several new Support for Open SwitchesPass Contributed in PR 389. Sides Accessors for BranchesAccess to parameters and results of branch sides has been improved by adding side accessors to branch elements.
A side is a bus connectable element that has all common attributes of bus connectables. For example, Functions that used to accept a separate branch element and a Contributed in PR 385. Plotting Improvements
Contributed in PR 395, PR 399. Better Graph SupportIn this release, the
Contributed in PR 391. External Tool Data in JSON FilesWhen writing an electrical network to a JSON file, it is now possible to include data specific to your tool or application. This data is stored in the Contributed in PR 388. Improved Unbalance CalculationsIn earlier versions, the voltage unbalance calculation was limited to the IEC definition (Voltage Unbalance Factor, VUF). This release adds support for IEEE (Percentage Voltage Unbalance Ratio, PVUR) and NEMA (Load Voltage Unbalance Ratio, LVUR) definitions. The Additionally, current unbalance calculations have been added for loads and sources through the Contributed in PR 357. Transformers ImprovementsThis release includes several improvements and bug fixes related to transformers and the transformers catalogue.
Contributed in PR 355, PR 366, PR 382, PR 364, PR 371, PR 365. Python Support and Build System ChangesThis release drops support for Python 3.10 and older versions. Roseau Load Flow now requires Python 3.11 or newer. This release also adds support for musl linux distributions and preliminary support for python 3.14 development version and for free-threaded python 3.13t and 3.14t. Full support is waiting on our dependencies to release relevant wheels. We also switched from Contributed in PR 362, PR 394, PR 393. Other Notable Improvements and New Features
Other Notable Bug Fixes
Miscellaneous Changes
|
A very long list of changes for this new version. 🌟
Add results plotting for rlfs #402 Improve the
en.to_graphmethod.geomattribute to be a GeoJSON-like dictionary instead of a shapely geometry object. This makes the graph data JSON-serializable and compatible with pyviz plotting.Flatten the models package #401 Rename some internal models modules. The models classes are always available as
rlf.<model_name>.Add LineParameters.to_sym method #400 Add
LineParameters.to_symmethod to convert three-phase line parameters to symmetrical components. The method returns the symmetrical components:z0,z1,y0,y1, and for lines with a neutral wire:zn,zpn,yn,ypn.Add popup and search to interactive map plots #399 Add popup and search functionality to the interactive map plot.
rlf.plotting.plot_interactive_mapnow acceptsadd_tooltips,add_popupsandadd_searcharguments to control the display of tooltips, popups and search features. These features are enabled by default.Improve the performance of network results and network serialization #398 Improve the performance of accessing network results as dataframes by up to 20% and serializing a network to a dictionary by up to 15%. The improvements are mostly noticeable for large networks or when performing many simulations like in a time series analysis.
Allow passing a single flex param to loads #396 Allow passing a single
FlexibleParameterobject to a constant-power load to be used for all phases.Improve plotting interactive map #395 Improve line and bus hover information in interactive map plots. Fix an error in automatic zoom calculation when the whole network is on the same longitude or latitude.
Support musl linux #394 Add support for musl linux distributions. Also add preliminary support for python 3.14 development version and for free-threaded python 3.13t and 3.14t. Full support is waiting on our dependencies to release relevant
wheels.
ENH: Use the uv build backend #393 Use the
uv_buildbuild backend instead ofhatchlingto build the package.Fix disconnecting loads and sources #392 Disconnect a ground connection of a load or source when the load or source is disconnected from the network. Add
is_disconnectedproperty to loads, sources and ground connections to check if the element is disconnected. In the future, accessing the bus of a disconnected load or source will return the original bus instead ofNone, useis_disconnectedto check if the load or source is disconnected.Return multi-graph from
en.to_graph#391 BUG:en.to_graphdoes not include parallel branches #390ElectricalNetwork.to_graphnow returns a multi-graph to preserve parallel edges. It also gained arespect_switchesparameter that can be set toFalseto include open switches in the graph. The default value isTrue, which means that open switches are not included in the graph.Add support for open switches #389 Add support for open switches. Pass
closed=Falseto theSwitchconstructor to create an open switch. Callswitch.open()to open an existing switch andswitch.close()to close it.switch.closedtells if the switch is closed or not. The switch is closed by default.Add external tool data to the electrical network #388 ENH: Add a way to store tool metadata on the network #378 Add
ElectricalNetwork.tool_datato attach tool-specific data to the electrical network. The data is written to the JSON file when saving the network and is read when loading.Stop reformatting arrays in json output #387 Stop reformatting arrays in json output.
Add branch sides #385 ENH: Add accessors to the sides of branches #344 Add sides accessors to branches.
Transformer.side_hvandTransformer.side_lvreturn the high-voltage and low-voltage sides of a transformer.Line.side1andLine.side2return the two sides of a line.Switch.side1andSwitch.side2return the two sides of a switch.A side is a bus connectable element and has all common attributes of bus connectables. For example,
Transformer.side_hvhas the attributesbus,phases,res_currents,res_powers,res_voltages, etc.Passing a branch element and a separate side argument to
rlf.GroundConnection,rlf.plotting.plot_voltage_phasorsandrlf.plotting.plot_symmetrical_voltagesis deprecated in favor of passing a branch side directly. For example, replacerlf.GroundConnection(ground=ground, element=transformer, side="HV")byrlf.GroundConnection(ground=ground, element=transformer.side_hv).Fix voltage propagation when traversing step-up transformer #382 Improve load flow convergence for networks with step-up transformers by improving the initial guesses for the voltages of the buses.
Fix missing neutral ampacity in line params geometric model #380 BUG:
LineParameters.from_geometryraises an error ifampacity_neutralis not set #379 Fix error when neutral ampacity is not passed toLineParameters.from_geometry.Refactor network and element classes #374 Rename the
from_dgsmethod ofrlf.ElectricalNetworktofrom_dgs_fileand add a newfrom_dgs_dictmethod to load a network from a DGS-formatted dictionary. The old method is deprecated and will be removed in a future release. Thefrom_dgs_filemethod accepts an optionalencodingparameter to specify the encoding of the DGS file.Deprecate forgotten transformer properties from last release #371 Deprecate
Transformer.res_voltage_hvandTransformer.res_voltage_lvproperties added in the last release by mistake. A simpler interface will be added later, as described in ENH: Add accessors to the sides of branches #344.Add results of ground potential to shunt line #369 Add
Line.res_ground_potentialproperty to get the potential of the ground port of lines with shunt components. Update JSON file format to version 5 to store this information. Files created with previous versions of Roseau Load Flow will still be readable and will warn on loading.Improve the transformer parameters and the catalogue #366 Add nominal frequency (
fn), cooling class (cooling) and insulation type (insulation) to theTransformerParametersclass. The transformers catalogue has been updated accordingly. The manufacturer names in thecatalogue have been expanded to better accommodate new transformers (
SE⇾Schneider Electric,FT⇾France Transfo, ...). More HV/MV transformers have been added to the catalogue. The cooling and insulation are described in the new enumeration typesTransformerCoolingandTransformerInsulationrespectively.Fix minor inconsistency in sc parameters calculation of transformers #365 Fix minor inconsistency in the calculation of short-circuit parameters of transformers with no open and short circuit tests data. The iron losses are now consistently ignored during the calculation of the short-circuit parameters.
Fix missing transformer floating neutral #364 BUG: Transformer with a neutral connected to a bus without a neutral loses its neutral phase #363 Fix missing floating neutral of three-phase transformers when the bus does not have a neutral.
Detect parameters with duplicate IDs #361 ENH: Check if different transformer/line parameters with the same ID are used #300 Raise an error when duplicate line or transformer parameters IDs are used in the same network.
Drop support for Python 3.10 #362 ENH: Drop Python 3.10 support #338 Require Python 3.11 or newer.
BUG: ground not added by
add_short_circuit#360 BUG: ground not added byadd_short_circuit#359 Fix a bug related to adding short circuits to a bus when the ground fault was not already part of the electrical network.Fix in DGS export #358 Fix a division by zero error during DGS export.
Add more unbalance calculations #357 Improve support for unbalance calculations.
res_voltage_unbalancemethod now accepts adefinitionparameter to choose between the definitions of the voltage unbalance from'VUF'(IEC),'PVUR'(IEEE) and'LVUR'(NEMA).res_current_unbalancemethod to compute the current unbalance.Add missing max voltage level to the catalogue #356 Fix regression since version 0.11.0 where
max_voltage_levelfor buses was missing in the catalogue networks.Add HV/MV transformer models to the catalogue #355 ENH: Add HV/MV transformers to the catalogue #337 Add HV/MV transformer models to the catalogue.