Skip to content

Adding "scalar" attributes as a pandas series/dataframe indexed against investment period onlyΒ #1095

Open
@ollie-bell

Description

Taking generators as an example, in order to enable "scalar" attributes (e.g. capital_cost) to vary over investment periods, one has to loop over the model investment periods and add a unique generator with the capital_cost value for that year as a float and apply the build_year:

capital_cost_by_period = {2025: 10.0, 2030: 20.0}
for period in capital_cost_by_period:
    n.add("Generator", name=f"my-generator-{period}", capital_cost=capital_cost_by_period[period], build_year=period)

This is a somewhat clunky user experience because "build_year" implies something not actually being built until that year, but it's being used for other situations like variable costs.

Could it be possible instead for the API to allow passing a pandas series indexed against the investment periods for these "scalar" attributes?

capital_cost_by_period = pd.Series([10.0, 20.0], index=pd.Index([2025, 2030], name="period"))  # index name matches multiindex level name for investment periods
n.add("Generator", name="my-generator", capital_cost=capital_cost_by_period)

In the case where you are using n.add with its implicit multi-add feature, you would pass a dataframe with the same index but columns with names matching each generator name. I suspect there may be ambiguities with the existing multi-add functionality to deal with here...

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions