Skip to content

Make carrier attribute optional#182

Draft
Bachibouzouk wants to merge 2 commits intodevfrom
feature/make-carrier-optional
Draft

Make carrier attribute optional#182
Bachibouzouk wants to merge 2 commits intodevfrom
feature/make-carrier-optional

Conversation

@Bachibouzouk
Copy link
Collaborator

@Bachibouzouk Bachibouzouk commented Aug 27, 2024

Description

I noticed that carrier was set at the component level and should be explicitly set at bus level in case of multi-input/multi-output components in rl-institut/oemof-tabular-plugins#26 otherwise it leads to logical problems that a component has one carrier assigned although it deals with multiple carriers. This is needed for book-keeping of energy flows from different sectors.

It is possible without any changes to assign a carrier column to the bus.csv resource, however it is not possible to not have a carrier column in resources based on Facades which have carrier as an attribute.

I experimented and saw that the fact that the carrier attribute is required in the definition of the facades. It throws an error at this line if I try to instantiate a facade without providing a value for the carrier attribute.

Fixes #oemof-tabular-plugins/issues/26

Type of change

Right now I outline two suggestions in the two commits for discussion purposes, I will then reset the commits and implement an approved solution.

Suggestion 1:
Always provide carrier as an empty string if "carrier" not found in the kwargs to the facade. This is working well and is a two-liner fix but it is not elegant.

Suggestion 2:
Make carrier attribute optional and with a default value. This is more elegant but we need to change that in all facades

Please tick or delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

Please tick or delete options that are not relevant.

  • New and adjusted code is formatted using the pre-commit hooks
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
    Existing tests do not pass locally on latest dev but they pass online
  • I have added new features/fixes to the CHANGELOG
  • I have added my name to AUTHORS

@Bachibouzouk Bachibouzouk force-pushed the feature/make-carrier-optional branch from cf98a07 to ffc9b42 Compare August 27, 2024 09:53
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.

1 participant

Comments