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

Add with_units_base feature #1232

Merged
merged 3 commits into from
Dec 26, 2024
Merged

Add with_units_base feature #1232

merged 3 commits into from
Dec 26, 2024

Conversation

GabrielKS
Copy link
Collaborator

Closes #1229 by adding a new exported function with_units_base that serves as a "context manager" to execute a block of code as if the system's units base were set to a particular value.

src/base.jl Outdated Show resolved Hide resolved
@GabrielKS GabrielKS self-assigned this Dec 23, 2024
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.31%. Comparing base (2d4b336) to head (6e8e2f2).
Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1232      +/-   ##
==========================================
+ Coverage   84.29%   84.31%   +0.02%     
==========================================
  Files         181      181              
  Lines        8391     8399       +8     
==========================================
+ Hits         7073     7082       +9     
+ Misses       1318     1317       -1     
Flag Coverage Δ
unittests 84.31% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/PowerSystems.jl 0.00% <ø> (ø)
src/base.jl 88.98% <100.00%> (+0.10%) ⬆️

... and 1 file with indirect coverage changes

Copy link
Contributor

@daniel-thom daniel-thom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GabrielKS GabrielKS requested a review from jd-lara December 23, 2024 18:06
Copy link
Contributor

@kdayday kdayday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an example at the end of this tutorial section showing with_units_base? https://nrel-sienna.github.io/PowerSystems.jl/stable/tutorials/creating_system/#Changing-System-Per-Unit-Settings
and mention in https://nrel-sienna.github.io/PowerSystems.jl/stable/explanation/per_unit/ with the other functions (halfway down). Thanks!

src/base.jl Outdated Show resolved Hide resolved
src/base.jl Outdated Show resolved Hide resolved
src/base.jl Outdated Show resolved Hide resolved
@GabrielKS
Copy link
Collaborator Author

@kdayday fixed the docstrings and added to that tutorial and that explanation page — how do those look?

@GabrielKS GabrielKS requested a review from kdayday December 26, 2024 19:09
@jd-lara
Copy link
Member

jd-lara commented Dec 26, 2024

@GabrielKS can you rebase this branch to update it?

@GabrielKS
Copy link
Collaborator Author

@GabrielKS can you rebase this branch to update it?

Done

@jd-lara jd-lara merged commit ac0a147 into main Dec 26, 2024
11 checks passed
@jd-lara jd-lara deleted the gks/with_units_base branch December 26, 2024 20:00
GabrielKS added a commit to NREL-Sienna/PowerFlows.jl that referenced this pull request Dec 26, 2024
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

Successfully merging this pull request may close these issues.

Move with_units here from PowerFlows.jl
4 participants