diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b803e6b7..339dd803 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,10 +1,51 @@
----
-ci:
- autofix_commit_msg: "Chore: pre-commit autoupdate"
-
repos:
-
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.5.0
+ hooks:
+ - id: ruff
+ args: [
+ --fix,
+ --preview,
+ --exit-non-zero-on-fix,
+ --config=ruff.toml,
+ ]
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.6.0
+ rev: v4.5.0
hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ exclude: LICENSES/headers
+ - id: check-yaml
+ # !reference is specific to gitlab
+ # !! prefix is specific to mkdocs
+ exclude: \.gitlab-ci.yml|mkdocs.yml
- id: check-added-large-files
+ - id: check-json
+ - id: pretty-format-json
+ args: [
+ --autofix,
+ --no-sort-keys,
+ ]
+ exclude: \.ipynb
+ - id: check-toml
+ - id: destroyed-symlinks
+ - id: check-symlinks
+ - repo: https://github.com/pre-commit/pygrep-hooks
+ rev: v1.10.0
+ hooks:
+ - id: rst-backticks
+ - id: rst-directive-colons
+ - id: rst-inline-touching-normal
+ - repo: https://github.com/kynan/nbstripout
+ rev: 0.7.1
+ hooks:
+ - id: nbstripout
+ - repo: https://github.com/igorshubovych/markdownlint-cli
+ rev: v0.39.0
+ hooks:
+ - id: markdownlint
+ args: [
+ --fix,
+ --disable,
+ MD024,
+ ]
diff --git a/data_energy/fitting/clean_energy_simple_techno.py b/data_energy/fitting/clean_energy_simple_techno.py
new file mode 100644
index 00000000..651e6975
--- /dev/null
+++ b/data_energy/fitting/clean_energy_simple_techno.py
@@ -0,0 +1,153 @@
+'''
+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 numpy as np
+import pandas as pd
+from scipy.optimize import minimize
+from sostrades_core.execution_engine.execution_engine import ExecutionEngine
+from sostrades_core.tools.post_processing.charts.two_axes_instanciated_chart import (
+ InstanciatedSeries,
+ TwoAxesInstanciatedChart,
+)
+
+from energy_models.database_witness_energy import DatabaseWitnessEnergy
+from energy_models.glossaryenergy import GlossaryEnergy
+from energy_models.models.clean_energy.clean_energy_simple_techno.clean_energy_simple_techno_disc import (
+ CleanEnergySimpleTechnoDiscipline,
+)
+
+year_calibration = 2015
+
+
+df_invest_historic = DatabaseWitnessEnergy.get_techno_invest_df(techno_name=GlossaryEnergy.CleanEnergySimpleTechno)
+df_prod_historic = DatabaseWitnessEnergy.get_techno_prod(techno_name=GlossaryEnergy.CleanEnergySimpleTechno, year=2020)[1].value
+ref_price_2023 = 70.76 # $/MWh
+# data to run techno
+construction_delay = GlossaryEnergy.TechnoConstructionDelayDict[GlossaryEnergy.CleanEnergySimpleTechno]
+year_start_fitting = int(max(df_invest_historic['years'].min() + construction_delay, df_prod_historic['years'].min(), year_calibration))
+year_end_fitting = int(min(df_invest_historic['years'].max(), df_prod_historic['years'].max()))
+
+prod_values_historic = df_prod_historic.loc[(df_prod_historic['years'] >= year_start_fitting) & (df_prod_historic['years'] <= year_end_fitting)]['production'].values
+years_fitting = list(np.arange(year_start_fitting, year_end_fitting + 1))
+invest_df = df_invest_historic.loc[(df_invest_historic['years'] >= year_start_fitting) & (df_invest_historic['years'] <= year_end_fitting)]
+margin = pd.DataFrame({GlossaryEnergy.Years: years_fitting, GlossaryEnergy.MarginValue: 110})
+transport = pd.DataFrame({GlossaryEnergy.Years: years_fitting, 'transport': np.zeros(len(years_fitting))})
+co2_taxes = pd.DataFrame({GlossaryEnergy.Years: years_fitting, GlossaryEnergy.CO2Tax: np.linspace(0., 0., len(years_fitting))})
+stream_prices = pd.DataFrame({GlossaryEnergy.Years: years_fitting})
+resources_price = pd.DataFrame({GlossaryEnergy.Years: years_fitting})
+techno_dict_default = CleanEnergySimpleTechnoDiscipline.techno_infos_dict_default
+
+name = 'Test'
+model_name = GlossaryEnergy.CleanEnergySimpleTechno
+ee = ExecutionEngine(name)
+ns_dict = {'ns_public': name,
+ 'ns_energy': name,
+ 'ns_energy_study': f'{name}',
+ 'ns_clean_energy': name,
+ 'ns_resource': name}
+ee.ns_manager.add_ns_def(ns_dict)
+
+mod_path = 'energy_models.models.clean_energy.clean_energy_simple_techno.clean_energy_simple_techno_disc.CleanEnergySimpleTechnoDiscipline'
+builder = ee.factory.get_builder_from_module(
+ model_name, mod_path)
+
+ee.factory.set_builders_to_coupling_builder(builder)
+
+ee.configure()
+ee.display_treeview_nodes()
+
+
+def run_model(x: list):
+ techno_dict_default["Capex_init"] = x[0]
+ init_age_distrib_factor = x[1]
+ techno_dict_default["learning_rate"] = x[2]
+ techno_dict_default["Opex_percentage"] = x[3]
+ techno_dict_default["WACC"] = x[4]
+
+ inputs_dict = {
+ f'{name}.{GlossaryEnergy.YearStart}': year_start_fitting,
+ f'{name}.{GlossaryEnergy.YearEnd}': year_end_fitting,
+ f'{name}.{GlossaryEnergy.StreamPricesValue}': stream_prices,
+ f'{name}.{GlossaryEnergy.StreamsCO2EmissionsValue}': pd.DataFrame({GlossaryEnergy.Years: years_fitting}),
+ f'{name}.{model_name}.{GlossaryEnergy.InvestLevelValue}': invest_df,
+ f'{name}.{GlossaryEnergy.TransportMarginValue}': margin,
+ f'{name}.{GlossaryEnergy.CO2TaxesValue}': co2_taxes,
+ f'{name}.{GlossaryEnergy.TransportCostValue}': transport,
+ f'{name}.{GlossaryEnergy.ResourcesPriceValue}': resources_price,
+ f'{name}.{model_name}.{GlossaryEnergy.MarginValue}': margin,
+ f'{name}.{model_name}.{GlossaryEnergy.InitialPlantsAgeDistribFactor}': init_age_distrib_factor,
+ f'{name}.{model_name}.techno_infos_dict': techno_dict_default,
+ }
+
+ ee.load_study_from_input_dict(inputs_dict)
+
+ ee.execute()
+
+ prod_df = ee.dm.get_value(ee.dm.get_all_namespaces_from_var_name(GlossaryEnergy.TechnoProductionValue)[0])
+ prod_values_model = prod_df[f"{GlossaryEnergy.clean_energy} (TWh)"].values * 1000
+
+ price_df = ee.dm.get_value(ee.dm.get_all_namespaces_from_var_name(GlossaryEnergy.TechnoPricesValue)[0])
+
+ price_model_values = float((price_df.loc[price_df[GlossaryEnergy.Years] == 2023, f"{GlossaryEnergy.CleanEnergySimpleTechno}_wotaxes"]).values)
+ return prod_values_model, price_model_values
+
+
+def fitting_renewable(x: list):
+ prod_values_model, price_model_values = run_model(x)
+ return (((prod_values_model - prod_values_historic)) ** 2).mean() + (price_model_values - ref_price_2023) ** 2
+
+
+# Initial guess for the variables
+x0 = np.array([250., 1., 0.0, 0.2, 0.1])
+#x0 = np.array([743.8, 1.3, 0.06, 0.0, 0.06])
+
+bounds = [(0, 10000), (0, 1.1), (0.00, 0.), (0.001, 0.99), (0.0001, 0.3)]
+
+# Use minimize to find the minimum of the function
+result = minimize(fitting_renewable, x0, bounds=bounds)
+
+prod_values_model, price_model_values = run_model(result.x)
+
+# Print the result
+#print("Optimal solution:", result.x)
+print("Function value at the optimum:", result.fun)
+
+
+new_chart = TwoAxesInstanciatedChart('years', 'production (TWh)',
+ chart_name='Production : model vs historic')
+
+
+serie = InstanciatedSeries(years_fitting, prod_values_model, 'model', 'lines')
+new_chart.series.append(serie)
+
+serie = InstanciatedSeries(years_fitting, prod_values_historic, 'historic', 'lines')
+new_chart.series.append(serie)
+
+new_chart.to_plotly().show()
+
+parameters = ["capex_init", "init_age_distrib_factor", "learning_rate", "opex_percentage", "wacc"]
+opt_values = dict(zip(parameters, np.round(result.x, 2)))
+for key, val in opt_values.items():
+ print("Optimal", key, ":", val)
+
+capex_init, init_age_distrib_factor, learning_rate, opex_percentage, wacc = result.x
+
+disc = ee.dm.get_disciplines_with_name(
+ f'{name}.{model_name}')[0]
+filters = disc.get_chart_filter_list()
+graph_list = disc.get_post_processing_list(filters)
+for graph in graph_list:
+ graph.to_plotly().show()
+ pass
\ No newline at end of file
diff --git a/data_energy/fitting/fossil_energy_simple_techno.py b/data_energy/fitting/fossil_energy_simple_techno.py
new file mode 100644
index 00000000..9588ae37
--- /dev/null
+++ b/data_energy/fitting/fossil_energy_simple_techno.py
@@ -0,0 +1,170 @@
+'''
+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 numpy as np
+import pandas as pd
+from scipy.optimize import minimize
+from sostrades_core.execution_engine.execution_engine import ExecutionEngine
+from sostrades_core.tools.post_processing.charts.two_axes_instanciated_chart import (
+ InstanciatedSeries,
+ TwoAxesInstanciatedChart,
+)
+
+from energy_models.database_witness_energy import DatabaseWitnessEnergy
+from energy_models.glossaryenergy import GlossaryEnergy
+from energy_models.models.fossil.fossil_simple_techno.fossil_simple_techno_disc import (
+ FossilSimpleTechnoDiscipline,
+)
+
+year_calibration = 2015
+
+df_invest_historic = DatabaseWitnessEnergy.get_techno_invest_df(techno_name=GlossaryEnergy.FossilSimpleTechno)
+df_prod_historic = DatabaseWitnessEnergy.get_techno_prod(techno_name=GlossaryEnergy.FossilSimpleTechno, year=2020)[1].value
+ref_price_2023 = 121.5 # $/MWh Source: chatgpt LCOE without tax
+# data to run techno
+construction_delay = GlossaryEnergy.TechnoConstructionDelayDict[GlossaryEnergy.FossilSimpleTechno]
+year_start_fitting = int(max(df_invest_historic['years'].min() + construction_delay, df_prod_historic['years'].min(), year_calibration))
+year_end_fitting = int(min(df_invest_historic['years'].max(), df_prod_historic['years'].max()))
+
+prod_values_historic = df_prod_historic.loc[(df_prod_historic['years'] >= year_start_fitting) & (df_prod_historic['years'] <= year_end_fitting)]['production'].values
+years_fitting = list(np.arange(year_start_fitting, year_end_fitting + 1))
+invest_df = df_invest_historic.loc[(df_invest_historic['years'] >= year_start_fitting) & (df_invest_historic['years'] <= year_end_fitting)]
+margin = pd.DataFrame({GlossaryEnergy.Years: years_fitting, GlossaryEnergy.MarginValue: 110})
+transport = pd.DataFrame({GlossaryEnergy.Years: years_fitting, 'transport': np.zeros(len(years_fitting))})
+co2_taxes = pd.DataFrame({GlossaryEnergy.Years: years_fitting, GlossaryEnergy.CO2Tax: np.linspace(0., 0., len(years_fitting))})
+stream_prices = pd.DataFrame({GlossaryEnergy.Years: years_fitting})
+resources_price = pd.DataFrame({GlossaryEnergy.Years: years_fitting})
+techno_dict_default = FossilSimpleTechnoDiscipline.techno_infos_dict_default
+
+name = 'Test'
+model_name = GlossaryEnergy.FossilSimpleTechno
+ee = ExecutionEngine(name)
+ns_dict = {'ns_public': name,
+ 'ns_energy': name,
+ 'ns_energy_study': f'{name}',
+ 'ns_fossil': name,
+ 'ns_resource': name}
+ee.ns_manager.add_ns_def(ns_dict)
+
+mod_path = 'energy_models.models.fossil.fossil_simple_techno.fossil_simple_techno_disc.FossilSimpleTechnoDiscipline'
+builder = ee.factory.get_builder_from_module(
+ model_name, mod_path)
+
+ee.factory.set_builders_to_coupling_builder(builder)
+
+ee.configure()
+ee.display_treeview_nodes()
+
+
+
+def run_model(x: list, year_end: int = year_end_fitting):
+ techno_dict_default["Capex_init"] = x[0]
+ init_age_distrib_factor = x[1]
+ techno_dict_default["learning_rate"] = x[2]
+ techno_dict_default["Opex_percentage"] = x[3]
+ techno_dict_default["WACC"] = x[4]
+ utilisation_ratio = pd.DataFrame({GlossaryEnergy.Years: years_fitting,
+ GlossaryEnergy.UtilisationRatioValue: x[5:]})
+
+ inputs_dict = {
+ f'{name}.{GlossaryEnergy.YearStart}': year_start_fitting,
+ f'{name}.{GlossaryEnergy.YearEnd}': year_end,
+ f'{name}.{GlossaryEnergy.StreamPricesValue}': stream_prices,
+ f'{name}.{GlossaryEnergy.StreamsCO2EmissionsValue}': pd.DataFrame({GlossaryEnergy.Years: years_fitting}),
+ f'{name}.{model_name}.{GlossaryEnergy.InvestLevelValue}': invest_df,
+ f'{name}.{GlossaryEnergy.TransportMarginValue}': margin,
+ f'{name}.{GlossaryEnergy.CO2TaxesValue}': co2_taxes,
+ f'{name}.{GlossaryEnergy.TransportCostValue}': transport,
+ f'{name}.{GlossaryEnergy.ResourcesPriceValue}': resources_price,
+ f'{name}.{model_name}.{GlossaryEnergy.MarginValue}': margin,
+ f'{name}.{model_name}.{GlossaryEnergy.InitialPlantsAgeDistribFactor}': init_age_distrib_factor,
+ f'{name}.{model_name}.techno_infos_dict': techno_dict_default,
+ f'{name}.{model_name}.{GlossaryEnergy.UtilisationRatioValue}': utilisation_ratio,
+ }
+
+ ee.load_study_from_input_dict(inputs_dict)
+
+ ee.execute()
+
+ prod_df = ee.dm.get_value(ee.dm.get_all_namespaces_from_var_name(GlossaryEnergy.TechnoProductionValue)[0])
+ prod_values_model = prod_df["fossil (TWh)"].values * 1000
+
+ price_df = ee.dm.get_value(ee.dm.get_all_namespaces_from_var_name(GlossaryEnergy.TechnoPricesValue)[0])
+
+ price_model_values = float((price_df.loc[price_df[GlossaryEnergy.Years] == 2023, f"{GlossaryEnergy.FossilSimpleTechno}_wotaxes"]).values)
+ return prod_values_model, price_model_values
+
+
+def fitting_renewable(x: list):
+ prod_values_model, price_model_values = run_model(x)
+ return (((prod_values_model - prod_values_historic)) ** 2).mean() + (price_model_values - ref_price_2023) ** 2
+
+
+# Initial guess for the variables
+# [capex_init, init_age_distrib_factor, learnin_rate, Opex_fraction, WACC, utilization_ratio]
+x0 = np.concatenate((np.array([200., 1., 0.0, 0.024, 0.058]), 100.0 * np.ones_like(years_fitting)))
+
+# can put different lower and upper bounds for utilization ratio if want to activate it
+bounds = [(0, 10000), (1.0, 1.0), (0.0, 0.0), (0.001, 0.99), (0.058, 0.3)] + len(years_fitting) * [(100.0, 100.0)]
+
+# Use minimize to find the minimum of the function
+result = minimize(fitting_renewable, x0, bounds=bounds)
+
+prod_values_model, price_model_values = run_model(result.x)
+
+# Print the result
+print("Function value at the optimum:", result.fun)
+
+
+new_chart = TwoAxesInstanciatedChart('years', 'production (TWh)',
+ chart_name='Production : model vs historic')
+
+
+serie = InstanciatedSeries(years_fitting, prod_values_model, 'model', 'lines')
+new_chart.series.append(serie)
+
+serie = InstanciatedSeries(years_fitting, prod_values_historic, 'historic', 'lines')
+new_chart.series.append(serie)
+
+new_chart.to_plotly().show()
+
+capex_init, init_age_distrib_factor, learning_rate, opex_percentage, wacc = result.x[0:5]
+utilization_ratio = result.x[5:]
+parameters = ["capex_init", "init_age_distrib_factor", "learning_rate", "opex_percentage", "wacc"]
+opt_values = dict(zip(parameters, np.round(result.x, 3)))
+for key, val in opt_values.items():
+ print("Optimal", key, ":", val)
+print("Optimal utilization_ratio", utilization_ratio)
+
+disc = ee.dm.get_disciplines_with_name(
+ f'{name}.{model_name}')[0]
+filters = disc.get_chart_filter_list()
+graph_list = disc.get_post_processing_list(filters)
+for graph in graph_list:
+ graph.to_plotly().show()
+ pass
+
+"""
+Results obtained:
+Function value at the optimum: 16826745.79920797
+=> less than 6% error at max between model and historic production between 2015 and 2023
+=> no error on the price
+Optimal capex_init : 222.638
+Optimal init_age_distrib_factor : 1.0
+Optimal learning_rate : 0.0
+Optimal opex_percentage : 0.262
+Optimal wacc : 0.058
+Optimal utilization_ratio [100. 100. 100. 100. 100. 100.]
+"""
\ No newline at end of file
diff --git a/data_energy/techno_factories_age/cleanenergysimpletechno.csv b/data_energy/techno_factories_age/cleanenergysimpletechno.csv
index c0496593..ee2b2878 100644
--- a/data_energy/techno_factories_age/cleanenergysimpletechno.csv
+++ b/data_energy/techno_factories_age/cleanenergysimpletechno.csv
@@ -1,4 +1,5 @@
years,growth_rate
-2023,1.0
-2020,1.0
+2023,1.13
+2020,1.1
+2015,1.1
1991,1.0
diff --git a/data_energy/techno_invests/cleanenergysimpletechno.csv b/data_energy/techno_invests/cleanenergysimpletechno.csv
index 095e7a6f..3c53df23 100644
--- a/data_energy/techno_invests/cleanenergysimpletechno.csv
+++ b/data_energy/techno_invests/cleanenergysimpletechno.csv
@@ -1,10 +1,11 @@
-years,invest
-2015,394
-2016,401
-2017,403
-2018,427
-2019,473
-2020,500
-2021,539
-2022,687
-2023,822
+,Renewable power,Grids and storage,Energy efficiency and end-use,Nuclear and other clean power,Low-emissions fuels,invest,years
+0,343,338,393,43,8,630.6,2015
+0,349,350,457,44,8,646.0,2016
+0,354,341,465,41,8,641.7,2017
+0,379,335,451,40,8,661.5,2018
+0,424,316,455,40,9,694.2,2019
+0,446,313,436,46,9,720.1,2020
+0,470,330,562,58,11,770.0,2021
+0,605,365,655,65,17,942.5,2022
+0,735,416,646,67,20,1113.2,2023
+0,771,452,669,80,31,1198.4,2024
diff --git a/data_energy/techno_invests/fossilsimpletechno.csv b/data_energy/techno_invests/fossilsimpletechno.csv
index 85a38792..516980a8 100644
--- a/data_energy/techno_invests/fossilsimpletechno.csv
+++ b/data_energy/techno_invests/fossilsimpletechno.csv
@@ -1,10 +1,10 @@
-years,invest
-2015,1319
-2016,1105
-2017,1114
-2018,1109
-2019,1066
-2020,839
-2021,914
-2022,1002
-2023,1050
+years,invest
+2015,1374
+2016,1145
+2017,1179
+2018,1170
+2019,1127
+2020,897
+2021,963
+2022,1036
+2023,1090
diff --git a/data_energy/techno_invests/global-investment-in-clean-energy-and-fossil-fuels-2015-2024.csv b/data_energy/techno_invests/global-investment-in-clean-energy-and-fossil-fuels-2015-2024.csv
new file mode 100644
index 00000000..e9fb810d
--- /dev/null
+++ b/data_energy/techno_invests/global-investment-in-clean-energy-and-fossil-fuels-2015-2024.csv
@@ -0,0 +1,11 @@
+Renewable power;Grids and storage;Energy efficiency and end-use;Nuclear and other clean power;Low-emissions fuels
+0;343;338;393;43;8
+0;349;350;457;44;8
+0;354;341;465;41;8
+0;379;335;451;40;8
+0;424;316;455;40;9
+0;446;313;436;46;9
+0;470;330;562;58;11
+0;605;365;655;65;17
+0;735;416;646;67;20
+0;771;452;669;80;31
\ No newline at end of file
diff --git a/data_energy/techno_invests/sources.txt b/data_energy/techno_invests/sources.txt
index d36b6195..e1c22539 100644
--- a/data_energy/techno_invests/sources.txt
+++ b/data_energy/techno_invests/sources.txt
@@ -1,5 +1,9 @@
-FossilSimpleTechno : 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
+FossilSimpleTechno : https://www.iea.org/data-and-statistics/charts/global-investment-in-clean-energy-and-fossil-fuels-2015-2024
+fossil simple techno invest = coal + gas + oil
+
+Clean energy simple techno : https://www.iea.org/data-and-statistics/charts/global-investment-in-clean-energy-and-fossil-fuels-2015-2024
+Clean energy invest = Renewable + Nuclear and others + Low emission fuels + 70% of grid invests because renewable need a lot of grid invest to work (https://www.rystadenergy.com/news/power-grids-investments-energy-transition-permitting-policies)
+
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,]
diff --git a/data_energy/techno_production_historic/anaerobicdigestion.csv b/data_energy/techno_production_historic/anaerobicdigestion.csv
index ab7d5937..19dcf15d 100644
--- a/data_energy/techno_production_historic/anaerobicdigestion.csv
+++ b/data_energy/techno_production_historic/anaerobicdigestion.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,407.05,TWh
+2019,407.05,TWh
diff --git a/data_energy/techno_production_historic/autothermalreforming.csv b/data_energy/techno_production_historic/autothermalreforming.csv
index 0e39a2e1..28dce373 100644
--- a/data_energy/techno_production_historic/autothermalreforming.csv
+++ b/data_energy/techno_production_historic/autothermalreforming.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,TWh
+2019,0.0,TWh
diff --git a/data_energy/techno_production_historic/biogasfired.csv b/data_energy/techno_production_historic/biogasfired.csv
index 53955e62..4b36b785 100644
--- a/data_energy/techno_production_historic/biogasfired.csv
+++ b/data_energy/techno_production_historic/biogasfired.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,88.751,TWh
+2019,88.751,TWh
diff --git a/data_energy/techno_production_historic/biomassburyingfossilization.csv b/data_energy/techno_production_historic/biomassburyingfossilization.csv
index d180e15d..7b337b0c 100644
--- a/data_energy/techno_production_historic/biomassburyingfossilization.csv
+++ b/data_energy/techno_production_historic/biomassburyingfossilization.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,MtCO2
+2019,0.0,MtCO2
diff --git a/data_energy/techno_production_historic/biomassfermentation.csv b/data_energy/techno_production_historic/biomassfermentation.csv
index ca24fee8..e7dd1350 100644
--- a/data_energy/techno_production_historic/biomassfermentation.csv
+++ b/data_energy/techno_production_historic/biomassfermentation.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,649.9888347148141,TWh
+2019,649.9888347148141,TWh
diff --git a/data_energy/techno_production_historic/biomassfired.csv b/data_energy/techno_production_historic/biomassfired.csv
index 60bcfe33..8fca606a 100644
--- a/data_energy/techno_production_historic/biomassfired.csv
+++ b/data_energy/techno_production_historic/biomassfired.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,443.085,TWh
+2019,443.085,TWh
diff --git a/data_energy/techno_production_historic/biomassgasification.csv b/data_energy/techno_production_historic/biomassgasification.csv
index 1545b730..3c8d1df3 100644
--- a/data_energy/techno_production_historic/biomassgasification.csv
+++ b/data_energy/techno_production_historic/biomassgasification.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,19.728111000000002,TWh
+2019,19.728111000000002,TWh
diff --git a/data_energy/techno_production_historic/chphighheat.csv b/data_energy/techno_production_historic/chphighheat.csv
index 3e51f872..1e15fb9a 100644
--- a/data_energy/techno_production_historic/chphighheat.csv
+++ b/data_energy/techno_production_historic/chphighheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,43.97872340425532,TWh
+2019,43.97872340425532,TWh
diff --git a/data_energy/techno_production_historic/chplowheat.csv b/data_energy/techno_production_historic/chplowheat.csv
index 78946ec8..a7595741 100644
--- a/data_energy/techno_production_historic/chplowheat.csv
+++ b/data_energy/techno_production_historic/chplowheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,26.0,TWh
+2019,26.0,TWh
diff --git a/data_energy/techno_production_historic/chpmediumheat.csv b/data_energy/techno_production_historic/chpmediumheat.csv
index 5f1ed54e..591ccf50 100644
--- a/data_energy/techno_production_historic/chpmediumheat.csv
+++ b/data_energy/techno_production_historic/chpmediumheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,36.0,TWh
+2019,36.0,TWh
diff --git a/data_energy/techno_production_historic/cleanenergysimpletechno.csv b/data_energy/techno_production_historic/cleanenergysimpletechno.csv
index d802ce38..300117db 100644
--- a/data_energy/techno_production_historic/cleanenergysimpletechno.csv
+++ b/data_energy/techno_production_historic/cleanenergysimpletechno.csv
@@ -1,3 +1,35 @@
years,production,unit
-2020,31552.17,TWh
-2023,36306.66,TWh
+1990,18370.5875,TWh
+1991,18873.95528,TWh
+1992,19135.62528,TWh
+1993,19486.54778,TWh
+1994,19814.36028,TWh
+1995,20365.18472,TWh
+1996,20841.40972,TWh
+1997,20918.9875,TWh
+1998,21163.00139,TWh
+1999,21622.88306,TWh
+2000,21710.03944,TWh
+2001,21717.85889,TWh
+2002,22014.94472,TWh
+2003,22208.18222,TWh
+2004,22953.40194,TWh
+2005,23430.80361,TWh
+2006,23929.52528,TWh
+2007,24004.7825,TWh
+2008,24457.19194,TWh
+2009,24592.80528,TWh
+2010,25476.99056,TWh
+2011,25200.32583,TWh
+2012,25482.41556,TWh
+2013,26268.14056,TWh
+2014,26850.79611,TWh
+2015,27282.17139,TWh
+2016,28045.97389,TWh
+2017,28835.65389,TWh
+2018,29959.75861,TWh
+2019,30840.28944,TWh
+2020,31082.16167,TWh
+2021,32428.30806,TWh
+2022,32911.60028,TWh
+2023,35741.32642,TWh
diff --git a/data_energy/techno_production_historic/co2hydrogenation.csv b/data_energy/techno_production_historic/co2hydrogenation.csv
index 1435dbcf..82ca4cd0 100644
--- a/data_energy/techno_production_historic/co2hydrogenation.csv
+++ b/data_energy/techno_production_historic/co2hydrogenation.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,543.0,TWh
+2019,543.0,TWh
diff --git a/data_energy/techno_production_historic/coalextraction.csv b/data_energy/techno_production_historic/coalextraction.csv
index 3b3bc258..1d9705b6 100644
--- a/data_energy/techno_production_historic/coalextraction.csv
+++ b/data_energy/techno_production_historic/coalextraction.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,42799.22,TWh
+2019,42799.22,TWh
diff --git a/data_energy/techno_production_historic/coalgasification.csv b/data_energy/techno_production_historic/coalgasification.csv
index 5e0a801d..d3f8d422 100644
--- a/data_energy/techno_production_historic/coalgasification.csv
+++ b/data_energy/techno_production_historic/coalgasification.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,3023.294117647059,TWh
+2019,3023.294117647059,TWh
diff --git a/data_energy/techno_production_historic/coelectrolysis.csv b/data_energy/techno_production_historic/coelectrolysis.csv
index 0e39a2e1..28dce373 100644
--- a/data_energy/techno_production_historic/coelectrolysis.csv
+++ b/data_energy/techno_production_historic/coelectrolysis.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,TWh
+2019,0.0,TWh
diff --git a/data_energy/techno_production_historic/cropenergy.csv b/data_energy/techno_production_historic/cropenergy.csv
index 7bef058a..78143497 100644
--- a/data_energy/techno_production_historic/cropenergy.csv
+++ b/data_energy/techno_production_historic/cropenergy.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,292.62239999999997,TWh
+2019,292.62239999999997,TWh
diff --git a/data_energy/techno_production_historic/deepoceaninjection.csv b/data_energy/techno_production_historic/deepoceaninjection.csv
index d180e15d..7b337b0c 100644
--- a/data_energy/techno_production_historic/deepoceaninjection.csv
+++ b/data_energy/techno_production_historic/deepoceaninjection.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,MtCO2
+2019,0.0,MtCO2
diff --git a/data_energy/techno_production_historic/deepsalineformation.csv b/data_energy/techno_production_historic/deepsalineformation.csv
index d180e15d..7b337b0c 100644
--- a/data_energy/techno_production_historic/deepsalineformation.csv
+++ b/data_energy/techno_production_historic/deepsalineformation.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,MtCO2
+2019,0.0,MtCO2
diff --git a/data_energy/techno_production_historic/depletedoilgas.csv b/data_energy/techno_production_historic/depletedoilgas.csv
index d180e15d..7b337b0c 100644
--- a/data_energy/techno_production_historic/depletedoilgas.csv
+++ b/data_energy/techno_production_historic/depletedoilgas.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,MtCO2
+2019,0.0,MtCO2
diff --git a/data_energy/techno_production_historic/direct_air_capture_aminescrubbing.csv b/data_energy/techno_production_historic/direct_air_capture_aminescrubbing.csv
index 210f7bfe..a3f2a9b4 100644
--- a/data_energy/techno_production_historic/direct_air_capture_aminescrubbing.csv
+++ b/data_energy/techno_production_historic/direct_air_capture_aminescrubbing.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.005,MtCO2
+2019,0.005,MtCO2
diff --git a/data_energy/techno_production_historic/direct_air_capture_calciumpotassiumscrubbing.csv b/data_energy/techno_production_historic/direct_air_capture_calciumpotassiumscrubbing.csv
index 210f7bfe..a3f2a9b4 100644
--- a/data_energy/techno_production_historic/direct_air_capture_calciumpotassiumscrubbing.csv
+++ b/data_energy/techno_production_historic/direct_air_capture_calciumpotassiumscrubbing.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.005,MtCO2
+2019,0.005,MtCO2
diff --git a/data_energy/techno_production_historic/electricboilerhighheat.csv b/data_energy/techno_production_historic/electricboilerhighheat.csv
index e4ad9308..aef2ab01 100644
--- a/data_energy/techno_production_historic/electricboilerhighheat.csv
+++ b/data_energy/techno_production_historic/electricboilerhighheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,139.67,TWh
+2019,139.67,TWh
diff --git a/data_energy/techno_production_historic/electricboilerlowheat.csv b/data_energy/techno_production_historic/electricboilerlowheat.csv
index 17b56d28..91255792 100644
--- a/data_energy/techno_production_historic/electricboilerlowheat.csv
+++ b/data_energy/techno_production_historic/electricboilerlowheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,139.66,TWh
+2019,139.66,TWh
diff --git a/data_energy/techno_production_historic/electricboilermediumheat.csv b/data_energy/techno_production_historic/electricboilermediumheat.csv
index e4ad9308..aef2ab01 100644
--- a/data_energy/techno_production_historic/electricboilermediumheat.csv
+++ b/data_energy/techno_production_historic/electricboilermediumheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,139.67,TWh
+2019,139.67,TWh
diff --git a/data_energy/techno_production_historic/electrolysis_awe.csv b/data_energy/techno_production_historic/electrolysis_awe.csv
index c026b2b2..1e3e8324 100644
--- a/data_energy/techno_production_historic/electrolysis_awe.csv
+++ b/data_energy/techno_production_historic/electrolysis_awe.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,1.2000000000000002,TWh
+2019,1.2000000000000002,TWh
diff --git a/data_energy/techno_production_historic/electrolysis_pem.csv b/data_energy/techno_production_historic/electrolysis_pem.csv
index 0246e148..f8191ece 100644
--- a/data_energy/techno_production_historic/electrolysis_pem.csv
+++ b/data_energy/techno_production_historic/electrolysis_pem.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.4,TWh
+2019,0.4,TWh
diff --git a/data_energy/techno_production_historic/electrolysis_soec.csv b/data_energy/techno_production_historic/electrolysis_soec.csv
index 0e39a2e1..28dce373 100644
--- a/data_energy/techno_production_historic/electrolysis_soec.csv
+++ b/data_energy/techno_production_historic/electrolysis_soec.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,TWh
+2019,0.0,TWh
diff --git a/data_energy/techno_production_historic/enhancedoilrecovery.csv b/data_energy/techno_production_historic/enhancedoilrecovery.csv
index d180e15d..7b337b0c 100644
--- a/data_energy/techno_production_historic/enhancedoilrecovery.csv
+++ b/data_energy/techno_production_historic/enhancedoilrecovery.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,MtCO2
+2019,0.0,MtCO2
diff --git a/data_energy/techno_production_historic/fischertropsch.csv b/data_energy/techno_production_historic/fischertropsch.csv
index ae516584..9e944d8a 100644
--- a/data_energy/techno_production_historic/fischertropsch.csv
+++ b/data_energy/techno_production_historic/fischertropsch.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,309.6295,TWh
+2019,309.6295,TWh
diff --git a/data_energy/techno_production_historic/flue_gas_capture_calciumlooping.csv b/data_energy/techno_production_historic/flue_gas_capture_calciumlooping.csv
index b842c224..ba8a9076 100644
--- a/data_energy/techno_production_historic/flue_gas_capture_calciumlooping.csv
+++ b/data_energy/techno_production_historic/flue_gas_capture_calciumlooping.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,5.0,MtCO2
+2019,5.0,MtCO2
diff --git a/data_energy/techno_production_historic/flue_gas_capture_chilledammoniaprocess.csv b/data_energy/techno_production_historic/flue_gas_capture_chilledammoniaprocess.csv
index b842c224..ba8a9076 100644
--- a/data_energy/techno_production_historic/flue_gas_capture_chilledammoniaprocess.csv
+++ b/data_energy/techno_production_historic/flue_gas_capture_chilledammoniaprocess.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,5.0,MtCO2
+2019,5.0,MtCO2
diff --git a/data_energy/techno_production_historic/flue_gas_capture_co2membranes.csv b/data_energy/techno_production_historic/flue_gas_capture_co2membranes.csv
index b842c224..ba8a9076 100644
--- a/data_energy/techno_production_historic/flue_gas_capture_co2membranes.csv
+++ b/data_energy/techno_production_historic/flue_gas_capture_co2membranes.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,5.0,MtCO2
+2019,5.0,MtCO2
diff --git a/data_energy/techno_production_historic/flue_gas_capture_monoethanolamine.csv b/data_energy/techno_production_historic/flue_gas_capture_monoethanolamine.csv
index 19f3eabc..7d9e00bd 100644
--- a/data_energy/techno_production_historic/flue_gas_capture_monoethanolamine.csv
+++ b/data_energy/techno_production_historic/flue_gas_capture_monoethanolamine.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,15.0,MtCO2
+2019,15.0,MtCO2
diff --git a/data_energy/techno_production_historic/flue_gas_capture_piperazineprocess.csv b/data_energy/techno_production_historic/flue_gas_capture_piperazineprocess.csv
index b842c224..ba8a9076 100644
--- a/data_energy/techno_production_historic/flue_gas_capture_piperazineprocess.csv
+++ b/data_energy/techno_production_historic/flue_gas_capture_piperazineprocess.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,5.0,MtCO2
+2019,5.0,MtCO2
diff --git a/data_energy/techno_production_historic/flue_gas_capture_pressureswingadsorption.csv b/data_energy/techno_production_historic/flue_gas_capture_pressureswingadsorption.csv
index b842c224..ba8a9076 100644
--- a/data_energy/techno_production_historic/flue_gas_capture_pressureswingadsorption.csv
+++ b/data_energy/techno_production_historic/flue_gas_capture_pressureswingadsorption.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,5.0,MtCO2
+2019,5.0,MtCO2
diff --git a/data_energy/techno_production_historic/fossilsimpletechno.csv b/data_energy/techno_production_historic/fossilsimpletechno.csv
index 77472652..8560ebb7 100644
--- a/data_energy/techno_production_historic/fossilsimpletechno.csv
+++ b/data_energy/techno_production_historic/fossilsimpletechno.csv
@@ -1,44 +1,35 @@
-Entity,years,Coal production,Oil production,Gas production,unit,production
-World,1981,21445.264,33858.336,14530.98,TWh,69834.58
-World,1982,22204.45,32518.732,14597.483,TWh,69320.66500000001
-World,1983,22137.21,32122.473,14728.052,TWh,68987.735
-World,1984,23105.666,32752.219,15988.612,TWh,71846.497
-World,1985,24276.508,32465.682,16410.338,TWh,73152.528
-World,1986,24852.295,34069.39,16834.781,TWh,75756.466
-World,1987,25321.266,34148.09,17678.572,TWh,77147.928
-World,1988,25936.305,35607.57,18457.764,TWh,80001.639
-World,1989,26394.465,36037.48,19096.992,TWh,81528.937
-World,1990,26344.957,36726.777,19697.164,TWh,82768.898
-World,1991,25628.818,36627.707,19959.688,TWh,82216.213
-World,1992,25572.447,37157.996,20018.34,TWh,82748.783
-World,1993,24802.262,37105.156,20246.295,TWh,82153.713
-World,1994,25371.623,37619.203,20542.516,TWh,83533.342
-World,1995,26146.615,38135.516,20883.5,TWh,85165.63100000001
-World,1996,26502.912,39151.24,21899.963,TWh,87554.115
-World,1997,26894.896,40023.2,21882.97,TWh,88801.06599999999
-World,1998,26412.506,41034.703,22462.334,TWh,89909.543
-World,1999,26421.326,40104.69,23102.75,TWh,89628.766
-World,2000,26812.184,41863.727,24007.166,TWh,92683.07699999999
-World,2001,27948.334,41854.504,24574.18,TWh,94377.01800000001
-World,2002,28287.195,41349.258,25147.336,TWh,94783.789
-World,2003,30361.137,43184.227,26046.873,TWh,99592.237
-World,2004,32984.98,45349.15,26932.35,TWh,105266.48000000001
-World,2005,35060.26,45735.105,27577.504,TWh,108372.869
-World,2006,36829.766,46140.66,28517.908,TWh,111488.334
-World,2007,38453.367,46042.082,29278.344,TWh,113773.79299999999
-World,2008,39718.855,46532.49,30349.936,TWh,116601.281
-World,2009,39704.535,45375.168,29408.73,TWh,114488.433
-World,2010,41834.363,46271.11,31501.742,TWh,119607.215
-World,2011,44789.605,46628.05,32575.154,TWh,123992.809
-World,2012,45253.773,47925.867,33265.63,TWh,126445.26999999999
-World,2013,45978.477,47984.973,33660.957,TWh,127624.407
-World,2014,45850.832,49109.766,34356.14,TWh,129316.738
-World,2015,44570.035,50752.184,35059.98,TWh,130382.19900000002
-World,2016,42189.684,50948.1,35076.668,TWh,128214.45199999999
-World,2017,43191.312,51020.32,36709.18,TWh,130920.812
-World,2018,45143.613,52221.39,38453.266,TWh,135818.269
-World,2019,45783.21,52188.836,39640.457,TWh,137612.503
-World,2020,43483.91,48708.867,38661.79,TWh,130854.56700000001
-World,2021,45202.457,49286.684,40437.043,TWh,134926.184
-World,2022,48358.03,51519.516,40486.11,TWh,140363.65600000002
-World,2023,49789.156,52432.227,40592.312,TWh,142813.695
+Entity,years,unit,production
+World,1990,TWh,82793.46806
+World,1991,TWh,82936.90861
+World,1992,TWh,82756.93861
+World,1993,TWh,83442.45333
+World,1994,TWh,83909.28861
+World,1995,TWh,85971.84472
+World,1996,TWh,88145.4825
+World,1997,TWh,89179.28639
+World,1998,TWh,89465.70833
+World,1999,TWh,91444.55972
+World,2000,TWh,93822.62861
+World,2001,TWh,94776.65167
+World,2002,TWh,96919.55
+World,2003,TWh,101029.5506
+World,2004,TWh,105867.19
+World,2005,TWh,109070.5481
+World,2006,TWh,112404.6575
+World,2007,TWh,116029.2067
+World,2008,TWh,117157.3708
+World,2009,TWh,115546.1642
+World,2010,TWh,122588.6319
+World,2011,TWh,125257.3619
+World,2012,TWh,126692.7997
+World,2013,TWh,128144.5494
+World,2014,TWh,129481.3961
+World,2015,TWh,129263.3089
+World,2016,TWh,129960.4772
+World,2017,TWh,132681.4917
+World,2018,TWh,135365.7864
+World,2019,TWh,136480.9619
+World,2020,TWh,130071.7306
+World,2021,TWh,138229.7597
+World,2022,TWh,139917.3519
+World,2023,TWh,139500.1165
diff --git a/data_energy/techno_production_historic/geologicmineralization.csv b/data_energy/techno_production_historic/geologicmineralization.csv
index d180e15d..7b337b0c 100644
--- a/data_energy/techno_production_historic/geologicmineralization.csv
+++ b/data_energy/techno_production_historic/geologicmineralization.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,MtCO2
+2019,0.0,MtCO2
diff --git a/data_energy/techno_production_historic/geothermalhighheat.csv b/data_energy/techno_production_historic/geothermalhighheat.csv
index 839abfe9..04b16893 100644
--- a/data_energy/techno_production_historic/geothermalhighheat.csv
+++ b/data_energy/techno_production_historic/geothermalhighheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,60833.333333333336,TWh
+2019,60833.333333333336,TWh
diff --git a/data_energy/techno_production_historic/geothermallowheat.csv b/data_energy/techno_production_historic/geothermallowheat.csv
index 839abfe9..04b16893 100644
--- a/data_energy/techno_production_historic/geothermallowheat.csv
+++ b/data_energy/techno_production_historic/geothermallowheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,60833.333333333336,TWh
+2019,60833.333333333336,TWh
diff --git a/data_energy/techno_production_historic/geothermalmediumheat.csv b/data_energy/techno_production_historic/geothermalmediumheat.csv
index 839abfe9..04b16893 100644
--- a/data_energy/techno_production_historic/geothermalmediumheat.csv
+++ b/data_energy/techno_production_historic/geothermalmediumheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,60833.333333333336,TWh
+2019,60833.333333333336,TWh
diff --git a/data_energy/techno_production_historic/heatpumphighheat.csv b/data_energy/techno_production_historic/heatpumphighheat.csv
index e18deb4c..0990ce6c 100644
--- a/data_energy/techno_production_historic/heatpumphighheat.csv
+++ b/data_energy/techno_production_historic/heatpumphighheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,2920.0,TWh
+2019,2920.0,TWh
diff --git a/data_energy/techno_production_historic/heatpumplowheat.csv b/data_energy/techno_production_historic/heatpumplowheat.csv
index e18deb4c..0990ce6c 100644
--- a/data_energy/techno_production_historic/heatpumplowheat.csv
+++ b/data_energy/techno_production_historic/heatpumplowheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,2920.0,TWh
+2019,2920.0,TWh
diff --git a/data_energy/techno_production_historic/heatpumpmediumheat.csv b/data_energy/techno_production_historic/heatpumpmediumheat.csv
index e18deb4c..0990ce6c 100644
--- a/data_energy/techno_production_historic/heatpumpmediumheat.csv
+++ b/data_energy/techno_production_historic/heatpumpmediumheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,2920.0,TWh
+2019,2920.0,TWh
diff --git a/data_energy/techno_production_historic/hefadecarboxylation.csv b/data_energy/techno_production_historic/hefadecarboxylation.csv
index 159b7db8..d36990de 100644
--- a/data_energy/techno_production_historic/hefadecarboxylation.csv
+++ b/data_energy/techno_production_historic/hefadecarboxylation.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,8.58,TWh
+2019,8.58,TWh
diff --git a/data_energy/techno_production_historic/hefadeoxygenation.csv b/data_energy/techno_production_historic/hefadeoxygenation.csv
index 966efe91..2b4b22f0 100644
--- a/data_energy/techno_production_historic/hefadeoxygenation.csv
+++ b/data_energy/techno_production_historic/hefadeoxygenation.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,77.22,TWh
+2019,77.22,TWh
diff --git a/data_energy/techno_production_historic/hydrogenliquefaction.csv b/data_energy/techno_production_historic/hydrogenliquefaction.csv
index fc5849d8..79472695 100644
--- a/data_energy/techno_production_historic/hydrogenliquefaction.csv
+++ b/data_energy/techno_production_historic/hydrogenliquefaction.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,2.331,TWh
+2019,2.331,TWh
diff --git a/data_energy/techno_production_historic/managedwood.csv b/data_energy/techno_production_historic/managedwood.csv
index 419ee699..baecadb6 100644
--- a/data_energy/techno_production_historic/managedwood.csv
+++ b/data_energy/techno_production_historic/managedwood.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,28850.625000000007,TWh
+2019,28850.625000000007,TWh
diff --git a/data_energy/techno_production_historic/methanation.csv b/data_energy/techno_production_historic/methanation.csv
index 691983a4..fbde8780 100644
--- a/data_energy/techno_production_historic/methanation.csv
+++ b/data_energy/techno_production_historic/methanation.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.047199379320000005,TWh
+2019,0.047199379320000005,TWh
diff --git a/data_energy/techno_production_historic/naturalgasboilerhighheat.csv b/data_energy/techno_production_historic/naturalgasboilerhighheat.csv
index fc9f65e5..ac70a885 100644
--- a/data_energy/techno_production_historic/naturalgasboilerhighheat.csv
+++ b/data_energy/techno_production_historic/naturalgasboilerhighheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,561.0,TWh
+2019,561.0,TWh
diff --git a/data_energy/techno_production_historic/naturalgasboilerlowheat.csv b/data_energy/techno_production_historic/naturalgasboilerlowheat.csv
index fc9f65e5..ac70a885 100644
--- a/data_energy/techno_production_historic/naturalgasboilerlowheat.csv
+++ b/data_energy/techno_production_historic/naturalgasboilerlowheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,561.0,TWh
+2019,561.0,TWh
diff --git a/data_energy/techno_production_historic/naturalgasboilermediumheat.csv b/data_energy/techno_production_historic/naturalgasboilermediumheat.csv
index fc9f65e5..ac70a885 100644
--- a/data_energy/techno_production_historic/naturalgasboilermediumheat.csv
+++ b/data_energy/techno_production_historic/naturalgasboilermediumheat.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,561.0,TWh
+2019,561.0,TWh
diff --git a/data_energy/techno_production_historic/pelletizing.csv b/data_energy/techno_production_historic/pelletizing.csv
index 33160469..5e864ba4 100644
--- a/data_energy/techno_production_historic/pelletizing.csv
+++ b/data_energy/techno_production_historic/pelletizing.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,217.04,TWh
+2019,217.04,TWh
diff --git a/data_energy/techno_production_historic/plasmacracking.csv b/data_energy/techno_production_historic/plasmacracking.csv
index 0d077562..11af0fe1 100644
--- a/data_energy/techno_production_historic/plasmacracking.csv
+++ b/data_energy/techno_production_historic/plasmacracking.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,1e-12,TWh
+2019,1e-12,TWh
diff --git a/data_energy/techno_production_historic/purecarbonsolidstorage.csv b/data_energy/techno_production_historic/purecarbonsolidstorage.csv
index d180e15d..7b337b0c 100644
--- a/data_energy/techno_production_historic/purecarbonsolidstorage.csv
+++ b/data_energy/techno_production_historic/purecarbonsolidstorage.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,MtCO2
+2019,0.0,MtCO2
diff --git a/data_energy/techno_production_historic/pyrolysis.csv b/data_energy/techno_production_historic/pyrolysis.csv
index 0d077562..11af0fe1 100644
--- a/data_energy/techno_production_historic/pyrolysis.csv
+++ b/data_energy/techno_production_historic/pyrolysis.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,1e-12,TWh
+2019,1e-12,TWh
diff --git a/data_energy/techno_production_historic/refinery.csv b/data_energy/techno_production_historic/refinery.csv
index 134764de..ae443819 100644
--- a/data_energy/techno_production_historic/refinery.csv
+++ b/data_energy/techno_production_historic/refinery.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,46986.11,TWh
+2019,46986.11,TWh
diff --git a/data_energy/techno_production_historic/reforestation.csv b/data_energy/techno_production_historic/reforestation.csv
index 36025207..5a506807 100644
--- a/data_energy/techno_production_historic/reforestation.csv
+++ b/data_energy/techno_production_historic/reforestation.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.,MtCO2
+2019,0.,MtCO2
diff --git a/data_energy/techno_production_historic/rwgs.csv b/data_energy/techno_production_historic/rwgs.csv
index 0e39a2e1..28dce373 100644
--- a/data_energy/techno_production_historic/rwgs.csv
+++ b/data_energy/techno_production_historic/rwgs.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,0.0,TWh
+2019,0.0,TWh
diff --git a/data_energy/techno_production_historic/smr.csv b/data_energy/techno_production_historic/smr.csv
index aac1305c..d22f9b52 100644
--- a/data_energy/techno_production_historic/smr.csv
+++ b/data_energy/techno_production_historic/smr.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,2980.79475,TWh
+2019,2980.79475,TWh
diff --git a/data_energy/techno_production_historic/solarpv.csv b/data_energy/techno_production_historic/solarpv.csv
index 7b3f84fd..aa4bbc45 100644
--- a/data_energy/techno_production_historic/solarpv.csv
+++ b/data_energy/techno_production_historic/solarpv.csv
@@ -1,3 +1,3 @@
years,production,unit
-2020,700.0,TWh
+2019,700.0,TWh
2022,1300,TWh
diff --git a/data_energy/techno_production_historic/solarthermal.csv b/data_energy/techno_production_historic/solarthermal.csv
index 39a2e789..3f61cf0a 100644
--- a/data_energy/techno_production_historic/solarthermal.csv
+++ b/data_energy/techno_production_historic/solarthermal.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,15.6,TWh
+2019,15.6,TWh
diff --git a/data_energy/techno_production_historic/sources.txt b/data_energy/techno_production_historic/sources.txt
index a082af6b..ac146b10 100644
--- a/data_energy/techno_production_historic/sources.txt
+++ b/data_energy/techno_production_historic/sources.txt
@@ -9,4 +9,6 @@ Hydropower : https://www.statista.com/statistics/273273/world-electricity-genera
GasTurbine : 25% of Natural gas electricity generation https://www.statista.com/statistics/273273/world-electricity-generation-by-energy-source/
CombinedGasCycleTurbine : 75% of Natural gas electricity generation https://www.statista.com/statistics/273273/world-electricity-generation-by-energy-source/
Geothermal : https://geothermal-energy-journal.springeropen.com/articles/10.1186/s40517-024-00290-w
-CropEnergy : 1972, by reading this graph https://www.iea.org/reports/bioenergy-2#overview we get 3966Twh in 2022 (2361 from convetional crop and 1605 from short rotation)
\ No newline at end of file
+CropEnergy : 1972, by reading this graph https://www.iea.org/reports/bioenergy-2#overview we get 3966Twh in 2022 (2361 from convetional crop and 1605 from short rotation)
+
+Clean energy simple techno :
\ No newline at end of file
diff --git a/data_energy/techno_production_historic/transesterification.csv b/data_energy/techno_production_historic/transesterification.csv
index 36988417..8c934c9c 100644
--- a/data_energy/techno_production_historic/transesterification.csv
+++ b/data_energy/techno_production_historic/transesterification.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,339.27520000000004,TWh
+2019,339.27520000000004,TWh
diff --git a/data_energy/techno_production_historic/unmanagedwood.csv b/data_energy/techno_production_historic/unmanagedwood.csv
index 0d2f2d37..77aaaf70 100644
--- a/data_energy/techno_production_historic/unmanagedwood.csv
+++ b/data_energy/techno_production_historic/unmanagedwood.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,2332.4906250000004,TWh
+2019,2332.4906250000004,TWh
diff --git a/data_energy/techno_production_historic/upgradingbiogas.csv b/data_energy/techno_production_historic/upgradingbiogas.csv
index 60de6038..391b3ffe 100644
--- a/data_energy/techno_production_historic/upgradingbiogas.csv
+++ b/data_energy/techno_production_historic/upgradingbiogas.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,37.57071500000001,TWh
+2019,37.57071500000001,TWh
diff --git a/data_energy/techno_production_historic/watergasshift.csv b/data_energy/techno_production_historic/watergasshift.csv
index 6fcb69a4..3c8eefd1 100644
--- a/data_energy/techno_production_historic/watergasshift.csv
+++ b/data_energy/techno_production_historic/watergasshift.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,2284.38,TWh
+2019,2284.38,TWh
diff --git a/data_energy/techno_production_historic/windoffshore.csv b/data_energy/techno_production_historic/windoffshore.csv
index 343f2f74..8b0ff956 100644
--- a/data_energy/techno_production_historic/windoffshore.csv
+++ b/data_energy/techno_production_historic/windoffshore.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,89.0,TWh
+2019,89.0,TWh
diff --git a/data_energy/techno_production_historic/windonshore.csv b/data_energy/techno_production_historic/windonshore.csv
index 7695ff3d..4b849545 100644
--- a/data_energy/techno_production_historic/windonshore.csv
+++ b/data_energy/techno_production_historic/windonshore.csv
@@ -1,2 +1,2 @@
years,production,unit
-2020,1323.0,TWh
+2019,1323.0,TWh
diff --git a/energy_models/core/ccus/ccus_disc.py b/energy_models/core/ccus/ccus_disc.py
index 06a8a10d..15f305a7 100644
--- a/energy_models/core/ccus/ccus_disc.py
+++ b/energy_models/core/ccus/ccus_disc.py
@@ -300,7 +300,6 @@ def get_chart_co2_limited_storage(self):
(co2_emissions[f'{GlossaryEnergy.carbon_storage} Limited by capture (Mt)'].values / 1.0e3).tolist(),
'CO2 captured and stored', 'bar')
new_chart.add_series(serie)
- new_chart.to_plotly().show()
return new_chart
def get_chart_co2_emissions_sources(self):
diff --git a/energy_models/core/energy_mix/energy_mix.py b/energy_models/core/energy_mix/energy_mix.py
index 457372b1..64db5c15 100644
--- a/energy_models/core/energy_mix/energy_mix.py
+++ b/energy_models/core/energy_mix/energy_mix.py
@@ -134,9 +134,10 @@ class EnergyMix(BaseStream):
def __init__(self, name):
'''
- Constructor
+ Constructor
'''
super(EnergyMix, self).__init__(name)
+ self.non_use_capital_obj = None
self.period_tol_power_non_use_capital_constraint = None
self.non_use_capital_constraint_df = None
self.target_production_constraint = None
@@ -199,7 +200,7 @@ def __init__(self, name):
def configure(self, inputs_dict):
'''
- Configure method
+ Configure method
'''
self.configure_parameters(inputs_dict)
self.configure_parameters_update(inputs_dict)
@@ -487,7 +488,7 @@ def compute_energy_production_uncut(self):
def compute_net_prod_of_coarse_energies(self, energy, column_name):
'''
Compute the net production for coarse energies which does not have energy consumption
- We use a raw/net ratio to compute consumed energy production
+ We use a raw/net ratio to compute consumed energy production
consu = raw-net = raw(1-1/ratio)
'''
try:
@@ -521,7 +522,7 @@ def compute_CO2_emissions_ratio(self):
self.carbon_emissions_after_use[stream] = self.total_carbon_emissions[stream] + \
self.co2_emitted_by_energy[stream][GlossaryEnergy.CO2PerUse]
else:
- self.total_carbon_emissions[stream] = 0. # todo: fixme, Antoine: shouldnt we compute emissions for each stream, even ccs ones ?
+ self.total_carbon_emissions[stream] = 0. # todo: fixme, Antoine: shouldnt we compute emissions for each stream, even ccs ones ?
def compute_CO2_emissions(self):
'''
@@ -566,7 +567,7 @@ def compute_CO2_emissions(self):
''' CARBON CAPTURE needed by energy mix
Total carbon capture needed by energy mix if a technology needs carbon_capture
- Ex :Sabatier process or RWGS in FischerTropsch technology
+ Ex :Sabatier process or RWGS in FischerTropsch technology
'''
energy_needing_carbon_capture = self.co2_consumption[[
col for col in self.co2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]]
@@ -748,7 +749,7 @@ def compute_syngas_prod_constraint(self):
self.syngas_prod_constraint = np.zeros(len(self.years))
def compute_all_streams_demand_ratio(self):
- '''! Computes the demand_ratio dataframe.
+ '''! Computes the demand_ratio dataframe.
The ratio is calculated using the production and consumption WITHOUT the ratio applied
The value of the ratio is capped to 100.0
'''
@@ -845,7 +846,7 @@ def compute_grad_CO2_emissions(self):
# 0.0, self.production[f'production {energy}
# ({self.energy_class_dict[energy].unit})'].values)
- ''' CARBON STORAGE
+ ''' CARBON STORAGE
Total carbon storage is production of carbon storage
Solid carbon is gaseous equivalent in the production for
solidcarbonstorage technology
@@ -859,7 +860,7 @@ def compute_grad_CO2_emissions(self):
# else:
# self.total_co2_emissions[f'{GlossaryEnergy.carbon_storage} ({GlossaryEnergy.mass_unit})'] = 0.0
- ''' CARBON CAPTURE from CC technos
+ ''' CARBON CAPTURE from CC technos
Total carbon capture = carbon captured from carboncapture stream +
carbon captured from energies (can be negative if FischerTropsch needs carbon
captured)
@@ -896,7 +897,7 @@ def compute_grad_CO2_emissions(self):
''' CARBON CAPTURE needed by energy mix
Total carbon capture needed by energy mix if a technology needs carbon_capture
- Ex :Sabatier process or RWGS in FischerTropsch technology
+ Ex :Sabatier process or RWGS in FischerTropsch technology
'''
energy_needing_carbon_capture = co2_consumption[[
col for col in co2_consumption if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]]
@@ -913,9 +914,9 @@ def compute_grad_CO2_emissions(self):
# self.total_co2_emissions[
# f'{GlossaryEnergy.carbon_capture} needed by energy mix (Mt)'] = 0.0
- ''' CO2 from energy mix
- CO2 expelled by energy mix technologies during the process
- i.e. for machinery or tractors
+ ''' CO2 from energy mix
+ CO2 expelled by energy mix technologies during the process
+ i.e. for machinery or tractors
'''
energy_producing_co2 = co2_production[[
col for col in co2_production if col.endswith(f'{GlossaryEnergy.carbon_capture} ({GlossaryEnergy.mass_unit})')]]
@@ -932,8 +933,8 @@ def compute_grad_CO2_emissions(self):
# self.total_co2_emissions[
# f'{GlossaryEnergy.carbon_capture} from energy mix (Mt)'] = 0.0
- ''' CO2 removed by energy mix
- CO2 removed by energy mix technologies during the process
+ ''' 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[[
@@ -951,7 +952,7 @@ def compute_grad_CO2_emissions(self):
# f'{GlossaryEnergy.carbon_capture} removed energy mix (Mt)'] = 0.0
''' Total C02 from Flue gas
- sum of all production of flue gas
+ sum of all production of flue gas
it could be equal to carbon capture from CC technos if enough investment but not sure
'''
# self.total_co2_emissions[f'Total {CarbonCapture.flue_gas_name} ({GlossaryEnergy.mass_unit})'] = self.co2_production[[
@@ -965,7 +966,7 @@ def compute_grad_CO2_emissions(self):
f'Total {CarbonCapture.flue_gas_name} ({GlossaryEnergy.mass_unit}) vs {energy1}#{CarbonCapture.flue_gas_name} ({GlossaryEnergy.mass_unit})#prod'] = np.ones(
len_years)
''' Carbon captured that needs to be stored
- sum of the one from CC technos and the one directly captured
+ sum of the one from CC technos and the one directly captured
we delete the one needed by energy mix and potentially later the CO2 for food
'''
@@ -984,11 +985,15 @@ def compute_grad_CO2_emissions(self):
return dtot_CO2_emissions
def compute_target_production_constraint(self, inputs_dict: dict):
+ """should be negative"""
target_production_constraint_ref = inputs_dict[GlossaryEnergy.TargetProductionConstraintRefValue]
target_energy_production = inputs_dict[GlossaryEnergy.TargetEnergyProductionValue][GlossaryEnergy.TargetEnergyProductionValue].values
actual_production_twh = self.production[GlossaryEnergy.TotalProductionValue].values
missing_production = target_energy_production - actual_production_twh
- self.target_production_constraint = missing_production / target_production_constraint_ref
+ self.target_production_constraint = pd.DataFrame({
+ GlossaryEnergy.Years: self.years,
+ GlossaryEnergy.TargetProductionConstraintValue: missing_production / target_production_constraint_ref
+ })
def compute(self, inputs: dict, exp_min=True):
self.configure_parameters_update(inputs)
@@ -1003,6 +1008,7 @@ def compute(self, inputs: dict, exp_min=True):
self.aggregate_land_use_required()
self.compute_energy_capital()
self.compute_non_use_energy_capital_constraint()
+ self.compute_non_use_energy_capital_objective()
self.compute_total_prod_minus_min_prod_constraint()
self.compute_constraint_solid_fuel_elec()
self.compute_constraint_h2()
@@ -1020,7 +1026,7 @@ def compute(self, inputs: dict, exp_min=True):
def compute_energy_mean_price_objective(self):
self.energy_mean_price_objective = np.array([
- self.energy_mean_price[GlossaryEnergy.EnergyPriceValue].mean() / self.energy_mean_price_objective_ref])
+ self.energy_mean_price[GlossaryEnergy.EnergyPriceValue].mean() / self.energy_mean_price_objective_ref])
def d_energy_mean_price_obj_d_energy_mean_price(self, d_energy_mean_price):
return np.mean(d_energy_mean_price, axis=0) / self.energy_mean_price_objective_ref
@@ -1045,6 +1051,18 @@ def compute_non_use_energy_capital_constraint(self):
GlossaryEnergy.ConstraintEnergyNonUseCapital: constraint
})
+ def compute_non_use_energy_capital_objective(self):
+ """to minimize"""
+ ratio_non_use_capital = self.energy_capital[GlossaryEnergy.NonUseCapital].values / self.energy_capital[GlossaryEnergy.Capital].values
+ self.non_use_capital_obj = np.array([ratio_non_use_capital.mean()])
+
+ def d_non_use_capital_obj_d_capital(self):
+ capital = self.energy_capital[GlossaryEnergy.Capital].values
+ non_use_capital = self.energy_capital[GlossaryEnergy.NonUseCapital].values
+ d_non_use_capital = 1 / capital / len(self.years) / 1e3
+ d_capital = - non_use_capital / (capital ** 2) / len(self.years) / 1e3
+ return d_non_use_capital, d_capital
+
def d_non_use_capital_constraint_d_capital(self):
"""
@@ -1058,6 +1076,7 @@ def d_non_use_capital_constraint_d_capital(self):
d_capital = np.diag(- non_use_capital * period_tolerance / (capital ** 2) / self.ref_constraint_non_use_capital_energy / 1e3)
return d_non_use_capital, d_capital
+
def update_new_gradient(grad_dict, key_dep_tuple_list, new_key):
'''
Update new gradient which are dependent of old ones by simple sum or difference
diff --git a/energy_models/core/energy_mix/energy_mix_disc.py b/energy_models/core/energy_mix/energy_mix_disc.py
index d2e81054..0d14ed6f 100644
--- a/energy_models/core/energy_mix/energy_mix_disc.py
+++ b/energy_models/core/energy_mix/energy_mix_disc.py
@@ -133,12 +133,12 @@ class Energy_Mix_Discipline(SoSWrapp):
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': 'ns_public'},
'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%'},
+ '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},
'syngas_prod_constraint_limit': {'type': 'float', 'default': 10000., 'unit': 'TWh', 'user_level': 2},
'ratio_ref': {'type': 'float', 'default': 500., 'unit': '-', 'user_level': 2},
@@ -196,6 +196,7 @@ class Energy_Mix_Discipline(SoSWrapp):
GlossaryEnergy.EnergyCapitalDfValue: GlossaryEnergy.EnergyCapitalDf,
GlossaryEnergy.EnergyMeanPriceObjectiveValue: GlossaryEnergy.EnergyMeanPriceObjective,
GlossaryEnergy.ConstraintEnergyNonUseCapital: {'type': 'dataframe', 'unit': '-', 'visibility': ClimateEcoDiscipline.SHARED_VISIBILITY, 'namespace': GlossaryEnergy.NS_FUNCTIONS},
+ GlossaryEnergy.ObjectiveEnergyNonUseCapital: {'type': 'array', 'unit': '-', 'visibility': ClimateEcoDiscipline.SHARED_VISIBILITY, 'namespace': GlossaryEnergy.NS_FUNCTIONS},
}
energy_name = EnergyMix.name
@@ -314,24 +315,24 @@ def setup_sos_disciplines(self):
dynamic_inputs[f'{ccs_name}.{GlossaryEnergy.StreamConsumptionValue}'] = {
'type': 'dataframe', 'unit': 'PWh', 'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_CCS,
- 'dynamic_dataframe_columns': True,}
+ 'dynamic_dataframe_columns': True, }
dynamic_inputs[f'{ccs_name}.{GlossaryEnergy.StreamConsumptionWithoutRatioValue}'] = {
'type': 'dataframe', 'unit': 'PWh', 'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_CCS,
- 'dynamic_dataframe_columns': True,}
+ 'dynamic_dataframe_columns': True, }
dynamic_inputs[f'{ccs_name}.{GlossaryEnergy.EnergyProductionValue}'] = {
'type': 'dataframe', 'unit': 'PWh', 'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_CCS,
- 'dynamic_dataframe_columns': True,}
+ 'dynamic_dataframe_columns': True, }
dynamic_inputs[f'{ccs_name}.{GlossaryEnergy.StreamPricesValue}'] = {
'type': 'dataframe', 'unit': '$/MWh', 'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_CCS,
- 'dynamic_dataframe_columns': True,}
+ 'dynamic_dataframe_columns': True, }
dynamic_inputs[f'{ccs_name}.{GlossaryEnergy.LandUseRequiredValue}'] = {
'type': 'dataframe', 'unit': 'Gha', 'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_CCS,
- 'dynamic_dataframe_columns': True,}
+ 'dynamic_dataframe_columns': True, }
if GlossaryEnergy.energy_list in self.get_data_in() and GlossaryEnergy.ccs_list in self.get_data_in():
energy_list = self.get_sosdisc_inputs(GlossaryEnergy.energy_list)
@@ -349,7 +350,7 @@ def setup_sos_disciplines(self):
def update_default_with_years(self, inputs_dict):
'''
- Update default variables knowing the year start and the year end
+ Update default variables knowing the year start and the year end
'''
if GlossaryEnergy.YearStart in self.get_data_in():
year_start, year_end = self.get_sosdisc_inputs([GlossaryEnergy.YearStart, GlossaryEnergy.YearEnd])
@@ -379,7 +380,6 @@ def run(self):
[(1. - alpha) * self.energy_model.production[GlossaryEnergy.TotalProductionValue][0] * delta_years
/ self.energy_model.production[GlossaryEnergy.TotalProductionValue].sum(), ])
-
if EnergyMix.PRODUCTION in self.energy_model.stream_prices:
self.energy_model.stream_prices.drop(
columns=[EnergyMix.PRODUCTION], inplace=True)
@@ -421,6 +421,7 @@ def run(self):
GlossaryEnergy.TargetProductionConstraintValue: self.energy_model.target_production_constraint,
GlossaryEnergy.EnergyMeanPriceObjectiveValue: self.energy_model.energy_mean_price_objective,
GlossaryEnergy.ConstraintEnergyNonUseCapital: self.energy_model.non_use_capital_constraint_df,
+ GlossaryEnergy.ObjectiveEnergyNonUseCapital: self.energy_model.non_use_capital_obj,
}
primary_energy_percentage = inputs_dict['primary_energy_percentage']
@@ -514,6 +515,7 @@ def compute_sos_jacobian(self):
# ---- Production / Consumption gradients----#
# -------------------------------------------#
d_non_use_capital, d_capital = self.energy_model.d_non_use_capital_constraint_d_capital()
+ d_non_use_capital_obj, d_capital_obj = self.energy_model.d_non_use_capital_obj_d_capital()
for stream in inputs_dict[GlossaryEnergy.energy_list] + inputs_dict[GlossaryEnergy.ccs_list]:
ns_stream = self.get_ns_stream(stream)
self.set_partial_derivative_for_other_types(
@@ -539,11 +541,23 @@ def compute_sos_jacobian(self):
d_non_use_capital
)
+ self.set_partial_derivative_for_other_types(
+ (GlossaryEnergy.ObjectiveEnergyNonUseCapital,),
+ (f'{ns_stream}.{GlossaryEnergy.EnergyTypeCapitalDfValue}', GlossaryEnergy.Capital),
+ d_capital_obj
+ )
+
+ self.set_partial_derivative_for_other_types(
+ (GlossaryEnergy.ObjectiveEnergyNonUseCapital,),
+ (f'{ns_stream}.{GlossaryEnergy.EnergyTypeCapitalDfValue}', GlossaryEnergy.NonUseCapital),
+ d_non_use_capital_obj
+ )
+
for stream in stream_list:
ns_stream = self.get_ns_stream(stream)
if stream in energies:
- loss_percentage = inputs_dict[f'{ns_stream}.losses_percentage'] / 100.0
+ loss_percentage = 0 # inputs_dict[f'{ns_stream}.losses_percentage'] / 100.0 # fixme : loss percentage by energy was considered in gradient but not in compute method so for the moment its also disabled in gradient to fix gradients
# To model raw to net percentage for witness coarse energies
if stream in self.energy_model.raw_tonet_dict:
loss_percentage += (1.0 -
@@ -557,18 +571,16 @@ def compute_sos_jacobian(self):
dtotal_prod_denergy_prod, inputs_dict['alpha'], outputs_dict[GlossaryEnergy.EnergyProductionValue],
years)
self.set_partial_derivative_for_other_types(
- (GlossaryEnergy.EnergyProductionValue,
- GlossaryEnergy.TotalProductionValue),
+ (GlossaryEnergy.EnergyProductionValue, GlossaryEnergy.TotalProductionValue),
(f'{ns_stream}.{GlossaryEnergy.EnergyProductionValue}', stream),
dtotal_prod_denergy_prod)
target_production_constraint_ref = inputs_dict[GlossaryEnergy.TargetProductionConstraintRefValue]
self.set_partial_derivative_for_other_types(
- (GlossaryEnergy.TargetProductionConstraintValue,),
+ (GlossaryEnergy.TargetProductionConstraintValue, GlossaryEnergy.TargetProductionConstraintValue),
(f'{ns_stream}.{GlossaryEnergy.EnergyProductionValue}', stream),
- dtotal_prod_denergy_prod * 1e3 / target_production_constraint_ref)
self.set_partial_derivative_for_other_types(
- (GlossaryEnergy.StreamProductionDetailedValue,
- GlossaryEnergy.TotalProductionValue),
+ (GlossaryEnergy.StreamProductionDetailedValue, GlossaryEnergy.TotalProductionValue),
(f'{ns_stream}.{GlossaryEnergy.EnergyProductionValue}', stream),
dtotal_prod_denergy_prod * scaling_factor_energy_production)
self.set_partial_derivative_for_other_types(
@@ -665,7 +677,7 @@ def compute_sos_jacobian(self):
f'{stream} ({GlossaryEnergy.unit_dicts[stream]})'),
scaling_factor_energy_consumption * dtotal_prod_denergy_cons / scaling_factor_energy_production)
self.set_partial_derivative_for_other_types(
- (GlossaryEnergy.TargetProductionConstraintValue,), (
+ (GlossaryEnergy.TargetProductionConstraintValue, GlossaryEnergy.TargetProductionConstraintValue), (
f'{ns_stream_input}.{GlossaryEnergy.StreamConsumptionValue}',
f'{stream} ({GlossaryEnergy.unit_dicts[stream]})'),
- scaling_factor_energy_consumption * dtotal_prod_denergy_cons / scaling_factor_energy_production * 1e3 / target_production_constraint_ref)
@@ -769,14 +781,14 @@ def compute_sos_jacobian(self):
for stream_input in stream_list:
ns_stream_input = self.get_ns_stream(stream_input)
list_columns_energy_consumption = list(inputs_dict[f'{stream_input}.{GlossaryEnergy.StreamConsumptionValue}'].columns)
- if f'{stream} ({GlossaryEnergy.unit_dicts[stream]})' in list_columns_energy_consumption:#F or stream_input == GlossaryEnergy.carbon_storage:
+ if f'{stream} ({GlossaryEnergy.unit_dicts[stream]})' in list_columns_energy_consumption: # F or stream_input == GlossaryEnergy.carbon_storage:
self.set_partial_derivative_for_other_types(
(GlossaryEnergy.StreamProductionDetailedValue, f'production {stream} ({GlossaryEnergy.unit_dicts[stream]})'),
(f'{ns_stream_input}.{GlossaryEnergy.StreamConsumptionValue}', f'{stream} ({GlossaryEnergy.unit_dicts[stream]})'),
-scaling_factor_energy_consumption * np.identity(
- len(years)) / scaling_factor_energy_production * scaling_factor_energy_production* 0)
+ len(years)) / scaling_factor_energy_production * scaling_factor_energy_production * 0)
- if f'{stream} ({GlossaryEnergy.unit_dicts[stream]})' in list_columns_energy_consumption:# or stream_input == GlossaryEnergy.carbon_capture:
+ if f'{stream} ({GlossaryEnergy.unit_dicts[stream]})' in list_columns_energy_consumption: # or stream_input == GlossaryEnergy.carbon_capture:
self.set_partial_derivative_for_other_types(
(GlossaryEnergy.StreamProductionDetailedValue, f'production {stream} ({GlossaryEnergy.unit_dicts[stream]})'),
(f'{ns_stream_input}.{GlossaryEnergy.StreamConsumptionValue}', f'{stream} ({GlossaryEnergy.unit_dicts[stream]})'),
@@ -1018,7 +1030,7 @@ def compute_sos_jacobian(self):
if f'{stream} ({GlossaryEnergy.unit_dicts[stream]})' in list_columns_energy_consumption:
self.set_partial_derivative_for_other_types(
(GlossaryEnergy.AllStreamsDemandRatioValue, f'{stream}'),
- (f'{ns_stream_input}.{GlossaryEnergy.StreamConsumptionWithoutRatioValue}',f'{stream} ({GlossaryEnergy.unit_dicts[stream]})'),
+ (f'{ns_stream_input}.{GlossaryEnergy.StreamConsumptionWithoutRatioValue}', f'{stream} ({GlossaryEnergy.unit_dicts[stream]})'),
ddemand_ratio_denergy_cons)
dobjective_dcons = np.matmul(dobjective_dratio_energy, ddemand_ratio_denergy_cons)
self.set_partial_derivative_for_other_types(
@@ -1087,7 +1099,7 @@ def set_gradient_for_co2_emissions(self, co2_variable, co2_emissions, co2_emissi
def compute_dratio_objective(self, stream_ratios, ratio_ref, energy_list):
'''
- Compute the ratio_objective with the gradient of stream_ratios vs any input and the ratio ojective value
+ Compute the ratio_objective with the gradient of stream_ratios vs any input and the ratio ojective value
obj = smooth_maximum(100.0 - ratio_arrays, 3)/ratio_ref
dobj/dratio = -dsmooth_max(100.0 - ratio_arrays, 3)/ratio_ref
@@ -1166,8 +1178,8 @@ def compute_ddemand_ratio_denergy_production(self, energy, sub_production_dict,
'''! Compute the gradient of the demand ratio vs energy production function :
-the ratio is capped to one if energy_prod>energy_cons, hence the special condition.
-the function is designed to be used even if no energy_input is specified (to get ddemand_ratio_denergy_prod gradient alone)
- @param energy: string, name of the energy
- @param sub_production_dict: dictionary with the raw production for all the energies
+ @param energy: string, name of the energy
+ @param sub_production_dict: dictionary with the raw production for all the energies
@param sub_consumption_dict: dictionary with the raw consumption for all energies
@param scaling_factor_production: float used to scale the energy production at input/output of the model
@return ddemand_ratio_denergy_prod, ddemand_ratio_denergy_cons: numpy.arrays, shape=(len(years),len(years)) with the gradients
@@ -1234,13 +1246,13 @@ def compute_dmean_price_dprod(self, energy, energies, mix_weight, energy_price_a
production_energy_net_pos_consumable, production_detailed_df, cons=False):
"""
Function that returns the gradient of mean_price compared to energy_prod
- Params:
+ Params:
- energy: name of the energy derived by
- energies: list of all the energies
- mix_weight: dataframe of the energies ratio
- - energy_price_after_tax: dataframe with values
+ - energy_price_after_tax: dataframe with values
- production_energy_net_pos_consumable: dataframe with values
- - production_detailed_df: dataframe with values
+ - production_detailed_df: dataframe with values
Output:
- dmean_price_dprod
"""
@@ -1864,7 +1876,7 @@ def get_chart_co2_limited_storage(self):
def get_chart_co2_emissions_sources(self):
'''
- Plot all CO2 emissions sources
+ Plot all CO2 emissions sources
'''
chart_name = 'CO2 emissions sources'
co2_emissions = self.get_sosdisc_outputs('co2_emissions')
@@ -1905,7 +1917,7 @@ def get_chart_co2_emissions_sources(self):
def get_chart_co2_needed_by_energy_mix(self):
'''
- Plot all CO2 emissions sinks
+ Plot all CO2 emissions sinks
'''
chart_name = 'CO2 emissions sinks'
co2_emissions = self.get_sosdisc_outputs(
@@ -1953,7 +1965,7 @@ def get_chart_stream_ratio(self):
def get_chart_energy_mix_losses(self, energy_list):
'''
- Plot chart on energy mix heat losses
+ Plot chart on energy mix heat losses
'''
chart_name = 'Energy mix losses'
diff --git a/energy_models/core/investments/disciplines/independent_invest_disc.py b/energy_models/core/investments/disciplines/independent_invest_disc.py
index 5e05fd84..35e55a9a 100644
--- a/energy_models/core/investments/disciplines/independent_invest_disc.py
+++ b/energy_models/core/investments/disciplines/independent_invest_disc.py
@@ -215,7 +215,7 @@ def compute_sos_jacobian(self):
ones * 1e-3)
self.set_partial_derivative_for_other_types(
- (GlossaryEnergy.MaxBudgetConstraintValue,),
+ (GlossaryEnergy.MaxBudgetConstraintValue, GlossaryEnergy.MaxBudgetConstraintValue),
(GlossaryEnergy.invest_mix, techno),
identity / max_budget_constraint_ref)
@@ -235,7 +235,7 @@ def compute_sos_jacobian(self):
ones * 1e-3)
self.set_partial_derivative_for_other_types(
- (GlossaryEnergy.MaxBudgetConstraintValue,),
+ (GlossaryEnergy.MaxBudgetConstraintValue, GlossaryEnergy.MaxBudgetConstraintValue),
(GlossaryEnergy.ForestInvestmentValue, GlossaryEnergy.ForestInvestmentValue),
identity / max_budget_constraint_ref)
@@ -253,7 +253,7 @@ def compute_sos_jacobian(self):
ones * 1e-3)
self.set_partial_derivative_for_other_types(
- (GlossaryEnergy.MaxBudgetConstraintValue,),
+ (GlossaryEnergy.MaxBudgetConstraintValue, GlossaryEnergy.MaxBudgetConstraintValue),
(techno, GlossaryEnergy.InvestmentsValue),
identity / max_budget_constraint_ref)
diff --git a/energy_models/core/investments/independent_invest.py b/energy_models/core/investments/independent_invest.py
index 38b73c85..1a74f3da 100644
--- a/energy_models/core/investments/independent_invest.py
+++ b/energy_models/core/investments/independent_invest.py
@@ -69,7 +69,12 @@ def compute_energy_investment_wo_tax(self, inputs_dict: dict):
return energy_investment_wo_tax
def compute_max_budget_constraint(self, energy_investment_wo_tax: np.ndarray, inputs_dict: dict):
+ """should be negative"""
max_budget_constraint_ref = inputs_dict[GlossaryEnergy.MaxBudgetConstraintRefValue]
max_budget = inputs_dict[GlossaryEnergy.MaxBudgetValue][GlossaryEnergy.MaxBudgetValue].values
overspending = energy_investment_wo_tax[GlossaryEnergy.EnergyInvestmentsWoTaxValue].values * 1000 - max_budget
- return overspending / max_budget_constraint_ref
+ max_budget_constraint_df = pd.DataFrame({
+ GlossaryEnergy.Years: inputs_dict[GlossaryEnergy.invest_mix][GlossaryEnergy.Years],
+ GlossaryEnergy.MaxBudgetConstraintValue: overspending / max_budget_constraint_ref
+ })
+ return max_budget_constraint_df
diff --git a/energy_models/core/techno_type/disciplines/carbon_capture_techno_disc.py b/energy_models/core/techno_type/disciplines/carbon_capture_techno_disc.py
index d71723c4..c845ecbb 100644
--- a/energy_models/core/techno_type/disciplines/carbon_capture_techno_disc.py
+++ b/energy_models/core/techno_type/disciplines/carbon_capture_techno_disc.py
@@ -271,11 +271,11 @@ def get_chart_detailed_price_in_dollar_tCO2(self):
new_chart.series.append(serie)
- if 'energy_costs' in techno_detailed_prices:
+ if 'energy_and_resources_costs' in techno_detailed_prices:
# energy_costs
serie = InstanciatedSeries(
techno_detailed_prices[GlossaryEnergy.Years].values.tolist(),
- techno_detailed_prices['energy_costs'].values.tolist(), 'Energy costs', 'lines')
+ techno_detailed_prices['energy_and_resources_costs'].values.tolist(), 'Energy costs', 'lines')
new_chart.series.append(serie)
diff --git a/energy_models/core/techno_type/disciplines/carbon_storage_techno_disc.py b/energy_models/core/techno_type/disciplines/carbon_storage_techno_disc.py
index 02704b57..dd27c36f 100644
--- a/energy_models/core/techno_type/disciplines/carbon_storage_techno_disc.py
+++ b/energy_models/core/techno_type/disciplines/carbon_storage_techno_disc.py
@@ -176,11 +176,11 @@ def get_chart_detailed_price_in_dollar_ton(self):
new_chart.series.append(serie)
- if 'energy_costs' in techno_detailed_prices:
+ if 'energy_and_resources_costs' in techno_detailed_prices:
# energy_costs
serie = InstanciatedSeries(
techno_detailed_prices[GlossaryEnergy.Years].values.tolist(),
- techno_detailed_prices['energy_costs'].values.tolist(), 'Energy costs', 'lines')
+ techno_detailed_prices['energy_and_resources_costs'].values.tolist(), 'Energy costs', 'lines')
new_chart.series.append(serie)
diff --git a/energy_models/core/techno_type/techno_disc.py b/energy_models/core/techno_type/techno_disc.py
index 9043dc60..b6ed91d5 100644
--- a/energy_models/core/techno_type/techno_disc.py
+++ b/energy_models/core/techno_type/techno_disc.py
@@ -110,7 +110,8 @@ class TechnoDiscipline(SoSWrapp):
}},
GlossaryEnergy.InstalledPower: GlossaryEnergy.InstalledPowerDf,
GlossaryEnergy.TechnoCapitalValue: GlossaryEnergy.TechnoCapitalDf,
- GlossaryEnergy.SpecificCostsForProductionValue: GlossaryEnergy.SpecificCostsForProduction
+ GlossaryEnergy.SpecificCostsForProductionValue: GlossaryEnergy.SpecificCostsForProduction,
+ GlossaryEnergy.InitialPlantsTechnoProductionValue: GlossaryEnergy.InitialPlantsTechnoProduction,
}
_maturity = 'Research'
@@ -238,15 +239,16 @@ def update_default_values(self):
self.update_default_value(GlossaryEnergy.LifetimeName, 'in', lifetime)
if GlossaryEnergy.InitialPlantsAgeDistribFactor in self.get_data_in() and GlossaryEnergy.YearStart in self.get_data_in():
+ initial_plant_age_distrib_factor = self.get_sosdisc_inputs(GlossaryEnergy.InitialPlantsAgeDistribFactor)
year_start = self.get_sosdisc_inputs(GlossaryEnergy.YearStart)
- if year_start is not None:
+ if year_start is not None and initial_plant_age_distrib_factor is None:
initial_plant_age_distrib_factor, _ = DatabaseWitnessEnergy.get_techno_age_distrib_factor(self.techno_name, year=year_start)
self.update_default_value(GlossaryEnergy.InitialPlantsAgeDistribFactor, 'in', initial_plant_age_distrib_factor)
if 'initial_production' in self.get_data_in() and GlossaryEnergy.YearStart in self.get_data_in():
year_start = self.get_sosdisc_inputs(GlossaryEnergy.YearStart)
if year_start is not None:
- initial_production, _ = DatabaseWitnessEnergy.get_techno_prod(self.techno_name, year=year_start)
+ initial_production, _ = DatabaseWitnessEnergy.get_techno_prod(self.techno_name, year=year_start - 1)
self.update_default_value('initial_production', 'in', initial_production)
construction_delay = None
@@ -326,6 +328,7 @@ def run(self):
GlossaryEnergy.CostOfStreamsUsageValue: self.techno_model.cost_of_streams_usage,
GlossaryEnergy.SpecificCostsForProductionValue: self.techno_model.specific_costs,
'initial_age_distrib': self.techno_model.initial_age_distrib,
+ GlossaryEnergy.InitialPlantsTechnoProductionValue: self.techno_model.initial_plants_historical_prod,
}
self.store_sos_outputs_values(outputs_dict)
@@ -900,9 +903,9 @@ def get_chart_detailed_price_in_dollar_kwh(self):
new_chart.series.append(serie)
- if 'energy_costs' in techno_detailed_prices:
+ if 'energy_and_resources_costs' in techno_detailed_prices:
# energy_costs
- ec_price_mwh = techno_detailed_prices['energy_costs'].values
+ ec_price_mwh = techno_detailed_prices['energy_and_resources_costs'].values
serie = InstanciatedSeries(
techno_detailed_prices[GlossaryEnergy.Years].values.tolist(),
ec_price_mwh.tolist(), 'Energy costs', 'bar')
@@ -969,9 +972,9 @@ def get_chart_detailed_price_in_dollar_kg(self):
techno_kg_price.tolist(), 'Factory', 'bar')
new_chart.series.append(serie)
- if 'energy_costs' in techno_detailed_prices:
+ if 'energy_and_resources_costs' in techno_detailed_prices:
# energy_costs
- techno_kg_price = techno_detailed_prices['energy_costs'].values * \
+ techno_kg_price = techno_detailed_prices['energy_and_resources_costs'].values * \
data_fuel_dict['calorific_value']
serie = InstanciatedSeries(
techno_detailed_prices[GlossaryEnergy.Years].values.tolist(),
@@ -1139,7 +1142,7 @@ def get_chart_initial_production(self):
initial_prod['cum energy (TWh)'] = initial_prod['energy (TWh)'].cumsum(
)
study_production = self.get_sosdisc_outputs(GlossaryEnergy.TechnoDetailedProductionValue)
- chart_name = f'{self.energy_name} World Production via {self.techno_name}
with 2020 factories distribution'
+ chart_name = f'{self.energy_name} World Production via {self.techno_name}
with {year_start} factories distribution'
new_chart = TwoAxesInstanciatedChart(GlossaryEnergy.Years, f'{self.energy_name} production [TWh]',
chart_name=chart_name.capitalize())
diff --git a/energy_models/core/techno_type/techno_type.py b/energy_models/core/techno_type/techno_type.py
index db549820..fec18ab8 100644
--- a/energy_models/core/techno_type/techno_type.py
+++ b/energy_models/core/techno_type/techno_type.py
@@ -49,6 +49,7 @@ class TechnoType:
min_value_invest = 1.e-12
def __init__(self, name):
+ self.initial_plants_historical_prod = None
self.lifetime: int = 20
self.initial_age_distrib_distrib_factor: float = 1.
self.construction_delay: int = 0
@@ -407,7 +408,7 @@ def compute_price(self):
self.cost_details['transport'] = self.compute_transport()
self.cost_details[self.name] = self.cost_details[f'{self.name}_factory'].values + self.cost_details['transport'].values + \
- self.cost_details['energy_costs'].values
+ self.cost_details['energy_and_resources_costs'].values
# Add margin in %
# self.cost_details[GlossaryEnergy.MarginValue] = self.cost_details[self.name] * self.margin.loc[self.margin[GlossaryEnergy.Years]<= self.cost_details[GlossaryEnergy.Years].max()][GlossaryEnergy.MarginValue].values / 100.0
@@ -436,7 +437,7 @@ def compute_price(self):
# pylint: enable=no-member
self.cost_details[f'{self.name}_amort'] = self.cost_details[f'{self.name}_factory_amort'].values + \
self.cost_details['transport'].values + \
- self.cost_details['energy_costs'].values
+ self.cost_details['energy_and_resources_costs'].values
self.cost_details[f'{self.name}_amort'] *= self.margin.loc[self.margin[GlossaryEnergy.Years]
<= self.cost_details[
GlossaryEnergy.Years].max()][
@@ -458,7 +459,7 @@ def compute_price(self):
# Running OPEX in ($/MWh)
self.cost_details['OPEX_Part'] = self.cost_details[f'Capex_{self.name}'].values * \
(self.techno_infos_dict['Opex_percentage']) + \
- self.cost_details['transport'].values + self.cost_details['energy_costs'].values
+ self.cost_details['transport'].values + self.cost_details['energy_and_resources_costs'].values
# CO2 Tax in ($/MWh)
self.cost_details['CO2Tax_Part'] = self.cost_details[self.name].values - \
self.cost_details[f'{self.name}_wotaxes'].values
@@ -498,7 +499,7 @@ def compute_other_primary_energy_costs(self):
self.compute_other_streams_needs()
self.compute_cost_of_other_streams_usage()
self.compute_specifif_costs_of_technos()
- self.compute_sum_all_costs()
+ self.compute_energy_and_resources_costs()
def is_invest_before_year(self, year):
'''
@@ -1018,7 +1019,7 @@ def compute_prod_from_invest(self):
GlossaryEnergy.InvestValue: invest_before_year_start,
f'Capex_{self.name}': capex_year_start
})
- invests_after_year_start_df = self.cost_details[[GlossaryEnergy.Years, GlossaryEnergy.InvestValue, f'Capex_{self.name}']]
+ invests_after_year_start_df = self.cost_details[[GlossaryEnergy.Years, GlossaryEnergy.InvestValue, f'Capex_{self.name}']].copy()
prod_from_invests_df = pd.concat([invest_before_year_start_df, invests_after_year_start_df], ignore_index=True) if len(invest_before_year_start) > 0 else invests_after_year_start_df
# Need prod_from invest in TWh we have M$ and $/MWh M$/($/MWh)= TWh
@@ -1131,11 +1132,11 @@ def store_consumption_and_production_and_landuse_wo_ratios(self):
self.consumption_woratio = copy(self.consumption_detailed)
self.land_use_woratio = copy(self.land_use)
- def compute_sum_all_costs(self):
+ def compute_energy_and_resources_costs(self):
all_costs = self.cost_of_resources_usage[self.resources_used_for_production].values.sum(axis=1) + \
self.cost_of_streams_usage[self.streams_used_for_production].values.sum(axis=1) + \
self.specific_costs.drop(GlossaryEnergy.Years, axis=1).values.sum(axis=1)
- self.cost_details['energy_costs'] = all_costs
+ self.cost_details['energy_and_resources_costs'] = all_costs
def compute_co2_emissions_from_ressources_usage(self):
"""Computes the co2 emissions due to resources usage"""
@@ -1162,6 +1163,7 @@ def compute(self, inputs_dict):
# -- compute informations
self.compute_initial_age_distribution()
self.compute_price()
+ self.compute_initial_plants_historical_prod()
self.compute_primary_energy_production()
self.compute_land_use()
self.compute_resource_consumption()
@@ -1563,4 +1565,15 @@ def compute_initial_age_distribution(self):
self.initial_age_distrib = pd.DataFrame({
"age": np.arange(1, self.lifetime),
"distrib": distrib
- })
\ No newline at end of file
+ })
+
+ def compute_initial_plants_historical_prod(self):
+ energy = self.initial_age_distrib['distrib'] / 100.0 * self.initial_production
+
+ self.initial_plants_historical_prod = pd.DataFrame({
+ GlossaryEnergy.Years: self.year_start - self.initial_age_distrib['age'],
+ f'energy ({self.product_unit})': energy,
+ })
+
+ self.initial_plants_historical_prod.sort_values(GlossaryEnergy.Years, inplace=True)
+ self.initial_plants_historical_prod[f'cum energy ({self.product_unit})'] = self.initial_plants_historical_prod[f'energy ({self.product_unit})'].cumsum()
\ No newline at end of file
diff --git a/energy_models/database_witness_energy.py b/energy_models/database_witness_energy.py
index 585d2478..851b01ec 100644
--- a/energy_models/database_witness_energy.py
+++ b/energy_models/database_witness_energy.py
@@ -87,7 +87,7 @@ class DatabaseWitnessEnergy:
invest_before_year_start_folder = join(Path(__file__).parents[1], "data_energy", "techno_invests")
@classmethod
- def get_techno_invest(cls, techno_name: str, year: int):
+ def get_techno_invest(cls, techno_name: str, year: int) -> float:
name_formatted = techno_name.replace(".", "_")
name_formatted = name_formatted.lower()
path_to_csv = os.path.join(cls.invest_before_year_start_folder, name_formatted) + ".csv"
@@ -103,6 +103,23 @@ def get_techno_invest(cls, techno_name: str, year: int):
)
return heavy_collected_data.get_value_at_year(year=year)
+ @classmethod
+ def get_techno_invest_df(cls, techno_name: str) -> pd.DataFrame:
+ name_formatted = techno_name.replace(".", "_")
+ name_formatted = name_formatted.lower()
+ path_to_csv = os.path.join(cls.invest_before_year_start_folder, name_formatted) + ".csv"
+ heavy_collected_data = HeavyCollectedData(
+ value=path_to_csv,
+ description="",
+ unit="G$",
+ link="",
+ source="",
+ last_update_date=datetime.datetime.today(),
+ critical_at_year_start=True,
+ column_to_pick="invest"
+ )
+ return heavy_collected_data.value
+
@classmethod
def get_techno_invest_before_year_start(cls, techno_name: str, year_start: int, construction_delay: int, is_available_at_year: bool = False):
name_formatted = techno_name.replace(".", "_")
diff --git a/energy_models/glossaryenergy.py b/energy_models/glossaryenergy.py
index 4489b42c..ccc1c260 100644
--- a/energy_models/glossaryenergy.py
+++ b/energy_models/glossaryenergy.py
@@ -338,10 +338,18 @@ class GlossaryEnergy(GlossaryWitnessCore):
[1900, GlossaryWitnessCore.YearEndDefault],
False,
),
- GlossaryWitnessCore.UtilisationRatioValue: ("float", [0, 100], False),
+ GlossaryWitnessCore.UtilisationRatioValue: ("float", [0, 100.1], False),
},
}
+ InitialPlantsTechnoProductionValue = "InitialPlantsTechnoProduction"
+ InitialPlantsTechnoProduction = {
+ "varname": InitialPlantsTechnoProductionValue,
+ "type": "dataframe",
+ "unit": "TWh",
+ "dynamic_dataframe_columns": True,
+ }
+
EnergyTypeCapitalDfValue = "energy_type_capital"
EnergyTypeCapitalDf = {
"var_name": EnergyTypeCapitalDfValue,
@@ -1482,7 +1490,7 @@ def get_techno_detailed_price_df(cls, techno_name: str):
f"Capex_{techno_name}": ("float", None, False),
cls.InvestValue: ("float", None, False),
"efficiency": ("float", None, False),
- "energy_costs": ("float", None, False),
+ "energy_and_resources_costs": ("float", None, False),
"transport": ("float", None, False),
f"{techno_name}_factory": ("float", None, False),
cls.MarginValue: ("float", None, False),
diff --git a/energy_models/models/clean_energy/clean_energy_simple_techno/clean_energy_simple_techno_disc.py b/energy_models/models/clean_energy/clean_energy_simple_techno/clean_energy_simple_techno_disc.py
index b618956a..655160bf 100644
--- a/energy_models/models/clean_energy/clean_energy_simple_techno/clean_energy_simple_techno_disc.py
+++ b/energy_models/models/clean_energy/clean_energy_simple_techno/clean_energy_simple_techno_disc.py
@@ -53,16 +53,16 @@ class CleanEnergySimpleTechnoDiscipline(CleanEnergyTechnoDiscipline):
clean_energy_capital = 12.414 # trillion dollars
techno_infos_dict_default = {'maturity': 0,
- 'Opex_percentage': 0.12,
+ 'Opex_percentage': 0.06,
'WACC': 0.058,
- 'learning_rate': 0.00,
- 'Capex_init': 230.0,
+ 'learning_rate': 0.01,
+ 'Capex_init': 572.,
'Capex_init_unit': '$/MWh',
'techno_evo_eff': 'no',
'efficiency': 1.0,
'CO2_from_production': 0.0,
'CO2_from_production_unit': 'kg/kg',
- 'resource_price': 70.0,
+ 'resource_price': 10.0,
'resource_price_unit': '$/MWh'}
techno_info_dict = techno_infos_dict_default
diff --git a/energy_models/models/fossil/fossil_simple_techno/fossil_simple_techno_disc.py b/energy_models/models/fossil/fossil_simple_techno/fossil_simple_techno_disc.py
index f1548387..44cbfca0 100644
--- a/energy_models/models/fossil/fossil_simple_techno/fossil_simple_techno_disc.py
+++ b/energy_models/models/fossil/fossil_simple_techno/fossil_simple_techno_disc.py
@@ -69,16 +69,16 @@ class FossilSimpleTechnoDiscipline(FossilTechnoDiscipline):
FossilGasDiscipline.techno_infos_dict_default['CO2_from_production'] * prod_methane) / prod_fossil
techno_infos_dict_default = {'maturity': 0,
- 'Opex_percentage': 0.024,
+ 'Opex_percentage': 0.299,
'WACC': 0.058,
'learning_rate': 0.00,
- 'Capex_init': 100.,
+ 'Capex_init': 222.64,
'Capex_init_unit': '$/MWh',
'techno_evo_eff': 'no',
'efficiency': 1.0,
'CO2_from_production': co2_from_prod,
'CO2_from_production_unit': 'kg/kg',
- 'resource_price': 75.0,
+ 'resource_price': 35.0,
'resource_price_unit': '$/MWh',
'CH4_venting_emission_factor': (21.9 + 7.2) / 50731.,
'CH4_flaring_emission_factor': (1.4 + 6.9) / 50731.,
diff --git a/energy_models/models/gaseous_hydrogen/water_gas_shift/water_gas_shift_disc.py b/energy_models/models/gaseous_hydrogen/water_gas_shift/water_gas_shift_disc.py
index 9cab9bb4..de53890f 100644
--- a/energy_models/models/gaseous_hydrogen/water_gas_shift/water_gas_shift_disc.py
+++ b/energy_models/models/gaseous_hydrogen/water_gas_shift/water_gas_shift_disc.py
@@ -176,7 +176,7 @@ def compute_sos_jacobian(self):
dwater_dsyngas_ratio / 100.0)
self.set_partial_derivative_for_other_types(
- (GlossaryEnergy.TechnoDetailedPricesValue, 'energy_costs'), ('syngas_ratio',),
+ (GlossaryEnergy.TechnoDetailedPricesValue, 'energy_and_resources_costs'), ('syngas_ratio',),
(dsyngas_dsyngas_ratio + dwater_dsyngas_ratio) / 100.0)
mol_H2 = (1.0 + syngas_ratio) / \
diff --git a/energy_models/models/heat/high/electric_boiler_high_heat/electric_boiler_high_heat.py b/energy_models/models/heat/high/electric_boiler_high_heat/electric_boiler_high_heat.py
index 6360131d..0232e784 100644
--- a/energy_models/models/heat/high/electric_boiler_high_heat/electric_boiler_high_heat.py
+++ b/energy_models/models/heat/high/electric_boiler_high_heat/electric_boiler_high_heat.py
@@ -41,7 +41,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/high/geothermal_high_heat/geothermal_high_heat.py b/energy_models/models/heat/high/geothermal_high_heat/geothermal_high_heat.py
index cebc8d1d..44a64238 100644
--- a/energy_models/models/heat/high/geothermal_high_heat/geothermal_high_heat.py
+++ b/energy_models/models/heat/high/geothermal_high_heat/geothermal_high_heat.py
@@ -58,7 +58,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/high/heat_pump_high_heat/heat_pump_high_heat.py b/energy_models/models/heat/high/heat_pump_high_heat/heat_pump_high_heat.py
index 4c18e41f..cb792fb4 100644
--- a/energy_models/models/heat/high/heat_pump_high_heat/heat_pump_high_heat.py
+++ b/energy_models/models/heat/high/heat_pump_high_heat/heat_pump_high_heat.py
@@ -54,7 +54,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/high/natural_gas_boiler_high_heat/natural_gas_boiler_high_heat.py b/energy_models/models/heat/high/natural_gas_boiler_high_heat/natural_gas_boiler_high_heat.py
index ace5d72b..c25db254 100644
--- a/energy_models/models/heat/high/natural_gas_boiler_high_heat/natural_gas_boiler_high_heat.py
+++ b/energy_models/models/heat/high/natural_gas_boiler_high_heat/natural_gas_boiler_high_heat.py
@@ -75,7 +75,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/low/electric_boiler_low_heat/electric_boiler_low_heat.py b/energy_models/models/heat/low/electric_boiler_low_heat/electric_boiler_low_heat.py
index 8b6a3825..e79ae4f4 100644
--- a/energy_models/models/heat/low/electric_boiler_low_heat/electric_boiler_low_heat.py
+++ b/energy_models/models/heat/low/electric_boiler_low_heat/electric_boiler_low_heat.py
@@ -47,7 +47,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/low/geothermal_low_heat/geothermal_low_heat.py b/energy_models/models/heat/low/geothermal_low_heat/geothermal_low_heat.py
index 1860abe8..bae05328 100644
--- a/energy_models/models/heat/low/geothermal_low_heat/geothermal_low_heat.py
+++ b/energy_models/models/heat/low/geothermal_low_heat/geothermal_low_heat.py
@@ -68,7 +68,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/low/heat_pump_low_heat/heat_pump_low_heat.py b/energy_models/models/heat/low/heat_pump_low_heat/heat_pump_low_heat.py
index 91438ab6..976239e5 100644
--- a/energy_models/models/heat/low/heat_pump_low_heat/heat_pump_low_heat.py
+++ b/energy_models/models/heat/low/heat_pump_low_heat/heat_pump_low_heat.py
@@ -56,7 +56,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/low/natural_gas_boiler_low_heat/natural_gas_boiler_low_heat.py b/energy_models/models/heat/low/natural_gas_boiler_low_heat/natural_gas_boiler_low_heat.py
index d028b290..ffcb9831 100644
--- a/energy_models/models/heat/low/natural_gas_boiler_low_heat/natural_gas_boiler_low_heat.py
+++ b/energy_models/models/heat/low/natural_gas_boiler_low_heat/natural_gas_boiler_low_heat.py
@@ -75,7 +75,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/medium/electric_boiler_medium_heat/electric_boiler_medium_heat.py b/energy_models/models/heat/medium/electric_boiler_medium_heat/electric_boiler_medium_heat.py
index daa9774c..bfd17259 100644
--- a/energy_models/models/heat/medium/electric_boiler_medium_heat/electric_boiler_medium_heat.py
+++ b/energy_models/models/heat/medium/electric_boiler_medium_heat/electric_boiler_medium_heat.py
@@ -47,7 +47,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/medium/geothermal_medium_heat/geothermal_medium_heat.py b/energy_models/models/heat/medium/geothermal_medium_heat/geothermal_medium_heat.py
index 5013f2ff..bc05b8f6 100644
--- a/energy_models/models/heat/medium/geothermal_medium_heat/geothermal_medium_heat.py
+++ b/energy_models/models/heat/medium/geothermal_medium_heat/geothermal_medium_heat.py
@@ -68,7 +68,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/medium/heat_pump_medium_heat/heat_pump_medium_heat.py b/energy_models/models/heat/medium/heat_pump_medium_heat/heat_pump_medium_heat.py
index 4a5830ec..fb3058a3 100644
--- a/energy_models/models/heat/medium/heat_pump_medium_heat/heat_pump_medium_heat.py
+++ b/energy_models/models/heat/medium/heat_pump_medium_heat/heat_pump_medium_heat.py
@@ -55,7 +55,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/models/heat/medium/natural_gas_boiler_medium_heat/natural_gas_boiler_medium_heat.py b/energy_models/models/heat/medium/natural_gas_boiler_medium_heat/natural_gas_boiler_medium_heat.py
index d50f4633..cb8d5547 100644
--- a/energy_models/models/heat/medium/natural_gas_boiler_medium_heat/natural_gas_boiler_medium_heat.py
+++ b/energy_models/models/heat/medium/natural_gas_boiler_medium_heat/natural_gas_boiler_medium_heat.py
@@ -76,7 +76,7 @@ def configure_input(self, inputs_dict):
def compute_heat_flux(self):
land_rate = self.land_rate
- self.heat_flux = land_rate / self.cost_details['energy_costs'].values
+ self.heat_flux = land_rate / self.cost_details['energy_and_resources_costs'].values
self.heat_flux_distribution = pd.DataFrame({GlossaryEnergy.Years: self.cost_details[GlossaryEnergy.Years],
'heat_flux': self.heat_flux})
return self.heat_flux_distribution
diff --git a/energy_models/sos_processes/energy/MDA/energy_mix_optim_sub_process/usecase.py b/energy_models/sos_processes/energy/MDA/energy_mix_optim_sub_process/usecase.py
index 23493bb0..a95b402e 100644
--- a/energy_models/sos_processes/energy/MDA/energy_mix_optim_sub_process/usecase.py
+++ b/energy_models/sos_processes/energy/MDA/energy_mix_optim_sub_process/usecase.py
@@ -104,7 +104,6 @@ def __init__(
self.bspline = bspline
self.invest_discipline = INVEST_DISCIPLINE_OPTIONS[2]
self.test_post_procs = False
-
def create_study_list(self):
self.sub_study_dict = {}
@@ -235,7 +234,7 @@ def setup_usecase_sub_study_list(self, merge_design_spaces=False):
instanced_sub_studies = []
dspace_list = []
for sub_study_name, sub_study in self.sub_study_dict.items():
- instance_sub_study = None # initialize variable
+ instance_sub_study = None # initialize variable
if self.techno_dict[sub_study_name][GlossaryEnergy.stream_type] == GlossaryEnergy.ccus_type:
prefix_name = f"{GlossaryEnergy.ccus_type}"
instance_sub_study = sub_study(
@@ -320,7 +319,6 @@ def get_dvar_dscriptor(self):
'namespace_out': GlossaryEnergy.NS_WITNESS
}
-
for ccs in self.ccs_list:
ccs_wo_dot = ccs.replace('.', '_')
for technology in self.dict_technos[ccs]:
@@ -407,12 +405,12 @@ def make_dspace_utilisation_ratio(self) -> pd.DataFrame:
def make_func_df(self):
func_df = pd.DataFrame({
- "variable": [GlossaryEnergy.CO2EmissionsObjectiveValue, GlossaryEnergy.TargetProductionConstraintValue, GlossaryEnergy.MaxBudgetConstraintValue,],
- "parent": ["objectives", "constraints", "constraints"],
- "ftype": [FunctionManagerDisc.OBJECTIVE, FunctionManagerDisc.INEQ_CONSTRAINT, FunctionManagerDisc.INEQ_CONSTRAINT] ,
- "weight": [1.0, 100.0, 100.0,],
- FunctionManagerDisc.AGGR_TYPE: [FunctionManager.AGGR_TYPE_SUM, FunctionManager.AGGR_TYPE_SUM, FunctionManager.AGGR_TYPE_SUM,],
- "namespace": [GlossaryEnergy.NS_FUNCTIONS, GlossaryEnergy.NS_FUNCTIONS, GlossaryEnergy.NS_FUNCTIONS,]
+ "variable": [GlossaryEnergy.CO2EmissionsObjectiveValue, GlossaryEnergy.CO2EmissionsObjectiveValue, GlossaryEnergy.TargetProductionConstraintValue, GlossaryEnergy.MaxBudgetConstraintValue,],
+ "parent": ["objectives", "objectives", "constraints", "constraints"],
+ "ftype": [FunctionManagerDisc.OBJECTIVE, FunctionManagerDisc.OBJECTIVE, FunctionManagerDisc.INEQ_CONSTRAINT, FunctionManagerDisc.INEQ_CONSTRAINT],
+ "weight": [1.0, .0, .0, 100.0,],
+ FunctionManagerDisc.AGGR_TYPE: [FunctionManager.AGGR_TYPE_SUM, FunctionManager.AGGR_TYPE_SUM, FunctionManager.INEQ_NEGATIVE_WHEN_SATIFIED_AND_SQUARE_IT, FunctionManager.INEQ_NEGATIVE_WHEN_SATIFIED_AND_SQUARE_IT,],
+ "namespace": [GlossaryEnergy.NS_FUNCTIONS] * 4
})
return func_df
@@ -580,7 +578,6 @@ def setup_usecase(self, study_folder_path=None):
"indus_emissions": 0.
})
-
target_energy_prod = pd.DataFrame({
GlossaryEnergy.Years: self.years,
GlossaryEnergy.TargetEnergyProductionValue: np.linspace(100. * 1.e3, 150. * 1e3, len(self.years))
@@ -596,7 +593,6 @@ def setup_usecase(self, study_folder_path=None):
GlossaryEnergy.TotalProductionValue: 0.
})
-
values_dict = {
f"{self.study_name}.{GlossaryEnergy.YearStart}": self.year_start,
f"{self.study_name}.{GlossaryEnergy.YearEnd}": self.year_end,
@@ -696,7 +692,7 @@ def setup_usecase(self, study_folder_path=None):
f"{self.study_name}.{self.coupling_name}.FunctionsManager.function_df": func_df,
f"{self.study_name}.{self.coupling_name}.GHGEmissions.{GlossaryEnergy.SectorListValue}": [],
f"{self.study_name}.{self.coupling_name}.max_mda_iter": 200,
- f"{self.study_name}.{self.coupling_name}.tolerance": 1e-8,
+ f"{self.study_name}.{self.coupling_name}.tolerance": 1e-10,
f"{self.study_name}.{self.coupling_name}.sub_mda_class": "MDAGaussSeidel",
}
@@ -709,4 +705,5 @@ def setup_usecase(self, study_folder_path=None):
if "__main__" == __name__:
uc_cls = Study()
- uc_cls.test()
+ uc_cls.load_data()
+ uc_cls.run()
diff --git a/energy_models/sos_processes/energy/MDO/energy_mix_optim_process/process.py b/energy_models/sos_processes/energy/MDO/energy_mix_optim_process/process.py
index 799851a3..98472519 100644
--- a/energy_models/sos_processes/energy/MDO/energy_mix_optim_process/process.py
+++ b/energy_models/sos_processes/energy/MDO/energy_mix_optim_process/process.py
@@ -21,7 +21,7 @@ class ProcessBuilder(BaseProcessBuilder):
# ontology information
_ontology_data = {
'label': 'Energy Mix Optim process - medium techno dict',
- 'description': 'Techno dict with 12 streams and 24 technos',
+ 'description': '',
'category': '',
'version': '',
}
diff --git a/energy_models/sos_processes/techno_dict/data/techno_dict_test.json b/energy_models/sos_processes/techno_dict/data/techno_dict_test.json
index e5dcf605..edabc6c7 100644
--- a/energy_models/sos_processes/techno_dict/data/techno_dict_test.json
+++ b/energy_models/sos_processes/techno_dict/data/techno_dict_test.json
@@ -1,12 +1,22 @@
{
+ "methane": {
+ "type": "energy",
+ "value": [
+ "Methanation"
+ ]
+ },
"hydrogen.gaseous_hydrogen": {
"type": "energy",
"value": [
- "Electrolysis.SOEC",
- "Electrolysis.PEM",
"Electrolysis.AWE"
]
},
+ "hydrogen.liquid_hydrogen": {
+ "type": "energy",
+ "value": [
+ "HydrogenLiquefaction"
+ ]
+ },
"fuel.hydrotreated_oil_fuel": {
"type": "energy",
"value": [
@@ -14,6 +24,12 @@
"HefaDeoxygenation"
]
},
+ "fuel.biodiesel": {
+ "type": "energy",
+ "value": [
+ "Transesterification"
+ ]
+ },
"electricity": {
"type": "energy",
"value": [
@@ -29,11 +45,8 @@
"type": "CCUS",
"value": [
"flue_gas_capture.CalciumLooping",
- "flue_gas_capture.ChilledAmmoniaProcess",
- "flue_gas_capture.CO2Membranes",
"flue_gas_capture.MonoEthanolAmine",
- "flue_gas_capture.PiperazineProcess",
- "flue_gas_capture.PressureSwingAdsorption"
+ "flue_gas_capture.PiperazineProcess"
]
},
"biomass_dry": {
@@ -47,11 +60,5 @@
"value": [
"CarbonStorageTechno"
]
- },
- "heat.hightemperatureheat": {
- "type": "energy",
- "value": [
- "ElectricBoilerHighHeat"
- ]
}
}
\ No newline at end of file
diff --git a/energy_models/sos_processes/techno_dict/data/techno_dicts.py b/energy_models/sos_processes/techno_dict/data/techno_dicts.py
index 63f8da53..0bb0bc6a 100644
--- a/energy_models/sos_processes/techno_dict/data/techno_dicts.py
+++ b/energy_models/sos_processes/techno_dict/data/techno_dicts.py
@@ -19,7 +19,7 @@
techno_dict_folder = dirname(__file__)
filename = "techno_dict_2024-07-14 Jul01_24technos_12streams.json"
-#filename = "techno_dict_test.json"
+filename = "techno_dict_test.json"
def load_dict(filename: str):
filepath = join(techno_dict_folder, filename)
with open(filepath, 'r') as json_file:
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 57efb72f..6ec171b6 100644
--- a/energy_models/sos_processes/techno_dict/techno_dict_builder.py
+++ b/energy_models/sos_processes/techno_dict/techno_dict_builder.py
@@ -31,6 +31,8 @@ def techno_dict_builder(techno_infos: dict, initial_selection: list[str],
minimal_techno_number: int = 0,
minimal_stream_number: int = 0,
technos_to_avoid: list[str] = [],
+ streams_to_avoid: list[str] = [],
+ streams_to_have: list[str] = [],
max_carbon_storage_technos: int = 10):
"""
:param techno_infos: expect something like this :
@@ -97,6 +99,11 @@ def techno_dict_builder(techno_infos: dict, initial_selection: list[str],
M = 10000
bool_stream_produced_vars = pulp.LpVariable.dicts(name="IsStreamProduced", indices=all_streams, lowBound=0, upBound=1, cat=pulp.LpBinary)
+ for s in streams_to_avoid:
+ prob.addConstraint(constraint=bool_stream_produced_vars[s] == 0, name=f"AvoidedStreamProduced{s}")
+ for s in streams_to_have:
+ prob.addConstraint(constraint=bool_stream_produced_vars[s] == 1, name=f"StreamsToHave{s}")
+
# For each energy, add constraints to ensure that if it is consumed, it must be produced by some technology
for tech in tech_vars:
# Constraint to ensure each energy consumed must be produced
@@ -121,7 +128,6 @@ def techno_dict_builder(techno_infos: dict, initial_selection: list[str],
prob += pulp.lpSum([bool_stream_produced_vars[s] for s in all_streams]) >= minimal_stream_number
-
for stream in all_streams:
techno_producing_stream = energy_to_producing_technos[stream]
name = f"{stream}=" + 'or'.join(techno_producing_stream)
@@ -217,12 +223,18 @@ def build_techno_infos(stream_used_by_technos: dict, stream_produced_by_techno:
f"{GlossaryEnergy.flue_gas_capture}.{GlossaryEnergy.CO2Membranes}", # remove
f"{GlossaryEnergy.flue_gas_capture}.{GlossaryEnergy.PressureSwingAdsorption}", # remove
GlossaryEnergy.BiomassBuryingFossilization,
-GlossaryEnergy.PureCarbonSolidStorage
+GlossaryEnergy.PureCarbonSolidStorage,
+GlossaryEnergy.FischerTropsch
]
streams_to_avoid = [
GlossaryEnergy.hightemperatureheat_energyname,
GlossaryEnergy.mediumtemperatureheat_energyname,
-GlossaryEnergy.lowtemperatureheat_energyname
+GlossaryEnergy.lowtemperatureheat_energyname,
+GlossaryEnergy.syngas,
+f'{GlossaryEnergy.fuel}.{GlossaryEnergy.liquid_fuel}',
+]
+streams_to_have = [
+ GlossaryEnergy.carbon_capture,
]
@@ -230,8 +242,11 @@ def build_techno_infos(stream_used_by_technos: dict, stream_produced_by_techno:
sub_techno_dict, n_technos, n_streams = techno_dict_builder(
techno_infos=techno_info_dict,
initial_selection=inital_selection,
- minimal_stream_number=7,
- minimal_techno_number=20,
+ minimal_stream_number=8,
+ minimal_techno_number=17,
+ streams_to_avoid=streams_to_avoid,
+ streams_to_have=streams_to_have,
+ technos_to_avoid=technos_to_avoid,
max_carbon_storage_technos=3)
ts = datetime.now().strftime("%Y-%m-%d %h%M")
diff --git a/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno.pkl b/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno.pkl
index c48d1e32..0b395731 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno.pkl and b/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno_construction_delay_0.pkl b/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno_construction_delay_0.pkl
index ae485c6b..5468066c 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno_construction_delay_0.pkl and b/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno_construction_delay_0.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_FossilSimpleTechno_FossilSimpleTechno.pkl b/energy_models/tests/jacobian_pkls/jacobian_FossilSimpleTechno_FossilSimpleTechno.pkl
index e4808406..ec4923d6 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_FossilSimpleTechno_FossilSimpleTechno.pkl and b/energy_models/tests/jacobian_pkls/jacobian_FossilSimpleTechno_FossilSimpleTechno.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_FossilSimpleTechno_FossilSimpleTechno_construction_delay_0.pkl b/energy_models/tests/jacobian_pkls/jacobian_FossilSimpleTechno_FossilSimpleTechno_construction_delay_0.pkl
index e4808406..ec4923d6 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_FossilSimpleTechno_FossilSimpleTechno_construction_delay_0.pkl and b/energy_models/tests/jacobian_pkls/jacobian_FossilSimpleTechno_FossilSimpleTechno_construction_delay_0.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_cc_gas_turbine.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_cc_gas_turbine.pkl
index 08ce8001..f92ac9f9 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_cc_gas_turbine.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_cc_gas_turbine.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_coal_gen.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_coal_gen.pkl
index e0ee1c40..8640eb5b 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_coal_gen.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_coal_gen.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_gas_turbine.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_gas_turbine.pkl
index 7f0e1d33..eccbf3f0 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_gas_turbine.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_gas_turbine.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_geothermal_high_heat_zz.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_geothermal_high_heat_zz.pkl
index 905d054e..4e2fca1f 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_geothermal_high_heat_zz.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_geothermal_high_heat_zz.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_hydropower.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_hydropower.pkl
index 69aaf3a5..a9bce81e 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_hydropower.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_hydropower.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_nuclear.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_nuclear.pkl
index 3ca139ea..318e183c 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_nuclear.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_nuclear.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_oil_gen.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_oil_gen.pkl
index 00ce1d97..03c44705 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_oil_gen.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_oil_gen.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_solar_pv.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_solar_pv.pkl
index f83edc8f..22bdf67d 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_solar_pv.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_solar_pv.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_solar_thermal.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_solar_thermal.pkl
index f04719a0..d7cfee69 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_solar_thermal.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_solar_thermal.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_wind_off_shore.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_wind_off_shore.pkl
index 6ba36fdb..40a56ff6 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_wind_off_shore.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_wind_off_shore.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_wind_on_shore.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_wind_on_shore.pkl
index dd4519c7..f835efdd 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_wind_on_shore.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_wind_on_shore.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_methane_fossil_gas.pkl b/energy_models/tests/jacobian_pkls/jacobian_methane_fossil_gas.pkl
index d6ad649f..878dbe6b 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_methane_fossil_gas.pkl and b/energy_models/tests/jacobian_pkls/jacobian_methane_fossil_gas.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_ratio_FossilGas.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_FossilGas.pkl
index fdfa1b8f..9b8ae73d 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_FossilGas.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_FossilGas.pkl differ
diff --git a/energy_models/tests/jacobian_pkls/jacobian_ratio_Nuclear.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_Nuclear.pkl
index 55744edc..54c7183b 100644
Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_Nuclear.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_Nuclear.pkl differ
diff --git a/energy_models/tests/l0_test_compute_rnw_renewable_simple_techno.py b/energy_models/tests/l0_test_compute_rnw_renewable_simple_techno.py
index 6b3f0d70..29cff1fe 100644
--- a/energy_models/tests/l0_test_compute_rnw_renewable_simple_techno.py
+++ b/energy_models/tests/l0_test_compute_rnw_renewable_simple_techno.py
@@ -87,7 +87,6 @@ def test_03_clean_energy_simple_techno_discipline(self):
'ns_resource': self.name}
self.ee.ns_manager.add_ns_def(ns_dict)
- mod_path = 'energy_models.models.clean_energy.clean_energy_simple_techno.clean_energy_simple_techno_disc.CleanEnergySimpleTechnoDiscipline'
mod_path = 'energy_models.models.clean_energy.clean_energy_simple_techno.clean_energy_simple_techno_disc.CleanEnergySimpleTechnoDiscipline'
builder = self.ee.factory.get_builder_from_module(
self.model_name, mod_path)
diff --git a/platform_version_required.txt b/platform_version_required.txt
index b572ab0b..8a58a0dc 100644
--- a/platform_version_required.txt
+++ b/platform_version_required.txt
@@ -1 +1 @@
-v4.1.2
\ No newline at end of file
+v4.1.3
\ No newline at end of file