Skip to content

Add warning when negative bev availability profile values#858

Merged
fneum merged 1 commit intoPyPSA:masterfrom
Climact:feature/warning-bev-profile
Jan 17, 2024
Merged

Add warning when negative bev availability profile values#858
fneum merged 1 commit intoPyPSA:masterfrom
Climact:feature/warning-bev-profile

Conversation

@tgi-climact
Copy link
Copy Markdown
Contributor

Changes proposed in this Pull Request

Changing the bev_avail_max and bev_avail_mean values could cause the profile to generate negative values. This leads to infeasibility. Raising a warning earlier in the process is useful to catch the configuration error sooner. This warning is raised in build_transport_demand.

Checklist

  • I tested my contribution locally and it seems to work fine.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to envs/environment.yaml.
  • Changes in configuration options are added in all of config.default.yaml.
  • Changes in configuration options are also documented in doc/configtables/*.csv.
  • A release note doc/release_notes.rst is added.

@fneum
Copy link
Copy Markdown
Member

fneum commented Jan 16, 2024

It would be good to understand where the negative values could come from and fix the underlying issue.

@tgi-climact
Copy link
Copy Markdown
Contributor Author

It would be good to understand where the negative values could come from and fix the underlying issue.

In my case, I was defining a too high value for bev_avail_max compared to bev_avail_mean. If so, avail becomes negative here :

avail = avail_max - (avail_max - avail_mean) * (traffic - traffic.min()) / (
        traffic.mean() - traffic.min()
    )

Because it's configuration based, I'm afraid there's not that much to do other than raise a warning.

@fneum fneum merged commit 59a92f6 into PyPSA:master Jan 17, 2024
@tgi-climact tgi-climact deleted the feature/warning-bev-profile branch May 21, 2024 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants