Skip to content

Commit

Permalink
change keys "tobus" and "frombus" to "to_bus" and "from_bus"
Browse files Browse the repository at this point in the history
  • Loading branch information
uvchik committed Aug 12, 2016
1 parent 5889c00 commit 7cb564c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
32 changes: 16 additions & 16 deletions examples/example_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,22 +123,22 @@ def check_nosetests():

test_results = {
'objective': 2947725.249402091,
('b_el', 'tobus', 'pp_chp', 'val'): 11161.357450000065,
('b_el', 'tobus', 'pp_coal', 'val'): 33723.047672110595,
('b_el', 'tobus', 'pp_gas', 'val'): 30412.377779000046,
('b_el', 'tobus', 'pp_lig', 'val'): 22066.451080999268,
('b_el', 'tobus', 'pp_oil', 'val'): 2.2872599999999998,
('b_el', 'tobus', 'pv', 'val'): 7796.8431880300122,
('b_el', 'tobus', 'wind', 'val'): 28009.549502999955,
('b_el', 'frombus', 'demand_el', 'val'): 132243.7904593189,
('b_el', 'frombus', 'excess', 'val'): 928.12139200000013,
('b_th', 'tobus', 'pp_chp', 'val'): 14881.810039999958,
('b_th', 'frombus', 'demand_th', 'val'): 14881.80983624002,
('coal', 'frombus', 'pp_coal', 'val'): 86469.394787298472,
('gas', 'frombus', 'pp_chp', 'val'): 37204.525720000034,
('gas', 'frombus', 'pp_gas', 'val'): 60824.751778000136,
('lignite', 'frombus', 'pp_lig', 'val'): 53820.634704001102,
('oil', 'frombus', 'pp_oil', 'val'): 8.1687949999999994}
('b_el', 'to_bus', 'pp_chp', 'val'): 11161.357450000065,
('b_el', 'to_bus', 'pp_coal', 'val'): 33723.047672110595,
('b_el', 'to_bus', 'pp_gas', 'val'): 30412.377779000046,
('b_el', 'to_bus', 'pp_lig', 'val'): 22066.451080999268,
('b_el', 'to_bus', 'pp_oil', 'val'): 2.2872599999999998,
('b_el', 'to_bus', 'pv', 'val'): 7796.8431880300122,
('b_el', 'to_bus', 'wind', 'val'): 28009.549502999955,
('b_el', 'from_bus', 'demand_el', 'val'): 132243.7904593189,
('b_el', 'from_bus', 'excess', 'val'): 928.12139200000013,
('b_th', 'to_bus', 'pp_chp', 'val'): 14881.810039999958,
('b_th', 'from_bus', 'demand_th', 'val'): 14881.80983624002,
('coal', 'from_bus', 'pp_coal', 'val'): 86469.394787298472,
('gas', 'from_bus', 'pp_chp', 'val'): 37204.525720000034,
('gas', 'from_bus', 'pp_gas', 'val'): 60824.751778000136,
('lignite', 'from_bus', 'pp_lig', 'val'): 53820.634704001102,
('oil', 'from_bus', 'pp_oil', 'val'): 8.1687949999999994}

check(test_results, least_costs_run, testdict['least_costs'], results)
# *********** end of simple least cost example *******************************
Expand Down
2 changes: 1 addition & 1 deletion examples/solph/simple_least_costs/simple_least_costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def plot_results(energysystem):
# create multiindex dataframe with result values
esplot = output.DataFramePlot(energy_system=energysystem)
# select input results of electrical bus (i.e. power delivered by plants)
esplot.slice_unstacked(bus_label="b_el", type="tobus",
esplot.slice_unstacked(bus_label="b_el", type="to_bus",
date_from='2012-01-01 00:00:00',
date_to='2012-01-07 00:00:00')
# set colorlist for esplot
Expand Down
6 changes: 3 additions & 3 deletions examples/solph/storage_optimization/storage_invest.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def get_result_dict(energysystem):
storage = energysystem.groups['storage']
myresults = outputlib.DataFramePlot(energy_system=energysystem)

pp_gas = myresults.slice_by(obj_label='pp_gas', type='tobus',
pp_gas = myresults.slice_by(obj_label='pp_gas', type='to_bus',
date_from='2012-01-01 00:00:00',
date_to='2012-12-31 23:00:00')

Expand Down Expand Up @@ -182,7 +182,7 @@ def create_plots(energysystem):

# Plotting the input flows of the electricity bus for January
myplot = outputlib.DataFramePlot(energy_system=energysystem)
myplot.slice_unstacked(bus_label="electricity", type="tobus",
myplot.slice_unstacked(bus_label="electricity", type="to_bus",
date_from="2012-01-01 00:00:00",
date_to="2012-01-31 00:00:00")
colorlist = myplot.color_from_dict(cdict)
Expand All @@ -193,7 +193,7 @@ def create_plots(energysystem):
myplot.set_datetime_ticks(date_format='%d-%m-%Y', tick_distance=24*7)

# Plotting the output flows of the electricity bus for January
myplot.slice_unstacked(bus_label="electricity", type="frombus")
myplot.slice_unstacked(bus_label="electricity", type="from_bus")
myplot.plot(title="Year 2016", colormap='Spectral', linewidth=2)
myplot.ax.legend(loc='upper right')
myplot.ax.set_ylabel('Power in MW')
Expand Down
12 changes: 6 additions & 6 deletions oemof/outputlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, **kwargs):
if k is kk:
row['type'] = 'other'
else:
row['type'] = 'frombus'
row['type'] = 'from_bus'
if k is kk:
row['obj_label'] = 'duals'
elif isinstance(kk, str):
Expand All @@ -81,7 +81,7 @@ def __init__(self, **kwargs):
# bus inputs (only self ref. components)
row = dict()
row['bus_label'] = list(k.outputs.keys())[0].label
row['type'] = 'tobus'
row['type'] = 'to_bus'
row['obj_label'] = k.label
row['datetime'] = es.time_idx
row['val'] = v.get(list(k.outputs.keys())[0])
Expand All @@ -91,7 +91,7 @@ def __init__(self, **kwargs):
# bus inputs (results[component][bus])
row = dict()
row['bus_label'] = kk.label
row['type'] = 'tobus'
row['type'] = 'to_bus'
row['obj_label'] = k.label
row['datetime'] = es.time_idx
row['val'] = vv
Expand Down Expand Up @@ -119,7 +119,7 @@ def slice_by(self, **kwargs):
Parameters
----------
bus_label : string
type : string (tobus/frombus/other)
type : string (to_bus/from_bus/other)
obj_label: string
date_from : string
Start date selection e.g. "2016-01-01 00:00:00". If not set, the
Expand Down Expand Up @@ -396,15 +396,15 @@ def io_plot(self, bus_label, cdict, line_kwa=None, lineorder=None,
self.ax = fig.add_subplot(1, 1, 1)

# Create a bar plot for all input flows
self.slice_unstacked(bus_label=bus_label, type='tobus', **kwargs)
self.slice_unstacked(bus_label=bus_label, type='to_bus', **kwargs)
if barorder is not None:
self.rearrange_subset(barorder)
self.subset.plot(kind='bar', linewidth=0, stacked=True, width=1,
ax=self.ax, color=self.color_from_dict(cdict),
**bar_kwa)

# Create a line plot for all output flows
self.slice_unstacked(bus_label=bus_label, type='frombus', **kwargs)
self.slice_unstacked(bus_label=bus_label, type='from_bus', **kwargs)
if lineorder is not None:
self.rearrange_subset(lineorder)
# The following changes are made to have the bottom line on top layer
Expand Down

0 comments on commit 7cb564c

Please sign in to comment.