Skip to content

Commit

Permalink
Merge 3809f0c into 66d17e1
Browse files Browse the repository at this point in the history
  • Loading branch information
p-snft committed Jun 9, 2020
2 parents 66d17e1 + 3809f0c commit 5c8f173
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 79 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def read(fname):
setup(name='oemof.thermal',
version='0.0.2',
author='oemof developer group',
author_email='oemof@rl-institut.de',
author_email='contact@oemof.org',
description=(
'Thermal energy components for '
'the open energy modelling framework.'
Expand All @@ -21,7 +21,7 @@ def read(fname):
long_description=read('README.rst'),
packages=["oemof"] + ["oemof." + p for p in find_packages("src/oemof")],
package_dir={"": "src"},
install_requires=['oemof',
install_requires=['oemof.solph',
'matplotlib',
'pvlib',
'numpy >= 1.7.0, < 1.18',
Expand Down
10 changes: 4 additions & 6 deletions src/oemof/thermal/facades.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
calculate_capacities, calculate_losses
from oemof.thermal.concentrating_solar_power import csp_precalc
from oemof.thermal.solar_thermal_collector import flat_plate_precalc
from oemof.energy_system import EnergySystem
from oemof.network import Node
from oemof.network.energy_system import EnergySystem
from oemof.network.network import Node
from oemof.solph import Flow, Investment, Transformer, Source
from oemof.solph.components import GenericStorage
from oemof.solph.plumbing import sequence
Expand Down Expand Up @@ -489,8 +489,7 @@ def build_solph_components(self):
label=self.label + "-inflow",
outputs={
self: Flow(nominal_value=self.aperture_area,
actual_value=self.collectors_heat,
fixed=True)
fix=self.collectors_heat)
},
)

Expand Down Expand Up @@ -644,8 +643,7 @@ def build_solph_components(self):
label=self.label + "-inflow",
outputs={
self: Flow(nominal_value=self.aperture_area,
actual_value=self.collectors_heat,
fixed=True)
fix=self.collectors_heat)
},
)

Expand Down
24 changes: 12 additions & 12 deletions tests/lp_files/stratified_thermal_storage.lp
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@ c_e_Bus_balance(bus_heat_2)_:
= 0

c_e_GenericStorageBlock_balance_first(thermal_storage)_:
+1 GenericStorageBlock_capacity(thermal_storage_0)
-0.99982340904089895 GenericStorageBlock_init_cap(thermal_storage)
-0.99982340904089895 GenericStorageBlock_init_content(thermal_storage)
+1 GenericStorageBlock_storage_content(thermal_storage_0)
-1 flow(bus_heat_thermal_storage_0)
+1 flow(thermal_storage_bus_heat_0)
= -0.028863382504856223

c_e_GenericStorageBlock_balance(thermal_storage_1)_:
-0.99982340904089895 GenericStorageBlock_capacity(thermal_storage_0)
+1 GenericStorageBlock_capacity(thermal_storage_1)
-0.99982340904089895 GenericStorageBlock_storage_content(thermal_storage_0)
+1 GenericStorageBlock_storage_content(thermal_storage_1)
-1 flow(bus_heat_thermal_storage_1)
+1 flow(thermal_storage_bus_heat_1)
= -0.028863382504856223

c_e_GenericStorageBlock_balance(thermal_storage_2)_:
-0.99982340904089895 GenericStorageBlock_capacity(thermal_storage_1)
+1 GenericStorageBlock_capacity(thermal_storage_2)
-0.99982340904089895 GenericStorageBlock_storage_content(thermal_storage_1)
+1 GenericStorageBlock_storage_content(thermal_storage_2)
-1 flow(bus_heat_thermal_storage_2)
+1 flow(thermal_storage_bus_heat_2)
= -0.028863382504856223

c_e_GenericStorageBlock_balanced_cstr(thermal_storage)_:
+1 GenericStorageBlock_capacity(thermal_storage_2)
-1 GenericStorageBlock_init_cap(thermal_storage)
-1 GenericStorageBlock_init_content(thermal_storage)
+1 GenericStorageBlock_storage_content(thermal_storage_2)
= 0

c_e_ONE_VAR_CONSTANT:
Expand All @@ -59,8 +59,8 @@ bounds
0 <= flow(thermal_storage_bus_heat_0) <= 2
0 <= flow(thermal_storage_bus_heat_1) <= 2
0 <= flow(thermal_storage_bus_heat_2) <= 2
91.06370721026974 <= GenericStorageBlock_capacity(thermal_storage_0) <= 2.3349668515453779
91.06370721026974 <= GenericStorageBlock_capacity(thermal_storage_1) <= 2.3349668515453779
91.06370721026974 <= GenericStorageBlock_capacity(thermal_storage_2) <= 2.3349668515453779
0 <= GenericStorageBlock_init_cap(thermal_storage) <= 93.398674061815115
91.06370721026974 <= GenericStorageBlock_storage_content(thermal_storage_0) <= 2.3349668515453779
91.06370721026974 <= GenericStorageBlock_storage_content(thermal_storage_1) <= 2.3349668515453779
91.06370721026974 <= GenericStorageBlock_storage_content(thermal_storage_2) <= 2.3349668515453779
0 <= GenericStorageBlock_init_content(thermal_storage) <= 93.398674061815115
end
52 changes: 26 additions & 26 deletions tests/lp_files/stratified_thermal_storage_invest_option_1.lp
Original file line number Diff line number Diff line change
Expand Up @@ -54,38 +54,38 @@ c_u_InvestmentFlow_max(thermal_storage_bus_heat_2)_:
+1 flow(thermal_storage_bus_heat_2)
<= 0

c_u_GenericInvestmentStorageBlock_init_cap_limit(thermal_storage)_:
+1 GenericInvestmentStorageBlock_init_cap(thermal_storage)
c_u_GenericInvestmentStorageBlock_init_content_limit(thermal_storage)_:
+1 GenericInvestmentStorageBlock_init_content(thermal_storage)
-1 GenericInvestmentStorageBlock_invest(thermal_storage)
<= 0

c_e_GenericInvestmentStorageBlock_balance_first(thermal_storage)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_0)
-0.99982340904089895 GenericInvestmentStorageBlock_init_cap(thermal_storage)
-0.99982340904089895 GenericInvestmentStorageBlock_init_content(thermal_storage)
+0.00025227279871584872 GenericInvestmentStorageBlock_invest(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_0)
-1 flow(bus_heat_thermal_storage_0)
+1 flow(thermal_storage_bus_heat_0)
= -0.0053014376029327757

c_e_GenericInvestmentStorageBlock_balance(thermal_storage_1)_:
-0.99982340904089895 GenericInvestmentStorageBlock_capacity(thermal_storage_0)
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_1)
+0.00025227279871584872 GenericInvestmentStorageBlock_invest(thermal_storage)
-0.99982340904089895 GenericInvestmentStorageBlock_storage_content(thermal_storage_0)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_1)
-1 flow(bus_heat_thermal_storage_1)
+1 flow(thermal_storage_bus_heat_1)
= -0.0053014376029327757

c_e_GenericInvestmentStorageBlock_balance(thermal_storage_2)_:
-0.99982340904089895 GenericInvestmentStorageBlock_capacity(thermal_storage_1)
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_2)
+0.00025227279871584872 GenericInvestmentStorageBlock_invest(thermal_storage)
-0.99982340904089895 GenericInvestmentStorageBlock_storage_content(thermal_storage_1)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_2)
-1 flow(bus_heat_thermal_storage_2)
+1 flow(thermal_storage_bus_heat_2)
= -0.0053014376029327757

c_e_GenericInvestmentStorageBlock_balanced_cstr(thermal_storage)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_2)
-1 GenericInvestmentStorageBlock_init_cap(thermal_storage)
-1 GenericInvestmentStorageBlock_init_content(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_2)
= 0

c_e_GenericInvestmentStorageBlock_power_coupled(thermal_storage)_:
Expand All @@ -98,34 +98,34 @@ c_e_GenericInvestmentStorageBlock_storage_capacity_inflow(thermal_storage)_:
+1 InvestmentFlow_invest(bus_heat_thermal_storage)
= 0

c_u_GenericInvestmentStorageBlock_max_capacity(thermal_storage_0)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_0)
c_u_GenericInvestmentStorageBlock_max_storage_content(thermal_storage_0)_:
-0.025000000000000001 GenericInvestmentStorageBlock_invest(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_0)
<= 0

c_u_GenericInvestmentStorageBlock_max_capacity(thermal_storage_1)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_1)
c_u_GenericInvestmentStorageBlock_max_storage_content(thermal_storage_1)_:
-0.025000000000000001 GenericInvestmentStorageBlock_invest(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_1)
<= 0

c_u_GenericInvestmentStorageBlock_max_capacity(thermal_storage_2)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_2)
c_u_GenericInvestmentStorageBlock_max_storage_content(thermal_storage_2)_:
-0.025000000000000001 GenericInvestmentStorageBlock_invest(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_2)
<= 0

c_u_GenericInvestmentStorageBlock_min_capacity(thermal_storage_0)_:
-1 GenericInvestmentStorageBlock_capacity(thermal_storage_0)
c_u_GenericInvestmentStorageBlock_min_storage_content(thermal_storage_0)_:
+0.97499999999999998 GenericInvestmentStorageBlock_invest(thermal_storage)
-1 GenericInvestmentStorageBlock_storage_content(thermal_storage_0)
<= 0

c_u_GenericInvestmentStorageBlock_min_capacity(thermal_storage_1)_:
-1 GenericInvestmentStorageBlock_capacity(thermal_storage_1)
c_u_GenericInvestmentStorageBlock_min_storage_content(thermal_storage_1)_:
+0.97499999999999998 GenericInvestmentStorageBlock_invest(thermal_storage)
-1 GenericInvestmentStorageBlock_storage_content(thermal_storage_1)
<= 0

c_u_GenericInvestmentStorageBlock_min_capacity(thermal_storage_2)_:
-1 GenericInvestmentStorageBlock_capacity(thermal_storage_2)
c_u_GenericInvestmentStorageBlock_min_storage_content(thermal_storage_2)_:
+0.97499999999999998 GenericInvestmentStorageBlock_invest(thermal_storage)
-1 GenericInvestmentStorageBlock_storage_content(thermal_storage_2)
<= 0

c_e_ONE_VAR_CONSTANT:
Expand All @@ -140,9 +140,9 @@ bounds
0 <= flow(thermal_storage_bus_heat_2) <= +inf
0 <= InvestmentFlow_invest(bus_heat_thermal_storage) <= +inf
0 <= InvestmentFlow_invest(thermal_storage_bus_heat) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(thermal_storage_0) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(thermal_storage_1) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(thermal_storage_2) <= +inf
0 <= GenericInvestmentStorageBlock_storage_content(thermal_storage_0) <= +inf
0 <= GenericInvestmentStorageBlock_storage_content(thermal_storage_1) <= +inf
0 <= GenericInvestmentStorageBlock_storage_content(thermal_storage_2) <= +inf
1 <= GenericInvestmentStorageBlock_invest(thermal_storage) <= +inf
0 <= GenericInvestmentStorageBlock_init_cap(thermal_storage) <= +inf
0 <= GenericInvestmentStorageBlock_init_content(thermal_storage) <= +inf
end
52 changes: 26 additions & 26 deletions tests/lp_files/stratified_thermal_storage_invest_option_2.lp
Original file line number Diff line number Diff line change
Expand Up @@ -55,73 +55,73 @@ c_u_InvestmentFlow_max(thermal_storage_bus_heat_2)_:
+1 flow(thermal_storage_bus_heat_2)
<= 0

c_u_GenericInvestmentStorageBlock_init_cap_limit(thermal_storage)_:
+1 GenericInvestmentStorageBlock_init_cap(thermal_storage)
c_u_GenericInvestmentStorageBlock_init_content_limit(thermal_storage)_:
+1 GenericInvestmentStorageBlock_init_content(thermal_storage)
-1 GenericInvestmentStorageBlock_invest(thermal_storage)
<= 0

c_e_GenericInvestmentStorageBlock_balance_first(thermal_storage)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_0)
-0.99982340904089895 GenericInvestmentStorageBlock_init_cap(thermal_storage)
-0.99982340904089895 GenericInvestmentStorageBlock_init_content(thermal_storage)
+0.00025227279871584872 GenericInvestmentStorageBlock_invest(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_0)
-1 flow(bus_heat_thermal_storage_0)
+1 flow(thermal_storage_bus_heat_0)
= -0.0053014376029327757

c_e_GenericInvestmentStorageBlock_balance(thermal_storage_1)_:
-0.99982340904089895 GenericInvestmentStorageBlock_capacity(thermal_storage_0)
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_1)
+0.00025227279871584872 GenericInvestmentStorageBlock_invest(thermal_storage)
-0.99982340904089895 GenericInvestmentStorageBlock_storage_content(thermal_storage_0)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_1)
-1 flow(bus_heat_thermal_storage_1)
+1 flow(thermal_storage_bus_heat_1)
= -0.0053014376029327757

c_e_GenericInvestmentStorageBlock_balance(thermal_storage_2)_:
-0.99982340904089895 GenericInvestmentStorageBlock_capacity(thermal_storage_1)
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_2)
+0.00025227279871584872 GenericInvestmentStorageBlock_invest(thermal_storage)
-0.99982340904089895 GenericInvestmentStorageBlock_storage_content(thermal_storage_1)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_2)
-1 flow(bus_heat_thermal_storage_2)
+1 flow(thermal_storage_bus_heat_2)
= -0.0053014376029327757

c_e_GenericInvestmentStorageBlock_balanced_cstr(thermal_storage)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_2)
-1 GenericInvestmentStorageBlock_init_cap(thermal_storage)
-1 GenericInvestmentStorageBlock_init_content(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_2)
= 0

c_e_GenericInvestmentStorageBlock_power_coupled(thermal_storage)_:
-1 InvestmentFlow_invest(bus_heat_thermal_storage)
+1 InvestmentFlow_invest(thermal_storage_bus_heat)
= 0

c_u_GenericInvestmentStorageBlock_max_capacity(thermal_storage_0)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_0)
c_u_GenericInvestmentStorageBlock_max_storage_content(thermal_storage_0)_:
-0.025000000000000001 GenericInvestmentStorageBlock_invest(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_0)
<= 0

c_u_GenericInvestmentStorageBlock_max_capacity(thermal_storage_1)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_1)
c_u_GenericInvestmentStorageBlock_max_storage_content(thermal_storage_1)_:
-0.025000000000000001 GenericInvestmentStorageBlock_invest(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_1)
<= 0

c_u_GenericInvestmentStorageBlock_max_capacity(thermal_storage_2)_:
+1 GenericInvestmentStorageBlock_capacity(thermal_storage_2)
c_u_GenericInvestmentStorageBlock_max_storage_content(thermal_storage_2)_:
-0.025000000000000001 GenericInvestmentStorageBlock_invest(thermal_storage)
+1 GenericInvestmentStorageBlock_storage_content(thermal_storage_2)
<= 0

c_u_GenericInvestmentStorageBlock_min_capacity(thermal_storage_0)_:
-1 GenericInvestmentStorageBlock_capacity(thermal_storage_0)
c_u_GenericInvestmentStorageBlock_min_storage_content(thermal_storage_0)_:
+0.97499999999999998 GenericInvestmentStorageBlock_invest(thermal_storage)
-1 GenericInvestmentStorageBlock_storage_content(thermal_storage_0)
<= 0

c_u_GenericInvestmentStorageBlock_min_capacity(thermal_storage_1)_:
-1 GenericInvestmentStorageBlock_capacity(thermal_storage_1)
c_u_GenericInvestmentStorageBlock_min_storage_content(thermal_storage_1)_:
+0.97499999999999998 GenericInvestmentStorageBlock_invest(thermal_storage)
-1 GenericInvestmentStorageBlock_storage_content(thermal_storage_1)
<= 0

c_u_GenericInvestmentStorageBlock_min_capacity(thermal_storage_2)_:
-1 GenericInvestmentStorageBlock_capacity(thermal_storage_2)
c_u_GenericInvestmentStorageBlock_min_storage_content(thermal_storage_2)_:
+0.97499999999999998 GenericInvestmentStorageBlock_invest(thermal_storage)
-1 GenericInvestmentStorageBlock_storage_content(thermal_storage_2)
<= 0

c_e_ONE_VAR_CONSTANT:
Expand All @@ -136,9 +136,9 @@ bounds
0 <= flow(thermal_storage_bus_heat_2) <= +inf
0 <= InvestmentFlow_invest(bus_heat_thermal_storage) <= +inf
0 <= InvestmentFlow_invest(thermal_storage_bus_heat) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(thermal_storage_0) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(thermal_storage_1) <= +inf
0 <= GenericInvestmentStorageBlock_capacity(thermal_storage_2) <= +inf
0 <= GenericInvestmentStorageBlock_storage_content(thermal_storage_0) <= +inf
0 <= GenericInvestmentStorageBlock_storage_content(thermal_storage_1) <= +inf
0 <= GenericInvestmentStorageBlock_storage_content(thermal_storage_2) <= +inf
1 <= GenericInvestmentStorageBlock_invest(thermal_storage) <= +inf
0 <= GenericInvestmentStorageBlock_init_cap(thermal_storage) <= +inf
0 <= GenericInvestmentStorageBlock_init_content(thermal_storage) <= +inf
end
10 changes: 3 additions & 7 deletions tests/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@
import re
from difflib import unified_diff

import pytest
import pandas as pd

from oemof.thermal import facades
from oemof.network import Node
from oemof.tools import helpers
from oemof.network.network import Node
from oemof.solph import helpers
import oemof.solph as solph


logging.disable(logging.INFO)


def chop_trailing_whitespace(lines):
return [re.sub(r'\s*$', '', l) for l in lines]
return [re.sub(r'\s*$', '', line) for line in lines]


def remove(pattern, lines):
Expand Down Expand Up @@ -122,7 +121,6 @@ def compare_to_reference_lp(self, ref_filename, my_om=None):
with open(ref_filepath) as ref_file:
compare_lp_files(new_file, ref_file)

@pytest.mark.skip(reason="Relies on not yet released oemof v3.3")
def test_stratified_thermal_storage_facade(self):
"""Constraint test of a StratifiedThermalStorage without investment.
"""
Expand All @@ -146,7 +144,6 @@ def test_stratified_thermal_storage_facade(self):

self.compare_to_reference_lp('stratified_thermal_storage.lp')

@pytest.mark.skip(reason="Relies on not yet released oemof v3.3")
def test_stratified_thermal_storage_invest_option_1_facade(self):
"""
Constraint test of a StratifiedThermalStorage with investment.
Expand Down Expand Up @@ -175,7 +172,6 @@ def test_stratified_thermal_storage_invest_option_1_facade(self):

self.compare_to_reference_lp('stratified_thermal_storage_invest_option_1.lp')

@pytest.mark.skip(reason="Relies on not yet released oemof v3.3")
def test_stratified_thermal_storage_invest_option_2_facade(self):
"""
Constraint test of a StratifiedThermalStorage with investment.
Expand Down

0 comments on commit 5c8f173

Please sign in to comment.