NatLabRockies / NatLabRockies/H2Integrate

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

Open
#660 1 comment 0 reactions 2 assignees View on GitHub

@johnjasa is already working on this.

Since May 1, 2026.

Dominant language
Python
Stars
26
Forks
44
Avg merge
3d 22h
Merged PRs (30d)
16

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.