Skip to content

Commit

Permalink
Merge dev into docs/make-style-modern
Browse files Browse the repository at this point in the history
  • Loading branch information
fwitte committed Jan 14, 2025
2 parents 578efeb + 718b377 commit 6b76d50
Show file tree
Hide file tree
Showing 107 changed files with 888 additions and 1,018 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: "3.10"

- name: Install Python dependencies
run: pip install black flake8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.9]
python-version: ["3.10"]

steps:
- uses: actions/checkout@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tox_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:
- name: Git clone
uses: actions/checkout@v2

- name: Set up Python ${{ env.default_python || '3.9' }}
- name: Set up Python ${{ env.default_python || '3.10' }}
uses: actions/setup-python@v5
with:
python-version: "${{ env.default_python || '3.9' }}"
python-version: "${{ env.default_python || '3.10' }}"

- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}-${{ hashFiles('tox.ini', 'setup.py') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tox_pytests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ on:
- cron: "0 5 * * 6" # 5:00 UTC every Saturday

jobs:
build:
pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9, "3.10", "3.11"]
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v1
Expand Down
11 changes: 6 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

------------------------------

.. |tox-pytest| image:: https://github.com/oemof/oemof-solph/workflows/tox%20pytests/badge.svg?branch=dev
.. |tox-pytest| image:: https://github.com/oemof/oemof-solph/actions/workflows/tox_pytests.yml/badge.svg?branch=dev
:target: https://github.com/oemof/oemof-solph/actions?query=workflow%3A%22tox+checks%22

.. |tox-checks| image:: https://github.com/oemof/oemof-solph/workflows/tox%20checks/badge.svg?branch=dev
.. |tox-checks| image:: https://github.com/oemof/oemof-solph/actions/workflows/tox_checks.yml/badge.svg?branch=dev
:target: https://github.com/oemof/oemof-solph/actions?query=workflow%3A%22tox+checks%22

.. |packaging| image:: https://github.com/oemof/oemof-solph/workflows/packaging/badge.svg?branch=dev
.. |packaging| image:: https://github.com/oemof/oemof-solph/actions/workflows/packaging.yml/badge.svg
:target: https://github.com/oemof/oemof-solph/actions?query=workflow%3Apackaging

.. |docs| image:: https://readthedocs.org/projects/oemof-solph/badge/?style=flat
Expand Down Expand Up @@ -165,7 +165,8 @@ There are several solvers that can work with oemof, both open source and commerc
Two open source solvers are widely used (CBC and GLPK), but oemof suggests CBC (Coin-or branch and cut).
It may be useful to compare results of different solvers to see which performs best.
Other commercial solvers, like Gurobi or Cplex, are also options.
Have a look at the `pyomo docs <https://pyomo.readthedocs.io/en/stable/solving_pyomo_models.html#supported-solvers>`_ to learn about which solvers are supported.
Have a look at the `pyomo docs <https://pyomo.readthedocs.io/en/stable/api/pyomo.solvers.plugins.solvers.html>`_
to learn about which solvers are supported.

Check the solver installation by executing the test_installation example below (see section Installation Test).

Expand All @@ -188,7 +189,7 @@ Check the solver installation by executing the test_installation example (see th

Please follow the installation instructions on the respective homepages for details.

CBC-solver: https://projects.coin-or.org/Cbc
CBC-solver: https://github.com/coin-or/Cbc

GLPK-solver: http://arnab-deka.com/posts/2010/02/installing-glpk-on-a-mac/

Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
These are new features and improvements of note in each release

.. include:: whatsnew/v0-6-0.rst
.. include:: whatsnew/v0-5-6.rst
.. include:: whatsnew/v0-5-5.rst
.. include:: whatsnew/v0-5-4.rst
.. include:: whatsnew/v0-5-3.rst
Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,6 @@ def setup(app):
r"https://forum.openmod-initiative.org/*",
r"https://github.com/oemof/oemof-solph/issues/*",
r"https://github.com/oemof/oemof-solph/pull/*",
# Due to traffic limitation, the folowwing creates a 403 in CI pipeline:
"https://www.sciencedirect.com/science/article/abs/pii/S036054421500331X",
]
89 changes: 40 additions & 49 deletions docs/usage.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/whatsnew/v0-2-2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/oemof/oemof-solph/pull/480>`_).
Expand Down
2 changes: 1 addition & 1 deletion docs/whatsnew/v0-5-1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/whatsnew/v0-5-3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions docs/whatsnew/v0-5-6.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
v0.5.6 (November 26th, 2024)
----------------------------

Bug fixes
#########

* Update required Pyomo version to allow working with numpy >= 2.0.0.

Known issues
############

* Indexing of Storage with capacity investment is off by one.

Contributors
############

* Patrik Schönfeldt
17 changes: 15 additions & 2 deletions docs/whatsnew/v0-6-0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ 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.
* Tansitional wrappers that still allowed to use "Transformer" and
"OffsetTransformer" have been removed. Use of the new names
("Converter" and "OffsetConverter") is now obligatory.
* Tansitional wrappers that still allowed to use "investment",
"summed_min", and "summed_max" as arguments to initialise a Flow
have been removed. Use of the new names ("nominal_value",
"full_load_time_min", and "full_load_time_max") is now obligatory.
* Rename custom_attributes to custom_properties for all Nodes.
Setting the oemof.network.Node.custom_properties
using an argument called "custom_attributes" was rather confusing.
Additionally, the class Bus already called the argument
"custom_properties".
* The parameters `GenericStorage.nominal_storage_capacity` and
`Flow.nominal_value` are now both called `nominal_capacity`.

New features
############
Expand All @@ -29,10 +43,9 @@ Other changes
Known issues
############

* Incompatible to numpy >= 2.0.0. This is because of Pyomo, but we have to
enforce a lower version in our package.

Contributors
############

* Patrik Schönfeldt
* Johannes Kochems
6 changes: 3 additions & 3 deletions examples/activity_costs/activity_costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand All @@ -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)
Expand Down
20 changes: 11 additions & 9 deletions examples/basic_example/basic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
},
)
Expand All @@ -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
)
},
)
Expand All @@ -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},
Expand All @@ -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,
nominal_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,
Expand Down
14 changes: 8 additions & 6 deletions examples/dual_variable_example/dual_variable_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ 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)},
)
)

# create simple sink object representing the electrical demand
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)},
)
)

Expand All @@ -215,19 +215,21 @@ 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},
)
)

# 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_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,
Expand Down
16 changes: 9 additions & 7 deletions examples/electrical/transshipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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},
)
Expand All @@ -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])},
)
)

Expand Down
8 changes: 5 additions & 3 deletions examples/emission_constraint/emission_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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],
)
},
)
Expand All @@ -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},
)
)
Expand Down
Loading

0 comments on commit 6b76d50

Please sign in to comment.