Skip to content

Commit

Permalink
Remove output_unit
Browse files Browse the repository at this point in the history
This was only used as informative string. Not needed any longer.
  • Loading branch information
lumbric committed May 8, 2024
1 parent c70643a commit 29801d8
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 104 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ node1 = NodeScalableInput(
name="node1",
input_profile=random_time_series(),
costs=10,
output_unit="MW",
)
```

Expand All @@ -89,7 +88,6 @@ node2 = NodeFixInput(
name="node2",
costs=0,
input_flow=random_time_series(),
output_unit="t",
)

```
Expand All @@ -100,7 +98,6 @@ node3 = Node(
inputs=[node1, node2],
input_commodities="electricity",
costs=42,
output_unit="t",
)

```
Expand All @@ -111,7 +108,6 @@ node4 = Node(
inputs=[node1, node2],
input_commodities=["co2", "hydrogen"],
costs=8,
output_unit="t",
input_proportions={"node1": 0.25, "node2": 0.75},
)
```
Expand All @@ -122,7 +118,6 @@ node5 = Node(
inputs=[node2, node3],
input_commodities="electricity",
costs=7,
output_unit="t",
storage=Storage(
costs=200,
max_charging_speed=0.2,
Expand Down
32 changes: 2 additions & 30 deletions notebooks/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@
" name=\"wind\",\n",
" input_profile=random_time_series(),\n",
" costs=5,\n",
" output_unit=\"MW\",\n",
")\n",
"demand = NodeFixOutput(\n",
" name=\"demand\",\n",
" inputs=[wind],\n",
" input_commodities='electricity',\n",
" output_unit='MW',\n",
" costs=0,\n",
" output_flow=random_time_series(),\n",
")\n",
Expand Down Expand Up @@ -93,49 +91,42 @@
" name=\"solar_pv\",\n",
" input_profile=random_time_series(),\n",
" costs=10,\n",
" output_unit=\"MW\",\n",
")\n",
"wind = NodeScalableInput(\n",
" name=\"wind\",\n",
" input_profile=random_time_series(),\n",
" costs=5,\n",
" output_unit=\"MW\",\n",
")\n",
"co2 = NodeFixInput(\n",
" name=\"co2\",\n",
" costs=0,\n",
" input_flow=random_time_series(),\n",
" output_unit=\"t\",\n",
")\n",
"\n",
"curtail = Node(\n",
" name=\"curtail\",\n",
" inputs=[solar_pv, wind],\n",
" input_commodities=\"electricity\",\n",
" costs=0,\n",
" output_unit=\"t\",\n",
")\n",
"hydrogen = Node(\n",
" name=\"hydrogen\",\n",
" inputs=[solar_pv, wind],\n",
" input_commodities=\"electricity\",\n",
" costs=7,\n",
" output_unit=\"t\",\n",
")\n",
"curtail_h2 = Node(\n",
" name=\"curtail_h2\",\n",
" inputs=[hydrogen],\n",
" input_commodities=\"hydrogen\",\n",
" costs=0,\n",
" output_unit=\"t\",\n",
")\n",
"\n",
"methanol_synthesis = Node(\n",
" name=\"methanol_synthesis\",\n",
" inputs=[co2, hydrogen],\n",
" input_commodities=[\"co2\", \"hydrogen\"],\n",
" costs=8,\n",
" output_unit=\"t\",\n",
" input_proportions={\"co2\": 0.25, \"hydrogen\": 0.75},\n",
")\n",
"\n",
Expand Down Expand Up @@ -697,58 +688,50 @@
" name=\"solar_pv\",\n",
" input_profile=random_time_series(),\n",
" costs=10,\n",
" output_unit=\"MW\",\n",
")\n",
"wind = NodeScalableInput(\n",
" name=\"wind\",\n",
" input_profile=random_time_series(),\n",
" costs=5,\n",
" output_unit=\"MW\",\n",
")\n",
"\n",
"electricity = Node(\n",
" name=\"electricity\",\n",
" inputs=[solar_pv, wind],\n",
" input_commodities=\"electricity\",\n",
" costs=0,\n",
" output_unit=\"MW\",\n",
")\n",
"\n",
"co2 = NodeFixInput(\n",
" name=\"co2\",\n",
" costs=0,\n",
" input_flow=random_time_series(),\n",
" output_unit=\"t\",\n",
")\n",
"\n",
"curtail = Node(\n",
" name=\"curtail\",\n",
" inputs=[electricity],\n",
" input_commodities=\"electricity\",\n",
" costs=0,\n",
" output_unit=\"MW\",\n",
")\n",
"hydrogen = Node(\n",
" name=\"hydrogen\",\n",
" inputs=[electricity],\n",
" input_commodities=\"electricity\",\n",
" costs=7,\n",
" output_unit=\"t\",\n",
")\n",
"curtail_h2 = Node(\n",
" name=\"curtail_h2\",\n",
" inputs=[hydrogen],\n",
" input_commodities=\"hydrogen\",\n",
" costs=0,\n",
" output_unit=\"t\",\n",
")\n",
"\n",
"methanol_synthesis = Node(\n",
" name=\"methanol_synthesis\",\n",
" inputs=[co2, hydrogen],\n",
" input_commodities=[\"co2\", \"hydrogen\"],\n",
" costs=8,\n",
" output_unit=\"t\",\n",
" input_proportions={\"co2\": 0.25, \"hydrogen\": 0.75},\n",
")\n",
"\n",
Expand Down Expand Up @@ -1312,28 +1295,24 @@
" name=\"solar_pv\",\n",
" input_profile=random_time_series(),\n",
" costs=10,\n",
" output_unit=\"MW\",\n",
")\n",
"wind = NodeScalableInput(\n",
" name=\"wind\",\n",
" input_profile=random_time_series(),\n",
" costs=5,\n",
" output_unit=\"MW\",\n",
")\n",
"\n",
"electricity = Node(\n",
" name=\"electricity\",\n",
" inputs=[solar_pv, wind],\n",
" input_commodities=\"electricity\",\n",
" costs=0,\n",
" output_unit=\"MW\",\n",
" storage=Storage(costs=3, max_charging_speed=0.1, storage_loss=0.03, charging_loss=0.2),\n",
")\n",
"\n",
"co2 = NodeFixInput(\n",
" name=\"co2\",\n",
" costs=0,\n",
" output_unit=\"t\",\n",
" input_flow=random_time_series(),\n",
" storage=Storage(costs=200, max_charging_speed=0.2, storage_loss=0.0, charging_loss=0.001),\n",
")\n",
Expand All @@ -1342,7 +1321,6 @@
" name=\"curtail\",\n",
" inputs=[electricity],\n",
" input_commodities=\"electricity\",\n",
" output_unit=\"MW\",\n",
" costs=0,\n",
")\n",
"\n",
Expand All @@ -1351,22 +1329,19 @@
" inputs=[electricity],\n",
" input_commodities=\"electricity\",\n",
" costs=7,\n",
" output_unit=\"t\",\n",
" storage=Storage(costs=200, max_charging_speed=0.2, storage_loss=0.0, charging_loss=0.001),\n",
")\n",
"curtail_h2 = Node(\n",
" name=\"curtail_h2\",\n",
" inputs=[hydrogen],\n",
" input_commodities=\"hydrogen\",\n",
" output_unit=\"t\",\n",
" costs=0,\n",
")\n",
"\n",
"methanol_synthesis = Node(\n",
" name=\"methanol_synthesis\",\n",
" inputs=[co2, hydrogen],\n",
" input_commodities=[\"co2\", \"hydrogen\"],\n",
" output_unit=\"t\",\n",
" costs=8,\n",
" input_proportions={\"co2\": 0.25, \"hydrogen\": 0.75},\n",
")\n",
Expand Down Expand Up @@ -2066,23 +2041,21 @@
"metadata": {},
"outputs": [],
"source": [
"wind = NodeScalableInput(name=\"wind\", input_profile=const_time_series(.5), costs=1, output_unit='MW')\n",
"solar_pv = NodeScalableInput(name=\"solar_pv\", input_profile=const_time_series(.5), costs=20., output_unit='MW')\n",
"wind = NodeScalableInput(name=\"wind\", input_profile=const_time_series(.5), costs=1,)\n",
"solar_pv = NodeScalableInput(name=\"solar_pv\", input_profile=const_time_series(.5), costs=20.)\n",
"\n",
"\n",
"electricity = Node(\n",
" name=\"electricity\",\n",
" inputs=[solar_pv, wind],\n",
" input_commodities=\"electricity\",\n",
" costs=0,\n",
" output_unit='MW',\n",
")\n",
"\n",
"co2 = NodeFixInput(\n",
" name=\"co2\",\n",
" input_flow=const_time_series(5),\n",
" costs=0,\n",
" output_unit='t',\n",
")\n",
"\n",
"# FIXME methanol synthesis does not work that way! we need hydrogen!\n",
Expand All @@ -2092,7 +2065,6 @@
" input_commodities=['co2', \"electricity\"],\n",
" costs=8e-6,\n",
" input_proportions={\"co2\": 0.25, \"electricity\": 0.75},\n",
" output_unit='t',\n",
")\n",
"\n",
"network = Network(\n",
Expand Down
8 changes: 0 additions & 8 deletions notebooks/reproduce-brazil-paper.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -746,25 +746,21 @@
" name=\"solar_pv\",\n",
" input_profile=solar_pv_input_profile,\n",
" costs=pv_cost,\n",
" output_unit=\"KW\",\n",
")\n",
"wind_class2 = NodeScalableInput(\n",
" name=\"wind_class2\",\n",
" input_profile=wind_class2_input_profileile,\n",
" costs=wind_cost,\n",
" output_unit=\"KW\",\n",
")\n",
"wind_class3 = NodeScalableInput(\n",
" name=\"wind_class3\",\n",
" input_profileile=wind_class3_input_profile,\n",
" costs=wind_cost,\n",
" output_unit=\"KW\",\n",
")\n",
"co2 = NodeFixInput(\n",
" name=\"co2\",\n",
" costs=0,\n",
" input_flow=co2_input_flow,\n",
" output_unit=\"t\",\n",
" storage=Storage(**storage_params['co2']),\n",
")\n",
"electricity = Node(\n",
Expand All @@ -773,22 +769,19 @@
" input_commodities=\"electricity\",\n",
" costs=0,\n",
" storage=Storage(**storage_params['electricity']),\n",
" output_unit=\"KW\",\n",
")\n",
"curtail_electricity = Node(\n",
" name=\"curtail_electricity\",\n",
" inputs=[electricity],\n",
" input_commodities=\"electricity\",\n",
" costs=0,\n",
" output_unit=\"KW\",\n",
")\n",
"electrolizer = Node(\n",
" name=\"electrolizer\",\n",
" inputs=[electricity],\n",
" input_commodities=\"electricity\",\n",
" costs=1/electrolizer_convert_factor * electrolizer_cost,\n",
" convert_factor=electrolizer_convert_factor,\n",
" output_unit=\"t\",\n",
" storage=Storage(**storage_params['hydrogen']),\n",
")\n",
"\n",
Expand All @@ -798,7 +791,6 @@
" input_commodities=[\"co2\", \"hydrogen\"],\n",
" costs=methanol_synthesis_cost,\n",
" convert_factor=methanol_synthesis_convert_factor,\n",
" output_unit=\"KW\",\n",
" input_proportions=methanol_synthesis_input_proportions,\n",
")\n",
"\n",
Expand Down
9 changes: 1 addition & 8 deletions syfop/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def __init__(
name,
input_profile,
costs,
output_unit,
output_proportions=None,
storage=None,
):
Expand All @@ -74,8 +73,6 @@ def __init__(
Time series of the input flow. Must be capacity factors, i.e. between 0 and 1.
costs : pint.Quantity
Costs per unit of size.
output_unit : list of str or str
Unit of the output commodity.
output_proportions : dict
Proportions of the output flows. The keys are the names of the output commodities and
the values are a quantity of the type of the output commodity, all multiples of these
Expand All @@ -96,7 +93,6 @@ def __init__(
name=name,
input_flow=None, # overwritten by create_variables()
costs=costs,
output_unit=output_unit,
output_proportions=output_proportions,
storage=storage,
)
Expand Down Expand Up @@ -157,7 +153,6 @@ def __init__(
inputs,
input_commodities,
costs,
output_unit,
convert_factor=1.0,
convert_factors=None,
size_commodity=None,
Expand All @@ -180,8 +175,6 @@ def __init__(
costs : pint.Quantity
Costs per size. See also ``size_commodity``. Can be set to zero, e.g. for curtailing
nodes: in this case no size variable will be created.
output_unit : str
Unit of the output commodity.
convert_factor : float or pint.Quantity
Conversion factor for the output commodity. If this node has multiple different input
comodities, the parameter ``convert_factors`` needs to be used.
Expand Down Expand Up @@ -211,7 +204,7 @@ def __init__(
one input node is allowed if ``input_flow_costs`` is given.
"""
super().__init__(name, storage, costs, output_unit, convert_factor, convert_factors)
super().__init__(name, storage, costs, convert_factor, convert_factors)

# TODO add check that inputs does not contain nodes of type NodeOutputBase?
self.inputs = inputs
Expand Down
Loading

0 comments on commit 29801d8

Please sign in to comment.