diff --git a/energy_models/core/ccus/ccus.py b/energy_models/core/ccus/ccus.py index e824e263..632fbfc9 100644 --- a/energy_models/core/ccus/ccus.py +++ b/energy_models/core/ccus/ccus.py @@ -21,7 +21,6 @@ from energy_models.core.stream_type.base_stream import BaseStream from energy_models.core.stream_type.carbon_models.carbon import Carbon from energy_models.core.stream_type.carbon_models.carbon_capture import CarbonCapture -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.glossaryenergy import GlossaryEnergy @@ -42,7 +41,6 @@ class CCUS(BaseStream): CO2_list = [f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', f'{CarbonCapture.flue_gas_name} ({GlossaryEnergy.mass_unit})', f'{GlossaryEnergy.carbon_storage} ({GlossaryEnergy.mass_unit})', - f'{CO2.name} ({GlossaryEnergy.mass_unit})', f'{Carbon.name} ({GlossaryEnergy.mass_unit})'] ccs_list = [GlossaryEnergy.carbon_capture, GlossaryEnergy.carbon_storage] @@ -85,7 +83,7 @@ def configure_parameters(self, inputs_dict): BaseStream.configure_parameters(self, inputs_dict) self.co2_for_food = pd.DataFrame( - {GlossaryEnergy.Years: self.production[GlossaryEnergy.Years], f'{CO2.name} for food (Mt)': 0.0}) + {GlossaryEnergy.Years: self.production[GlossaryEnergy.Years], f'{GlossaryEnergy.carbon_capture} for food (Mt)': 0.0}) self.CCS_price = pd.DataFrame( {GlossaryEnergy.Years: np.arange(inputs_dict[GlossaryEnergy.YearStart], inputs_dict[GlossaryEnergy.YearEnd] + 1)}) @@ -193,7 +191,7 @@ def compute_CO2_emissions(self): self.co2_emissions_needed_by_energy_mix[ f'{GlossaryEnergy.carbon_capture} needed by energy mix (Gt)'] * 1e3 - \ self.co2_for_food[ - f'{CO2.name} for food (Mt)'] + f'{GlossaryEnergy.carbon_capture} for food (Mt)'] ''' Solid Carbon to be stored to limit the carbon solid storage @@ -349,37 +347,37 @@ def compute_grad_CO2_emissions(self, co2_emissions): i.e. for machinery or tractors ''' energy_producing_co2 = co2_production[[ - col for col in co2_production if col.endswith(f'{CO2.name} ({GlossaryEnergy.mass_unit})')]] + col for col in co2_production if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]] energy_producing_co2_list = [key.replace( - f' {CO2.name} ({GlossaryEnergy.mass_unit})', '') for key in energy_producing_co2] + f' {GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', '') for key in energy_producing_co2] if len(energy_producing_co2_list) != 0: for energy1 in energy_producing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} from energy mix (Mt) vs {energy1}#{CO2.name} ({GlossaryEnergy.mass_unit})#prod'] = np.ones(len_years) + f'{GlossaryEnergy.carbon_capture} from energy mix (Mt) vs {energy1}#{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})#prod'] = np.ones(len_years) - # self.total_co2_emissions[f'{CO2.name} from energy mix (Mt)'] = energy_producing_co2.sum( + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] = energy_producing_co2.sum( # axis=1).values # else: # self.total_co2_emissions[ - # f'{CO2.name} from energy mix (Mt)'] = 0.0 + # f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] = 0.0 ''' CO2 removed by energy mix CO2 removed by energy mix technologies during the process i.e. biomass processes as managed wood or crop energy ''' energy_removing_co2 = co2_consumption[[ - col for col in co2_consumption if col.endswith(f'{CO2.name} ({GlossaryEnergy.mass_unit})')]] + col for col in co2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]] energy_removing_co2_list = [key.replace( - f' {CO2.name} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] + f' {GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] if len(energy_removing_co2_list) != 0: for energy1 in energy_removing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} removed by energy mix (Mt) vs {energy1}#{CO2.name} ({GlossaryEnergy.mass_unit})#cons'] = np.ones(len_years) - # self.total_co2_emissions[f'{CO2.name} removed by energy mix (Mt)'] = energy_removing_co2.sum( + f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt) vs {energy1}#{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})#cons'] = np.ones(len_years) + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt)'] = energy_removing_co2.sum( # axis=1).values # else: # self.total_co2_emissions[ - # f'{CO2.name} removed energy mix (Mt)'] = 0.0 + # f'{GlossaryEnergy.carbon_capture} removed energy mix (Mt)'] = 0.0 ''' Total C02 from Flue gas sum of all production of flue gas @@ -403,10 +401,10 @@ def compute_grad_CO2_emissions(self, co2_emissions): # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} to be stored (Mt)'] = self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit}) from CC technos'] + \ # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] - \ # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} needed by energy mix (Mt)'] -\ - # self.total_co2_emissions[f'{CO2.name} for food (Mt)' + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} for food (Mt)' new_key = f'{GlossaryEnergy.carbon_capture} to be stored (Mt)' - dtot_CO2_emissions[f'{new_key} vs {CO2.name} for food (Mt)#carbon_capture'] = - np.ones( + dtot_CO2_emissions[f'{new_key} vs {GlossaryEnergy.carbon_capture} for food (Mt)#carbon_capture'] = - np.ones( len_years) dtot_CO2_emissions[f'{new_key} vs {GlossaryEnergy.carbon_capture} from energy mix (Mt)#carbon_capture'] = np.ones( len_years) @@ -415,7 +413,7 @@ def compute_grad_CO2_emissions(self, co2_emissions): key_dep_tuple_list = [(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit}) from CC technos', 1.0), (f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)', 1.0), (f'{GlossaryEnergy.carbon_capture} needed by energy mix (Mt)', -1.0), - (f'{CO2.name} for food (Mt)', -1.0)] + (f'{GlossaryEnergy.carbon_capture} for food (Mt)', -1.0)] dtot_CO2_emissions = update_new_gradient( dtot_CO2_emissions, key_dep_tuple_list, new_key) @@ -424,7 +422,7 @@ def compute_grad_CO2_emissions(self, co2_emissions): f'{GlossaryEnergy.carbon_capture} from energy mix (Gt)'].values * 1e3 - \ self.co2_emissions_needed_by_energy_mix[ f'{GlossaryEnergy.carbon_capture} needed by energy mix (Gt)'].values * 1e3 - \ - self.co2_for_food[f'{CO2.name} for food (Mt)'].values + self.co2_for_food[f'{GlossaryEnergy.carbon_capture} for food (Mt)'].values # if the carbon to be stored is lower than zero that means that we need # more carbon capture for energy mix than the one created by CC technos # or upgrading biogas diff --git a/energy_models/core/ccus/ccus_disc.py b/energy_models/core/ccus/ccus_disc.py index 46980fc9..452d5b71 100644 --- a/energy_models/core/ccus/ccus_disc.py +++ b/energy_models/core/ccus/ccus_disc.py @@ -31,7 +31,6 @@ from energy_models.core.ccus.ccus import CCUS from energy_models.core.energy_mix.energy_mix import EnergyMix from energy_models.core.stream_type.carbon_models.carbon_capture import CarbonCapture -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.glossaryenergy import GlossaryEnergy @@ -142,10 +141,10 @@ def setup_sos_disciplines(self): if year_start is not None and year_end is not None: dynamic_inputs['co2_for_food'] = { 'type': 'dataframe', 'unit': 'Mt', 'default': pd.DataFrame( - {GlossaryEnergy.Years: np.arange(year_start, year_end + 1), f'{CO2.name} for food (Mt)': 0.0}), + {GlossaryEnergy.Years: np.arange(year_start, year_end + 1), f'{GlossaryEnergy.carbon_capture} for food (Mt)': 0.0}), 'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_energy', 'dataframe_descriptor': {GlossaryEnergy.Years: ('float', None, True), - 'CO2_resource for food (Mt)': ('float', None, True), } + f'{GlossaryEnergy.carbon_capture} for food (Mt)': ('float', None, True), } } self.add_inputs(dynamic_inputs), @@ -276,10 +275,10 @@ def compute_sos_jacobian(self): self.set_partial_derivative_for_other_types( ('co2_emissions_ccus_Gt', co2_emission_column_upd), (f'{energy}.{GlossaryEnergy.CO2PerUse}', GlossaryEnergy.CO2PerUse), np.identity(len(years)) * value / 1.0e3) - elif energy_prod_info.startswith(f'{CO2.name} for food (Mt)'): + elif energy_prod_info.startswith(f'{GlossaryEnergy.carbon_capture} for food (Mt)'): self.set_partial_derivative_for_other_types( ('co2_emissions_ccus_Gt', co2_emission_column_upd), - ('co2_for_food', f'{CO2.name} for food (Mt)'), np.identity(len(years)) * value / 1.0e3) + ('co2_for_food', f'{GlossaryEnergy.carbon_capture} for food (Mt)'), np.identity(len(years)) * value / 1.0e3) elif energy_prod_info.startswith(f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'): self.set_partial_derivative_for_other_types( @@ -329,9 +328,9 @@ def compute_sos_jacobian(self): elif last_part_key == 'co2_per_use': self.set_partial_derivative_for_other_types( (EnergyMix.CARBON_STORAGE_CONSTRAINT,), (f'{energy}.{GlossaryEnergy.CO2PerUse}', GlossaryEnergy.CO2PerUse), value) - elif energy_prod_info.startswith(f'{CO2.name} for food (Mt)'): + elif energy_prod_info.startswith(f'{GlossaryEnergy.carbon_capture} for food (Mt)'): self.set_partial_derivative_for_other_types( - (EnergyMix.CARBON_STORAGE_CONSTRAINT,), ('co2_for_food', f'{CO2.name} for food (Mt)'), value) + (EnergyMix.CARBON_STORAGE_CONSTRAINT,), ('co2_for_food', f'{GlossaryEnergy.carbon_capture} for food (Mt)'), value) elif energy_prod_info.startswith(f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'): self.set_partial_derivative_for_other_types( @@ -480,7 +479,7 @@ def get_chart_co2_to_store(self): serie = InstanciatedSeries( x_serie_1, - (-co2_for_food[f'{CO2.name} for food (Mt)'].values / 1.0e3).tolist(), f'{CO2.name} used for food', 'bar') + (-co2_for_food[f'{GlossaryEnergy.carbon_capture} for food (Mt)'].values / 1.0e3).tolist(), f'{GlossaryEnergy.carbon_capture} used for food', 'bar') new_chart.add_series(serie) serie = InstanciatedSeries( @@ -548,7 +547,7 @@ def get_chart_co2_emissions_sources(self): serie = InstanciatedSeries( x_serie_1, - (co2_emissions[f'{CO2.name} from energy mix (Mt)'].values / 1.0e3).tolist(), + (co2_emissions[f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'].values / 1.0e3).tolist(), 'CO2 from energy mix (machinery fuels)') new_chart.add_series(serie) diff --git a/energy_models/core/consumption_CO2_emissions/consumption_CO2_emissions.py b/energy_models/core/consumption_CO2_emissions/consumption_CO2_emissions.py index 971ce2bf..58410117 100644 --- a/energy_models/core/consumption_CO2_emissions/consumption_CO2_emissions.py +++ b/energy_models/core/consumption_CO2_emissions/consumption_CO2_emissions.py @@ -21,7 +21,6 @@ from energy_models.core.stream_type.base_stream import BaseStream from energy_models.core.stream_type.carbon_models.carbon import Carbon from energy_models.core.stream_type.carbon_models.carbon_capture import CarbonCapture -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.glossaryenergy import GlossaryEnergy @@ -36,7 +35,7 @@ class ConsumptionCO2Emissions(BaseStream): CO2_list = [f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', f'{CarbonCapture.flue_gas_name} ({GlossaryEnergy.mass_unit})', f'{GlossaryEnergy.carbon_storage} ({GlossaryEnergy.mass_unit})', - f'{CO2.name} ({GlossaryEnergy.mass_unit})', + f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', f'{Carbon.name} ({GlossaryEnergy.mass_unit})'] def __init__(self, name): @@ -140,15 +139,15 @@ def compute_CO2_emissions(self): i.e. for machinery or tractors ''' energy_producing_co2 = self.CO2_production[[ - col for col in self.CO2_production if col.endswith(f'{CO2.name} ({GlossaryEnergy.mass_unit})')]] + col for col in self.CO2_production if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]] energy_producing_co2_list = [key.replace( - f' {CO2.name} ({GlossaryEnergy.mass_unit})', '') for key in energy_producing_co2] + f' {GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', '') for key in energy_producing_co2] if len(energy_producing_co2_list) != 0: - self.CO2_sources[f'{CO2.name} from energy mix (Mt)'] = energy_producing_co2.sum( + self.CO2_sources[f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] = energy_producing_co2.sum( axis=1).values else: self.CO2_sources[ - f'{CO2.name} from energy mix (Mt)'] = 0.0 + f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] = 0.0 ''' CARBON CAPTURE from energy mix Total carbon capture from energy mix if the technology offers carbon_capture @@ -172,15 +171,15 @@ def compute_CO2_emissions(self): i.e. biomass processes as managed wood or crop energy ''' energy_removing_co2 = self.CO2_consumption[[ - col for col in self.CO2_consumption if col.endswith(f'{CO2.name} ({GlossaryEnergy.mass_unit})')]] + col for col in self.CO2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]] energy_removing_co2_list = [key.replace( - f' {CO2.name} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] + f' {GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] if len(energy_removing_co2_list) != 0: - self.CO2_sinks[f'{CO2.name} removed by energy mix (Mt)'] = energy_removing_co2.sum( + self.CO2_sinks[f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt)'] = energy_removing_co2.sum( axis=1).values else: self.CO2_sinks[ - f'{CO2.name} removed by energy mix (Mt)'] = 0.0 + f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt)'] = 0.0 '''Total CO2 by use which is the sum of all CO2 emissions emitted by use of net energy production @@ -285,37 +284,37 @@ def compute_grad_CO2_emissions_sources(self, net_production): i.e. for machinery or tractors ''' energy_producing_co2 = co2_production[[ - col for col in co2_production if col.endswith(f'{CO2.name} ({GlossaryEnergy.mass_unit})')]] + col for col in co2_production if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]] energy_producing_co2_list = [key.replace( - f' {CO2.name} ({GlossaryEnergy.mass_unit})', '') for key in energy_producing_co2] + f' {GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', '') for key in energy_producing_co2] if len(energy_producing_co2_list) != 0: for energy1 in energy_producing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} from energy mix (Gt) vs {energy1}#{CO2.name} ({GlossaryEnergy.mass_unit})#prod'] = np.ones(len_years) + f'{GlossaryEnergy.carbon_capture} from energy mix (Gt) vs {energy1}#{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})#prod'] = np.ones(len_years) - # self.total_co2_emissions[f'{CO2.name} from energy mix (Mt)'] = energy_producing_co2.sum( + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] = energy_producing_co2.sum( # axis=1).values # else: # self.total_co2_emissions[ - # f'{CO2.name} from energy mix (Mt)'] = 0.0 + # f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] = 0.0 ''' CO2 removed by energy mix CO2 removed by energy mix technologies during the process i.e. biomass processes as managed wood or crop energy ''' energy_removing_co2 = co2_consumption[[ - col for col in co2_consumption if col.endswith(f'{CO2.name} ({GlossaryEnergy.mass_unit})')]] + col for col in co2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]] energy_removing_co2_list = [key.replace( - f' {CO2.name} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] + f' {GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] if len(energy_removing_co2_list) != 0: for energy1 in energy_removing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} removed by energy mix (Gt) vs {energy1}#{CO2.name} ({GlossaryEnergy.mass_unit})#cons'] = np.ones(len_years) - # self.total_co2_emissions[f'{CO2.name} removed by energy mix (Mt)'] = energy_removing_co2.sum( + f'{GlossaryEnergy.carbon_capture} removed by energy mix (Gt) vs {energy1}#{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})#cons'] = np.ones(len_years) + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt)'] = energy_removing_co2.sum( # axis=1).values # else: # self.total_co2_emissions[ - # f'{CO2.name} removed energy mix (Mt)'] = 0.0 + # f'{GlossaryEnergy.carbon_capture} removed energy mix (Mt)'] = 0.0 ''' Total C02 from Flue gas sum of all production of flue gas @@ -367,17 +366,17 @@ def compute_grad_CO2_emissions_sinks(self): i.e. biomass processes as managed wood or crop energy ''' energy_removing_co2 = co2_consumption[[ - col for col in co2_consumption if col.endswith(f'{CO2.name} ({GlossaryEnergy.mass_unit})')]] + col for col in co2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]] energy_removing_co2_list = [key.replace( - f' {CO2.name} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] + f' {GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] if len(energy_removing_co2_list) != 0: for energy1 in energy_removing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} removed by energy mix (Gt) vs {energy1}#{CO2.name} ({GlossaryEnergy.mass_unit})#cons'] = np.ones(len_years) - # self.total_co2_emissions[f'{CO2.name} removed by energy mix (Mt)'] = energy_removing_co2.sum( + f'{GlossaryEnergy.carbon_capture} removed by energy mix (Gt) vs {energy1}#{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})#cons'] = np.ones(len_years) + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt)'] = energy_removing_co2.sum( # axis=1).values # else: # self.total_co2_emissions[ - # f'{CO2.name} removed energy mix (Mt)'] = 0.0 + # f'{GlossaryEnergy.carbon_capture} removed energy mix (Mt)'] = 0.0 return dtot_CO2_emissions diff --git a/energy_models/core/energy_ghg_emissions/energy_ghg_emissions.py b/energy_models/core/energy_ghg_emissions/energy_ghg_emissions.py index fa1e9cab..4163410e 100644 --- a/energy_models/core/energy_ghg_emissions/energy_ghg_emissions.py +++ b/energy_models/core/energy_ghg_emissions/energy_ghg_emissions.py @@ -26,7 +26,6 @@ from energy_models.core.stream_type.base_stream import BaseStream from energy_models.core.stream_type.carbon_models.carbon import Carbon from energy_models.core.stream_type.carbon_models.carbon_capture import CarbonCapture -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.glossaryenergy import GlossaryEnergy @@ -42,7 +41,7 @@ class EnergyGHGEmissions(BaseStream): CO2_list = [f'{GlossaryEnergy.carbon_capture} {ghg_input_unit}', f'{CarbonCapture.flue_gas_name} {ghg_input_unit}', f'{GlossaryEnergy.carbon_storage} {ghg_input_unit}', - f'{CO2.name} {ghg_input_unit}', + f'{GlossaryEnergy.carbon_capture} {ghg_input_unit}', f'{Carbon.name} {ghg_input_unit}'] GHG_TYPE_LIST = GHGEmissions.GHG_TYPE_LIST @@ -177,15 +176,15 @@ def compute_other_co2_emissions(self): i.e. for machinery or tractors ''' energy_producing_co2 = self.ghg_production_dict[GlossaryEnergy.CO2][[ - col for col in self.ghg_production_dict[GlossaryEnergy.CO2] if col.endswith(f'{CO2.name} {self.ghg_input_unit}')]] + col for col in self.ghg_production_dict[GlossaryEnergy.CO2] if col.endswith(f'{GlossaryEnergy.carbon_capture} {self.ghg_input_unit}')]] energy_producing_co2_list = [key.replace( - f' {CO2.name} {self.ghg_input_unit}', '') for key in energy_producing_co2] + f' {GlossaryEnergy.carbon_capture} {self.ghg_input_unit}', '') for key in energy_producing_co2] if len(energy_producing_co2_list) != 0: - self.CO2_sources[f'{CO2.name} from energy mix {self.ghg_input_unit}'] = energy_producing_co2.sum( + self.CO2_sources[f'{GlossaryEnergy.carbon_capture} from energy mix {self.ghg_input_unit}'] = energy_producing_co2.sum( axis=1).values else: self.CO2_sources[ - f'{CO2.name} from energy mix {self.ghg_input_unit}'] = 0.0 + f'{GlossaryEnergy.carbon_capture} from energy mix {self.ghg_input_unit}'] = 0.0 ''' CARBON CAPTURE from energy mix Total carbon capture from energy mix if the technology offers carbon_capture @@ -211,15 +210,15 @@ def compute_other_co2_emissions(self): i.e. biomass processes as managed wood or crop energy ''' energy_removing_co2 = self.CO2_consumption[[ - col for col in self.CO2_consumption if col.endswith(f'{CO2.name} {self.ghg_input_unit}')]] + col for col in self.CO2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} {self.ghg_input_unit}')]] energy_removing_co2_list = [key.replace( - f' {CO2.name} {self.ghg_input_unit}', '') for key in energy_removing_co2] + f' {GlossaryEnergy.carbon_capture} {self.ghg_input_unit}', '') for key in energy_removing_co2] if len(energy_removing_co2_list) != 0: - self.CO2_sinks[f'{CO2.name} removed by energy mix {self.ghg_input_unit}'] = energy_removing_co2.sum( + self.CO2_sinks[f'{GlossaryEnergy.carbon_capture} removed by energy mix {self.ghg_input_unit}'] = energy_removing_co2.sum( axis=1).values else: self.CO2_sinks[ - f'{CO2.name} removed by energy mix {self.ghg_input_unit}'] = 0.0 + f'{GlossaryEnergy.carbon_capture} removed by energy mix {self.ghg_input_unit}'] = 0.0 ''' Total C02 from Flue gas sum of all production of flue gas @@ -411,39 +410,39 @@ def compute_grad_CO2_emissions_sources(self, net_production): i.e. for machinery or tractors ''' energy_producing_co2 = co2_production[[ - col for col in co2_production if col.endswith(f'{CO2.name} {self.ghg_input_unit}')]] + col for col in co2_production if col.endswith(f'{GlossaryEnergy.carbon_capture} {self.ghg_input_unit}')]] energy_producing_co2_list = [key.replace( - f' {CO2.name} {self.ghg_input_unit}', '') for key in energy_producing_co2] + f' {GlossaryEnergy.carbon_capture} {self.ghg_input_unit}', '') for key in energy_producing_co2] if len(energy_producing_co2_list) != 0: for energy1 in energy_producing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} from energy mix (Mt) vs {energy1}#{CO2.name} {self.ghg_input_unit}#prod'] = np.ones( + f'{GlossaryEnergy.carbon_capture} from energy mix (Mt) vs {energy1}#{GlossaryEnergy.carbon_capture} {self.ghg_input_unit}#prod'] = np.ones( len_years) - # self.total_co2_emissions[f'{CO2.name} from energy mix {self.ghg_input_unit}'] = energy_producing_co2.sum( + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} from energy mix {self.ghg_input_unit}'] = energy_producing_co2.sum( # axis=1).values # else: # self.total_co2_emissions[ - # f'{CO2.name} from energy mix {self.ghg_input_unit}'] = 0.0 + # f'{GlossaryEnergy.carbon_capture} from energy mix {self.ghg_input_unit}'] = 0.0 ''' CO2 removed by energy mix CO2 removed by energy mix technologies during the process i.e. biomass processes as managed wood or crop energy ''' energy_removing_co2 = co2_consumption[[ - col for col in co2_consumption if col.endswith(f'{CO2.name} {self.ghg_input_unit}')]] + col for col in co2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} {self.ghg_input_unit}')]] energy_removing_co2_list = [key.replace( - f' {CO2.name} {self.ghg_input_unit}', '') for key in energy_removing_co2] + f' {GlossaryEnergy.carbon_capture} {self.ghg_input_unit}', '') for key in energy_removing_co2] if len(energy_removing_co2_list) != 0: for energy1 in energy_removing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} removed by energy mix (Mt) vs {energy1}#{CO2.name} {self.ghg_input_unit}#cons'] = np.ones( + f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt) vs {energy1}#{GlossaryEnergy.carbon_capture} {self.ghg_input_unit}#cons'] = np.ones( len_years) - # self.total_co2_emissions[f'{CO2.name} removed by energy mix {self.ghg_input_unit}'] = energy_removing_co2.sum( + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} removed by energy mix {self.ghg_input_unit}'] = energy_removing_co2.sum( # axis=1).values # else: # self.total_co2_emissions[ - # f'{CO2.name} removed energy mix {self.ghg_input_unit}'] = 0.0 + # f'{GlossaryEnergy.carbon_capture} removed energy mix {self.ghg_input_unit}'] = 0.0 ''' Total C02 from Flue gas sum of all production of flue gas @@ -496,13 +495,13 @@ def compute_grad_CO2_emissions_sinks(self): i.e. biomass processes as managed wood or crop energy ''' energy_removing_co2 = co2_consumption[[ - col for col in co2_consumption if col.endswith(f'{CO2.name} {self.ghg_input_unit}')]] + col for col in co2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} {self.ghg_input_unit}')]] energy_removing_co2_list = [key.replace( - f' {CO2.name} {self.ghg_input_unit}', '') for key in energy_removing_co2] + f' {GlossaryEnergy.carbon_capture} {self.ghg_input_unit}', '') for key in energy_removing_co2] if len(energy_removing_co2_list) != 0: for energy1 in energy_removing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} removed by energy mix (Mt) vs {energy1}#{CO2.name} {self.ghg_input_unit}#cons'] = np.ones( + f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt) vs {energy1}#{GlossaryEnergy.carbon_capture} {self.ghg_input_unit}#cons'] = np.ones( len_years) return dtot_CO2_emissions diff --git a/energy_models/core/energy_mix/energy_mix.py b/energy_models/core/energy_mix/energy_mix.py index f0b2acbc..5e19c5fb 100644 --- a/energy_models/core/energy_mix/energy_mix.py +++ b/energy_models/core/energy_mix/energy_mix.py @@ -30,7 +30,6 @@ from energy_models.core.stream_type.base_stream import BaseStream from energy_models.core.stream_type.carbon_models.carbon import Carbon from energy_models.core.stream_type.carbon_models.carbon_capture import CarbonCapture -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.core.stream_type.carbon_models.carbon_storage import CarbonStorage from energy_models.core.stream_type.energy_models.biodiesel import BioDiesel from energy_models.core.stream_type.energy_models.biogas import BioGas @@ -116,7 +115,7 @@ class EnergyMix(BaseStream): CO2_list = [f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', f'{CarbonCapture.flue_gas_name} ({GlossaryEnergy.mass_unit})', f'{GlossaryEnergy.carbon_storage} ({GlossaryEnergy.mass_unit})', - f'{CO2.name} ({GlossaryEnergy.mass_unit})', + f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', f'{Carbon.name} ({GlossaryEnergy.mass_unit})'] solidFuel_name = SolidFuel.name electricity_name = GlossaryEnergy.electricity @@ -234,7 +233,7 @@ def configure_parameters(self, inputs_dict): self.co2_for_food = pd.DataFrame( {GlossaryEnergy.Years: np.arange(inputs_dict[GlossaryEnergy.YearStart], inputs_dict[GlossaryEnergy.YearEnd] + 1), - f'{CO2.name} for food (Mt)': 0.0}) + f'{GlossaryEnergy.carbon_capture} for food (Mt)': 0.0}) self.ratio_norm_value = inputs_dict['ratio_ref'] self.heat_losses_percentage = inputs_dict['heat_losses_percentage'] @@ -903,37 +902,37 @@ def compute_grad_CO2_emissions(self): i.e. for machinery or tractors ''' energy_producing_co2 = co2_production[[ - col for col in co2_production if col.endswith(f'{CO2.name} ({GlossaryEnergy.mass_unit})')]] + col for col in co2_production if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]] energy_producing_co2_list = [key.replace( - f' {CO2.name} ({GlossaryEnergy.mass_unit})', '') for key in energy_producing_co2] + f' {GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', '') for key in energy_producing_co2] if len(energy_producing_co2_list) != 0: for energy1 in energy_producing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} from energy mix (Mt) vs {energy1}#{CO2.name} ({GlossaryEnergy.mass_unit})#prod'] = np.ones(len_years) + f'{GlossaryEnergy.carbon_capture} from energy mix (Mt) vs {energy1}#{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})#prod'] = np.ones(len_years) - # self.total_co2_emissions[f'{CO2.name} from energy mix (Mt)'] = energy_producing_co2.sum( + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] = energy_producing_co2.sum( # axis=1).values # else: # self.total_co2_emissions[ - # f'{CO2.name} from energy mix (Mt)'] = 0.0 + # f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] = 0.0 ''' CO2 removed by energy mix CO2 removed by energy mix technologies during the process i.e. biomass processes as managed wood or crop energy ''' energy_removing_co2 = co2_consumption[[ - col for col in co2_consumption if col.endswith(f'{CO2.name} ({GlossaryEnergy.mass_unit})')]] + col for col in co2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]] energy_removing_co2_list = [key.replace( - f' {CO2.name} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] + f' {GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})', '') for key in energy_removing_co2] if len(energy_removing_co2_list) != 0: for energy1 in energy_removing_co2_list: dtot_CO2_emissions[ - f'{CO2.name} removed by energy mix (Mt) vs {energy1}#{CO2.name} ({GlossaryEnergy.mass_unit})#cons'] = np.ones(len_years) - # self.total_co2_emissions[f'{CO2.name} removed by energy mix (Mt)'] = energy_removing_co2.sum( + f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt) vs {energy1}#{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})#cons'] = np.ones(len_years) + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} removed by energy mix (Mt)'] = energy_removing_co2.sum( # axis=1).values # else: # self.total_co2_emissions[ - # f'{CO2.name} removed energy mix (Mt)'] = 0.0 + # f'{GlossaryEnergy.carbon_capture} removed energy mix (Mt)'] = 0.0 ''' Total C02 from Flue gas sum of all production of flue gas @@ -957,7 +956,7 @@ def compute_grad_CO2_emissions(self): # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} to be stored (Mt)'] = self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit}) from CC technos'] + \ # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] - \ # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} needed by energy mix (Mt)'] -\ - # self.total_co2_emissions[f'{CO2.name} for food (Mt)' + # self.total_co2_emissions[f'{GlossaryEnergy.carbon_capture} for food (Mt)' new_key = f'{GlossaryEnergy.carbon_capture} to be stored (Mt)' key_dep_tuple_list = [(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit}) from CC technos', 1.0), diff --git a/energy_models/core/energy_mix/energy_mix_disc.py b/energy_models/core/energy_mix/energy_mix_disc.py index 18e37aef..dbe98b05 100644 --- a/energy_models/core/energy_mix/energy_mix_disc.py +++ b/energy_models/core/energy_mix/energy_mix_disc.py @@ -51,7 +51,6 @@ from energy_models.core.energy_mix.energy_mix import EnergyMix from energy_models.core.stream_type.carbon_models.carbon_capture import CarbonCapture -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.core.stream_type.energy_models.biomass_dry import BiomassDry from energy_models.core.stream_type.energy_models.gaseous_hydrogen import ( GaseousHydrogen, @@ -1812,7 +1811,7 @@ def get_chart_co2_to_store(self): serie = InstanciatedSeries( x_serie_1, - (-co2_emissions[f'{CO2.name} for food (Mt)'].values / 1.0e3).tolist(), f'{CO2.name} used for food', 'bar') + (-co2_emissions[f'{GlossaryEnergy.carbon_capture} for food (Mt)'].values / 1.0e3).tolist(), f'{GlossaryEnergy.carbon_capture} used for food', 'bar') new_chart.add_series(serie) serie = InstanciatedSeries( @@ -1880,7 +1879,7 @@ def get_chart_co2_emissions_sources(self): serie = InstanciatedSeries( x_serie_1, - (co2_emissions[f'{CO2.name} from energy mix (Mt)'].values / 1.0e3).tolist(), + (co2_emissions[f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'].values / 1.0e3).tolist(), 'CO2 from energy mix (machinery fuels)') new_chart.add_series(serie) diff --git a/energy_models/core/stream_type/resources_data_disc.py b/energy_models/core/stream_type/resources_data_disc.py index 516eadac..83b5a374 100644 --- a/energy_models/core/stream_type/resources_data_disc.py +++ b/energy_models/core/stream_type/resources_data_disc.py @@ -40,7 +40,7 @@ def get_default_resources_CO2_emissions(years): resources_CO2_emissions_dict.update({ResourceGlossary.GlossaryDict[resource]['name']: ResourceGlossary.GlossaryDict[resource][GlossaryEnergy.CO2EmissionsValue] for resource in ResourceGlossary.GlossaryDict.keys()}) - resources_CO2_emissions_dict[GlossaryEnergy.SolidCarbon] = resources_CO2_emissions_dict[GlossaryEnergy.CO2Resource] + resources_CO2_emissions_dict[GlossaryEnergy.SolidCarbon] = 0. return pd.DataFrame(resources_CO2_emissions_dict) @@ -60,7 +60,7 @@ def get_default_resources_prices(years): {ResourceGlossary.GlossaryDict[resource]['name']: ResourceGlossary.GlossaryDict[resource]['price'] for resource in ResourceGlossary.GlossaryDict.keys()}) - resources_prices_default_dict[GlossaryEnergy.SolidCarbon] = resources_prices_default_dict[GlossaryEnergy.CO2Resource] + resources_prices_default_dict[GlossaryEnergy.SolidCarbon] = 0. return pd.DataFrame(resources_prices_default_dict) diff --git a/energy_models/core/techno_type/techno_disc.py b/energy_models/core/techno_type/techno_disc.py index 10b9d162..96caa7d7 100644 --- a/energy_models/core/techno_type/techno_disc.py +++ b/energy_models/core/techno_type/techno_disc.py @@ -76,11 +76,11 @@ class TechnoDiscipline(SoSWrapp): 'possible_values': ['smooth_max', 'soft_max', 'cons_smooth_max'], 'user_level': 2, 'structuring': False, 'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_public'}, - 'is_apply_ratio': {'type': 'bool', 'default': True, 'user_level': 2, 'structuring': True, + GlossaryEnergy.BoolApplyRatio: {'type': 'bool', 'default': True, 'user_level': 2, 'structuring': True, 'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_public'}, - 'is_stream_demand': {'type': 'bool', 'default': True, 'user_level': 2, 'structuring': True, + GlossaryEnergy.BoolApplyStreamRatio: {'type': 'bool', 'default': True, 'user_level': 2, 'structuring': True, 'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_public'}, - 'is_apply_resource_ratio': {'type': 'bool', 'default': False, 'user_level': 2, 'structuring': True, + GlossaryEnergy.BoolApplyResourceRatio: {'type': 'bool', 'default': False, 'user_level': 2, 'structuring': True, 'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_public'}, GlossaryEnergy.ResourcesUsedForProductionValue: GlossaryEnergy.ResourcesUsedForProduction, GlossaryEnergy.ResourcesUsedForBuildingValue: GlossaryEnergy.ResourcesUsedForBuilding, @@ -167,10 +167,10 @@ def setup_sos_disciplines(self): GlossaryEnergy.StreamsCO2EmissionsValue: GlossaryEnergy.get_stream_co2_emissions_df(stream_used_for_production=streams_used_for_production) }) - if 'is_apply_ratio' in self.get_data_in(): + if GlossaryEnergy.BoolApplyRatio in self.get_data_in(): year_start, year_end = self.get_sosdisc_inputs([GlossaryEnergy.YearStart, GlossaryEnergy.YearEnd]) years = np.arange(year_start, year_end + 1) - if self.get_sosdisc_inputs('is_stream_demand'): + if self.get_sosdisc_inputs(GlossaryEnergy.BoolApplyStreamRatio): demand_ratio_dict = dict( zip(EnergyMix.energy_list, np.linspace(1.0, 1.0, len(years)) * 100.0)) demand_ratio_dict[GlossaryEnergy.Years] = years @@ -182,7 +182,7 @@ def setup_sos_disciplines(self): 'namespace': 'ns_energy', "dynamic_dataframe_columns": True } - if self.get_sosdisc_inputs('is_apply_resource_ratio'): + if self.get_sosdisc_inputs(GlossaryEnergy.BoolApplyResourceRatio): resource_ratio_dict = dict( zip(EnergyMix.RESOURCE_LIST, np.ones(len(years)) * 100.0)) resource_ratio_dict[GlossaryEnergy.Years] = years @@ -359,7 +359,7 @@ def compute_sos_jacobian(self): # ---Gradient main techno prod vs each ratio dapplied_ratio_dratio = self.techno_model.compute_dapplied_ratio_dratios( - inputs_dict['is_apply_ratio']) + inputs_dict[GlossaryEnergy.BoolApplyRatio]) self.dprod_dratio = {} if GlossaryEnergy.AllStreamsDemandRatioValue in inputs_dict.keys(): for ratio_name in inputs_dict[GlossaryEnergy.AllStreamsDemandRatioValue].columns: @@ -705,7 +705,7 @@ def get_chart_filter_list(self): GlossaryEnergy.UtilisationRatioValue, 'Non-Use Capital', 'Power production'] - if self.get_sosdisc_inputs('is_apply_ratio'): + if self.get_sosdisc_inputs(GlossaryEnergy.BoolApplyRatio): chart_list.extend(['Applied Ratio']) chart_filters.append(ChartFilter( 'Charts', chart_list, chart_list, 'charts')) diff --git a/energy_models/core/techno_type/techno_type.py b/energy_models/core/techno_type/techno_type.py index b9f2c821..994093f1 100644 --- a/energy_models/core/techno_type/techno_type.py +++ b/energy_models/core/techno_type/techno_type.py @@ -63,13 +63,12 @@ def __init__(self, name): self.margin = None self.maturity = None self.invest_before_ystart = None - self.is_apply_resource_ratio = None self.ratio_available_resource = None self.CO2_taxes = None self.resources_prices = None self.invest_level = None self.production_detailed = None - self.is_apply_resource_ratio = None + self.apply_resource_ratio = None self.ratio_available_resource = None self.transport_cost = None self.transport_margin = None @@ -110,9 +109,9 @@ def __init__(self, name): self.scaling_factor_techno_consumption = None # self.product_unit_billion = 'TWh' self.all_streams_demand_ratio = None - self.is_stream_demand = False + self.apply_ratio = False + self.apply_stream_ratio = False self.is_resource_ratio = False - self.is_applied_resource_ratios = None self.smooth_type = None self.ratio_df = None self.non_use_capital = None @@ -179,12 +178,13 @@ def configure_parameters(self, inputs_dict): self.scaling_factor_techno_consumption = inputs_dict['scaling_factor_techno_consumption'] self.scaling_factor_techno_production = inputs_dict['scaling_factor_techno_production'] - self.is_stream_demand = inputs_dict['is_stream_demand'] - self.is_apply_resource_ratio = inputs_dict['is_apply_resource_ratio'] + self.apply_ratio = inputs_dict[GlossaryEnergy.BoolApplyRatio] + self.apply_stream_ratio = inputs_dict[GlossaryEnergy.BoolApplyStreamRatio] + self.apply_resource_ratio = inputs_dict[GlossaryEnergy.BoolApplyResourceRatio] self.smooth_type = inputs_dict['smooth_type'] - if self.is_stream_demand: + if self.apply_stream_ratio: self.all_streams_demand_ratio = inputs_dict[GlossaryEnergy.AllStreamsDemandRatioValue] - if self.is_apply_resource_ratio: + if self.apply_resource_ratio: self.ratio_available_resource = inputs_dict[ResourceMixModel.RATIO_USABLE_DEMAND] if inputs_dict[GlossaryEnergy.UtilisationRatioValue] is not None: @@ -222,14 +222,14 @@ def configure_parameters_update(self, inputs_dict): self.production_detailed = pd.DataFrame({GlossaryEnergy.Years: self.years}) self.installed_power = pd.DataFrame({GlossaryEnergy.Years: self.years}) self.ratio_df = pd.DataFrame({GlossaryEnergy.Years: self.years}) - self.is_stream_demand = inputs_dict['is_stream_demand'] - self.is_apply_resource_ratio = inputs_dict['is_apply_resource_ratio'] + self.apply_stream_ratio = inputs_dict[GlossaryEnergy.BoolApplyStreamRatio] + self.apply_resource_ratio = inputs_dict[GlossaryEnergy.BoolApplyResourceRatio] self.smooth_type = inputs_dict['smooth_type'] - if self.is_stream_demand: + if self.apply_stream_ratio: self.all_streams_demand_ratio = inputs_dict[GlossaryEnergy.AllStreamsDemandRatioValue].loc[ inputs_dict[GlossaryEnergy.AllStreamsDemandRatioValue][GlossaryEnergy.Years] <= self.year_end] - if self.is_apply_resource_ratio: + if self.apply_resource_ratio: self.ratio_available_resource = inputs_dict[ResourceMixModel.RATIO_USABLE_DEMAND] self.utilisation_ratio = inputs_dict[GlossaryEnergy.UtilisationRatioValue][ @@ -267,11 +267,11 @@ def select_resources_ratios(self): This function is to be overloaded in specific techno_models """ ratio_df = pd.DataFrame() - if self.is_stream_demand: + if self.apply_stream_ratio: ratio_df = pd.concat( [ratio_df, self.all_streams_demand_ratio], ignore_index=True) - if self.is_apply_resource_ratio: + if self.apply_resource_ratio: for resource in EnergyMix.RESOURCE_LIST: ratio_df[resource] = self.ratio_available_resource[resource].values for col in ratio_df.columns: @@ -1193,7 +1193,7 @@ def compute(self, inputs_dict): self.store_consumption_and_production_and_landuse_wo_ratios() self.apply_utilisation_ratio() self.select_resources_ratios() - self.apply_resources_ratios(inputs_dict['is_apply_ratio']) + self.apply_resources_ratios(self.apply_ratio) self.compute_capital() self.get_mean_age_over_years() diff --git a/energy_models/glossaryenergy.py b/energy_models/glossaryenergy.py index e3cd43e3..c749ec60 100644 --- a/energy_models/glossaryenergy.py +++ b/energy_models/glossaryenergy.py @@ -118,6 +118,9 @@ class GlossaryEnergy(GlossaryWitnessCore): Transesterification = "Transesterification" AnaerobicDigestion = "AnaerobicDigestion" + BoolApplyRatio = "is_apply_ratio" + BoolApplyStreamRatio = "is_stream_demand" + BoolApplyResourceRatio = "is_apply_resource_ratio" AllStreamsDemandRatioValue = "all_streams_demand_ratio" FlueGasMean = "flue_gas_mean" MarginValue = "margin" @@ -973,7 +976,7 @@ class GlossaryEnergy(GlossaryWitnessCore): HefaDeoxygenation: [WaterResource], Transesterification: [GlycerolResource], BiomassFermentation: [carbon_capture], - CoalExtraction: [GlossaryWitnessCore.CH4, CO2Resource], + CoalExtraction: [GlossaryWitnessCore.CH4, carbon_capture], Pelletizing: [CO2FromFlueGas], SolarThermal: [f"{heat}.{hightemperatureheat}"], Nuclear: [f"{heat}.{hightemperatureheat}"], @@ -1045,7 +1048,7 @@ class GlossaryEnergy(GlossaryWitnessCore): CarbonStorageTechno: [], CO2Hydrogenation: [], ManagedWood: [], - UnmanagedWood: [CO2Resource], + UnmanagedWood: [carbon_capture], CropEnergy: [], Reforestation: [], Geothermal: [], @@ -1107,7 +1110,7 @@ class GlossaryEnergy(GlossaryWitnessCore): Refinery: [f"{hydrogen}.{gaseous_hydrogen}", electricity], # idea : creer une techno puit de pétrole (CrudeOil) HydrogenLiquefaction: [f"{hydrogen}.{gaseous_hydrogen}", electricity], # might need some heat ? produced or consumed, not clear FossilGas: [electricity], # "transport fuel" - Methanation: [f"{hydrogen}.{gaseous_hydrogen}"], # consumed CO2 (which can come from carbon_capture) + Methanation: [f"{hydrogen}.{gaseous_hydrogen}", carbon_capture], UpgradingBiogas: [electricity, biogas], # heat not electricity CO2Hydrogenation: [ f"{hydrogen}.{gaseous_hydrogen}", @@ -1116,9 +1119,9 @@ class GlossaryEnergy(GlossaryWitnessCore): ], CoalExtraction: [electricity], # transport fuel instead of electricity Pelletizing: [electricity, biomass_dry], # might be heat instead of electricity - AutothermalReforming: [methane], # add heat + AutothermalReforming: [methane, carbon_capture], # add heat BiomassGasification: [electricity, biomass_dry], # heat instead of electricity, produce syngas - CoElectrolysis: [electricity], # consumed CO2 (which can come from carbon_capture) + CoElectrolysis: [electricity, carbon_capture], CoalGasification: [solid_fuel], # add heat ReversedWaterGasShift: [electricity, syngas], # heat instead of electricity, CO2 instead of carbon_capture SMR: [electricity, methane], # heat instead of elec @@ -1132,6 +1135,7 @@ class GlossaryEnergy(GlossaryWitnessCore): EnhancedOilRecovery: [carbon_capture], # add transport fuel GeologicMineralization: [carbon_capture], # add transport fuel CarbonStorageTechno: [carbon_capture], + CropEnergy: [carbon_capture], } # dict of resources used by technos @@ -1157,11 +1161,10 @@ class GlossaryEnergy(GlossaryWitnessCore): ElectrolysisSOEC: [WaterResource], Refinery: [OilResource], FossilGas: [NaturalGasResource], - Methanation: [CO2Resource], CO2Hydrogenation: [WaterResource], CoalExtraction: [CoalResource], - AutothermalReforming: [CO2Resource, OxygenResource], - CoElectrolysis: [CO2Resource, WaterResource], + AutothermalReforming: [OxygenResource], + CoElectrolysis: [WaterResource], Pyrolysis: [WoodResource], WaterGasShift: [WaterResource], ReversedWaterGasShift: [CO2Resource], @@ -1169,7 +1172,6 @@ class GlossaryEnergy(GlossaryWitnessCore): HefaDecarboxylation: [NaturalOilResource], HefaDeoxygenation: [NaturalOilResource], BiomassGasification: [WaterResource], - CropEnergy: [CO2Resource], UpgradingBiogas: [MonoEthanolAmineResource], PureCarbonSolidStorage: [SolidCarbon], # note : could be a stream but we prefered to let it as a resource for the moment } diff --git a/energy_models/models/biomass_dry/crop_energy/crop_energy.py b/energy_models/models/biomass_dry/crop_energy/crop_energy.py index 695c358e..84c98a6d 100644 --- a/energy_models/models/biomass_dry/crop_energy/crop_energy.py +++ b/energy_models/models/biomass_dry/crop_energy/crop_energy.py @@ -20,7 +20,6 @@ import numpy as np import pandas as pd -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.core.techno_type.base_techno_models.biomass_dry_techno import ( BiomassDryTechno, ) @@ -189,4 +188,4 @@ def compute_dlanduse_dinvest(self): return dlanduse_dinvest def compute_resources_needs(self): - self.cost_details[f'{CO2.name}_needs'] = -self.techno_infos_dict['CO2_from_production'] / self.data_energy_dict['high_calorific_value'] \ No newline at end of file + self.cost_details[f'{GlossaryEnergy.carbon_capture}_needs'] = -self.techno_infos_dict['CO2_from_production'] / self.data_energy_dict['high_calorific_value'] \ No newline at end of file diff --git a/energy_models/models/biomass_dry/crop_energy/crop_energy_disc.py b/energy_models/models/biomass_dry/crop_energy/crop_energy_disc.py index 6062c103..5fb21dfc 100644 --- a/energy_models/models/biomass_dry/crop_energy/crop_energy_disc.py +++ b/energy_models/models/biomass_dry/crop_energy/crop_energy_disc.py @@ -22,7 +22,6 @@ TwoAxesInstanciatedChart, ) -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.core.techno_type.disciplines.biomass_dry_techno_disc import ( BiomassDryTechnoDiscipline, ) @@ -201,11 +200,11 @@ def compute_sos_jacobian(self): (CropEnergy.LAND_SURFACE_FOR_FOOD_DF, 'Agriculture total (Gha)'), d_prod_dland_for_food / scaling_factor_techno_production) self.set_partial_derivative_for_other_types( - (GlossaryEnergy.TechnoConsumptionValue, f'{CO2.name} ({GlossaryEnergy.mass_unit})'), + (GlossaryEnergy.TechnoConsumptionValue, f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})'), (CropEnergy.LAND_SURFACE_FOR_FOOD_DF, 'Agriculture total (Gha)'), d_conso_dland_for_food / scaling_factor_techno_consumption) self.set_partial_derivative_for_other_types( - (GlossaryEnergy.TechnoConsumptionWithoutRatioValue, f'{CO2.name} ({GlossaryEnergy.mass_unit})'), + (GlossaryEnergy.TechnoConsumptionWithoutRatioValue, f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})'), (CropEnergy.LAND_SURFACE_FOR_FOOD_DF, 'Agriculture total (Gha)'), d_conso_dland_for_food / scaling_factor_techno_consumption) self.set_partial_derivative_for_other_types( diff --git a/energy_models/models/biomass_dry/unmanaged_wood/unmanaged_wood.py b/energy_models/models/biomass_dry/unmanaged_wood/unmanaged_wood.py index fc5b3033..5142b3ee 100644 --- a/energy_models/models/biomass_dry/unmanaged_wood/unmanaged_wood.py +++ b/energy_models/models/biomass_dry/unmanaged_wood/unmanaged_wood.py @@ -19,7 +19,6 @@ import numpy as np import pandas as pd -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.core.techno_type.base_techno_models.biomass_dry_techno import ( BiomassDryTechno, ) @@ -143,7 +142,7 @@ def compute_byproducts_production(self): name_residue] + \ self.production_mix[ name_wood] - self.production_detailed[f'{CO2.name} ({GlossaryEnergy.mass_unit})'] = self.techno_infos_dict['CO2_from_production'] / \ + self.production_detailed[f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})'] = self.techno_infos_dict['CO2_from_production'] / \ self.data_energy_dict['high_calorific_value'] * \ self.production_detailed[ f'{BiomassDryTechno.energy_name} ({self.product_unit})'] diff --git a/energy_models/models/liquid_fuel/fischer_tropsch/fischer_tropsch.py b/energy_models/models/liquid_fuel/fischer_tropsch/fischer_tropsch.py index 7ee3fb50..78f09104 100644 --- a/energy_models/models/liquid_fuel/fischer_tropsch/fischer_tropsch.py +++ b/energy_models/models/liquid_fuel/fischer_tropsch/fischer_tropsch.py @@ -96,7 +96,7 @@ def select_resources_ratios(self): """! Select the ratios to be added to ratio_df """ ratio_df = LiquidFuelTechno.select_resources_ratios(self) - if GlossaryEnergy.carbon_capture in ratio_df.columns and self.is_stream_demand: + if GlossaryEnergy.carbon_capture in ratio_df.columns and self.apply_stream_ratio: ratio_df[GlossaryEnergy.carbon_capture] = ratio_df[GlossaryEnergy.carbon_capture].values else: ratio_df[GlossaryEnergy.carbon_capture] = np.ones(len(self.years)) @@ -400,16 +400,17 @@ def compute_rwgs_contribution(self, sg_ratio): 'scaling_factor_techno_consumption': self.scaling_factor_techno_consumption, 'scaling_factor_techno_production': self.scaling_factor_techno_production, 'smooth_type': self.smooth_type, - 'is_stream_demand': self.is_stream_demand, - 'is_apply_resource_ratio': self.is_apply_resource_ratio, + GlossaryEnergy.BoolApplyRatio: self.apply_ratio, + GlossaryEnergy.BoolApplyStreamRatio: self.apply_stream_ratio, + GlossaryEnergy.BoolApplyResourceRatio: self.apply_resource_ratio, 'data_fuel_dict': self.syngas_energy_dict, GlossaryEnergy.ResourcesUsedForProductionValue: GlossaryEnergy.TechnoResourceUsedDict[GlossaryEnergy.ReversedWaterGasShift], GlossaryEnergy.ResourcesUsedForBuildingValue: GlossaryEnergy.TechnoBuildingResourceDict[GlossaryEnergy.ReversedWaterGasShift] if GlossaryEnergy.ReversedWaterGasShift in GlossaryEnergy.TechnoBuildingResourceDict else [], GlossaryEnergy.StreamsUsedForProductionValue: GlossaryEnergy.TechnoStreamsUsedDict[GlossaryEnergy.ReversedWaterGasShift], } - if self.is_stream_demand: + if self.apply_stream_ratio: inputs_dict[GlossaryEnergy.AllStreamsDemandRatioValue] = self.all_streams_demand_ratio - if self.is_apply_resource_ratio: + if self.apply_resource_ratio: inputs_dict[ResourceMixModel.RATIO_USABLE_DEMAND] = self.ratio_available_resource self.syngas_ratio_techno = RWGS('RWGS') @@ -457,16 +458,17 @@ def compute_wgs_contribution(self, sg_ratio): 'scaling_factor_techno_consumption': self.scaling_factor_techno_consumption, 'scaling_factor_techno_production': self.scaling_factor_techno_production, 'smooth_type': self.smooth_type, - 'is_stream_demand': self.is_stream_demand, - 'is_apply_resource_ratio': self.is_apply_resource_ratio, + GlossaryEnergy.BoolApplyRatio: self.apply_ratio, + GlossaryEnergy.BoolApplyStreamRatio: self.apply_stream_ratio, + GlossaryEnergy.BoolApplyResourceRatio: self.apply_resource_ratio, 'data_fuel_dict': self.gaseous_hydrogen_energy_dict, GlossaryEnergy.ResourcesUsedForProductionValue: GlossaryEnergy.TechnoResourceUsedDict[GlossaryEnergy.WaterGasShift], GlossaryEnergy.ResourcesUsedForBuildingValue: GlossaryEnergy.TechnoBuildingResourceDict[GlossaryEnergy.WaterGasShift] if GlossaryEnergy.WaterGasShift in GlossaryEnergy.TechnoBuildingResourceDict else [], GlossaryEnergy.StreamsUsedForProductionValue: GlossaryEnergy.TechnoStreamsUsedDict[GlossaryEnergy.WaterGasShift], } - if self.is_stream_demand: + if self.apply_stream_ratio: inputs_dict[GlossaryEnergy.AllStreamsDemandRatioValue] = self.all_streams_demand_ratio - if self.is_apply_resource_ratio: + if self.apply_resource_ratio: inputs_dict[ResourceMixModel.RATIO_USABLE_DEMAND] = self.ratio_available_resource self.syngas_ratio_techno = WGS('WGS') diff --git a/energy_models/models/methane/methanation/methanation.py b/energy_models/models/methane/methanation/methanation.py index bef735c0..0055f4d8 100644 --- a/energy_models/models/methane/methanation/methanation.py +++ b/energy_models/models/methane/methanation/methanation.py @@ -31,7 +31,7 @@ class Methanation(MethaneTechno): def compute_resources_needs(self): # in kg of CO2 for kWh of CH4 - self.cost_details[f'{CO2.name}_needs'] = self.get_theoretical_co2_needs() / self.cost_details['efficiency'] + self.cost_details[f'{GlossaryEnergy.carbon_capture}_needs'] = self.get_theoretical_co2_needs() / self.cost_details['efficiency'] def compute_other_streams_needs(self): # in kWh of H2 for kWh of CH4 diff --git a/energy_models/models/solid_fuel/coal_extraction/coal_extraction.py b/energy_models/models/solid_fuel/coal_extraction/coal_extraction.py index 108081d7..dcf71284 100644 --- a/energy_models/models/solid_fuel/coal_extraction/coal_extraction.py +++ b/energy_models/models/solid_fuel/coal_extraction/coal_extraction.py @@ -17,7 +17,6 @@ import numpy as np -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.core.stream_type.energy_models.methane import Methane from energy_models.core.stream_type.energy_models.solid_fuel import SolidFuel from energy_models.core.techno_type.base_techno_models.solid_fuel_techno import ( @@ -42,7 +41,7 @@ def compute_other_streams_needs(self): self.cost_details[f'{GlossaryEnergy.electricity}_needs'] = self.get_electricity_needs() / self.cost_details['efficiency'] def compute_byproducts_production(self): - self.production_detailed[f'{CO2.name} ({GlossaryEnergy.mass_unit})'] = self.techno_infos_dict['CO2_from_production'] / \ + self.production_detailed[f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})'] = self.techno_infos_dict['CO2_from_production'] / \ self.data_energy_dict['high_calorific_value'] * \ self.production_detailed[ f'{SolidFuelTechno.energy_name} ({self.product_unit})'] diff --git a/energy_models/models/syngas/autothermal_reforming/autothermal_reforming.py b/energy_models/models/syngas/autothermal_reforming/autothermal_reforming.py index 8c6481ce..ffc7b429 100644 --- a/energy_models/models/syngas/autothermal_reforming/autothermal_reforming.py +++ b/energy_models/models/syngas/autothermal_reforming/autothermal_reforming.py @@ -28,7 +28,6 @@ class AutothermalReforming(SyngasTechno): def compute_resources_needs(self): # need in kg to produce 1kwh of syngas - self.cost_details[f"{GlossaryEnergy.CO2Resource}_needs"] = self.get_theoretical_CO2_needs() / self.cost_details['efficiency'] # need in kg to produce 1kwh of syngas self.cost_details[f'{GlossaryEnergy.OxygenResource}_needs'] = self.get_theoretical_O2_needs() / self.cost_details['efficiency'] @@ -36,7 +35,7 @@ def compute_resources_needs(self): def compute_other_streams_needs(self): # need in kwh to produce 1kwh of syngas self.cost_details[f'{Methane.name}_needs'] = self.get_theoretical_CH4_needs() / self.cost_details['efficiency'] - + self.cost_details[f"{GlossaryEnergy.carbon_capture}_needs"] = self.get_theoretical_CO2_needs() / self.cost_details['efficiency'] def get_theoretical_CH4_needs(self): """ diff --git a/energy_models/models/syngas/co_electrolysis/co_electrolysis.py b/energy_models/models/syngas/co_electrolysis/co_electrolysis.py index 35214aea..a244e3eb 100644 --- a/energy_models/models/syngas/co_electrolysis/co_electrolysis.py +++ b/energy_models/models/syngas/co_electrolysis/co_electrolysis.py @@ -26,13 +26,14 @@ class CoElectrolysis(SyngasTechno): syngas_COH2_ratio = 100.0 # in % def compute_resources_needs(self): - # need in kg to produce 1kwh of syngas - self.cost_details[f"{GlossaryEnergy.CO2Resource}_needs"] = self.get_theoretical_CO2_needs() / self.cost_details['efficiency'] # need in kwh to produce 1kwh of syngas self.cost_details[f"{GlossaryEnergy.WaterResource}_needs"] = self.get_theoretical_water_needs() / self.cost_details['efficiency'] def compute_other_streams_needs(self): + # need in kg to produce 1kwh of syngas + self.cost_details[f"{GlossaryEnergy.carbon_capture}_needs"] = self.get_theoretical_CO2_needs() / self.cost_details['efficiency'] + self.cost_details[f'{GlossaryEnergy.electricity}_needs'] = self.get_electricity_needs() diff --git a/energy_models/models/wet_biomass/animal_manure/animal_manure.py b/energy_models/models/wet_biomass/animal_manure/animal_manure.py index 94297016..6c7e4989 100644 --- a/energy_models/models/wet_biomass/animal_manure/animal_manure.py +++ b/energy_models/models/wet_biomass/animal_manure/animal_manure.py @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ''' -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.core.techno_type.base_techno_models.wet_biomass_techno import ( WetBiomassTechno, ) @@ -27,6 +26,6 @@ def compute_other_streams_needs(self): self.cost_details[f'{GlossaryEnergy.electricity}_needs'] = self.get_electricity_needs() def compute_byproducts_production(self): - self.production_detailed[f'{CO2.name} (kg)'] = self.techno_infos_dict['CO2_from_production'] / \ + self.production_detailed[f'{GlossaryEnergy.carbon_capture} (kg)'] = self.techno_infos_dict['CO2_from_production'] / \ self.data_energy_dict['calorific_value'] * \ self.production_detailed[f'{WetBiomassTechno.energy_name} (kWh)'] \ No newline at end of file diff --git a/energy_models/models/wet_biomass/wet_crop_residue/wet_crop_residues.py b/energy_models/models/wet_biomass/wet_crop_residue/wet_crop_residues.py index 5bc4e33a..74f53e5d 100644 --- a/energy_models/models/wet_biomass/wet_crop_residue/wet_crop_residues.py +++ b/energy_models/models/wet_biomass/wet_crop_residue/wet_crop_residues.py @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. ''' -from energy_models.core.stream_type.carbon_models.carbon_dioxyde import CO2 from energy_models.core.techno_type.base_techno_models.wet_biomass_techno import ( WetBiomassTechno, ) @@ -28,6 +27,6 @@ def compute_other_streams_needs(self): def compute_byproducts_production(self): - self.production_detailed[f'{CO2.name} (kg)'] = self.techno_infos_dict['CO2_from_production'] / \ + self.production_detailed[f'{GlossaryEnergy.carbon_capture} (kg)'] = self.techno_infos_dict['CO2_from_production'] / \ self.data_energy_dict['calorific_value'] * \ self.production_detailed[f'{WetBiomassTechno.energy_name} (kWh)'] diff --git a/energy_models/sos_processes/energy/techno_mix/biomass_dry_mix/usecase.py b/energy_models/sos_processes/energy/techno_mix/biomass_dry_mix/usecase.py index 362d1e38..549f83ee 100644 --- a/energy_models/sos_processes/energy/techno_mix/biomass_dry_mix/usecase.py +++ b/energy_models/sos_processes/energy/techno_mix/biomass_dry_mix/usecase.py @@ -72,7 +72,9 @@ def setup_usecase(self, study_folder_path=None): years = np.arange(self.year_start, self.year_end + 1) # reference_data_name = 'Reference_aircraft_data' energy_prices = pd.DataFrame({GlossaryEnergy.Years: years, - GlossaryEnergy.electricity: 16.0}) + GlossaryEnergy.electricity: 16.0, + GlossaryEnergy.carbon_capture: 70. + }) # We use the IEA H2 demand to fake the invest level through years @@ -103,7 +105,8 @@ def setup_usecase(self, study_folder_path=None): 50.0, 100.0, len(years)) # biomass_dry price in $/kg energy_carbon_emissions = pd.DataFrame( {GlossaryEnergy.Years: years, GlossaryEnergy.biomass_dry: - 0.64 / 4.86, GlossaryEnergy.solid_fuel: 0.64 / 4.86, GlossaryEnergy.electricity: 0.0, - GlossaryEnergy.methane: 0.123 / 15.4, GlossaryEnergy.syngas: 0.0, f'{GlossaryEnergy.hydrogen}.{GlossaryEnergy.gaseous_hydrogen}': 0.0, 'crude oil': 0.02533}) + GlossaryEnergy.methane: 0.123 / 15.4, GlossaryEnergy.syngas: 0.0, f'{GlossaryEnergy.hydrogen}.{GlossaryEnergy.gaseous_hydrogen}': 0.0, 'crude oil': 0.02533, + GlossaryEnergy.carbon_capture: -4.}) # define invest mix investment_mix = self.get_investments() diff --git a/energy_models/sos_processes/energy/techno_mix/methane_mix/usecase.py b/energy_models/sos_processes/energy/techno_mix/methane_mix/usecase.py index adfd9415..16d28003 100644 --- a/energy_models/sos_processes/energy/techno_mix/methane_mix/usecase.py +++ b/energy_models/sos_processes/energy/techno_mix/methane_mix/usecase.py @@ -76,7 +76,8 @@ def setup_usecase(self, study_folder_path=None): GlossaryEnergy.electricity: 16.0, f'{GlossaryEnergy.hydrogen}.{GlossaryEnergy.gaseous_hydrogen}': 0.0, GlossaryEnergy.syngas: 80.0, - GlossaryEnergy.biogas: 70.0}) + GlossaryEnergy.biogas: 70.0, + GlossaryEnergy.carbon_capture: 70.}) # the value for invest_level is just set as an order of magnitude invest_level = pd.DataFrame( @@ -102,7 +103,7 @@ def setup_usecase(self, study_folder_path=None): energy_carbon_emissions = pd.DataFrame( {GlossaryEnergy.Years: years, GlossaryEnergy.biomass_dry: - 0.64 / 4.86, GlossaryEnergy.biogas: - 0.05, GlossaryEnergy.solid_fuel: 0.64 / 4.86, GlossaryEnergy.electricity: 0.0, GlossaryEnergy.methane: 0.123 / 15.4, GlossaryEnergy.syngas: 0.0, f'{GlossaryEnergy.hydrogen}.{GlossaryEnergy.gaseous_hydrogen}': 0.0, - 'crude oil': 0.02533}) + 'crude oil': 0.02533, GlossaryEnergy.carbon_capture: - 0.64 / 4.888}) investment_mix = self.get_investments() values_dict = {f'{self.study_name}.{GlossaryEnergy.YearStart}': self.year_start, diff --git a/energy_models/sos_processes/energy/techno_mix/syngas_mix/usecase.py b/energy_models/sos_processes/energy/techno_mix/syngas_mix/usecase.py index 34793631..2ae94fb5 100644 --- a/energy_models/sos_processes/energy/techno_mix/syngas_mix/usecase.py +++ b/energy_models/sos_processes/energy/techno_mix/syngas_mix/usecase.py @@ -82,7 +82,8 @@ def setup_usecase(self, study_folder_path=None): energy_prices = pd.DataFrame({GlossaryEnergy.Years: years, GlossaryEnergy.electricity: 16.0, GlossaryEnergy.methane: 80.0, GlossaryEnergy.biomass_dry: 50.0, - GlossaryEnergy.solid_fuel: 50.0}) + GlossaryEnergy.solid_fuel: 50.0, + GlossaryEnergy.carbon_capture: 70.}) # the value for invest_level is just set as an order of magnitude invest_level = pd.DataFrame( @@ -106,9 +107,17 @@ def setup_usecase(self, study_folder_path=None): resources_price[GlossaryEnergy.Years] = years resources_price[GlossaryEnergy.CO2] = np.linspace( 50.0, 100.0, len(years)) # biomass_dry price in $/kg - energy_carbon_emissions = pd.DataFrame( - {GlossaryEnergy.Years: years, GlossaryEnergy.biomass_dry: - 0.64 / 4.86, GlossaryEnergy.solid_fuel: 0.64 / 4.86, GlossaryEnergy.electricity: 0.0, - GlossaryEnergy.methane: 0.123 / 15.4, GlossaryEnergy.syngas: 0.0, f'{GlossaryEnergy.hydrogen}.{GlossaryEnergy.gaseous_hydrogen}': 0.0, 'crude oil': 0.02533}) + energy_carbon_emissions = pd.DataFrame({ + GlossaryEnergy.Years: years, + GlossaryEnergy.biomass_dry: - 0.64 / 4.86, + GlossaryEnergy.solid_fuel: 0.64 / 4.86, + GlossaryEnergy.electricity: 0.0, + GlossaryEnergy.methane: 0.123 / 15.4, + GlossaryEnergy.syngas: 0.0, + f'{GlossaryEnergy.hydrogen}.{GlossaryEnergy.gaseous_hydrogen}': 0.0, + 'crude oil': 0.02533, + GlossaryEnergy.carbon_capture: -4. + }) # define invest mix investment_mix = self.get_investments() diff --git a/energy_models/sos_processes/techno_dict/techno_dict_builder.py b/energy_models/sos_processes/techno_dict/techno_dict_builder.py index 13c3020c..57efb72f 100644 --- a/energy_models/sos_processes/techno_dict/techno_dict_builder.py +++ b/energy_models/sos_processes/techno_dict/techno_dict_builder.py @@ -211,6 +211,20 @@ def build_techno_infos(stream_used_by_technos: dict, stream_produced_by_techno: GlossaryEnergy.HefaDecarboxylation, ] +technos_to_avoid = [ +GlossaryEnergy.BiomassFermentation, +f"{GlossaryEnergy.flue_gas_capture}.{GlossaryEnergy.ChilledAmmoniaProcess}", # remove +f"{GlossaryEnergy.flue_gas_capture}.{GlossaryEnergy.CO2Membranes}", # remove +f"{GlossaryEnergy.flue_gas_capture}.{GlossaryEnergy.PressureSwingAdsorption}", # remove +GlossaryEnergy.BiomassBuryingFossilization, +GlossaryEnergy.PureCarbonSolidStorage +] +streams_to_avoid = [ +GlossaryEnergy.hightemperatureheat_energyname, +GlossaryEnergy.mediumtemperatureheat_energyname, +GlossaryEnergy.lowtemperatureheat_energyname +] + if __name__ == '__main__': sub_techno_dict, n_technos, n_streams = techno_dict_builder( diff --git a/energy_models/sos_processes/techno_dict/visualistion.py b/energy_models/sos_processes/techno_dict/visualistion.py new file mode 100644 index 00000000..64385eaf --- /dev/null +++ b/energy_models/sos_processes/techno_dict/visualistion.py @@ -0,0 +1,104 @@ +''' +Copyright 2024 Capgemini +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +''' +import matplotlib.colors as mcolors +import matplotlib.pyplot as plt +import numpy as np + +# Define the technologies and their energy connections +technologies = { + 'T1': {'consumes': ['E1'], 'produces': 'E2'}, + 'T2': {'consumes': ['E2'], 'produces': 'E1'}, + 'T3': {'consumes': ['E1', 'E2'], 'produces': 'E3'}, + 'T4': {'consumes': ['E3'], 'produces': 'E4'}, + 'T5': {'consumes': ['E4'], 'produces': 'E1'} +} + + + +def generate_color_mapping(strings): + # Get a list of all available colors + colors = list(mcolors.CSS4_COLORS.keys()) + + # If there are more strings than available colors, raise an error + if len(strings) > len(colors): + raise ValueError("Too many strings for the available unique colors.") + + # Shuffle the colors to get a diverse set + np.random.shuffle(colors) + + # Map each string to a unique color + color_mapping = {string: colors[i] for i, string in enumerate(strings)} + + cmap = plt.get_cmap('tab20') + num_colors = cmap.N + + # If there are more strings than available colors, repeat colors + colors = [cmap(i % num_colors) for i in range(len(strings))] + + # Map each string to a unique color + color_mapping = {string: mcolors.to_hex(colors[i]) for i, string in enumerate(strings)} + + return color_mapping + +def visualize(technologies): + # Initialize the directed graph + import re + + import networkx as nx + def improve_string(ss): + ss = ss.replace('.','\n').replace('_',' ') + ss = re.sub(r'(?