From 30b5e2ec3e043dd4e746c84547f1e908dc103f36 Mon Sep 17 00:00:00 2001 From: "caroline.moeller" Date: Wed, 20 Dec 2017 15:52:54 +0100 Subject: [PATCH] Restructure results output --- .../storage_investment_1.py | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/examples/oemof_0.2/storage_investment/storage_investment_1.py b/examples/oemof_0.2/storage_investment/storage_investment_1.py index ae48c5f..5dc346f 100644 --- a/examples/oemof_0.2/storage_investment/storage_investment_1.py +++ b/examples/oemof_0.2/storage_investment/storage_investment_1.py @@ -174,25 +174,24 @@ # check if the new result object is working for custom components results = processing.results(om) -if not silent: - # print(results[(storage, None)]['sequences'].head()) - print(results[(storage, None)]['scalars']) - print(results[(wind, bel)]['scalars']) custom_storage = views.node(results, 'storage') electricity_bus = views.node(results, 'electricity') +if not silent: + meta_results = processing.meta_results(om) + pp.pprint(meta_results) + + my_results = electricity_bus['scalars'] + my_results['storage_invest_GWh'] = results[(storage, None)]['scalars']['invest']/1e6 + my_results['wind_invest_MW'] = results[(wind, bel)]['scalars']['invest']/1e3 + my_results['res_share'] = 1 - results[(pp_gas, bel)]['sequences'].sum()/results[(bel, demand)]['sequences'].sum() + pp.pprint(my_results) + + if plt is not None and not silent: custom_storage['sequences'].plot(kind='line', drawstyle='steps-post') plt.show() + electricity_bus['sequences'].plot(kind='line', drawstyle='steps-post') plt.show() -my_results = electricity_bus['sequences'].sum(axis=0).to_dict() -my_results['storage_invest'] = results[(storage, None)]['scalars']['invest'] -my_results['wind_invest'] = results[(wind, bel)]['scalars']['invest'] - -if not silent: - meta_results = processing.meta_results(om) - pp.pprint(meta_results) - -pp.pprint(my_results)