Skip to content

Commit

Permalink
Merge 8317f82 into 70b6c5f
Browse files Browse the repository at this point in the history
  • Loading branch information
p-snft committed Jul 1, 2020
2 parents 70b6c5f + 8317f82 commit b051d94
Show file tree
Hide file tree
Showing 21 changed files with 155 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import os
import oemof.thermal.compression_heatpumps_and_chillers as cmpr_hp_chiller
import oemof.solph as solph
import oemof.outputlib as outputlib
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -43,8 +42,7 @@

energysystem.add(solph.Sink(
label='demand',
inputs={b_heat: solph.Flow(actual_value=data['demand_heat'],
fixed=True,
inputs={b_heat: solph.Flow(fix=data['demand_heat'],
nominal_value=1)}))

temp_threshold_icing = 2
Expand All @@ -69,8 +67,8 @@

model.solve(solver=solver, solve_kwargs={'tee': solver_verbose})

energysystem.results['main'] = outputlib.processing.results(model)
energysystem.results['meta'] = outputlib.processing.meta_results(model)
energysystem.results['main'] = solph.processing.results(model)
energysystem.results['meta'] = solph.processing.meta_results(model)

energysystem.dump(dpath=None, filename=None)

Expand All @@ -83,10 +81,10 @@

results = energysystem.results['main']

electricity_bus = outputlib.views.node(results, 'electricity')
heat_bus = outputlib.views.node(results, 'heat')
electricity_bus = solph.views.node(results, 'electricity')
heat_bus = solph.views.node(results, 'heat')

string_results = outputlib.views.convert_keys_to_strings(
string_results = solph.views.convert_keys_to_strings(
energysystem.results['main'])
ASHP_output = string_results[
'ASHP', 'heat']['sequences'].values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import os
import oemof.thermal.compression_heatpumps_and_chillers as cmpr_hp_chiller
import oemof.solph as solph
import oemof.outputlib as outputlib
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -45,8 +44,7 @@

energysystem.add(solph.Sink(
label='demand',
inputs={b_heat: solph.Flow(actual_value=data['demand_heat'],
fixed=True,
inputs={b_heat: solph.Flow(fix=data['demand_heat'],
nominal_value=1)}))

temp_threshold_icing = 2
Expand Down Expand Up @@ -82,8 +80,8 @@

model.solve(solver=solver, solve_kwargs={'tee': solver_verbose})

energysystem.results['main'] = outputlib.processing.results(model)
energysystem.results['meta'] = outputlib.processing.meta_results(model)
energysystem.results['main'] = solph.processing.results(model)
energysystem.results['meta'] = solph.processing.meta_results(model)

energysystem.dump(dpath=None, filename=None)

Expand All @@ -96,10 +94,10 @@

results = energysystem.results['main']

electricity_bus = outputlib.views.node(results, 'electricity')
heat_bus = outputlib.views.node(results, 'heat')
electricity_bus = solph.views.node(results, 'electricity')
heat_bus = solph.views.node(results, 'heat')

string_results = outputlib.views.convert_keys_to_strings(
string_results = solph.views.convert_keys_to_strings(
energysystem.results['main'])
ASHP_output = string_results[
'ASHP', 'heat']['sequences'].values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os
import oemof.thermal.compression_heatpumps_and_chillers as cmpr_hp_chiller
import oemof.solph as solph
import oemof.outputlib as outputlib
import pandas as pd
import matplotlib.pyplot as plt

Expand Down Expand Up @@ -49,8 +48,7 @@

energysystem.add(solph.Sink(
label='demand',
inputs={b_th_high: solph.Flow(actual_value=data['demand_heat'],
fixed=True,
inputs={b_th_high: solph.Flow(fix=data['demand_heat'],
nominal_value=1)}))

# Pre-Calculate COPs
Expand All @@ -72,8 +70,8 @@

model.solve(solver=solver, solve_kwargs={'tee': solver_verbose})

energysystem.results['main'] = outputlib.processing.results(model)
energysystem.results['meta'] = outputlib.processing.meta_results(model)
energysystem.results['main'] = solph.processing.results(model)
energysystem.results['meta'] = solph.processing.meta_results(model)

energysystem.dump(dpath=None, filename=None)

Expand All @@ -86,10 +84,10 @@

results = energysystem.results['main']

electricity_bus = outputlib.views.node(results, 'electricity')
heat_bus = outputlib.views.node(results, 'heat')
electricity_bus = solph.views.node(results, 'electricity')
heat_bus = solph.views.node(results, 'heat')

string_results = outputlib.views.convert_keys_to_strings(
string_results = solph.views.convert_keys_to_strings(
energysystem.results['main'])
GSHP_output = string_results[
'GSHP', 'heat']['sequences'].values
Expand Down
15 changes: 6 additions & 9 deletions examples/concentrating_solar_power/csp_plant_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from oemof.tools import economics
from oemof.thermal.concentrating_solar_power import csp_precalc

import oemof.outputlib as outputlib
import matplotlib.pyplot as plt

# set path
Expand Down Expand Up @@ -85,8 +84,7 @@
col_heat = solph.Source(
label='collector_heat',
outputs={bcol: solph.Flow(
fixed=True,
actual_value=data_precalc['collector_heat'],
fix=data_precalc['collector_heat'],
nominal_value=size_collector)})

el_grid = solph.Source(
Expand All @@ -100,8 +98,7 @@
consumer = solph.Sink(
label='demand',
inputs={bel: solph.Flow(
fixed=True,
actual_value=data_precalc['ES_load_actual_entsoe_power_statistics'],
fix=data_precalc['ES_load_actual_entsoe_power_statistics'],
nominal_value=1)})

ambience_sol = solph.Sink(
Expand Down Expand Up @@ -150,11 +147,11 @@
# model.write((lp_path + 'csp_model.lp'),
# io_options={'symbolic_solver_labels': True})

results = outputlib.processing.results(model)
results = solph.processing.results(model)

electricity_bus = outputlib.views.node(results, 'electricity')['sequences']
thermal_bus = outputlib.views.node(results, 'thermal')['sequences']
solar_bus = outputlib.views.node(results, 'solar')['sequences']
electricity_bus = solph.views.node(results, 'electricity')['sequences']
thermal_bus = solph.views.node(results, 'thermal')['sequences']
solar_bus = solph.views.node(results, 'solar')['sequences']
df = pd.merge(
pd.merge(electricity_bus, thermal_bus, left_index=True, right_index=True),
solar_bus, left_index=True, right_index=True)
Expand Down
12 changes: 5 additions & 7 deletions examples/concentrating_solar_power/example_csp_facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"""
import os
import pandas as pd
import oemof.outputlib as outputlib
import matplotlib.pyplot as plt


Expand Down Expand Up @@ -108,8 +107,7 @@
consumer = solph.Sink(
label='demand',
inputs={bel: solph.Flow(
fixed=True,
actual_value=input_data['ES_load_actual_entsoe_power_statistics'],
fix=input_data['ES_load_actual_entsoe_power_statistics'],
nominal_value=1)})

excess = solph.Sink(
Expand Down Expand Up @@ -148,12 +146,12 @@
# io_options={'symbolic_solver_labels': True})


results = outputlib.processing.results(model)
results = solph.processing.results(model)

collector_inflow = outputlib.views.node(
collector_inflow = solph.views.node(
results, 'solar_collector-inflow')['sequences']
thermal_bus = outputlib.views.node(results, 'thermal')['sequences']
electricity_bus = outputlib.views.node(results, 'electricity')['sequences']
thermal_bus = solph.views.node(results, 'thermal')['sequences']
electricity_bus = solph.views.node(results, 'electricity')['sequences']
df = pd.DataFrame()
df = df.append(collector_inflow)
df = df.join(thermal_bus, lsuffix='_1')
Expand Down
14 changes: 6 additions & 8 deletions examples/solar_thermal_collector/flat_plate_collector_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from oemof import solph
from oemof.tools import economics
from oemof.thermal.solar_thermal_collector import flat_plate_precalc
import oemof.outputlib as outputlib
from plots import plot_collector_heat


Expand Down Expand Up @@ -99,8 +98,7 @@
label='collector_heat',
outputs={
bcol: solph.Flow(
fixed=True,
actual_value=precalc_data['collectors_heat'],
fix=precalc_data['collectors_heat'],
nominal_value=size_collector,
)
},
Expand All @@ -117,7 +115,7 @@

consumer = solph.Sink(
label='demand',
inputs={bth: solph.Flow(fixed=True, actual_value=demand, nominal_value=1)},
inputs={bth: solph.Flow(fix=demand, nominal_value=1)},
)

collector_excess_heat = solph.Sink(
Expand Down Expand Up @@ -167,11 +165,11 @@
model.solve(solver='cbc', solve_kwargs={'tee': True})

# save model results to csv
results = outputlib.processing.results(model)
results = solph.processing.results(model)

electricity_bus = outputlib.views.node(results, 'electricity')['sequences']
thermal_bus = outputlib.views.node(results, 'thermal')['sequences']
solar_bus = outputlib.views.node(results, 'solar')['sequences']
electricity_bus = solph.views.node(results, 'electricity')['sequences']
thermal_bus = solph.views.node(results, 'thermal')['sequences']
solar_bus = solph.views.node(results, 'solar')['sequences']
df = pd.merge(
pd.merge(electricity_bus, thermal_bus, left_index=True, right_index=True),
solar_bus, left_index=True, right_index=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
"""
import os
import pandas as pd
# import oemof.outputlib as outputlib
import matplotlib.pyplot as plt
from oemof.thermal import facades
from oemof import solph
import oemof.outputlib as outputlib
from oemof.tools import economics


Expand Down Expand Up @@ -98,7 +96,7 @@

consumer = solph.Sink(
label='demand',
inputs={bth: solph.Flow(fixed=True, actual_value=demand, nominal_value=1)},
inputs={bth: solph.Flow(fix=demand, nominal_value=1)},
)

collector_excess_heat = solph.Sink(
Expand Down Expand Up @@ -136,12 +134,12 @@
model.solve(solver='cbc', solve_kwargs={'tee': True})

# save model results to csv
results = outputlib.processing.results(model)
results = solph.processing.results(model)

collector_inflow = outputlib.views.node(
collector_inflow = solph.views.node(
results, 'solar_collector-inflow')['sequences']
thermal_bus = outputlib.views.node(results, 'thermal')['sequences']
electricity_bus = outputlib.views.node(results, 'electricity')['sequences']
thermal_bus = solph.views.node(results, 'thermal')['sequences']
electricity_bus = solph.views.node(results, 'electricity')['sequences']
df = pd.DataFrame()
df = df.append(collector_inflow)
df = df.join(thermal_bus, lsuffix='_1')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from oemof import solph
from oemof.tools import economics
from oemof.thermal.solar_thermal_collector import flat_plate_precalc
import oemof.outputlib as outputlib
from plots import plot_collector_heat


Expand Down Expand Up @@ -99,8 +98,7 @@
label='collector_heat',
outputs={
bcol: solph.Flow(
fixed=True,
actual_value=precalc_data['collectors_heat'],
fix=precalc_data['collectors_heat'],
investment=solph.Investment(ep_costs=costs_collector),
)
},
Expand All @@ -117,7 +115,7 @@

consumer = solph.Sink(
label='demand',
inputs={bth: solph.Flow(fixed=True, actual_value=demand, nominal_value=1)},
inputs={bth: solph.Flow(fix=demand, nominal_value=1)},
)

collector_excess_heat = solph.Sink(
Expand Down Expand Up @@ -168,11 +166,11 @@
model.solve(solver='cbc', solve_kwargs={'tee': True})

# save model results to csv
results = outputlib.processing.results(model)
results = solph.processing.results(model)

electricity_bus = outputlib.views.node(results, 'electricity')['sequences']
thermal_bus = outputlib.views.node(results, 'thermal')['sequences']
solar_bus = outputlib.views.node(results, 'solar')['sequences']
electricity_bus = solph.views.node(results, 'electricity')['sequences']
thermal_bus = solph.views.node(results, 'thermal')['sequences']
solar_bus = solph.views.node(results, 'solar')['sequences']
df = pd.merge(
pd.merge(electricity_bus, thermal_bus, left_index=True, right_index=True),
solar_bus, left_index=True, right_index=True)
Expand Down
10 changes: 5 additions & 5 deletions examples/stratified_thermal_storage/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
import pandas as pd
import matplotlib.pyplot as plt


from oemof.thermal.stratified_thermal_storage import (
calculate_storage_u_value,
calculate_storage_dimensions,
calculate_capacities,
calculate_losses,
)
from oemof.solph import Bus, Flow, Model, EnergySystem
from oemof.solph import processing, views, Bus, Flow, Model, EnergySystem
from oemof.solph.components import GenericStorage
import oemof.outputlib as outputlib


data_path = os.path.join(
Expand Down Expand Up @@ -144,9 +144,9 @@ def print_results():
optimization_model.solve(solver=solver)

# get results
results = outputlib.processing.results(optimization_model)
results = processing.results(optimization_model)

storage_content = outputlib.views.node_weight_by_type(results, GenericStorage)\
storage_content = views.node_weight_by_type(results, GenericStorage)\
.reset_index(drop=True)

storage_content.columns = storage_content.columns\
Expand Down Expand Up @@ -175,7 +175,7 @@ def print_results():
# plot losses vs storage content
for storage_label in (storage.label for storage in storage_list):
ax2.scatter(
storage_df[(storage_label, 'capacity')],
storage_df[(storage_label, 'storage_content')],
storage_df[(storage_label, 'losses')],
label=storage_label,
s=1
Expand Down

0 comments on commit b051d94

Please sign in to comment.