Skip to content

Commit

Permalink
Change deprecated API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
p-snft committed Oct 12, 2023
1 parent b5b3a81 commit 63e699e
Show file tree
Hide file tree
Showing 44 changed files with 277 additions and 229 deletions.
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 @@ -1144,7 +1144,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 @@ -1178,7 +1178,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 @@ -1466,12 +1466,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
6 changes: 2 additions & 4 deletions examples/generic_invest_limit/example_generic_invest.py
Original file line number Diff line number Diff line change
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,12 @@ 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,12 @@ 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
6 changes: 3 additions & 3 deletions src/oemof/solph/_energy_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(
"consistent.\nIf you are not considering non-equidistant "
"timeindices, consider only specifying a timeindex."
)
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 @@ -151,7 +151,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 @@ -170,7 +170,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.periods = periods
self._extract_periods_years()
self._extract_periods_matrix()
Expand Down
2 changes: 1 addition & 1 deletion src/oemof/solph/components/_generic_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class GenericStorage(Node):
>>> my_investment_storage = solph.components.GenericStorage(
... label='storage',
... investment=solph.Investment(ep_costs=50),
... nominal_storage_capacity=solph.Investment(ep_costs=50),
... inputs={my_bus: solph.flows.Flow()},
... outputs={my_bus: solph.flows.Flow()},
... loss_rate=0.02,
Expand Down
4 changes: 2 additions & 2 deletions src/oemof/solph/constraints/equate_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,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(
... investment=solph.Investment(ep_costs=20))}))
... nominal_value=solph.Investment(ep_costs=20))}))
>>> energysystem.add(solph.components.Converter(
... label='powerline_2_1',
... inputs={bel2: solph.flows.Flow()},
... outputs={bel1: solph.flows.Flow(
... investment=solph.Investment(ep_costs=20))}))
... nominal_value=solph.Investment(ep_costs=20))}))
>>> om = solph.Model(energysystem)
>>> line12 = energysystem.groups['powerline_1_2']
>>> line21 = energysystem.groups['powerline_2_1']
Expand Down
4 changes: 2 additions & 2 deletions src/oemof/solph/constraints/investment_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ def additional_investment_flow_limit(model, keyword, limit=None):
... solph.flows.Flow(nominal_value=10, fix=[10, 20, 30, 40, 50])})
>>> src1 = solph.components.Source(
... label='source_0', outputs={bus: solph.flows.Flow(
... investment=solph.Investment(
... nominal_value=solph.Investment(
... ep_costs=50, custom_attributes={"space": 4},
... ))
... })
>>> src2 = solph.components.Source(
... label='source_1', outputs={bus: solph.flows.Flow(
... investment=solph.Investment(
... nominal_value=solph.Investment(
... ep_costs=100, custom_attributes={"space": 1},
... ))
... })
Expand Down
Loading

0 comments on commit 63e699e

Please sign in to comment.