Conversation
Member
Author
|
@benoit9126 did you have some time to take a look at this PR? I think we should cut a release after it is merged to fix several warnings from new pandas versions. |
Member
|
Yes, and both @Saelyos and I don't manage to reproduce this bug on our computer with Python 3.11 or Python 3.12. Could you please provide us the version of numpy and pint that you are using? The problem may be solved by modifying the dependencies requirements. |
Member
Author
import numpy as np
from roseau.load_flow import *
# Create two buses
source_bus = Bus(id="sb", phases="abcn")
load_bus = Bus(id="lb", phases="abcn")
# Define the reference of potentials to be the neutral of the source bus
ground = Ground(id="gnd")
# Fix the potential of the ground at 0 V
pref = PotentialRef(id="pref", element=ground)
ground.connect(source_bus, phase="n")
# Create a LV source at the first bus
# Volts (phase-to-neutral because the source is connected to the neutral)
un = Q_(0.4 / np.sqrt(3), "kV")
source_voltages = [un, un * np.exp(-2j * np.pi / 3), un * np.exp(2j * np.pi / 3)]
vs = VoltageSource(id="vs", bus=source_bus, voltages=source_voltages)
# Add a load at the second bus
load = PowerLoad(id="load", bus=load_bus, powers=[10e3 + 0j, 10e3, 10e3]) # VA
# Add a LV line between the source bus and the load bus
# R = 0.1 Ohm/km, X = 0
lp = LineParameters("lp", z_line=(0.1 + 0.0j) * np.eye(4, dtype=complex))
line = Line(id="line", bus1=source_bus, bus2=load_bus, parameters=lp, length=2.0)
Versions: $ python --version
Python 3.11.5
$ poetry show | grep -E '(numpy|pint)'
numpy 1.26.1 Fundamental package for array co...
pint 0.22 Physical quantities moduleThis also reproduced with Python 3.12 and the latest version of pint and numpy 3 weeks ago |
Member
|
@alihamdan: @Saelyos is on it. He will rewrite a part of the wrapper to handle the case "array of quantities". Two advantages:
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #145
This required a few setters to abandon the
ureg.wrapsdecorator but the alternative is very simple so I don't see a problem. I also tested other alternative likeQ_.from_sequencebut these don't always work as expected.