diff --git a/tests/datapackages/mimo/investment_var_output/data/elements/mimo.csv b/tests/datapackages/mimo/investment_var_output/data/elements/mimo.csv index 63bcd98..2b3e79a 100644 --- a/tests/datapackages/mimo/investment_var_output/data/elements/mimo.csv +++ b/tests/datapackages/mimo/investment_var_output/data/elements/mimo.csv @@ -1,2 +1,2 @@ -type;name;region;year;carrier;tech;expandable;primary;capacity_cost;capacity_potential;from_bus_0;from_bus_1;to_bus_0;to_bus_1;to_bus_2;groups;conversion_factor_gas;conversion_factor_hydro;conversion_factor_heat;emission_factor_gas_co2;emission_factor_hydro_co2;flow_share_fix_gas -mimo;mimo;DE;2021;elec;mimo;true;electricity;1.2;20;gas;hydro;electricity;heat;co2;{"in": ["gas", "hydro"], "out": ["electricity", "heat"]};1.2;1.3;1.2;0.5;0.3;profile_DE \ No newline at end of file +type;name;region;year;carrier;tech;expandable;primary;capacity_cost;capacity_potential;from_bus_0;from_bus_1;to_bus_0;to_bus_1;to_bus_2;groups;conversion_factor_gas;conversion_factor_hydro;conversion_factor_heat;activity_bound_max;emission_factor_gas_co2;emission_factor_hydro_co2;flow_share_fix_gas +mimo;mimo;DE;2021;elec;mimo;true;electricity;1.2;20;gas;hydro;electricity;heat;co2;{"in": ["gas", "hydro"], "out": ["electricity", "heat"]};1.2;1.3;1.2;18;0.5;0.3;profile_DE \ No newline at end of file diff --git a/tests/datapackages/mimo/investment_var_output/datapackage.json b/tests/datapackages/mimo/investment_var_output/datapackage.json index b4f0425..43091c1 100644 --- a/tests/datapackages/mimo/investment_var_output/datapackage.json +++ b/tests/datapackages/mimo/investment_var_output/datapackage.json @@ -208,6 +208,11 @@ "type": "number", "format": "default" }, + { + "name": "activity_bound_max", + "type": "number", + "format": "default" + }, { "name": "emission_factor_gas_co2", "type": "number", diff --git a/tests/test_datapackage.py b/tests/test_datapackage.py index f552c05..c9d3ce9 100644 --- a/tests/test_datapackage.py +++ b/tests/test_datapackage.py @@ -58,8 +58,8 @@ def test_datapackage_results_for_investment_var_outputs(): check_results_for_investment_var_output(results) # Check emissions: - gas_input = 20 * 1.2 * 0.8 - hydro_input = 20 * 1.3 * 0.2 + gas_input = 18 * 1.2 * 0.8 + hydro_input = 18 * 1.3 * 0.2 assert results[("mimo", "co2")]["sequences"]["flow"].values[0] == pytest.approx( gas_input * 0.5 + hydro_input * 0.3 ) diff --git a/tests/test_mimo_converter.py b/tests/test_mimo_converter.py index ff03508..882d453 100644 --- a/tests/test_mimo_converter.py +++ b/tests/test_mimo_converter.py @@ -13,10 +13,7 @@ from oemof.solph.components import Source from oemof.solph.flows import Flow -from oemof_industry.mimo_converter import ( - MultiInputMultiOutputConverter, - MultiInputMultiOutputConverterBlock, -) +from oemof_industry.mimo_converter import MultiInputMultiOutputConverter def test_invalid_flow_shares(): diff --git a/tests/test_mimo_investment.py b/tests/test_mimo_investment.py index b62b09c..44124a4 100644 --- a/tests/test_mimo_investment.py +++ b/tests/test_mimo_investment.py @@ -75,6 +75,7 @@ def test_investment_fix_outputs(): }, conversion_factors={b_gas: 1.2, b_hydro: 1.3, b_heat: 1.2}, flow_shares={"fix": {b_gas: [0.8, 0.3], b_heat: 0.8}}, + activity_bounds={"max": 18} ) ) @@ -87,11 +88,11 @@ def test_investment_fix_outputs(): # create result object results = processing.convert_keys_to_strings(processing.results(om)) - assert results[("mimo", "electricity")]["scalars"]["invest"] == 20 + assert results[("mimo", "electricity")]["scalars"]["invest"] == 18 - assert results[("mimo", "heat")]["sequences"]["flow"].values[0] == 20 * 0.8 * 1.2 - assert results[("heat_import", "heat")]["sequences"]["flow"].values[0] == 100 - 20 * 0.8 * 1.2 - assert results[("mimo", "electricity")]["sequences"]["flow"].values[0] == 20 + assert results[("mimo", "heat")]["sequences"]["flow"].values[0] == 18 * 0.8 * 1.2 + assert results[("heat_import", "heat")]["sequences"]["flow"].values[0] == 100 - 18 * 0.8 * 1.2 + assert results[("mimo", "electricity")]["sequences"]["flow"].values[0] == 18 def test_investment_var_outputs(): @@ -134,6 +135,7 @@ def test_investment_var_outputs(): }, conversion_factors={b_gas: 1.2, b_hydro: 1.3, b_heat: 1.2}, flow_shares={"fix": {b_gas: [0.8, 0.3, 0.3]}}, + activity_bounds={"max": 18} ) ) @@ -150,10 +152,10 @@ def test_investment_var_outputs(): def check_results_for_investment_var_output(results): - assert results[("mimo", "electricity")]["scalars"]["invest"] == 20 - assert results[("mimo", "heat")]["sequences"]["flow"].values[0] == 20 * 1.2 - assert results[("heat_import", "heat")]["sequences"]["flow"].values[0] == 100 - 20 * 1.2 + assert results[("mimo", "electricity")]["scalars"]["invest"] == 18 + assert results[("mimo", "heat")]["sequences"]["flow"].values[0] == pytest.approx(18 * 1.2) + assert results[("heat_import", "heat")]["sequences"]["flow"].values[0] == pytest.approx(100 - 18 * 1.2) assert results[("mimo", "electricity")]["sequences"]["flow"].values[0] == 0 - assert results[("gas", "mimo")]["sequences"]["flow"].values[0] == pytest.approx(20 * 1.2 * 0.8) - assert results[("hydro", "mimo")]["sequences"]["flow"].values[0] == pytest.approx(20 * 1.3 * 0.2) + assert results[("gas", "mimo")]["sequences"]["flow"].values[0] == pytest.approx(18 * 1.2 * 0.8) + assert results[("hydro", "mimo")]["sequences"]["flow"].values[0] == pytest.approx(18 * 1.3 * 0.2)