Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning when negative bev availability profile values #858

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

tgi-climact
Copy link
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
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
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
3 checks passed
@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