NREL-Sienna / InfrastructureSystems.jl

Utility package for Sienna's simulation infrastructure
https://nrel-sienna.github.io/InfrastructureSystems.jl/
BSD 3-Clause "New" or "Revised" License
39 stars 21 forks source link

Variable Cost Refactor Part 1: Function Data #331

Closed GabrielKS closed 7 months ago

GabrielKS commented 7 months ago

The first part of a significant refactor of Sienna cost data structures. See https://github.com/NREL-Sienna/PowerSystems.jl/pull/1056 for more details. This PR consists of a new type FunctionData, a new set of concrete subtype structs to represent various functions, and the necessary refactoring to use them rather than IS.PWL and such in other InfrastructureSystems data structures. I also performed some minor code deduplication.

IS, PSY, and PSB tests pass when using the appropriate branches of each plus PowerSystemsTestData:

Screenshot of passing tests
GabrielKS commented 7 months ago

The group of four PRs this is a part of:

  1. https://github.com/NREL-Sienna/InfrastructureSystems.jl/pull/331
  2. https://github.com/NREL-Sienna/PowerSystems.jl/pull/1056
  3. https://github.com/NREL-Sienna/PowerSystemCaseBuilder.jl/pull/72
  4. https://github.com/NREL-Sienna/PowerSystemsTestData/pull/50
codecov[bot] commented 7 months ago

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (f74a857) 79.57% compared to head (dff57ce) 80.04%. Report is 2 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331/graphs/tree.svg?width=650&height=150&src=pr&token=I73yjxYxgn&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna)](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna) ```diff @@ Coverage Diff @@ ## main #331 +/- ## ========================================== + Coverage 79.57% 80.04% +0.47% ========================================== Files 53 54 +1 Lines 4244 4315 +71 ========================================== + Hits 3377 3454 +77 + Misses 867 861 -6 ``` | [Flag](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna) | `80.04% <94.82%> (+0.47%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna) | Coverage Δ | | |---|---|---| | [src/InfrastructureSystems.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL0luZnJhc3RydWN0dXJlU3lzdGVtcy5qbA==) | `80.00% <ø> (ø)` | | | [src/common.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL2NvbW1vbi5qbA==) | `100.00% <ø> (ø)` | | | [src/deterministic.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL2RldGVybWluaXN0aWMuamw=) | `84.61% <100.00%> (+2.52%)` | :arrow_up: | | [src/probabilistic.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL3Byb2JhYmlsaXN0aWMuamw=) | `80.70% <100.00%> (+2.73%)` | :arrow_up: | | [src/scenarios.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL3NjZW5hcmlvcy5qbA==) | `84.31% <100.00%> (ø)` | | | [src/function\_data.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL2Z1bmN0aW9uX2RhdGEuamw=) | `98.59% <98.59%> (ø)` | | | [src/hdf5\_time\_series\_storage.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL2hkZjVfdGltZV9zZXJpZXNfc3RvcmFnZS5qbA==) | `91.31% <96.15%> (ø)` | | | [src/utils/utils.jl](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna#diff-c3JjL3V0aWxzL3V0aWxzLmps) | `62.73% <75.00%> (+0.03%)` | :arrow_up: | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/NREL-Sienna/InfrastructureSystems.jl/pull/331/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NREL-Sienna)