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

import_components_from_dataframe ignores default values #746

Open
1 task
Irakli-D opened this issue Oct 4, 2023 · 2 comments · May be fixed by #896
Open
1 task

import_components_from_dataframe ignores default values #746

Irakli-D opened this issue Oct 4, 2023 · 2 comments · May be fixed by #896
Labels
Milestone

Comments

@Irakli-D
Copy link

Irakli-D commented Oct 4, 2023

Checklist

  • I am using the latest version of PyPSA available on the 4th of October 2023, without any modification.

Describe the Bug

If some parameters in the dataframe are Nan, the import_components_from_dataframe does not take into consideration the default values. For example, if the p_max_pu and p_min_pu of Generators are not defined in an inputted data frame, the network does not consider the default values of the component parameters and consistency_check() shows them as warnings. This finally results in an infeasible solution.

@Irakli-D Irakli-D added the bug label Oct 4, 2023
@fneum
Copy link
Member

fneum commented Oct 10, 2023

Thanks for letting us know. In the meantime, you can do:

n.madd(c, df.index, **df)

#341

@fneum fneum added this to the Release v0.26 milestone Nov 2, 2023
@koen-vg
Copy link
Contributor

koen-vg commented Dec 5, 2023

Just to add on to this, import_components_from_dataframe is used internally in PyPSA too in ways that have been causing me some trouble. In particular, when clustering networks, the new (output) variable n_mod receives NaN values at clustering/spatial.py#L262 (in aggregateoneport), and these NaN values later can lead to problems in get_clustering_from_busmap where a call to import_components_from_dataframe now raises an error because NaN values cannot be cast to int.

It seems like either PyPSA internally must be able to accept NaN values even in columns that nominally should be cast to int, or that aggregateoneport (and maybe other functions?) need to be fixed so as not lot let NaN values slip into int-typed columns.

(This problem seems to make PyPSA-Eur incompatible with PyPSA 0.26, at least for me.)

@lkstrp lkstrp linked a pull request May 22, 2024 that will close this issue
6 tasks
lkstrp added a commit to lkstrp/PyPSA that referenced this issue May 22, 2024
@lkstrp lkstrp linked a pull request May 22, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants