Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/eliminate warnings #990

Merged
merged 30 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c4f9365
Delete useless test
p-snft Oct 11, 2023
860b742
Disuse network.Bus in warnings test
p-snft Oct 11, 2023
55f3fdc
Disuse subclasses of oemof.network.Node
p-snft Oct 11, 2023
ecb8c25
Use pytest.approx(x) instead of int(round(x))
p-snft Oct 11, 2023
3e02fc5
Embrace conformity
p-snft Oct 11, 2023
962abb6
Use full_load_time_min instead of summed_min
p-snft Oct 11, 2023
aa43b30
Sort imports
p-snft Oct 11, 2023
0156477
Delete unused import
p-snft Oct 11, 2023
91b14c2
Merge branch 'dev' into fix/eliminate_warnings
p-snft Oct 12, 2023
b5b3a81
Merge branch 'dev' into fix/eliminate_warnings
p-snft Oct 12, 2023
63e699e
Change deprecated API calls
p-snft Oct 12, 2023
fc403d3
Fix wrong replacement in TestsConstraint
p-snft Oct 12, 2023
01ebeaa
Fix implicit time step inference
p-snft Oct 12, 2023
f677ad9
Adhere to Black
p-snft Oct 12, 2023
f9c79ab
Adhere to Black
p-snft Oct 12, 2023
9fe9389
Merge branch 'dev' into fix/eliminate_warnings
p-snft Oct 12, 2023
2129b0a
Delete warning about timeincrement in EnergySystem
p-snft Oct 12, 2023
240746c
Fix include of example_genergic_invest
p-snft Oct 12, 2023
442c3a6
Avoid DataFrame.groupby(*args, axis=1, **kwargs)
p-snft Oct 12, 2023
1a681f0
Ignore ExperimentalFeatureWarning in pytest
p-snft Oct 12, 2023
b3ba6f2
Adhere to Black
p-snft Oct 12, 2023
8ef4c4c
Include pytest.ini in MANIFEST
p-snft Oct 13, 2023
cfc6966
Revert "Ignore ExperimentalFeatureWarning in pytest"
p-snft Oct 13, 2023
99385e6
Revert "Include pytest.ini in MANIFEST"
p-snft Oct 13, 2023
ceba43d
Delete tangling white space in docs
p-snft Oct 13, 2023
a849327
Merge branch 'dev' into fix/eliminate_warnings
p-snft Oct 13, 2023
6cb4bbf
Test Future warning in Flow invenstment
p-snft Oct 13, 2023
321a35a
Revert "Delete warning about timeincrement in EnergySystem"
p-snft Oct 16, 2023
561688d
Tell about need for timeincrement in MP models
p-snft Oct 16, 2023
5cb5b72
Merge branch 'dev' into fix/eliminate_warnings
jokochems Oct 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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(investment= solph.Investment(ep_costs=500))},
outputs={b_el: solph.flows.Flow(investment= solph.Investment(ep_costs=500)},
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)},
loss_rate=0.001,
inflow_conversion_factor=0.98, outflow_conversion_factor=0.8),
investment = solph.Investment(ep_costs=40))
Expand Down Expand Up @@ -912,7 +912,7 @@ turbines.

solph.components.Source(label='new_wind_pp', outputs={electricity: solph.flows.Flow(
fix=wind_power_time_series,
investment=solph.Investment(ep_costs=epc, maximum=50000))})
nominal_value=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
Expand All @@ -922,7 +922,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,
investment=solph.Investment(ep_costs=epc,
nominal_value=solph.Investment(ep_costs=epc,
maximum=30000,
existing=20000))})

Expand Down Expand Up @@ -957,7 +957,7 @@ example of a converter:
label='converter_nonconvex',
inputs={bus_0: solph.flows.Flow()},
outputs={bus_1: solph.flows.Flow(
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=4,
maximum=100,
minimum=20,
Expand Down Expand Up @@ -1143,7 +1143,7 @@ Here is an example
inputs={hydrogen_bus: solph.flows.Flow()},
outputs={
electricity_bus: solph.flows.Flow(
investment=solph.Investment(
nominal_value=solph.Investment(
maximum=1000,
ep_costs=1e6,
lifetime=30,
Expand Down Expand Up @@ -1177,7 +1177,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(
investment=solph.Investment(
nominal_value=solph.Investment(
maximum=1000,
ep_costs=[1e6, 1.1e6],
lifetime=30,
Expand Down Expand Up @@ -1472,12 +1472,11 @@ This nonlinearity is linearised in the
inputs={b_diesel: solph.flows.Flow()},
outputs={
b_el: solph.flows.Flow(
nominal_value=None,
variable_costs=0.04,
min=0.2,
max=1,
nonconvex=solph.NonConvex(),
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=90,
maximum=150, # required for the linearization
),
Expand Down
2 changes: 1 addition & 1 deletion examples/electrical/lopf.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def main():
input=b_el0,
output=b_el1,
reactance=0.0001,
investment=Investment(ep_costs=10),
nominal_value=Investment(ep_costs=10),
min=-1,
max=1,
)
Expand Down
4 changes: 2 additions & 2 deletions examples/electrical/transshipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def main():
label="line_0",
inputs={b_0: Flow(), b_1: Flow()},
outputs={
b_1: Flow(investment=Investment()),
b_0: Flow(investment=Investment()),
b_1: Flow(nominal_value=Investment()),
b_0: Flow(nominal_value=Investment()),
},
conversion_factors={(b_0, b_1): 0.95, (b_1, b_0): 0.9},
)
Expand Down
8 changes: 3 additions & 5 deletions examples/generic_invest_limit/example_generic_invest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

.. literalinclude:: /../examples/generic_invest_limit/example_generic_invest.py
:language: python
:lines: 62-219
:lines: 62-

Installation requirements
-------------------------
Expand Down Expand Up @@ -141,8 +141,7 @@ def main():
inputs={bus_a_0: solph.Flow()},
outputs={
bus_a_1: solph.Flow(
nominal_value=None,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_invest,
custom_attributes={"space": 2},
),
Expand All @@ -159,8 +158,7 @@ def main():
inputs={bus_b_0: solph.Flow()},
outputs={
bus_b_1: solph.Flow(
nominal_value=None,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_invest,
custom_attributes={"space": 1},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ def main():
outputs={
b_el_dc: solph.flows.Flow(
fix=solar_potential / peak_solar_potential,
nominal_value=None,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_pv * n_days / n_days_in_year
),
variable_costs=0,
Expand All @@ -157,11 +156,10 @@ def main():
inputs={b_diesel: solph.flows.Flow()},
outputs={
b_el_ac: solph.flows.Flow(
nominal_value=None,
variable_costs=variable_cost_diesel_genset,
min=min_load,
max=max_load,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_diesel_genset * n_days / n_days_in_year,
maximum=2 * peak_demand,
),
Expand All @@ -177,8 +175,7 @@ def main():
label="rectifier",
inputs={
b_el_ac: solph.flows.Flow(
nominal_value=None,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_rectifier * n_days / n_days_in_year
),
variable_costs=0,
Expand All @@ -196,8 +193,7 @@ def main():
label="inverter",
inputs={
b_el_dc: solph.flows.Flow(
nominal_value=None,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_inverter * n_days / n_days_in_year
),
variable_costs=0,
Expand All @@ -213,13 +209,14 @@ def main():
epc_battery = 101.00 # currency/kWh/year
battery = solph.components.GenericStorage(
label="battery",
nominal_storage_capacity=None,
investment=solph.Investment(
nominal_storage_capacity=solph.Investment(
ep_costs=epc_battery * n_days / n_days_in_year
),
inputs={b_el_dc: solph.flows.Flow(variable_costs=0)},
outputs={
b_el_dc: solph.flows.Flow(investment=solph.Investment(ep_costs=0))
b_el_dc: solph.flows.Flow(
nominal_value=solph.Investment(ep_costs=0)
)
},
initial_storage_level=0.0,
min_storage_level=0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def heat_demand(d):
minimum_uptime=5,
initial_status=1,
),
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc,
minimum=1.0,
maximum=10.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def solar_thermal(d):
outputs={
b_heat: solph.flows.Flow(
fix=[solar_thermal(day) for day in range(0, periods)],
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc, minimum=1.0, maximum=5.0
),
)
Expand Down
3 changes: 1 addition & 2 deletions examples/investment_with_minimal_invest/minimal_invest.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ def main():
inputs={bus_0: solph.Flow()},
outputs={
bus_1: solph.Flow(
nominal_value=None,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=c_var,
maximum=p_install_max,
minimum=p_install_min,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ def offset_converter_example():
outputs={
b_el_dc: solph.flows.Flow(
fix=solar_potential / peak_solar_potential,
nominal_value=None,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_pv * n_days / n_days_in_year
),
variable_costs=0,
Expand Down Expand Up @@ -168,11 +167,10 @@ def offset_converter_example():
inputs={b_diesel: solph.flows.Flow()},
outputs={
b_el_ac: solph.flows.Flow(
nominal_value=None,
variable_costs=variable_cost_diesel_genset,
min=min_load,
max=max_load,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_diesel_genset * n_days / n_days_in_year,
maximum=2 * peak_demand,
),
Expand All @@ -188,8 +186,7 @@ def offset_converter_example():
label="rectifier",
inputs={
b_el_ac: solph.flows.Flow(
nominal_value=None,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_rectifier * n_days / n_days_in_year
),
variable_costs=0,
Expand All @@ -207,8 +204,7 @@ def offset_converter_example():
label="inverter",
inputs={
b_el_dc: solph.flows.Flow(
nominal_value=None,
investment=solph.Investment(
nominal_value=solph.Investment(
ep_costs=epc_inverter * n_days / n_days_in_year
),
variable_costs=0,
Expand All @@ -224,13 +220,14 @@ def offset_converter_example():
epc_battery = 101.00 # currency/kWh/year
battery = solph.components.GenericStorage(
label="battery",
nominal_storage_capacity=None,
investment=solph.Investment(
nominal_storage_capacity=solph.Investment(
ep_costs=epc_battery * n_days / n_days_in_year
),
inputs={b_el_dc: solph.flows.Flow(variable_costs=0)},
outputs={
b_el_dc: solph.flows.Flow(investment=solph.Investment(ep_costs=0))
b_el_dc: solph.flows.Flow(
nominal_value=solph.Investment(ep_costs=0)
)
},
initial_storage_level=0.0,
min_storage_level=0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def main():
outputs={
bel: solph.Flow(
fix=data["wind"],
investment=solph.Investment(ep_costs=epc_wind),
nominal_value=solph.Investment(ep_costs=epc_wind),
)
},
)
Expand All @@ -161,7 +161,7 @@ def main():
label="pv",
outputs={
bel: solph.Flow(
fix=data["pv"], investment=solph.Investment(ep_costs=epc_pv)
fix=data["pv"], nominal_value=solph.Investment(ep_costs=epc_pv)
)
},
)
Expand Down Expand Up @@ -191,7 +191,7 @@ def main():
invest_relation_output_capacity=1 / 6,
inflow_conversion_factor=1,
outflow_conversion_factor=0.8,
investment=solph.Investment(ep_costs=epc_storage),
nominal_value=solph.Investment(ep_costs=epc_storage),
)

energysystem.add(excess, gas_resource, wind, pv, demand, pp_gas, storage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def main():
invest_relation_output_capacity=1 / 6,
inflow_conversion_factor=1,
outflow_conversion_factor=0.8,
investment=solph.Investment(ep_costs=epc_storage),
nominal_value=solph.Investment(ep_costs=epc_storage),
)

energysystem.add(excess, gas_resource, wind, pv, demand, pp_gas, storage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def main():
invest_relation_output_capacity=1 / 6,
inflow_conversion_factor=1,
outflow_conversion_factor=0.8,
investment=solph.Investment(ep_costs=epc_storage),
nominal_value=solph.Investment(ep_costs=epc_storage),
)

energysystem.add(excess, gas_resource, wind, pv, demand, pp_gas, storage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def main():
outputs={
bel: solph.Flow(
fix=data["wind"],
investment=solph.Investment(ep_costs=epc_wind),
nominal_value=solph.Investment(ep_costs=epc_wind),
)
},
)
Expand All @@ -172,7 +172,7 @@ def main():
label="pv",
outputs={
bel: solph.Flow(
fix=data["pv"], investment=solph.Investment(ep_costs=epc_pv)
fix=data["pv"], nominal_value=solph.Investment(ep_costs=epc_pv)
)
},
)
Expand Down
9 changes: 4 additions & 5 deletions src/oemof/solph/_energy_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,9 @@ def __init__(
else:
msg = (
"Ensure that your timeindex and timeincrement are "
"consistent.\nIf you are not considering non-equidistant "
"timeindices, consider only specifying a timeindex."
"consistent."
)
warnings.warn(msg, debugging.SuspiciousUsageWarning)
warnings.warn(msg, debugging.ExperimentalFeatureWarning)

elif timeindex is not None and timeincrement is None:
df = pd.DataFrame(timeindex)
Expand All @@ -156,7 +155,7 @@ def __init__(
if timeincrement is not None and (pd.Series(timeincrement) <= 0).any():
msg = (
"The time increment is inconsistent. Negative values and zero "
"is not allowed.\nThis is caused by a inconsistent "
"are not allowed.\nThis is caused by a inconsistent "
"timeincrement parameter or an incorrect timeindex."
)
raise TypeError(msg)
Expand All @@ -176,7 +175,7 @@ def __init__(
"now. If you find anything suspicious or any bugs, "
"please report them."
)
warnings.warn(msg, debugging.SuspiciousUsageWarning)
warnings.warn(msg, debugging.ExperimentalFeatureWarning)
self._extract_periods_years()
self._extract_periods_matrix()
self._extract_end_year_of_optimization()
Expand Down
4 changes: 2 additions & 2 deletions src/oemof/solph/buses/_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

"""

from oemof.network import network as on
from oemof.network import Node
from pyomo.core import BuildAction
from pyomo.core import Constraint
from pyomo.core.base.block import ScalarBlock


class Bus(on.Bus):
class Bus(Node):
"""A balance object. Every component has to be connected to buses.

The sum of all inputs of a Bus object must equal the sum of all outputs
Expand Down
4 changes: 2 additions & 2 deletions src/oemof/solph/components/_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from warnings import warn

from oemof.network import network as on
from oemof.network import Node
from pyomo.core import BuildAction
from pyomo.core import Constraint
from pyomo.core.base.block import ScalarBlock
Expand All @@ -32,7 +32,7 @@
from oemof.solph._plumbing import sequence


class Converter(on.Transformer):
class Converter(Node):
"""A linear ConverterBlock object with n inputs and n outputs.

Node object that relates any number of inflow and outflows with
Expand Down
Loading
Loading