From fe3618525309939e06e457c44ad6d1230281d370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 09:27:03 +0200 Subject: [PATCH 01/17] Add planned change to changelog --- docs/whatsnew/v0-6-0.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/whatsnew/v0-6-0.rst b/docs/whatsnew/v0-6-0.rst index 339fae4d9..122bbe7a7 100644 --- a/docs/whatsnew/v0-6-0.rst +++ b/docs/whatsnew/v0-6-0.rst @@ -10,6 +10,8 @@ API changes effectively the same) had double weight before. Also, if the initial storage level is defined, the costs just offset the objective value without changing anything else. +* The parameters `GenericStorage.nominal_storage_capacity` and + `Flow.nominal_value` are now both called `nominal_calacity`. New features ############ From 6ed34e4b39e25e4c401e66d2496a15a66bea7995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 13:08:47 +0200 Subject: [PATCH 02/17] Rename Flow argument from nominal_value to nominal_capacity I still have to keep explaining people what the nominal_value is meant for and they just understand if I name it nominal_capacity, instead. Reflecting a bit, the capacity of a Flow (e.g. a power line) is easier to interpret as the "nominal value". Thus the refactoring. --- src/oemof/solph/flows/_flow.py | 50 +++++++++++++++++++++-------- tests/test_flows/test_flow_class.py | 4 +-- tests/test_solph_network_classes.py | 6 ++-- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/src/oemof/solph/flows/_flow.py b/src/oemof/solph/flows/_flow.py index 6ed8e97ab..ded156642 100644 --- a/src/oemof/solph/flows/_flow.py +++ b/src/oemof/solph/flows/_flow.py @@ -41,10 +41,10 @@ class Flow(Edge): Parameters ---------- - nominal_value : numeric, :math:`P_{nom}` or + nominal_capacity : numeric, :math:`P_{nom}` or :class:`Investment ` - The nominal value of the flow, either fixed or as an investement - optimisation. If this value is set the corresponding optimization + The nominal calacity of the flow, either fixed or as an investement + optimisation. If this value is set, the corresponding optimization variable of the flow object will be bounded by this value multiplied by min(lower bound)/max(upper bound). variable_costs : numeric (iterable or scalar), default: 0, :math:`c` @@ -68,11 +68,11 @@ class Flow(Edge): full_load_time_max : numeric, :math:`t_{full\_load,max}` Maximum energy transported by the flow expressed as the time (in hours) that the flow would have to run at nominal capacity - (`nominal_value`). + (`nominal_capacity`). full_load_time_min : numeric, :math:`t_{full\_load,min}` Minimum energy transported by the flow expressed as the time (in hours) that the flow would have to run at nominal capacity - (`nominal_value`). + (`nominal_capacity`). integer : boolean Set True to bound the flow values to integers. nonconvex : :class:`NonConvex ` @@ -107,7 +107,7 @@ class Flow(Edge): -------- Creating a fixed flow object: - >>> f = Flow(nominal_value=2, fix=[10, 4, 4], variable_costs=5) + >>> f = Flow(nominal_capacity=2, fix=[10, 4, 4], variable_costs=5) >>> f.variable_costs[2] 5 >>> f.fix[2] @@ -115,14 +115,17 @@ class Flow(Edge): Creating a flow object with time-depended lower and upper bounds: - >>> f1 = Flow(min=[0.2, 0.3], max=0.99, nominal_value=100) + >>> f1 = Flow(min=[0.2, 0.3], max=0.99, nominal_capacity=100) >>> f1.max[1] 0.99 """ # noqa: E501 def __init__( self, + nominal_capacity=None, + # --- BEGIN: To be removed for versions >= v0.7 --- nominal_value=None, + # --- END --- variable_costs=0, min=None, max=None, @@ -176,6 +179,27 @@ def __init__( full_load_time_min = summed_min # --- END --- + # --- BEGIN: The following code can be removed for versions >= v0.7 --- + if nominal_value is not None: + msg = ( + "For backward compatibility," + " the option nominal_value overwrites the option" + " nominal_capacity." + + " Both options cannot be set at the same time." + ) + if nominal_capacity is not None: + raise AttributeError(msg) + else: + warn(msg, FutureWarning) + nominal_capacity = nominal_value + + msg = ( + "\nThe parameter '{0}' is deprecated and will be removed " + + "in version v0.6.\nUse the parameter '{1}', " + + "to avoid this warning and future problems. " + ) + # --- END --- + super().__init__() if custom_attributes is not None: @@ -189,12 +213,12 @@ def __init__( "{} must be a finite value. Passing an infinite " "value is not allowed." ) - if isinstance(nominal_value, numbers.Real): - if not math.isfinite(nominal_value): - raise ValueError(infinite_error_msg.format("nominal_value")) - self.nominal_value = nominal_value - elif isinstance(nominal_value, Investment): - self.investment = nominal_value + if isinstance(nominal_capacity, numbers.Real): + if not math.isfinite(nominal_capacity): + raise ValueError(infinite_error_msg.format("nominal_capacity")) + self.nominal_value = nominal_capacity + elif isinstance(nominal_capacity, Investment): + self.investment = nominal_capacity if fixed_costs is not None: msg = ( diff --git a/tests/test_flows/test_flow_class.py b/tests/test_flows/test_flow_class.py index f59c907b6..4ddcda1fb 100644 --- a/tests/test_flows/test_flow_class.py +++ b/tests/test_flows/test_flow_class.py @@ -21,7 +21,7 @@ def test_summed_max_future_warning(): """Can be removed with v0.6.""" msg = "The parameter 'summed_max' is deprecated and will be removed" with warnings.catch_warnings(record=True) as w: - Flow(nominal_value=1, summed_max=2) + Flow(nominal_capacity=1, summed_max=2) assert len(w) == 1 assert msg in str(w[-1].message) @@ -30,7 +30,7 @@ def test_summed_min_future_warning(): """Can be removed with v0.6.""" msg = "The parameter 'summed_min' is deprecated and will be removed" with warnings.catch_warnings(record=True) as w: - Flow(nominal_value=1, summed_min=2) + Flow(nominal_capacity=1, summed_min=2) assert len(w) == 1 assert msg in str(w[-1].message) diff --git a/tests/test_solph_network_classes.py b/tests/test_solph_network_classes.py index 71726a286..5edad18c9 100644 --- a/tests/test_solph_network_classes.py +++ b/tests/test_solph_network_classes.py @@ -128,12 +128,12 @@ def test_flow_with_fix_and_min_max(): def test_infinite_values(): - msg1 = "nominal_value must be a finite value" + msg1 = "nominal_capacity must be a finite value" msg2 = "max must be a finite value" with pytest.raises(ValueError, match=msg1): - solph.flows.Flow(nominal_value=float("+inf")) + solph.flows.Flow(nominal_capacity=float("+inf")) with pytest.raises(ValueError, match=msg2): - solph.flows.Flow(nominal_value=1, max=float("+inf")) + solph.flows.Flow(nominal_capacity=1, max=float("+inf")) def test_attributes_needing_nominal_value_get_it(): From e91c7fc97e46a66858b8c3116d26d60d5171b0fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 13:21:27 +0200 Subject: [PATCH 03/17] Test Flow(nominal_value) wrapper --- tests/test_flows/test_simple_flow.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_flows/test_simple_flow.py b/tests/test_flows/test_simple_flow.py index 3c351e0ce..8dca29043 100644 --- a/tests/test_flows/test_simple_flow.py +++ b/tests/test_flows/test_simple_flow.py @@ -55,3 +55,17 @@ def test_full_load_time_min(): flow_result = list(_run_flow_model(flow)["flow"][:-1]) assert flow_result == pytest.approx(4 * [2] + [1] + 5 * [0]) + + +# --- BEGIN: The following code can be removed for versions >= v0.7 --- +def test_nominal_value_warning(): + with pytest.warns(FutureWarning, match="nominal_value"): + _ = solph.flows.Flow(nominal_value=2) + + +def test_nominal_value_error(): + with pytest.raises(AttributeError, match="nominal_value"): + _ = solph.flows.Flow(nominal_value=2, nominal_capacity=1) + + +# --- END --- From 375cf7c7d8180373a1da21ca4aee868741aa8d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 13:57:32 +0200 Subject: [PATCH 04/17] Rename Flow argument nominal_value to nominal_capacity --- docs/usage.rst | 70 +++++++++---------- docs/whatsnew/v0-2-2.rst | 2 +- docs/whatsnew/v0-5-1.rst | 2 +- docs/whatsnew/v0-5-3.rst | 2 +- docs/whatsnew/v0-6-0.rst | 2 +- examples/activity_costs/activity_costs.py | 6 +- examples/basic_example/basic_example.py | 18 ++--- .../dual_variable_example.py | 12 ++-- examples/electrical/transshipment.py | 14 ++-- .../emission_constraint.py | 8 ++- examples/excel_reader/dispatch.py | 12 ++-- .../flexible_modelling/add_constraints.py | 6 +- .../flexible_modelling/saturating_storage.py | 6 +- examples/flow_count_limit/flow_count_limit.py | 8 +-- .../example_generic_invest.py | 8 +-- examples/gradient_example/gradient_example.py | 4 +- .../diesel_genset_nonconvex_investment.py | 12 ++-- .../house_with_nonconvex_investment.py | 8 +-- .../house_without_nonconvex_investment.py | 10 +-- .../minimal_invest.py | 4 +- examples/min_max_runtimes/min_max_runtimes.py | 6 +- ...fset_diesel_genset_nonconvex_investment.py | 12 ++-- examples/simple_dispatch/simple_dispatch.py | 23 +++--- .../startup_shutdown.py | 6 +- .../storage_balanced_unbalanced/storage.py | 6 +- examples/storage_costs/storage_costs.py | 8 +-- .../v1_invest_optimize_all_technologies.py | 9 +-- ...v2_invest_optimize_only_gas_and_storage.py | 8 +-- ...optimize_only_storage_with_fossil_share.py | 10 +-- ...mize_all_technologies_with_fossil_share.py | 11 +-- .../storage_level_constraint.py | 10 +-- .../non_equidistant_time_step_example.py | 6 +- .../simple_time_step_example.py | 6 +- examples/tuple_as_labels/tuple_as_label.py | 20 ++++-- examples/variable_chp/variable_chp.py | 16 +++-- src/oemof/solph/_console_scripts.py | 4 +- .../components/_extraction_turbine_chp.py | 2 +- .../solph/components/_generic_storage.py | 4 +- src/oemof/solph/components/_link.py | 4 +- .../solph/components/_offset_converter.py | 2 +- .../_piecewise_linear_converter.py | 2 +- .../solph/constraints/equate_variables.py | 4 +- src/oemof/solph/constraints/integral_limit.py | 4 +- .../solph/constraints/investment_limit.py | 6 +- .../flows/experimental/_electrical_line.py | 2 +- tests/test_components.py | 10 +-- .../test_components/test_offset_converter.py | 24 ++++--- tests/test_components/test_sink.py | 2 +- tests/test_components/test_source.py | 2 +- tests/test_components/test_storage.py | 32 +++++---- .../test_constraints_module.py | 8 +-- tests/test_constraints/test_equate_flows.py | 8 +-- .../test_constraints/test_flow_count_limit.py | 8 +-- tests/test_constraints/test_storage_level.py | 18 +++-- tests/test_flows/test_flow_class.py | 4 +- tests/test_flows/test_non_convex_flow.py | 18 ++--- tests/test_flows/test_simple_flow.py | 6 +- tests/test_grouping.py | 6 +- tests/test_models.py | 12 ++-- tests/test_non_equidistant_time_index.py | 4 +- tests/test_options.py | 2 +- tests/test_outputlib/__init__.py | 22 +++--- tests/test_processing.py | 4 +- .../test_connect_invest.py | 8 +-- .../test_add_constraints.py | 6 +- .../test_generic_chp/test_generic_chp.py | 4 +- .../test_simple_invest_fixed.py | 6 +- .../test_solph/test_lopf/test_lopf.py | 12 ++-- .../test_multi_period_dispatch_model.py | 42 ++++++----- .../test_multi_period_investment_model.py | 38 +++++----- .../test_piecewiselineartransformer.py | 6 +- .../test_simple_model/test_simple_dispatch.py | 23 +++--- .../test_simple_dispatch_one.py | 12 ++-- ...t_simple_dispatch_one_explicit_timemode.py | 12 ++-- .../test_simple_model/test_simple_invest.py | 22 +++--- .../test_invest_storage_regression.py | 8 +-- .../test_storage_investment.py | 15 ++-- .../test_storage_with_tuple_label.py | 17 +++-- .../test_variable_chp/test_variable_chp.py | 16 +++-- tests/test_solph_network_classes.py | 2 +- tests/test_warnings.py | 6 +- 81 files changed, 470 insertions(+), 380 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index 58247d9d9..a51fb2d66 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -266,13 +266,13 @@ Sink (basic) A sink is normally used to define the demand within an energy model but it can also be used to detect excesses. The example shows the electricity demand of the electricity_bus defined above. -The *'my_demand_series'* should be sequence of normalised valueswhile the *'nominal_value'* is the maximum demand the normalised sequence is multiplied with. +The *'my_demand_series'* should be sequence of normalised valueswhile the *'nominal_capacity'* is the maximum demand the normalised sequence is multiplied with. Giving *'my_demand_series'* as parameter *'fix'* means that the demand cannot be changed by the solver. .. code-block:: python solph.components.Sink(label='electricity_demand', inputs={electricity_bus: solph.flows.Flow( - fix=my_demand_series, nominal_value=nominal_demand)}) + fix=my_demand_series, nominal_capacity=nominal_demand)}) In contrast to the demand sink the excess sink has normally less restrictions but is open to take the whole excess. @@ -290,21 +290,21 @@ Source (basic) A source can represent a pv-system, a wind power plant, an import of natural gas or a slack variable to avoid creating an in-feasible model. -While a wind power plant will have as feed-in depending on the weather conditions the natural_gas import might be restricted by maximum value (*nominal_value*) and an annual limit (*full_load_time_max*). +While a wind power plant will have as feed-in depending on the weather conditions the natural_gas import might be restricted by maximum value (*nominal_capacity*) and an annual limit (*full_load_time_max*). As we do have to pay for imported gas we should set variable costs. Comparable to the demand series an *fix* is used to define a fixed the normalised output of a wind power plant. Alternatively, you might use *max* to allow for easy curtailment. -The *nominal_value* sets the installed capacity. +The *nominal_capacity* sets the installed capacity. .. code-block:: python solph.components.Source( label='import_natural_gas', outputs={my_energysystem.groups['natural_gas']: solph.flows.Flow( - nominal_value=1000, full_load_time_max=1000000, variable_costs=50)}) + nominal_capacity=1000, full_load_time_max=1000000, variable_costs=50)}) solph.components.Source(label='wind', outputs={electricity_bus: solph.flows.Flow( - fix=wind_power_feedin_series, nominal_value=1000000)}) + fix=wind_power_feedin_series, nominal_capacity=1000000)}) .. note:: The Source class is only a plug and provides no additional constraints or variables. @@ -327,7 +327,7 @@ A condensing power plant can be defined by a converter with one input (fuel) and solph.components.Converter( label="pp_gas", inputs={bgas: solph.flows.Flow()}, - outputs={b_el: solph.flows.Flow(nominal_value=10e10)}, + outputs={b_el: solph.flows.Flow(nominal_capacity=10e10)}, conversion_factors={electricity_bus: 0.58}) A CHP power plant would be defined in the same manner but with two outputs: @@ -341,8 +341,8 @@ A CHP power plant would be defined in the same manner but with two outputs: solph.components.Converter( label='pp_chp', inputs={b_gas: Flow()}, - outputs={b_el: Flow(nominal_value=30), - b_th: Flow(nominal_value=40)}, + outputs={b_el: Flow(nominal_capacity=30), + b_th: Flow(nominal_capacity=40)}, conversion_factors={b_el: 0.3, b_th: 0.4}) A CHP power plant with 70% coal and 30% natural gas can be defined with two inputs and two outputs: @@ -357,8 +357,8 @@ A CHP power plant with 70% coal and 30% natural gas can be defined with two inpu solph.components.Converter( label='pp_chp', inputs={b_gas: Flow(), b_coal: Flow()}, - outputs={b_el: Flow(nominal_value=30), - b_th: Flow(nominal_value=40)}, + outputs={b_el: Flow(nominal_capacity=30), + b_th: Flow(nominal_capacity=40)}, conversion_factors={b_el: 0.3, b_th: 0.4, b_coal: 0.7, b_gas: 0.3}) @@ -428,7 +428,7 @@ applies when the second flow is zero (*`conversion_factor_full_condensation`*). solph.components._extractionTurbineCHP( label='variable_chp_gas', - inputs={b_gas: solph.flows.Flow(nominal_value=10e10)}, + inputs={b_gas: solph.flows.Flow(nominal_capacity=10e10)}, outputs={b_el: solph.flows.Flow(), b_th: solph.flows.Flow()}, conversion_factors={b_el: 0.3, b_th: 0.5}, conversion_factor_full_condensation={b_el: 0.5}) @@ -559,15 +559,15 @@ GenericStorage (component) A component to model a storage with its basic characteristics. The GenericStorage is designed for one input and one output. The ``nominal_storage_capacity`` of the storage signifies the storage capacity. You can either set it to the net capacity or to the gross capacity and limit it using the min/max attribute. -To limit the input and output flows, you can define the ``nominal_value`` in the Flow objects. +To limit the input and output flows, you can define the ``nominal_capacity`` in the Flow objects. Furthermore, an efficiency for loading, unloading and a loss rate can be defined. .. code-block:: python solph.components.GenericStorage( label='storage', - inputs={b_el: solph.flows.Flow(nominal_value=9, variable_costs=10)}, - outputs={b_el: solph.flows.Flow(nominal_value=25, variable_costs=10)}, + inputs={b_el: solph.flows.Flow(nominal_capacity=9, variable_costs=10)}, + outputs={b_el: solph.flows.Flow(nominal_capacity=25, variable_costs=10)}, loss_rate=0.001, nominal_storage_capacity=50, inflow_conversion_factor=0.98, outflow_conversion_factor=0.8) @@ -588,8 +588,8 @@ The following code block shows an example of the storage parametrization for the solph.components.GenericStorage( label='storage', - inputs={b_el: solph.flows.Flow(nominal_value=9, variable_costs=10)}, - outputs={b_el: solph.flows.Flow(nominal_value=25, variable_costs=10)}, + inputs={b_el: solph.flows.Flow(nominal_capacity=9, variable_costs=10)}, + outputs={b_el: solph.flows.Flow(nominal_capacity=25, variable_costs=10)}, loss_rate=0.001, nominal_storage_capacity=50, initial_storage_level=0.5, balanced=True, inflow_conversion_factor=0.98, outflow_conversion_factor=0.8) @@ -625,7 +625,7 @@ Based on the `GenericStorage` object the `GenericInvestmentStorageBlock` adds tw * Invest into the flow parameters e.g. a turbine or a pump * Invest into capacity of the storage e.g. a basin or a battery cell -Investment in this context refers to the value of the variable for the 'nominal_value' (installed capacity) in the investment mode. +Investment in this context refers to the value of the variable for the 'nominal_capacity' (installed capacity) in the investment mode. As an addition to other flow-investments, the storage class implements the possibility to couple or decouple the flows with the capacity of the storage. @@ -643,8 +643,8 @@ The following example pictures a Pumped Hydroelectric Energy Storage (PHES). Bot solph.components.GenericStorage( label='PHES', - inputs={b_el: solph.flows.Flow(nominal_value=solph.Investment(ep_costs=500))}, - outputs={b_el: solph.flows.Flow(nominal_value=solph.Investment(ep_costs=500)}, + inputs={b_el: solph.flows.Flow(nominal_capacity=solph.Investment(ep_costs=500))}, + outputs={b_el: solph.flows.Flow(nominal_capacity=solph.Investment(ep_costs=500)}, loss_rate=0.001, inflow_conversion_factor=0.98, outflow_conversion_factor=0.8), investment = solph.Investment(ep_costs=40)) @@ -755,7 +755,7 @@ Then we can create our component with the buses attached to it. ... label='boiler', ... inputs={ ... bfuel: solph.flows.Flow( - ... nominal_value=P_out_max, + ... nominal_capacity=P_out_max, ... max=l_max, ... min=l_min, ... nonconvex=solph.NonConvex() @@ -775,7 +775,7 @@ Then we can create our component with the buses attached to it. will serve as the reference for the `conversion_factors` and the `normed_offsets`. The `NonConvex` flow also holds - - the `nominal_value` (or `Investment` in case of investment optimization), + - the `nominal_capacity` (can be `Investment` in case of investment optimization), - the `min` and - the `max` attributes. @@ -897,7 +897,7 @@ This small example of PV, grid and SinkDSM shows how to use the component grid = solph.components.Source(label='Grid', outputs={ b_elec: solph.flows.Flow( - nominal_value=10000, + nominal_capacity=10000, variable_costs=50)} ) es.add(grid) @@ -907,7 +907,7 @@ This small example of PV, grid and SinkDSM shows how to use the component outputs={ b_elec: solph.flows.Flow( fix=data['pv'], - nominal_value=3.5)} + nominal_capacity=3.5)} ) es.add(s_wind) @@ -956,7 +956,7 @@ The annual savings by building up new capacity must therefore compensate the ann See the API of the :py:class:`~oemof.solph.options.Investment` class to see all possible parameters. Basically, an instance of the Investment class can be added to a Flow, a -Storage or a DSM Sink. All parameters that usually refer to the *nominal_value/capacity* will +Storage or a DSM Sink. All parameters that usually refer to the *nominal_capacity* will now refer to the investment variables and existing capacity. It is also possible to set a maximum limit for the capacity that can be build. If existing capacity is considered for a component with investment mode enabled, @@ -981,7 +981,7 @@ turbines. solph.components.Source(label='new_wind_pp', outputs={electricity: solph.flows.Flow( fix=wind_power_time_series, - nominal_value=solph.Investment(ep_costs=epc, maximum=50000))}) + nominal_capacity=solph.Investment(ep_costs=epc, maximum=50000))}) Let's slightly alter the case and consider for already existing wind power capacity of 20,000 kW. We're still expecting the total wind power capacity, thus we @@ -991,7 +991,7 @@ allow for 30,000 kW of new installations and formulate as follows. solph.components.Source(label='new_wind_pp', outputs={electricity: solph.flows.Flow( fix=wind_power_time_series, - nominal_value=solph.Investment(ep_costs=epc, + nominal_capacity=solph.Investment(ep_costs=epc, maximum=30000, existing=20000))}) @@ -1026,7 +1026,7 @@ example of a converter: label='converter_nonconvex', inputs={bus_0: solph.flows.Flow()}, outputs={bus_1: solph.flows.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=4, maximum=100, minimum=20, @@ -1183,7 +1183,7 @@ Then you add all the *components* and *buses* to your energy system, just as you label="electricity_demand", inputs={ electricity_bus: solph.flows.Flow( - nominal_value=1000, fix=[0.8] * len(my_index) + nominal_capacity=1000, fix=[0.8] * len(my_index) ) }, ) @@ -1212,7 +1212,7 @@ Here is an example inputs={hydrogen_bus: solph.flows.Flow()}, outputs={ electricity_bus: solph.flows.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( maximum=1000, ep_costs=1e6, lifetime=30, @@ -1246,7 +1246,7 @@ This would mean that for investments in the particular period, these values woul inputs={hydrogen_bus: solph.flows.Flow()}, outputs={ electricity_bus: solph.flows.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( maximum=1000, ep_costs=[1e6, 1.1e6], lifetime=30, @@ -1273,7 +1273,7 @@ For components that is not invested into, you also can specify some additional a inputs={coal_bus: solph.flows.Flow()}, outputs={ electricity_bus: solph.flows.Flow( - nominal_value=600, + nominal_capacity=600, max=1, min=0.4, lifetime=50, @@ -1377,9 +1377,9 @@ class, and only the optimal dispatch strategy of an existing asset with a given inputs={b_gas: solph.flows.Flow()}, outputs={b_el: solph.flows.Flow( nonconvex=solph.NonConvex(), - nominal_value=30, + nominal_capacity=30, min=0.5), - b_th: solph.flows.Flow(nominal_value=40)}, + b_th: solph.flows.Flow(nominal_capacity=40)}, conversion_factors={b_el: 0.3, b_th: 0.4}) The class :py:class:`~oemof.solph.options.NonConvex` for the electrical output of the created Converter (i.e., CHP) @@ -1421,7 +1421,7 @@ This nonlinearity is linearised in the min=0.2, max=1, nonconvex=solph.NonConvex(), - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=90, maximum=150, # required for the linearization ), diff --git a/docs/whatsnew/v0-2-2.rst b/docs/whatsnew/v0-2-2.rst index 2af434373..d2c191e6d 100644 --- a/docs/whatsnew/v0-2-2.rst +++ b/docs/whatsnew/v0-2-2.rst @@ -29,7 +29,7 @@ New features `invest_relation_output_capacity` replace the existing attributes `nominal_input_capacity_ratio` and `nominal_input_capacity_ratio` for the investment mode. In case of the dispatch mode one should use the - `nominal_value` of the Flow classes. The attributes + `nominal_capacity` of the Flow classes. The attributes `nominal_input_capacity_ratio` and `nominal_input_capacity_ratio` will be removed in v0.3.0. Please adapt your application to avoid problems in the future (`Issue #480 `_). diff --git a/docs/whatsnew/v0-5-1.rst b/docs/whatsnew/v0-5-1.rst index 06c327774..9a2b30ad9 100644 --- a/docs/whatsnew/v0-5-1.rst +++ b/docs/whatsnew/v0-5-1.rst @@ -13,7 +13,7 @@ API changes (Note that we always had the argument "conversion_factor".) * Unify API for constant sized objects and sizing of investment. For both, `Flow` and `GenericStorage`, the argument `investment` is now deprecated. Instead, - `nominal_value` and `nominal_storage_capacity` accept an `Investment` object. + `nominal_capacity` and `nominal_storage_capacity` accept an `Investment` object. * Change investment for experimental :class:`oemof.solph.components.experimental._sink_dsm.SinkDSM`: Remove obsolete parameters `flex_share_down` and `flex_share_up`. * Mainline link component :class:`oemof.solph.components._link.Link` from experimental. diff --git a/docs/whatsnew/v0-5-3.rst b/docs/whatsnew/v0-5-3.rst index c4dcb591f..6aa70ff6a 100644 --- a/docs/whatsnew/v0-5-3.rst +++ b/docs/whatsnew/v0-5-3.rst @@ -9,7 +9,7 @@ API changes to the `NonConvex` flow, and `normed_offsets` with the normed offsets relative to the `NonConvex` flow. * The `NonConvex` attribute must be specified for one of `Flow` at the inlets - or outlets of the `OffsetConverter`. `min`, `max` and `nominal_value` have to + or outlets of the `OffsetConverter`. `min`, `max` and `nominal_capacity` have to be specified for the same `Flow`. New features diff --git a/docs/whatsnew/v0-6-0.rst b/docs/whatsnew/v0-6-0.rst index 122bbe7a7..5b95cd94b 100644 --- a/docs/whatsnew/v0-6-0.rst +++ b/docs/whatsnew/v0-6-0.rst @@ -11,7 +11,7 @@ API changes initial storage level is defined, the costs just offset the objective value without changing anything else. * The parameters `GenericStorage.nominal_storage_capacity` and - `Flow.nominal_value` are now both called `nominal_calacity`. + `Flow.nominal_capacity` are now both called `nominal_calacity`. New features ############ diff --git a/examples/activity_costs/activity_costs.py b/examples/activity_costs/activity_costs.py index 9f129c015..2ecb4b2e4 100644 --- a/examples/activity_costs/activity_costs.py +++ b/examples/activity_costs/activity_costs.py @@ -69,14 +69,14 @@ def main(): sink_heat = solph.components.Sink( label="demand", - inputs={b_heat: solph.Flow(fix=demand_heat, nominal_value=1)}, + inputs={b_heat: solph.Flow(fix=demand_heat, nominal_capacity=1)}, ) fireplace = solph.components.Source( label="fireplace", outputs={ b_heat: solph.Flow( - nominal_value=3, + nominal_capacity=3, variable_costs=0, nonconvex=solph.NonConvex(activity_costs=activity_costs), ) @@ -85,7 +85,7 @@ def main(): boiler = solph.components.Source( label="boiler", - outputs={b_heat: solph.Flow(nominal_value=10, variable_costs=1)}, + outputs={b_heat: solph.Flow(nominal_capacity=10, variable_costs=1)}, ) es.add(sink_heat, fireplace, boiler) diff --git a/examples/basic_example/basic_example.py b/examples/basic_example/basic_example.py index b188b4ca8..cfd8e32f5 100644 --- a/examples/basic_example/basic_example.py +++ b/examples/basic_example/basic_example.py @@ -173,7 +173,7 @@ def main(dump_and_restore=False): label="wind", outputs={ bus_electricity: flows.Flow( - fix=data["wind"], nominal_value=1000000 + fix=data["wind"], nominal_capacity=1000000 ) }, ) @@ -185,20 +185,20 @@ def main(dump_and_restore=False): label="pv", outputs={ bus_electricity: flows.Flow( - fix=data["pv"], nominal_value=582000 + fix=data["pv"], nominal_capacity=582000 ) }, ) ) # create simple sink object representing the electrical demand - # nominal_value is set to 1 because demand_el is not a normalised series + # nominal_capacity is set to 1 because demand_el is not a normalised series energysystem.add( components.Sink( label="demand", inputs={ bus_electricity: flows.Flow( - fix=data["demand_el"], nominal_value=1 + fix=data["demand_el"], nominal_capacity=1 ) }, ) @@ -211,7 +211,7 @@ def main(dump_and_restore=False): inputs={bus_gas: flows.Flow()}, outputs={ bus_electricity: flows.Flow( - nominal_value=10e10, variable_costs=50 + nominal_capacity=10e10, variable_costs=50 ) }, conversion_factors={bus_electricity: 0.58}, @@ -220,15 +220,17 @@ def main(dump_and_restore=False): # create storage object representing a battery nominal_capacity = 10077997 - nominal_value = nominal_capacity / 6 + nominal_capacity = nominal_capacity / 6 battery_storage = components.GenericStorage( nominal_storage_capacity=nominal_capacity, label=STORAGE_LABEL, - inputs={bus_electricity: flows.Flow(nominal_value=nominal_value)}, + inputs={ + bus_electricity: flows.Flow(nominal_capacity=nominal_capacity) + }, outputs={ bus_electricity: flows.Flow( - nominal_value=nominal_value, variable_costs=0.001 + nominal_capacity=nominal_capacity, variable_costs=0.001 ) }, loss_rate=0.00, diff --git a/examples/dual_variable_example/dual_variable_example.py b/examples/dual_variable_example/dual_variable_example.py index 4ccc1105a..0e26c2472 100644 --- a/examples/dual_variable_example/dual_variable_example.py +++ b/examples/dual_variable_example/dual_variable_example.py @@ -198,7 +198,7 @@ def main(): energysystem.add( cmp.Source( label="pv", - outputs={bus_elec: flows.Flow(fix=pv, nominal_value=700)}, + outputs={bus_elec: flows.Flow(fix=pv, nominal_capacity=700)}, ) ) @@ -206,7 +206,7 @@ def main(): energysystem.add( cmp.Sink( label="demand", - inputs={bus_elec: flows.Flow(fix=demand, nominal_value=1)}, + inputs={bus_elec: flows.Flow(fix=demand, nominal_capacity=1)}, ) ) @@ -215,7 +215,7 @@ def main(): cmp.Converter( label="pp_gas", inputs={bus_gas: flows.Flow()}, - outputs={bus_elec: flows.Flow(nominal_value=400)}, + outputs={bus_elec: flows.Flow(nominal_capacity=400)}, conversion_factors={bus_elec: 0.5}, ) ) @@ -225,9 +225,11 @@ def main(): storage = cmp.GenericStorage( nominal_storage_capacity=cap, label="storage", - inputs={bus_elec: flows.Flow(nominal_value=cap / 6)}, + inputs={bus_elec: flows.Flow(nominal_capacity=cap / 6)}, outputs={ - bus_elec: flows.Flow(nominal_value=cap / 6, variable_costs=0.001) + bus_elec: flows.Flow( + nominal_capacity=cap / 6, variable_costs=0.001 + ) }, loss_rate=0.00, initial_storage_level=0, diff --git a/examples/electrical/transshipment.py b/examples/electrical/transshipment.py index d5e0e53ef..3a1e181e4 100644 --- a/examples/electrical/transshipment.py +++ b/examples/electrical/transshipment.py @@ -144,8 +144,8 @@ def main(): label="line_0", inputs={b_0: Flow(), b_1: Flow()}, outputs={ - b_1: Flow(nominal_value=Investment()), - b_0: Flow(nominal_value=Investment()), + b_1: Flow(nominal_capacity=Investment()), + b_0: Flow(nominal_capacity=Investment()), }, conversion_factors={(b_0, b_1): 0.95, (b_1, b_0): 0.9}, ) @@ -154,26 +154,28 @@ def main(): es.add( cmp.Source( label="gen_0", - outputs={b_0: Flow(nominal_value=100, variable_costs=50)}, + outputs={b_0: Flow(nominal_capacity=100, variable_costs=50)}, ) ) es.add( cmp.Source( label="gen_1", - outputs={b_1: Flow(nominal_value=100, variable_costs=50)}, + outputs={b_1: Flow(nominal_capacity=100, variable_costs=50)}, ) ) es.add( cmp.Sink( - label="load_0", inputs={b_0: Flow(nominal_value=150, fix=[0, 1])} + label="load_0", + inputs={b_0: Flow(nominal_capacity=150, fix=[0, 1])}, ) ) es.add( cmp.Sink( - label="load_1", inputs={b_1: Flow(nominal_value=150, fix=[1, 0])} + label="load_1", + inputs={b_1: Flow(nominal_capacity=150, fix=[1, 0])}, ) ) diff --git a/examples/emission_constraint/emission_constraint.py b/examples/emission_constraint/emission_constraint.py index 73537ead4..bced70d38 100644 --- a/examples/emission_constraint/emission_constraint.py +++ b/examples/emission_constraint/emission_constraint.py @@ -57,7 +57,7 @@ def main(): label="biomass", outputs={ bel: solph.Flow( - nominal_value=100, + nominal_capacity=100, variable_costs=10, fix=[0.1, 0.2, 0.3], custom_attributes={"emission_factor": 0.01}, @@ -84,7 +84,9 @@ def main(): label="demand", inputs={ bel: solph.Flow( - nominal_value=200, variable_costs=10, fix=[0.1, 0.2, 0.3] + nominal_capacity=200, + variable_costs=10, + fix=[0.1, 0.2, 0.3], ) }, ) @@ -95,7 +97,7 @@ def main(): solph.components.Converter( label="pp_gas", inputs={bgas: solph.Flow()}, - outputs={bel: solph.Flow(nominal_value=200)}, + outputs={bel: solph.Flow(nominal_capacity=200)}, conversion_factors={bel: 0.58}, ) ) diff --git a/examples/excel_reader/dispatch.py b/examples/excel_reader/dispatch.py index 97baad936..efb534f24 100644 --- a/examples/excel_reader/dispatch.py +++ b/examples/excel_reader/dispatch.py @@ -178,7 +178,7 @@ def create_nodes(nd=None): for i, re in nd["renewables"].iterrows(): if re["active"]: # set static outflow values - outflow_args = {"nominal_value": re["capacity"]} + outflow_args = {"nominal_capacity": re["capacity"]} # get time series for node and parameter for col in nd["timeseries"].columns.values: if col.split(".")[0] == re["label"]: @@ -196,7 +196,7 @@ def create_nodes(nd=None): for i, de in nd["demand"].iterrows(): if de["active"]: # set static inflow values - inflow_args = {"nominal_value": de["nominal value"]} + inflow_args = {"nominal_capacity": de["nominal value"]} # get time series for node and parameter for col in nd["timeseries"].columns.values: if col.split(".")[0] == de["label"]: @@ -225,7 +225,9 @@ def create_nodes(nd=None): label=t["label"], inputs={busd[t["from"]]: solph.Flow(**inflow_args)}, outputs={ - busd[t["to"]]: solph.Flow(nominal_value=t["capacity"]) + busd[t["to"]]: solph.Flow( + nominal_capacity=t["capacity"] + ) }, conversion_factors={busd[t["to"]]: t["efficiency"]}, ) @@ -238,13 +240,13 @@ def create_nodes(nd=None): label=s["label"], inputs={ busd[s["bus"]]: solph.Flow( - nominal_value=s["capacity inflow"], + nominal_capacity=s["capacity inflow"], variable_costs=s["variable input costs"], ) }, outputs={ busd[s["bus"]]: solph.Flow( - nominal_value=s["capacity outflow"], + nominal_capacity=s["capacity outflow"], variable_costs=s["variable output costs"], ) }, diff --git a/examples/flexible_modelling/add_constraints.py b/examples/flexible_modelling/add_constraints.py index 1f1efceab..375b49735 100644 --- a/examples/flexible_modelling/add_constraints.py +++ b/examples/flexible_modelling/add_constraints.py @@ -69,18 +69,18 @@ def run_add_constraints_example(solver="cbc", nologg=False): sink = cmp.Sink( label="Sink", - inputs={b_el: Flow(nominal_value=40, fix=[0.5, 0.4, 0.3, 1])}, + inputs={b_el: Flow(nominal_capacity=40, fix=[0.5, 0.4, 0.3, 1])}, ) pp_oil = cmp.Converter( label="pp_oil", inputs={boil: Flow()}, - outputs={b_el: Flow(nominal_value=50, variable_costs=25)}, + outputs={b_el: Flow(nominal_capacity=50, variable_costs=25)}, conversion_factors={b_el: 0.39}, ) pp_lig = cmp.Converter( label="pp_lig", inputs={blig: Flow()}, - outputs={b_el: Flow(nominal_value=50, variable_costs=10)}, + outputs={b_el: Flow(nominal_capacity=50, variable_costs=10)}, conversion_factors={b_el: 0.41}, ) diff --git a/examples/flexible_modelling/saturating_storage.py b/examples/flexible_modelling/saturating_storage.py index 46f9d7730..757e685bb 100644 --- a/examples/flexible_modelling/saturating_storage.py +++ b/examples/flexible_modelling/saturating_storage.py @@ -50,7 +50,7 @@ def saturating_storage_example(): es.add( solph.components.Source( label="source_el", - outputs={bel: solph.Flow(nominal_value=1, fix=1)}, + outputs={bel: solph.Flow(nominal_capacity=1, fix=1)}, ) ) @@ -59,7 +59,7 @@ def saturating_storage_example(): label="sink_el", inputs={ bel: solph.Flow( - nominal_value=1, + nominal_capacity=1, variable_costs=1, ) }, @@ -74,7 +74,7 @@ def saturating_storage_example(): battery = solph.components.GenericStorage( label="battery", nominal_storage_capacity=storage_capacity, - inputs={bel: solph.Flow(nominal_value=inflow_capacity)}, + inputs={bel: solph.Flow(nominal_capacity=inflow_capacity)}, outputs={bel: solph.Flow(variable_costs=2)}, initial_storage_level=0, balanced=False, diff --git a/examples/flow_count_limit/flow_count_limit.py b/examples/flow_count_limit/flow_count_limit.py index 210d85052..b8a25fd47 100644 --- a/examples/flow_count_limit/flow_count_limit.py +++ b/examples/flow_count_limit/flow_count_limit.py @@ -71,7 +71,7 @@ def main(): outputs={ bel: solph.Flow( nonconvex=solph.NonConvex(), - nominal_value=210, + nominal_capacity=210, variable_costs=[-1, -5, -1, -1], max=[1, 1, 1, 0], custom_attributes={"my_keyword": True}, @@ -88,7 +88,7 @@ def main(): bel: solph.Flow( nonconvex=solph.NonConvex(), variable_costs=[-2, -1, -2, -2], - nominal_value=250, + nominal_capacity=250, max=[1, 1, 1, 0], custom_attributes={"my_keyword": False}, ) @@ -105,7 +105,7 @@ def main(): variable_costs=1, nonconvex=solph.NonConvex(), max=[1, 1, 1, 0], - nominal_value=145, + nominal_capacity=145, ) }, ) @@ -119,7 +119,7 @@ def main(): bel: solph.Flow( custom_attributes={"my_keyword": True}, fix=[0, 1, 1, 0], - nominal_value=130, + nominal_capacity=130, ) }, ) diff --git a/examples/generic_invest_limit/example_generic_invest.py b/examples/generic_invest_limit/example_generic_invest.py index a428f9c8f..a7b3a397e 100644 --- a/examples/generic_invest_limit/example_generic_invest.py +++ b/examples/generic_invest_limit/example_generic_invest.py @@ -105,7 +105,7 @@ def main(): es.add( solph.components.Sink( label="demand_a", - inputs={bus_a_1: solph.Flow(fix=data, nominal_value=1)}, + inputs={bus_a_1: solph.Flow(fix=data, nominal_capacity=1)}, ) ) @@ -130,7 +130,7 @@ def main(): es.add( solph.components.Sink( label="demand_b", - inputs={bus_b_1: solph.Flow(fix=data, nominal_value=1)}, + inputs={bus_b_1: solph.Flow(fix=data, nominal_capacity=1)}, ) ) @@ -141,7 +141,7 @@ def main(): inputs={bus_a_0: solph.Flow()}, outputs={ bus_a_1: solph.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_invest, custom_attributes={"space": 2}, ), @@ -158,7 +158,7 @@ def main(): inputs={bus_b_0: solph.Flow()}, outputs={ bus_b_1: solph.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_invest, custom_attributes={"space": 1}, ), diff --git a/examples/gradient_example/gradient_example.py b/examples/gradient_example/gradient_example.py index c1f7f58cb..b50269a1a 100644 --- a/examples/gradient_example/gradient_example.py +++ b/examples/gradient_example/gradient_example.py @@ -131,7 +131,7 @@ def main(): energysystem.add( cmp.Sink( label="demand", - inputs={bel: flows.Flow(fix=demand, nominal_value=1)}, + inputs={bel: flows.Flow(fix=demand, nominal_capacity=1)}, ) ) @@ -142,7 +142,7 @@ def main(): inputs={bgas: flows.Flow()}, outputs={ bel: flows.Flow( - nominal_value=10e5, + nominal_capacity=10e5, negative_gradient_limit=gradient, positive_gradient_limit=gradient, ) diff --git a/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py b/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py index 9ea6dfa30..60f12b7e9 100644 --- a/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py +++ b/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py @@ -132,7 +132,7 @@ def main(): outputs={ b_el_dc: solph.flows.Flow( fix=solar_potential / peak_solar_potential, - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_pv * n_days / n_days_in_year ), variable_costs=0, @@ -159,7 +159,7 @@ def main(): variable_costs=variable_cost_diesel_genset, min=min_load, max=max_load, - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_diesel_genset * n_days / n_days_in_year, maximum=2 * peak_demand, ), @@ -175,7 +175,7 @@ def main(): label="rectifier", inputs={ b_el_ac: solph.flows.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_rectifier * n_days / n_days_in_year ), variable_costs=0, @@ -193,7 +193,7 @@ def main(): label="inverter", inputs={ b_el_dc: solph.flows.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_inverter * n_days / n_days_in_year ), variable_costs=0, @@ -215,7 +215,7 @@ def main(): inputs={b_el_dc: solph.flows.Flow(variable_costs=0)}, outputs={ b_el_dc: solph.flows.Flow( - nominal_value=solph.Investment(ep_costs=0) + nominal_capacity=solph.Investment(ep_costs=0) ) }, initial_storage_level=0.0, @@ -234,7 +234,7 @@ def main(): inputs={ b_el_ac: solph.flows.Flow( fix=hourly_demand / peak_demand, - nominal_value=peak_demand, + nominal_capacity=peak_demand, ) }, ) diff --git a/examples/invest_nonconvex_flow_examples/house_with_nonconvex_investment.py b/examples/invest_nonconvex_flow_examples/house_with_nonconvex_investment.py index ba50494ab..2d9f345ef 100644 --- a/examples/invest_nonconvex_flow_examples/house_with_nonconvex_investment.py +++ b/examples/invest_nonconvex_flow_examples/house_with_nonconvex_investment.py @@ -71,7 +71,7 @@ def heat_demand(d): inputs={ b_heat: solph.flows.Flow( fix=[heat_demand(day) for day in range(0, periods)], - nominal_value=10, + nominal_capacity=10, ) }, ) @@ -91,7 +91,7 @@ def heat_demand(d): minimum_uptime=5, initial_status=1, ), - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc, minimum=1.0, maximum=10.0, @@ -104,14 +104,14 @@ def heat_demand(d): label="boiler", outputs={ b_heat: solph.flows.Flow( - nominal_value=10, min=0.3, variable_costs=0.2 + nominal_capacity=10, min=0.3, variable_costs=0.2 ) }, ) excess_heat = solph.components.Sink( label="excess_heat", - inputs={b_heat: solph.flows.Flow(nominal_value=10)}, + inputs={b_heat: solph.flows.Flow(nominal_capacity=10)}, ) es.add(demand_heat, fireplace, boiler, excess_heat) diff --git a/examples/invest_nonconvex_flow_examples/house_without_nonconvex_investment.py b/examples/invest_nonconvex_flow_examples/house_without_nonconvex_investment.py index 15baeacf3..3c00e88f6 100644 --- a/examples/invest_nonconvex_flow_examples/house_without_nonconvex_investment.py +++ b/examples/invest_nonconvex_flow_examples/house_without_nonconvex_investment.py @@ -80,7 +80,7 @@ def solar_thermal(d): inputs={ b_heat: solph.flows.Flow( fix=[heat_demand(day) for day in range(0, periods)], - nominal_value=10, + nominal_capacity=10, ) }, ) @@ -89,7 +89,7 @@ def solar_thermal(d): label="fireplace", outputs={ b_heat: solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, min=0.4, max=1.0, variable_costs=0.1, @@ -104,7 +104,7 @@ def solar_thermal(d): boiler = solph.components.Source( label="boiler", outputs={ - b_heat: solph.flows.Flow(nominal_value=10, variable_costs=0.2) + b_heat: solph.flows.Flow(nominal_capacity=10, variable_costs=0.2) }, ) @@ -117,7 +117,7 @@ def solar_thermal(d): outputs={ b_heat: solph.flows.Flow( fix=[solar_thermal(day) for day in range(0, periods)], - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc, minimum=1.0, maximum=5.0 ), ) @@ -126,7 +126,7 @@ def solar_thermal(d): excess_heat = solph.components.Sink( label="excess_heat", - inputs={b_heat: solph.flows.Flow(nominal_value=10)}, + inputs={b_heat: solph.flows.Flow(nominal_capacity=10)}, ) es.add(demand_heat, fireplace, boiler, thermal_collector, excess_heat) diff --git a/examples/investment_with_minimal_invest/minimal_invest.py b/examples/investment_with_minimal_invest/minimal_invest.py index 6302fa816..e48d0416f 100644 --- a/examples/investment_with_minimal_invest/minimal_invest.py +++ b/examples/investment_with_minimal_invest/minimal_invest.py @@ -66,7 +66,7 @@ def main(): es.add( solph.components.Sink( label="demand", - inputs={bus_1: solph.Flow(fix=data, nominal_value=1)}, + inputs={bus_1: solph.Flow(fix=data, nominal_capacity=1)}, ) ) @@ -86,7 +86,7 @@ def main(): inputs={bus_0: solph.Flow()}, outputs={ bus_1: solph.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=c_var, maximum=p_install_max, minimum=p_install_min, diff --git a/examples/min_max_runtimes/min_max_runtimes.py b/examples/min_max_runtimes/min_max_runtimes.py index 46a56deed..285ad5eed 100644 --- a/examples/min_max_runtimes/min_max_runtimes.py +++ b/examples/min_max_runtimes/min_max_runtimes.py @@ -50,7 +50,7 @@ def main(): demand_el = solph.components.Sink( label="demand_el", - inputs={bel: solph.Flow(fix=demand_el, nominal_value=10)}, + inputs={bel: solph.Flow(fix=demand_el, nominal_capacity=10)}, ) dummy_el = solph.components.Sink( @@ -61,7 +61,7 @@ def main(): label="plant_min_down_constraints", outputs={ bel: solph.Flow( - nominal_value=10, + nominal_capacity=10, min=0.5, max=1.0, variable_costs=10, @@ -76,7 +76,7 @@ def main(): label="plant_min_up_constraints", outputs={ bel: solph.Flow( - nominal_value=10, + nominal_capacity=10, min=0.5, max=1.0, variable_costs=10, diff --git a/examples/offset_converter_example/offset_diesel_genset_nonconvex_investment.py b/examples/offset_converter_example/offset_diesel_genset_nonconvex_investment.py index 94ebe0825..3bea2bcae 100644 --- a/examples/offset_converter_example/offset_diesel_genset_nonconvex_investment.py +++ b/examples/offset_converter_example/offset_diesel_genset_nonconvex_investment.py @@ -130,7 +130,7 @@ def offset_converter_example(): outputs={ b_el_dc: solph.flows.Flow( fix=solar_potential / peak_solar_potential, - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_pv * n_days / n_days_in_year ), variable_costs=0, @@ -173,7 +173,7 @@ def offset_converter_example(): variable_costs=variable_cost_diesel_genset, min=min_load, max=max_load, - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_diesel_genset * n_days / n_days_in_year, maximum=2 * peak_demand, ), @@ -190,7 +190,7 @@ def offset_converter_example(): label="rectifier", inputs={ b_el_ac: solph.flows.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_rectifier * n_days / n_days_in_year ), variable_costs=0, @@ -208,7 +208,7 @@ def offset_converter_example(): label="inverter", inputs={ b_el_dc: solph.flows.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_inverter * n_days / n_days_in_year ), variable_costs=0, @@ -230,7 +230,7 @@ def offset_converter_example(): inputs={b_el_dc: solph.flows.Flow(variable_costs=0)}, outputs={ b_el_dc: solph.flows.Flow( - nominal_value=solph.Investment(ep_costs=0) + nominal_capacity=solph.Investment(ep_costs=0) ) }, initial_storage_level=0.0, @@ -249,7 +249,7 @@ def offset_converter_example(): inputs={ b_el_ac: solph.flows.Flow( fix=hourly_demand / peak_demand, - nominal_value=peak_demand, + nominal_capacity=peak_demand, ) }, ) diff --git a/examples/simple_dispatch/simple_dispatch.py b/examples/simple_dispatch/simple_dispatch.py index ea9e9ab66..9ade61c4a 100644 --- a/examples/simple_dispatch/simple_dispatch.py +++ b/examples/simple_dispatch/simple_dispatch.py @@ -108,13 +108,14 @@ def main(): energysystem.add( Source( label="wind", - outputs={bel: Flow(fix=data["wind"], nominal_value=66.3)}, + outputs={bel: Flow(fix=data["wind"], nominal_capacity=66.3)}, ) ) energysystem.add( Source( - label="pv", outputs={bel: Flow(fix=data["pv"], nominal_value=65.3)} + label="pv", + outputs={bel: Flow(fix=data["pv"], nominal_capacity=65.3)}, ) ) @@ -122,14 +123,14 @@ def main(): energysystem.add( Sink( label="demand_el", - inputs={bel: Flow(nominal_value=85, fix=data["demand_el"])}, + inputs={bel: Flow(nominal_capacity=85, fix=data["demand_el"])}, ) ) energysystem.add( Sink( label="demand_th", - inputs={bth: Flow(nominal_value=40, fix=data["demand_th"])}, + inputs={bth: Flow(nominal_capacity=40, fix=data["demand_th"])}, ) ) @@ -138,7 +139,7 @@ def main(): Converter( label="pp_coal", inputs={bcoal: Flow()}, - outputs={bel: Flow(nominal_value=20.2, variable_costs=25)}, + outputs={bel: Flow(nominal_capacity=20.2, variable_costs=25)}, conversion_factors={bel: 0.39}, ) ) @@ -147,7 +148,7 @@ def main(): Converter( label="pp_lig", inputs={blig: Flow()}, - outputs={bel: Flow(nominal_value=11.8, variable_costs=19)}, + outputs={bel: Flow(nominal_capacity=11.8, variable_costs=19)}, conversion_factors={bel: 0.41}, ) ) @@ -156,7 +157,7 @@ def main(): Converter( label="pp_gas", inputs={bgas: Flow()}, - outputs={bel: Flow(nominal_value=41, variable_costs=40)}, + outputs={bel: Flow(nominal_capacity=41, variable_costs=40)}, conversion_factors={bel: 0.50}, ) ) @@ -165,7 +166,7 @@ def main(): Converter( label="pp_oil", inputs={boil: Flow()}, - outputs={bel: Flow(nominal_value=5, variable_costs=50)}, + outputs={bel: Flow(nominal_capacity=5, variable_costs=50)}, conversion_factors={bel: 0.28}, ) ) @@ -176,8 +177,8 @@ def main(): label="pp_chp", inputs={bgas: Flow()}, outputs={ - bel: Flow(nominal_value=30, variable_costs=42), - bth: Flow(nominal_value=40), + bel: Flow(nominal_capacity=30, variable_costs=42), + bth: Flow(nominal_capacity=40), }, conversion_factors={bel: 0.3, bth: 0.4}, ) @@ -196,7 +197,7 @@ def main(): Converter( label="heat_pump", inputs={bel: Flow(), b_heat_source: Flow()}, - outputs={bth: Flow(nominal_value=10)}, + outputs={bth: Flow(nominal_capacity=10)}, conversion_factors={bel: 1 / 3, b_heat_source: (cop - 1) / cop}, ) ) diff --git a/examples/start_and_shutdown_costs/startup_shutdown.py b/examples/start_and_shutdown_costs/startup_shutdown.py index 47b9349b6..648a02f49 100644 --- a/examples/start_and_shutdown_costs/startup_shutdown.py +++ b/examples/start_and_shutdown_costs/startup_shutdown.py @@ -71,7 +71,7 @@ def main(): demand_el = solph.components.Sink( label="demand_el", - inputs={bel: solph.Flow(fix=demand_el, nominal_value=10)}, + inputs={bel: solph.Flow(fix=demand_el, nominal_capacity=10)}, ) # pp1 and pp2 are competing to serve overall 12 units load at lowest cost @@ -81,7 +81,7 @@ def main(): # the start and shutdown costs of pp2 change its marginal costs pp1 = solph.components.Source( label="power_plant1", - outputs={bel: solph.Flow(nominal_value=10, variable_costs=10.25)}, + outputs={bel: solph.Flow(nominal_capacity=10, variable_costs=10.25)}, ) # shutdown costs only work in combination with a minimum load @@ -92,7 +92,7 @@ def main(): label="power_plant2", outputs={ bel: solph.Flow( - nominal_value=10, + nominal_capacity=10, min=0.5, max=1.0, variable_costs=10, diff --git a/examples/storage_balanced_unbalanced/storage.py b/examples/storage_balanced_unbalanced/storage.py index 591274630..d26e8419e 100644 --- a/examples/storage_balanced_unbalanced/storage.py +++ b/examples/storage_balanced_unbalanced/storage.py @@ -89,7 +89,9 @@ def storage_example(): solph.components.Source( label="pv_el_{0}".format(name), outputs={ - bel: solph.Flow(fix=timeseries["pv_el"], nominal_value=1) + bel: solph.Flow( + fix=timeseries["pv_el"], nominal_capacity=1 + ) }, ) ) @@ -99,7 +101,7 @@ def storage_example(): label="demand_el_{0}".format(name), inputs={ bel: solph.Flow( - fix=timeseries["demand_el"], nominal_value=1 + fix=timeseries["demand_el"], nominal_capacity=1 ) }, ) diff --git a/examples/storage_costs/storage_costs.py b/examples/storage_costs/storage_costs.py index 312c5ab49..39bfae556 100644 --- a/examples/storage_costs/storage_costs.py +++ b/examples/storage_costs/storage_costs.py @@ -89,13 +89,13 @@ def storage_costs_example(): nominal_storage_capacity=10, inputs={ bel: solph.Flow( - nominal_value=1, + nominal_capacity=1, variable_costs=electricity_price, ) }, outputs={ bel: solph.Flow( - nominal_value=1, + nominal_capacity=1, variable_costs=-electricity_price, ) }, @@ -111,13 +111,13 @@ def storage_costs_example(): nominal_storage_capacity=10, inputs={ bel: solph.Flow( - nominal_value=1, + nominal_capacity=1, variable_costs=electricity_price, ) }, outputs={ bel: solph.Flow( - nominal_value=1, + nominal_capacity=1, variable_costs=-electricity_price, ) }, diff --git a/examples/storage_investment/v1_invest_optimize_all_technologies.py b/examples/storage_investment/v1_invest_optimize_all_technologies.py index 8f3749fd5..45c5a1d25 100644 --- a/examples/storage_investment/v1_invest_optimize_all_technologies.py +++ b/examples/storage_investment/v1_invest_optimize_all_technologies.py @@ -151,7 +151,7 @@ def main(): outputs={ bel: solph.Flow( fix=data["wind"], - nominal_value=solph.Investment(ep_costs=epc_wind), + nominal_capacity=solph.Investment(ep_costs=epc_wind), ) }, ) @@ -161,7 +161,8 @@ def main(): label="pv", outputs={ bel: solph.Flow( - fix=data["pv"], nominal_value=solph.Investment(ep_costs=epc_pv) + fix=data["pv"], + nominal_capacity=solph.Investment(ep_costs=epc_pv), ) }, ) @@ -169,14 +170,14 @@ def main(): # create simple sink object representing the electrical demand demand = solph.components.Sink( label="demand", - inputs={bel: solph.Flow(fix=data["demand_el"], nominal_value=1)}, + inputs={bel: solph.Flow(fix=data["demand_el"], nominal_capacity=1)}, ) # create simple Converter object representing a gas power plant pp_gas = solph.components.Converter( label="pp_gas", inputs={bgas: solph.Flow()}, - outputs={bel: solph.Flow(nominal_value=10e10, variable_costs=0)}, + outputs={bel: solph.Flow(nominal_capacity=10e10, variable_costs=0)}, conversion_factors={bel: 0.58}, ) diff --git a/examples/storage_investment/v2_invest_optimize_only_gas_and_storage.py b/examples/storage_investment/v2_invest_optimize_only_gas_and_storage.py index 00c251044..528059e03 100644 --- a/examples/storage_investment/v2_invest_optimize_only_gas_and_storage.py +++ b/examples/storage_investment/v2_invest_optimize_only_gas_and_storage.py @@ -150,26 +150,26 @@ def main(): # create fixed source object representing wind power plants wind = solph.components.Source( label="wind", - outputs={bel: solph.Flow(fix=data["wind"], nominal_value=1000000)}, + outputs={bel: solph.Flow(fix=data["wind"], nominal_capacity=1000000)}, ) # create fixed source object representing pv power plants pv = solph.components.Source( label="pv", - outputs={bel: solph.Flow(fix=data["pv"], nominal_value=600000)}, + outputs={bel: solph.Flow(fix=data["pv"], nominal_capacity=600000)}, ) # create simple sink object representing the electrical demand demand = solph.components.Sink( label="demand", - inputs={bel: solph.Flow(fix=data["demand_el"], nominal_value=1)}, + inputs={bel: solph.Flow(fix=data["demand_el"], nominal_capacity=1)}, ) # create simple Converter object representing a gas power plant pp_gas = solph.components.Converter( label="pp_gas", inputs={bgas: solph.Flow()}, - outputs={bel: solph.Flow(nominal_value=10e10, variable_costs=0)}, + outputs={bel: solph.Flow(nominal_capacity=10e10, variable_costs=0)}, conversion_factors={bel: 0.58}, ) diff --git a/examples/storage_investment/v3_invest_optimize_only_storage_with_fossil_share.py b/examples/storage_investment/v3_invest_optimize_only_storage_with_fossil_share.py index f682620cf..4c254e2be 100644 --- a/examples/storage_investment/v3_invest_optimize_only_storage_with_fossil_share.py +++ b/examples/storage_investment/v3_invest_optimize_only_storage_with_fossil_share.py @@ -147,7 +147,7 @@ def main(): label="rgas", outputs={ bgas: solph.Flow( - nominal_value=fossil_share + nominal_capacity=fossil_share * consumption_total / 0.58 * number_timesteps @@ -160,26 +160,26 @@ def main(): # create fixed source object representing wind power plants wind = solph.components.Source( label="wind", - outputs={bel: solph.Flow(fix=data["wind"], nominal_value=1000000)}, + outputs={bel: solph.Flow(fix=data["wind"], nominal_capacity=1000000)}, ) # create fixed source object representing pv power plants pv = solph.components.Source( label="pv", - outputs={bel: solph.Flow(fix=data["pv"], nominal_value=600000)}, + outputs={bel: solph.Flow(fix=data["pv"], nominal_capacity=600000)}, ) # create simple sink object representing the electrical demand demand = solph.components.Sink( label="demand", - inputs={bel: solph.Flow(fix=data["demand_el"], nominal_value=1)}, + inputs={bel: solph.Flow(fix=data["demand_el"], nominal_capacity=1)}, ) # create simple Converter object representing a gas power plant pp_gas = solph.components.Converter( label="pp_gas", inputs={bgas: solph.Flow()}, - outputs={bel: solph.Flow(nominal_value=10e10, variable_costs=0)}, + outputs={bel: solph.Flow(nominal_capacity=10e10, variable_costs=0)}, conversion_factors={bel: 0.58}, ) diff --git a/examples/storage_investment/v4_invest_optimize_all_technologies_with_fossil_share.py b/examples/storage_investment/v4_invest_optimize_all_technologies_with_fossil_share.py index a9c3511c9..2e9264ff1 100644 --- a/examples/storage_investment/v4_invest_optimize_all_technologies_with_fossil_share.py +++ b/examples/storage_investment/v4_invest_optimize_all_technologies_with_fossil_share.py @@ -146,7 +146,7 @@ def main(): label="rgas", outputs={ bgas: solph.Flow( - nominal_value=fossil_share + nominal_capacity=fossil_share * consumption_total / 0.58 * number_timesteps @@ -162,7 +162,7 @@ def main(): outputs={ bel: solph.Flow( fix=data["wind"], - nominal_value=solph.Investment(ep_costs=epc_wind), + nominal_capacity=solph.Investment(ep_costs=epc_wind), ) }, ) @@ -172,7 +172,8 @@ def main(): label="pv", outputs={ bel: solph.Flow( - fix=data["pv"], nominal_value=solph.Investment(ep_costs=epc_pv) + fix=data["pv"], + nominal_capacity=solph.Investment(ep_costs=epc_pv), ) }, ) @@ -180,14 +181,14 @@ def main(): # create simple sink object representing the electrical demand demand = solph.components.Sink( label="demand", - inputs={bel: solph.Flow(fix=data["demand_el"], nominal_value=1)}, + inputs={bel: solph.Flow(fix=data["demand_el"], nominal_capacity=1)}, ) # create simple Converter object representing a gas power plant pp_gas = solph.components.Converter( label="pp_gas", inputs={bgas: solph.Flow()}, - outputs={bel: solph.Flow(nominal_value=10e10, variable_costs=0)}, + outputs={bel: solph.Flow(nominal_capacity=10e10, variable_costs=0)}, conversion_factors={bel: 0.58}, ) diff --git a/examples/storage_level_constraint/storage_level_constraint.py b/examples/storage_level_constraint/storage_level_constraint.py index 9fd51a607..cbc237445 100644 --- a/examples/storage_level_constraint/storage_level_constraint.py +++ b/examples/storage_level_constraint/storage_level_constraint.py @@ -73,22 +73,24 @@ def storage_level_constraint_example(): in_0 = Source( label="in_0", - outputs={multiplexer: Flow(nominal_value=0.5, variable_costs=0.15)}, + outputs={multiplexer: Flow(nominal_capacity=0.5, variable_costs=0.15)}, ) es.add(in_0) - in_1 = Source(label="in_1", outputs={multiplexer: Flow(nominal_value=0.1)}) + in_1 = Source( + label="in_1", outputs={multiplexer: Flow(nominal_capacity=0.1)} + ) es.add(in_1) out_0 = Sink( label="out_0", - inputs={multiplexer: Flow(nominal_value=0.25, variable_costs=-0.1)}, + inputs={multiplexer: Flow(nominal_capacity=0.25, variable_costs=-0.1)}, ) es.add(out_0) out_1 = Sink( label="out_1", - inputs={multiplexer: Flow(nominal_value=0.15, variable_costs=-0.1)}, + inputs={multiplexer: Flow(nominal_capacity=0.15, variable_costs=-0.1)}, ) es.add(out_1) diff --git a/examples/time_index_example/non_equidistant_time_step_example.py b/examples/time_index_example/non_equidistant_time_step_example.py index 8e8d47081..02c91af34 100644 --- a/examples/time_index_example/non_equidistant_time_step_example.py +++ b/examples/time_index_example/non_equidistant_time_step_example.py @@ -75,7 +75,7 @@ def main(): label="source", outputs={ bus: solph.flows.Flow( - nominal_value=16, + nominal_capacity=16, variable_costs=0.2, max=[0, 0, 0, 0, 0, 0, 0, 1, 1], ) @@ -99,7 +99,7 @@ def main(): inputs={bus: solph.flows.Flow()}, outputs={ bus: solph.flows.Flow( - nominal_value=4, max=[0, 0, 0, 0, 0, 0, 0, 1, 1] + nominal_capacity=4, max=[0, 0, 0, 0, 0, 0, 0, 1, 1] ) }, nominal_storage_capacity=8, @@ -110,7 +110,7 @@ def main(): label="sink", inputs={ bus: solph.flows.Flow( - nominal_value=8, + nominal_capacity=8, variable_costs=0.1, fix=[0.75, 0.5, 0, 0, 1, 0, 0, 0, 0], ) diff --git a/examples/time_index_example/simple_time_step_example.py b/examples/time_index_example/simple_time_step_example.py index 7a0509872..9d6cb5b07 100644 --- a/examples/time_index_example/simple_time_step_example.py +++ b/examples/time_index_example/simple_time_step_example.py @@ -14,7 +14,7 @@ If the storage is balanced, this is the same storage level as in the last time step. * The nominal_value in Flows has to be interpreted in means of power: We have - nominal_value=0.5, but the maximum change of the storage content of an ideal + nominal_capacity=0.5, but the maximum change of the storage content of an ideal storage is 0.125. Code @@ -60,7 +60,7 @@ def main(): label="source", outputs={ bus: solph.flows.Flow( - nominal_value=2, + nominal_capacity=2, variable_costs=0.2, max=[0, 0, 0, 0, 1, 0.25, 0.75, 1], ) @@ -77,7 +77,7 @@ def main(): label="sink", inputs={ bus: solph.flows.Flow( - nominal_value=2, + nominal_capacity=2, variable_costs=0.1, fix=[1, 1, 0.5, 0.5, 0, 0, 0, 0], ) diff --git a/examples/tuple_as_labels/tuple_as_label.py b/examples/tuple_as_labels/tuple_as_label.py index b31fe559f..50c904851 100644 --- a/examples/tuple_as_labels/tuple_as_label.py +++ b/examples/tuple_as_labels/tuple_as_label.py @@ -198,7 +198,7 @@ def main(): energysystem.add( comp.Source( label=Label("ee_source", "electricity", "wind"), - outputs={bel: flows.Flow(fix=data["wind"], nominal_value=2000)}, + outputs={bel: flows.Flow(fix=data["wind"], nominal_capacity=2000)}, ) ) @@ -206,7 +206,7 @@ def main(): energysystem.add( comp.Source( label=Label("ee_source", "electricity", "pv"), - outputs={bel: flows.Flow(fix=data["pv"], nominal_value=3000)}, + outputs={bel: flows.Flow(fix=data["pv"], nominal_capacity=3000)}, ) ) @@ -215,7 +215,9 @@ def main(): comp.Sink( label=Label("sink", "electricity", "demand"), inputs={ - bel: flows.Flow(fix=data["demand_el"] / 1000, nominal_value=1) + bel: flows.Flow( + fix=data["demand_el"] / 1000, nominal_capacity=1 + ) }, ) ) @@ -225,7 +227,9 @@ def main(): comp.Converter( label=Label("power plant", "electricity", "gas"), inputs={bgas: flows.Flow()}, - outputs={bel: flows.Flow(nominal_value=10000, variable_costs=50)}, + outputs={ + bel: flows.Flow(nominal_capacity=10000, variable_costs=50) + }, conversion_factors={bel: 0.58}, ) ) @@ -235,8 +239,12 @@ def main(): storage = comp.GenericStorage( nominal_storage_capacity=nominal_storage_capacity, label=Label("storage", "electricity", "battery"), - inputs={bel: flows.Flow(nominal_value=nominal_storage_capacity / 6)}, - outputs={bel: flows.Flow(nominal_value=nominal_storage_capacity / 6)}, + inputs={ + bel: flows.Flow(nominal_capacity=nominal_storage_capacity / 6) + }, + outputs={ + bel: flows.Flow(nominal_capacity=nominal_storage_capacity / 6) + }, loss_rate=0.00, initial_storage_level=None, inflow_conversion_factor=1, diff --git a/examples/variable_chp/variable_chp.py b/examples/variable_chp/variable_chp.py index 8561c3c32..03b2d905c 100644 --- a/examples/variable_chp/variable_chp.py +++ b/examples/variable_chp/variable_chp.py @@ -176,13 +176,15 @@ def main(): noded["demand_elec"] = solph.components.Sink( label="demand_elec", inputs={ - noded["bel"]: solph.Flow(fix=data["demand_el"], nominal_value=1) + noded["bel"]: solph.Flow(fix=data["demand_el"], nominal_capacity=1) }, ) noded["demand_el_2"] = solph.components.Sink( label="demand_el_2", inputs={ - noded["bel2"]: solph.Flow(fix=data["demand_el"], nominal_value=1) + noded["bel2"]: solph.Flow( + fix=data["demand_el"], nominal_capacity=1 + ) }, ) @@ -191,7 +193,7 @@ def main(): label="demand_therm", inputs={ noded["bth"]: solph.Flow( - fix=data["demand_th"], nominal_value=741000 + fix=data["demand_th"], nominal_capacity=741000 ) }, ) @@ -199,7 +201,7 @@ def main(): label="demand_th_2", inputs={ noded["bth2"]: solph.Flow( - fix=data["demand_th"], nominal_value=741000 + fix=data["demand_th"], nominal_capacity=741000 ) }, ) @@ -207,7 +209,7 @@ def main(): # This is just a dummy Converter with a nominal input of zero noded["fixed_chp_gas"] = solph.components.Converter( label="fixed_chp_gas", - inputs={noded["bgas"]: solph.Flow(nominal_value=0)}, + inputs={noded["bgas"]: solph.Flow(nominal_capacity=0)}, outputs={noded["bel"]: solph.Flow(), noded["bth"]: solph.Flow()}, conversion_factors={noded["bel"]: 0.3, noded["bth"]: 0.5}, ) @@ -215,7 +217,7 @@ def main(): # create a fixed Converter to distribute to the heat_2 and elec_2 buses noded["fixed_chp_gas_2"] = solph.components.Converter( label="fixed_chp_gas_2", - inputs={noded["bgas"]: solph.Flow(nominal_value=10e10)}, + inputs={noded["bgas"]: solph.Flow(nominal_capacity=10e10)}, outputs={noded["bel2"]: solph.Flow(), noded["bth2"]: solph.Flow()}, conversion_factors={noded["bel2"]: 0.3, noded["bth2"]: 0.5}, ) @@ -223,7 +225,7 @@ def main(): # create a fixed Converter to distribute to the heat and elec buses noded["variable_chp_gas"] = solph.components.ExtractionTurbineCHP( label="variable_chp_gas", - inputs={noded["bgas"]: solph.Flow(nominal_value=10e10)}, + inputs={noded["bgas"]: solph.Flow(nominal_capacity=10e10)}, outputs={noded["bel"]: solph.Flow(), noded["bth"]: solph.Flow()}, conversion_factors={noded["bel"]: 0.3, noded["bth"]: 0.5}, conversion_factor_full_condensation={noded["bel"]: 0.5}, diff --git a/src/oemof/solph/_console_scripts.py b/src/oemof/solph/_console_scripts.py index ecc15c77b..0eccd6840 100644 --- a/src/oemof/solph/_console_scripts.py +++ b/src/oemof/solph/_console_scripts.py @@ -34,14 +34,14 @@ def _check_oemof_installation(solvers): solph.components.Sink( label="demand", inputs={ - bel: solph.flows.Flow(fix=[10, 20, 30, 40, 50], nominal_value=1) + bel: solph.flows.Flow(fix=[10, 20, 30, 40, 50], nominal_capacity=1) }, ) solph.components.Converter( label="pp_gas", inputs={bgas: solph.flows.Flow()}, outputs={ - bel: solph.flows.Flow(nominal_value=10e10, variable_costs=50) + bel: solph.flows.Flow(nominal_capacity=10e10, variable_costs=50) }, conversion_factors={bel: 0.58}, ) diff --git a/src/oemof/solph/components/_extraction_turbine_chp.py b/src/oemof/solph/components/_extraction_turbine_chp.py index cef1a6152..e6ed731db 100644 --- a/src/oemof/solph/components/_extraction_turbine_chp.py +++ b/src/oemof/solph/components/_extraction_turbine_chp.py @@ -64,7 +64,7 @@ class ExtractionTurbineCHP(Converter): >>> bgas = solph.buses.Bus(label='commodityBus') >>> et_chp = solph.components.ExtractionTurbineCHP( ... label='variable_chp_gas', - ... inputs={bgas: solph.flows.Flow(nominal_value=10e10)}, + ... inputs={bgas: solph.flows.Flow(nominal_capacity=10e10)}, ... outputs={bel: solph.flows.Flow(), bth: solph.flows.Flow()}, ... conversion_factors={bel: 0.3, bth: 0.5}, ... conversion_factor_full_condensation={bel: 0.5}) diff --git a/src/oemof/solph/components/_generic_storage.py b/src/oemof/solph/components/_generic_storage.py index 62a04dc87..f8fd76df7 100644 --- a/src/oemof/solph/components/_generic_storage.py +++ b/src/oemof/solph/components/_generic_storage.py @@ -141,8 +141,8 @@ class GenericStorage(Node): >>> my_storage = solph.components.GenericStorage( ... label='storage', ... nominal_storage_capacity=1000, - ... inputs={my_bus: solph.flows.Flow(nominal_value=200, variable_costs=10)}, - ... outputs={my_bus: solph.flows.Flow(nominal_value=200)}, + ... inputs={my_bus: solph.flows.Flow(nominal_capacity=200, variable_costs=10)}, + ... outputs={my_bus: solph.flows.Flow(nominal_capacity=200)}, ... loss_rate=0.01, ... initial_storage_level=0, ... max_storage_level = 0.9, diff --git a/src/oemof/solph/components/_link.py b/src/oemof/solph/components/_link.py index d5ca435c4..b6042c91a 100644 --- a/src/oemof/solph/components/_link.py +++ b/src/oemof/solph/components/_link.py @@ -60,8 +60,8 @@ class Link(Node): >>> link = solph.components.Link( ... label="transshipment_link", - ... inputs={bel0: solph.flows.Flow(nominal_value=4), - ... bel1: solph.flows.Flow(nominal_value=2)}, + ... inputs={bel0: solph.flows.Flow(nominal_capacity=4), + ... bel1: solph.flows.Flow(nominal_capacity=2)}, ... outputs={bel0: solph.flows.Flow(), ... bel1: solph.flows.Flow()}, ... conversion_factors={(bel0, bel1): 0.8, (bel1, bel0): 0.9}) diff --git a/src/oemof/solph/components/_offset_converter.py b/src/oemof/solph/components/_offset_converter.py index b078c9ced..b33442f6c 100644 --- a/src/oemof/solph/components/_offset_converter.py +++ b/src/oemof/solph/components/_offset_converter.py @@ -108,7 +108,7 @@ class OffsetConverter(Node): ... label='ostf', ... inputs={bel: solph.flows.Flow()}, ... outputs={bth: solph.flows.Flow( - ... nominal_value=l_nominal, min=l_min, max=l_max, + ... nominal_capacity=l_nominal, min=l_min, max=l_max, ... nonconvex=solph.NonConvex())}, ... conversion_factors={bel: slope}, ... normed_offsets={bel: offset}, diff --git a/src/oemof/solph/components/experimental/_piecewise_linear_converter.py b/src/oemof/solph/components/experimental/_piecewise_linear_converter.py index 666dfd701..ef2e5192b 100644 --- a/src/oemof/solph/components/experimental/_piecewise_linear_converter.py +++ b/src/oemof/solph/components/experimental/_piecewise_linear_converter.py @@ -54,7 +54,7 @@ class PiecewiseLinearConverter(Node): >>> pwltf = solph.components.experimental.PiecewiseLinearConverter( ... label='pwltf', ... inputs={b_gas: solph.flows.Flow( - ... nominal_value=100, + ... nominal_capacity=100, ... variable_costs=1)}, ... outputs={b_el: solph.flows.Flow()}, ... in_breakpoints=[0,25,50,75,100], diff --git a/src/oemof/solph/constraints/equate_variables.py b/src/oemof/solph/constraints/equate_variables.py index 52237830d..0238a2896 100644 --- a/src/oemof/solph/constraints/equate_variables.py +++ b/src/oemof/solph/constraints/equate_variables.py @@ -74,12 +74,12 @@ def equate_variables(model, var1, var2, factor1=1, name=None): ... label='powerline_1_2', ... inputs={bel1: solph.flows.Flow()}, ... outputs={bel2: solph.flows.Flow( - ... nominal_value=solph.Investment(ep_costs=20))})) + ... nominal_capacity=solph.Investment(ep_costs=20))})) >>> energysystem.add(solph.components.Converter( ... label='powerline_2_1', ... inputs={bel2: solph.flows.Flow()}, ... outputs={bel1: solph.flows.Flow( - ... nominal_value=solph.Investment(ep_costs=20))})) + ... nominal_capacity=solph.Investment(ep_costs=20))})) >>> om = solph.Model(energysystem) >>> line12 = energysystem.groups['powerline_1_2'] >>> line21 = energysystem.groups['powerline_2_1'] diff --git a/src/oemof/solph/constraints/integral_limit.py b/src/oemof/solph/constraints/integral_limit.py index 0544226db..38d09ec58 100644 --- a/src/oemof/solph/constraints/integral_limit.py +++ b/src/oemof/solph/constraints/integral_limit.py @@ -127,10 +127,10 @@ def generic_integral_limit( ... ) >>> bel = solph.buses.Bus(label='electricityBus') >>> flow1 = solph.flows.Flow( - ... nominal_value=100, + ... nominal_capacity=100, ... custom_attributes={"my_factor": 0.8}, ... ) - >>> flow2 = solph.flows.Flow(nominal_value=50) + >>> flow2 = solph.flows.Flow(nominal_capacity=50) >>> src1 = solph.components.Source(label='source1', outputs={bel: flow1}) >>> src2 = solph.components.Source(label='source2', outputs={bel: flow2}) >>> energysystem.add(bel, src1, src2) diff --git a/src/oemof/solph/constraints/investment_limit.py b/src/oemof/solph/constraints/investment_limit.py index 1d3b62454..abb6ec9fe 100644 --- a/src/oemof/solph/constraints/investment_limit.py +++ b/src/oemof/solph/constraints/investment_limit.py @@ -178,16 +178,16 @@ def additional_investment_flow_limit(model, keyword, limit=None): ... ) >>> bus = solph.buses.Bus(label='bus_1') >>> sink = solph.components.Sink(label="sink", inputs={bus: - ... solph.flows.Flow(nominal_value=10, fix=[10, 20, 30, 40, 50])}) + ... solph.flows.Flow(nominal_capacity=10, fix=[10, 20, 30, 40, 50])}) >>> src1 = solph.components.Source( ... label='source_0', outputs={bus: solph.flows.Flow( - ... nominal_value=solph.Investment( + ... nominal_capacity=solph.Investment( ... ep_costs=50, custom_attributes={"space": 4}, ... )) ... }) >>> src2 = solph.components.Source( ... label='source_1', outputs={bus: solph.flows.Flow( - ... nominal_value=solph.Investment( + ... nominal_capacity=solph.Investment( ... ep_costs=100, custom_attributes={"space": 1}, ... )) ... }) diff --git a/src/oemof/solph/flows/experimental/_electrical_line.py b/src/oemof/solph/flows/experimental/_electrical_line.py index 2b5e2eb85..8edd417f0 100644 --- a/src/oemof/solph/flows/experimental/_electrical_line.py +++ b/src/oemof/solph/flows/experimental/_electrical_line.py @@ -60,7 +60,7 @@ class ElectricalLine(Flow): def __init__(self, **kwargs): super().__init__( - nominal_value=kwargs.get("nominal_value"), + nominal_capacity=kwargs.get("nominal_value"), variable_costs=kwargs.get("variable_costs", 0), min=kwargs.get("min"), max=kwargs.get("max"), diff --git a/tests/test_components.py b/tests/test_components.py index f66230bfc..02a7b1d1e 100644 --- a/tests/test_components.py +++ b/tests/test_components.py @@ -70,8 +70,8 @@ def test_generic_storage_3(): components.GenericStorage( label="storage4", nominal_storage_capacity=45, - inputs={bel: Flow(nominal_value=23, variable_costs=10e10)}, - outputs={bel: Flow(nominal_value=7.5, variable_costs=10e10)}, + inputs={bel: Flow(nominal_capacity=23, variable_costs=10e10)}, + outputs={bel: Flow(nominal_capacity=7.5, variable_costs=10e10)}, loss_rate=0.00, initial_storage_level=0, inflow_conversion_factor=1, @@ -112,7 +112,9 @@ def test_generic_storage_with_non_convex_investment(): outputs={bel: Flow()}, invest_relation_input_capacity=1 / 6, invest_relation_output_capacity=1 / 6, - nominal_value=Investment(nonconvex=True, existing=5, maximum=25), + nominal_capacity=Investment( + nonconvex=True, existing=5, maximum=25 + ), ) @@ -261,7 +263,7 @@ def test_offsetconverter_investment_not_on_nonconvex(): b_diesel = Bus(label="bus_diesel") b_heat = Bus(label="bus_heat") components.OffsetConverter( - inputs={b_diesel: Flow(nominal_value=Investment(maximum=1))}, + inputs={b_diesel: Flow(nominal_capacity=Investment(maximum=1))}, outputs={b_heat: Flow(nonconvex=NonConvex())}, ) diff --git a/tests/test_components/test_offset_converter.py b/tests/test_components/test_offset_converter.py index 997a1140c..c094cb5d0 100644 --- a/tests/test_components/test_offset_converter.py +++ b/tests/test_components/test_offset_converter.py @@ -172,7 +172,7 @@ def test_custom_properties(): bus2 = solph.Bus() oc = solph.components.OffsetConverter( inputs={ - bus1: solph.Flow(nominal_value=2, nonconvex=solph.NonConvex()) + bus1: solph.Flow(nominal_capacity=2, nonconvex=solph.NonConvex()) }, outputs={bus2: solph.Flow()}, conversion_factors={bus2: 2}, @@ -189,7 +189,9 @@ def test_invalid_conversion_factor(): with pytest.raises(ValueError, match="Conversion factors cannot be "): solph.components.OffsetConverter( inputs={ - bus1: solph.Flow(nominal_value=2, nonconvex=solph.NonConvex()) + bus1: solph.Flow( + nominal_capacity=2, nonconvex=solph.NonConvex() + ) }, outputs={bus2: solph.Flow()}, conversion_factors={ @@ -206,7 +208,9 @@ def test_invalid_normed_offset(): with pytest.raises(ValueError, match="Normed offsets cannot be "): solph.components.OffsetConverter( inputs={ - bus1: solph.Flow(nominal_value=2, nonconvex=solph.NonConvex()) + bus1: solph.Flow( + nominal_capacity=2, nonconvex=solph.NonConvex() + ) }, outputs={bus2: solph.Flow()}, conversion_factors={ @@ -225,7 +229,9 @@ def test_wrong_number_of_coefficients(): with pytest.raises(ValueError, match="Two coefficients"): solph.components.OffsetTransformer( inputs={ - bus1: solph.Flow(nominal_value=2, nonconvex=solph.NonConvex()) + bus1: solph.Flow( + nominal_capacity=2, nonconvex=solph.NonConvex() + ) }, outputs={bus2: solph.Flow()}, coefficients=(1, 2, 3), @@ -474,7 +480,7 @@ def test_two_OffsetConverters_with_and_without_investment(): outputs={ es.groups["bus output 0"]: solph.Flow( nonconvex=solph.NonConvex(), - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( maximum=nominal_value, ep_costs=10 ), ) @@ -528,7 +534,7 @@ def test_OffsetConverter_05x_compatibility(): outputs={ es.groups["bus output 0"]: solph.Flow( nonconvex=solph.NonConvex(), - nominal_value=nominal_value, + nominal_capacity=nominal_value, min=minimal_value / nominal_value, ) }, @@ -575,7 +581,7 @@ def test_error_handling(): outputs={ output_bus: solph.Flow( nonconvex=solph.NonConvex(), - nominal_value=10, + nominal_capacity=10, min=0.3, ) }, @@ -595,7 +601,7 @@ def test_error_handling(): outputs={ output_bus: solph.Flow( nonconvex=solph.NonConvex(), - nominal_value=10, + nominal_capacity=10, min=0.3, ) }, @@ -612,7 +618,7 @@ def test_error_handling(): outputs={ output_bus: solph.Flow( nonconvex=solph.NonConvex(), - nominal_value=10, + nominal_capacity=10, min=0.3, ) }, diff --git a/tests/test_components/test_sink.py b/tests/test_components/test_sink.py index fa0559650..a4bce2a26 100644 --- a/tests/test_components/test_sink.py +++ b/tests/test_components/test_sink.py @@ -32,7 +32,7 @@ def test_multi_input_sink(): solph.components.Sink( inputs={ es.node[f"bus input {i}"]: solph.Flow( - nominal_value=1, + nominal_capacity=1, variable_costs=costs, ) for i in range(num_in) diff --git a/tests/test_components/test_source.py b/tests/test_components/test_source.py index 7219639b0..cce218fc6 100644 --- a/tests/test_components/test_source.py +++ b/tests/test_components/test_source.py @@ -31,7 +31,7 @@ def test_multi_output_source(): solph.components.Source( outputs={ es.node[f"bus input {i}"]: solph.Flow( - nominal_value=1, + nominal_capacity=1, variable_costs=costs, ) for i in range(num_out) diff --git a/tests/test_components/test_storage.py b/tests/test_components/test_storage.py index 763883637..16faf3fae 100644 --- a/tests/test_components/test_storage.py +++ b/tests/test_components/test_storage.py @@ -66,12 +66,14 @@ def test_invest_power_uncoupled(): "storage", inputs={ bus: solph.Flow( - variable_costs=-1, nominal_value=solph.Investment(ep_costs=0.1) + variable_costs=-1, + nominal_capacity=solph.Investment(ep_costs=0.1), ) }, outputs={ bus: solph.Flow( - variable_costs=1, nominal_value=solph.Investment(ep_costs=0.1) + variable_costs=1, + nominal_capacity=solph.Investment(ep_costs=0.1), ) }, nominal_storage_capacity=10, @@ -110,12 +112,14 @@ def test_invest_power_coupled(): "storage", inputs={ bus: solph.Flow( - variable_costs=-1, nominal_value=solph.Investment(ep_costs=0.1) + variable_costs=-1, + nominal_capacity=solph.Investment(ep_costs=0.1), ) }, outputs={ bus: solph.Flow( - variable_costs=1, nominal_value=solph.Investment(ep_costs=0.1) + variable_costs=1, + nominal_capacity=solph.Investment(ep_costs=0.1), ) }, nominal_storage_capacity=10, @@ -153,8 +157,8 @@ def test_storage_charging(): storage = solph.components.GenericStorage( "storage", - inputs={bus: solph.Flow(nominal_value=2, variable_costs=-2)}, - outputs={bus: solph.Flow(nominal_value=0.1)}, + inputs={bus: solph.Flow(nominal_capacity=2, variable_costs=-2)}, + outputs={bus: solph.Flow(nominal_capacity=0.1)}, nominal_storage_capacity=19, initial_storage_level=0, balanced=False, @@ -188,8 +192,8 @@ def test_invest_content_uncoupled(): storage = solph.components.GenericStorage( "storage", - inputs={bus: solph.Flow(nominal_value=2, variable_costs=-2)}, - outputs={bus: solph.Flow(nominal_value=0.1)}, + inputs={bus: solph.Flow(nominal_capacity=2, variable_costs=-2)}, + outputs={bus: solph.Flow(nominal_capacity=0.1)}, nominal_storage_capacity=solph.Investment( ep_costs=0.1, ), @@ -228,8 +232,8 @@ def test_invest_content_minimum(): storage = solph.components.GenericStorage( "storage", - inputs={bus: solph.Flow(nominal_value=2, variable_costs=-2)}, - outputs={bus: solph.Flow(nominal_value=0.1, variable_costs=0.1)}, + inputs={bus: solph.Flow(nominal_capacity=2, variable_costs=-2)}, + outputs={bus: solph.Flow(nominal_capacity=0.1, variable_costs=0.1)}, nominal_storage_capacity=solph.Investment( ep_costs=0.1, minimum=32, @@ -269,8 +273,8 @@ def test_invest_content_minimum_nonconvex(): storage = solph.components.GenericStorage( "storage", - inputs={bus: solph.Flow(nominal_value=2, variable_costs=0.1)}, - outputs={bus: solph.Flow(nominal_value=0.1, variable_costs=0.1)}, + inputs={bus: solph.Flow(nominal_capacity=2, variable_costs=0.1)}, + outputs={bus: solph.Flow(nominal_capacity=0.1, variable_costs=0.1)}, nominal_storage_capacity=solph.Investment( ep_costs=0.1, minimum=32, @@ -312,11 +316,11 @@ def test_invest_content_maximum(): "storage", inputs={ bus: solph.Flow( - nominal_value=2, + nominal_capacity=2, variable_costs=[-2 + i * 0.01 for i in range(0, 11)], ) }, - outputs={bus: solph.Flow(nominal_value=0.1, variable_costs=0.1)}, + outputs={bus: solph.Flow(nominal_capacity=0.1, variable_costs=0.1)}, nominal_storage_capacity=solph.Investment( ep_costs=0.1, maximum=10, diff --git a/tests/test_constraints/test_constraints_module.py b/tests/test_constraints/test_constraints_module.py index 6a36b7049..30283a526 100644 --- a/tests/test_constraints/test_constraints_module.py +++ b/tests/test_constraints/test_constraints_module.py @@ -26,7 +26,7 @@ def test_integral_limit(): ) bel = solph.buses.Bus(label="electricityBus", balanced=False) flow1 = solph.flows.Flow( - nominal_value=100, + nominal_capacity=100, custom_attributes={ "my_factor": integral_weight1, "emission_factor": emission_factor_low, @@ -34,11 +34,11 @@ def test_integral_limit(): variable_costs=-1, ) flow2 = solph.flows.Flow( - nominal_value=50, + nominal_capacity=50, variable_costs=-0.5, ) flow3 = solph.flows.Flow( - nominal_value=100, + nominal_capacity=100, custom_attributes={ "my_factor": integral_weight3, "emission_factor": emission_factor_low, @@ -46,7 +46,7 @@ def test_integral_limit(): variable_costs=-0.5, ) flow4 = solph.flows.Flow( - nominal_value=500, + nominal_capacity=500, custom_attributes={ "emission_factor": emission_factor_high, }, diff --git a/tests/test_constraints/test_equate_flows.py b/tests/test_constraints/test_equate_flows.py index 33d76e2a0..7dc5c3e7b 100644 --- a/tests/test_constraints/test_equate_flows.py +++ b/tests/test_constraints/test_equate_flows.py @@ -28,7 +28,7 @@ def test_equate_flows(): b1: solph.Flow( variable_costs=-0.5, max=[0.5, 1], - nominal_value=4, + nominal_capacity=4, custom_attributes={"keyword1": "group 1"}, ) }, @@ -38,7 +38,7 @@ def test_equate_flows(): inputs={ b1: solph.Flow( variable_costs=0.1, - nominal_value=2, + nominal_capacity=2, custom_attributes={"keyword2": "group 2"}, ) }, @@ -48,7 +48,7 @@ def test_equate_flows(): inputs={ b1: solph.Flow( variable_costs=0.2, - nominal_value=3, + nominal_capacity=3, custom_attributes={"keyword2": "group 2"}, ) }, @@ -58,7 +58,7 @@ def test_equate_flows(): inputs={ b1: solph.Flow( variable_costs=0.2, - nominal_value=3, + nominal_capacity=3, custom_attributes={"keyword3": "no group"}, ) }, diff --git a/tests/test_constraints/test_flow_count_limit.py b/tests/test_constraints/test_flow_count_limit.py index 9b53300c6..89e6678e2 100644 --- a/tests/test_constraints/test_flow_count_limit.py +++ b/tests/test_constraints/test_flow_count_limit.py @@ -27,7 +27,7 @@ def test_flow_count_limit(): inputs={ b1: solph.Flow( variable_costs=[-0.5, 0.5], - nominal_value=4, + nominal_capacity=4, min=0.5, nonconvex=solph.NonConvex(), custom_attributes={"keyword1": "group 1"}, @@ -39,7 +39,7 @@ def test_flow_count_limit(): inputs={ b1: solph.Flow( variable_costs=[-0.2, 0.2], - nominal_value=2, + nominal_capacity=2, min=0.5, nonconvex=solph.NonConvex(), custom_attributes={"keyword1": "also group 1"}, @@ -51,7 +51,7 @@ def test_flow_count_limit(): inputs={ b1: solph.Flow( variable_costs=[-0.1, 0.1], - nominal_value=3, + nominal_capacity=3, min=0.5, nonconvex=solph.NonConvex(), custom_attributes={"keyword1": "still group 1"}, @@ -63,7 +63,7 @@ def test_flow_count_limit(): inputs={ b1: solph.Flow( variable_costs=[-0.1, 0.2], - nominal_value=3, + nominal_capacity=3, min=0.5, nonconvex=solph.NonConvex(), custom_attributes={"keyword2": "not in group 1"}, diff --git a/tests/test_constraints/test_storage_level.py b/tests/test_constraints/test_storage_level.py index 325b2e8ff..e55f7a7ed 100644 --- a/tests/test_constraints/test_storage_level.py +++ b/tests/test_constraints/test_storage_level.py @@ -32,28 +32,34 @@ def test_storage_level_constraint(): in_100 = solph.components.Source( label="in_100", - outputs={multiplexer: solph.Flow(nominal_value=5, variable_costs=0.1)}, + outputs={ + multiplexer: solph.Flow(nominal_capacity=5, variable_costs=0.1) + }, ) in_050 = solph.components.Source( label="in_050", - outputs={multiplexer: solph.Flow(nominal_value=5, variable_costs=0.1)}, + outputs={ + multiplexer: solph.Flow(nominal_capacity=5, variable_costs=0.1) + }, ) in_000 = solph.components.Source( label="in_000", - outputs={multiplexer: solph.Flow(nominal_value=5, variable_costs=0.1)}, + outputs={ + multiplexer: solph.Flow(nominal_capacity=5, variable_costs=0.1) + }, ) out_000 = solph.components.Sink( label="out_000", - inputs={multiplexer: solph.Flow(nominal_value=5)}, + inputs={multiplexer: solph.Flow(nominal_capacity=5)}, ) out_050 = solph.components.Sink( label="out_050", - inputs={multiplexer: solph.Flow(nominal_value=5)}, + inputs={multiplexer: solph.Flow(nominal_capacity=5)}, ) out_100 = solph.components.Sink( label="out_100", - inputs={multiplexer: solph.Flow(nominal_value=5)}, + inputs={multiplexer: solph.Flow(nominal_capacity=5)}, ) es.add(in_000, in_050, in_100, out_000, out_050, out_100) diff --git a/tests/test_flows/test_flow_class.py b/tests/test_flows/test_flow_class.py index 4ddcda1fb..cf5805d23 100644 --- a/tests/test_flows/test_flow_class.py +++ b/tests/test_flows/test_flow_class.py @@ -36,7 +36,7 @@ def test_summed_min_future_warning(): def test_source_with_full_load_time_max(): - Flow(nominal_value=1, full_load_time_max=2) + Flow(nominal_capacity=1, full_load_time_max=2) def test_nonconvex_positive_gradient_error(): @@ -74,7 +74,7 @@ def test_non_convex_negative_gradient_error(): def test_fix_sequence(): - flow = Flow(nominal_value=4, fix=[0.3, 0.2, 0.7]) + flow = Flow(nominal_capacity=4, fix=[0.3, 0.2, 0.7]) assert flow.fix[0] == 0.3 assert flow.fix[1] == 0.2 diff --git a/tests/test_flows/test_non_convex_flow.py b/tests/test_flows/test_non_convex_flow.py index d5960a898..1f8198e9d 100644 --- a/tests/test_flows/test_non_convex_flow.py +++ b/tests/test_flows/test_non_convex_flow.py @@ -16,7 +16,7 @@ def test_initial_status_off(): # negative costs but turned off initially flow = solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, nonconvex=solph.NonConvex(initial_status=0, minimum_downtime=5), variable_costs=-1, ) @@ -27,7 +27,7 @@ def test_initial_status_off(): def test_maximum_shutdowns(): flow = solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, min=0.5, nonconvex=solph.NonConvex(maximum_shutdowns=1), variable_costs=[1, -2, 1, 1, 1, -5, 1, 1, 1, -2], @@ -39,7 +39,7 @@ def test_maximum_shutdowns(): def test_maximum_startups(): flow = solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, min=0.5, nonconvex=solph.NonConvex(maximum_startups=1), variable_costs=[1, -4, 1, 1, 1, -5, 1, 1, 5, -3], @@ -52,7 +52,7 @@ def test_maximum_startups(): def test_initial_status_on(): # positive costs but turned on initially flow = solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, min=0.5, nonconvex=solph.NonConvex(initial_status=1, minimum_uptime=3), variable_costs=1, @@ -65,7 +65,7 @@ def test_initial_status_on(): def test_activity_costs(): # activity costs higher then revenue for first time steps flow = solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, min=0.1, max=[0.1] + [i * 0.1 for i in range(1, 10)], nonconvex=solph.NonConvex(activity_costs=9 * [1] + [10]), @@ -79,7 +79,7 @@ def test_activity_costs(): def test_inactivity_costs(): # inactivity costs lower then running costs for middle time steps flow = solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, min=[i * 0.1 for i in range(10)], nonconvex=solph.NonConvex(inactivity_costs=9 * [1] + [10]), variable_costs=0.45, @@ -94,7 +94,7 @@ def test_startup_costs_start_off(): # startup costs higher then effect of shutting down flow = solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, min=0.1, nonconvex=solph.NonConvex(startup_costs=5, initial_status=0), variable_costs=price_pattern, @@ -109,7 +109,7 @@ def test_startup_costs_start_on(): # startup costs higher then effect of shutting down flow = solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, min=0.1, nonconvex=solph.NonConvex(startup_costs=5, initial_status=1), variable_costs=price_pattern, @@ -124,7 +124,7 @@ def test_shutdown_costs_start_on(): # shutdown costs higher then effect of shutting down flow = solph.flows.Flow( - nominal_value=10, + nominal_capacity=10, min=0.1, nonconvex=solph.NonConvex(shutdown_costs=5, initial_status=1), variable_costs=price_pattern, diff --git a/tests/test_flows/test_simple_flow.py b/tests/test_flows/test_simple_flow.py index 8dca29043..4bc0c4b36 100644 --- a/tests/test_flows/test_simple_flow.py +++ b/tests/test_flows/test_simple_flow.py @@ -19,7 +19,7 @@ def test_gradient_limit(): price_pattern = [8] + 8 * [-1] + [8] flow = solph.flows.Flow( - nominal_value=2, + nominal_capacity=2, variable_costs=price_pattern, positive_gradient_limit=0.4, negative_gradient_limit=0.25, @@ -35,7 +35,7 @@ def test_full_load_time_max(): price_pattern = [-i for i in range(11)] flow = solph.flows.Flow( - nominal_value=2, + nominal_capacity=2, variable_costs=price_pattern, full_load_time_max=4.5, ) @@ -48,7 +48,7 @@ def test_full_load_time_min(): price_pattern = [i for i in range(11)] flow = solph.flows.Flow( - nominal_value=2, + nominal_capacity=2, variable_costs=price_pattern, full_load_time_min=4.5, ) diff --git a/tests/test_grouping.py b/tests/test_grouping.py index c9f0c450d..fb074aebc 100644 --- a/tests/test_grouping.py +++ b/tests/test_grouping.py @@ -41,7 +41,7 @@ def test_investment_flow_grouping(self): label="Source", outputs={ b: solph.flows.Flow( - fix=[12, 16, 14], nominal_value=1000000 + fix=[12, 16, 14], nominal_capacity=1000000 ) }, ) @@ -55,7 +55,9 @@ def test_investment_flow_grouping(self): full_load_time_max=2.3, variable_costs=25, max=0.8, - nominal_value=Investment(ep_costs=500, maximum=10e5), + nominal_capacity=Investment( + ep_costs=500, maximum=10e5 + ), ) }, ) diff --git a/tests/test_models.py b/tests/test_models.py index e5c51f9bd..feb982132 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -23,12 +23,14 @@ def test_infeasible_model(): es.add(bel) es.add( solph.components.Sink( - inputs={bel: solph.flows.Flow(nominal_value=5, fix=[1])} + inputs={bel: solph.flows.Flow(nominal_capacity=5, fix=[1])} ) ) es.add( solph.components.Source( - outputs={bel: solph.flows.Flow(nominal_value=4, variable_costs=5)} + outputs={ + bel: solph.flows.Flow(nominal_capacity=4, variable_costs=5) + } ) ) m = solph.Model(es) @@ -60,7 +62,7 @@ def test_multi_period_default_discount_rate(): label="sink", inputs={ bel: solph.flows.Flow( - nominal_value=5, fix=[1] * len(timeindex) + nominal_capacity=5, fix=[1] * len(timeindex) ) }, ) @@ -68,7 +70,9 @@ def test_multi_period_default_discount_rate(): es.add( solph.components.Source( label="source", - outputs={bel: solph.flows.Flow(nominal_value=4, variable_costs=5)}, + outputs={ + bel: solph.flows.Flow(nominal_capacity=4, variable_costs=5) + }, ) ) msg = ( diff --git a/tests/test_non_equidistant_time_index.py b/tests/test_non_equidistant_time_index.py index 1b68df738..24aed8d14 100644 --- a/tests/test_non_equidistant_time_index.py +++ b/tests/test_non_equidistant_time_index.py @@ -40,7 +40,7 @@ def setup_class(cls): inputs={b_diesel: flows.Flow(variable_costs=2)}, outputs={ b_el1: flows.Flow( - variable_costs=1, nominal_value=Investment(ep_costs=500) + variable_costs=1, nominal_capacity=Investment(ep_costs=500) ) }, conversion_factors={b_el1: 0.5}, @@ -64,7 +64,7 @@ def setup_class(cls): label="demand_el", inputs={ b_el1: flows.Flow( - nominal_value=1, + nominal_capacity=1, fix=demand_values, ) }, diff --git a/tests/test_options.py b/tests/test_options.py index 2b26b9d2f..b33baed83 100644 --- a/tests/test_options.py +++ b/tests/test_options.py @@ -16,4 +16,4 @@ def test_check_age_and_lifetime(): """Check error being thrown if age > lifetime""" msg = "A unit's age must be smaller than its expected lifetime." with pytest.raises(AttributeError, match=msg): - solph.Flow(nominal_value=solph.Investment(age=41, lifetime=40)) + solph.Flow(nominal_capacity=solph.Investment(age=41, lifetime=40)) diff --git a/tests/test_outputlib/__init__.py b/tests/test_outputlib/__init__.py index 5e86927e3..b717b21e2 100644 --- a/tests/test_outputlib/__init__.py +++ b/tests/test_outputlib/__init__.py @@ -33,7 +33,7 @@ outputs={ bel: Flow( fix=data["wind"], - nominal_value=66.3, + nominal_capacity=66.3, ) }, ) @@ -43,7 +43,7 @@ outputs={ bel: Flow( fix=data["pv"], - nominal_value=65.3, + nominal_capacity=65.3, ) }, ) @@ -53,7 +53,7 @@ label="demand_elec", inputs={ bel: Flow( - nominal_value=85, + nominal_capacity=85, fix=data["demand_el"], ) }, @@ -63,7 +63,7 @@ label="demand_therm", inputs={ bth: Flow( - nominal_value=40, + nominal_capacity=40, fix=data["demand_th"], ) }, @@ -73,28 +73,28 @@ pp_coal = Converter( label="pp_coal", inputs={bcoal: Flow()}, - outputs={bel: Flow(nominal_value=20.2, variable_costs=25)}, + outputs={bel: Flow(nominal_capacity=20.2, variable_costs=25)}, conversion_factors={bel: 0.39}, ) pp_lig = Converter( label="pp_lig", inputs={blig: Flow()}, - outputs={bel: Flow(nominal_value=11.8, variable_costs=19)}, + outputs={bel: Flow(nominal_capacity=11.8, variable_costs=19)}, conversion_factors={bel: 0.41}, ) pp_gas = Converter( label="pp_gas", inputs={bgas: Flow()}, - outputs={bel: Flow(nominal_value=41, variable_costs=40)}, + outputs={bel: Flow(nominal_capacity=41, variable_costs=40)}, conversion_factors={bel: 0.50}, ) pp_oil = Converter( label="pp_oil", inputs={boil: Flow()}, - outputs={bel: Flow(nominal_value=5, variable_costs=50)}, + outputs={bel: Flow(nominal_capacity=5, variable_costs=50)}, conversion_factors={bel: 0.28}, ) @@ -103,8 +103,8 @@ label="pp_chp", inputs={bgas: Flow()}, outputs={ - bel: Flow(nominal_value=30, variable_costs=42), - bth: Flow(nominal_value=40), + bel: Flow(nominal_capacity=30, variable_costs=42), + bth: Flow(nominal_capacity=40), }, conversion_factors={bel: 0.3, bth: 0.4}, ) @@ -118,7 +118,7 @@ heat_pump = Converter( label="heat_pump", inputs={bel: Flow(), b_heat_source: Flow()}, - outputs={bth: Flow(nominal_value=10)}, + outputs={bth: Flow(nominal_capacity=10)}, conversion_factors={bel: 1 / 3, b_heat_source: (cop - 1) / cop}, ) diff --git a/tests/test_processing.py b/tests/test_processing.py index c7b93c900..e563fece7 100644 --- a/tests/test_processing.py +++ b/tests/test_processing.py @@ -51,7 +51,7 @@ def setup_class(cls): inputs={b_diesel: Flow(variable_costs=2)}, outputs={ b_el1: Flow( - variable_costs=1, nominal_value=Investment(ep_costs=0.5) + variable_costs=1, nominal_capacity=Investment(ep_costs=0.5) ) }, conversion_factors={b_el1: 2}, @@ -75,7 +75,7 @@ def setup_class(cls): label="demand_el", inputs={ b_el2: Flow( - nominal_value=1, + nominal_capacity=1, fix=cls.demand_values, ) }, diff --git a/tests/test_scripts/test_solph/test_connect_invest/test_connect_invest.py b/tests/test_scripts/test_solph/test_connect_invest/test_connect_invest.py index a409177fb..7af2cab04 100644 --- a/tests/test_scripts/test_solph/test_connect_invest/test_connect_invest.py +++ b/tests/test_scripts/test_solph/test_connect_invest/test_connect_invest.py @@ -57,7 +57,7 @@ def test_connect_invest(): es.add( components.Source( label="wind", - outputs={bel1: Flow(fix=data["wind"], nominal_value=1000000)}, + outputs={bel1: Flow(fix=data["wind"], nominal_capacity=1000000)}, ) ) @@ -65,7 +65,7 @@ def test_connect_invest(): es.add( components.Sink( label="demand", - inputs={bel1: Flow(fix=data["demand_el"], nominal_value=1)}, + inputs={bel1: Flow(fix=data["demand_el"], nominal_capacity=1)}, ) ) @@ -86,14 +86,14 @@ def test_connect_invest(): line12 = components.Converter( label="line12", inputs={bel1: Flow()}, - outputs={bel2: Flow(nominal_value=Investment(ep_costs=20))}, + outputs={bel2: Flow(nominal_capacity=Investment(ep_costs=20))}, ) es.add(line12) line21 = components.Converter( label="line21", inputs={bel2: Flow()}, - outputs={bel1: Flow(nominal_value=Investment(ep_costs=20))}, + outputs={bel1: Flow(nominal_capacity=Investment(ep_costs=20))}, ) es.add(line21) diff --git a/tests/test_scripts/test_solph/test_flexible_modelling/test_add_constraints.py b/tests/test_scripts/test_solph/test_flexible_modelling/test_add_constraints.py index 01a63e426..00868963d 100644 --- a/tests/test_scripts/test_solph/test_flexible_modelling/test_add_constraints.py +++ b/tests/test_scripts/test_solph/test_flexible_modelling/test_add_constraints.py @@ -45,13 +45,13 @@ def test_add_constraints_example(solver="cbc", nologg=False): es.add( components.Sink( label="Sink", - inputs={b_el: Flow(nominal_value=40, fix=[0.5, 0.4, 0.3, 1])}, + inputs={b_el: Flow(nominal_capacity=40, fix=[0.5, 0.4, 0.3, 1])}, ) ) pp_oil = components.Converter( label="pp_oil", inputs={boil: Flow()}, - outputs={b_el: Flow(nominal_value=50, variable_costs=25)}, + outputs={b_el: Flow(nominal_capacity=50, variable_costs=25)}, conversion_factors={b_el: 0.39}, ) @@ -60,7 +60,7 @@ def test_add_constraints_example(solver="cbc", nologg=False): components.Converter( label="pp_lig", inputs={blig: Flow()}, - outputs={b_el: Flow(nominal_value=50, variable_costs=10)}, + outputs={b_el: Flow(nominal_capacity=50, variable_costs=10)}, conversion_factors={b_el: 0.41}, ) ) diff --git a/tests/test_scripts/test_solph/test_generic_chp/test_generic_chp.py b/tests/test_scripts/test_solph/test_generic_chp/test_generic_chp.py index 6c9f8c423..e7b557428 100644 --- a/tests/test_scripts/test_solph/test_generic_chp/test_generic_chp.py +++ b/tests/test_scripts/test_solph/test_generic_chp/test_generic_chp.py @@ -59,7 +59,9 @@ def test_gen_chp(): solph.components.Sink( label="demand_th", inputs={ - bth: solph.flows.Flow(fix=data["demand_th"], nominal_value=200) + bth: solph.flows.Flow( + fix=data["demand_th"], nominal_capacity=200 + ) }, ) ) diff --git a/tests/test_scripts/test_solph/test_invest_fix_flow/test_simple_invest_fixed.py b/tests/test_scripts/test_solph/test_invest_fix_flow/test_simple_invest_fixed.py index 1a025b9a6..2a90f4e1d 100644 --- a/tests/test_scripts/test_solph/test_invest_fix_flow/test_simple_invest_fixed.py +++ b/tests/test_scripts/test_solph/test_invest_fix_flow/test_simple_invest_fixed.py @@ -50,14 +50,16 @@ def test_dispatch_fix_example(solver="cbc", periods=10): pv = Source( label="pv", outputs={ - bel: Flow(fix=data["pv"], nominal_value=Investment(ep_costs=ep_pv)) + bel: Flow( + fix=data["pv"], nominal_capacity=Investment(ep_costs=ep_pv) + ) }, ) # demands (electricity/heat) demand_el = Sink( label="demand_elec", - inputs={bel: Flow(nominal_value=85, fix=data["demand_el"])}, + inputs={bel: Flow(nominal_capacity=85, fix=data["demand_el"])}, ) datetimeindex = pd.date_range("1/1/2012", periods=periods, freq="h") diff --git a/tests/test_scripts/test_solph/test_lopf/test_lopf.py b/tests/test_scripts/test_solph/test_lopf/test_lopf.py index e831734a4..1a6246697 100644 --- a/tests/test_scripts/test_solph/test_lopf/test_lopf.py +++ b/tests/test_scripts/test_solph/test_lopf/test_lopf.py @@ -55,7 +55,7 @@ def test_lopf(solver="cbc"): input=b_el0, output=b_el1, reactance=0.0001, - nominal_value=Investment(ep_costs=10), + nominal_capacity=Investment(ep_costs=10), min=-1, max=1, ) @@ -64,7 +64,7 @@ def test_lopf(solver="cbc"): input=b_el1, output=b_el2, reactance=0.0001, - nominal_value=60, + nominal_capacity=60, min=-1, max=1, ) @@ -73,7 +73,7 @@ def test_lopf(solver="cbc"): input=b_el2, output=b_el0, reactance=0.0001, - nominal_value=60, + nominal_capacity=60, min=-1, max=1, ) @@ -81,21 +81,21 @@ def test_lopf(solver="cbc"): es.add( Source( label="gen_0", - outputs={b_el0: Flow(nominal_value=100, variable_costs=50)}, + outputs={b_el0: Flow(nominal_capacity=100, variable_costs=50)}, ) ) es.add( Source( label="gen_1", - outputs={b_el1: Flow(nominal_value=100, variable_costs=25)}, + outputs={b_el1: Flow(nominal_capacity=100, variable_costs=25)}, ) ) es.add( Sink( label="load", - inputs={b_el2: Flow(nominal_value=100, fix=1)}, + inputs={b_el2: Flow(nominal_capacity=100, fix=1)}, ) ) diff --git a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_dispatch_model.py b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_dispatch_model.py index c61952720..3e391938a 100644 --- a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_dispatch_model.py +++ b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_dispatch_model.py @@ -83,13 +83,15 @@ def test_multi_period_dispatch_model(solver="cbc"): bus_el: flows.Flow( variable_costs=0, fix=[110] + [90] * (len(timeindex) - 1), - nominal_value=1, + nominal_capacity=1, ) }, ) source_shortage = components.Source( label="DE_source_shortage", - outputs={bus_el: flows.Flow(variable_costs=1e10, nominal_value=1e10)}, + outputs={ + bus_el: flows.Flow(variable_costs=1e10, nominal_capacity=1e10) + }, ) source_wind_fr = components.Source( label="FR_source_wind", @@ -97,14 +99,14 @@ def test_multi_period_dispatch_model(solver="cbc"): bus_el_fr: flows.Flow( variable_costs=0, fix=[45] * len(timeindex), - nominal_value=1, + nominal_capacity=1, ) }, ) source_shortage_fr = components.Source( label="FR_source_shortage", outputs={ - bus_el_fr: flows.Flow(variable_costs=1e10, nominal_value=1e10) + bus_el_fr: flows.Flow(variable_costs=1e10, nominal_capacity=1e10) }, ) @@ -112,36 +114,42 @@ def test_multi_period_dispatch_model(solver="cbc"): sink_el = components.Sink( label="DE_sink_el", inputs={ - bus_el: flows.Flow(fix=[80] * len(timeindex), nominal_value=1) + bus_el: flows.Flow(fix=[80] * len(timeindex), nominal_capacity=1) }, ) sink_excess = components.Sink( label="DE_sink_excess", - inputs={bus_el: flows.Flow(variable_costs=1e10, nominal_value=1e10)}, + inputs={ + bus_el: flows.Flow(variable_costs=1e10, nominal_capacity=1e10) + }, ) sink_el_fr = components.Sink( label="FR_sink_el", inputs={ - bus_el_fr: flows.Flow(fix=[50] * len(timeindex), nominal_value=1) + bus_el_fr: flows.Flow( + fix=[50] * len(timeindex), nominal_capacity=1 + ) }, ) sink_excess_fr = components.Sink( label="FR_sink_excess", - inputs={bus_el_fr: flows.Flow(variable_costs=1e3, nominal_value=1e10)}, + inputs={ + bus_el_fr: flows.Flow(variable_costs=1e3, nominal_capacity=1e10) + }, ) # Create converters pp_lignite = components.Converter( label="DE_pp_lignite", inputs={bus_lignite: flows.Flow()}, - outputs={bus_el: flows.Flow(nominal_value=100, variable_costs=1)}, + outputs={bus_el: flows.Flow(nominal_capacity=100, variable_costs=1)}, conversion_factors={bus_el: 0.38}, ) pp_hardcoal = components.Converter( label="DE_pp_hardcoal", inputs={bus_hardcoal: flows.Flow()}, - outputs={bus_el: flows.Flow(nominal_value=100, variable_costs=2)}, + outputs={bus_el: flows.Flow(nominal_capacity=100, variable_costs=2)}, conversion_factors={bus_el: 0.45}, ) @@ -150,7 +158,7 @@ def test_multi_period_dispatch_model(solver="cbc"): inputs={bus_natgas: flows.Flow()}, outputs={ bus_el: flows.Flow( - nominal_value=100, + nominal_capacity=100, variable_costs=3, ) }, @@ -162,7 +170,7 @@ def test_multi_period_dispatch_model(solver="cbc"): inputs={bus_natgas: flows.Flow()}, outputs={ bus_el: flows.Flow( - nominal_value=100, + nominal_capacity=100, variable_costs=4, ) }, @@ -171,9 +179,11 @@ def test_multi_period_dispatch_model(solver="cbc"): storage_el = components.GenericStorage( label="DE_storage_el", - inputs={bus_el: flows.Flow(nominal_value=20, variable_costs=0, max=1)}, + inputs={ + bus_el: flows.Flow(nominal_capacity=20, variable_costs=0, max=1) + }, outputs={ - bus_el: flows.Flow(nominal_value=20, variable_costs=0, max=1) + bus_el: flows.Flow(nominal_capacity=20, variable_costs=0, max=1) }, nominal_storage_capacity=20, loss_rate=0, @@ -189,8 +199,8 @@ def test_multi_period_dispatch_model(solver="cbc"): link_de_fr = components.Link( label="link_DE_FR", inputs={ - bus_el: flows.Flow(nominal_value=10), - bus_el_fr: flows.Flow(nominal_value=10), + bus_el: flows.Flow(nominal_capacity=10), + bus_el_fr: flows.Flow(nominal_capacity=10), }, outputs={ bus_el_fr: flows.Flow(), diff --git a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py index 43c45834b..fcaf31c93 100644 --- a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py +++ b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py @@ -86,14 +86,14 @@ def test_multi_period_investment_model(solver="cbc"): bus_el: flows.Flow( variable_costs=0, fix=[110] + [90] * (len(timeindex) - 1), - nominal_value=1, + nominal_capacity=1, ) }, ) source_shortage = components.Source( label="DE_source_shortage", outputs={ - bus_el: flows.Flow(variable_costs=1e10, nominal_value=1e10) + bus_el: flows.Flow(variable_costs=1e10, nominal_capacity=1e10) }, ) source_wind_FR = components.Source( @@ -102,14 +102,16 @@ def test_multi_period_investment_model(solver="cbc"): bus_el_FR: flows.Flow( variable_costs=0, fix=[45] * len(timeindex), - nominal_value=1, + nominal_capacity=1, ) }, ) source_shortage_FR = components.Source( label="FR_source_shortage", outputs={ - bus_el_FR: flows.Flow(variable_costs=1e10, nominal_value=1e10) + bus_el_FR: flows.Flow( + variable_costs=1e10, nominal_capacity=1e10 + ) }, ) @@ -117,27 +119,31 @@ def test_multi_period_investment_model(solver="cbc"): sink_el = components.Sink( label="DE_sink_el", inputs={ - bus_el: flows.Flow(fix=[80] * len(timeindex), nominal_value=1) + bus_el: flows.Flow( + fix=[80] * len(timeindex), nominal_capacity=1 + ) }, ) sink_excess = components.Sink( label="DE_sink_excess", inputs={ - bus_el: flows.Flow(variable_costs=1e10, nominal_value=1e10) + bus_el: flows.Flow(variable_costs=1e10, nominal_capacity=1e10) }, ) sink_el_FR = components.Sink( label="FR_sink_el", inputs={ bus_el_FR: flows.Flow( - fix=[50] * len(timeindex), nominal_value=1 + fix=[50] * len(timeindex), nominal_capacity=1 ) }, ) sink_excess_FR = components.Sink( label="FR_sink_excess", inputs={ - bus_el_FR: flows.Flow(variable_costs=1e3, nominal_value=1e10) + bus_el_FR: flows.Flow( + variable_costs=1e3, nominal_capacity=1e10 + ) }, ) @@ -147,7 +153,7 @@ def test_multi_period_investment_model(solver="cbc"): inputs={bus_lignite: flows.Flow()}, outputs={ bus_el: flows.Flow( - nominal_value=_options.Investment( + nominal_capacity=_options.Investment( maximum=1000, ep_costs=2e6, existing=0, @@ -166,7 +172,7 @@ def test_multi_period_investment_model(solver="cbc"): inputs={bus_hardcoal: flows.Flow()}, # )}, outputs={ bus_el: flows.Flow( - nominal_value=_options.Investment( + nominal_capacity=_options.Investment( maximum=1000, ep_costs=1.6e6, existing=0, @@ -185,7 +191,7 @@ def test_multi_period_investment_model(solver="cbc"): inputs={bus_natgas: flows.Flow()}, # )}, outputs={ bus_el: flows.Flow( - nominal_value=_options.Investment( + nominal_capacity=_options.Investment( maximum=1000, ep_costs=1e6, existing=0, @@ -204,7 +210,7 @@ def test_multi_period_investment_model(solver="cbc"): inputs={bus_natgas: flows.Flow()}, # )}, outputs={ bus_el: flows.Flow( - nominal_value=_options.Investment( + nominal_capacity=_options.Investment( maximum=1000, ep_costs=[0.6e6, 0.5e6, 0.8e6, 0.4e6], existing=0, @@ -225,7 +231,7 @@ def test_multi_period_investment_model(solver="cbc"): bus_el: flows.Flow( variable_costs=0, max=1, - nominal_value=_options.Investment( + nominal_capacity=_options.Investment( maximum=20, ep_costs=1000, existing=10, @@ -239,7 +245,7 @@ def test_multi_period_investment_model(solver="cbc"): bus_el: flows.Flow( variable_costs=0, max=1, - nominal_value=_options.Investment( + nominal_capacity=_options.Investment( maximum=20, ep_costs=1000, existing=10, @@ -274,10 +280,10 @@ def test_multi_period_investment_model(solver="cbc"): label="link_DE_FR", inputs={ bus_el: flows.Flow( - nominal_value=10, + nominal_capacity=10, ), bus_el_FR: flows.Flow( - nominal_value=10, + nominal_capacity=10, ), }, outputs={bus_el_FR: flows.Flow(), bus_el: flows.Flow()}, diff --git a/tests/test_scripts/test_solph/test_piecewiselineartransformer/test_piecewiselineartransformer.py b/tests/test_scripts/test_solph/test_piecewiselineartransformer/test_piecewiselineartransformer.py index 64823a6b9..b3bf89a77 100644 --- a/tests/test_scripts/test_solph/test_piecewiselineartransformer/test_piecewiselineartransformer.py +++ b/tests/test_scripts/test_solph/test_piecewiselineartransformer/test_piecewiselineartransformer.py @@ -38,7 +38,7 @@ def test_pwltf(): b_el = Bus(label="electricity") demand_el = Sink( label="demand", - inputs={b_el: Flow(nominal_value=1, fix=demand)}, + inputs={b_el: Flow(nominal_capacity=1, fix=demand)}, ) energysystem.add(b_gas, b_el, demand_el) @@ -52,7 +52,9 @@ def conv_func(x): # Create and add PiecewiseLinearConverter pwltf = solph.components.experimental.PiecewiseLinearConverter( label="pwltf", - inputs={b_gas: solph.flows.Flow(nominal_value=100, variable_costs=1)}, + inputs={ + b_gas: solph.flows.Flow(nominal_capacity=100, variable_costs=1) + }, outputs={b_el: solph.flows.Flow()}, in_breakpoints=in_breakpoints, conversion_function=conv_func, diff --git a/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch.py b/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch.py index e8d12b264..7705fc4c3 100644 --- a/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch.py +++ b/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch.py @@ -54,50 +54,51 @@ def test_dispatch_example(solver="cbc", periods=24 * 5): # sources wind = Source( - label="wind", outputs={bel: Flow(fix=data["wind"], nominal_value=66.3)} + label="wind", + outputs={bel: Flow(fix=data["wind"], nominal_capacity=66.3)}, ) pv = Source( - label="pv", outputs={bel: Flow(fix=data["pv"], nominal_value=65.3)} + label="pv", outputs={bel: Flow(fix=data["pv"], nominal_capacity=65.3)} ) # demands (electricity/heat) demand_el = Sink( label="demand_elec", - inputs={bel: Flow(nominal_value=85, fix=data["demand_el"])}, + inputs={bel: Flow(nominal_capacity=85, fix=data["demand_el"])}, ) demand_th = Sink( label="demand_therm", - inputs={bth: Flow(nominal_value=40, fix=data["demand_th"])}, + inputs={bth: Flow(nominal_capacity=40, fix=data["demand_th"])}, ) # power plants pp_coal = Converter( label="pp_coal", inputs={bcoal: Flow()}, - outputs={bel: Flow(nominal_value=20.2, variable_costs=25)}, + outputs={bel: Flow(nominal_capacity=20.2, variable_costs=25)}, conversion_factors={bel: 0.39}, ) pp_lig = Converter( label="pp_lig", inputs={blig: Flow()}, - outputs={bel: Flow(nominal_value=11.8, variable_costs=19)}, + outputs={bel: Flow(nominal_capacity=11.8, variable_costs=19)}, conversion_factors={bel: 0.41}, ) pp_gas = Converter( label="pp_gas", inputs={bgas: Flow()}, - outputs={bel: Flow(nominal_value=41, variable_costs=40)}, + outputs={bel: Flow(nominal_capacity=41, variable_costs=40)}, conversion_factors={bel: 0.50}, ) pp_oil = Converter( label="pp_oil", inputs={boil: Flow()}, - outputs={bel: Flow(nominal_value=5, variable_costs=50)}, + outputs={bel: Flow(nominal_capacity=5, variable_costs=50)}, conversion_factors={bel: 0.28}, ) @@ -106,8 +107,8 @@ def test_dispatch_example(solver="cbc", periods=24 * 5): label="pp_chp", inputs={bgas: Flow()}, outputs={ - bel: Flow(nominal_value=30, variable_costs=42), - bth: Flow(nominal_value=40), + bel: Flow(nominal_capacity=30, variable_costs=42), + bth: Flow(nominal_capacity=40), }, conversion_factors={bel: 0.3, bth: 0.4}, ) @@ -121,7 +122,7 @@ def test_dispatch_example(solver="cbc", periods=24 * 5): heat_pump = Converter( label="heat_pump", inputs={bel: Flow(), b_heat_source: Flow()}, - outputs={bth: Flow(nominal_value=10)}, + outputs={bth: Flow(nominal_capacity=10)}, conversion_factors={bel: 1 / 3, b_heat_source: (cop - 1) / cop}, ) diff --git a/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch_one.py b/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch_one.py index 99a2f7478..2ba6aebbe 100644 --- a/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch_one.py +++ b/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch_one.py @@ -40,16 +40,16 @@ def test_dispatch_one_time_step(solver="cbc"): # sources wind = Source( - label="wind", outputs={bel: Flow(fix=0.5, nominal_value=66.3)} + label="wind", outputs={bel: Flow(fix=0.5, nominal_capacity=66.3)} ) # demands (electricity/heat) demand_el = Sink( - label="demand_elec", inputs={bel: Flow(nominal_value=85, fix=0.3)} + label="demand_elec", inputs={bel: Flow(nominal_capacity=85, fix=0.3)} ) demand_th = Sink( - label="demand_therm", inputs={bth: Flow(nominal_value=40, fix=0.2)} + label="demand_therm", inputs={bth: Flow(nominal_capacity=40, fix=0.2)} ) # combined heat and power plant (chp) @@ -57,8 +57,8 @@ def test_dispatch_one_time_step(solver="cbc"): label="pp_chp", inputs={bgas: Flow()}, outputs={ - bel: Flow(nominal_value=30, variable_costs=42), - bth: Flow(nominal_value=40), + bel: Flow(nominal_capacity=30, variable_costs=42), + bth: Flow(nominal_capacity=40), }, conversion_factors={bel: 0.3, bth: 0.4}, ) @@ -72,7 +72,7 @@ def test_dispatch_one_time_step(solver="cbc"): heat_pump = Converter( label="heat_pump", inputs={bel: Flow(), b_heat_source: Flow()}, - outputs={bth: Flow(nominal_value=10)}, + outputs={bth: Flow(nominal_capacity=10)}, conversion_factors={bel: 1 / 3, b_heat_source: (cop - 1) / cop}, ) diff --git a/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch_one_explicit_timemode.py b/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch_one_explicit_timemode.py index 99a2f7478..2ba6aebbe 100644 --- a/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch_one_explicit_timemode.py +++ b/tests/test_scripts/test_solph/test_simple_model/test_simple_dispatch_one_explicit_timemode.py @@ -40,16 +40,16 @@ def test_dispatch_one_time_step(solver="cbc"): # sources wind = Source( - label="wind", outputs={bel: Flow(fix=0.5, nominal_value=66.3)} + label="wind", outputs={bel: Flow(fix=0.5, nominal_capacity=66.3)} ) # demands (electricity/heat) demand_el = Sink( - label="demand_elec", inputs={bel: Flow(nominal_value=85, fix=0.3)} + label="demand_elec", inputs={bel: Flow(nominal_capacity=85, fix=0.3)} ) demand_th = Sink( - label="demand_therm", inputs={bth: Flow(nominal_value=40, fix=0.2)} + label="demand_therm", inputs={bth: Flow(nominal_capacity=40, fix=0.2)} ) # combined heat and power plant (chp) @@ -57,8 +57,8 @@ def test_dispatch_one_time_step(solver="cbc"): label="pp_chp", inputs={bgas: Flow()}, outputs={ - bel: Flow(nominal_value=30, variable_costs=42), - bth: Flow(nominal_value=40), + bel: Flow(nominal_capacity=30, variable_costs=42), + bth: Flow(nominal_capacity=40), }, conversion_factors={bel: 0.3, bth: 0.4}, ) @@ -72,7 +72,7 @@ def test_dispatch_one_time_step(solver="cbc"): heat_pump = Converter( label="heat_pump", inputs={bel: Flow(), b_heat_source: Flow()}, - outputs={bth: Flow(nominal_value=10)}, + outputs={bth: Flow(nominal_capacity=10)}, conversion_factors={bel: 1 / 3, b_heat_source: (cop - 1) / cop}, ) diff --git a/tests/test_scripts/test_solph/test_simple_model/test_simple_invest.py b/tests/test_scripts/test_solph/test_simple_model/test_simple_invest.py index 3634406f3..0d6e5d3b9 100644 --- a/tests/test_scripts/test_solph/test_simple_model/test_simple_invest.py +++ b/tests/test_scripts/test_solph/test_simple_model/test_simple_invest.py @@ -61,7 +61,7 @@ def test_dispatch_example(solver="cbc", periods=24 * 5): outputs={ bel: Flow( fix=data["wind"], - nominal_value=Investment(ep_costs=ep_wind, existing=100), + nominal_capacity=Investment(ep_costs=ep_wind, existing=100), ) }, ) @@ -72,7 +72,7 @@ def test_dispatch_example(solver="cbc", periods=24 * 5): outputs={ bel: Flow( fix=data["pv"], - nominal_value=Investment(ep_costs=ep_pv, existing=80), + nominal_capacity=Investment(ep_costs=ep_pv, existing=80), ) }, ) @@ -80,40 +80,40 @@ def test_dispatch_example(solver="cbc", periods=24 * 5): # demands (electricity/heat) demand_el = Sink( label="demand_elec", - inputs={bel: Flow(nominal_value=85, fix=data["demand_el"])}, + inputs={bel: Flow(nominal_capacity=85, fix=data["demand_el"])}, ) demand_th = Sink( label="demand_therm", - inputs={bth: Flow(nominal_value=40, fix=data["demand_th"])}, + inputs={bth: Flow(nominal_capacity=40, fix=data["demand_th"])}, ) # power plants pp_coal = Converter( label="pp_coal", inputs={bcoal: Flow()}, - outputs={bel: Flow(nominal_value=20.2, variable_costs=25)}, + outputs={bel: Flow(nominal_capacity=20.2, variable_costs=25)}, conversion_factors={bel: 0.39}, ) pp_lig = Converter( label="pp_lig", inputs={blig: Flow()}, - outputs={bel: Flow(nominal_value=11.8, variable_costs=19)}, + outputs={bel: Flow(nominal_capacity=11.8, variable_costs=19)}, conversion_factors={bel: 0.41}, ) pp_gas = Converter( label="pp_gas", inputs={bgas: Flow()}, - outputs={bel: Flow(nominal_value=41, variable_costs=40)}, + outputs={bel: Flow(nominal_capacity=41, variable_costs=40)}, conversion_factors={bel: 0.50}, ) pp_oil = Converter( label="pp_oil", inputs={boil: Flow()}, - outputs={bel: Flow(nominal_value=5, variable_costs=50)}, + outputs={bel: Flow(nominal_capacity=5, variable_costs=50)}, conversion_factors={bel: 0.28}, ) @@ -122,8 +122,8 @@ def test_dispatch_example(solver="cbc", periods=24 * 5): label="pp_chp", inputs={bgas: Flow()}, outputs={ - bel: Flow(nominal_value=30, variable_costs=42), - bth: Flow(nominal_value=40), + bel: Flow(nominal_capacity=30, variable_costs=42), + bth: Flow(nominal_capacity=40), }, conversion_factors={bel: 0.3, bth: 0.4}, ) @@ -137,7 +137,7 @@ def test_dispatch_example(solver="cbc", periods=24 * 5): heat_pump = Converter( label="el_heat_pump", inputs={bel: Flow(), b_heat_source: Flow()}, - outputs={bth: Flow(nominal_value=10)}, + outputs={bth: Flow(nominal_capacity=10)}, conversion_factors={bel: 1 / 3, b_heat_source: (cop - 1) / cop}, ) diff --git a/tests/test_scripts/test_solph/test_storage_investment/test_invest_storage_regression.py b/tests/test_scripts/test_solph/test_storage_investment/test_invest_storage_regression.py index b33f915e5..244556e1f 100644 --- a/tests/test_scripts/test_solph/test_storage_investment/test_invest_storage_regression.py +++ b/tests/test_scripts/test_solph/test_storage_investment/test_invest_storage_regression.py @@ -39,7 +39,7 @@ def test_regression_investment_storage(solver="cbc"): label="demand", inputs={ bel: solph.flows.Flow( - fix=[209643, 207497, 200108, 191892], nominal_value=1 + fix=[209643, 207497, 200108, 191892], nominal_capacity=1 ) }, ) @@ -57,7 +57,7 @@ def test_regression_investment_storage(solver="cbc"): solph.components.Converter( label="pp_gas", inputs={bgas: solph.flows.Flow()}, - outputs={bel: solph.flows.Flow(nominal_value=300000)}, + outputs={bel: solph.flows.Flow(nominal_capacity=300000)}, conversion_factors={bel: 0.58}, ) ) @@ -68,14 +68,14 @@ def test_regression_investment_storage(solver="cbc"): label="storage", inputs={ bel: solph.flows.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( existing=625046 / 6, maximum=0 ) ) }, outputs={ bel: solph.flows.Flow( - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( existing=104174.33, maximum=1 ) ) diff --git a/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py b/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py index 92232979b..478d7273d 100644 --- a/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py +++ b/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py @@ -80,7 +80,9 @@ def test_optimise_storage_size( solph.components.Sink( label="demand", inputs={ - bel: solph.flows.Flow(fix=data["demand_el"], nominal_value=1) + bel: solph.flows.Flow( + fix=data["demand_el"], nominal_capacity=1 + ) }, ) ) @@ -91,7 +93,8 @@ def test_optimise_storage_size( label="rgas", outputs={ bgas: solph.flows.Flow( - nominal_value=194397000 * 400 / 8760, full_load_time_max=1 + nominal_capacity=194397000 * 400 / 8760, + full_load_time_max=1, ) }, ) @@ -101,7 +104,9 @@ def test_optimise_storage_size( solph.components.Source( label="wind", outputs={ - bel: solph.flows.Flow(fix=data["wind"], nominal_value=1000000) + bel: solph.flows.Flow( + fix=data["wind"], nominal_capacity=1000000 + ) }, ) ) @@ -110,7 +115,7 @@ def test_optimise_storage_size( solph.components.Source( label="pv", outputs={ - bel: solph.flows.Flow(fix=data["pv"], nominal_value=582000) + bel: solph.flows.Flow(fix=data["pv"], nominal_capacity=582000) }, ) ) @@ -120,7 +125,7 @@ def test_optimise_storage_size( label="pp_gas", inputs={bgas: solph.flows.Flow()}, outputs={ - bel: solph.flows.Flow(nominal_value=10e10, variable_costs=50) + bel: solph.flows.Flow(nominal_capacity=10e10, variable_costs=50) }, conversion_factors={bel: 0.58}, ) diff --git a/tests/test_scripts/test_solph/test_storage_investment/test_storage_with_tuple_label.py b/tests/test_scripts/test_solph/test_storage_investment/test_storage_with_tuple_label.py index 7dea33903..3027f02fe 100644 --- a/tests/test_scripts/test_solph/test_storage_investment/test_storage_with_tuple_label.py +++ b/tests/test_scripts/test_solph/test_storage_investment/test_storage_with_tuple_label.py @@ -90,7 +90,9 @@ def test_tuples_as_labels_example( solph.components.Sink( label=Label("sink", "electricity", "demand"), inputs={ - bel: solph.flows.Flow(fix=data["demand_el"], nominal_value=1) + bel: solph.flows.Flow( + fix=data["demand_el"], nominal_capacity=1 + ) }, ) ) @@ -101,7 +103,8 @@ def test_tuples_as_labels_example( label=Label("source", "natural_gas", "commodity"), outputs={ bgas: solph.flows.Flow( - nominal_value=194397000 * 400 / 8760, full_load_time_max=1 + nominal_capacity=194397000 * 400 / 8760, + full_load_time_max=1, ) }, ) @@ -111,7 +114,9 @@ def test_tuples_as_labels_example( solph.components.Source( label=Label("renewable", "electricity", "wind"), outputs={ - bel: solph.flows.Flow(fix=data["wind"], nominal_value=1000000) + bel: solph.flows.Flow( + fix=data["wind"], nominal_capacity=1000000 + ) }, ) ) @@ -122,7 +127,7 @@ def test_tuples_as_labels_example( outputs={ bel: solph.flows.Flow( fix=data["pv"], - nominal_value=582000, + nominal_capacity=582000, ) }, ) @@ -134,7 +139,9 @@ def test_tuples_as_labels_example( label=Label("pp", "electricity", "natural_gas"), inputs={bgas: solph.flows.Flow()}, outputs={ - bel: solph.flows.Flow(nominal_value=10e10, variable_costs=50) + bel: solph.flows.Flow( + nominal_capacity=10e10, variable_costs=50 + ) }, conversion_factors={bel: 0.58}, ) diff --git a/tests/test_scripts/test_solph/test_variable_chp/test_variable_chp.py b/tests/test_scripts/test_solph/test_variable_chp/test_variable_chp.py index 4b790bd22..0f9f4c514 100644 --- a/tests/test_scripts/test_solph/test_variable_chp/test_variable_chp.py +++ b/tests/test_scripts/test_solph/test_variable_chp/test_variable_chp.py @@ -87,7 +87,9 @@ def test_variable_chp(filename="variable_chp.csv", solver="cbc"): solph.components.Sink( label=("demand", "elec1"), inputs={ - bel: solph.flows.Flow(fix=data["demand_el"], nominal_value=1) + bel: solph.flows.Flow( + fix=data["demand_el"], nominal_capacity=1 + ) }, ) ) @@ -95,7 +97,9 @@ def test_variable_chp(filename="variable_chp.csv", solver="cbc"): solph.components.Sink( label=("demand", "elec2"), inputs={ - bel2: solph.flows.Flow(fix=data["demand_el"], nominal_value=1) + bel2: solph.flows.Flow( + fix=data["demand_el"], nominal_capacity=1 + ) }, ) ) @@ -106,7 +110,7 @@ def test_variable_chp(filename="variable_chp.csv", solver="cbc"): label=("demand", "therm1"), inputs={ bth: solph.flows.Flow( - fix=data["demand_th"], nominal_value=741000 + fix=data["demand_th"], nominal_capacity=741000 ) }, ) @@ -116,7 +120,7 @@ def test_variable_chp(filename="variable_chp.csv", solver="cbc"): label=("demand", "therm2"), inputs={ bth2: solph.flows.Flow( - fix=data["demand_th"], nominal_value=741000 + fix=data["demand_th"], nominal_capacity=741000 ) }, ) @@ -126,7 +130,7 @@ def test_variable_chp(filename="variable_chp.csv", solver="cbc"): energysystem.add( solph.components.Converter( label=("fixed_chp", "gas"), - inputs={bgas: solph.flows.Flow(nominal_value=10e10)}, + inputs={bgas: solph.flows.Flow(nominal_capacity=10e10)}, outputs={bel2: solph.flows.Flow(), bth2: solph.flows.Flow()}, conversion_factors={bel2: 0.3, bth2: 0.5}, ) @@ -136,7 +140,7 @@ def test_variable_chp(filename="variable_chp.csv", solver="cbc"): energysystem.add( solph.components.ExtractionTurbineCHP( label=("variable_chp", "gas"), - inputs={bgas: solph.flows.Flow(nominal_value=10e10)}, + inputs={bgas: solph.flows.Flow(nominal_capacity=10e10)}, outputs={bel: solph.flows.Flow(), bth: solph.flows.Flow()}, conversion_factors={bel: 0.3, bth: 0.5}, conversion_factor_full_condensation={bel: 0.5}, diff --git a/tests/test_solph_network_classes.py b/tests/test_solph_network_classes.py index 5edad18c9..5d3a11a50 100644 --- a/tests/test_solph_network_classes.py +++ b/tests/test_solph_network_classes.py @@ -160,7 +160,7 @@ def test_attributes_needing_nominal_value_get_it(): def test_min_max_values_for_bidirectional_flow(): a = solph.flows.Flow(bidirectional=True) # use default values b = solph.flows.Flow( - bidirectional=True, nominal_value=1, min=-0.8, max=0.9 + bidirectional=True, nominal_capacity=1, min=-0.8, max=0.9 ) assert a.bidirectional assert a.max[0] == 1 diff --git a/tests/test_warnings.py b/tests/test_warnings.py index 6b66f961d..ef81c732e 100644 --- a/tests/test_warnings.py +++ b/tests/test_warnings.py @@ -94,7 +94,7 @@ def test_nonconvex_investment_without_maximum_raises_warning(warning_fixture): variable_costs=25, min=0.2, max=0.8, - nominal_value=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=500, # no maximum is provided here ), nonconvex=solph.NonConvex(), @@ -140,8 +140,8 @@ def test_link_raise_key_error_in_Linkblock(warning_fixture): link = solph.components.Link( label="transshipment_link", inputs={ - bel0: solph.flows.Flow(nominal_value=4), - bel1: solph.flows.Flow(nominal_value=2), + bel0: solph.flows.Flow(nominal_capacity=4), + bel1: solph.flows.Flow(nominal_capacity=2), }, outputs={bel0: solph.flows.Flow(), look_out: solph.flows.Flow()}, conversion_factors={(bel0, bel1): 0.8, (bel1, bel0): 0.7}, From df65fe40da4e175f8ef05103cd1993946a66b4c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 14:17:05 +0200 Subject: [PATCH 05/17] Rename attribute Flow.nominal_value to nominal_capacity --- .../simple_time_step_example.py | 2 +- src/oemof/solph/_models.py | 8 +- .../solph/components/_generic_storage.py | 2 +- .../solph/components/_offset_converter.py | 2 +- .../_piecewise_linear_converter.py | 6 +- src/oemof/solph/constraints/storage_level.py | 6 +- src/oemof/solph/flows/_flow.py | 14 +-- .../flows/_invest_non_convex_flow_block.py | 2 +- .../solph/flows/_non_convex_flow_block.py | 4 +- src/oemof/solph/flows/_simple_flow_block.py | 20 ++--- .../flows/experimental/_electrical_line.py | 2 +- .../test_components/test_offset_converter.py | 86 ++++++++++--------- tests/test_flows/test_flow_class.py | 2 +- tests/test_flows/test_simple_flow.py | 8 +- tests/test_processing.py | 4 +- 15 files changed, 87 insertions(+), 81 deletions(-) diff --git a/examples/time_index_example/simple_time_step_example.py b/examples/time_index_example/simple_time_step_example.py index 9d6cb5b07..868f8f93d 100644 --- a/examples/time_index_example/simple_time_step_example.py +++ b/examples/time_index_example/simple_time_step_example.py @@ -13,7 +13,7 @@ * The initial_storage_level of a GenericStorage is given at the first time step. If the storage is balanced, this is the same storage level as in the last time step. -* The nominal_value in Flows has to be interpreted in means of power: We have +* The nominal_capacity in Flows has to be interpreted in means of power: We have nominal_capacity=0.5, but the maximum change of the storage content of an ideal storage is 0.125. diff --git a/src/oemof/solph/_models.py b/src/oemof/solph/_models.py index 5ecbbd474..74e49b69d 100644 --- a/src/oemof/solph/_models.py +++ b/src/oemof/solph/_models.py @@ -314,25 +314,25 @@ def _add_parent_block_variables(self): self.flow = po.Var(self.FLOWS, self.TIMESTEPS, within=po.Reals) for o, i in self.FLOWS: - if self.flows[o, i].nominal_value is not None: + if self.flows[o, i].nominal_capacity is not None: if self.flows[o, i].fix[self.TIMESTEPS.at(1)] is not None: for t in self.TIMESTEPS: self.flow[o, i, t].value = ( self.flows[o, i].fix[t] - * self.flows[o, i].nominal_value + * self.flows[o, i].nominal_capacity ) self.flow[o, i, t].fix() else: for t in self.TIMESTEPS: self.flow[o, i, t].setub( self.flows[o, i].max[t] - * self.flows[o, i].nominal_value + * self.flows[o, i].nominal_capacity ) if not self.flows[o, i].nonconvex: for t in self.TIMESTEPS: self.flow[o, i, t].setlb( self.flows[o, i].min[t] - * self.flows[o, i].nominal_value + * self.flows[o, i].nominal_capacity ) elif (o, i) in self.UNIDIRECTIONAL_FLOWS: for t in self.TIMESTEPS: diff --git a/src/oemof/solph/components/_generic_storage.py b/src/oemof/solph/components/_generic_storage.py index f8fd76df7..eff79ae11 100644 --- a/src/oemof/solph/components/_generic_storage.py +++ b/src/oemof/solph/components/_generic_storage.py @@ -104,7 +104,7 @@ class GenericStorage(Node): max_storage_level : numeric (iterable or scalar), :math:`c_{max}(t)` see: min_storage_level investment : :class:`oemof.solph.options.Investment` object - Object indicating if a nominal_value of the flow is determined by + Object indicating if a nominal_capacity of the flow is determined by the optimization problem. Note: This will refer all attributes to an investment variable instead of to the nominal_storage_capacity. The nominal_storage_capacity should not be set (or set to None) if an diff --git a/src/oemof/solph/components/_offset_converter.py b/src/oemof/solph/components/_offset_converter.py index b33442f6c..25c51f95a 100644 --- a/src/oemof/solph/components/_offset_converter.py +++ b/src/oemof/solph/components/_offset_converter.py @@ -46,7 +46,7 @@ class OffsetConverter(Node): normed_offsets : dict, (:math:`y_\text{0,normed}(t)`) Dict containing the respective bus as key and as value the parameter :math:`y_\text{0,normed}(t)`. It represents the y-intercept with respect - to the `NonConvex` flow divided by the `nominal_value` of the + to the `NonConvex` flow divided by the `nominal_capacity` of the `NonConvex` flow (this is for internal purposes). The value can either be a scalar or a sequence with length of time horizon for simulation. Notes diff --git a/src/oemof/solph/components/experimental/_piecewise_linear_converter.py b/src/oemof/solph/components/experimental/_piecewise_linear_converter.py index ef2e5192b..2cd155d42 100644 --- a/src/oemof/solph/components/experimental/_piecewise_linear_converter.py +++ b/src/oemof/solph/components/experimental/_piecewise_linear_converter.py @@ -94,8 +94,10 @@ def __init__( + "more than 1 input and 1 output!" ) - nominal_value = [a.nominal_value for a in self.inputs.values()][0] - if max(self.in_breakpoints) < nominal_value: + nominal_capacity = [a.nominal_capacity for a in self.inputs.values()][ + 0 + ] + if max(self.in_breakpoints) < nominal_capacity: raise ValueError( "Largest in_breakpoint must be larger or equal " + "nominal value" diff --git a/src/oemof/solph/constraints/storage_level.py b/src/oemof/solph/constraints/storage_level.py index 87c892bdf..60d538c10 100644 --- a/src/oemof/solph/constraints/storage_level.py +++ b/src/oemof/solph/constraints/storage_level.py @@ -24,7 +24,7 @@ def storage_level_constraint( As a GenericStorage just allows exactly one input and one output, an additional bus, the multiplexer_bus, is used for the connections. Note that all Flow objects connected to the multiplexer_bus have to have - a nominal_value. + a nominal_capacity. Parameters ---------- @@ -91,7 +91,7 @@ def _output_active_rule(m): def _constraint_output_rule(m, o, t): return ( m.flow[multiplexer_bus, o, t] - / m.flows[multiplexer_bus, o].nominal_value + / m.flows[multiplexer_bus, o].nominal_capacity <= active_output[o, t] ) @@ -156,7 +156,7 @@ def _input_active_rule(m): def _constraint_input_rule(m, i, t): return ( m.flow[i, multiplexer_bus, t] - / m.flows[i, multiplexer_bus].nominal_value + / m.flows[i, multiplexer_bus].nominal_capacity <= 1 - inactive_input[i, t] ) diff --git a/src/oemof/solph/flows/_flow.py b/src/oemof/solph/flows/_flow.py index ded156642..6e2d859d8 100644 --- a/src/oemof/solph/flows/_flow.py +++ b/src/oemof/solph/flows/_flow.py @@ -53,12 +53,12 @@ class Flow(Edge): will be added to the objective expression of the optimization problem. max : numeric (iterable or scalar), :math:`f_{max}` Normed maximum value of the flow. The flow absolute maximum will be - calculated by multiplying :attr:`nominal_value` with :attr:`max` + calculated by multiplying :attr:`nominal_capacity` with :attr:`max` min : numeric (iterable or scalar), :math:`f_{min}` Normed minimum value of the flow (see :attr:`max`). fix : numeric (iterable or scalar), :math:`f_{fix}` Normed fixed value for the flow variable. Will be multiplied with the - :attr:`nominal_value` to get the absolute value. + :attr:`nominal_capacity` to get the absolute value. positive_gradient_limit : numeric (iterable, scalar or None) the normed *upper bound* on the positive difference (`flow[t-1] < flow[t]`) of two consecutive flow values. @@ -206,7 +206,7 @@ def __init__( for attribute, value in custom_attributes.items(): setattr(self, attribute, value) - self.nominal_value = None + self.nominal_capacity = None self.investment = None infinite_error_msg = ( @@ -216,7 +216,7 @@ def __init__( if isinstance(nominal_capacity, numbers.Real): if not math.isfinite(nominal_capacity): raise ValueError(infinite_error_msg.format("nominal_capacity")) - self.nominal_value = nominal_capacity + self.nominal_capacity = nominal_capacity elif isinstance(nominal_capacity, Investment): self.investment = nominal_capacity @@ -260,7 +260,7 @@ def __init__( "max", ] sequences = ["fix", "variable_costs", "min", "max"] - if self.investment is None and self.nominal_value is None: + if self.investment is None and self.nominal_capacity is None: for attr in need_nominal_value: if isinstance(eval(attr), Iterable): the_attr = eval(attr)[0] @@ -287,7 +287,9 @@ def __init__( for attr in sequences: setattr(self, attr, sequence(eval(attr))) - if self.nominal_value is not None and not math.isfinite(self.max[0]): + if self.nominal_capacity is not None and not math.isfinite( + self.max[0] + ): raise ValueError(infinite_error_msg.format("max")) # Checking for impossible gradient combinations diff --git a/src/oemof/solph/flows/_invest_non_convex_flow_block.py b/src/oemof/solph/flows/_invest_non_convex_flow_block.py index 747c17f79..84be801c8 100644 --- a/src/oemof/solph/flows/_invest_non_convex_flow_block.py +++ b/src/oemof/solph/flows/_invest_non_convex_flow_block.py @@ -121,7 +121,7 @@ def _investvar_bound_rule(block, i, o, p): # `status_nominal` is a parameter which represents the # multiplication of a binary variable (`status`) - # and a continuous variable (`invest` or `nominal_value`) + # and a continuous variable (`invest` or `nominal_capacity`) self.status_nominal = Var( self.INVEST_NON_CONVEX_FLOWS, m.TIMESTEPS, within=NonNegativeReals ) diff --git a/src/oemof/solph/flows/_non_convex_flow_block.py b/src/oemof/solph/flows/_non_convex_flow_block.py index 88eb76850..3d2c1d9f2 100644 --- a/src/oemof/solph/flows/_non_convex_flow_block.py +++ b/src/oemof/solph/flows/_non_convex_flow_block.py @@ -97,7 +97,7 @@ def _create_variables(self): # `status_nominal` is a parameter which represents the # multiplication of a binary variable (`status`) - # and a continuous variable (`invest` or `nominal_value`) + # and a continuous variable (`invest` or `nominal_capacity`) self.status_nominal = Var( self.NONCONVEX_FLOWS, m.TIMESTEPS, within=NonNegativeReals ) @@ -648,7 +648,7 @@ def _status_nominal_rule(_, i, o, t): """Rule definition for status_nominal""" expr = ( self.status_nominal[i, o, t] - == self.status[i, o, t] * m.flows[i, o].nominal_value + == self.status[i, o, t] * m.flows[i, o].nominal_capacity ) return expr diff --git a/src/oemof/solph/flows/_simple_flow_block.py b/src/oemof/solph/flows/_simple_flow_block.py index dc893592b..ad3b1caa1 100644 --- a/src/oemof/solph/flows/_simple_flow_block.py +++ b/src/oemof/solph/flows/_simple_flow_block.py @@ -75,7 +75,7 @@ def _create_sets(self, group): (g[0], g[1]) for g in group if g[2].full_load_time_max is not None - and g[2].nominal_value is not None + and g[2].nominal_capacity is not None ] ) @@ -84,7 +84,7 @@ def _create_sets(self, group): (g[0], g[1]) for g in group if g[2].full_load_time_min is not None - and g[2].nominal_value is not None + and g[2].nominal_capacity is not None ] ) @@ -175,12 +175,12 @@ def _create_variables(self, group): if m.flows[i, o].positive_gradient_limit[0] is not None: for t in m.TIMESTEPS: self.positive_gradient[i, o, t].setub( - f.positive_gradient_limit[t] * f.nominal_value + f.positive_gradient_limit[t] * f.nominal_capacity ) if m.flows[i, o].negative_gradient_limit[0] is not None: for t in m.TIMESTEPS: self.negative_gradient[i, o, t].setub( - f.negative_gradient_limit[t] * f.nominal_value + f.negative_gradient_limit[t] * f.nominal_capacity ) def _create_constraints(self): @@ -220,7 +220,7 @@ def _flow_full_load_time_max_rule(model): ) rhs = ( m.flows[inp, out].full_load_time_max - * m.flows[inp, out].nominal_value + * m.flows[inp, out].nominal_capacity ) self.full_load_time_max_constr.add((inp, out), lhs <= rhs) @@ -240,7 +240,7 @@ def _flow_full_load_time_min_rule(_): ) rhs = ( m.flows[inp, out].full_load_time_min - * m.flows[inp, out].nominal_value + * m.flows[inp, out].nominal_capacity ) self.full_load_time_min_constr.add((inp, out), lhs >= rhs) @@ -451,12 +451,12 @@ def _objective_expression(self): # Fixed costs for units with no lifetime limit if ( m.flows[i, o].fixed_costs[0] is not None - and m.flows[i, o].nominal_value is not None + and m.flows[i, o].nominal_capacity is not None and (i, o) not in self.LIFETIME_FLOWS and (i, o) not in self.LIFETIME_AGE_FLOWS ): fixed_costs += sum( - m.flows[i, o].nominal_value + m.flows[i, o].nominal_capacity * m.flows[i, o].fixed_costs[pp] * ((1 + m.discount_rate) ** (-pp)) for pp in range(m.es.end_year_of_optimization) @@ -470,7 +470,7 @@ def _objective_expression(self): m.flows[i, o].lifetime, ) fixed_costs += sum( - m.flows[i, o].nominal_value + m.flows[i, o].nominal_capacity * m.flows[i, o].fixed_costs[pp] * ((1 + m.discount_rate) ** (-pp)) for pp in range(range_limit) @@ -483,7 +483,7 @@ def _objective_expression(self): m.flows[i, o].lifetime - m.flows[i, o].age, ) fixed_costs += sum( - m.flows[i, o].nominal_value + m.flows[i, o].nominal_capacity * m.flows[i, o].fixed_costs[pp] * ((1 + m.discount_rate) ** (-pp)) for pp in range(range_limit) diff --git a/src/oemof/solph/flows/experimental/_electrical_line.py b/src/oemof/solph/flows/experimental/_electrical_line.py index 8edd417f0..a3dd0e4cd 100644 --- a/src/oemof/solph/flows/experimental/_electrical_line.py +++ b/src/oemof/solph/flows/experimental/_electrical_line.py @@ -60,7 +60,7 @@ class ElectricalLine(Flow): def __init__(self, **kwargs): super().__init__( - nominal_capacity=kwargs.get("nominal_value"), + nominal_capacity=kwargs.get("nominal_capacity"), variable_costs=kwargs.get("variable_costs", 0), min=kwargs.get("min"), max=kwargs.get("max"), diff --git a/tests/test_components/test_offset_converter.py b/tests/test_components/test_offset_converter.py index c094cb5d0..82bdd9b59 100644 --- a/tests/test_components/test_offset_converter.py +++ b/tests/test_components/test_offset_converter.py @@ -53,7 +53,7 @@ def solve_and_extract_results(es): def check_results( results, reference_bus, - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -62,7 +62,7 @@ def check_results( if "input" in reference_bus.label: slope, offset = slope_offset_from_nonconvex_input( 1, - minimal_value / nominal_value, + minimal_value / nominal_capacity, eta_at_nom[bus], eta_at_min[bus], ) @@ -75,7 +75,7 @@ def check_results( else: slope, offset = slope_offset_from_nonconvex_output( 1, - minimal_value / nominal_value, + minimal_value / nominal_capacity, eta_at_nom[bus], eta_at_min[bus], ) @@ -87,7 +87,7 @@ def check_results( ]["sequences"]["status"] flow_expected = ( - offset * nominal_value * reference_flow_status + offset * nominal_capacity * reference_flow_status + slope * reference_flow ) if "input" in bus.label: @@ -103,7 +103,7 @@ def check_results( def add_OffsetConverter( - es, reference_bus, nominal_value, minimal_value, eta_at_nom, eta_at_min + es, reference_bus, nominal_capacity, minimal_value, eta_at_nom, eta_at_min ): # Use of experimental API to access nodes by label. # Can be removed with future release of network. @@ -123,19 +123,21 @@ def add_OffsetConverter( if reference_bus in oc_outputs: f = oc_outputs[reference_bus] get_slope_and_offset = slope_offset_from_nonconvex_output - fix = [0] + np.linspace(minimal_value, nominal_value, 9).tolist() + fix = [0] + np.linspace( + minimal_value, nominal_capacity, 9 + ).tolist() else: f = oc_inputs[reference_bus] get_slope_and_offset = slope_offset_from_nonconvex_input fix = [0] + np.linspace( minimal_value * eta_at_min[es.node["bus output 0"]], - nominal_value * eta_at_nom[es.node["bus output 0"]], + nominal_capacity * eta_at_nom[es.node["bus output 0"]], 9, ).tolist() fix_flow = es.flows()[es.node["bus output 0"], es.node["sink 0"]] fix_flow.fix = fix - fix_flow.nominal_value = 1 + fix_flow.nominal_capacity = 1 slopes = {} offsets = {} @@ -145,7 +147,7 @@ def add_OffsetConverter( continue slope, offset = get_slope_and_offset( 1, - minimal_value / nominal_value, + minimal_value / nominal_capacity, eta_at_nom[bus], eta_at_min[bus], ) @@ -153,8 +155,8 @@ def add_OffsetConverter( offsets[bus] = offset f.nonconvex = solph.NonConvex() - f.nominal_value = nominal_value - f.min = sequence(minimal_value / nominal_value) + f.nominal_capacity = nominal_capacity + f.min = sequence(minimal_value / nominal_capacity) oc = solph.components.OffsetConverter( label="offset converter", @@ -243,7 +245,7 @@ def test_OffsetConverter_single_input_output_ref_output(): num_out = 1 es = create_energysystem_stub(num_in, num_out) - nominal_value = 10 + nominal_capacity = 10 minimal_value = 3 eta_at_nom = {es.groups["bus input 0"]: 0.7} @@ -252,7 +254,7 @@ def test_OffsetConverter_single_input_output_ref_output(): add_OffsetConverter( es, es.groups["bus output 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -263,7 +265,7 @@ def test_OffsetConverter_single_input_output_ref_output(): check_results( results, es.groups["bus output 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -275,7 +277,7 @@ def test_OffsetConverter_single_input_output_ref_output_eta_decreasing(): num_out = 1 es = create_energysystem_stub(num_in, num_out) - nominal_value = 10 + nominal_capacity = 10 minimal_value = 3 eta_at_nom = {es.groups["bus input 0"]: 0.5} @@ -284,7 +286,7 @@ def test_OffsetConverter_single_input_output_ref_output_eta_decreasing(): add_OffsetConverter( es, es.groups["bus output 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -295,7 +297,7 @@ def test_OffsetConverter_single_input_output_ref_output_eta_decreasing(): check_results( results, es.groups["bus output 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -307,7 +309,7 @@ def test_OffsetConverter_single_input_output_ref_input(): num_out = 1 es = create_energysystem_stub(num_in, num_out) - nominal_value = 10 + nominal_capacity = 10 minimal_value = 3 eta_at_nom = {es.groups["bus output 0"]: 0.7} @@ -316,7 +318,7 @@ def test_OffsetConverter_single_input_output_ref_input(): add_OffsetConverter( es, es.groups["bus input 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -327,7 +329,7 @@ def test_OffsetConverter_single_input_output_ref_input(): check_results( results, es.groups["bus input 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -339,7 +341,7 @@ def test_OffsetConverter_single_input_output_ref_input_eta_decreasing(): num_out = 1 es = create_energysystem_stub(num_in, num_out) - nominal_value = 10 + nominal_capacity = 10 minimal_value = 3 eta_at_nom = {es.groups["bus output 0"]: 0.5} @@ -348,7 +350,7 @@ def test_OffsetConverter_single_input_output_ref_input_eta_decreasing(): add_OffsetConverter( es, es.groups["bus input 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -359,7 +361,7 @@ def test_OffsetConverter_single_input_output_ref_input_eta_decreasing(): check_results( results, es.groups["bus input 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -371,7 +373,7 @@ def test_OffsetConverter_double_input_output_ref_input(): num_out = 2 es = create_energysystem_stub(num_in, num_out) - nominal_value = 10 + nominal_capacity = 10 minimal_value = 3 eta_at_nom = { @@ -388,7 +390,7 @@ def test_OffsetConverter_double_input_output_ref_input(): add_OffsetConverter( es, es.groups["bus input 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -399,7 +401,7 @@ def test_OffsetConverter_double_input_output_ref_input(): check_results( results, es.groups["bus input 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -412,7 +414,7 @@ def test_OffsetConverter_double_input_output_ref_output(): es = create_energysystem_stub(num_in, num_out) - nominal_value = 10 + nominal_capacity = 10 minimal_value = 3 eta_at_nom = { @@ -429,7 +431,7 @@ def test_OffsetConverter_double_input_output_ref_output(): add_OffsetConverter( es, es.groups["bus output 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -440,7 +442,7 @@ def test_OffsetConverter_double_input_output_ref_output(): check_results( results, es.groups["bus output 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -453,7 +455,7 @@ def test_two_OffsetConverters_with_and_without_investment(): es = create_energysystem_stub(num_in, num_out) - nominal_value = 10 + nominal_capacity = 10 minimal_value = 3 eta_at_nom = { @@ -466,7 +468,7 @@ def test_two_OffsetConverters_with_and_without_investment(): add_OffsetConverter( es, es.groups["bus output 0"], - nominal_value, + nominal_capacity, minimal_value, eta_at_nom, eta_at_min, @@ -481,7 +483,7 @@ def test_two_OffsetConverters_with_and_without_investment(): es.groups["bus output 0"]: solph.Flow( nonconvex=solph.NonConvex(), nominal_capacity=solph.Investment( - maximum=nominal_value, ep_costs=10 + maximum=nominal_capacity, ep_costs=10 ), ) }, @@ -507,25 +509,25 @@ def test_OffsetConverter_05x_compatibility(): num_out = 1 es = create_energysystem_stub(num_in, num_out) - nominal_value = 10 + nominal_capacity = 10 minimal_value = 3 # Use of experimental API to access nodes by label. # Can be removed with future release of network. with warnings.catch_warnings(): warnings.simplefilter("ignore", category=ExperimentalFeatureWarning) - fix = [0] + np.linspace(minimal_value, nominal_value, 9).tolist() + fix = [0] + np.linspace(minimal_value, nominal_capacity, 9).tolist() fix_flow = es.flows()[es.node["bus output 0"], es.node["sink 0"]] fix_flow.fix = fix - fix_flow.nominal_value = 1 + fix_flow.nominal_capacity = 1 eta_at_nom = 0.7 eta_at_min = 0.5 - slope = (nominal_value - minimal_value) / ( - nominal_value / eta_at_nom - minimal_value / eta_at_min + slope = (nominal_capacity - minimal_value) / ( + nominal_capacity / eta_at_nom - minimal_value / eta_at_min ) - offset = minimal_value / nominal_value * (1 - slope / eta_at_min) + offset = minimal_value / nominal_capacity * (1 - slope / eta_at_min) warnings.filterwarnings("ignore", "", DeprecationWarning) oc = solph.components.OffsetConverter( @@ -534,8 +536,8 @@ def test_OffsetConverter_05x_compatibility(): outputs={ es.groups["bus output 0"]: solph.Flow( nonconvex=solph.NonConvex(), - nominal_capacity=nominal_value, - min=minimal_value / nominal_value, + nominal_capacity=nominal_capacity, + min=minimal_value / nominal_capacity, ) }, coefficients=(offset, slope), @@ -547,7 +549,7 @@ def test_OffsetConverter_05x_compatibility(): results = solve_and_extract_results(es) slope, offset = slope_offset_from_nonconvex_output( - 1, minimal_value / nominal_value, 0.7, 0.5 + 1, minimal_value / nominal_capacity, 0.7, 0.5 ) output_flow = results["offset converter", "bus output 0"]["sequences"][ "flow" @@ -557,7 +559,7 @@ def test_OffsetConverter_05x_compatibility(): ]["status"] input_flow_expected = ( - offset * nominal_value * output_flow_status + slope * output_flow + offset * nominal_capacity * output_flow_status + slope * output_flow ) input_flow_actual = results["bus input 0", "offset converter"][ "sequences" diff --git a/tests/test_flows/test_flow_class.py b/tests/test_flows/test_flow_class.py index cf5805d23..5c3955c83 100644 --- a/tests/test_flows/test_flow_class.py +++ b/tests/test_flows/test_flow_class.py @@ -82,6 +82,6 @@ def test_fix_sequence(): def test_fix_sequence_non_nominal(): - """Attribute fix needs nominal_value""" + """Attribute fix needs nominal_capacity""" with pytest.raises(AttributeError): Flow(fix=[0.3, 0.2, 0.7]) diff --git a/tests/test_flows/test_simple_flow.py b/tests/test_flows/test_simple_flow.py index 4bc0c4b36..e5c74ed91 100644 --- a/tests/test_flows/test_simple_flow.py +++ b/tests/test_flows/test_simple_flow.py @@ -58,13 +58,13 @@ def test_full_load_time_min(): # --- BEGIN: The following code can be removed for versions >= v0.7 --- -def test_nominal_value_warning(): - with pytest.warns(FutureWarning, match="nominal_value"): +def test_nominal_capacity_warning(): + with pytest.warns(FutureWarning, match="nominal_capacity"): _ = solph.flows.Flow(nominal_value=2) -def test_nominal_value_error(): - with pytest.raises(AttributeError, match="nominal_value"): +def test_nominal_capacity_error(): + with pytest.raises(AttributeError, match="nominal_capacity"): _ = solph.flows.Flow(nominal_value=2, nominal_capacity=1) diff --git a/tests/test_processing.py b/tests/test_processing.py index e563fece7..0299ff627 100644 --- a/tests/test_processing.py +++ b/tests/test_processing.py @@ -99,7 +99,7 @@ def test_flows_with_none_exclusion(self): { "bidirectional": False, "integer": False, - "nominal_value": 1, + "nominal_capacity": 1, "max": 1, "min": 0, "variable_costs": 0, @@ -124,7 +124,7 @@ def test_flows_without_none_exclusion(self): "lifetime": None, "integer": False, "investment": None, - "nominal_value": 1, + "nominal_capacity": 1, "nonconvex": None, "bidirectional": False, "full_load_time_max": None, From a2bca51479e7557e90f21d800aed26ad4ac1de80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 14:33:03 +0200 Subject: [PATCH 06/17] Rename "value" to "capacity" in docstrings --- examples/electrical/transshipment.py | 2 +- examples/excel_reader/dispatch.py | 2 +- src/oemof/solph/components/_offset_converter.py | 4 ++-- src/oemof/solph/flows/_investment_flow_block.py | 4 ++-- tests/test_components.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/electrical/transshipment.py b/examples/electrical/transshipment.py index 3a1e181e4..513aabfed 100644 --- a/examples/electrical/transshipment.py +++ b/examples/electrical/transshipment.py @@ -77,7 +77,7 @@ def draw_graph( grph : networkxGraph A graph to draw. edge_labels : boolean - Use nominal values of flow as edge label + Use nominal capacities of flow as edge label node_color : dict or string Hex color code oder matplotlib color for each node. If string, all colors are the same. diff --git a/examples/excel_reader/dispatch.py b/examples/excel_reader/dispatch.py index efb534f24..8927d6e9b 100644 --- a/examples/excel_reader/dispatch.py +++ b/examples/excel_reader/dispatch.py @@ -301,7 +301,7 @@ def draw_graph( grph : networkxGraph A graph to draw. edge_labels : boolean - Use nominal values of flow as edge label + Use nominal capacities of flow as edge label node_color : dict or string Hex color code oder matplotlib color for each node. If string, all colors are the same. diff --git a/src/oemof/solph/components/_offset_converter.py b/src/oemof/solph/components/_offset_converter.py index 25c51f95a..74778673d 100644 --- a/src/oemof/solph/components/_offset_converter.py +++ b/src/oemof/solph/components/_offset_converter.py @@ -579,7 +579,7 @@ def slope_offset_from_nonconvex_input( With the input load being at 100 %, in this example, the efficiency should be 30 %. With the input load being at 50 %, it should be 40 %. We can - calcualte slope and the offset which is normed to the nominal value of + calcualte slope and the offset which is normed to the nominal capacity of the referenced flow (in this case the input flow) always. >>> slope, offset = solph.components.slope_offset_from_nonconvex_input( @@ -656,7 +656,7 @@ def slope_offset_from_nonconvex_output( With the output load being at 100 %, in this example, the efficiency should be 80 %. With the input load being at 50 %, it should be 70 %. We can - calcualte slope and the offset, which is normed to the nominal value of + calcualte slope and the offset, which is normed to the nominal capacity of the referenced flow (in this case the output flow) always. >>> slope, offset = solph.components.slope_offset_from_nonconvex_output( diff --git a/src/oemof/solph/flows/_investment_flow_block.py b/src/oemof/solph/flows/_investment_flow_block.py index e77ec40b5..bad8c6b8d 100644 --- a/src/oemof/solph/flows/_investment_flow_block.py +++ b/src/oemof/solph/flows/_investment_flow_block.py @@ -185,12 +185,12 @@ def _create_variables(self, _): Value of the investment variable in period p, equal to what is being invested and equivalent resp. similar to - the nominal value of the flows after optimization. + the nominal capacity of the flows after optimization. * :math:`P_{total}(p)` Total installed capacity / energy in period p, - equivalent to the nominal value of the flows after optimization. + equivalent to the nominal capacity of the flows after optimization. * :math:`P_{old}(p)` diff --git a/tests/test_components.py b/tests/test_components.py index 02a7b1d1e..8618af937 100644 --- a/tests/test_components.py +++ b/tests/test_components.py @@ -43,7 +43,7 @@ def test_generic_storage_1(): def test_generic_storage_2(): - """Nominal value defined with investment model.""" + """Nominal capacity defined with investment model.""" bel = Bus() with pytest.raises( AttributeError, @@ -65,7 +65,7 @@ def test_generic_storage_2(): def test_generic_storage_3(): - """Nominal value defined with investment model.""" + """Nominal capacity defined with investment model.""" bel = Bus() components.GenericStorage( label="storage4", From 6973a31e3c0990197e212cecf94af74a83de988b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 14:43:29 +0200 Subject: [PATCH 07/17] Rename nominal_storage_capacity to nominal_capacity --- .../solph/components/_generic_storage.py | 27 +++++++++--- tests/test_components/test_storage.py | 41 +++++++++++++++---- 2 files changed, 54 insertions(+), 14 deletions(-) diff --git a/src/oemof/solph/components/_generic_storage.py b/src/oemof/solph/components/_generic_storage.py index eff79ae11..e0e178403 100644 --- a/src/oemof/solph/components/_generic_storage.py +++ b/src/oemof/solph/components/_generic_storage.py @@ -167,7 +167,8 @@ def __init__( label=None, inputs=None, outputs=None, - nominal_storage_capacity=None, + nominal_capacity=None, + nominal_storage_capacity=None, # Can be removed for versions >= v0.7 initial_storage_level=None, investment=None, invest_relation_input_output=None, @@ -207,20 +208,34 @@ def __init__( + " nominal_storage_capacity." + " Both options cannot be set at the same time." ) - if nominal_storage_capacity is not None: + if nominal_capacity is not None: raise AttributeError(msg) else: warn(msg, FutureWarning) nominal_storage_capacity = investment # --- END --- + # --- BEGIN: The following code can be removed for versions >= v0.6 --- + if nominal_storage_capacity is not None: + msg = ( + "For backward compatibility," + " the option nominal_storage_capacity overwrites the option" + + " nominal_capacity." + + " Both options cannot be set at the same time." + ) + if nominal_capacity is not None: + raise AttributeError(msg) + else: + warn(msg, FutureWarning) + nominal_capacity = nominal_storage_capacity + # --- END --- self.nominal_storage_capacity = None self.investment = None self._invest_group = False - if isinstance(nominal_storage_capacity, numbers.Real): - self.nominal_storage_capacity = nominal_storage_capacity - elif isinstance(nominal_storage_capacity, Investment): - self.investment = nominal_storage_capacity + if isinstance(nominal_capacity, numbers.Real): + self.nominal_storage_capacity = nominal_capacity + elif isinstance(nominal_capacity, Investment): + self.investment = nominal_capacity self._invest_group = True self.initial_storage_level = initial_storage_level diff --git a/tests/test_components/test_storage.py b/tests/test_components/test_storage.py index 16faf3fae..ec6494456 100644 --- a/tests/test_components/test_storage.py +++ b/tests/test_components/test_storage.py @@ -28,7 +28,7 @@ def test_relative_losses(): "storage", inputs={bus: solph.Flow(variable_costs=1)}, outputs={bus: solph.Flow(variable_costs=1)}, - nominal_storage_capacity=10, + nominal_capacity=10, initial_storage_level=1, loss_rate=0.004125876075, # half life of one week ) @@ -76,7 +76,7 @@ def test_invest_power_uncoupled(): nominal_capacity=solph.Investment(ep_costs=0.1), ) }, - nominal_storage_capacity=10, + nominal_capacity=10, initial_storage_level=0, balanced=False, ) @@ -122,7 +122,7 @@ def test_invest_power_coupled(): nominal_capacity=solph.Investment(ep_costs=0.1), ) }, - nominal_storage_capacity=10, + nominal_capacity=10, invest_relation_input_output=0.5, initial_storage_level=0, balanced=False, @@ -159,7 +159,7 @@ def test_storage_charging(): "storage", inputs={bus: solph.Flow(nominal_capacity=2, variable_costs=-2)}, outputs={bus: solph.Flow(nominal_capacity=0.1)}, - nominal_storage_capacity=19, + nominal_capacity=19, initial_storage_level=0, balanced=False, ) @@ -194,7 +194,7 @@ def test_invest_content_uncoupled(): "storage", inputs={bus: solph.Flow(nominal_capacity=2, variable_costs=-2)}, outputs={bus: solph.Flow(nominal_capacity=0.1)}, - nominal_storage_capacity=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=0.1, ), initial_storage_level=0, @@ -234,7 +234,7 @@ def test_invest_content_minimum(): "storage", inputs={bus: solph.Flow(nominal_capacity=2, variable_costs=-2)}, outputs={bus: solph.Flow(nominal_capacity=0.1, variable_costs=0.1)}, - nominal_storage_capacity=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=0.1, minimum=32, ), @@ -275,7 +275,7 @@ def test_invest_content_minimum_nonconvex(): "storage", inputs={bus: solph.Flow(nominal_capacity=2, variable_costs=0.1)}, outputs={bus: solph.Flow(nominal_capacity=0.1, variable_costs=0.1)}, - nominal_storage_capacity=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=0.1, minimum=32, nonconvex=solph.NonConvex(), @@ -321,7 +321,7 @@ def test_invest_content_maximum(): ) }, outputs={bus: solph.Flow(nominal_capacity=0.1, variable_costs=0.1)}, - nominal_storage_capacity=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=0.1, maximum=10, ), @@ -344,3 +344,28 @@ def test_invest_content_maximum(): assert storage_content == pytest.approx( [min(i * 1.9, 10) for i in range(0, 11)] ) + + +# --- BEGIN: The following code can be removed for versions >= v0.6 --- +def test_capacity_keyword_wrapper_warning(): + with pytest.warns(FutureWarning, match="nominal_storage_capacity"): + bus = solph.Bus() + _ = solph.components.GenericStorage( + nominal_storage_capacity=5, + inputs={bus: solph.Flow()}, + outputs={bus: solph.Flow()}, + ) + + +def test_capacity_keyword_wrapper_error(): + with pytest.raises(AttributeError, match="nominal_storage_capacity"): + bus = solph.Bus() + _ = solph.components.GenericStorage( + nominal_storage_capacity=5, + nominal_capacity=5, + inputs={bus: solph.Flow()}, + outputs={bus: solph.Flow()}, + ) + + +# --- END --- From 96ab6f847f12068560fa22b6ca9a8448e8176d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 14:49:19 +0200 Subject: [PATCH 08/17] Rename GenericStorage keyword to nominal_capacity This way, it is analogue to teh keyword of the Flow. --- docs/usage.rst | 4 ++-- examples/basic_example/basic_example.py | 2 +- .../dual_variable_example.py | 2 +- examples/excel_reader/dispatch.py | 2 +- .../flexible_modelling/saturating_storage.py | 2 +- examples/gradient_example/gradient_example.py | 2 +- .../diesel_genset_nonconvex_investment.py | 2 +- .../offset_diesel_genset_nonconvex_investment.py | 2 +- examples/storage_balanced_unbalanced/storage.py | 2 +- examples/storage_costs/storage_costs.py | 4 ++-- .../v1_invest_optimize_all_technologies.py | 2 +- .../v2_invest_optimize_only_gas_and_storage.py | 2 +- ...st_optimize_only_storage_with_fossil_share.py | 2 +- ...ptimize_all_technologies_with_fossil_share.py | 2 +- .../storage_level_constraint.py | 2 +- .../non_equidistant_time_step_example.py | 4 ++-- .../simple_time_step_example.py | 2 +- examples/tuple_as_labels/tuple_as_label.py | 2 +- src/oemof/solph/components/_generic_storage.py | 4 ++-- src/oemof/solph/constraints/shared_limit.py | 4 ++-- tests/test_components.py | 16 +++++++--------- tests/test_constraints/test_storage_level.py | 2 +- tests/test_non_equidistant_time_index.py | 2 +- tests/test_processing.py | 2 +- .../test_connect_invest/test_connect_invest.py | 2 +- .../test_multi_period_dispatch_model.py | 2 +- .../test_multi_period_investment_model.py | 2 +- .../test_invest_storage_regression.py | 2 +- .../test_storage_investment.py | 2 +- .../test_storage_with_tuple_label.py | 2 +- 30 files changed, 41 insertions(+), 43 deletions(-) diff --git a/docs/usage.rst b/docs/usage.rst index a51fb2d66..9dbbbec2c 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -568,7 +568,7 @@ Furthermore, an efficiency for loading, unloading and a loss rate can be defined label='storage', inputs={b_el: solph.flows.Flow(nominal_capacity=9, variable_costs=10)}, outputs={b_el: solph.flows.Flow(nominal_capacity=25, variable_costs=10)}, - loss_rate=0.001, nominal_storage_capacity=50, + loss_rate=0.001, nominal_capacity=50, inflow_conversion_factor=0.98, outflow_conversion_factor=0.8) For initialising the state of charge before the first time step (time step zero) the parameter ``initial_storage_level`` (default value: ``None``) can be set by a numeric value as fraction of the storage capacity. @@ -590,7 +590,7 @@ The following code block shows an example of the storage parametrization for the label='storage', inputs={b_el: solph.flows.Flow(nominal_capacity=9, variable_costs=10)}, outputs={b_el: solph.flows.Flow(nominal_capacity=25, variable_costs=10)}, - loss_rate=0.001, nominal_storage_capacity=50, + loss_rate=0.001, nominal_capacity=50, initial_storage_level=0.5, balanced=True, inflow_conversion_factor=0.98, outflow_conversion_factor=0.8) diff --git a/examples/basic_example/basic_example.py b/examples/basic_example/basic_example.py index cfd8e32f5..2afd5a4e2 100644 --- a/examples/basic_example/basic_example.py +++ b/examples/basic_example/basic_example.py @@ -223,7 +223,7 @@ def main(dump_and_restore=False): nominal_capacity = nominal_capacity / 6 battery_storage = components.GenericStorage( - nominal_storage_capacity=nominal_capacity, + nominal_capacity=nominal_capacity, label=STORAGE_LABEL, inputs={ bus_electricity: flows.Flow(nominal_capacity=nominal_capacity) diff --git a/examples/dual_variable_example/dual_variable_example.py b/examples/dual_variable_example/dual_variable_example.py index 0e26c2472..a06f792d6 100644 --- a/examples/dual_variable_example/dual_variable_example.py +++ b/examples/dual_variable_example/dual_variable_example.py @@ -223,7 +223,7 @@ def main(): # create storage object representing a battery cap = 400 storage = cmp.GenericStorage( - nominal_storage_capacity=cap, + nominal_capacity=cap, label="storage", inputs={bus_elec: flows.Flow(nominal_capacity=cap / 6)}, outputs={ diff --git a/examples/excel_reader/dispatch.py b/examples/excel_reader/dispatch.py index 8927d6e9b..baa099a99 100644 --- a/examples/excel_reader/dispatch.py +++ b/examples/excel_reader/dispatch.py @@ -250,7 +250,7 @@ def create_nodes(nd=None): variable_costs=s["variable output costs"], ) }, - nominal_storage_capacity=s["nominal capacity"], + nominal_capacity=s["nominal capacity"], loss_rate=s["capacity loss"], initial_storage_level=s["initial capacity"], max_storage_level=s["capacity max"], diff --git a/examples/flexible_modelling/saturating_storage.py b/examples/flexible_modelling/saturating_storage.py index 757e685bb..342a6733f 100644 --- a/examples/flexible_modelling/saturating_storage.py +++ b/examples/flexible_modelling/saturating_storage.py @@ -73,7 +73,7 @@ def saturating_storage_example(): storage_capacity = 10 battery = solph.components.GenericStorage( label="battery", - nominal_storage_capacity=storage_capacity, + nominal_capacity=storage_capacity, inputs={bel: solph.Flow(nominal_capacity=inflow_capacity)}, outputs={bel: solph.Flow(variable_costs=2)}, initial_storage_level=0, diff --git a/examples/gradient_example/gradient_example.py b/examples/gradient_example/gradient_example.py index b50269a1a..166b85e62 100644 --- a/examples/gradient_example/gradient_example.py +++ b/examples/gradient_example/gradient_example.py @@ -153,7 +153,7 @@ def main(): # create storage object representing a battery storage = cmp.GenericStorage( - nominal_storage_capacity=999999999, + nominal_capacity=999999999, label="storage", inputs={bel: flows.Flow()}, outputs={bel: flows.Flow()}, diff --git a/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py b/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py index 60f12b7e9..f400c3619 100644 --- a/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py +++ b/examples/invest_nonconvex_flow_examples/diesel_genset_nonconvex_investment.py @@ -209,7 +209,7 @@ def main(): epc_battery = 101.00 # currency/kWh/year battery = solph.components.GenericStorage( label="battery", - nominal_storage_capacity=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_battery * n_days / n_days_in_year ), inputs={b_el_dc: solph.flows.Flow(variable_costs=0)}, diff --git a/examples/offset_converter_example/offset_diesel_genset_nonconvex_investment.py b/examples/offset_converter_example/offset_diesel_genset_nonconvex_investment.py index 3bea2bcae..841a6b8a1 100644 --- a/examples/offset_converter_example/offset_diesel_genset_nonconvex_investment.py +++ b/examples/offset_converter_example/offset_diesel_genset_nonconvex_investment.py @@ -224,7 +224,7 @@ def offset_converter_example(): epc_battery = 101.00 # currency/kWh/year battery = solph.components.GenericStorage( label="battery", - nominal_storage_capacity=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc_battery * n_days / n_days_in_year ), inputs={b_el_dc: solph.flows.Flow(variable_costs=0)}, diff --git a/examples/storage_balanced_unbalanced/storage.py b/examples/storage_balanced_unbalanced/storage.py index d26e8419e..23aa73a5d 100644 --- a/examples/storage_balanced_unbalanced/storage.py +++ b/examples/storage_balanced_unbalanced/storage.py @@ -118,7 +118,7 @@ def storage_example(): es.add( solph.components.GenericStorage( label="storage_elec_{0}".format(name), - nominal_storage_capacity=PARAMETER["nominal_storage_capacity"], + nominal_capacity=PARAMETER["nominal_storage_capacity"], inputs={bel: solph.Flow()}, outputs={bel: solph.Flow()}, initial_storage_level=data_set["initial_storage_level"], diff --git a/examples/storage_costs/storage_costs.py b/examples/storage_costs/storage_costs.py index 39bfae556..90ce6a03a 100644 --- a/examples/storage_costs/storage_costs.py +++ b/examples/storage_costs/storage_costs.py @@ -86,7 +86,7 @@ def storage_costs_example(): # last four time steps but emptying it is not a good option. battery1 = solph.components.GenericStorage( label="battery 1", - nominal_storage_capacity=10, + nominal_capacity=10, inputs={ bel: solph.Flow( nominal_capacity=1, @@ -108,7 +108,7 @@ def storage_costs_example(): # Electric Storage 2 battery2 = solph.components.GenericStorage( label="battery 2", - nominal_storage_capacity=10, + nominal_capacity=10, inputs={ bel: solph.Flow( nominal_capacity=1, diff --git a/examples/storage_investment/v1_invest_optimize_all_technologies.py b/examples/storage_investment/v1_invest_optimize_all_technologies.py index 45c5a1d25..6a3d74fa9 100644 --- a/examples/storage_investment/v1_invest_optimize_all_technologies.py +++ b/examples/storage_investment/v1_invest_optimize_all_technologies.py @@ -192,7 +192,7 @@ def main(): invest_relation_output_capacity=1 / 6, inflow_conversion_factor=1, outflow_conversion_factor=0.8, - nominal_storage_capacity=solph.Investment(ep_costs=epc_storage), + nominal_capacity=solph.Investment(ep_costs=epc_storage), ) energysystem.add(excess, gas_resource, wind, pv, demand, pp_gas, storage) diff --git a/examples/storage_investment/v2_invest_optimize_only_gas_and_storage.py b/examples/storage_investment/v2_invest_optimize_only_gas_and_storage.py index 528059e03..863410bb3 100644 --- a/examples/storage_investment/v2_invest_optimize_only_gas_and_storage.py +++ b/examples/storage_investment/v2_invest_optimize_only_gas_and_storage.py @@ -184,7 +184,7 @@ def main(): invest_relation_output_capacity=1 / 6, inflow_conversion_factor=1, outflow_conversion_factor=0.8, - nominal_storage_capacity=solph.Investment(ep_costs=epc_storage), + nominal_capacity=solph.Investment(ep_costs=epc_storage), ) energysystem.add(excess, gas_resource, wind, pv, demand, pp_gas, storage) diff --git a/examples/storage_investment/v3_invest_optimize_only_storage_with_fossil_share.py b/examples/storage_investment/v3_invest_optimize_only_storage_with_fossil_share.py index 4c254e2be..15a420c26 100644 --- a/examples/storage_investment/v3_invest_optimize_only_storage_with_fossil_share.py +++ b/examples/storage_investment/v3_invest_optimize_only_storage_with_fossil_share.py @@ -194,7 +194,7 @@ def main(): invest_relation_output_capacity=1 / 6, inflow_conversion_factor=1, outflow_conversion_factor=0.8, - nominal_storage_capacity=solph.Investment(ep_costs=epc_storage), + nominal_capacity=solph.Investment(ep_costs=epc_storage), ) energysystem.add(excess, gas_resource, wind, pv, demand, pp_gas, storage) diff --git a/examples/storage_investment/v4_invest_optimize_all_technologies_with_fossil_share.py b/examples/storage_investment/v4_invest_optimize_all_technologies_with_fossil_share.py index 2e9264ff1..d8cfc49c4 100644 --- a/examples/storage_investment/v4_invest_optimize_all_technologies_with_fossil_share.py +++ b/examples/storage_investment/v4_invest_optimize_all_technologies_with_fossil_share.py @@ -203,7 +203,7 @@ def main(): invest_relation_output_capacity=1 / 6, inflow_conversion_factor=1, outflow_conversion_factor=0.8, - nominal_storage_capacity=solph.Investment(ep_costs=epc_storage), + nominal_capacity=solph.Investment(ep_costs=epc_storage), ) energysystem.add(excess, gas_resource, wind, pv, demand, pp_gas, storage) diff --git a/examples/storage_level_constraint/storage_level_constraint.py b/examples/storage_level_constraint/storage_level_constraint.py index cbc237445..247ef9dc0 100644 --- a/examples/storage_level_constraint/storage_level_constraint.py +++ b/examples/storage_level_constraint/storage_level_constraint.py @@ -61,7 +61,7 @@ def storage_level_constraint_example(): storage = GenericStorage( label="storage", - nominal_storage_capacity=3, + nominal_capacity=3, initial_storage_level=1, balanced=True, loss_rate=0.05, diff --git a/examples/time_index_example/non_equidistant_time_step_example.py b/examples/time_index_example/non_equidistant_time_step_example.py index 02c91af34..33f40fb3d 100644 --- a/examples/time_index_example/non_equidistant_time_step_example.py +++ b/examples/time_index_example/non_equidistant_time_step_example.py @@ -87,7 +87,7 @@ def main(): label="storage_fixed", inputs={bus: solph.flows.Flow()}, outputs={bus: solph.flows.Flow()}, - nominal_storage_capacity=8, + nominal_capacity=8, initial_storage_level=1, fixed_losses_absolute=1, # 1 energy unit loss per hour ) @@ -102,7 +102,7 @@ def main(): nominal_capacity=4, max=[0, 0, 0, 0, 0, 0, 0, 1, 1] ) }, - nominal_storage_capacity=8, + nominal_capacity=8, initial_storage_level=1, loss_rate=0.5, # 50 % losses per hour ) diff --git a/examples/time_index_example/simple_time_step_example.py b/examples/time_index_example/simple_time_step_example.py index 868f8f93d..4ff1957eb 100644 --- a/examples/time_index_example/simple_time_step_example.py +++ b/examples/time_index_example/simple_time_step_example.py @@ -70,7 +70,7 @@ def main(): label="storage", inputs={bus: solph.flows.Flow()}, outputs={bus: solph.flows.Flow()}, - nominal_storage_capacity=4, + nominal_capacity=4, initial_storage_level=0.5, ) sink = solph.components.Sink( diff --git a/examples/tuple_as_labels/tuple_as_label.py b/examples/tuple_as_labels/tuple_as_label.py index 50c904851..f8fea8b4e 100644 --- a/examples/tuple_as_labels/tuple_as_label.py +++ b/examples/tuple_as_labels/tuple_as_label.py @@ -237,7 +237,7 @@ def main(): # create storage object representing a battery nominal_storage_capacity = 5000 storage = comp.GenericStorage( - nominal_storage_capacity=nominal_storage_capacity, + nominal_capacity=nominal_storage_capacity, label=Label("storage", "electricity", "battery"), inputs={ bel: flows.Flow(nominal_capacity=nominal_storage_capacity / 6) diff --git a/src/oemof/solph/components/_generic_storage.py b/src/oemof/solph/components/_generic_storage.py index e0e178403..a976114b0 100644 --- a/src/oemof/solph/components/_generic_storage.py +++ b/src/oemof/solph/components/_generic_storage.py @@ -140,7 +140,7 @@ class GenericStorage(Node): >>> my_storage = solph.components.GenericStorage( ... label='storage', - ... nominal_storage_capacity=1000, + ... nominal_capacity=1000, ... inputs={my_bus: solph.flows.Flow(nominal_capacity=200, variable_costs=10)}, ... outputs={my_bus: solph.flows.Flow(nominal_capacity=200)}, ... loss_rate=0.01, @@ -151,7 +151,7 @@ class GenericStorage(Node): >>> my_investment_storage = solph.components.GenericStorage( ... label='storage', - ... nominal_storage_capacity=solph.Investment(ep_costs=50), + ... nominal_capacity=solph.Investment(ep_costs=50), ... inputs={my_bus: solph.flows.Flow()}, ... outputs={my_bus: solph.flows.Flow()}, ... loss_rate=0.02, diff --git a/src/oemof/solph/constraints/shared_limit.py b/src/oemof/solph/constraints/shared_limit.py index 3ab92b965..70a51bbbb 100644 --- a/src/oemof/solph/constraints/shared_limit.py +++ b/src/oemof/solph/constraints/shared_limit.py @@ -69,13 +69,13 @@ def shared_limit( >>> b2 = solph.buses.Bus(label="Party2Bus") >>> storage1 = solph.components.GenericStorage( ... label="Party1Storage", - ... nominal_storage_capacity=5, + ... nominal_capacity=5, ... inputs={b1: solph.flows.Flow()}, ... outputs={b1: solph.flows.Flow()} ... ) >>> storage2 = solph.components.GenericStorage( ... label="Party2Storage", - ... nominal_storage_capacity=5, + ... nominal_capacity=5, ... inputs={b1: solph.flows.Flow()}, ... outputs={b1: solph.flows.Flow()} ... ) diff --git a/tests/test_components.py b/tests/test_components.py index 8618af937..0dbc2d993 100644 --- a/tests/test_components.py +++ b/tests/test_components.py @@ -36,7 +36,7 @@ def test_generic_storage_1(): invest_relation_input_output=1, invest_relation_output_capacity=1, invest_relation_input_capacity=1, - nominal_storage_capacity=Investment(), + nominal_capacity=Investment(), inflow_conversion_factor=1, outflow_conversion_factor=0.8, ) @@ -51,7 +51,7 @@ def test_generic_storage_2(): ): components.GenericStorage( label="storage3", - nominal_storage_capacity=45, + nominal_capacity=45, inputs={bel: Flow(variable_costs=10e10)}, outputs={bel: Flow(variable_costs=10e10)}, loss_rate=0.00, @@ -69,7 +69,7 @@ def test_generic_storage_3(): bel = Bus() components.GenericStorage( label="storage4", - nominal_storage_capacity=45, + nominal_capacity=45, inputs={bel: Flow(nominal_capacity=23, variable_costs=10e10)}, outputs={bel: Flow(nominal_capacity=7.5, variable_costs=10e10)}, loss_rate=0.00, @@ -87,7 +87,7 @@ def test_generic_storage_4(): ): components.GenericStorage( label="storage4", - nominal_storage_capacity=10, + nominal_capacity=10, inputs={bel: Flow(variable_costs=10e10)}, outputs={bel: Flow(variable_costs=10e10)}, loss_rate=0.00, @@ -130,7 +130,7 @@ def test_generic_storage_with_non_convex_invest_maximum(): outputs={bel: Flow()}, invest_relation_input_capacity=1 / 6, invest_relation_output_capacity=1 / 6, - nominal_storage_capacity=Investment(nonconvex=True), + nominal_capacity=Investment(nonconvex=True), ) @@ -146,7 +146,7 @@ def test_generic_storage_with_convex_invest_offset(): outputs={bel: Flow()}, invest_relation_input_capacity=1 / 6, invest_relation_output_capacity=1 / 6, - nominal_storage_capacity=Investment(offset=10), + nominal_capacity=Investment(offset=10), ) @@ -177,9 +177,7 @@ def test_generic_storage_with_invest_and_fixed_losses_absolute(): label="storage4", inputs={bel: Flow()}, outputs={bel: Flow()}, - nominal_storage_capacity=Investment( - ep_costs=23, minimum=0, existing=0 - ), + nominal_capacity=Investment(ep_costs=23, minimum=0, existing=0), fixed_losses_absolute=[0, 0, 4], ) diff --git a/tests/test_constraints/test_storage_level.py b/tests/test_constraints/test_storage_level.py index e55f7a7ed..6c066e162 100644 --- a/tests/test_constraints/test_storage_level.py +++ b/tests/test_constraints/test_storage_level.py @@ -19,7 +19,7 @@ def test_storage_level_constraint(): storage = solph.components.GenericStorage( label="storage", - nominal_storage_capacity=3, + nominal_capacity=3, initial_storage_level=1, balanced=True, storage_costs=0.1, diff --git a/tests/test_non_equidistant_time_index.py b/tests/test_non_equidistant_time_index.py index 24aed8d14..ee6534ed0 100644 --- a/tests/test_non_equidistant_time_index.py +++ b/tests/test_non_equidistant_time_index.py @@ -48,7 +48,7 @@ def setup_class(cls): batt = cmp.GenericStorage( label="storage", - nominal_storage_capacity=1000, + nominal_capacity=1000, inputs={b_el1: flows.Flow(variable_costs=3)}, outputs={b_el1: flows.Flow(variable_costs=2.5)}, loss_rate=0.00, diff --git a/tests/test_processing.py b/tests/test_processing.py index 0299ff627..15b09c096 100644 --- a/tests/test_processing.py +++ b/tests/test_processing.py @@ -67,7 +67,7 @@ def setup_class(cls): invest_relation_output_capacity=1 / 6, inflow_conversion_factor=1, outflow_conversion_factor=0.8, - nominal_storage_capacity=Investment(ep_costs=0.4), + nominal_capacity=Investment(ep_costs=0.4), ) cls.demand_values = [0.0] + [100] * 23 diff --git a/tests/test_scripts/test_solph/test_connect_invest/test_connect_invest.py b/tests/test_scripts/test_solph/test_connect_invest/test_connect_invest.py index 7af2cab04..c518cf402 100644 --- a/tests/test_scripts/test_solph/test_connect_invest/test_connect_invest.py +++ b/tests/test_scripts/test_solph/test_connect_invest/test_connect_invest.py @@ -79,7 +79,7 @@ def test_connect_invest(): invest_relation_output_capacity=1 / 6, inflow_conversion_factor=1, outflow_conversion_factor=0.8, - nominal_storage_capacity=Investment(ep_costs=0.2), + nominal_capacity=Investment(ep_costs=0.2), ) es.add(storage) diff --git a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_dispatch_model.py b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_dispatch_model.py index 3e391938a..83f7a5834 100644 --- a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_dispatch_model.py +++ b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_dispatch_model.py @@ -185,7 +185,7 @@ def test_multi_period_dispatch_model(solver="cbc"): outputs={ bus_el: flows.Flow(nominal_capacity=20, variable_costs=0, max=1) }, - nominal_storage_capacity=20, + nominal_capacity=20, loss_rate=0, initial_storage_level=0, max_storage_level=1, diff --git a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py index fcaf31c93..047afd9e9 100644 --- a/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py +++ b/tests/test_scripts/test_solph/test_multi_period_model/test_multi_period_investment_model.py @@ -265,7 +265,7 @@ def test_multi_period_investment_model(solver="cbc"): invest_relation_input_capacity=None, invest_relation_output_capacity=None, fixed_costs=10, - nominal_storage_capacity=_options.Investment( + nominal_capacity=_options.Investment( maximum=20, ep_costs=1000, existing=10, diff --git a/tests/test_scripts/test_solph/test_storage_investment/test_invest_storage_regression.py b/tests/test_scripts/test_solph/test_storage_investment/test_invest_storage_regression.py index 244556e1f..79d388791 100644 --- a/tests/test_scripts/test_solph/test_storage_investment/test_invest_storage_regression.py +++ b/tests/test_scripts/test_solph/test_storage_investment/test_invest_storage_regression.py @@ -86,7 +86,7 @@ def test_regression_investment_storage(solver="cbc"): invest_relation_output_capacity=1 / 6, inflow_conversion_factor=1, outflow_conversion_factor=0.8, - nominal_storage_capacity=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=50, existing=625046, ), diff --git a/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py b/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py index 478d7273d..e64ee1fe4 100644 --- a/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py +++ b/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py @@ -144,7 +144,7 @@ def test_optimise_storage_size( invest_relation_output_capacity=1 / 6, inflow_conversion_factor=1, outflow_conversion_factor=0.8, - nominal_storage_capacity=solph.Investment( + nominal_capacity=solph.Investment( ep_costs=epc, existing=6851, ), diff --git a/tests/test_scripts/test_solph/test_storage_investment/test_storage_with_tuple_label.py b/tests/test_scripts/test_solph/test_storage_investment/test_storage_with_tuple_label.py index 3027f02fe..e907b9177 100644 --- a/tests/test_scripts/test_solph/test_storage_investment/test_storage_with_tuple_label.py +++ b/tests/test_scripts/test_solph/test_storage_investment/test_storage_with_tuple_label.py @@ -151,7 +151,7 @@ def test_tuples_as_labels_example( energysystem.add( solph.components.GenericStorage( label=Label("storage", "electricity", "battery"), - nominal_storage_capacity=204685, + nominal_capacity=204685, inputs={bel: solph.flows.Flow(variable_costs=10e10)}, outputs={bel: solph.flows.Flow(variable_costs=10e10)}, loss_rate=0.00, From 822d8a783f21ca81d826ff1275723e49f301e7c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 15:35:13 +0200 Subject: [PATCH 09/17] Remove unneccesary code --- src/oemof/solph/flows/_flow.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/oemof/solph/flows/_flow.py b/src/oemof/solph/flows/_flow.py index 6e2d859d8..30f0dd61e 100644 --- a/src/oemof/solph/flows/_flow.py +++ b/src/oemof/solph/flows/_flow.py @@ -192,12 +192,6 @@ def __init__( else: warn(msg, FutureWarning) nominal_capacity = nominal_value - - msg = ( - "\nThe parameter '{0}' is deprecated and will be removed " - + "in version v0.6.\nUse the parameter '{1}', " - + "to avoid this warning and future problems. " - ) # --- END --- super().__init__() From 6909370fe9be4f992b784f1ff54d03bdf846fa38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Thu, 22 Aug 2024 16:06:40 +0200 Subject: [PATCH 10/17] Properly name nominal_capacity in docstring --- src/oemof/solph/components/_generic_storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oemof/solph/components/_generic_storage.py b/src/oemof/solph/components/_generic_storage.py index a976114b0..43bd06946 100644 --- a/src/oemof/solph/components/_generic_storage.py +++ b/src/oemof/solph/components/_generic_storage.py @@ -49,7 +49,7 @@ class GenericStorage(Node): Parameters ---------- - nominal_storage_capacity : numeric, :math:`E_{nom}` or + nominal_capacity : numeric, :math:`E_{nom}` or :class:`oemof.solph.options.Investment` object Absolute nominal capacity of the storage, fixed value or object describing parameter of investment optimisations. From cacc09d0d7848ad2e2165e505fe4542e1ba3ff4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Mon, 25 Nov 2024 17:13:28 +0100 Subject: [PATCH 11/17] Update examples/tuple_as_labels/tuple_as_label.py Co-authored-by: Johannes Kochems <40718083+jokochems@users.noreply.github.com> --- examples/tuple_as_labels/tuple_as_label.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tuple_as_labels/tuple_as_label.py b/examples/tuple_as_labels/tuple_as_label.py index f8fea8b4e..d8c8d3b7e 100644 --- a/examples/tuple_as_labels/tuple_as_label.py +++ b/examples/tuple_as_labels/tuple_as_label.py @@ -237,7 +237,7 @@ def main(): # create storage object representing a battery nominal_storage_capacity = 5000 storage = comp.GenericStorage( - nominal_capacity=nominal_storage_capacity, + nominal_capacity=nominal_capacity, label=Label("storage", "electricity", "battery"), inputs={ bel: flows.Flow(nominal_capacity=nominal_storage_capacity / 6) From 9b137cd87ad647711fb11da33db8df3cb1930b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Mon, 25 Nov 2024 17:13:47 +0100 Subject: [PATCH 12/17] Update examples/tuple_as_labels/tuple_as_label.py Co-authored-by: Johannes Kochems <40718083+jokochems@users.noreply.github.com> --- examples/tuple_as_labels/tuple_as_label.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tuple_as_labels/tuple_as_label.py b/examples/tuple_as_labels/tuple_as_label.py index d8c8d3b7e..3a6a49b25 100644 --- a/examples/tuple_as_labels/tuple_as_label.py +++ b/examples/tuple_as_labels/tuple_as_label.py @@ -235,7 +235,7 @@ def main(): ) # create storage object representing a battery - nominal_storage_capacity = 5000 + nominal_capacity = 5000 storage = comp.GenericStorage( nominal_capacity=nominal_capacity, label=Label("storage", "electricity", "battery"), From b98016796ff88f71b9b6ec61f7c1b9e216200e2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Mon, 25 Nov 2024 17:23:51 +0100 Subject: [PATCH 13/17] Apply suggestions from code review Co-authored-by: Johannes Kochems <40718083+jokochems@users.noreply.github.com> --- docs/whatsnew/v0-6-0.rst | 2 +- examples/tuple_as_labels/tuple_as_label.py | 4 ++-- src/oemof/solph/components/_generic_storage.py | 2 +- src/oemof/solph/flows/_flow.py | 4 ++-- tests/test_flows/test_simple_flow.py | 2 +- .../test_storage_investment/test_storage_investment.py | 2 +- .../test_solph/test_variable_chp/test_variable_chp.py | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/whatsnew/v0-6-0.rst b/docs/whatsnew/v0-6-0.rst index 5b95cd94b..6808ba412 100644 --- a/docs/whatsnew/v0-6-0.rst +++ b/docs/whatsnew/v0-6-0.rst @@ -11,7 +11,7 @@ API changes initial storage level is defined, the costs just offset the objective value without changing anything else. * The parameters `GenericStorage.nominal_storage_capacity` and - `Flow.nominal_capacity` are now both called `nominal_calacity`. + `Flow.nominal_capacity` are now both called `nominal_capacity`. New features ############ diff --git a/examples/tuple_as_labels/tuple_as_label.py b/examples/tuple_as_labels/tuple_as_label.py index 3a6a49b25..d72bd8d24 100644 --- a/examples/tuple_as_labels/tuple_as_label.py +++ b/examples/tuple_as_labels/tuple_as_label.py @@ -240,10 +240,10 @@ def main(): nominal_capacity=nominal_capacity, label=Label("storage", "electricity", "battery"), inputs={ - bel: flows.Flow(nominal_capacity=nominal_storage_capacity / 6) + bel: flows.Flow(nominal_capacity=nominal_capacity / 6) }, outputs={ - bel: flows.Flow(nominal_capacity=nominal_storage_capacity / 6) + bel: flows.Flow(nominal_capacity=nominal_capacity / 6) }, loss_rate=0.00, initial_storage_level=None, diff --git a/src/oemof/solph/components/_generic_storage.py b/src/oemof/solph/components/_generic_storage.py index 43bd06946..ca8d323d9 100644 --- a/src/oemof/solph/components/_generic_storage.py +++ b/src/oemof/solph/components/_generic_storage.py @@ -218,7 +218,7 @@ def __init__( if nominal_storage_capacity is not None: msg = ( "For backward compatibility," - " the option nominal_storage_capacity overwrites the option" + + " the option nominal_storage_capacity overwrites the option" + " nominal_capacity." + " Both options cannot be set at the same time." ) diff --git a/src/oemof/solph/flows/_flow.py b/src/oemof/solph/flows/_flow.py index 30f0dd61e..3ebb9051e 100644 --- a/src/oemof/solph/flows/_flow.py +++ b/src/oemof/solph/flows/_flow.py @@ -183,8 +183,8 @@ def __init__( if nominal_value is not None: msg = ( "For backward compatibility," - " the option nominal_value overwrites the option" - " nominal_capacity." + + " the option nominal_value overwrites the option" + + " nominal_capacity." + " Both options cannot be set at the same time." ) if nominal_capacity is not None: diff --git a/tests/test_flows/test_simple_flow.py b/tests/test_flows/test_simple_flow.py index e5c74ed91..6612b77dc 100644 --- a/tests/test_flows/test_simple_flow.py +++ b/tests/test_flows/test_simple_flow.py @@ -59,7 +59,7 @@ def test_full_load_time_min(): # --- BEGIN: The following code can be removed for versions >= v0.7 --- def test_nominal_capacity_warning(): - with pytest.warns(FutureWarning, match="nominal_capacity"): + with pytest.warns(FutureWarning, match="nominal_value"): _ = solph.flows.Flow(nominal_value=2) diff --git a/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py b/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py index e64ee1fe4..89cbf2b61 100644 --- a/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py +++ b/tests/test_scripts/test_solph/test_storage_investment/test_storage_investment.py @@ -125,7 +125,7 @@ def test_optimise_storage_size( label="pp_gas", inputs={bgas: solph.flows.Flow()}, outputs={ - bel: solph.flows.Flow(nominal_capacity=10e10, variable_costs=50) + bel: solph.flows.Flow(nominal_capacity=1e11, variable_costs=50) }, conversion_factors={bel: 0.58}, ) diff --git a/tests/test_scripts/test_solph/test_variable_chp/test_variable_chp.py b/tests/test_scripts/test_solph/test_variable_chp/test_variable_chp.py index 0f9f4c514..49a4a5dd4 100644 --- a/tests/test_scripts/test_solph/test_variable_chp/test_variable_chp.py +++ b/tests/test_scripts/test_solph/test_variable_chp/test_variable_chp.py @@ -130,7 +130,7 @@ def test_variable_chp(filename="variable_chp.csv", solver="cbc"): energysystem.add( solph.components.Converter( label=("fixed_chp", "gas"), - inputs={bgas: solph.flows.Flow(nominal_capacity=10e10)}, + inputs={bgas: solph.flows.Flow(nominal_capacity=1e11)}, outputs={bel2: solph.flows.Flow(), bth2: solph.flows.Flow()}, conversion_factors={bel2: 0.3, bth2: 0.5}, ) @@ -140,7 +140,7 @@ def test_variable_chp(filename="variable_chp.csv", solver="cbc"): energysystem.add( solph.components.ExtractionTurbineCHP( label=("variable_chp", "gas"), - inputs={bgas: solph.flows.Flow(nominal_capacity=10e10)}, + inputs={bgas: solph.flows.Flow(nominal_capacity=1e11)}, outputs={bel: solph.flows.Flow(), bth: solph.flows.Flow()}, conversion_factors={bel: 0.3, bth: 0.5}, conversion_factor_full_condensation={bel: 0.5}, From 988da2b0eed2e67478e44672157a96e7adf8f659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Mon, 25 Nov 2024 17:26:21 +0100 Subject: [PATCH 14/17] Update tests/test_components/test_storage.py --- tests/test_components/test_storage.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_components/test_storage.py b/tests/test_components/test_storage.py index ec6494456..f14e2f9af 100644 --- a/tests/test_components/test_storage.py +++ b/tests/test_components/test_storage.py @@ -366,6 +366,4 @@ def test_capacity_keyword_wrapper_error(): inputs={bus: solph.Flow()}, outputs={bus: solph.Flow()}, ) - - # --- END --- From f3e4d7ced98becc5c2a9c2ab031245c6df990534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Mon, 25 Nov 2024 17:27:57 +0100 Subject: [PATCH 15/17] Adhere to Black --- examples/tuple_as_labels/tuple_as_label.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/tuple_as_labels/tuple_as_label.py b/examples/tuple_as_labels/tuple_as_label.py index d72bd8d24..3e0290ce5 100644 --- a/examples/tuple_as_labels/tuple_as_label.py +++ b/examples/tuple_as_labels/tuple_as_label.py @@ -239,12 +239,8 @@ def main(): storage = comp.GenericStorage( nominal_capacity=nominal_capacity, label=Label("storage", "electricity", "battery"), - inputs={ - bel: flows.Flow(nominal_capacity=nominal_capacity / 6) - }, - outputs={ - bel: flows.Flow(nominal_capacity=nominal_capacity / 6) - }, + inputs={bel: flows.Flow(nominal_capacity=nominal_capacity / 6)}, + outputs={bel: flows.Flow(nominal_capacity=nominal_capacity / 6)}, loss_rate=0.00, initial_storage_level=None, inflow_conversion_factor=1, From 444b685089df9418b1b3e7300943fde596086416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Mon, 25 Nov 2024 17:41:23 +0100 Subject: [PATCH 16/17] Adhere to Black --- tests/test_components/test_storage.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_components/test_storage.py b/tests/test_components/test_storage.py index f14e2f9af..ec6494456 100644 --- a/tests/test_components/test_storage.py +++ b/tests/test_components/test_storage.py @@ -366,4 +366,6 @@ def test_capacity_keyword_wrapper_error(): inputs={bus: solph.Flow()}, outputs={bus: solph.Flow()}, ) + + # --- END --- From 445ee9faaa9d735de293d4401d40da962685e836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Sch=C3=B6nfeldt?= Date: Tue, 26 Nov 2024 09:48:41 +0100 Subject: [PATCH 17/17] Fix v0.6.0 whatsnew --- docs/whatsnew/v0-6-0.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/whatsnew/v0-6-0.rst b/docs/whatsnew/v0-6-0.rst index f5db57b34..aaf86994a 100644 --- a/docs/whatsnew/v0-6-0.rst +++ b/docs/whatsnew/v0-6-0.rst @@ -11,7 +11,7 @@ API changes initial storage level is defined, the costs just offset the objective value without changing anything else. * The parameters `GenericStorage.nominal_storage_capacity` and - `Flow.nominal_capacity` are now both called `nominal_capacity`. + `Flow.nominal_value` are now both called `nominal_capacity`. New features ############ @@ -36,3 +36,4 @@ Contributors ############ * Patrik Schönfeldt +* Johannes Kochems