Skip to content

Commit

Permalink
merge validation to main
Browse files Browse the repository at this point in the history
  • Loading branch information
b4pm-devops committed Sep 27, 2024
2 parents 2c641bd + 34a2c3a commit 1ef1917
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions data_energy/techno_invests/carbonstoragetechno.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ years,invest
2020,0.013
2021,0.009
2022,0.004
2023,0.004
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ years,past years,invest
2017,-3,1.3581333333333335e-05
2018,-2,1.3581333333333335e-05
2019,-1,0.0040248
2019,-1,0.0040248
2020,-1,0
2021,-1,0.0040248
2022,-1,1.0
2023,-1,0.0218
2024,-1,0.0218
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
years,past years,invest
2019,-1,0.2
2020,-1,0.0
2023,-1,0.0
8 changes: 4 additions & 4 deletions energy_models/core/energy_mix/energy_mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(self, name):
Constructor
'''
super(EnergyMix, self).__init__(name)

self.period_tol_power_non_use_capital_constraint = None
self.non_use_capital_constraint_df = None
self.target_production_constraint = None
self.co2_emitted_by_energy = None
Expand Down Expand Up @@ -242,7 +242,7 @@ def configure_parameters(self, inputs_dict):
self.heat_losses_percentage = inputs_dict['heat_losses_percentage']
self.tol_constraint_non_use_capital_energy = inputs_dict['tol_constraint_non_use_capital_energy']
self.ref_constraint_non_use_capital_energy = inputs_dict['ref_constraint_non_use_capital_energy']

self.period_tol_power_non_use_capital_constraint = inputs_dict['period_tol_power_non_use_capital_constraint']
if self.subelements_list is not None:
for energy in self.subelements_list:
if f'{energy}.losses_percentage' in inputs_dict:
Expand Down Expand Up @@ -1038,7 +1038,7 @@ def compute_non_use_energy_capital_constraint(self):
We add also a period tolerance, so
"""
ratio_non_use_capital = self.energy_capital[GlossaryEnergy.NonUseCapital].values / self.energy_capital[GlossaryEnergy.Capital].values
period_tolerance = np.linspace(0, 1, len(self.years)) ** 2
period_tolerance = np.linspace(0, 1, len(self.years)) ** self.period_tol_power_non_use_capital_constraint
constraint = (ratio_non_use_capital - self.tol_constraint_non_use_capital_energy) / self.ref_constraint_non_use_capital_energy * period_tolerance

self.non_use_capital_constraint_df = pd.DataFrame({
Expand All @@ -1054,7 +1054,7 @@ def d_non_use_capital_constraint_d_capital(self):

capital = self.energy_capital[GlossaryEnergy.Capital].values
non_use_capital = self.energy_capital[GlossaryEnergy.NonUseCapital].values
period_tolerance = np.linspace(0, 1, len(self.years)) ** 2
period_tolerance = np.linspace(0, 1, len(self.years)) ** self.period_tol_power_non_use_capital_constraint
d_non_use_capital = np.diag(period_tolerance / capital / self.ref_constraint_non_use_capital_energy / 1e3)
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
Expand Down
5 changes: 3 additions & 2 deletions energy_models/core/energy_mix/energy_mix_disc.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ class Energy_Mix_Discipline(SoSWrapp):
'liquid_hydrogen_constraint_ref': {'type': 'float', 'default': 1000., 'unit': 'Twh', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY,
'namespace': GlossaryEnergy.NS_REFERENCE},
'ref_constraint_non_use_capital_energy': {'type': 'float', 'default': 0.30, 'unit': '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': '0.05 means constraint does not penalize lagrangian when non use capital is less than 5%'},
'ref_constraint_non_use_capital_energy': {'type': 'float', 'default': 0.30, 'unit':'-','description': '0.30 means after 35 % of capital not used the constraint will explode'},
'tol_constraint_non_use_capital_energy': {'type': 'float', 'default': 0.05, 'unit':'-','description': '0.05 means constraint does not penalize lagrangian when non use capital is less than 5%'},
'period_tol_power_non_use_capital_constraint': {'type': 'float', 'default': 1.0, 'unit':'-','description': '0.05 means constraint does not penalize lagrangian when non use capital is less than 5%'},
'syngas_prod_ref': {'type': 'float', 'default': 10000., 'unit': 'TWh', 'user_level': 2,
'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': GlossaryEnergy.NS_REFERENCE},
'syngas_prod_constraint_limit': {'type': 'float', 'default': 10000., 'unit': 'TWh', 'user_level': 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ def get_post_processing_list(self, filters=None):
if new_chart is not None:
instanciated_charts.append(new_chart)

if 'Non-Use Capital' in charts:
new_chart = self.get_chart_non_use_capital()
if new_chart is not None:
instanciated_charts.append(new_chart)

return instanciated_charts

def get_chart_detailed_price_in_dollar_tCO2(self):
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 1ef1917

Please sign in to comment.