diff --git a/dhnx/component_attrs/edges.csv b/dhnx/component_attrs/pipes.csv similarity index 63% rename from dhnx/component_attrs/edges.csv rename to dhnx/component_attrs/pipes.csv index da6602e9..8e11d8f6 100644 --- a/dhnx/component_attrs/edges.csv +++ b/dhnx/component_attrs/pipes.csv @@ -1,8 +1,8 @@ attribute,type,unit,default,description,status,requirement id,int,n/a,n/a,Unique id,Input,required -from_node,int,n/a,n/a,Node where Edge begins,Input,required -to_node,int,n/a,n/a,Node where Edge ends,Input,required -length,float,m,n/a,Length of the Edge,Input,optional +from_node,int,n/a,n/a,Node where Pipe begins,Input,required +to_node,int,n/a,n/a,Node where Pipe ends,Input,required +length,float,m,n/a,Length of the Pipe,Input,optional diameter,float,mm,n/a,Inner diameter of the pipes,Input,optional heat_transfer_coeff,float,W/(m*K),n/a,Heat transfer coefficient,Input,optional roughness,float,mm,n/a,Roughness of pipes,Input,optional diff --git a/dhnx/components.csv b/dhnx/components.csv index 72220b27..72f8ac75 100644 --- a/dhnx/components.csv +++ b/dhnx/components.csv @@ -2,7 +2,7 @@ component_class,list_name,description ThermalSubNetwork,thermal_sub_networks,"Subsets of a thermal network" Producer,producers,"Heat producer" Consumer,consumers,"Heat consumer" -Fork,forks,"Node where several edges meet" +Fork,forks,"Node where several pipes meet" TransferStation,transfer_stations,"Transfer station" ThermalStorage,thermal_storages,"Thermal storage unit" -Edge,edges,"Edges representing double pipes (feed and return) that connect nodes" +Pipe,pipes,"Pipes representing double pipes (feed and return) that connect nodes" diff --git a/dhnx/dhn_from_osm.py b/dhnx/dhn_from_osm.py index c344302b..6dfd97e1 100644 --- a/dhnx/dhn_from_osm.py +++ b/dhnx/dhn_from_osm.py @@ -38,7 +38,9 @@ def connect_points_to_network(points, nodes, edges): Points connected to the network nodes : geopandas.GeoDataFrame - Nodes of the network + Original nodes of the network and + nearest connecting points on the + network's edges. edges : geopandas.GeoDataFrame Edges of the network. diff --git a/dhnx/graph.py b/dhnx/graph.py index abc15175..6bb8eb71 100644 --- a/dhnx/graph.py +++ b/dhnx/graph.py @@ -29,14 +29,16 @@ def thermal_network_to_nx_graph(thermal_network): """ nx_graph = nx.MultiDiGraph() # TODO: Check if this line can be removed. - edge_attr = list(thermal_network.components['edges'].columns) + edges = thermal_network.components['pipes'].copy() + + edge_attr = list(edges.columns) edge_attr.remove('from_node') edge_attr.remove('to_node') nx_graph = nx.from_pandas_edgelist( - thermal_network.components['edges'], + edges, 'from_node', 'to_node', edge_attr=edge_attr, diff --git a/dhnx/network.py b/dhnx/network.py index d9cab672..07dba6c0 100644 --- a/dhnx/network.py +++ b/dhnx/network.py @@ -91,7 +91,7 @@ def __repr__(self): summary += ' * ' + str(count) + ' ' + component + '\n' if summary == '': - return f"empty dhnx.network.ThermalNetwork object containing no components" + return "Empty dhnx.network.ThermalNetwork object containing no components." return f"dhnx.network.ThermalNetwork object with these components\n{summary}" @@ -172,9 +172,9 @@ def remove(self, class_name, id): def is_consistent(self): r""" Checks that - * edges connect to existing nodes, - * edges do not connect a node with itself, - * there are no duplicate edges between two nodes. + * pipes connect to existing nodes, + * pipes do not connect a node with itself, + * there are no duplicate pipes between two nodes. """ nodes = {list_name: self.components[list_name].copy() for list_name in [ 'consumers', @@ -189,7 +189,7 @@ def is_consistent(self): node_indices = nodes.index - for id, data in self.components.edges.iterrows(): + for id, data in self.components.pipes.iterrows(): if not data['from_node'] in node_indices: raise ValueError(f"Node {data['from_node']} not defined.") @@ -198,18 +198,18 @@ def is_consistent(self): raise ValueError(f"Node {data['to_node']} not defined.") assert data['from_node'] != data['to_node'], \ - f"Edge {id} connects {data['from_node']} to itself" + f"Pipe {id} connects {data['from_node']} to itself" - if not self.components.edges.empty: + if not self.components.pipes.empty: - duplicate_edges = [ - name for name, group in self.components.edges.groupby(['from_node', 'to_node']) + duplicate_pipes = [ + name for name, group in self.components.pipes.groupby(['from_node', 'to_node']) if len(group) > 1 ] - assert not duplicate_edges, ( - f"There is more than one edge that connects " - f"{[edge[0] + ' to ' + edge[1] for edge in duplicate_edges]}") + assert not duplicate_pipes, ( + f"There is more than one pipe that connects " + f"{[pipe[0] + ' to ' + pipe[1] for pipe in duplicate_pipes]}") return True diff --git a/dhnx/plotting.py b/dhnx/plotting.py index 16fe35a3..a1766118 100644 --- a/dhnx/plotting.py +++ b/dhnx/plotting.py @@ -40,7 +40,7 @@ class InteractiveMap(): """ def __init__(self, thermal_network): self.node_data = self.collect_node_data(thermal_network) - self.edge_data = thermal_network.components['edges'] + self.edge_data = thermal_network.components.pipes self.edge_data['value'] = 1 self.node_id = self.node_data.index self.lat = self.node_data['lat'] @@ -220,7 +220,7 @@ def _get_extent(self): def draw(self, bgcolor='w', no_axis=False, background_map=False, use_geom=False, edge_color='b', edge_linewidth=2, edge_alpha=1, node_size=40, node_color='r', node_alpha=1, - node_edgecolor='r', node_zorder=1): + edgecolor='r', node_zorder=1): """ This function has been adapted from osmnx plots.plot_graph() function. """ @@ -275,7 +275,7 @@ def draw(self, bgcolor='w', no_axis=False, background_map=False, s=node_size, c=node_color, alpha=node_alpha, - edgecolor=node_edgecolor, + edgecolor=edgecolor, zorder=node_zorder) if no_axis: diff --git a/docs/examples.rst b/docs/examples.rst index 2c596827..1d645f85 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -17,7 +17,7 @@ Create a thermal network thermal_network.add('Consumer', id=0, lat=50, lon=10) - thermal_network.add('Edge', id=0, from_node='producer-0', to_node='consumer-0') + thermal_network.add('Pipe', id=0, from_node='producer-0', to_node='consumer-0') print(thermal_network) @@ -25,9 +25,9 @@ Create a thermal network # dhnx.network.ThermalNetwork object with these components # * 1 producers # * 1 consumers - # * 1 edges + # * 1 pipes - print(thermal_network.components.edges) + print(thermal_network.components.pipes) # returns # from_node to_node diff --git a/docs/network.rst b/docs/network.rst index cd70b7b2..26b21edc 100644 --- a/docs/network.rst +++ b/docs/network.rst @@ -46,7 +46,7 @@ Producers are described with the following attributes: Fork ==== -Forks are the nodes where several edges of the network meet. +Forks are the nodes where several pipes of the network meet. Forks have the attributes described in the following table: .. csv-table:: @@ -54,12 +54,12 @@ Forks have the attributes described in the following table: :file: ../dhnx/component_attrs/forks.csv -Edge +Pipe ==== -Edges represent the feed and return pipes connecting the different nodes of the network. +Pipes imply the feed and return pipes connecting the different nodes of the network. They are characterized by these attributes: .. csv-table:: :header-rows: 1 - :file: ../dhnx/component_attrs/edges.csv \ No newline at end of file + :file: ../dhnx/component_attrs/pipes.csv \ No newline at end of file diff --git a/examples/import_export_plot/data_csv_input/edges.csv b/examples/import_export_plot/data_csv_input/pipes.csv similarity index 100% rename from examples/import_export_plot/data_csv_input/edges.csv rename to examples/import_export_plot/data_csv_input/pipes.csv diff --git a/examples/import_osmnx/import_osmnx.py b/examples/import_osmnx/import_osmnx.py index 2de9384a..3a0d7cd7 100644 --- a/examples/import_osmnx/import_osmnx.py +++ b/examples/import_osmnx/import_osmnx.py @@ -8,7 +8,7 @@ except ImportError: print("Need to install osmnx to run this example") -import dhnx +from dhnx.dhn_from_osm import connect_points_to_network # load street network and footprints from osm @@ -63,25 +63,29 @@ building_midpoints['y'] = building_midpoints.apply(lambda x: x.geometry.y, 1) building_midpoints = building_midpoints[['x', 'y', 'geometry']] -points, splits, edges = dhnx.dhn_from_osm.connect_points_to_network( +points, forks, pipes = connect_points_to_network( building_midpoints, nodes, edges) -producer = points.loc[[323], :] -consumer = points.drop(323) +# choose one of the points to be a producer +producer_id = 469 + +producers = points.loc[[producer_id], :] + +consumers = points.drop(producer_id) # save files if not os.path.isdir(os.path.join('data', f'{file_name}_potential_dhn')): os.makedirs(os.path.join('data', f'{file_name}_potential_dhn')) -producer.to_file(os.path.join('data', f'{file_name}_potential_dhn', 'producer.shp')) -consumer.to_file(os.path.join('data', f'{file_name}_potential_dhn', 'consumer.shp')) -splits.to_file(os.path.join('data', f'{file_name}_potential_dhn', 'splits.shp')) -edges.to_file(os.path.join('data', f'{file_name}_potential_dhn', 'edges.shp')) +producers.to_file(os.path.join('data', f'{file_name}_potential_dhn', 'producer.shp')) +consumers.to_file(os.path.join('data', f'{file_name}_potential_dhn', 'consumer.shp')) +forks.to_file(os.path.join('data', f'{file_name}_potential_dhn', 'forks.shp')) +pipes.to_file(os.path.join('data', f'{file_name}_potential_dhn', 'pipes.shp')) # plot fig, ax = plt.subplots() -producer.plot(ax=ax, color='r') -consumer.plot(ax=ax, color='g') +producers.plot(ax=ax, color='r') +consumers.plot(ax=ax, color='g') for x, y, label in zip(points.geometry.x, points.geometry.y, points.index): ax.annotate(label, xy=(x, y), @@ -95,7 +99,7 @@ textcoords='offset points', alpha=.3) -splits.plot(ax=ax) -edges.plot(ax=ax) +forks.plot(ax=ax) +pipes.plot(ax=ax) footprints.plot(ax=ax, alpha=.3) plt.show() diff --git a/examples/optimisation/investment_input/edges.csv b/examples/optimisation/investment_input/edges.csv deleted file mode 100644 index c5969800..00000000 --- a/examples/optimisation/investment_input/edges.csv +++ /dev/null @@ -1,16 +0,0 @@ -id,from_node,to_node,length[m],heat_flow_max,investment_cost[Eur/m],temperature_inlet,temperature_return -0,producers-0,forks-0,200,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -1,producers-0,forks-1,200,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -2,producers-0,forks-2,200,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -3,producers-0,consumers-0,200,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -4,producers-0,consumers-1,200,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -5,forks-0,forks-1,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -6,forks-0,forks-2,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -7,forks-0,consumers-0,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -8,forks-0,consumers-1,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -9,forks-1,forks-2,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -10,forks-1,consumers-0,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -11,forks-1,consumers-1,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -12,forks-2,consumers-0,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -13,forks-2,consumers-1,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -14,consumers-0,consumers-1,100,forks-2,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return diff --git a/examples/optimisation/investment_input/pipes.csv b/examples/optimisation/investment_input/pipes.csv new file mode 100644 index 00000000..af7c17b4 --- /dev/null +++ b/examples/optimisation/investment_input/pipes.csv @@ -0,0 +1,16 @@ +id,from_node,to_node,length[m],heat_flow_max,investment_cost[Eur/m],temperature_inlet,temperature_return +0,producers-0,forks-0,200,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +1,producers-0,forks-1,200,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +2,producers-0,forks-2,200,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +3,producers-0,consumers-0,200,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +4,producers-0,consumers-1,200,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +5,forks-0,forks-1,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +6,forks-0,forks-2,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +7,forks-0,consumers-0,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +8,forks-0,consumers-1,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +9,forks-1,forks-2,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +10,forks-1,consumers-0,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +11,forks-1,consumers-1,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +12,forks-2,consumers-0,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +13,forks-2,consumers-1,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +14,consumers-0,consumers-1,100,forks-2,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return diff --git a/examples/optimisation/investment_input/sequences/edges-temperature_inlet.csv b/examples/optimisation/investment_input/sequences/pipes-temperature_inlet.csv similarity index 100% rename from examples/optimisation/investment_input/sequences/edges-temperature_inlet.csv rename to examples/optimisation/investment_input/sequences/pipes-temperature_inlet.csv diff --git a/examples/optimisation/investment_input/sequences/edges-temperature_return.csv b/examples/optimisation/investment_input/sequences/pipes-temperature_return.csv similarity index 100% rename from examples/optimisation/investment_input/sequences/edges-temperature_return.csv rename to examples/optimisation/investment_input/sequences/pipes-temperature_return.csv diff --git a/examples/optimisation/operation_input/edges.csv b/examples/optimisation/operation_input/edges.csv deleted file mode 100644 index a29890ff..00000000 --- a/examples/optimisation/operation_input/edges.csv +++ /dev/null @@ -1,7 +0,0 @@ -id,from_node,to_node,length[m],heat_flow_max,investment_cost[Eur/m],temperature_inlet,temperature_return -0,producers-0,forks-0,200,3,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -5,forks-0,forks-1,100,3,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -6,forks-0,forks-2,100,3,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -9,forks-1,forks-2,100,3,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -10,forks-1,consumers-0,100,3,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return -13,forks-2,consumers-1,100,3,2000,sequences/edges/temperature_inlet,sequences/edges/temperature_return diff --git a/examples/optimisation/operation_input/pipes.csv b/examples/optimisation/operation_input/pipes.csv new file mode 100644 index 00000000..56fb4b05 --- /dev/null +++ b/examples/optimisation/operation_input/pipes.csv @@ -0,0 +1,7 @@ +id,from_node,to_node,length[m],heat_flow_max,investment_cost[Eur/m],temperature_inlet,temperature_return +0,producers-0,forks-0,200,3,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +5,forks-0,forks-1,100,3,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +6,forks-0,forks-2,100,3,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +9,forks-1,forks-2,100,3,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +10,forks-1,consumers-0,100,3,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return +13,forks-2,consumers-1,100,3,2000,sequences/pipes/temperature_inlet,sequences/pipes/temperature_return diff --git a/examples/optimisation/operation_input/sequences/edges-temperature_inlet.csv b/examples/optimisation/operation_input/sequences/pipes-temperature_inlet.csv similarity index 100% rename from examples/optimisation/operation_input/sequences/edges-temperature_inlet.csv rename to examples/optimisation/operation_input/sequences/pipes-temperature_inlet.csv diff --git a/examples/optimisation/operation_input/sequences/edges-temperature_return.csv b/examples/optimisation/operation_input/sequences/pipes-temperature_return.csv similarity index 100% rename from examples/optimisation/operation_input/sequences/edges-temperature_return.csv rename to examples/optimisation/operation_input/sequences/pipes-temperature_return.csv diff --git a/examples/optimisation/results_investment/edges.csv b/examples/optimisation/results_investment/pipes.csv similarity index 84% rename from examples/optimisation/results_investment/edges.csv rename to examples/optimisation/results_investment/pipes.csv index e6e615ae..28cfdd8b 100644 --- a/examples/optimisation/results_investment/edges.csv +++ b/examples/optimisation/results_investment/pipes.csv @@ -1,4 +1,4 @@ -edge_id,from_node,to_node,built +pipe_id,from_node,to_node,built 0,0,1,True 1,0,2,True 2,0,3,True diff --git a/examples/optimisation/results_investment/sequences/edges-heat_flow.csv b/examples/optimisation/results_investment/sequences/pipes-heat_flow.csv similarity index 100% rename from examples/optimisation/results_investment/sequences/edges-heat_flow.csv rename to examples/optimisation/results_investment/sequences/pipes-heat_flow.csv diff --git a/examples/optimisation/results_investment/sequences/edges-heat_losses.csv b/examples/optimisation/results_investment/sequences/pipes-heat_losses.csv similarity index 100% rename from examples/optimisation/results_investment/sequences/edges-heat_losses.csv rename to examples/optimisation/results_investment/sequences/pipes-heat_losses.csv diff --git a/examples/optimisation/results_investment/sequences/edges-mass_flow.csv b/examples/optimisation/results_investment/sequences/pipes-mass_flow.csv similarity index 100% rename from examples/optimisation/results_investment/sequences/edges-mass_flow.csv rename to examples/optimisation/results_investment/sequences/pipes-mass_flow.csv diff --git a/examples/optimisation/results_operation/edges.csv b/examples/optimisation/results_operation/pipes.csv similarity index 100% rename from examples/optimisation/results_operation/edges.csv rename to examples/optimisation/results_operation/pipes.csv diff --git a/examples/optimisation/results_operation/sequences/edges-heat_flow.csv b/examples/optimisation/results_operation/sequences/pipes-heat_flow.csv similarity index 100% rename from examples/optimisation/results_operation/sequences/edges-heat_flow.csv rename to examples/optimisation/results_operation/sequences/pipes-heat_flow.csv diff --git a/examples/optimisation/results_operation/sequences/edges-heat_losses.csv b/examples/optimisation/results_operation/sequences/pipes-heat_losses.csv similarity index 100% rename from examples/optimisation/results_operation/sequences/edges-heat_losses.csv rename to examples/optimisation/results_operation/sequences/pipes-heat_losses.csv diff --git a/examples/optimisation/results_operation/sequences/edges-mass_flow.csv b/examples/optimisation/results_operation/sequences/pipes-mass_flow.csv similarity index 100% rename from examples/optimisation/results_operation/sequences/edges-mass_flow.csv rename to examples/optimisation/results_operation/sequences/pipes-mass_flow.csv diff --git a/examples/simulation/results/sequences/edges-mass_flow.csv b/examples/simulation/results/sequences/edges-mass_flow.csv deleted file mode 100644 index 19020346..00000000 --- a/examples/simulation/results/sequences/edges-mass_flow.csv +++ /dev/null @@ -1,4 +0,0 @@ -snapshots,0,1,2 -0,0.6799999999999999,0.3400000000000004,0.3400000000000001 -1,0.7999999999999999,0.40000000000000036,0.4000000000000001 -2,0.6,0.3000000000000003,0.30000000000000016 diff --git a/examples/simulation/single_loop/edges.csv b/examples/simulation/single_loop/pipes.csv similarity index 100% rename from examples/simulation/single_loop/edges.csv rename to examples/simulation/single_loop/pipes.csv diff --git a/examples/simulation/tree/edges.csv b/examples/simulation/tree/pipes.csv similarity index 100% rename from examples/simulation/tree/edges.csv rename to examples/simulation/tree/pipes.csv diff --git a/tests/_files/inconsistent_network_import/edges.csv b/tests/_files/inconsistent_network_import/pipes.csv similarity index 100% rename from tests/_files/inconsistent_network_import/edges.csv rename to tests/_files/inconsistent_network_import/pipes.csv diff --git a/tests/_files/network_import/edges.csv b/tests/_files/network_import/pipes.csv similarity index 100% rename from tests/_files/network_import/edges.csv rename to tests/_files/network_import/pipes.csv diff --git a/tests/_files/network_import/sequences/edges-temperature_inlet.csv b/tests/_files/network_import/sequences/pipes-temperature_inlet.csv similarity index 100% rename from tests/_files/network_import/sequences/edges-temperature_inlet.csv rename to tests/_files/network_import/sequences/pipes-temperature_inlet.csv diff --git a/tests/_files/network_import/sequences/edges-temperature_return.csv b/tests/_files/network_import/sequences/pipes-temperature_return.csv similarity index 100% rename from tests/_files/network_import/sequences/edges-temperature_return.csv rename to tests/_files/network_import/sequences/pipes-temperature_return.csv diff --git a/tests/test_errors.py b/tests/test_errors.py index 563ff6fa..a9444243 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -26,14 +26,16 @@ thermal_network = dhnx.network.ThermalNetwork(dir_import) +# TODO: The assertions that let these tests fail have yet to be implemented. +# # def test_datatype_param_nodes(): # with pytest.raises(TypeError): -# thermal_network.producers['node_id'] = np.float(thermal_network.producers['node_id']) +# thermal_network.producers['id'] = np.float(thermal_network.producers['node_id']) # # -# def test_datatype_param_edges(): +# def test_datatype_param_pipes(): # with pytest.raises(TypeError): -# thermal_network.edges['edge_id'] = np.float(thermal_network.edges['edge_id']) +# thermal_network.pipes['id'] = np.float(thermal_network.pipes['id']) # # # def test_required_param_nodes(): @@ -41,29 +43,9 @@ # thermal_network.producers = thermal_network.producers.drop('lat', axis=1) # # -# def test_required_param_edges(): -# with pytest.raises(ValueError): -# thermal_network.edges = thermal_network.edges.drop('from_node', axis=1) -# -# -# def test_is_consistent_nodes(): -# with pytest.raises(ValueError): -# thermal_network.producers = thermal_network.producers -# -# -# def test_is_consistent_edges(): -# with pytest.raises(ValueError): -# thermal_network.edges.loc[0] = thermal_network.edges -# -# -# def test_is_consistent_thermal_network(): -# with pytest.raises(ValueError): -# thermal_network.edges -# -# -# def test_is_consistent_thermal_network_2(): +# def test_required_param_pipes(): # with pytest.raises(ValueError): -# thermal_network.producers +# thermal_network.pipes = thermal_network.pipes.drop('from_node', axis=1) def test_load_inconsistent_thermal_network(): @@ -74,4 +56,4 @@ def test_load_inconsistent_thermal_network(): def test_add(): # missing required attributes with pytest.raises(ValueError): - thermal_network.add('Edge', 10) + thermal_network.add('Pipe', 10) diff --git a/tests/test_integration.py b/tests/test_integration.py index 9f5c45ed..ceca4b3e 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -48,7 +48,7 @@ def test_access_attributes(): assert isinstance(network.components.consumers, pd.DataFrame) - assert isinstance(network.sequences.edges.temperature_return, pd.DataFrame) + assert isinstance(network.sequences.pipes.temperature_return, pd.DataFrame) def test_get_nx_graph():