Skip to content

Commit

Permalink
merge validation to main
Browse files Browse the repository at this point in the history
  • Loading branch information
b4pm-devops committed Oct 14, 2024
2 parents f93ef6a + 05bb45a commit 1d1da22
Show file tree
Hide file tree
Showing 40 changed files with 161 additions and 307 deletions.
18 changes: 9 additions & 9 deletions data_energy/techno_invests/cleanenergysimpletechno.csv
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
years,invest
2015,1074
2016,1132
2017,1129
2018,1137
2019,1225
2020,1259
2021,1408
2022,1617
2023,1740
2015,394
2016,401
2017,403
2018,427
2019,473
2020,500
2021,539
2022,687
2023,822
2 changes: 1 addition & 1 deletion data_energy/techno_invests/sources.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FossilSimpleTechno : https://www.iea.org/reports/world-energy-investment-2023/overview-and-key-findings
RenewableSimpleTechno : https://www.iea.org/reports/world-energy-investment-2023/overview-and-key-findings
RenewableSimpleTechno : https://www.iea.org/data-and-statistics/charts/global-investment-in-clean-energy-and-fossil-fuels-2015-2024
CarbonStorageTechno : https://www.iea.org/energy-system/carbon-capture-utilisation-and-storage/co2-capture-and-utilisation
DirectAirCaptureTechno : https://www.iea.org/energy-system/carbon-capture-utilisation-and-storage/direct-air-capture
SolarPV: [https://www.iea.org/energy-system/renewables/solar-pv,]
Expand Down
7 changes: 2 additions & 5 deletions energy_models/core/ccus/ccus_disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,8 @@ class CCUS_Discipline(SoSWrapp):
'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_public'},
'scaling_factor_energy_consumption': {'type': 'float', 'default': 1e3, 'unit': '-', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_public'},
'carbonstorage_limit': {'type': 'float', 'default': 12e6, 'unit': 'Mt', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': GlossaryEnergy.NS_REFERENCE},
'carbonstorage_constraint_ref': {'type': 'float', 'default': 12e6, 'unit': 'Mt', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'carbonstorage_limit': {'type': 'float', 'default': 12e6, 'unit': 'Mt', 'user_level': 2,},
'carbonstorage_constraint_ref': {'type': 'float', 'default': 12e6, 'unit': 'Mt', 'user_level': 2},
'co2_emissions_needed_by_energy_mix': {'type': 'dataframe', 'unit': 'Gt',
'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_energy',
'dataframe_descriptor': {GlossaryEnergy.Years: ('float', None, True),
Expand Down
8 changes: 2 additions & 6 deletions energy_models/core/demand/energy_demand_disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,13 @@ class EnergyDemandDiscipline(SoSWrapp):
# old value is 20900TWh
'initial_electricity_demand': {'type': 'float', 'default': 18000., 'unit': 'TWh'},
'long_term_elec_machine_efficiency': {'type': 'float', 'default': 0.985, 'unit': '-'},
'electricity_demand_constraint_ref': {'type': 'float', 'default': 2500.0, 'unit': 'TWh',
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'electricity_demand_constraint_ref': {'type': 'float', 'default': 2500.0, 'unit': 'TWh',},
GlossaryEnergy.PopulationDf['var_name']: GlossaryEnergy.PopulationDf,
GlossaryEnergy.TransportDemandValue: {'type': 'dataframe', 'dataframe_descriptor': {
GlossaryEnergy.Years: ('int', [1900, GlossaryEnergy.YearEndDefaultCore], False),
GlossaryEnergy.TransportDemandValue: ('float', None, True)},
'dataframe_edition_locked': False, 'unit': 'TWh'},
'transport_demand_constraint_ref': {'type': 'float', 'default': 6000.0, 'unit': 'TWh',
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'transport_demand_constraint_ref': {'type': 'float', 'default': 6000.0, 'unit': 'TWh',},
'additional_demand_transport': {'type': 'float', 'default': 10., 'unit': '%'}}

DESC_OUT = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class EnergyGHGEmissionsDiscipline(SoSWrapp):
'last_modification_date': '',
'category': '',
'definition': '',
'icon': 'fas fa-cloud fa-fw',
'icon': "fa-solid fa-bolt",
'version': '',
}

Expand Down
68 changes: 26 additions & 42 deletions energy_models/core/energy_mix/energy_mix_disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Energy_Mix_Discipline(SoSWrapp):
'last_modification_date': '',
'category': '',
'definition': '',
'icon': 'fas fa-battery-full fa-fw',
'icon': "fa-solid fa-bolt",
'version': '',
}
# All values used to calibrate heat loss percentage
Expand Down Expand Up @@ -117,19 +117,13 @@ class Energy_Mix_Discipline(SoSWrapp):
GlossaryEnergy.EnergyMeanPriceObjectiveRefValue: GlossaryEnergy.EnergyMeanPriceObjectiveRef,
'alpha': {'type': 'float', 'range': [0., 1.], 'default': 0.5, 'unit': '-',
'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_energy_study'},
'primary_energy_percentage': {'type': 'float', 'range': [0., 1.], 'unit': '-', 'default': 0.8,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'normalization_value_demand_constraints': {'type': 'float', 'default': 1000.0, 'unit': 'Twh',
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'primary_energy_percentage': {'type': 'float', 'range': [0., 1.], 'unit': '-', 'default': 0.8},
'normalization_value_demand_constraints': {'type': 'float', 'default': 1000.0, 'unit': 'Twh'},
GlossaryEnergy.CO2Taxes['var_name']: GlossaryEnergy.CO2Taxes,
'minimum_energy_production': {'type': 'float', 'default': 1e4,
'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_public',
'unit': 'TWh'},
'total_prod_minus_min_prod_constraint_ref': {'type': 'float', 'default': 1e4, 'unit': 'Twh',
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'total_prod_minus_min_prod_constraint_ref': {'type': 'float', 'default': 1e4, 'unit': 'Twh'},
'exp_min': {'type': 'bool', 'default': True, 'user_level': 2},
'production_threshold': {'type': 'float', 'default': 1e-3, 'unit': 'Twh'},
'scaling_factor_energy_production': {'type': 'float', 'default': 1e3, 'unit': '-', 'user_level': 2,
Expand All @@ -138,29 +132,16 @@ class Energy_Mix_Discipline(SoSWrapp):
'scaling_factor_energy_consumption': {'type': 'float', 'default': 1e3, 'unit': '-', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': 'ns_public'},
'solid_fuel_elec_percentage': {'type': 'float', 'default': 0.75, 'unit': '-', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'solid_fuel_elec_constraint_ref': {'type': 'float', 'default': 10000., 'unit': 'Twh', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'liquid_hydrogen_percentage': {'type': 'array', 'user_level': 2, 'unit': '%',
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'liquid_hydrogen_constraint_ref': {'type': 'float', 'default': 1000., 'unit': 'Twh', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'solid_fuel_elec_percentage': {'type': 'float', 'default': 0.75, 'unit': '-', 'user_level': 2},
'solid_fuel_elec_constraint_ref': {'type': 'float', 'default': 10000., 'unit': 'Twh', 'user_level': 2,},
'liquid_hydrogen_percentage': {'type': 'array', 'user_level': 2, 'unit': '%',},
'liquid_hydrogen_constraint_ref': {'type': 'float', 'default': 1000., 'unit': 'Twh', 'user_level': 2,},
'ref_constraint_non_use_capital_energy': {'type': 'float', 'default': 0.30, 'unit':'-','description': '0.30 means after 35 % of capital not used the constraint will explode'},
'tol_constraint_non_use_capital_energy': {'type': 'float', 'default': 0.05, 'unit':'-','description': '0.05 means constraint does not penalize lagrangian when non use capital is less than 5%'},
'period_tol_power_non_use_capital_constraint': {'type': 'float', 'default': 1.0, 'unit':'-','description': '0.05 means constraint does not penalize lagrangian when non use capital is less than 5%'},
'syngas_prod_ref': {'type': 'float', 'default': 10000., 'unit': 'TWh', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': GlossaryEnergy.NS_REFERENCE},
'syngas_prod_constraint_limit': {'type': 'float', 'default': 10000., 'unit': 'TWh', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},

'ratio_ref': {'type': 'float', 'default': 500., 'unit': '-', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': GlossaryEnergy.NS_REFERENCE},
'syngas_prod_ref': {'type': 'float', 'default': 10000., 'unit': 'TWh', 'user_level': 2},
'syngas_prod_constraint_limit': {'type': 'float', 'default': 10000., 'unit': 'TWh', 'user_level': 2},
'ratio_ref': {'type': 'float', 'default': 500., 'unit': '-', 'user_level': 2},
'heat_losses_percentage': {'type': 'float', 'default': heat_losses_percentage_default, 'unit': '%',
'range': [0., 100.]}, }

Expand Down Expand Up @@ -252,12 +233,13 @@ def setup_sos_disciplines(self):
inputs_dict = self.get_sosdisc_inputs()
if GlossaryEnergy.YearStart 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)
default_target_energy_production = pd.DataFrame({GlossaryEnergy.Years: years,
GlossaryEnergy.TargetEnergyProductionValue: np.zeros_like(
years)})
self.set_dynamic_default_values(
{GlossaryEnergy.TargetEnergyProductionValue: default_target_energy_production})
if year_start is not None and year_end is not None:
years = np.arange(year_start, year_end + 1)
default_target_energy_production = pd.DataFrame({GlossaryEnergy.Years: years,
GlossaryEnergy.TargetEnergyProductionValue: np.zeros_like(
years)})
self.set_dynamic_default_values(
{GlossaryEnergy.TargetEnergyProductionValue: default_target_energy_production})
if GlossaryEnergy.energy_list in self.get_data_in():
energy_list = inputs_dict[GlossaryEnergy.energy_list]
if energy_list is not None:
Expand Down Expand Up @@ -369,12 +351,14 @@ def update_default_with_years(self, inputs_dict):
'''
Update default variables knowing the year start and the year end
'''
if GlossaryEnergy.YearStart in inputs_dict:
years = np.arange(inputs_dict[GlossaryEnergy.YearStart], inputs_dict[GlossaryEnergy.YearEnd] + 1)
lh_perc_default = np.concatenate(
(np.ones(5) * 1e-4, np.ones(len(years) - 5) / 4), axis=None)
self.set_dynamic_default_values(
{'liquid_hydrogen_percentage': lh_perc_default})
if GlossaryEnergy.YearStart in self.get_data_in():
year_start, year_end = self.get_sosdisc_inputs([GlossaryEnergy.YearStart, GlossaryEnergy.YearEnd])
if year_start is not None and year_end is not None:
years = np.arange(year_start, year_end + 1)
lh_perc_default = np.concatenate(
(np.ones(5) * 1e-4, np.ones(len(years) - 5) / 4), axis=None)
self.set_dynamic_default_values(
{'liquid_hydrogen_percentage': lh_perc_default})

def run(self):
# -- get inputs
Expand Down
6 changes: 3 additions & 3 deletions energy_models/core/energy_process_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
# Only one discipline with absolute values for
# investments per techno and a constraint
]
INVEST_DISCIPLINE_DEFAULT = INVEST_DISCIPLINE_OPTIONS[1] # 'one_invest'
INVEST_DISCIPLINE_DEFAULT = INVEST_DISCIPLINE_OPTIONS[1]


class EnergyProcessBuilder(BaseProcessBuilder):

def __init__(self, ee):
def __init__(self, ee, invest_discipline: str = INVEST_DISCIPLINE_DEFAULT):
BaseProcessBuilder.__init__(self, ee)
self.techno_list = None
self.invest_discipline = INVEST_DISCIPLINE_DEFAULT
self.invest_discipline = invest_discipline
self.associate_namespace = False
#self.energy_name = filename.split('\\')[-2].replace("_mix", '')
#self.techno_list = current_techno_dict[self.energy_name]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class CleanEnergyDiscipline(EnergyDiscipline):
'last_modification_date': '',
'category': '',
'definition': '',
'icon': '',
'icon': 'fas fa-fan fa-fw',
'version': '',
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,11 @@ class ElectricityDiscipline(EnergyDiscipline):
# 4400TWh is total production,
# we use a 50% higher value
'unit': 'Twh',
'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'user_level': 2,},
'hydropower_constraint_ref': {'type': 'float',
'default': 1000.,
'unit': 'Twh',
'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'user_level': 2,},
'data_fuel_dict': {'type': 'dict',
'visibility': EnergyDiscipline.SHARED_VISIBILITY,
'namespace': 'ns_electricity',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FossilDiscipline(EnergyDiscipline):
'last_modification_date': '',
'category': '',
'definition': '',
'icon': '',
'icon': 'fas fa-smog fa-fw',
'version': '',
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ def get_post_processing_list(self, filters=None):
if new_chart is not None:
instanciated_charts.append(new_chart)

if 'Power plants initial age distribution' in charts:
new_chart = self.get_chart_initial_age_distrib()
if new_chart is not None:
instanciated_charts.append(new_chart)

if 'Capex' in charts:
new_chart = self.get_chart_capex()
instanciated_charts.append(new_chart)

return instanciated_charts

def get_chart_detailed_price_in_dollar_tCO2(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ def get_post_processing_list(self, filters=None):
if new_chart is not None:
instanciated_charts.append(new_chart)

if 'Power plants initial age distribution' in charts:
new_chart = self.get_chart_initial_age_distrib()
if new_chart is not None:
instanciated_charts.append(new_chart)

if 'Capex' in charts:
new_chart = self.get_chart_capex()
instanciated_charts.append(new_chart)

return instanciated_charts

def get_chart_detailed_price_in_dollar_ton(self):
Expand Down
Loading

0 comments on commit 1d1da22

Please sign in to comment.