Skip to content

Update Grid and Feedstock so prices can be provided per-year #660

@elenya-grant

Description

@elenya-grant

Update Grid and Feedstock so prices can be provided per-year

@vijay092 requested this for the grid model, but I thought it was relevant for the feedstock model as well. Currently, both of these models can take price inputs in as either a single value or as a list/array that has a length equal to n_timesteps. It'd be nice if these options were expanded to include a case where the prices would be specified as a list/array with a length of plant_life.

This can be done pretty easily by updating the logic in GridCostModel like below (but it should also be updated for the electricity_buy_price shape)

if self.config.electricity_buy_price is not None:
    buy_price = self.config.electricity_buy_price
    if isinstance(buy_price, list | np.ndarray):
        if len(buy_price) != n_timesteps or len(buy_price) != plant_life:
            raise ValueError(
                f"electricity_buy_price length ({len(buy_price)}) "
                f"must match n_timesteps ({n_timesteps}) or plant_life ({plant_life})"
            )
        
        buy_price_shape = len(buy_price)
    else:
        buy_price_shape = 1

However, there would be some additional considerations to handle variable dt or varying simulation length cases. I will update this issue with that proposed solution later.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions