-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add ValueCurves and cost functions from InfrastructureSystem.jl…
… to infrasys (#38) - Added classes for InputOutputCurve, IncrementalCurve, and AverageRateCurve that call function_data classes to build generic cost curves. These classes are analogous to the structs found in PowerSystems - Added functions to convert between the different value_curves classes (ex: InputOutputToIncremental creates an IncrementalCurve from an existing InputOutputCurve) - Added functions to function_data to perform calculations for value_curve conversion - Added additional serialization tests to test_function_data --------- Co-authored-by: pesap <[email protected]>
- Loading branch information
1 parent
cd13635
commit db59ea2
Showing
15 changed files
with
718 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
```{eval-rst} | ||
.. _function-data-api: | ||
``` | ||
# Function data | ||
|
||
```{eval-rst} | ||
.. automodule:: infrasys.function_data | ||
:members: | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ | |
time_series | ||
location | ||
quantities | ||
function_data | ||
``` |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from typing_extensions import Annotated | ||
from infrasys.component import Component | ||
from pydantic import Field | ||
from infrasys.value_curves import InputOutputCurve, IncrementalCurve, AverageRateCurve | ||
from infrasys.function_data import LinearFunctionData | ||
|
||
|
||
class ProductionVariableCostCurve(Component): | ||
name: Annotated[str, Field(frozen=True)] = "" | ||
|
||
|
||
class CostCurve(ProductionVariableCostCurve): | ||
"""Direct representation of the variable operation cost of a power plant in currency. | ||
Composed of a Value Curve that may represent input-output, incremental, or average rate | ||
data. The default units for the x-axis are MW and can be specified with | ||
`power_units`. | ||
""" | ||
|
||
value_curve: Annotated[ | ||
InputOutputCurve | IncrementalCurve | AverageRateCurve, | ||
Field( | ||
description="The underlying `ValueCurve` representation of this `ProductionVariableCostCurve`" | ||
), | ||
] | ||
vom_units: Annotated[ | ||
InputOutputCurve, | ||
Field(description="(default: natural units (MW)) The units for the x-axis of the curve"), | ||
] = InputOutputCurve( | ||
function_data=LinearFunctionData(proportional_term=0.0, constant_term=0.0) | ||
) | ||
|
||
|
||
class FuelCurve(ProductionVariableCostCurve): | ||
"""Representation of the variable operation cost of a power plant in terms of fuel. | ||
Fuel units (MBTU, liters, m^3, etc.) coupled with a conversion factor between fuel and currency. | ||
Composed of a Value Curve that may represent input-output, incremental, or average rate data. | ||
The default units for the x-axis are MW and can be specified with `power_units`. | ||
""" | ||
|
||
value_curve: Annotated[ | ||
InputOutputCurve | IncrementalCurve | AverageRateCurve, | ||
Field( | ||
description="The underlying `ValueCurve` representation of this `ProductionVariableCostCurve`" | ||
), | ||
] | ||
vom_units: Annotated[ | ||
InputOutputCurve, | ||
Field(description="(default: natural units (MW)) The units for the x-axis of the curve"), | ||
] = InputOutputCurve( | ||
function_data=LinearFunctionData(proportional_term=0.0, constant_term=0.0) | ||
) | ||
fuel_cost: Annotated[ | ||
float, | ||
Field( | ||
description="Either a fixed value for fuel cost or the key to a fuel cost time series" | ||
), | ||
] |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.