diff --git a/energy_models/core/energy_study_manager.py b/energy_models/core/energy_study_manager.py index a0b429c0..65f2d696 100644 --- a/energy_models/core/energy_study_manager.py +++ b/energy_models/core/energy_study_manager.py @@ -16,13 +16,15 @@ ''' from importlib import import_module -from sostrades_core.study_manager.study_manager import StudyManager +from climateeconomics.core.tools.ClimateEconomicsStudyManager import ( + ClimateEconomicsStudyManager, +) from sostrades_core.tools.bspline.bspline_methods import bspline_method from energy_models.glossaryenergy import GlossaryEnergy -class EnergyStudyManager(StudyManager): +class EnergyStudyManager(ClimateEconomicsStudyManager): """ classdocs """ diff --git a/energy_models/core/investments/disciplines/independent_invest_disc.py b/energy_models/core/investments/disciplines/independent_invest_disc.py index e8ed5c93..cc7dda30 100644 --- a/energy_models/core/investments/disciplines/independent_invest_disc.py +++ b/energy_models/core/investments/disciplines/independent_invest_disc.py @@ -66,9 +66,9 @@ class IndependentInvestDiscipline(SoSWrapp): 'visibility': SoSWrapp.SHARED_VISIBILITY, 'namespace': 'ns_energy_study', 'editable': False, 'structuring': True}, - GlossaryEnergy.ForestInvestmentValue: {'type': 'dataframe', 'unit': 'G$', 'visibility': 'Shared', + GlossaryEnergy.ReforestationInvestmentValue: {'type': 'dataframe', 'unit': 'G$', 'visibility': 'Shared', 'dataframe_descriptor': {GlossaryEnergy.Years: ('float', None, False), - GlossaryEnergy.ForestInvestmentValue: ( + GlossaryEnergy.ReforestationInvestmentValue: ( 'float', None, False)}, 'namespace': 'ns_invest', 'dataframe_edition_locked': False}, @@ -226,17 +226,17 @@ def compute_sos_jacobian(self): self.set_partial_derivative_for_other_types( (GlossaryEnergy.EnergyInvestmentsWoTaxValue, GlossaryEnergy.EnergyInvestmentsWoTaxValue), - (GlossaryEnergy.ForestInvestmentValue, GlossaryEnergy.ForestInvestmentValue), + (GlossaryEnergy.ReforestationInvestmentValue, GlossaryEnergy.ReforestationInvestmentValue), identity * 1e-3) self.set_partial_derivative_for_other_types( (GlossaryEnergy.EnergyInvestmentsMinimizationObjective,), - (GlossaryEnergy.ForestInvestmentValue, GlossaryEnergy.ForestInvestmentValue), + (GlossaryEnergy.ReforestationInvestmentValue, GlossaryEnergy.ReforestationInvestmentValue), ones * 1e-3) self.set_partial_derivative_for_other_types( (GlossaryEnergy.MaxBudgetConstraintValue, GlossaryEnergy.MaxBudgetConstraintValue), - (GlossaryEnergy.ForestInvestmentValue, GlossaryEnergy.ForestInvestmentValue), + (GlossaryEnergy.ReforestationInvestmentValue, GlossaryEnergy.ReforestationInvestmentValue), identity / max_budget_constraint_ref) energy_list = inputs_dict[GlossaryEnergy.energy_list] @@ -331,18 +331,18 @@ def pimp_string(val: str): new_chart_energy.series.append(serie) - forest_investment = self.get_sosdisc_inputs(GlossaryEnergy.ForestInvestmentValue) + reforestation_investment = self.get_sosdisc_inputs(GlossaryEnergy.ReforestationInvestmentValue) chart_name = 'Distribution of reforestation investments' agriculture_chart = TwoAxesInstanciatedChart(GlossaryEnergy.Years, 'Invest [G$]', chart_name=chart_name, stacked_bar=True) serie_agriculture = InstanciatedSeries( - forest_investment[GlossaryEnergy.Years].values.tolist(), - forest_investment[GlossaryEnergy.ForestInvestmentValue].values.tolist(), 'Reforestation', 'bar') + reforestation_investment[GlossaryEnergy.Years].values.tolist(), + reforestation_investment[GlossaryEnergy.ReforestationInvestmentValue].values.tolist(), 'Reforestation', 'bar') agriculture_chart.series.append(serie_agriculture) instanciated_charts.append(agriculture_chart) serie = InstanciatedSeries( - forest_investment[GlossaryEnergy.Years].values.tolist(), - forest_investment[GlossaryEnergy.ForestInvestmentValue].tolist(), 'Reforestation', 'bar') + reforestation_investment[GlossaryEnergy.Years].values.tolist(), + reforestation_investment[GlossaryEnergy.ReforestationInvestmentValue].tolist(), 'Reforestation', 'bar') new_chart_energy.series.append(serie) diff --git a/energy_models/core/investments/disciplines/investments_redistribution_disc.py b/energy_models/core/investments/disciplines/investments_redistribution_disc.py index d94a5377..0249ad88 100644 --- a/energy_models/core/investments/disciplines/investments_redistribution_disc.py +++ b/energy_models/core/investments/disciplines/investments_redistribution_disc.py @@ -60,7 +60,7 @@ class InvestmentsRedistributionDisicpline(SoSWrapp): GlossaryEnergy.YearEnd: GlossaryEnergy.YearEndVar, GlossaryEnergy.EnergyListName: energy_list_desc_dict, GlossaryEnergy.CCSListName: ccs_list_desc_dict, - GlossaryEnergy.ForestInvestmentValue: GlossaryEnergy.get_dynamic_variable(GlossaryEnergy.ForestInvestment), + GlossaryEnergy.ReforestationInvestmentValue: GlossaryEnergy.get_dynamic_variable(GlossaryEnergy.ForestInvestment), GlossaryEnergy.EconomicsDfValue: GlossaryEnergy.get_dynamic_variable(GlossaryEnergy.EconomicsDf), GlossaryEnergy.EnergyInvestPercentageGDPName: GlossaryEnergy.get_dynamic_variable( GlossaryEnergy.EnergyInvestPercentageGDP) @@ -234,7 +234,7 @@ def compute_sos_jacobian(self): self.set_partial_derivative_for_other_types( (GlossaryEnergy.EnergyInvestmentsWoTaxValue, GlossaryEnergy.EnergyInvestmentsWoTaxValue), - (GlossaryEnergy.ForestInvestmentValue, GlossaryEnergy.ForestInvestmentValue), + (GlossaryEnergy.ReforestationInvestmentValue, GlossaryEnergy.ReforestationInvestmentValue), identity * 1e-3) if BiomassDry.name in energy_list: @@ -305,18 +305,18 @@ def get_post_processing_list(self, filters=None): new_chart_energy.series.append(serie) - forest_investment = self.get_sosdisc_inputs(GlossaryEnergy.ForestInvestmentValue) + reforestation_investment = self.get_sosdisc_inputs(GlossaryEnergy.ReforestationInvestmentValue) chart_name = 'Distribution of reforestation investments ' agriculture_chart = TwoAxesInstanciatedChart(GlossaryEnergy.Years, 'Invest [G$]', chart_name=chart_name, stacked_bar=True) serie_agriculture = InstanciatedSeries( - forest_investment[GlossaryEnergy.Years].values.tolist(), - forest_investment[GlossaryEnergy.ForestInvestmentValue].values.tolist(), 'Reforestation', 'bar') + reforestation_investment[GlossaryEnergy.Years].values.tolist(), + reforestation_investment[GlossaryEnergy.ReforestationInvestmentValue].values.tolist(), 'Reforestation', 'bar') agriculture_chart.series.append(serie_agriculture) instanciated_charts.append(agriculture_chart) serie = InstanciatedSeries( - forest_investment[GlossaryEnergy.Years].values.tolist(), - forest_investment[GlossaryEnergy.ForestInvestmentValue].tolist(), 'Reforestation', 'bar') + reforestation_investment[GlossaryEnergy.Years].values.tolist(), + reforestation_investment[GlossaryEnergy.ReforestationInvestmentValue].tolist(), 'Reforestation', 'bar') new_chart_energy.series.append(serie) diff --git a/energy_models/core/investments/independent_invest.py b/energy_models/core/investments/independent_invest.py index 1a74f3da..9bc1b688 100644 --- a/energy_models/core/investments/independent_invest.py +++ b/energy_models/core/investments/independent_invest.py @@ -55,8 +55,8 @@ def compute_energy_investment_wo_tax(self, inputs_dict: dict): techno_invests = inputs_dict[GlossaryEnergy.invest_mix][self.distribution_list] techno_invest_sum = techno_invests.sum(axis=1).values - techno_invest_sum += inputs_dict[GlossaryEnergy.ForestInvestmentValue][ - GlossaryEnergy.ForestInvestmentValue].values + techno_invest_sum += inputs_dict[GlossaryEnergy.ReforestationInvestmentValue][ + GlossaryEnergy.ReforestationInvestmentValue].values energy_list = inputs_dict[GlossaryEnergy.energy_list] if BiomassDry.name in energy_list: diff --git a/energy_models/core/investments/investments_redistribution.py b/energy_models/core/investments/investments_redistribution.py index 58865265..7128c48f 100644 --- a/energy_models/core/investments/investments_redistribution.py +++ b/energy_models/core/investments/investments_redistribution.py @@ -42,7 +42,7 @@ def __init__(self): self.techno_list_dict = None self.total_investments_in_energy = None self.total_investments_in_energy_w_biomass_dry = None - self.forest_investment_df = None + self.reforestation_investment_df = None self.inputs_dict = None def configure_parameters(self, inputs_dict: dict): @@ -58,7 +58,7 @@ def configure_parameters(self, inputs_dict: dict): self.ccs_list = self.inputs_dict[GlossaryEnergy.CCSListName] self.techno_list_dict = {energy: self.inputs_dict[f'{energy}.{GlossaryEnergy.TechnoListName}'] for energy in self.energy_list + self.ccs_list if energy != BiomassDry.name} - self.forest_investment_df = self.inputs_dict[GlossaryEnergy.ForestInvestmentValue] + self.reforestation_investment_df = self.inputs_dict[GlossaryEnergy.ReforestationInvestmentValue] def compute(self): """compute investment per technology and total energy investments""" @@ -71,8 +71,8 @@ def compute_total_energy_investment_wo_tax(self): # compute sum of all investments (energy investments + forest investments + biomass_dry investments # if used in model ) self.total_investments_in_energy_w_biomass_dry = (self.total_investments_in_energy + - self.forest_investment_df[ - GlossaryEnergy.ForestInvestmentValue].values) + self.reforestation_investment_df[ + GlossaryEnergy.ReforestationInvestmentValue].values) if BiomassDry.name in self.energy_list: for techno in ['managed_wood_investment', 'deforestation_investment', 'crop_investment']: diff --git a/energy_models/core/stream_type/energy_disciplines/fuel_disc.py b/energy_models/core/stream_type/energy_disciplines/fuel_disc.py index 8432069a..830e3fb7 100644 --- a/energy_models/core/stream_type/energy_disciplines/fuel_disc.py +++ b/energy_models/core/stream_type/energy_disciplines/fuel_disc.py @@ -208,6 +208,10 @@ def run(self): self.store_sos_outputs_values(outputs_dict) + def compute_sos_jacobian(self): + """Compute nothing, here to avoid l1 error.""" + pass + # POST PROCESSING def get_chart_filter_list(self): diff --git a/energy_models/glossaryenergy.py b/energy_models/glossaryenergy.py index 8b0feaa9..f50c878c 100644 --- a/energy_models/glossaryenergy.py +++ b/energy_models/glossaryenergy.py @@ -30,7 +30,7 @@ class GlossaryEnergy(GlossaryWitnessCore): NB_POLES_FULL: int = 8 # number of poles in witness full NB_POLE_ENERGY_MIX_PROCESS = 12 EXPORT_PROFILES_AT_POLES = "export_invest_profiles_at_poles" - YearEndDefaultValueGradientTest = 2030 + YearEndDefaultValueGradientTest = 2050 # TODO: if using 2030 => year LifetimeDefaultValueGradientTest = 7 YearEndDefault = 2050 YearEndDefaultCore = GlossaryWitnessCore.YearEndDefault @@ -134,7 +134,7 @@ class GlossaryEnergy(GlossaryWitnessCore): TransportCostValue = "transport_cost" TransportMarginValue = "transport_margin" TransportDemandValue = "transport_demand" - ForestInvestmentValue = "forest_investment" + ReforestationInvestmentValue = "reforestation_investment" CarbonCapturedValue = "carbon_captured_type" InstalledPower = ( "power_production" # todo : rename string to Installed Power [MW] (check unit) @@ -482,7 +482,7 @@ class GlossaryEnergy(GlossaryWitnessCore): } ForestInvestment = { - "var_name": ForestInvestmentValue, + "var_name": ReforestationInvestmentValue, "type": "dataframe", "unit": "G$", "visibility": "Shared", @@ -492,7 +492,7 @@ class GlossaryEnergy(GlossaryWitnessCore): [1900, GlossaryWitnessCore.YearEndDefault], False, ), - ForestInvestmentValue: ("float", [0.0, 1e30], False), + ReforestationInvestmentValue: ("float", [0.0, 1e30], False), }, "namespace": "ns_invest", "dataframe_edition_locked": False, 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 5cdbffb3..3066c69d 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 @@ -565,7 +565,7 @@ def setup_usecase(self, study_folder_path=None): all_streams_demand_ratio.update({energy: 100.0 for energy in self.energy_list}) all_streams_demand_ratio = pd.DataFrame(all_streams_demand_ratio) - forest_invest_df = pd.DataFrame({GlossaryEnergy.Years: self.years, GlossaryEnergy.ForestInvestmentValue: 5}) + forest_invest_df = pd.DataFrame({GlossaryEnergy.Years: self.years, GlossaryEnergy.ReforestationInvestmentValue: 5}) co2_land_emissions = pd.DataFrame({ GlossaryEnergy.Years: self.years, @@ -605,12 +605,12 @@ def setup_usecase(self, study_folder_path=None): f"{self.study_name}.{self.coupling_name}.{energy_mix_name}.{GlossaryEnergy.AllStreamsDemandRatioValue}": all_streams_demand_ratio, f"{self.study_name}.is_stream_demand": True, f"{self.study_name}.max_mda_iter": 50, - f"{self.study_name}.sub_mda_class": "GSPureNewtonMDA", + f"{self.study_name}.inner_mda_name": "MDAGSNewton", f"{self.study_name}.{self.coupling_name}.{energy_mix_name}.{GlossaryEnergy.RessourcesCO2EmissionsValue}": resources_CO2_emissions, f"{self.study_name}.{self.coupling_name}.{energy_mix_name}.{GlossaryEnergy.ResourcesPriceValue}": resources_prices, f"{self.study_name}.{self.coupling_name}.{energy_mix_name}.{GlossaryEnergy.TargetEnergyProductionValue}": target_energy_prod, f"{self.study_name}.{self.coupling_name}.{energy_mix_name}.{GlossaryEnergy.MaxBudgetValue}": max_invest, - f"{self.study_name}.{self.coupling_name}.InvestmentDistribution.{GlossaryEnergy.ForestInvestmentValue}": forest_invest_df, + f"{self.study_name}.{self.coupling_name}.InvestmentDistribution.{GlossaryEnergy.ReforestationInvestmentValue}": forest_invest_df, f"{self.study_name}.{self.coupling_name}.{GlossaryCore.insertGHGAgriLandEmissions.format(GlossaryCore.CO2)}": co2_land_emissions, f"{self.study_name}.{self.coupling_name}.{GlossaryCore.insertGHGAgriLandEmissions.format(GlossaryCore.CH4)}": co2_land_emissions, f"{self.study_name}.{self.coupling_name}.{GlossaryCore.insertGHGAgriLandEmissions.format(GlossaryCore.N2O)}": co2_land_emissions, @@ -693,7 +693,7 @@ def setup_usecase(self, study_folder_path=None): f"{self.study_name}.{self.coupling_name}.GHGEmissions.{GlossaryEnergy.SectorListValue}": [], f"{self.study_name}.{self.coupling_name}.max_mda_iter": 400, f"{self.study_name}.{self.coupling_name}.tolerance": 1e-10, - f"{self.study_name}.{self.coupling_name}.sub_mda_class": "MDAGaussSeidel", + f"{self.study_name}.{self.coupling_name}.inner_mda_name": "MDAGaussSeidel", } dvar_values = self.get_dvar_values(dspace) diff --git a/energy_models/sos_processes/energy/MDA/energy_process_v0/usecase.py b/energy_models/sos_processes/energy/MDA/energy_process_v0/usecase.py index 1e75f1e9..eaaa6b8f 100644 --- a/energy_models/sos_processes/energy/MDA/energy_process_v0/usecase.py +++ b/energy_models/sos_processes/energy/MDA/energy_process_v0/usecase.py @@ -63,9 +63,6 @@ get_default_resources_prices, ) from energy_models.glossaryenergy import GlossaryEnergy -from energy_models.models.carbon_storage.pure_carbon_solid_storage.pure_carbon_solid_storage import ( - PureCarbonSS, -) from energy_models.sos_processes.energy.techno_mix.carbon_capture_mix.usecase import ( DEFAULT_FLUE_GAS_LIST, ) @@ -175,14 +172,14 @@ def setup_constraints(self): list_aggr_type.append(FunctionManager.AGGR_TYPE_SMAX) list_namespaces.append(GlossaryEnergy.NS_FUNCTIONS) - if GaseousHydrogen.name in self.energy_list: - if "PlasmaCracking" in self.dict_technos[GaseousHydrogen.name]: - list_var.extend([PureCarbonSS.CARBON_TO_BE_STORED_CONSTRAINT]) - list_parent.extend(["Carbon_to_be_stored_constraints"]) - list_ftype.extend([FunctionManagerDisc.INEQ_CONSTRAINT]) - list_weight.extend([0.0]) - list_aggr_type.append(FunctionManager.AGGR_TYPE_SMAX) - list_namespaces.append(GlossaryEnergy.NS_FUNCTIONS) + # if GaseousHydrogen.name in self.energy_list: + # if "PlasmaCracking" in self.dict_technos[GaseousHydrogen.name]: + # list_var.extend([PureCarbonSS.CARBON_TO_BE_STORED_CONSTRAINT]) + # list_parent.extend(["Carbon_to_be_stored_constraints"]) + # list_ftype.extend([FunctionManagerDisc.INEQ_CONSTRAINT]) + # list_weight.extend([0.0]) + # list_aggr_type.append(FunctionManager.AGGR_TYPE_SMAX) + # list_namespaces.append(GlossaryEnergy.NS_FUNCTIONS) list_var.extend([EnergyMix.TOTAL_PROD_MINUS_MIN_PROD_CONSTRAINT_DF]) list_parent.extend(["Energy_constraints"]) @@ -620,7 +617,7 @@ def setup_usecase(self, study_folder_path=None): f"{self.study_name}.{energy_mix_name}.{GlossaryEnergy.AllStreamsDemandRatioValue}": all_streams_demand_ratio, f"{self.study_name}.is_stream_demand": True, f"{self.study_name}.max_mda_iter": 50, - f"{self.study_name}.sub_mda_class": "MDAGaussSeidel", + f"{self.study_name}.inner_mda_name": "MDAGaussSeidel", f"{self.study_name}.NormalizationReferences.liquid_hydrogen_percentage": np.concatenate( (np.ones(5) * 1e-4, np.ones(len(self.years) - 5) / 4), axis=None ), diff --git a/energy_models/sos_processes/energy/MDA/energy_process_v0_mda/usecase.py b/energy_models/sos_processes/energy/MDA/energy_process_v0_mda/usecase.py index d9c7702e..6a9524eb 100644 --- a/energy_models/sos_processes/energy/MDA/energy_process_v0_mda/usecase.py +++ b/energy_models/sos_processes/energy/MDA/energy_process_v0_mda/usecase.py @@ -102,7 +102,7 @@ def setup_usecase(self, study_folder_path=None): f'{self.study_name}.tolerance': 1.0e-7, f'{self.study_name}.n_processes': 1, f'{self.study_name}.linearization_mode': 'adjoint', - f'{self.study_name}.sub_mda_class': 'GSPureNewtonMDA', + f'{self.study_name}.inner_mda_name': 'MDAGSNewton', } values_dict_list.append(numerical_values_dict) diff --git a/energy_models/sos_processes/energy/MDO/energy_mix_optim_process/usecase.py b/energy_models/sos_processes/energy/MDO/energy_mix_optim_process/usecase.py index 5eddd168..b7fc4538 100644 --- a/energy_models/sos_processes/energy/MDO/energy_mix_optim_process/usecase.py +++ b/energy_models/sos_processes/energy/MDO/energy_mix_optim_process/usecase.py @@ -13,7 +13,9 @@ limitations under the License. ''' -from sostrades_core.study_manager.study_manager import StudyManager +from climateeconomics.core.tools.ClimateEconomicsStudyManager import ( + ClimateEconomicsStudyManager, +) from sostrades_optimization_plugins.models.func_manager.func_manager_disc import ( FunctionManagerDisc, ) @@ -26,7 +28,7 @@ INVEST_DISC_NAME = 'InvestmentDistribution' -class Study(StudyManager): +class Study(ClimateEconomicsStudyManager): def __init__( self, file_path=__file__, diff --git a/energy_models/sos_processes/post_processing/post_proc_capex_opex.py b/energy_models/sos_processes/post_processing/post_proc_capex_opex.py index cb9fe9b1..800653f0 100644 --- a/energy_models/sos_processes/post_processing/post_proc_capex_opex.py +++ b/energy_models/sos_processes/post_processing/post_proc_capex_opex.py @@ -32,7 +32,7 @@ def post_processing_filters(execution_engine, namespace): filters = [] chart_list = [] energy = execution_engine.dm.get_disciplines_with_name(namespace)[ - 0].mdo_discipline_wrapp.wrapper.energy_name + 0].discipline_wrapp.wrapper.energy_name chart_list += [f'{energy} Capex value'] # The filters are set to False by default since the graphs are not yet @@ -144,19 +144,19 @@ def post_processings(execution_engine, namespace, filters): split_title = namespace.split('.') title = split_title[len(split_title) - 1] + ' Capex Price' - energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper.energy_name + energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper.energy_name if f'{energy} Capex value' in graphs_list: capex_bar_slider_graph = get_techno_price_data(execution_engine, namespace, title, 'CAPEX_Part', 'Capex') instanciated_charts.append(capex_bar_slider_graph) title = split_title[len(split_title) - 1] + ' Opex Price' - energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper.energy_name + energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper.energy_name if f'{energy} Capex value' in graphs_list: opex_bar_slider_graph = get_techno_price_data(execution_engine, namespace, title, 'OPEX_Part', 'Opex') instanciated_charts.append(opex_bar_slider_graph) title = split_title[len(split_title) - 1] + ' Total Price' - energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper.energy_name + energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper.energy_name if f'{energy} Capex value' in graphs_list: total_price_slider_graph = get_techno_price_data(execution_engine, namespace, title, 'Total_Price', 'Price') instanciated_charts.append(total_price_slider_graph) diff --git a/energy_models/sos_processes/post_processing/post_proc_energy_mix.py b/energy_models/sos_processes/post_processing/post_proc_energy_mix.py index bd4b1e1c..fb142f04 100644 --- a/energy_models/sos_processes/post_processing/post_proc_energy_mix.py +++ b/energy_models/sos_processes/post_processing/post_proc_energy_mix.py @@ -36,7 +36,7 @@ def post_processing_filters(execution_engine, namespace): chart_list = [] energy = execution_engine.dm.get_disciplines_with_name(namespace)[ - 0].mdo_discipline_wrapp.wrapper.energy_name + 0].discipline_wrapp.wrapper.energy_name chart_list += [f'{energy} Figures table'] # The filters are set to False by default since the graphs are not yet @@ -194,9 +194,9 @@ def post_processings(execution_engine, namespace, filters): if chart_filter.filter_key == 'Charts': graphs_list.extend(chart_filter.selected_values) # Sometimes wrapper object is None, TODO Need to find another way to find energy_name - wrapper_type = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper + wrapper_type = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper if wrapper_type is not None: - energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper.energy_name + energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper.energy_name absolute_value_table = [] average_value_table = [] if f'{energy} Figures table' in graphs_list: # diff --git a/energy_models/sos_processes/post_processing/post_proc_stream_CO2_breakdown.py b/energy_models/sos_processes/post_processing/post_proc_stream_CO2_breakdown.py index 66396074..11563420 100644 --- a/energy_models/sos_processes/post_processing/post_proc_stream_CO2_breakdown.py +++ b/energy_models/sos_processes/post_processing/post_proc_stream_CO2_breakdown.py @@ -41,7 +41,7 @@ def post_processing_filters(execution_engine, namespace): chart_list = [] energy = execution_engine.dm.get_disciplines_with_name(namespace)[ - 0].mdo_discipline_wrapp.wrapper.energy_name + 0].discipline_wrapp.wrapper.energy_name chart_list += [f'{energy} CO2 intensity'] chart_list += [f'{energy} CO2 breakdown sankey'] chart_list += [f'{energy} CO2 breakdown bar'] @@ -123,7 +123,7 @@ def post_processings(execution_engine, namespace, filters): graphs_list.extend(chart_filter.selected_values) # ---- - energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper.energy_name + energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper.energy_name if f'{energy} Figures table' in graphs_list: for year in YEAR_COMPARISON: new_table = get_comparision_data(execution_engine, namespace, year) @@ -327,7 +327,7 @@ def get_multilevel_df(execution_engine, namespace, columns=None): index=idx, columns=['production', GlossaryEnergy.InvestValue, 'CO2_per_kWh', 'price_per_kWh', 'price_per_kWh_wotaxes']) energy_list = [execution_engine.dm.get_disciplines_with_name(namespace)[ - 0].mdo_discipline_wrapp.wrapper.energy_name] + 0].discipline_wrapp.wrapper.energy_name] total_carbon_emissions = None for energy in energy_list: energy_disc = execution_engine.dm.get_disciplines_with_name( @@ -651,7 +651,7 @@ def get_CO2_breakdown_multilevel_df(execution_engine, namespace): @return multilevel_df: Dataframe ''' - energy_disc = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper + energy_disc = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper energy_list = [energy_disc.energy_name] years = np.arange(energy_disc.get_sosdisc_inputs( diff --git a/energy_models/sos_processes/post_processing/post_proc_technology_mix.py b/energy_models/sos_processes/post_processing/post_proc_technology_mix.py index 178dc81e..d7a9ce95 100644 --- a/energy_models/sos_processes/post_processing/post_proc_technology_mix.py +++ b/energy_models/sos_processes/post_processing/post_proc_technology_mix.py @@ -34,7 +34,7 @@ def post_processing_filters(execution_engine, namespace): filters = [] chart_list = [] energy = execution_engine.dm.get_disciplines_with_name(namespace)[ - 0].mdo_discipline_wrapp.wrapper.energy_name + 0].discipline_wrapp.wrapper.energy_name chart_list += [f'{energy} Price data of all technologies'] # The filters are set to False by default since the graphs are not yet @@ -230,16 +230,16 @@ def post_processings(execution_engine, namespace, filters): graphs_list.extend(chart_filter.selected_values) # ---- # Sometimes wrapper object is None, TODO Need to find another way to find energy_name - wrapper_type = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper + wrapper_type = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper if wrapper_type is not None: - energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper.energy_name + energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper.energy_name if f'{energy} Price data of all technologies' in graphs_list: capex_bar_slider_graph = get_techno_price_filter_data(execution_engine, namespace, '15 Most Producing Technologies Capex', 'CAPEX_Part', 'Capex') instanciated_charts.append(capex_bar_slider_graph) - energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].mdo_discipline_wrapp.wrapper.energy_name + energy = execution_engine.dm.get_disciplines_with_name(namespace)[0].discipline_wrapp.wrapper.energy_name if f'{energy} Price data of all technologies' in graphs_list: total_price_bar_slider_graph = get_techno_price_filter_data(execution_engine, namespace, '15 Most Producing Technologies Price', diff --git a/energy_models/tests/Test/dump_database_configure.py b/energy_models/tests/Test/dump_database_configure.py index 2b3e9b21..be9dfd85 100644 --- a/energy_models/tests/Test/dump_database_configure.py +++ b/energy_models/tests/Test/dump_database_configure.py @@ -26,7 +26,7 @@ from sostrades_core.sos_processes.processes_factory import SoSProcessFactory from sostrades_core.study_manager.base_study_manager import BaseStudyManager -NUMERICAL_KEYS = ['.sub_mda_class', '.max_mda_iter', '.n_processes', +NUMERICAL_KEYS = ['.inner_mda_name', '.max_mda_iter', '.n_processes', '.chain_linearize', '.tolerance', '.use_lu_fact', '.warm_start', '.acceleration', '.warm_start_threshold', '.n_subcouplings_parallel', '.tolerance_gs', diff --git a/energy_models/tests/_l1_test_gradient_energy_model_mda.py b/energy_models/tests/_l1_test_gradient_energy_model_mda.py index 62547a91..3a2b5cba 100644 --- a/energy_models/tests/_l1_test_gradient_energy_model_mda.py +++ b/energy_models/tests/_l1_test_gradient_energy_model_mda.py @@ -68,7 +68,7 @@ def test_01_check_gradient_with_newtonraphson(self): usecase.study_name = self.name values_dict = usecase.setup_usecase() - values_dict[0][f'{usecase.study_name}.sub_mda_class'] = 'MDANewtonRaphson' + values_dict[0][f'{usecase.study_name}.inner_mda_name'] = 'MDANewtonRaphson' values_dict[0][f'{usecase.study_name}.linearization_mode'] = 'adjoint' full_values_dict = {} diff --git a/energy_models/tests/_l2_test_gradient_energy_model_mda.py b/energy_models/tests/_l2_test_gradient_energy_model_mda.py index b3670a1a..ed58c9a8 100644 --- a/energy_models/tests/_l2_test_gradient_energy_model_mda.py +++ b/energy_models/tests/_l2_test_gradient_energy_model_mda.py @@ -121,7 +121,7 @@ def test_02_check_gradient_price_vs_invests(self): values_dict[0][f'{usecase.study_name}.tolerance'] = 1.0e-8 values_dict[0][f'{usecase.study_name}.chain_linearize'] = True - values_dict[0][f'{usecase.study_name}.sub_mda_class'] = 'MDAGaussSeidel' + values_dict[0][f'{usecase.study_name}.inner_mda_name'] = 'MDAGaussSeidel' values_dict[0][f'{usecase.study_name}.linearization_mode'] = 'adjoint' self.ee.display_treeview_nodes() full_values_dict = {} @@ -172,7 +172,7 @@ def test_03_check_gradient_of_price_vs_co2_emissions_open_loop(self): full_values_dict[f'{usecase.study_name}.linearization_mode'] = 'adjoint' full_values_dict[f'{usecase.study_name}.tolerance'] = 1.0e-12 full_values_dict[f'{usecase.study_name}.max_mda_iter'] = 200 - full_values_dict[f'{usecase.study_name}.sub_mda_class'] = 'MDAGaussSeidel' + full_values_dict[f'{usecase.study_name}.inner_mda_name'] = 'MDAGaussSeidel' self.ee.load_study_from_input_dict(full_values_dict) disc_mda = self.ee.root_process @@ -228,7 +228,7 @@ def test_04_check_gradient_energymixoutputs_vs_energy_investment(self): full_values_dict[f'{usecase.study_name}.linearization_mode'] = 'adjoint' full_values_dict[f'{usecase.study_name}.tolerance'] = 1.0e-12 full_values_dict[f'{usecase.study_name}.max_mda_iter'] = 200 - full_values_dict[f'{usecase.study_name}.sub_mda_class'] = 'MDAGaussSeidel' + full_values_dict[f'{usecase.study_name}.inner_mda_name'] = 'MDAGaussSeidel' self.ee.load_study_from_input_dict(full_values_dict) disc_mda = self.ee.root_process @@ -275,7 +275,7 @@ def test_05_check_gradient_open_loop_after_MDA_results(self): 'tol': 1.0e-14} full_values_dict[f'{usecase.study_name}.linearization_mode'] = 'adjoint' full_values_dict[f'{usecase.study_name}.tolerance'] = 1.0e-12 - full_values_dict[f'{usecase.study_name}.sub_mda_class'] = 'MDANewtonRaphson' + full_values_dict[f'{usecase.study_name}.inner_mda_name'] = 'MDANewtonRaphson' self.ee.load_study_from_input_dict(full_values_dict) @@ -303,7 +303,7 @@ def test_05_check_gradient_open_loop_after_MDA_results(self): dump_dir, exec_eng2, DirectLoadDump()) full_values_dict = { - f'{usecase.study_name}.sub_mda_class': 'MDAGaussSeidel', + f'{usecase.study_name}.inner_mda_name': 'MDAGaussSeidel', f'{usecase.study_name}.{GlossaryEnergy.StreamPricesValue}': energy_prices, f'{usecase.study_name}.{GlossaryEnergy.StreamsCO2EmissionsValue}': energy_emissions} @@ -365,7 +365,7 @@ def test_06_check_gradient_energymixoutputs_vs_energy_mixes(self): full_values_dict[f'{usecase.study_name}.linearization_mode'] = 'adjoint' full_values_dict[f'{usecase.study_name}.tolerance'] = 1.0e-12 full_values_dict[f'{usecase.study_name}.max_mda_iter'] = 200 - full_values_dict[f'{usecase.study_name}.sub_mda_class'] = 'MDAGaussSeidel' + full_values_dict[f'{usecase.study_name}.inner_mda_name'] = 'MDAGaussSeidel' nb_poles = 5 @@ -447,7 +447,7 @@ def test_06_check_gradient_energymixoutputs_vs_energy_mixes(self): # full_values_dict[f'{usecase.study_name}.linearization_mode'] = 'adjoint' # full_values_dict[f'{usecase.study_name}.tolerance'] = 1.0e-12 # full_values_dict[f'{usecase.study_name}.max_mda_iter'] = 200 -# full_values_dict[f'{usecase.study_name}.sub_mda_class'] = 'MDAGaussSeidel' +# full_values_dict[f'{usecase.study_name}.inner_mda_name'] = 'MDAGaussSeidel' # # nb_poles = 5 # diff --git a/energy_models/tests/data_tests/mda_energy_data_generator.py b/energy_models/tests/data_tests/mda_energy_data_generator.py index 0e80e554..b93b4d61 100644 --- a/energy_models/tests/data_tests/mda_energy_data_generator.py +++ b/energy_models/tests/data_tests/mda_energy_data_generator.py @@ -49,7 +49,7 @@ def launch_data_pickle_generation(directory=''): full_values_dict[f'{name}.epsilon0'] = 1.0 full_values_dict[f'{name}.tolerance'] = 1.0e-8 - full_values_dict[f'{name}.sub_mda_class'] = 'MDAGaussSeidel' + full_values_dict[f'{name}.inner_mda_name'] = 'MDAGaussSeidel' full_values_dict[f'{name}.max_mda_iter'] = 200 full_values_dict[f'{name}.year_end'] = GlossaryEnergy.YearEndDefaultValueGradientTest ee.load_study_from_input_dict(full_values_dict) diff --git a/energy_models/tests/data_tests/mda_energy_data_streams_input_dict.pkl b/energy_models/tests/data_tests/mda_energy_data_streams_input_dict.pkl index ccd3326a..5c6e7c28 100644 Binary files a/energy_models/tests/data_tests/mda_energy_data_streams_input_dict.pkl and b/energy_models/tests/data_tests/mda_energy_data_streams_input_dict.pkl differ diff --git a/energy_models/tests/data_tests/mda_energy_data_streams_output_dict.pkl b/energy_models/tests/data_tests/mda_energy_data_streams_output_dict.pkl index 16d8b071..31b7f724 100644 Binary files a/energy_models/tests/data_tests/mda_energy_data_streams_output_dict.pkl and b/energy_models/tests/data_tests/mda_energy_data_streams_output_dict.pkl differ diff --git a/energy_models/tests/data_tests/mda_energy_data_technologies_input_dict.pkl b/energy_models/tests/data_tests/mda_energy_data_technologies_input_dict.pkl index 1b170584..e30cb62f 100644 Binary files a/energy_models/tests/data_tests/mda_energy_data_technologies_input_dict.pkl and b/energy_models/tests/data_tests/mda_energy_data_technologies_input_dict.pkl differ diff --git a/energy_models/tests/data_tests/mda_energy_data_technologies_output_dict.pkl b/energy_models/tests/data_tests/mda_energy_data_technologies_output_dict.pkl index 8c0cb39e..4d4e190c 100644 Binary files a/energy_models/tests/data_tests/mda_energy_data_technologies_output_dict.pkl and b/energy_models/tests/data_tests/mda_energy_data_technologies_output_dict.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_CCUS_disc.pkl b/energy_models/tests/jacobian_pkls/jacobian_CCUS_disc.pkl index 250dc2a8..e1e0b522 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_CCUS_disc.pkl and b/energy_models/tests/jacobian_pkls/jacobian_CCUS_disc.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno.pkl b/energy_models/tests/jacobian_pkls/jacobian_CleanEnergySimpleTechno_CleanEnergySimpleTechno.pkl index f3ade6ed..f6f22121 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 c2d58c0b..a3596ec2 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_ConsumptionCO2Emissions.pkl b/energy_models/tests/jacobian_pkls/jacobian_ConsumptionCO2Emissions.pkl index e163dbda..eb189b00 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ConsumptionCO2Emissions.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ConsumptionCO2Emissions.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_ConsumptionCO2Emissions_prodcons.pkl b/energy_models/tests/jacobian_pkls/jacobian_ConsumptionCO2Emissions_prodcons.pkl index cfcdce6c..5dd0019b 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ConsumptionCO2Emissions_prodcons.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ConsumptionCO2Emissions_prodcons.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions.pkl b/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions.pkl index 5ba37059..cbb32770 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions.pkl and b/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_emission_energy_mix.pkl b/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_emission_energy_mix.pkl index d447cfc8..f313b25d 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_emission_energy_mix.pkl and b/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_emission_energy_mix.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_energy_production_detailed.pkl b/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_energy_production_detailed.pkl index e689021f..be1df9a5 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_energy_production_detailed.pkl and b/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_energy_production_detailed.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_prodcons.pkl b/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_prodcons.pkl index fc2cea48..6f6ea78f 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_prodcons.pkl and b/energy_models/tests/jacobian_pkls/jacobian_EnergyGHGEmissions_prodcons.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 f47e6b53..765a1cc1 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 f47e6b53..765a1cc1 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_biogas_AnaerobicDigestion.pkl b/energy_models/tests/jacobian_pkls/jacobian_biogas_AnaerobicDigestion.pkl index e321905b..6940950c 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_biogas_AnaerobicDigestion.pkl and b/energy_models/tests/jacobian_pkls/jacobian_biogas_AnaerobicDigestion.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_amine_scrubbing.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_amine_scrubbing.pkl index 098c82e9..778ba534 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_amine_scrubbing.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_amine_scrubbing.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_calcium_looping.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_calcium_looping.pkl index d28437dc..0c06132b 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_calcium_looping.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_calcium_looping.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_calcium_potassium_scrubbing.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_calcium_potassium_scrubbing.pkl index 4044a3c2..28370bb2 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_calcium_potassium_scrubbing.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_capture_calcium_potassium_scrubbing.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage.pkl index a9a8ff4d..1bef7dba 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DeepOceanInjection.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DeepOceanInjection.pkl index 099e69d4..5625361b 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DeepOceanInjection.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DeepOceanInjection.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DeepSalineFormation.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DeepSalineFormation.pkl index ff17d7df..4bcbc3b7 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DeepSalineFormation.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DeepSalineFormation.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DepletedOilGas.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DepletedOilGas.pkl index ed1517cd..a6931912 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DepletedOilGas.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_DepletedOilGas.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_EnhancedOilRecovery.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_EnhancedOilRecovery.pkl index b63db60c..f05cd149 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_EnhancedOilRecovery.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_EnhancedOilRecovery.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_GeologicMineralization.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_GeologicMineralization.pkl index 91271435..ac3720ec 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_GeologicMineralization.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_GeologicMineralization.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_Pure_Carbon_Solid_Storage.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_Pure_Carbon_Solid_Storage.pkl index ec9418dd..dd9e3ff7 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_Pure_Carbon_Solid_Storage.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_Pure_Carbon_Solid_Storage.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_Reforestation.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_Reforestation.pkl index 2831630f..687dbf01 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_Reforestation.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_Reforestation.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_biomass_bf.pkl b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_biomass_bf.pkl index a5f1f1f0..cf4c714b 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_biomass_bf.pkl and b/energy_models/tests/jacobian_pkls/jacobian_carbon_storage_biomass_bf.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_dac_direct_air_capture.DirectAirCaptureTechno.pkl b/energy_models/tests/jacobian_pkls/jacobian_dac_direct_air_capture.DirectAirCaptureTechno.pkl index 57ff080a..e94edbf1 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_dac_direct_air_capture.DirectAirCaptureTechno.pkl and b/energy_models/tests/jacobian_pkls/jacobian_dac_direct_air_capture.DirectAirCaptureTechno.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_demand_model.pkl b/energy_models/tests/jacobian_pkls/jacobian_demand_model.pkl index 1d80ed5a..44f11306 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_demand_model.pkl and b/energy_models/tests/jacobian_pkls/jacobian_demand_model.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity.pkl index a074da18..fc83900f 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_biogas_fired.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_biogas_fired.pkl index 7cf3874d..8898e5b7 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_biogas_fired.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_biogas_fired.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_electricity_biomass_fired.pkl b/energy_models/tests/jacobian_pkls/jacobian_electricity_biomass_fired.pkl index 4e193743..da767b84 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_electricity_biomass_fired.pkl and b/energy_models/tests/jacobian_pkls/jacobian_electricity_biomass_fired.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 f92ac9f9..6d4458fd 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 57d4f283..2a90b2a0 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 eccbf3f0..7f01783b 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 8a65f581..bc66fa3a 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 a9bce81e..6f136137 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 214a7403..1fe6d138 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 72f1569f..5fbcddbd 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 782b7d83..e9e3b736 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..40b014ec 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..9f14ee66 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..89d0a50d 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_energy_invest_disc.pkl b/energy_models/tests/jacobian_pkls/jacobian_energy_invest_disc.pkl index a585cef9..0bb3fee7 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_energy_invest_disc.pkl and b/energy_models/tests/jacobian_pkls/jacobian_energy_invest_disc.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_energy_invest_or_ccs_disc.pkl b/energy_models/tests/jacobian_pkls/jacobian_energy_invest_or_ccs_disc.pkl index 8fc1b411..363f54e8 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_energy_invest_or_ccs_disc.pkl and b/energy_models/tests/jacobian_pkls/jacobian_energy_invest_or_ccs_disc.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_energy_mix_electricity_stream.pkl b/energy_models/tests/jacobian_pkls/jacobian_energy_mix_electricity_stream.pkl index 93f24509..d1eed97c 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_energy_mix_electricity_stream.pkl and b/energy_models/tests/jacobian_pkls/jacobian_energy_mix_electricity_stream.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_ethanol_BiomassFermentation.pkl b/energy_models/tests/jacobian_pkls/jacobian_ethanol_BiomassFermentation.pkl index c57e600e..e9c1dcc6 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ethanol_BiomassFermentation.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ethanol_BiomassFermentation.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_CO2_membranes.pkl b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_CO2_membranes.pkl index 21823429..b72bdf9c 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_CO2_membranes.pkl and b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_CO2_membranes.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_CalciumLooping.pkl b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_CalciumLooping.pkl index 3e85986f..8d773727 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_CalciumLooping.pkl and b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_CalciumLooping.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_chilled_ammonia_process.pkl b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_chilled_ammonia_process.pkl index c3174b58..f7b5cc0b 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_chilled_ammonia_process.pkl and b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_chilled_ammonia_process.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_mono_ethanol_amine.pkl b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_mono_ethanol_amine.pkl index 56f3ccb7..3a75e9ec 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_mono_ethanol_amine.pkl and b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_mono_ethanol_amine.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_piperazine_process.pkl b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_piperazine_process.pkl index 5b99b26d..230f701f 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_piperazine_process.pkl and b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_piperazine_process.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_pressure_swing_adsorption.pkl b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_pressure_swing_adsorption.pkl index 783bf5c3..ca15eb48 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_flue_gas_pressure_swing_adsorption.pkl and b/energy_models/tests/jacobian_pkls/jacobian_flue_gas_pressure_swing_adsorption.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_fluegas_discipline.pkl b/energy_models/tests/jacobian_pkls/jacobian_fluegas_discipline.pkl index 4b3f0e31..39ba044b 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_fluegas_discipline.pkl and b/energy_models/tests/jacobian_pkls/jacobian_fluegas_discipline.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_fuel.liquid_fuel.pkl b/energy_models/tests/jacobian_pkls/jacobian_fuel.liquid_fuel.pkl index 68ac5b2a..01149d31 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_fuel.liquid_fuel.pkl and b/energy_models/tests/jacobian_pkls/jacobian_fuel.liquid_fuel.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_generic_syngas.pkl b/energy_models/tests/jacobian_pkls/jacobian_generic_syngas.pkl index 376420f6..ad5e2b1b 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_generic_syngas.pkl and b/energy_models/tests/jacobian_pkls/jacobian_generic_syngas.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_hydrogen.gaseous_hydrogen.pkl b/energy_models/tests/jacobian_pkls/jacobian_hydrogen.gaseous_hydrogen.pkl index 8c3921ce..5746cf61 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_hydrogen.gaseous_hydrogen.pkl and b/energy_models/tests/jacobian_pkls/jacobian_hydrogen.gaseous_hydrogen.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_hydrogen.liquid_hydrogen.pkl b/energy_models/tests/jacobian_pkls/jacobian_hydrogen.liquid_hydrogen.pkl index 3f46a35c..f0db9bf8 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_hydrogen.liquid_hydrogen.pkl and b/energy_models/tests/jacobian_pkls/jacobian_hydrogen.liquid_hydrogen.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_hydrogen.pkl b/energy_models/tests/jacobian_pkls/jacobian_hydrogen.pkl index 2aab083c..34410cc5 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_hydrogen.pkl and b/energy_models/tests/jacobian_pkls/jacobian_hydrogen.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_hydrogen_AWE.pkl b/energy_models/tests/jacobian_pkls/jacobian_hydrogen_AWE.pkl index d50fd975..9852f9b2 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_hydrogen_AWE.pkl and b/energy_models/tests/jacobian_pkls/jacobian_hydrogen_AWE.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_hydrogen_PEM.pkl b/energy_models/tests/jacobian_pkls/jacobian_hydrogen_PEM.pkl index aa8ea91a..ad7990d2 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_hydrogen_PEM.pkl and b/energy_models/tests/jacobian_pkls/jacobian_hydrogen_PEM.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_hydrogen_SOEC.pkl b/energy_models/tests/jacobian_pkls/jacobian_hydrogen_SOEC.pkl index 2f65d67a..29e6a399 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_hydrogen_SOEC.pkl and b/energy_models/tests/jacobian_pkls/jacobian_hydrogen_SOEC.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_hydrogen_WGS.pkl b/energy_models/tests/jacobian_pkls/jacobian_hydrogen_WGS.pkl index 37369b2f..8bf3533e 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_hydrogen_WGS.pkl and b/energy_models/tests/jacobian_pkls/jacobian_hydrogen_WGS.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_hydrotreated_oil_fuel_HefaDecarboxylation.pkl b/energy_models/tests/jacobian_pkls/jacobian_hydrotreated_oil_fuel_HefaDecarboxylation.pkl index ec7640f1..6c042020 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_hydrotreated_oil_fuel_HefaDecarboxylation.pkl and b/energy_models/tests/jacobian_pkls/jacobian_hydrotreated_oil_fuel_HefaDecarboxylation.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_hydrotreated_oil_fuel_HefaDeoxygenation.pkl b/energy_models/tests/jacobian_pkls/jacobian_hydrotreated_oil_fuel_HefaDeoxygenation.pkl index 78b8b37c..91df6fc5 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_hydrotreated_oil_fuel_HefaDeoxygenation.pkl and b/energy_models/tests/jacobian_pkls/jacobian_hydrotreated_oil_fuel_HefaDeoxygenation.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_independent_invest_disc.pkl b/energy_models/tests/jacobian_pkls/jacobian_independent_invest_disc.pkl index eba14cf5..7b2b2f11 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_independent_invest_disc.pkl and b/energy_models/tests/jacobian_pkls/jacobian_independent_invest_disc.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_invest_ccs_disc.pkl b/energy_models/tests/jacobian_pkls/jacobian_invest_ccs_disc.pkl index 966f2c8d..53c3ef1a 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_invest_ccs_disc.pkl and b/energy_models/tests/jacobian_pkls/jacobian_invest_ccs_disc.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_investments_profile_builder_disc_all_years.pkl b/energy_models/tests/jacobian_pkls/jacobian_investments_profile_builder_disc_all_years.pkl new file mode 100644 index 00000000..175bee65 Binary files /dev/null and b/energy_models/tests/jacobian_pkls/jacobian_investments_profile_builder_disc_all_years.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_investments_profile_builder_disc_poles.pkl b/energy_models/tests/jacobian_pkls/jacobian_investments_profile_builder_disc_poles.pkl new file mode 100644 index 00000000..4d5a9f2b Binary files /dev/null and b/energy_models/tests/jacobian_pkls/jacobian_investments_profile_builder_disc_poles.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_Transesterification.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_Transesterification.pkl index b2f090a5..e2929b20 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_Transesterification.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_Transesterification.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_Transesterification_negative.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_Transesterification_negative.pkl index 696f0037..d9f2fe65 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_Transesterification_negative.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_Transesterification_negative.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS.pkl index 486de628..96358025 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS.pkl index ec9464cc..6b0e2d86 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS_bis.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS_bis.pkl index fd9130b9..fbfbb665 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS_bis.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS_bis.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS_negative.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS_negative.pkl index b138eaec..c2f11384 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS_negative.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_RWGS_and_WGS_negative.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_WGS.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_WGS.pkl index f7525bf5..18d75ccb 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_WGS.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_WGS.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_ratio_available_cc.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_ratio_available_cc.pkl index 599c4dbf..2d131b61 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_ratio_available_cc.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_fischer_tropsch_ratio_available_cc.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_refinery.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_refinery.pkl index 4d31859e..3f4d3831 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_refinery.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_fuel_refinery.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_liquid_hydrogen_hydrogen_liquefaction.pkl b/energy_models/tests/jacobian_pkls/jacobian_liquid_hydrogen_hydrogen_liquefaction.pkl index ccd67cdd..ad262e49 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_liquid_hydrogen_hydrogen_liquefaction.pkl and b/energy_models/tests/jacobian_pkls/jacobian_liquid_hydrogen_hydrogen_liquefaction.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_methane.pkl b/energy_models/tests/jacobian_pkls/jacobian_methane.pkl index 7d3adeba..6554ea2c 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_methane.pkl and b/energy_models/tests/jacobian_pkls/jacobian_methane.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 924feb4a..48738266 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_methane_methanation.pkl b/energy_models/tests/jacobian_pkls/jacobian_methane_methanation.pkl index bfa6a6e2..3ef9d89e 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_methane_methanation.pkl and b/energy_models/tests/jacobian_pkls/jacobian_methane_methanation.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_methane_upgrading_biogas.pkl b/energy_models/tests/jacobian_pkls/jacobian_methane_upgrading_biogas.pkl index 26388988..00f86ad7 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_methane_upgrading_biogas.pkl and b/energy_models/tests/jacobian_pkls/jacobian_methane_upgrading_biogas.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_methanol_CO2Hydrogenation.pkl b/energy_models/tests/jacobian_pkls/jacobian_methanol_CO2Hydrogenation.pkl index 96578099..51dfd782 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_methanol_CO2Hydrogenation.pkl and b/energy_models/tests/jacobian_pkls/jacobian_methanol_CO2Hydrogenation.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_one_invest_Invest.pkl b/energy_models/tests/jacobian_pkls/jacobian_one_invest_Invest.pkl index 0931d54f..1b5f151f 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_one_invest_Invest.pkl and b/energy_models/tests/jacobian_pkls/jacobian_one_invest_Invest.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_ratio_CoalExtraction.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_CoalExtraction.pkl index 67ee3726..3e191c8b 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_CoalExtraction.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_CoalExtraction.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_ratio_Electrolysis.PEM.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_Electrolysis.PEM.pkl index 069710d7..1841173a 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_Electrolysis.PEM.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_Electrolysis.PEM.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_ratio_FischerTropsch.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_FischerTropsch.pkl index 12662499..32f5e2c9 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_FischerTropsch.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_FischerTropsch.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 abe0b19e..348017de 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_HydrogenLiquefaction.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_HydrogenLiquefaction.pkl index 80682f04..63123c31 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_HydrogenLiquefaction.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_HydrogenLiquefaction.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..54155770 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/jacobian_pkls/jacobian_ratio_Refinery.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_Refinery.pkl index 9316a103..a2962453 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_Refinery.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_Refinery.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_ratio_SMR.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_SMR.pkl index 24333813..f9e62ee4 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_SMR.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_SMR.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_ratio_WaterGasShift.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_WaterGasShift.pkl index f26687c6..19f308b2 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_WaterGasShift.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_WaterGasShift.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_ratio_flue_gas_capture.CalciumLooping.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_flue_gas_capture.CalciumLooping.pkl index 947877b3..30ffbb28 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_flue_gas_capture.CalciumLooping.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_flue_gas_capture.CalciumLooping.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_ratio_hydrogen.gaseous_hydrogen.pkl b/energy_models/tests/jacobian_pkls/jacobian_ratio_hydrogen.gaseous_hydrogen.pkl index 0b1aa236..f6814586 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_ratio_hydrogen.gaseous_hydrogen.pkl and b/energy_models/tests/jacobian_pkls/jacobian_ratio_hydrogen.gaseous_hydrogen.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_redistribution_invest_disc_w_biomass.pkl b/energy_models/tests/jacobian_pkls/jacobian_redistribution_invest_disc_w_biomass.pkl index 343babb0..430423bf 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_redistribution_invest_disc_w_biomass.pkl and b/energy_models/tests/jacobian_pkls/jacobian_redistribution_invest_disc_w_biomass.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_redistribution_invest_disc_wo_biomass.pkl b/energy_models/tests/jacobian_pkls/jacobian_redistribution_invest_disc_wo_biomass.pkl index a384301c..a18566b2 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_redistribution_invest_disc_wo_biomass.pkl and b/energy_models/tests/jacobian_pkls/jacobian_redistribution_invest_disc_wo_biomass.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_solid_fuel.pkl b/energy_models/tests/jacobian_pkls/jacobian_solid_fuel.pkl index f81def74..982872a6 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_solid_fuel.pkl and b/energy_models/tests/jacobian_pkls/jacobian_solid_fuel.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_solid_fuel_coal_extraction.pkl b/energy_models/tests/jacobian_pkls/jacobian_solid_fuel_coal_extraction.pkl index 18708662..1848dcac 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_solid_fuel_coal_extraction.pkl and b/energy_models/tests/jacobian_pkls/jacobian_solid_fuel_coal_extraction.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_solid_fuel_pelletizing.pkl b/energy_models/tests/jacobian_pkls/jacobian_solid_fuel_pelletizing.pkl index 402a00cb..31be0c3c 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_solid_fuel_pelletizing.pkl and b/energy_models/tests/jacobian_pkls/jacobian_solid_fuel_pelletizing.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_specific_methanol.pkl b/energy_models/tests/jacobian_pkls/jacobian_specific_methanol.pkl index 23f1dfad..7ee1637e 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_specific_methanol.pkl and b/energy_models/tests/jacobian_pkls/jacobian_specific_methanol.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_syngas_ATR.pkl b/energy_models/tests/jacobian_pkls/jacobian_syngas_ATR.pkl index eb48ef07..be2683e5 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_syngas_ATR.pkl and b/energy_models/tests/jacobian_pkls/jacobian_syngas_ATR.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_syngas_RWGS.pkl b/energy_models/tests/jacobian_pkls/jacobian_syngas_RWGS.pkl index 3a3d9fc2..27243ef5 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_syngas_RWGS.pkl and b/energy_models/tests/jacobian_pkls/jacobian_syngas_RWGS.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_syngas_ReversedWaterGasShift.pkl b/energy_models/tests/jacobian_pkls/jacobian_syngas_ReversedWaterGasShift.pkl index b4426cae..0047b159 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_syngas_ReversedWaterGasShift.pkl and b/energy_models/tests/jacobian_pkls/jacobian_syngas_ReversedWaterGasShift.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_syngas_SMR.pkl b/energy_models/tests/jacobian_pkls/jacobian_syngas_SMR.pkl index fac867f6..20ffb578 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_syngas_SMR.pkl and b/energy_models/tests/jacobian_pkls/jacobian_syngas_SMR.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_syngas_biomass_gasification.pkl b/energy_models/tests/jacobian_pkls/jacobian_syngas_biomass_gasification.pkl index e61ce318..de02afdf 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_syngas_biomass_gasification.pkl and b/energy_models/tests/jacobian_pkls/jacobian_syngas_biomass_gasification.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_syngas_coal_gasification.pkl b/energy_models/tests/jacobian_pkls/jacobian_syngas_coal_gasification.pkl index c3a33cba..ed194fa8 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_syngas_coal_gasification.pkl and b/energy_models/tests/jacobian_pkls/jacobian_syngas_coal_gasification.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_syngas_coelectrolysis.pkl b/energy_models/tests/jacobian_pkls/jacobian_syngas_coelectrolysis.pkl index 4d5d4d39..731b1ca3 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_syngas_coelectrolysis.pkl and b/energy_models/tests/jacobian_pkls/jacobian_syngas_coelectrolysis.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_syngas_pyrolysis.pkl b/energy_models/tests/jacobian_pkls/jacobian_syngas_pyrolysis.pkl index 48633ee7..50f3b08d 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_syngas_pyrolysis.pkl and b/energy_models/tests/jacobian_pkls/jacobian_syngas_pyrolysis.pkl differ diff --git a/energy_models/tests/jacobian_pkls/jacobian_techno_invest_disc.pkl b/energy_models/tests/jacobian_pkls/jacobian_techno_invest_disc.pkl index 54324c52..44e73b09 100644 Binary files a/energy_models/tests/jacobian_pkls/jacobian_techno_invest_disc.pkl and b/energy_models/tests/jacobian_pkls/jacobian_techno_invest_disc.pkl differ diff --git a/energy_models/tests/l0_test_compute_fischer_tropsch_price.py b/energy_models/tests/l0_test_compute_fischer_tropsch_price.py index 9c275ee0..ad655a84 100644 --- a/energy_models/tests/l0_test_compute_fischer_tropsch_price.py +++ b/energy_models/tests/l0_test_compute_fischer_tropsch_price.py @@ -209,9 +209,9 @@ def test_03_FT_with_ratio_available_cc(self): self.ee2.execute() ratio = self.ee.dm.get_disciplines_with_name(f'{self.name}.{self.model_name}')[ - 0].mdo_discipline_wrapp.wrapper.techno_model.applied_ratio['applied_ratio'].values + 0].discipline_wrapp.wrapper.techno_model.applied_ratio['applied_ratio'].values ratio2 = self.ee2.dm.get_disciplines_with_name(f'{self.name}.{self.model_name}')[ - 0].mdo_discipline_wrapp.wrapper.techno_model.applied_ratio['applied_ratio'].values + 0].discipline_wrapp.wrapper.techno_model.applied_ratio['applied_ratio'].values techno_production_with_ratio = self.ee2.dm.get_value( f'{self.name}.{self.model_name}.{GlossaryEnergy.TechnoProductionValue}') diff --git a/energy_models/tests/l0_test_compute_fluegas_price.py b/energy_models/tests/l0_test_compute_fluegas_price.py index 4309049c..5d695778 100644 --- a/energy_models/tests/l0_test_compute_fluegas_price.py +++ b/energy_models/tests/l0_test_compute_fluegas_price.py @@ -136,7 +136,7 @@ def test_02_fluegas_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline succeed = disc_techno.check_jacobian(derr_approx='complex_step', inputs=[ f'{self.name}.{GlossaryEnergy.electricity}.{GlossaryEnergy.CoalGen}.{GlossaryEnergy.TechnoProductionValue}', diff --git a/energy_models/tests/l0_test_compute_lh_hydrogen_liquefaction.py b/energy_models/tests/l0_test_compute_lh_hydrogen_liquefaction.py index 0b6310ab..1959b732 100644 --- a/energy_models/tests/l0_test_compute_lh_hydrogen_liquefaction.py +++ b/energy_models/tests/l0_test_compute_lh_hydrogen_liquefaction.py @@ -19,8 +19,8 @@ import numpy as np import pandas as pd -from gemseo.utils.compare_data_manager_tooling import compare_dict from sostrades_core.execution_engine.execution_engine import ExecutionEngine +from sostrades_core.tools.compare_data_manager_tooling import compare_dict from energy_models.core.energy_mix.energy_mix import EnergyMix from energy_models.core.stream_type.resources_data_disc import ( @@ -163,8 +163,8 @@ def test_03_liquefaction_H2_double_run(self): self.ee.load_study_from_input_dict(inputs_dict) proxy_disc = self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline - local_data = proxy_disc.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline.local_data + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline + local_data = proxy_disc.proxy_disciplines[0].discipline_wrapp.discipline.local_data # self.ee.root_process.pre_run_mda() output_error = '' test_passed = True diff --git a/energy_models/tests/l0_test_energy_invest.py b/energy_models/tests/l0_test_energy_invest.py index 4dc2531b..3443f4ee 100644 --- a/energy_models/tests/l0_test_energy_invest.py +++ b/energy_models/tests/l0_test_energy_invest.py @@ -241,7 +241,7 @@ def test_06_techno_invest_disc_check_jacobian(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename='jacobian_techno_invest_disc.pkl', @@ -282,7 +282,7 @@ def test_07_energy_invest_disc_check_jacobian(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename='jacobian_energy_invest_disc.pkl', discipline=disc, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/l0_test_energy_invest_redistribution.py b/energy_models/tests/l0_test_energy_invest_redistribution.py index cb0b5d76..dafdf261 100644 --- a/energy_models/tests/l0_test_energy_invest_redistribution.py +++ b/energy_models/tests/l0_test_energy_invest_redistribution.py @@ -71,8 +71,8 @@ def setUp(self): 20., len(self.years))}) forest_invest = np.linspace(5, 8, len(self.years)) - self.forest_invest_df = pd.DataFrame( - {GlossaryEnergy.Years: self.years, GlossaryEnergy.ForestInvestmentValue: forest_invest}) + self.reforestation_investment_df = pd.DataFrame( + {GlossaryEnergy.Years: self.years, GlossaryEnergy.ReforestationInvestmentValue: forest_invest}) managed_wood_invest = np.linspace(0.5, 2, len(self.years)) self.managed_wood_invest_df = pd.DataFrame( {GlossaryEnergy.Years: self.years, "investment": managed_wood_invest}) @@ -118,7 +118,7 @@ def test_01_redistribution_invest_disc(self): f'{self.name}.{GlossaryEnergy.EconomicsDfValue}': self.economics_df, f'{self.name}.{self.model_name}.{GlossaryEnergy.TechnoInvestPercentageName}': self.invest_percentage_per_techno, f'{self.name}.{self.model_name}.{GlossaryEnergy.EnergyInvestPercentageGDPName}': self.invest_percentage_gdp, - f'{self.name}.{self.model_name}.{GlossaryEnergy.ForestInvestmentValue}': self.forest_invest_df + f'{self.name}.{self.model_name}.{GlossaryEnergy.ReforestationInvestmentValue}': self.reforestation_investment_df } self.ee.load_study_from_input_dict(inputs_dict) @@ -191,13 +191,13 @@ def test_02_redistribution_invest_disc_gradient(self): f'{self.name}.{GlossaryEnergy.EconomicsDfValue}': self.economics_df, f'{self.name}.{self.model_name}.{GlossaryEnergy.TechnoInvestPercentageName}': self.invest_percentage_per_techno, f'{self.name}.{self.model_name}.{GlossaryEnergy.EnergyInvestPercentageGDPName}': self.invest_percentage_gdp, - f'{self.name}.{self.model_name}.{GlossaryEnergy.ForestInvestmentValue}': self.forest_invest_df + f'{self.name}.{self.model_name}.{GlossaryEnergy.ReforestationInvestmentValue}': self.reforestation_investment_df } self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline all_technos_list = [ f'{energy}.{techno}' for energy in self.energy_list + self.ccs_list for techno in inputs_dict[f'{self.name}.{energy}.{GlossaryEnergy.techno_list}']] @@ -206,7 +206,7 @@ def test_02_redistribution_invest_disc_gradient(self): discipline=disc, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, inputs=[f'{self.name}.{GlossaryEnergy.EconomicsDfValue}', - f'{self.name}.{self.model_name}.{GlossaryEnergy.ForestInvestmentValue}', + f'{self.name}.{self.model_name}.{GlossaryEnergy.ReforestationInvestmentValue}', f'{self.name}.{self.model_name}.{GlossaryEnergy.EnergyInvestPercentageGDPName}' ], outputs=[f'{self.name}.{techno}.{GlossaryEnergy.InvestLevelValue}' for techno in @@ -251,7 +251,7 @@ def test_02_redistribution_invest_disc_gradient_wih_biomass_dry(self): f'{self.name}.{GlossaryEnergy.EconomicsDfValue}': self.economics_df, f'{self.name}.{self.model_name}.{GlossaryEnergy.TechnoInvestPercentageName}': self.invest_percentage_per_techno, f'{self.name}.{self.model_name}.{GlossaryEnergy.EnergyInvestPercentageGDPName}': self.invest_percentage_gdp, - f'{self.name}.{self.model_name}.{GlossaryEnergy.ForestInvestmentValue}': self.forest_invest_df, + f'{self.name}.{self.model_name}.{GlossaryEnergy.ReforestationInvestmentValue}': self.reforestation_investment_df, f'{self.name}.managed_wood_investment': self.managed_wood_invest_df, f'{self.name}.deforestation_investment': self.deforestation_invest_df, f'{self.name}.crop_investment': self.crop_invest_df @@ -260,7 +260,7 @@ def test_02_redistribution_invest_disc_gradient_wih_biomass_dry(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline all_technos_list = [ f'{energy}.{techno}' for energy in self.energy_list + self.ccs_list for techno in inputs_dict[f'{self.name}.{energy}.{GlossaryEnergy.techno_list}']] @@ -269,7 +269,7 @@ def test_02_redistribution_invest_disc_gradient_wih_biomass_dry(self): discipline=disc, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, inputs=[f'{self.name}.{GlossaryEnergy.EconomicsDfValue}', - f'{self.name}.{self.model_name}.{GlossaryEnergy.ForestInvestmentValue}', + f'{self.name}.{self.model_name}.{GlossaryEnergy.ReforestationInvestmentValue}', f'{self.name}.{self.model_name}.{GlossaryEnergy.EnergyInvestPercentageGDPName}', f'{self.name}.managed_wood_investment', f'{self.name}.deforestation_investment', diff --git a/energy_models/tests/l0_test_energy_or_ccs_invest.py b/energy_models/tests/l0_test_energy_or_ccs_invest.py index b22e6391..da3c4351 100644 --- a/energy_models/tests/l0_test_energy_or_ccs_invest.py +++ b/energy_models/tests/l0_test_energy_or_ccs_invest.py @@ -145,7 +145,7 @@ def test_03_energy_invest_disc_check_jacobian(self): f'{self.name}.{self.model_name}.{key}': value for key, value in self.input_dict.items()} self.ee.load_study_from_input_dict(namespaced_input_dict) self.ee.execute() - disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename='jacobian_energy_invest_or_ccs_disc.pkl', discipline=disc, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -213,7 +213,7 @@ def test_05_ccs_invest_disc_check_jacobian(self): self.ee.load_study_from_input_dict(namespaced_input_dict) self.ee.execute() ccs_list = [GlossaryEnergy.carbon_capture, GlossaryEnergy.carbon_storage] - disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename='jacobian_invest_ccs_disc.pkl', discipline=disc, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/l0_test_independent_invest.py b/energy_models/tests/l0_test_independent_invest.py index cc8ecba2..01a25bc0 100644 --- a/energy_models/tests/l0_test_independent_invest.py +++ b/energy_models/tests/l0_test_independent_invest.py @@ -68,8 +68,8 @@ def setUp(self): self.scaling_factor_techno_production = 1e3 forest_invest = np.linspace(5, 8, year_range) - self.forest_invest_df = pd.DataFrame( - {GlossaryEnergy.Years: self.years, GlossaryEnergy.ForestInvestmentValue: forest_invest}) + self.reforestation_investment_df = pd.DataFrame( + {GlossaryEnergy.Years: self.years, GlossaryEnergy.ReforestationInvestmentValue: forest_invest}) managed_wood_invest = np.linspace(0.5, 2, year_range) self.managed_wood_invest_df = pd.DataFrame( {GlossaryEnergy.Years: self.years, "investment": managed_wood_invest}) @@ -122,7 +122,7 @@ def test_02_independent_invest_disc(self): f'{self.name}.{GlossaryEnergy.ccus_type}.{GlossaryEnergy.carbon_storage}.{GlossaryEnergy.technologies_list}': [GlossaryEnergy.DeepSalineFormation, GlossaryEnergy.GeologicMineralization], f'{self.name}.{self.model_name}.{GlossaryEnergy.invest_mix}': self.energy_mix, - f'{self.name}.{self.model_name}.{GlossaryEnergy.ForestInvestmentValue}': self.forest_invest_df, + f'{self.name}.{self.model_name}.{GlossaryEnergy.ReforestationInvestmentValue}': self.reforestation_investment_df, } self.ee.load_study_from_input_dict(inputs_dict) @@ -199,7 +199,7 @@ def test_03_independent_invest_with_forest_disc(self): f'{self.name}.{GlossaryEnergy.ccus_type}.{GlossaryEnergy.carbon_storage}.{GlossaryEnergy.technologies_list}': [GlossaryEnergy.DeepSalineFormation, GlossaryEnergy.GeologicMineralization], f'{self.name}.{self.model_name}.{GlossaryEnergy.invest_mix}': self.energy_mix, - f'{self.name}.{GlossaryEnergy.ForestInvestmentValue}': self.forest_invest_df, + f'{self.name}.{GlossaryEnergy.ReforestationInvestmentValue}': self.reforestation_investment_df, f'{self.name}.Forest.managed_wood_investment': self.managed_wood_invest_df, f'{self.name}.Forest.deforestation_investment': self.deforestation_invest_df, f'{self.name}.Crop.crop_investment': self.crop_invest_df} diff --git a/energy_models/tests/l1_test_base_stream_electricity.py b/energy_models/tests/l1_test_base_stream_electricity.py index 82ddb7ed..038ffdd5 100644 --- a/energy_models/tests/l1_test_base_stream_electricity.py +++ b/energy_models/tests/l1_test_base_stream_electricity.py @@ -152,7 +152,7 @@ def test_01_base_stream(self): self.ee.execute() print(self.ee.display_treeview_nodes(True)) disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.electricity')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.electricity')[0].discipline_wrapp.discipline inputs_checked = [f'Test.electricity.{GlossaryEnergy.GasTurbine}.{GlossaryEnergy.TechnoProductionValue}', f'Test.electricity.{GlossaryEnergy.GasTurbine}.{GlossaryEnergy.TechnoConsumptionValue}', f'Test.electricity.Hydropower.{GlossaryEnergy.TechnoProductionValue}', diff --git a/energy_models/tests/l1_test_gradient_CO2_emissions_disc.py b/energy_models/tests/l1_test_gradient_CO2_emissions_disc.py index abada609..660e7373 100644 --- a/energy_models/tests/l1_test_gradient_CO2_emissions_disc.py +++ b/energy_models/tests/l1_test_gradient_CO2_emissions_disc.py @@ -151,7 +151,7 @@ def test_01_Consumption_CO2_emissions_discipline_CO2_per_use_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline coupled_inputs = [ f'{self.name}.{self.model_name}.{energy}.{GlossaryEnergy.CO2PerUse}' for energy in self.energy_list if @@ -226,7 +226,7 @@ def test_02_Consumption_CO2_emissions_discipline_energy_prod_cons_jacobian(self) self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline coupled_inputs = [ f'{self.name}.{energy}.{GlossaryEnergy.EnergyProductionValue}' for energy in self.ccs_list] diff --git a/energy_models/tests/l1_test_gradient_biogas.py b/energy_models/tests/l1_test_gradient_biogas.py index daf497a9..068286e4 100644 --- a/energy_models/tests/l1_test_gradient_biogas.py +++ b/energy_models/tests/l1_test_gradient_biogas.py @@ -125,7 +125,7 @@ def test_01_biomass_gas_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', local_data=disc_techno.local_data, diff --git a/energy_models/tests/l1_test_gradient_carbon_capture.py b/energy_models/tests/l1_test_gradient_carbon_capture.py index 86079dbf..2d4fcd31 100644 --- a/energy_models/tests/l1_test_gradient_carbon_capture.py +++ b/energy_models/tests/l1_test_gradient_carbon_capture.py @@ -172,7 +172,7 @@ def test_01_amine_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-15, local_data=disc_techno.local_data, @@ -222,7 +222,7 @@ def test_02_CaKOH_jacobian(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-15, derr_approx='complex_step', threshold=1e-5, @@ -274,7 +274,7 @@ def test_03_Calcium_looping_jacobian(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-15, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -353,7 +353,7 @@ def test_04_carbon_capture_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-15, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, @@ -397,7 +397,7 @@ def _test_04b_carbon_capture_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-15, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, @@ -456,7 +456,7 @@ def test_05_direct_air_capture_techno_discipline_gradient(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() #self.override_dump_jacobian = True - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_dac_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-15, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -499,7 +499,7 @@ def _test_06_direct_air_capture_techno_discipline_gradient(self): inputs_dict2[key] = "smooth_max" self.ee.load_study_from_input_dict(inputs_dict2) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_dac_{self.model_name}_2.pkl', discipline=disc_techno, step=1.0e-15, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, diff --git a/energy_models/tests/l1_test_gradient_carbon_storage.py b/energy_models/tests/l1_test_gradient_carbon_storage.py index 49974d0a..fbcf2282 100644 --- a/energy_models/tests/l1_test_gradient_carbon_storage.py +++ b/energy_models/tests/l1_test_gradient_carbon_storage.py @@ -166,7 +166,7 @@ def test_01_biomass_bf_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -221,7 +221,7 @@ def test_02_deep_ocean_injection_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -276,7 +276,7 @@ def test_03_deep_saline_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -330,7 +330,7 @@ def test_04_depleted_oil_gas_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -389,7 +389,7 @@ def test_05_pure_carbon_solid_storage_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -448,7 +448,7 @@ def test_06_geologic_mineralization_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -503,7 +503,7 @@ def test_07_enhanced_oil_recovery_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -558,7 +558,7 @@ def test_08_reforestation_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -633,7 +633,7 @@ def test_09_carbon_storage_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, diff --git a/energy_models/tests/l1_test_gradient_ccus_disc.py b/energy_models/tests/l1_test_gradient_ccus_disc.py index 04eb493d..902f2fd2 100644 --- a/energy_models/tests/l1_test_gradient_ccus_disc.py +++ b/energy_models/tests/l1_test_gradient_ccus_disc.py @@ -167,7 +167,7 @@ def test_01_Consumption_ccus_disciplinejacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline coupled_inputs = [ f'{self.name}.carbon_capture_from_energy_mix', diff --git a/energy_models/tests/l1_test_gradient_clean_energy_simple_techno.py b/energy_models/tests/l1_test_gradient_clean_energy_simple_techno.py index d4e6dc21..82f66cbe 100644 --- a/energy_models/tests/l1_test_gradient_clean_energy_simple_techno.py +++ b/energy_models/tests/l1_test_gradient_clean_energy_simple_techno.py @@ -139,7 +139,7 @@ def test_01_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', local_data=disc_techno.local_data, @@ -212,7 +212,7 @@ def test_02_discipline_analytic_grad_construction_delay_0(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}_construction_delay_0.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', diff --git a/energy_models/tests/l1_test_gradient_demand_model.py b/energy_models/tests/l1_test_gradient_demand_model.py index 05e7bf82..e958a4cc 100644 --- a/energy_models/tests/l1_test_gradient_demand_model.py +++ b/energy_models/tests/l1_test_gradient_demand_model.py @@ -100,7 +100,7 @@ def test_01_demand_model_discipline_jacobian(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/l1_test_gradient_electricity.py b/energy_models/tests/l1_test_gradient_electricity.py index 283a6bd6..b968add0 100644 --- a/energy_models/tests/l1_test_gradient_electricity.py +++ b/energy_models/tests/l1_test_gradient_electricity.py @@ -259,7 +259,7 @@ def test_01_combined_cycle_gas_turbine_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian( location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', @@ -313,7 +313,7 @@ def test_02_geothermal_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian( location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}_zz.pkl', @@ -368,7 +368,7 @@ def test_03_hydropower_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian( location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -424,7 +424,7 @@ def test_04_coal_gen_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian( location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', @@ -480,7 +480,7 @@ def test_05_gas_turbine_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-15, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -533,7 +533,7 @@ def test_06_wind_on_shore_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -587,7 +587,7 @@ def test_07_wind_off_shore_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -641,7 +641,7 @@ def test_08_solar_thermal_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -695,7 +695,7 @@ def test_09_solar_pv_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian( location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', @@ -750,7 +750,7 @@ def test_10_nuclear_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-15, local_data=disc_techno.local_data, @@ -803,7 +803,7 @@ def test_11_biogas_fired_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -857,7 +857,7 @@ def test_12_biomass_fired_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -911,7 +911,7 @@ def test_13_oil_gen_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -977,7 +977,7 @@ def test_14_electricity_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, diff --git a/energy_models/tests/l1_test_gradient_energy_mix_for_coarse.py b/energy_models/tests/l1_test_gradient_energy_mix_for_coarse.py deleted file mode 100644 index b32b042f..00000000 --- a/energy_models/tests/l1_test_gradient_energy_mix_for_coarse.py +++ /dev/null @@ -1,157 +0,0 @@ -''' -Copyright 2023 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 os -from os.path import dirname - -import numpy as np -import pandas as pd -from climateeconomics.sos_processes.iam.witness.witness_coarse.usecase_witness_coarse_new import ( - DEFAULT_COARSE_TECHNO_DICT, -) -from sostrades_core.execution_engine.execution_engine import ExecutionEngine -from sostrades_core.tests.core.abstract_jacobian_unit_test import ( - AbstractJacobianUnittest, -) - -from energy_models.core.energy_process_builder import INVEST_DISCIPLINE_OPTIONS -from energy_models.glossaryenergy import GlossaryEnergy -from energy_models.sos_processes.energy.MDA.energy_process_v0_mda.usecase import Study - - -class EnergyMixCoarseJacobianTestCase(AbstractJacobianUnittest): - """ - Energy mix jacobian test class - """ - # AbstractJacobianUnittest.DUMP_JACOBIAN = True - - def analytic_grad_entry(self): - return [] - - def setUp(self): - ''' - Initialize third data needed for testing - ''' - self.name = 'Test' - self.ee = ExecutionEngine(self.name) - self.model_name = 'EnergyMix' - - repo = 'energy_models.sos_processes.energy.MDA' - builder = self.ee.factory.get_builder_from_process( - repo, 'energy_process_v0_mda', - techno_dict=DEFAULT_COARSE_TECHNO_DICT, invest_discipline=INVEST_DISCIPLINE_OPTIONS[2]) - - self.ee.factory.set_builders_to_coupling_builder(builder) - self.ee.configure() - usecase = Study(execution_engine=self.ee, - invest_discipline=INVEST_DISCIPLINE_OPTIONS[2], techno_dict=DEFAULT_COARSE_TECHNO_DICT, - main_study=True) - usecase.study_name = self.name - values_dict = usecase.setup_usecase() - - self.ee.display_treeview_nodes() - self.full_values_dict = {} - for dict_v in values_dict: - self.full_values_dict.update(dict_v) - self.full_values_dict[f'{self.name}.epsilon0'] = 1.0 - self.full_values_dict[f'{self.name}.tolerance'] = 1.0e-8 - self.full_values_dict[f'{self.name}.max_mda_iter'] = 50 - forest_investment = pd.DataFrame({ - GlossaryEnergy.Years: np.arange(GlossaryEnergy.YearStartDefault, GlossaryEnergy.YearEndDefault + 1), - GlossaryEnergy.ForestInvestmentValue: 5. - }) - self.full_values_dict.update({ - f"{self.name}.InvestmentDistribution.{GlossaryEnergy.ForestInvestmentValue}": forest_investment, - - }) - self.ee.load_study_from_input_dict(self.full_values_dict) - - self.ee.execute() - - self.disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.EnergyMix')[0].mdo_discipline_wrapp.mdo_discipline - self.energy_list = [GlossaryEnergy.clean_energy, GlossaryEnergy.fossil] - - def TearDown(self): - ''' - To execute after tests - ''' - - def test_01_energy_mix_discipline_co2_emissions_gt(self): - inputs_names = [] - - inputs_names.extend([ - f'{self.name}.{self.model_name}.{energy}.{GlossaryEnergy.StreamPricesValue}' for energy in self.energy_list - if - energy not in [GlossaryEnergy.carbon_capture, GlossaryEnergy.carbon_storage]]) - inputs_names.extend([ - f'{self.name}.{self.model_name}.{energy}.{GlossaryEnergy.EnergyProductionValue}' for energy in - self.energy_list if - energy not in [GlossaryEnergy.carbon_capture, GlossaryEnergy.carbon_storage]]) - inputs_names.extend( - [f'{self.name}.{self.model_name}.{energy}.{GlossaryEnergy.StreamConsumptionValue}' for energy in - self.energy_list if - energy not in [GlossaryEnergy.carbon_capture, GlossaryEnergy.carbon_storage]]) - inputs_names.extend( - [f'{self.name}.{GlossaryEnergy.ccus_type}.{energy}.{GlossaryEnergy.StreamConsumptionValue}' for energy in - [GlossaryEnergy.carbon_capture, GlossaryEnergy.carbon_storage]]) - - inputs_names.extend( - [f'{self.name}.{GlossaryEnergy.ccus_type}.{energy}.{GlossaryEnergy.EnergyProductionValue}' for energy in - [GlossaryEnergy.carbon_capture, GlossaryEnergy.carbon_storage]]) - inputs_names.extend([ - f'{self.name}.{GlossaryEnergy.ccus_type}.{energy}.{GlossaryEnergy.StreamPricesValue}' for energy in - [GlossaryEnergy.carbon_capture, GlossaryEnergy.carbon_storage]]) - inputs_names.extend( - [f'{self.name}.{self.model_name}.{energy}.{GlossaryEnergy.CO2EmissionsValue}' for energy in self.energy_list - if - energy not in [GlossaryEnergy.carbon_capture, GlossaryEnergy.carbon_storage]]) - self.override_dump_jacobian = True - self.check_jacobian(location=dirname(__file__), filename='jacobian_coarse_energymix_co2_emissions.pkl', - discipline=self.disc, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, - local_data=self.disc.local_data, - inputs=inputs_names, - outputs=[f'{self.name}.{self.model_name}.co2_emissions_needed_by_energy_mix', - f'{self.name}.{self.model_name}.carbon_capture_from_energy_mix', - f'{self.name}.{self.model_name}.{GlossaryEnergy.EnergyMeanPriceValue}', - f'{self.name}.FunctionManagerDisc.{GlossaryEnergy.EnergyMeanPriceObjectiveValue}', - f'{self.name}.{self.model_name}.{GlossaryEnergy.EnergyProductionValue}', - f'{self.name}.{self.model_name}.land_demand_df', - f'{self.name}.{GlossaryEnergy.EnergyCapitalDfValue}', - f'{self.name}.{self.model_name}.energy_prices_after_tax', - f'{self.name}.FunctionManagerDisc.{GlossaryEnergy.TargetProductionConstraintValue}' - ]) - path_pickle = os.path.join(dirname(__file__), 'jacobian_pkls', 'jacobian_coarse_energymix_co2_emissions.pkl') - ''' - For unknown reasons, the test does not pass on the platform (Tekton) but passes locally. - Therefore, the pkl file is removed after the test is done so that it is automatically regenerated at - each execution of the test - ''' # FIXME: address this --> remove the self.override_dump_jacobian in both tests - os.remove(path_pickle) - - def test_02_energy_mix_co2_tax(self): - inputs_names = [ - f'{self.name}.{GlossaryEnergy.CO2TaxesValue}'] - - energy_mix_output = [f'{self.name}.{self.model_name}.{GlossaryEnergy.EnergyMeanPriceValue}', - f'{self.name}.FunctionManagerDisc.{GlossaryEnergy.EnergyMeanPriceObjectiveValue}', - f'{self.name}.{self.model_name}.energy_prices_after_tax'] - self.override_dump_jacobian = True - self.check_jacobian(location=dirname(__file__), filename='jacobian_coarse_energy_mix_co2_tax.pkl', - discipline=self.disc, step=1.0e-12, derr_approx='complex_step', threshold=1e-5, - local_data=self.disc.local_data, - inputs=inputs_names, outputs=energy_mix_output) - path_pickle = os.path.join(dirname(__file__), 'jacobian_pkls', 'jacobian_coarse_energy_mix_co2_tax.pkl') - os.remove(path_pickle) diff --git a/energy_models/tests/l1_test_gradient_ethanol.py b/energy_models/tests/l1_test_gradient_ethanol.py index 55b717e6..db9a998c 100644 --- a/energy_models/tests/l1_test_gradient_ethanol.py +++ b/energy_models/tests/l1_test_gradient_ethanol.py @@ -124,7 +124,7 @@ def test_01_biomass_fermentation_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, diff --git a/energy_models/tests/l1_test_gradient_fischertropsch.py b/energy_models/tests/l1_test_gradient_fischertropsch.py index 451a7c0c..f7441e33 100644 --- a/energy_models/tests/l1_test_gradient_fischertropsch.py +++ b/energy_models/tests/l1_test_gradient_fischertropsch.py @@ -146,7 +146,7 @@ def test_01_FT_gradient_syngas_ratio_08(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', local_data=disc_techno.local_data, @@ -212,7 +212,7 @@ def test_02_FT_gradient_syngas_ratio_03(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', @@ -278,7 +278,7 @@ def test_03_FT_gradient_variable_syngas_ratio(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', @@ -333,7 +333,8 @@ def test_04_FT_gradient_variable_syngas_ratio_bis(self): f'{self.name}.{GlossaryEnergy.TransportCostValue}': self.transport, f'{self.name}.{GlossaryEnergy.CO2TaxesValue}': self.co2_taxes, f'{self.name}.syngas_ratio': np.array( - list(np.linspace(100, 0, 5)) + list(np.linspace(0, 100, 6))), + list(np.linspace(100, 0, 5) + ) + list(np.linspace(0, 100, GlossaryEnergy.YearEndDefaultValueGradientTest - self.years[4]))), f'{self.name}.syngas_ratio_technos': self.syngas_ratio_technos, f'{self.name}.energy_detailed_techno_prices': self.syngas_detailed_prices, f'{self.name}.{GlossaryEnergy.AllStreamsDemandRatioValue}': self.all_streams_demand_ratio, @@ -345,7 +346,7 @@ def test_04_FT_gradient_variable_syngas_ratio_bis(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', @@ -409,7 +410,7 @@ def test_05_FT_gradient_ratio_available_cc(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', local_data=disc_techno.local_data, @@ -473,7 +474,7 @@ def test_06_FT_gradient_variable_syngas_ratio_invest_negative(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', diff --git a/energy_models/tests/l1_test_gradient_flue_gas.py b/energy_models/tests/l1_test_gradient_flue_gas.py index debf8c46..7856015a 100644 --- a/energy_models/tests/l1_test_gradient_flue_gas.py +++ b/energy_models/tests/l1_test_gradient_flue_gas.py @@ -168,7 +168,7 @@ def test_01_calcium_looping_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -232,7 +232,7 @@ def test_02_pressure_swing_adsorption_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -295,7 +295,7 @@ def test_03_piperazine_process_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -357,7 +357,7 @@ def test_04_monoethanolamine_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -421,7 +421,7 @@ def test_05_co2_membranes_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, @@ -485,7 +485,7 @@ def test_06_chilled_ammonia_process_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, local_data=disc_techno.local_data, diff --git a/energy_models/tests/l1_test_gradient_fossil_simple_techno.py b/energy_models/tests/l1_test_gradient_fossil_simple_techno.py index 84ffa18a..f0f79eff 100644 --- a/energy_models/tests/l1_test_gradient_fossil_simple_techno.py +++ b/energy_models/tests/l1_test_gradient_fossil_simple_techno.py @@ -124,7 +124,7 @@ def test_01_discipline_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', local_data=disc_techno.local_data, @@ -183,7 +183,7 @@ def test_02_discipline_analytic_grad_construction_delay_0(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}_construction_delay_0.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', diff --git a/energy_models/tests/l1_test_gradient_ghg_energy_emissions_disc.py b/energy_models/tests/l1_test_gradient_ghg_energy_emissions_disc.py index 31fd3d62..acb17b4d 100644 --- a/energy_models/tests/l1_test_gradient_ghg_energy_emissions_disc.py +++ b/energy_models/tests/l1_test_gradient_ghg_energy_emissions_disc.py @@ -187,7 +187,7 @@ def test_01_GHGEnergy_emissions_discipline_CO2_per_use_jacobian(self): ''' disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline energy_list_wobiomass_dry = [ energy for energy in self.energy_list if energy != GlossaryEnergy.biomass_dry] @@ -217,7 +217,7 @@ def test_02_GHGEnergy_emissions_discipline_energy_prod_cons_jacobian(self): ''' disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline energy_list_wobiomass_dry = [ energy for energy in self.energy_list if energy != GlossaryEnergy.biomass_dry] @@ -245,7 +245,7 @@ def test_03_GHGENergy_from_energy_mix_jacobian(self): ''' disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline coupled_inputs = [ f'{self.name}.co2_emissions_ccus_Gt', @@ -266,7 +266,7 @@ def test_04_GHGENergy_energy_production_detailed_jacobian(self): ''' disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline coupled_inputs = [ f'{self.name}.{GlossaryEnergy.StreamProductionDetailedValue}'] diff --git a/energy_models/tests/l1_test_gradient_hydrogen.py b/energy_models/tests/l1_test_gradient_hydrogen.py index 565b01a7..e4c6b3e0 100644 --- a/energy_models/tests/l1_test_gradient_hydrogen.py +++ b/energy_models/tests/l1_test_gradient_hydrogen.py @@ -241,7 +241,7 @@ def test_01_wgs_jacobian(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', local_data=disc_techno.local_data, @@ -307,7 +307,7 @@ def _test_02_plasma_cracking_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline np.set_printoptions(100) # np.set_printoptions(threshold=50) @@ -385,7 +385,7 @@ def test_03_electrolysis_PEMjacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-15, derr_approx='complex_step', @@ -449,7 +449,7 @@ def test_04_electrolysis_SOEC_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', @@ -513,7 +513,7 @@ def test_05_electrolysis_AWE_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', @@ -587,7 +587,7 @@ def test_06_hydrogen_jacobian(self): self.ee.execute() - disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-16, derr_approx='complex_step', local_data=disc.local_data, inputs=[f'{self.name}.{self.model_name}.{GlossaryEnergy.WaterGasShift}.{GlossaryEnergy.TechnoPricesValue}', @@ -665,7 +665,7 @@ def test_08_gaseous_hydrogen_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, diff --git a/energy_models/tests/l1_test_gradient_hydrotreated_oil_fuel.py b/energy_models/tests/l1_test_gradient_hydrotreated_oil_fuel.py index 00cce3eb..e0cde81e 100644 --- a/energy_models/tests/l1_test_gradient_hydrotreated_oil_fuel.py +++ b/energy_models/tests/l1_test_gradient_hydrotreated_oil_fuel.py @@ -124,7 +124,7 @@ def test_01_hefa_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline disc = self.ee.dm.get_disciplines_with_name( f'{self.name}.{self.model_name}')[0] filters = disc.get_chart_filter_list() @@ -188,7 +188,7 @@ def test_02_hefa_green_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/l1_test_gradient_independent_invest_disc.py b/energy_models/tests/l1_test_gradient_independent_invest_disc.py index d3763d40..609ec582 100644 --- a/energy_models/tests/l1_test_gradient_independent_invest_disc.py +++ b/energy_models/tests/l1_test_gradient_independent_invest_disc.py @@ -71,8 +71,8 @@ def setUp(self): self.scaling_factor_techno_consumption = 1e3 self.scaling_factor_techno_production = 1e3 - self.forest_invest_df = pd.DataFrame( - {GlossaryEnergy.Years: self.years, GlossaryEnergy.ForestInvestmentValue: np.linspace(5, 8, year_range)}) + self.reforestation_investment_df = pd.DataFrame( + {GlossaryEnergy.Years: self.years, GlossaryEnergy.ReforestationInvestmentValue: np.linspace(5, 8, year_range)}) self.managed_wood_invest_df = pd.DataFrame( {GlossaryEnergy.Years: self.years, "investment": np.linspace(0.5, 2, year_range)}) @@ -135,7 +135,7 @@ def test_01_analytic_grad(self): f'{self.name}.{GlossaryEnergy.carbon_storage}.{GlossaryEnergy.technologies_list}': [GlossaryEnergy.DeepSalineFormation, GlossaryEnergy.GeologicMineralization], f'{self.name}.{self.model_name}.{GlossaryEnergy.invest_mix}': self.energy_mix, - f'{self.name}.{GlossaryEnergy.ForestInvestmentValue}': self.forest_invest_df, + f'{self.name}.{GlossaryEnergy.ReforestationInvestmentValue}': self.reforestation_investment_df, f'{self.name}.managed_wood_investment': self.managed_wood_invest_df, f'{self.name}.deforestation_investment': self.deforestation_invest_df, f'{self.name}.crop_investment': self.crop_invest_df} @@ -143,13 +143,13 @@ def test_01_analytic_grad(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline all_technos_list = [ f'{energy}.{techno}' for energy in energy_list + self.ccs_list for techno in inputs_dict[f'{self.name}.{energy}.{GlossaryEnergy.techno_list}']] self.check_jacobian(derr_approx='complex_step', inputs=[f'{self.name}.{self.model_name}.{GlossaryEnergy.invest_mix}', - f'{self.name}.{GlossaryEnergy.ForestInvestmentValue}', + f'{self.name}.{GlossaryEnergy.ReforestationInvestmentValue}', f'{self.name}.managed_wood_investment', f'{self.name}.deforestation_investment', f'{self.name}.crop_investment'], diff --git a/energy_models/tests/l1_test_gradient_investments_profile_builder.py b/energy_models/tests/l1_test_gradient_investments_profile_builder.py new file mode 100644 index 00000000..f496b63e --- /dev/null +++ b/energy_models/tests/l1_test_gradient_investments_profile_builder.py @@ -0,0 +1,150 @@ +''' +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. +''' +from os.path import dirname + +import numpy as np +import pandas as pd +from sostrades_core.execution_engine.execution_engine import ExecutionEngine +from sostrades_core.tests.core.abstract_jacobian_unit_test import ( + AbstractJacobianUnittest, +) + +from energy_models.glossaryenergy import GlossaryEnergy + + +class TestInvestmentProfileBuilderDisc(AbstractJacobianUnittest): + """ + Resources prices test class + """ + + def setUp(self): + ''' + Initialize third data needed for testing + ''' + self.override_dump_jacobian = True # let that to True + self.name = 'Test' + self.model_name = 'investments profile' + self.columns_names = [GlossaryEnergy.clean_energy, GlossaryEnergy.fossil, GlossaryEnergy.carbon_capture] + self.n_profiles = 4 + self.coeff_jacobian = [f'{self.name}.{self.model_name}.coeff_{i}' for i in range(self.n_profiles)] + self.year_min = 2020 + self.year_max = 2025 + self.years = np.arange(self.year_min, self.year_max + 1) + + self.inputs_dict = { + f'{self.name}.{self.model_name}.column_names': self.columns_names, + f'{self.name}.{self.model_name}.n_profiles': self.n_profiles, + f'{self.name}.{self.model_name}.{GlossaryEnergy.EXPORT_PROFILES_AT_POLES}': False, + + } + + def df_generator(years): + df = pd.DataFrame({ + **{GlossaryEnergy.Years: years}, + **dict(zip(self.columns_names, np.random.rand(len(self.columns_names)))) + }) + return df + + self.inputs_dict.update({ + f"{self.name}.{self.model_name}.coeff_{i}": np.random.uniform(0, 15) for i in range(self.n_profiles) + }) + + self.inputs_dict.update({ + f"{self.name}.{self.model_name}.df_{i}": df_generator(self.years) for i in range(self.n_profiles) + }) + pass + + def tearDown(self): + pass + + def analytic_grad_entry(self): + return [ + self.test_01_output_invest_mix, + self.test_02_output_at_poles, + ] + + def test_01_output_invest_mix(self): + ''' + Test the gradient of the invest profile exported into invest_mix + ''' + + self.ee = ExecutionEngine(self.name) + ns_dict = {'ns_invest': f'{self.name}.{self.model_name}', } + self.ee.ns_manager.add_ns_def(ns_dict) + + mod_path = 'energy_models.core.investments.disciplines.investments_profile_builder_disc.InvestmentsProfileBuilderDisc' + + builder = self.ee.factory.get_builder_from_module( + self.model_name, mod_path) + + self.ee.factory.set_builders_to_coupling_builder(builder) + + self.ee.configure() + self.ee.display_treeview_nodes() + + self.ee.load_study_from_input_dict(self.inputs_dict) + + self.ee.execute() + + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline + self.check_jacobian(derr_approx='complex_step', + inputs=self.coeff_jacobian, + outputs=[f'{self.name}.{self.model_name}.{GlossaryEnergy.invest_mix}'], + local_data=disc.local_data, + location=dirname(__file__), + discipline=disc, + filename='jacobian_investments_profile_builder_disc_all_years.pkl', threshold=1e-5, ) + + def test_02_output_at_poles(self): + ''' + Test the gradient of the invest profile exported into mix_array at the poles + ''' + inputs_dict = self.inputs_dict.copy() + nb_poles = 3 + inputs_dict.update({ + f'{self.name}.{self.model_name}.nb_poles': nb_poles, + f'{self.name}.{self.model_name}.{GlossaryEnergy.EXPORT_PROFILES_AT_POLES}': True, + + }) + + self.ee = ExecutionEngine(self.name) + ns_dict = {'ns_invest': f'{self.name}.{self.model_name}', } + self.ee.ns_manager.add_ns_def(ns_dict) + + mod_path = 'energy_models.core.investments.disciplines.investments_profile_builder_disc.InvestmentsProfileBuilderDisc' + + builder = self.ee.factory.get_builder_from_module( + self.model_name, mod_path) + + self.ee.factory.set_builders_to_coupling_builder(builder) + + self.ee.configure() + self.ee.display_treeview_nodes() + + self.ee.load_study_from_input_dict(inputs_dict) + + self.ee.execute() + + outputs = [f'{self.name}.{self.model_name}.{col}_array_mix' for col in self.columns_names] + + disc = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline + self.check_jacobian(derr_approx='complex_step', + inputs=self.coeff_jacobian, + outputs=outputs, + local_data=disc.local_data, + location=dirname(__file__), + discipline=disc, + filename='jacobian_investments_profile_builder_disc_poles.pkl', threshold=1e-5, ) diff --git a/energy_models/tests/l1_test_gradient_liquid_fuel.py b/energy_models/tests/l1_test_gradient_liquid_fuel.py index 3ca94d75..9d0c54a5 100644 --- a/energy_models/tests/l1_test_gradient_liquid_fuel.py +++ b/energy_models/tests/l1_test_gradient_liquid_fuel.py @@ -166,7 +166,7 @@ def test_01_refinery_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -228,7 +228,7 @@ def test_02_transesterification_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -290,8 +290,9 @@ def test_03_transesterification_discipline_analytic_grad_negative_invest(self): self.ee.load_study_from_input_dict(inputs_dict) self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline - self.override_dump_jacobian = True # Test seems KO in server, regenerate pickle at each test + + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline + self.override_dump_jacobian = True # Test seems KO in server, regenerate pickle at each test self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}_negative.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', @@ -373,7 +374,7 @@ def test_05_liquid_fuel_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/l1_test_gradient_liquid_hydrogen.py b/energy_models/tests/l1_test_gradient_liquid_hydrogen.py index 841916cc..bf49591d 100644 --- a/energy_models/tests/l1_test_gradient_liquid_hydrogen.py +++ b/energy_models/tests/l1_test_gradient_liquid_hydrogen.py @@ -160,7 +160,7 @@ def test_01_hydrogen_liquefaction_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -240,7 +240,7 @@ def test_02_liquid_hydrogen_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/l1_test_gradient_methane.py b/energy_models/tests/l1_test_gradient_methane.py index f1e63eaa..9043ed9f 100644 --- a/energy_models/tests/l1_test_gradient_methane.py +++ b/energy_models/tests/l1_test_gradient_methane.py @@ -141,7 +141,7 @@ def test_01_fossil_gas_discipline_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -201,7 +201,7 @@ def test_02_methanation_discipline_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -260,7 +260,7 @@ def test_03_upgrading_biogas_discipline_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -338,7 +338,7 @@ def test_04_methane_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/l1_test_gradient_methanol.py b/energy_models/tests/l1_test_gradient_methanol.py index 0947ad68..5f07bcab 100644 --- a/energy_models/tests/l1_test_gradient_methanol.py +++ b/energy_models/tests/l1_test_gradient_methanol.py @@ -141,7 +141,7 @@ def test_01_co2_hydrogenation_discipline_analytic_grad(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -222,7 +222,7 @@ def test_02_methanol_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_specific_{self.energy_name}.pkl', discipline=disc, step=1.0e-15, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, diff --git a/energy_models/tests/l1_test_gradient_one_invest.py b/energy_models/tests/l1_test_gradient_one_invest.py index da224f8b..f93f5039 100644 --- a/energy_models/tests/l1_test_gradient_one_invest.py +++ b/energy_models/tests/l1_test_gradient_one_invest.py @@ -123,7 +123,7 @@ def test_01_one_invest_analytic_grad(self): all_technos_list = [ f'{energy}.{techno}' for energy in energy_list + self.ccs_list for techno in inputs_dict[f'{self.name}.{energy}.{GlossaryEnergy.techno_list}']] - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_one_invest_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/l1_test_gradient_ratio.py b/energy_models/tests/l1_test_gradient_ratio.py index dba7c279..abe4f47c 100644 --- a/energy_models/tests/l1_test_gradient_ratio.py +++ b/energy_models/tests/l1_test_gradient_ratio.py @@ -48,7 +48,6 @@ def analytic_grad_entry(self): self.test_07_ratio_CalciumLooping_discipline_jacobian, self.test_08_gaseous_hydrogen_discipline_jacobian, # self.test_09_carbon_capture_discipline_jacobian, - self.test_12_energy_mix_all_stream_demand_ratio_discipline_jacobian, self.test_01b_ratio_FossilGas_discipline_jacobian(), self.test_02b_ratio_Nuclear_discipline_jacobian(), self.test_03b_ratio_CoalExtraction_discipline_jacobian(), @@ -116,7 +115,7 @@ def test_01_ratio_hydrogen_liquefaction_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -169,7 +168,7 @@ def test_01_ratio_hydrogen_liquefaction_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_{self.techno_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, @@ -208,7 +207,7 @@ def test_02_ratio_SMR_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -261,7 +260,7 @@ def test_02_ratio_SMR_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_{self.techno_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -303,7 +302,7 @@ def test_05_ratio_WaterGasShift_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -357,7 +356,7 @@ def test_05_ratio_WaterGasShift_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_{self.techno_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -398,7 +397,7 @@ def test_06_ratio_FischerTropsch_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -456,7 +455,7 @@ def test_06_ratio_FischerTropsch_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_{self.techno_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, @@ -496,7 +495,7 @@ def test_07_ratio_CalciumLooping_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -548,7 +547,7 @@ def test_07_ratio_CalciumLooping_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_{self.techno_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -624,7 +623,7 @@ def test_08_gaseous_hydrogen_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -705,7 +704,7 @@ def _test_09_carbon_capture_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_cc{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -744,7 +743,7 @@ def _test_10_energy_mix_discipline_jacobian(self): full_values_dict[f'{self.name}.epsilon0'] = 1.0 full_values_dict[f'{self.name}.tolerance'] = 1.0e-8 full_values_dict[f'{self.name}.max_mda_iter'] = 1 - full_values_dict[f'{self.name}.sub_mda_class'] = 'MDAGaussSeidel' + full_values_dict[f'{self.name}.inner_mda_name'] = 'MDAGaussSeidel' # Overwrite values for ratios with values from setup full_values_dict[f'{self.name}.is_apply_ratio'] = self.is_apply_ratio full_values_dict[f'{self.name}.is_stream_demand'] = self.is_stream_demand @@ -757,7 +756,7 @@ def _test_10_energy_mix_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline # Get coupled inputs and outputs full_inputs = disc.get_input_data_names() @@ -811,7 +810,7 @@ def _test_11_energy_mix_discipline_in_WITNESSFull_jacobian(self): full_values_dict[f'{self.name}.{GlossaryEnergy.YearEnd}'] = self.year_end full_values_dict[f'{self.name}.{usecase.coupling_name}.epsilon0'] = 1.0 full_values_dict[f'{self.name}.{usecase.coupling_name}.tolerance'] = 1.0e-8 - full_values_dict[f'{self.name}.{usecase.coupling_name}.sub_mda_class'] = 'MDANewtonRaphson' + full_values_dict[f'{self.name}.{usecase.coupling_name}.inner_mda_name'] = 'MDANewtonRaphson' full_values_dict[f'{self.name}.{usecase.coupling_name}.max_mda_iter'] = 1 # Overwrite values for ratios with values from setup full_values_dict[ @@ -835,7 +834,7 @@ def _test_11_energy_mix_discipline_in_WITNESSFull_jacobian(self): # EnergyMix disc = self.ee.dm.get_disciplines_with_name( f'{self.name}.{usecase.coupling_name}.{usecase.extra_name}.{self.model_name}')[ - 0].mdo_discipline_wrapp.mdo_discipline + 0].discipline_wrapp.discipline # Get coupled inputs and outputs full_inputs = disc.get_input_data_names() @@ -892,75 +891,6 @@ def _test_11_energy_mix_discipline_in_WITNESSFull_jacobian(self): discipline=disc, step=1.0e-16, derr_approx='complex_step', local_data=disc.local_data, inputs=coupled_inputs, outputs=coupled_outputs, ) - def test_12_energy_mix_all_stream_demand_ratio_discipline_jacobian(self): - ''' - Test the gradients of the ratios on EnergyMix discipline. - For now do not include it to the test routine (not sure how volatile this test it) - ''' - self.model_name = 'EnergyMix' - self.ee = ExecutionEngine(self.name) - ns_dict = {GlossaryEnergy.NS_ENERGY_MIX: f'{self.name}', - 'ns_public': f'{self.name}'} - - self.ee.ns_manager.add_ns_def(ns_dict) - - repo = 'energy_models.sos_processes.energy.MDA' - builder = self.ee.factory.get_builder_from_process( - repo, 'energy_process_v0') - - self.ee.factory.set_builders_to_coupling_builder(builder) - self.ee.configure() - usecase = Study(execution_engine=self.ee, year_end=self.year_end) - usecase.study_name = self.name - values_dict = usecase.setup_usecase() - - self.ee.display_treeview_nodes() - full_values_dict = {} - for dict_v in values_dict: - full_values_dict.update(dict_v) - - full_values_dict[f'{self.name}.{GlossaryEnergy.YearEnd}'] = self.year_end - full_values_dict[f'{self.name}.epsilon0'] = 1.0 - full_values_dict[f'{self.name}.tolerance'] = 1.0e-8 - full_values_dict[f'{self.name}.max_mda_iter'] = 50 - full_values_dict[f'{self.name}.sub_mda_class'] = 'MDAGaussSeidel' - # Overwrite values for ratios with values from setup - full_values_dict[f'{self.name}.is_apply_ratio'] = self.is_apply_ratio - full_values_dict[f'{self.name}.is_stream_demand'] = self.is_stream_demand - full_values_dict[f'{self.name}.is_apply_resource_ratio'] = self.is_apply_resource_ratio - full_values_dict[f'{self.name}.{GlossaryEnergy.AllStreamsDemandRatioValue}'] = self.all_streams_demand_ratio - full_values_dict[f'{self.name}.all_resource_ratio_usable_demand'] = self.all_resource_ratio_usable_demand - self.ee.load_study_from_input_dict(full_values_dict) - - self.ee.execute() - - disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline - - # Get coupled inputs and outputs - full_inputs = disc.get_input_data_names() - full_outputs = disc.get_output_data_names() - - # coupled_inputs = [input for input in full_inputs if self.ee.dm.get_data( - # input, 'coupling')] - # coupled_outputs = [output for output in full_outputs if self.ee.dm.get_data( - # output, 'coupling')] - # coupled_outputs.extend(['Test_Ratio.EnergyMix.{GlossaryEnergy.AllStreamsDemandRatioValue}' - # ]) - - coupled_inputs = [ - # 'Test_Ratio.EnergyMix.fuel.liquid_fuel.{GlossaryEnergy.StreamConsumptionWithoutRatioValue}', - # 'Test_Ratio.EnergyMix.methane.{GlossaryEnergy.EnergyProductionValue}', - f'Test_Ratio.EnergyMix.electricity.{GlossaryEnergy.StreamConsumptionValue}'] - coupled_outputs = [f'Test_Ratio.EnergyMix.{GlossaryEnergy.AllStreamsDemandRatioValue}', ] - - # coupled_inputs = ['Test_Ratio.EnergyMix.hydrogen.gaseous_hydrogen.{GlossaryEnergy.EnergyProductionValue}',] - # coupled_outputs = ['Test_Ratio.EnergyMix.output_test'] - - self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_false_true_{self.model_name}.pkl', - discipline=disc, step=1.0e-16, derr_approx='complex_step', local_data=disc.local_data, - inputs=coupled_inputs, outputs=coupled_outputs, ) - def test_01b_ratio_FossilGas_discipline_jacobian(self): ''' Test the gradients of the ratios on a simple techno which uses a single resource ratio (natural_gas_resource consumption) @@ -993,7 +923,7 @@ def test_01b_ratio_FossilGas_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -1046,7 +976,7 @@ def test_01b_ratio_FossilGas_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_{self.techno_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, @@ -1085,7 +1015,7 @@ def test_02b_ratio_Nuclear_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -1139,7 +1069,7 @@ def test_02b_ratio_Nuclear_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline coupled_inputs.append( f'{namespace}.all_resource_ratio_usable_demand' ) @@ -1181,7 +1111,7 @@ def test_03b_ratio_CoalExtraction_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -1234,7 +1164,7 @@ def test_03b_ratio_CoalExtraction_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_{self.techno_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, @@ -1273,7 +1203,7 @@ def test_04b_ratio_Refinery_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -1326,7 +1256,7 @@ def test_04b_ratio_Refinery_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_ratio_{self.techno_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, @@ -1365,7 +1295,7 @@ def test_05b_ratio_PEM_discipline_jacobian(self): coupled_inputs = [] for key in mda_data_input_dict[self.techno_name].keys(): # Modify namespace of input 'key' if needed - if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'sub_mda_class', + if key in ['linearization_mode', 'cache_type', 'cache_file_path', 'inner_mda_name', 'max_mda_iter', 'n_processes', 'chain_linearize', 'tolerance', 'use_lu_fact', 'warm_start', 'acceleration', 'warm_start_threshold', 'n_subcouplings_parallel', 'max_mda_iter_gs', 'relax_factor', 'epsilon0', @@ -1419,7 +1349,7 @@ def test_05b_ratio_PEM_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.techno_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.techno_name}')[0].discipline_wrapp.discipline coupled_inputs.append( f'{namespace}.all_resource_ratio_usable_demand' ) diff --git a/energy_models/tests/l1_test_gradient_solid_fuel.py b/energy_models/tests/l1_test_gradient_solid_fuel.py index b0ff7701..81bb8dfe 100644 --- a/energy_models/tests/l1_test_gradient_solid_fuel.py +++ b/energy_models/tests/l1_test_gradient_solid_fuel.py @@ -149,7 +149,7 @@ def test_01_coal_extraction_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -207,7 +207,7 @@ def test_02_pelletizing_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-16, derr_approx='complex_step', threshold=1e-5, @@ -286,7 +286,7 @@ def test_03_solid_fuel_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/l1_test_gradient_syngas.py b/energy_models/tests/l1_test_gradient_syngas.py index 5fcdd929..615b9c3a 100644 --- a/energy_models/tests/l1_test_gradient_syngas.py +++ b/energy_models/tests/l1_test_gradient_syngas.py @@ -157,7 +157,7 @@ def test_01_atr_discipline_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -219,7 +219,7 @@ def test_02_coelectrolysis_discipline_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -280,7 +280,7 @@ def test_03_smr_discipline_jac(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -339,7 +339,7 @@ def test_04_rwgs_discipline_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline # GlossaryEnergy.InvestValue, 'Capex_ReversedWaterGasShift', 'CO2_needs', 'syngas_needs',GlossaryEnergy.electricity, self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', @@ -400,7 +400,7 @@ def test_05_coal_gasification_discipline_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -458,7 +458,7 @@ def test_06_biomass_gas_discipline_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -516,7 +516,7 @@ def test_07_pyrolysis_discipline_jacobian(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_{self.energy_name}_{self.model_name}.pkl', discipline=disc_techno, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, @@ -2790,7 +2790,7 @@ def _test_08_syngas_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.model_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.model_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_specific_{self.energy_name}.pkl', discipline=disc, step=1.0e-15, derr_approx='complex_step', threshold=1e-5, local_data=disc.local_data, @@ -2875,7 +2875,7 @@ def test_09_generic_syngas_discipline_jacobian(self): self.ee.execute() disc = self.ee.dm.get_disciplines_with_name( - f'{self.name}.{self.energy_name}')[0].mdo_discipline_wrapp.mdo_discipline + f'{self.name}.{self.energy_name}')[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename=f'jacobian_generic_{self.energy_name}.pkl', discipline=disc, step=1.0e-18, derr_approx='complex_step', threshold=1e-5, diff --git a/energy_models/tests/to_fix/CalciumLoopingDiscipline.py b/energy_models/tests/to_fix/CalciumLoopingDiscipline.py index 4eee6d1f..50914db3 100644 --- a/energy_models/tests/to_fix/CalciumLoopingDiscipline.py +++ b/energy_models/tests/to_fix/CalciumLoopingDiscipline.py @@ -54,7 +54,7 @@ def test_execute(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename='jacobianIsolatedDiscTest_MDO_MDA_CCUS_carbon_capture_flue_gas_capture_CalciumLooping.pkl', discipline=disc_techno, step=1e-15, derr_approx='complex_step', local_data = disc_techno.local_data, diff --git a/energy_models/tests/to_fix/MonoEthanolAmineDiscipline.py b/energy_models/tests/to_fix/MonoEthanolAmineDiscipline.py index c022ed88..b48a70bd 100644 --- a/energy_models/tests/to_fix/MonoEthanolAmineDiscipline.py +++ b/energy_models/tests/to_fix/MonoEthanolAmineDiscipline.py @@ -54,7 +54,7 @@ def test_execute(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename='jacobianIsolatedDiscTest_MDO_MDA_CCUS_carbon_capture_flue_gas_capture_MonoEthanolAmine.pkl', discipline=disc_techno, step=1e-15, derr_approx='complex_step', local_data = disc_techno.local_data, diff --git a/energy_models/tests/to_fix/PiperazineProcessDiscipline.py b/energy_models/tests/to_fix/PiperazineProcessDiscipline.py index 5e7af477..e6221214 100644 --- a/energy_models/tests/to_fix/PiperazineProcessDiscipline.py +++ b/energy_models/tests/to_fix/PiperazineProcessDiscipline.py @@ -54,7 +54,7 @@ def test_execute(self): self.ee.execute() - disc_techno = self.ee.root_process.proxy_disciplines[0].mdo_discipline_wrapp.mdo_discipline + disc_techno = self.ee.root_process.proxy_disciplines[0].discipline_wrapp.discipline self.check_jacobian(location=dirname(__file__), filename='jacobianIsolatedDiscTest_MDO_MDA_CCUS_carbon_capture_flue_gas_capture_PiperazineProcess.pkl', discipline=disc_techno, step=1e-15, derr_approx='complex_step', local_data = disc_techno.local_data, diff --git a/platform_version_required.txt b/platform_version_required.txt index 15a2b33b..8eb38913 100644 --- a/platform_version_required.txt +++ b/platform_version_required.txt @@ -1 +1 @@ -v4.2.0 \ No newline at end of file +v5.0.0 \ No newline at end of file diff --git a/pytest.ini b/pytest.ini index 149dba41..ff8f05cc 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,5 @@ [pytest] -python_files = l1_test*.py +python_files = l1*.py testpaths = energy_models/tests addopts = --numprocesses=auto diff --git a/requirements.in b/requirements.in index ebb2aa47..43e0a989 100644 --- a/requirements.in +++ b/requirements.in @@ -8,7 +8,7 @@ matplotlib>=3.4.3 numpy==1.24.4 pandas==2.2.2 plotly>=5.3.0 -scipy==1.10.1 +scipy==1.13.1 # Development requirements pytest>=7.4.3