Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparison between Quantities does not work as expected #348

Closed
t-ober opened this issue Feb 16, 2023 · 2 comments
Closed

Comparison between Quantities does not work as expected #348

t-ober opened this issue Feb 16, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@t-ober
Copy link
Contributor

t-ober commented Feb 16, 2023

When comparing Quantities that are created with the DoubleConverterFactory and ones created "the regular way" we get unexpected failures.

That seems to be because the Units differ in their details.

e.g. the following test fails:

    def "creates units that are comparable to standard Quantity creation"() {

        when:
        def a = Quantities.getQuantity(1.234, PowerSystemUnits.NANOSIEMENS)
        def b = Quantities.getQuantity(1.234, MetricPrefix.NANO(Units.SIEMENS))

        then:
        a == b
    }
@t-ober t-ober added the bug Something isn't working label Feb 16, 2023
@t-ober
Copy link
Contributor Author

t-ober commented Feb 16, 2023

Related: ie3-institute/simBench2psdm#138

@sebastian-peter
Copy link
Member

As discussed, there is no easy solution to this besides just using the units in PowerSystemUnits. These also have the advantage that they can speed up calculations with quantities.

@t-ober t-ober closed this as completed Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants