From 80c693202d49755493895f0d52e8a8f7006294c7 Mon Sep 17 00:00:00 2001 From: Hendrik Huyskens Date: Fri, 6 Oct 2023 13:41:20 +0200 Subject: [PATCH] Implement facade specific parameter mapping --- data_adapter_oemof/mappings.py | 13 ++++++++++--- data_adapter_oemof/mappings/PARAMETER_MAP.yaml | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/data_adapter_oemof/mappings.py b/data_adapter_oemof/mappings.py index b9a5692..d9c022b 100644 --- a/data_adapter_oemof/mappings.py +++ b/data_adapter_oemof/mappings.py @@ -63,18 +63,25 @@ def map_key(self, key): if self.process_name in self.mapping and key in self.mapping[self.process_name]: return self.mapping[self.process_name][key] - # 2. Check facade-specific mappings second + # 2. Check adapter-specific mappings second if ( self.adapter.__name__ in self.mapping and key in self.mapping[self.adapter.__name__] ): return self.mapping[self.adapter.__name__][key] - # 3. Check default mappings third + # 3. Check facade-specific mappings third + if ( + self.adapter.facade.__name__ in self.mapping + and key in self.mapping[self.adapter.facade.__name__] + ): + return self.mapping[self.adapter.facade.__name__][key] + + # 4. Check default mappings fourth if key in self.mapping.get("DEFAULT", []): return self.mapping["DEFAULT"][key] - # 4. Use key if no mapping available + # 5. Use key if no mapping available logger.warning(f"Key not found. Did not map '{key}'") return key diff --git a/data_adapter_oemof/mappings/PARAMETER_MAP.yaml b/data_adapter_oemof/mappings/PARAMETER_MAP.yaml index 20c3469..6516a6d 100644 --- a/data_adapter_oemof/mappings/PARAMETER_MAP.yaml +++ b/data_adapter_oemof/mappings/PARAMETER_MAP.yaml @@ -5,3 +5,5 @@ DEFAULT: marginal_cost: variable_costs fixed_cost: fixed_costs capacity_cost: capital_costs +Conversion: + marginal_cost: fuel_costs