Skip to content

Commit

Permalink
Add function for bev share constraint data (WIP).
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasJeckstadt committed Mar 14, 2024
1 parent e65b72d commit 39d9022
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions data_adapter_oemof/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,27 @@ def get_default_parameters(
defaults.update({"name": self.process_name})
return defaults

def create_bev_share_constraint(self
):
df = pd.DataFrame(
{'name': [f'{self.process_name}_{year}' for year in self.data['year']],
'type': self.process_name,
'year': self.data['year'],
'label': self.type,
'share_mob_flex_G2V': self.data['share_tra_flex_g2v'][0] if len(
self.data['share_tra_flex_g2v']) == 1 else self.data[
'share_tra_flex_g2v'], # if-structure necessary because single value is contained in a list.
'share_mob_flex_V2G': self.data['share_tra_flex_v2g'][0] if len(
self.data['share_tra_flex_v2g']) == 1 else self.data[
'share_tra_flex_v2g'],
'share_mob_inflex': self.data['share_tra_inflex'][0]if len(
self.data['share_tra_inflex']) == 1 else self.data[
'share_tra_inflex'],
}
)
# todo: save df to csv or find function to do so.
return


class TransportConversionAdapter(Adapter):
"""
Expand Down
3 changes: 3 additions & 0 deletions data_adapter_oemof/build_datapackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from data_adapter_oemof.adapters import Adapter as FacadeAdapter
from data_adapter_oemof.settings import BUS_MAP, PARAMETER_MAP, PROCESS_ADAPTER_MAP
from data_adapter_oemof.utils import convert_mixed_types_to_same_length
from data_adapter_oemof.adapters import BevFleetAdapter


# Define a function to aggregate differing values into a list
Expand Down Expand Up @@ -511,6 +512,8 @@ def build_datapackage(
parameter_map=parameter_map,
bus_map=bus_map,
)
if component_adapter.type == 'bev_fleet':
component_adapter.create_bev_share_constraint()
components.append(component_adapter.facade_dict)
# Fill with all buses occurring, needed for foreign keys as well!
process_busses += list(component_adapter.get_busses().values())
Expand Down

0 comments on commit 39d9022

Please sign in to comment.