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

Unit Conversion Inconsistency Between Types #1164

Open
GabrielKS opened this issue Jul 29, 2024 · 3 comments
Open

Unit Conversion Inconsistency Between Types #1164

GabrielKS opened this issue Jul 29, 2024 · 3 comments
Assignees

Comments

@GabrielKS
Copy link
Collaborator

GabrielKS commented Jul 29, 2024

Another sub-issue of #1134 but this one is distinct enough to get its own issue: certain fields are units system-dependent in some structs but not in others. For instance, the result of get_active_power is units system-dependent in ThermalStandard:

get_active_power(value::ThermalStandard) = get_value(value, value.active_power)

but not in Source:
get_active_power(value::Source) = value.active_power

making it frustrating to try to write polymorphic code that does the right thing for both.

As an incremental fix before the #1134 overhaul, I propose we work towards the principle that each getter function (a) either performs conversion for all types or does not perform conversion for any types and (b) clearly states which of these it is in its docstrings.

@jd-lara
Copy link
Member

jd-lara commented Jul 29, 2024

This has a fix by defining correct getter in the JSON template.

@jd-lara jd-lara self-assigned this Jul 29, 2024
@rodrigomha rodrigomha self-assigned this Jul 29, 2024
@GabrielKS
Copy link
Collaborator Author

Update from synchronous discussion: there is a nuance here in that Source doesn't have a base power, so it cannot report quantities in device base units. @rodrigomha will add a base power field to Source.

@jd-lara
Copy link
Member

jd-lara commented Jan 16, 2025

@GabrielKS and @rodrigomha did we add base power to the source?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants