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

Feature/routine for decomissioning of exisiting capacity #78

Merged
merged 30 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
47a629e
Structure for steelcast test case
FelixMau Mar 5, 2024
192cb71
Merge Dev
FelixMau Mar 5, 2024
f51db2d
start test writing
FelixMau Mar 6, 2024
b832178
Adapt strukture and Mappings for steel
FelixMau Mar 13, 2024
4da45c7
Merge branch 'feature/add_mimo_adapter' into feature/routine-for-deco…
FelixMau Mar 15, 2024
4cc72fd
Add decomissioning to adapters & calculations
FelixMau Mar 15, 2024
32cf342
Linting
FelixMau Mar 15, 2024
82c57e0
Warn and return single capacity
FelixMau Mar 15, 2024
89ac703
Calc max value from capacity
FelixMau Apr 3, 2024
4e28f88
Commenting & Linting
FelixMau Apr 3, 2024
97a7ad0
Adding empty helper
FelixMau Apr 10, 2024
39192f5
Commenting & Linting
FelixMau Apr 10, 2024
c8b1f35
Loggin info if `max` already set
FelixMau Apr 11, 2024
cf958cb
Loggin info if `max` already set
FelixMau Apr 11, 2024
9583a68
Adding comment
FelixMau Apr 15, 2024
4cbeb22
Seperating calculation functionality
FelixMau Apr 15, 2024
0ee4eca
seperating functions for better overview
FelixMau Apr 16, 2024
1e3d412
Merge branch 'dev' into feature/routine-for-decomissioning-of-existin…
FelixMau Apr 16, 2024
6132c83
Move post mappinig calculations to calculations
FelixMau Apr 16, 2024
8c0c690
Commenting & Linting
FelixMau Apr 16, 2024
4cee6ff
Idea pitch to add in flow parameters
FelixMau Apr 16, 2024
e32c109
Rearranging functions
FelixMau Apr 17, 2024
d96d6f6
Revisting decomissioning
FelixMau Apr 17, 2024
2901bb9
Test fail due to empty parameter dicts
FelixMau Apr 17, 2024
3451937
Update oemof.industry
FelixMau Apr 24, 2024
78600e5
Update oemof.industry
FelixMau Apr 24, 2024
03fbefc
Adjust extra fields for mimo
FelixMau Apr 24, 2024
60c135f
Remove outputparameters in Mimo
FelixMau May 6, 2024
acdb9e9
Update dependencies
FelixMau May 6, 2024
d9e872d
Update documentation & Logging
FelixMau May 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion data_adapter_oemof/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def get_default_parameters(self) -> dict:
)
}
)

if self.process_name[-1] == "0":
defaults = calculations.decommission(defaults)
return defaults

def get_fields(self) -> list[Field]:
Expand Down
48 changes: 48 additions & 0 deletions data_adapter_oemof/calculations.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import logging

import numpy as np
from oemof.tools.economics import annuity


Expand Down Expand Up @@ -34,3 +37,48 @@ def get_name(*args, counter=None):
@calculation
def get_capacity_cost(overnight_cost, fixed_cost, lifetime, wacc):
return annuity(overnight_cost, lifetime, wacc) + fixed_cost


def decommission(adapter_dict: dict) -> dict:
"""

Takes adapter dictionary from adapters.py with mapped values.

Supposed to be called when getting default parameters

Non investment objects must be decommissioned in multi period to take end of lifetime
for said objet into account

Returns
dictionary (
-------

"""
capacity_column = "capacity"
max_column = "max"

if capacity_column not in adapter_dict.keys():
logging.info("Capacity missing for decommissioning")
FelixMau marked this conversation as resolved.
Show resolved Hide resolved
return adapter_dict

if not isinstance(adapter_dict[capacity_column], list):
logging.info("No capacity fading out that can be decommissioned.")
FelixMau marked this conversation as resolved.
Show resolved Hide resolved
return adapter_dict

if max_column in adapter_dict.keys():
if adapter_dict[capacity_column] == adapter_dict[max_column]:
adapter_dict[max_column] = adapter_dict[capacity_column] / np.max(
adapter_dict[capacity_column]
)
else:
logging.info("Decommissioning and max value can not be set in parallel")
adapter_dict[max_column] = list(
(adapter_dict[max_column] / np.max(adapter_dict[capacity_column]))
)
else:
adapter_dict[max_column] = adapter_dict[capacity_column] / np.max(
adapter_dict[capacity_column]
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain whats happening in decommission function, as I don't quite get it from code alone?
Best to put in docstring directly...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Baisicly I am just dividing the yealy changing capacity by the maximum capacity and then setting the max capacity as value for all years while using the quotient as value for max

I also wanted to check whether max value already is used and wheter it just is the same as the capacity value (as in data provided for steel industy)


adapter_dict[capacity_column] = np.max(adapter_dict[capacity_column])
return adapter_dict
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name;type;balanced
sec_elec;bus;True
sec_h2;bus;True
sec_methane;bus;True
sec_hydrogen;bus;True
sec_elec_ind;bus;True
iip_heat_proc;bus;True
iip_steel_crudesteel;bus;True
exo_steel;bus;True
emi_co2_f_ind;bus;True
emi_ch4_f_ind;bus;True
emi_n2o_f_ind;bus;True
iip_steel_iron_ore;bus;True
ch4;bus;True
electricity;bus;True
emi_no2_f_ind;bus;True
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;name;region;year;bus
excess;De_emi_ch4_f_ind_tech;De;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];emi_ch4_f_ind
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;name;region;year;bus
excess;De_emi_co2_f_ind_tech;De;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];emi_co2_f_ind
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;name;region;year;bus
excess;De_emi_N2O_f_ind_tech;De;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];emi_no2_f_ind
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;carrier;tech;name;region;year;from_bus;to_bus
conversion;carrier;tech;DE_carrier_tech;DE;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];ch4;electricity
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;carrier;tech;name;region;year;capacity;max;expandable;from_bus_0;from_bus_1;from_bus_2;from_bus_3;from_bus_4;to_bus_0;to_bus_1;to_bus_2;to_bus_3;groups;emissions_factor_sec_methane_co2;emissions_factor_sec_methane_n2o;emissions_factor_sec_methane_ch4;conversion_factor_iip_heat_proc;conversion_factor_iip_steel_crudesteel;conversion_factor_sec_elec_ind;flow_share_sec_hydrogen_max;conversion_factor_sec_methane;conversion_factor_sec_hydrogen
mimo;carrier;tech;DE_carrier_tech;DE;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];42.6;[0.23839906103286382, 0.925924882629108, 0.7407417840375586, 0.555556338028169, 0.3703708920187793, 0.18518544600938966, 0.0, 0.0, 0.0, 0.0];0.0;sec_methane;sec_hydrogen;sec_elec_ind;iip_heat_proc;iip_steel_crudesteel;exo_steel;emi_co2_f_ind;emi_ch4_f_ind;emi_n2o_f_ind;"{""group_0"": [""sec_methane"", ""sec_hydrogen""]}";28.0;265.0;1.0;0.345;1.0;0.7749;[0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];1.5774;1.5774
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;carrier;tech;name;region;year;capacity_cost;from_bus_0;from_bus_1;from_bus_2;from_bus_3;from_bus_4;to_bus_0;to_bus_1;to_bus_2;to_bus_3;groups;emissions_factor_sec_methane_co2;emissions_factor_sec_methane_n2o;emissions_factor_sec_methane_ch4;conversion_factor_iip_heat_proc;conversion_factor_iip_steel_crudesteel;conversion_factor_sec_elec_ind;flow_share_sec_hydrogen_max;conversion_factor_sec_methane;conversion_factor_sec_hydrogen
mimo;carrier;tech;DE_carrier_tech;DE;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];50.0;sec_methane;sec_hydrogen;sec_elec_ind;iip_heat_proc;iip_steel_crudesteel;exo_steel;emi_co2_f_ind;emi_ch4_f_ind;emi_n2o_f_ind;"{""group_0"": [""sec_methane"", ""sec_hydrogen""]}";28.0;265.0;1.0;0.345;1.0;0.7749;[0.0, 0.0, 0.0, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0];1.5774;1.5774
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;carrier;tech;name;region;year;capacity_cost;from_bus_0;from_bus_1;from_bus_2;to_bus_0;groups;conversion_factor_iip_steel_iron_ore;conversion_factor_sec_elec_ind;conversion_factor_sec_hydrogen
mimo;carrier;tech;DE_carrier_tech;DE;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];10.0;sec_elec_ind;sec_hydrogen;iip_steel_iron_ore;iip_steel_crudesteel;{};1.5;0.7;17.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;carrier;amount;marginal_cost;name;region;year;bus
commodity;electricity;1000.0;[10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0];De_electricity_tech;De;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];sec_elec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;carrier;amount;marginal_cost;name;region;year;bus
commodity;h2;1000.0;[10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0];De_h2_tech;De;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];sec_h2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type;carrier;amount;marginal_cost;name;region;year;bus
commodity;methane;1000.0;[10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0];De_methane_tech;De;[2021, 2024, 2027, 2030, 2035, 2040, 2045, 2050, 2060, 2070];sec_methane
Loading
Loading