def supply_results( types=[ "dispatchable", "volatile", "conversion", "backpressure", "extraction", "storage", "reservoir", ], bus=None, results=None, es=None, ): """ """ if not hasattr(es, "typemap"): setattr(es, "typemap", facades.TYPEMAP) selection = pd.DataFrame() for t in types: if (issubclass(es.typemap[t], GenericStorage) and es.typemap[t] is not facades.Reservoir): df = views.net_storage_flow(results, node_type=es.typemap[t]) if df is not None: selection = pd.concat([selection, df], axis=1) else: df = views.node_output_by_type(results, node_type=es.typemap[t]) if df is not None: selection = pd.concat([selection, df], axis=1) selection = selection.loc[:, (slice(None), [es.groups[b] for b in bus], ["flow", "net_flow"])] return selection
def test_net_storage_flow(self): results = processing.results(self.om) storage_flow = views.net_storage_flow(results, node_type=GenericStorage) compare = views.node(results, 'storage', multiindex=True)['sequences'] eq_(((compare[('storage', 'b_el2', 'flow')] - compare[('b_el1', 'storage', 'flow')]).to_frame() == storage_flow.values).all()[0], True)
def test_net_storage_flow_empty(self): results = processing.results(self.om) view = views.net_storage_flow(results, node_type=Sink) ok_(view is None) view2 = views.net_storage_flow(results, node_type=Flow) ok_(view2 is None)