diff --git a/data_adapter_oemof/adapters.py b/data_adapter_oemof/adapters.py index bf00d21..7b2b6da 100644 --- a/data_adapter_oemof/adapters.py +++ b/data_adapter_oemof/adapters.py @@ -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): """ diff --git a/data_adapter_oemof/build_datapackage.py b/data_adapter_oemof/build_datapackage.py index c74906f..46158ba 100644 --- a/data_adapter_oemof/build_datapackage.py +++ b/data_adapter_oemof/build_datapackage.py @@ -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 @@ -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())