From d7158950daffaae536dbaa7ed169d94e9d90ab0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pedro=20L=2E=20Magalh=C3=A3es?= <pmlpm@posteo.de>
Date: Sat, 29 Jun 2024 13:08:54 +0200
Subject: [PATCH] Changes to the DB reading method.

---
 examples/script_design_capacity.py       |   2 +-
 examples/script_moody_diagram.py         |   2 +-
 examples/script_nikuradse_experiments.py |   2 +-
 examples/script_pipe_losses.py           | 484 +++++++++++++++++------
 src/topupheat/pipes/utils.py             |  86 +++-
 tests/test_all.py                        |  12 +-
 tests/test_pipes.py                      | 100 ++---
 tests/test_system.py                     |  40 +-
 tests/test_trenches.py                   | 311 +++------------
 tests/test_utils.py                      |  18 +-
 10 files changed, 575 insertions(+), 482 deletions(-)

diff --git a/examples/script_design_capacity.py b/examples/script_design_capacity.py
index 435c947..4279abb 100644
--- a/examples/script_design_capacity.py
+++ b/examples/script_design_capacity.py
@@ -4,7 +4,7 @@
 # TIP: this script requires the data found in the hyhetra-pipedata and hyhetra-
 # -fluiddata repositories
 
-pipedata_files = ['pipes/isoplus_singlepipes_s1.csv']
+pipedata_files = ['pipes/isoplus_single_disconti_s1.csv']
         
 fluiddata_file = 'fluids/incropera2006_saturated_water.csv'
 
diff --git a/examples/script_moody_diagram.py b/examples/script_moody_diagram.py
index 76486e2..1b17462 100644
--- a/examples/script_moody_diagram.py
+++ b/examples/script_moody_diagram.py
@@ -4,7 +4,7 @@
 # TIP: this script requires the data found in the hyhetra-pipedata and hyhetra-
 # -fluiddata repositories
 
-pipedata_files = ['pipes/isoplus_singlepipes_s1.csv']
+pipedata_files = ['pipes/isoplus_single_disconti_s1.csv']
 
 fluiddata_file = 'fluids/incropera2006_saturated_water.csv'
 
diff --git a/examples/script_nikuradse_experiments.py b/examples/script_nikuradse_experiments.py
index cae7390..c77a9ec 100644
--- a/examples/script_nikuradse_experiments.py
+++ b/examples/script_nikuradse_experiments.py
@@ -4,7 +4,7 @@
 # TIP: this script requires the data found in the hyhetra-pipedata and hyhetra-
 # -fluiddata repositories
 
-pipedata_files = ['pipes/isoplus_singlepipes_s1.csv']
+pipedata_files = ['pipes/isoplus_single_disconti_s1.csv']
 
 fluiddata_file = 'fluids/incropera2006_saturated_water.csv'
 
diff --git a/examples/script_pipe_losses.py b/examples/script_pipe_losses.py
index 6c6116f..ba7a385 100644
--- a/examples/script_pipe_losses.py
+++ b/examples/script_pipe_losses.py
@@ -18,25 +18,84 @@ import topupheat.pipes.trenches as _tre
 pipedata_files = [
     'pipes/enerpipe_caldopex_single.csv',
     'pipes/enerpipe_caldopex_twin.csv',
-    'pipes/isoplus_singlepipes_s1.csv',
-    'pipes/isoplus_singlepipes_s2.csv',
-    'pipes/isoplus_singlepipes_s3.csv',
+    'pipes/isoplus_single_disconti_s1.csv',
+    'pipes/isoplus_single_disconti_s2.csv',
+    'pipes/isoplus_single_disconti_s3.csv',
     'pipes/isoplus_twin_disconti_s1.csv',
     'pipes/isoplus_twin_disconti_s2.csv',
     'pipes/isoplus_twin_disconti_s3.csv',
     ]
 
+def minimum_assembling_distance(pipe_outer_diameter: float):
+    
+    if pipe_outer_diameter <= 0.065:
+        return 0.100
+    elif pipe_outer_diameter <= 0.075:
+        return 0.100    
+    elif pipe_outer_diameter <= 0.090:
+        return 0.100    
+    elif pipe_outer_diameter <= 0.110:
+        return 0.150    
+    elif pipe_outer_diameter <= 0.125:
+        return 0.150    
+    elif pipe_outer_diameter <= 0.140:
+        return 0.150
+    elif pipe_outer_diameter <= 0.160:
+        return 0.200    
+    elif pipe_outer_diameter <= 0.180:
+        return 0.200    
+    elif pipe_outer_diameter <= 0.200:
+        return 0.200    
+    elif pipe_outer_diameter <= 0.225:
+        return 0.200
+    elif pipe_outer_diameter <= 0.250:
+        return 0.200    
+    elif pipe_outer_diameter <= 0.280:
+        return 0.300
+    elif pipe_outer_diameter <= 0.315:
+        return 0.300
+    elif pipe_outer_diameter <= 0.355:
+        return 0.300   
+    elif pipe_outer_diameter <= 0.400:
+        return 0.400    
+    elif pipe_outer_diameter <= 0.450:
+        return 0.400
+    elif pipe_outer_diameter <= 0.500:
+        return 0.400    
+    elif pipe_outer_diameter <= 0.560:
+        return 0.500    
+    elif pipe_outer_diameter <= 0.630:
+        return 0.500    
+    elif pipe_outer_diameter <= 0.670:
+        return 0.600
+    elif pipe_outer_diameter <= 0.710:
+        return 0.600
+    elif pipe_outer_diameter <= 0.800:
+        return 0.700
+    elif pipe_outer_diameter <= 0.900:
+        return 0.700
+    elif pipe_outer_diameter <= 1.000:
+        return 0.800
+    elif pipe_outer_diameter <= 1.100:
+        return 0.800
+    elif pipe_outer_diameter <= 1.200:
+        return 0.900
+    elif pipe_outer_diameter <= 1.300:
+        return 0.900
+    else:
+        raise NotImplementedError
+        
 # *****************************************************************************
 # *****************************************************************************
 
 # specifications
 
 # maximum specific pressure drop
-list_max_specific_pressure_loss = [100] # Pa/m
+list_max_specific_pressure_loss = [80] # Pa/m
 
 # district heating details
-dh_flow_temperature = 273.15+100 # K
-dh_return_temperature = 273.15+100 # K
+dh_flow_temperature = 273.15+115 # K
+dh_return_temperature = 273.15+85 # K
 
 # temperature fluid bulk
 temperature_fluid_bulk = 0.5*(dh_return_temperature+dh_flow_temperature)
@@ -303,7 +362,7 @@ u_pipes = {
     (450, 3, 'isoplus', 'DRE-450-TWIRE'): 0.2703, 
     (500, 3, 'isoplus', 'DRE-500-TWIRE'): 0.2669, 
     (600, 3, 'isoplus', 'DRE-600-TWIRE'): 0.3065, 
-    # isoplus twin disconti
+    # isoplus twin disconti, standard
     (20, 1, 'isoplus', 'DRD-20-STD'): 0.1830,
     (25, 1, 'isoplus', 'DRD-25-STD'): 0.1981, 
     (32, 1, 'isoplus', 'DRD-32-STD'): 0.2154,
@@ -315,6 +374,170 @@ u_pipes = {
     (125, 1, 'isoplus', 'DRD-125-STD'): 0.3100,
     (150, 1, 'isoplus', 'DRD-150-STD'): 0.3763, 
     (200, 1, 'isoplus', 'DRD-200-STD'): 0.4115, 
+    # isoplus twin disconti, reinforced
+    (20, 2, 'isoplus', 'DRD-20-RE'): 0.1608, 
+    (25, 2, 'isoplus', 'DRD-25-RE'): 0.1700,
+    (32, 2, 'isoplus', 'DRD-32-RE'): 0.1856,
+    (40, 2, 'isoplus', 'DRD-40-RE'): 0.2144,
+    (50, 2, 'isoplus', 'DRD-50-RE'): 0.2076,
+    (65, 2, 'isoplus', 'DRD-65-RE'): 0.2430,
+    (80, 2, 'isoplus', 'DRD-80-RE'): 0.2653,
+    (100, 2, 'isoplus', 'DRD-100-RE'): 0.2635,
+    (125, 2, 'isoplus', 'DRD-125-RE'): 0.2488,
+    (150, 2, 'isoplus', 'DRD-150-RE'): 0.2914,
+    (200, 2, 'isoplus', 'DRD-200-RE'): 0.3037, 
+    # isoplus twin disconti, twice reinforced
+    (20, 3, 'isoplus', 'DRD-20-TWIRE'): 0.1423,
+    (25, 3, 'isoplus', 'DRD-25-TWIRE'): 0.1516, 
+    (32, 3, 'isoplus', 'DRD-32-TWIRE'): 0.1661,
+    (40, 3, 'isoplus', 'DRD-40-TWIRE'): 0.1882, 
+    (50, 3, 'isoplus', 'DRD-50-TWIRE'): 0.1833,
+    (65, 3, 'isoplus', 'DRD-65-TWIRE'): 0.2074,
+    (80, 3, 'isoplus', 'DRD-80-TWIRE'): 0.2199, 
+    (100, 3, 'isoplus', 'DRD-100-TWIRE'): 0.2197, 
+    (125, 3, 'isoplus', 'DRD-125-TWIRE'): 0.2126, 
+    (150, 3, 'isoplus', 'DRD-150-TWIRE'): 0.2379
+    }
+
+# pipe speeds
+
+m_pipes = { # 60-80 Pa
+    21.7: [0.4, 0.5], # 20
+    27.3: [0.8, 1.0],
+    36.0: [1.7, 2.0],
+    41.9: [2.5, 3.0],
+    53.9: [4.7, 5.5],
+    69.7: [9.3, 11.0],
+    82.5: [14.5, 16.5],
+    107.1: [28.5, 33.0],
+    132.5: [50.0, 58.0],
+    160.3: [82.0, 95.0],
+    210.1: [167.0, 193.0],
+    263.0: [300, 348],
+    312.7: [472, 547],
+    344.4: [610, 705],
+    393.8: [862, 1000],
+    444.6: [1180, 1370],
+    495.4: [1570, 1820],
+    595.8: [2520, 2920],
+    695.0: [3770, 4370],
+    795.4: [5390, 6240],
+    894.0: [7400, 9500],
+    #994.0: [9200, None],
+    }
+    
+    
+p_pipes = {
+    (20, 1, 'caldopex', '25-76'): 0,
+    (20, 2, 'caldopex', 'PLUS 25-91'): 0,
+    (25, 1, 'caldopex', '32-76'): 0,
+    (25, 2, 'caldopex', 'PLUS 32-91'): 0,
+    (32, 1, 'caldopex', '40-91'): 0,
+    (32, 2, 'caldopex', 'PLUS 40-111'): 0,
+    (40, 1, 'caldopex', '50-111'): 0, 
+    (40, 2, 'caldopex', 'PLUS 50-126'): 0, 
+    (50, 1, 'caldopex', '63-126'): 0,
+    (50, 2, 'caldopex', 'PLUS 63-142'): 0,
+    (65, 1, 'caldopex', '75-142'): 0,
+    (65, 2, 'caldopex', 'PLUS 75-162'): 0,
+    (80, 1, 'caldopex', '90-162'): 0,
+    (80, 2, 'caldopex', 'PLUS 90-182'): 0,
+    (100, 1, 'caldopex', '110-162'): 0, 
+    (100, 2, 'caldopex', '110-182'): 0,
+    (100, 3, 'caldopex', 'PLUS 110-202'): 0,
+    (125, 1, 'caldopex', '125-182'): 0, 
+    (125, 2, 'caldopex', 'PLUS 125-202'): 0, 
+    (125, 3, 'caldopex', '140-202'): 0,
+    (150, 1, 'caldopex', '160-250'): 0,
+    (20, 1, 'caldopex', '25+25-91'): 0, 
+    (20, 2, 'caldopex', 'PLUS 25+25-111'): 0, 
+    (25, 1, 'caldopex', '32+32-111'): 0,
+    (25, 2, 'caldopex', 'PLUS 32+32-126'): 0,
+    (32, 1, 'caldopex', '40+40-126'): 0, 
+    (32, 2, 'caldopex', 'PLUS 40+40-142'): 0,
+    (40, 1, 'caldopex', '50+50-162'): 0,
+    (40, 2, 'caldopex', 'PLUS 50+50-182'): 0, 
+    (50, 1, 'caldopex', '63+63-182'): 0,
+    (50, 2, 'caldopex', 'PLUS 63+63-202'): 0, 
+    (65, 1, 'caldopex', '75+75-202'): 0,
+    # single pipe, standard insulation
+    (20, 1, 'isoplus', 'DRE-20-STD'): 0.1295, 
+    (25, 1, 'isoplus', 'DRE-25-STD'): 0.1564, 
+    (32, 1, 'isoplus', 'DRE-32-STD'): 0.1589, 
+    (40, 1, 'isoplus', 'DRE-40-STD'): 0.1810, 
+    (50, 1, 'isoplus', 'DRE-50-STD'): 0.2013, 
+    (65, 1, 'isoplus', 'DRE-65-STD'): 0.2325, 
+    (80, 1, 'isoplus', 'DRE-80-STD'): 0.2418, 
+    (100, 1, 'isoplus', 'DRE-100-STD'): 0.2543, 
+    (125, 1, 'isoplus', 'DRE-125-STD'): 0.2880, 
+    (150, 1, 'isoplus', 'DRE-150-STD'): 0.3369, 
+    (200, 1, 'isoplus', 'DRE-200-STD'): 0.3686, 
+    (250, 1, 'isoplus', 'DRE-250-STD'): 0.3637, 
+    (300, 1, 'isoplus', 'DRE-300-STD'): 0.4126, 
+    (350, 1, 'isoplus', 'DRE-350-STD'): 0.4009, 
+    (400, 1, 'isoplus', 'DRE-400-STD'): 0.4222, 
+    (450, 1, 'isoplus', 'DRE-450-STD'): 0.4242,
+    (500, 1, 'isoplus', 'DRE-500-STD'): 0.4149, 
+    (600, 1, 'isoplus', 'DRE-600-STD'): 0.5002, 
+    (700, 1, 'isoplus', 'DRE-700-STD'): 0.5665, 
+    (800, 1, 'isoplus', 'DRE-800-STD'): 0.6372, 
+    (900, 1, 'isoplus', 'DRE-900-STD'): 0.7027, 
+    (1000, 1, 'isoplus', 'DRE-1000-STD'): 0.7742,
+    # single pipe, reinforced    
+    (20, 2, 'isoplus', 'DRE-20-RE'): 0.1114, 
+    (25, 2, 'isoplus', 'DRE-25-RE'): 0.1308, 
+    (32, 2, 'isoplus', 'DRE-32-RE'): 0.1420, 
+    (40, 2, 'isoplus', 'DRE-40-RE'): 0.1593, 
+    (50, 2, 'isoplus', 'DRE-50-RE'): 0.1763, 
+    (65, 2, 'isoplus', 'DRE-65-RE'): 0.1980, 
+    (80, 2, 'isoplus', 'DRE-80-RE'): 0.2076, 
+    (100, 2, 'isoplus', 'DRE-100-RE'): 0.2148,
+    (125, 2, 'isoplus', 'DRE-125-RE'): 0.2459, 
+    (150, 2, 'isoplus', 'DRE-150-RE'): 0.2794, 
+    (200, 2, 'isoplus', 'DRE-200-RE'): 0.2953,
+    (250, 2, 'isoplus', 'DRE-250-RE'): 0.2914, 
+    (300, 2, 'isoplus', 'DRE-300-RE'): 0.3284, 
+    (350, 2, 'isoplus', 'DRE-350-RE'): 0.3169, 
+    (400, 2, 'isoplus', 'DRE-400-RE'): 0.3277,
+    (450, 2, 'isoplus', 'DRE-450-RE'): 0.3299, 
+    (500, 2, 'isoplus', 'DRE-500-RE'): 0.3249,
+    (600, 2, 'isoplus', 'DRE-600-RE'): 0.3748,
+    (700, 2, 'isoplus', 'DRE-700-RE'): 0.4238, 
+    (800, 2, 'isoplus', 'DRE-800-RE'): 0.4732, 
+    (900, 2, 'isoplus', 'DRE-900-RE'): 0.5221,
+    (1000, 2, 'isoplus', 'DRE-1000-RE'): 0.5733,
+    # single pipe, twice reinforced
+    (20, 3, 'isoplus', 'DRE-20-TWIRE'): 0.10280, 
+    (25, 3, 'isoplus', 'DRE-25-TWIRE'): 0.1191,
+    (32, 3, 'isoplus', 'DRE-32-TWIRE'): 0.1290, 
+    (40, 3, 'isoplus', 'DRE-40-TWIRE'): 0.1432, 
+    (50, 3, 'isoplus', 'DRE-50-TWIRE'): 0.1557,
+    (65, 3, 'isoplus', 'DRE-65-TWIRE'): 0.1744, 
+    (80, 3, 'isoplus', 'DRE-80-TWIRE'): 0.1847,
+    (100, 3, 'isoplus', 'DRE-100-TWIRE'): 0.1905, 
+    (125, 3, 'isoplus', 'DRE-125-TWIRE'): 0.2138, 
+    (150, 3, 'isoplus', 'DRE-150-TWIRE'): 0.2343,
+    (200, 3, 'isoplus', 'DRE-200-TWIRE'): 0.2472, 
+    (250, 3, 'isoplus', 'DRE-250-TWIRE'): 0.2468, 
+    (300, 3, 'isoplus', 'DRE-300-TWIRE'): 0.2698, 
+    (350, 3, 'isoplus', 'DRE-350-TWIRE'): 0.2605, 
+    (400, 3, 'isoplus', 'DRE-400-TWIRE'): 0.2684, 
+    (450, 3, 'isoplus', 'DRE-450-TWIRE'): 0.2703, 
+    (500, 3, 'isoplus', 'DRE-500-TWIRE'): 0.2669, 
+    (600, 3, 'isoplus', 'DRE-600-TWIRE'): 0.3065, 
+    # isoplus twin disconti, standard, 30K delta T
+    (20, 1, 'isoplus', 'DRD-20-STD'): (25,54),
+    (25, 1, 'isoplus', 'DRD-25-STD'): (40,88), 
+    (32, 1, 'isoplus', 'DRD-32-STD'): (82,164),
+    (40, 1, 'isoplus', 'DRD-40-STD'): (110,220),
+    (50, 1, 'isoplus', 'DRD-50-STD'): (205,410), 
+    (65, 1, 'isoplus', 'DRD-65-STD'): (341,683), 
+    (80, 1, 'isoplus', 'DRD-80-STD'): (537,1074),
+    (100, 1, 'isoplus', 'DRD-100-STD'): (905,1811),
+    (125, 1, 'isoplus', 'DRD-125-STD'): (1732,3118),
+    (150, 1, 'isoplus', 'DRD-150-STD'): (3042,5324), 
+    (200, 1, 'isoplus', 'DRD-200-STD'): (6097,10451), 
+    # isoplus twin disconti, reinforced, 30K delta T
     (20, 2, 'isoplus', 'DRD-20-RE'): 0.1608, 
     (25, 2, 'isoplus', 'DRD-25-RE'): 0.1700,
     (32, 2, 'isoplus', 'DRD-32-RE'): 0.1856,
@@ -326,6 +549,7 @@ u_pipes = {
     (125, 2, 'isoplus', 'DRD-125-RE'): 0.2488,
     (150, 2, 'isoplus', 'DRD-150-RE'): 0.2914,
     (200, 2, 'isoplus', 'DRD-200-RE'): 0.3037, 
+    # isoplus twin disconti, twice reinforced, 30K delta T
     (20, 3, 'isoplus', 'DRD-20-TWIRE'): 0.1423,
     (25, 3, 'isoplus', 'DRD-25-TWIRE'): 0.1516, 
     (32, 3, 'isoplus', 'DRD-32-TWIRE'): 0.1661,
@@ -407,7 +631,8 @@ for max_specific_pressure_loss in list_max_specific_pressure_loss:
         # single pipe trench    
         single_trench = SupplyReturnPipeTrench(
             pipe_center_depth=[pipe_depth+pipe.d_cas/2 for pipe in list_single_pipes],  
-            pipe_center_distance=[pipe_distance+pipe.d_cas for pipe in list_single_pipes], 
+            # pipe_center_distance=[pipe_distance+pipe.d_cas for pipe in list_single_pipes], # minimum_assembling_distance
+            pipe_center_distance=[minimum_assembling_distance(pipe.d_cas)+pipe.d_cas for pipe in list_single_pipes],
             fluid_db=fluiddb, 
             phase=fluiddb.fluid_LIQUID, 
             pressure=[1e5 for i in range(len(list_single_pipes))], 
@@ -489,6 +714,30 @@ fig.set_size_inches(15,10)
 
 model_string_ids = ['-STD','-RE','-TWIRE']
 
+style_category_single_official = {
+    0: 'ro-',
+    1: 'rx-',
+    2: 'rd-'
+    }
+
+style_category_single_model = {
+    0: 'go-',
+    1: 'gx-',
+    2: 'gd-'
+    }
+
+style_category_twin_official = {
+    0: 'bo-',
+    1: 'bx-',
+    2: 'bd-'
+    }
+
+style_category_twin_model = {
+    0: 'ko-',
+    1: 'kx-',
+    2: 'kd-'
+    }
+
 single_pipe_tuples_per_tech = {
     i: [pipe_tuple for pipe_tuple in list_single_pipe_tuples if model_string_ids[i] in pipe_tuple[3]]
     for i, _str in enumerate(model_string_ids)
@@ -499,77 +748,68 @@ twin_pipe_tuples_per_tech = {
     for i, _str in enumerate(model_string_ids)
     }
 
+# official
+
 for max_specific_pressure_loss in list_max_specific_pressure_loss:
+    # single pipe
     for tech_index, _single_pipe_tuples in single_pipe_tuples_per_tech.items():
         
         _indices = [list_single_pipe_tuples.index(pipe_tuple) for pipe_tuple in _single_pipe_tuples]
-        # single pipe
-        ax.plot(
+        
+        ax.semilogy(
             [1000*list_single_pipes[index].d_int for index in _indices], 
             [2*u_pipes[pipe_tuple]*(temperature_fluid_bulk-ground_temperature)
              for pipe_tuple in _single_pipe_tuples],
-            'ro-',
+            style_category_single_official[tech_index],
             markersize=10,
-            label='topupheat, tech '+str(model_string_ids[tech_index])
+            label='isoplus, 2x single, tech '+str(model_string_ids[tech_index][1:])+' (datasheet)'
             )
-        
+    # twin pipe  
     for tech_index, _twin_pipe_tuples in twin_pipe_tuples_per_tech.items():
         
         _indices = [list_twin_pipe_tuples.index(pipe_tuple) for pipe_tuple in _twin_pipe_tuples]
-        # twin pipe
-        ax.plot(
+        
+        ax.semilogy(
             [1000*list_twin_pipes[index].d_int for index in _indices], 
             [u_pipes[pipe_tuple]*(temperature_fluid_bulk-ground_temperature)
              for pipe_tuple in _twin_pipe_tuples],
-            'bo-',
+            style_category_twin_official[tech_index],
             markersize=10,
-            label='topupheat, tech '+str(model_string_ids[tech_index])
+            label='isoplus, 1x twin, tech '+str(model_string_ids[tech_index][1:])+' (datasheet)'
             )
-
-    
-    # # single pipe
-    # ax.plot([1000*pipe.d_int for pipe in list_single_pipes], 
-    #         [u_pipes[pipe.pipe_tuple]*(temperature_fluid_bulk-ground_temperature)
-    #          for pipe in list_single_pipes],
-    #         'ro',
-    #         markersize=10,
-    #         label='Single @ '+str(max_specific_pressure_loss)+' Pa/m') 
-
-    # # twin pipe
-    # ax.plot([1000*pipe.d_int for pipe in list_twin_pipes], 
-    #         [u_pipes[pipe.pipe_tuple]*(temperature_fluid_bulk-ground_temperature)
-    #          for pipe in list_twin_pipes],
-    #         'go',
-    #         markersize=10,
-    #         label='Twin @ '+str(max_specific_pressure_loss)+' Pa/m') 
-
-    # ax.plot([1000*single_trench.supply_pipe.d_int
-    #          for single_trench in dict_single_trench[max_specific_pressure_loss]], 
-    #         [qloss_line #sum(qloss_line)
-    #          for qloss_line in dict_heat_losses[max_specific_pressure_loss]],
-    #         'ro-',
-    #         markersize=10,
-    #         label='Results @ '+str(max_specific_pressure_loss)+' Pa/m') 
-
-#     ax.plot([d_int*1000 for d_int in table_d_int],
-#             table_losses,
-#             'bs-',
-#             markersize=10,
-#             label='Röder et al. (2021)')
-
-ax.plot([1000*pipe.d_int for pipe in list_single_pipes],
-        [dict_single_heat_transfer_rate[max_specific_pressure_loss][i]
-         for i, pipe_tuple in enumerate(list_single_pipe_tuples)],
-        'gx',
-        markersize=10,
-        label='isoplus, 2x single')
-
-ax.plot([1000*pipe.d_int for pipe in list_twin_pipes],
-        [dict_twin_heat_transfer_rate[max_specific_pressure_loss][i]
-         for i, pipe_tuple in enumerate(list_twin_pipe_tuples)],
-        'k^',
-        markersize=10,
-        label='isoplus, 1x twin')
+        
+# model, single
+for tech_index, _single_pipe_tuples in single_pipe_tuples_per_tech.items():
+    _indices = [list_single_pipe_tuples.index(pipe_tuple) for pipe_tuple in _single_pipe_tuples]
+    ax.semilogy([1000*list_single_pipes[index].d_int for index in _indices], 
+            [dict_single_heat_transfer_rate[max_specific_pressure_loss][list_single_pipe_tuples.index(pipe_tuple)]
+             for pipe_tuple in _single_pipe_tuples],
+            style_category_single_model[tech_index],
+            markersize=10,
+            label='isoplus, 2x single (model)')
+# model, twin    
+for tech_index, _twin_pipe_tuples in twin_pipe_tuples_per_tech.items(): 
+    _indices = [list_twin_pipe_tuples.index(pipe_tuple) for pipe_tuple in _twin_pipe_tuples]
+    ax.semilogy([1000*list_twin_pipes[index].d_int for index in _indices], 
+            [dict_twin_heat_transfer_rate[max_specific_pressure_loss][list_twin_pipe_tuples.index(pipe_tuple)]
+             for pipe_tuple in _twin_pipe_tuples],
+            style_category_twin_model[tech_index],
+            markersize=10,
+            label='isoplus, 1x twin (model)')
+
+# ax.plot([1000*pipe.d_int for pipe in list_single_pipes],
+#         [dict_single_heat_transfer_rate[max_specific_pressure_loss][i]
+#          for i, pipe_tuple in enumerate(list_single_pipe_tuples)],
+#         'gx',
+#         markersize=10,
+#         label='isoplus, 2x single (model)')
+
+# ax.plot([1000*pipe.d_int for pipe in list_twin_pipes],
+#         [dict_twin_heat_transfer_rate[max_specific_pressure_loss][i]
+#          for i, pipe_tuple in enumerate(list_twin_pipe_tuples)],
+#         'k^',
+#         markersize=10,
+#         label='isoplus, 1x twin (model)')
 
 ax.set(xlabel='Nominal diameter (DN)', 
        ylabel='Specific heat losses [W/m]',
@@ -582,82 +822,72 @@ ax.legend()
 # fig.savefig("test.png")
 plt.show()
 
-# *****************************************************************************
-# *****************************************************************************
-# *****************************************************************************
-# ***************************************************************************** 
-
-# plot the pipe heat losses as a function of pipe heat capacity
-
-# # Röder2021: http://doi.org/10.5278/ijsepm.6248
-    
-# table_phc = [0.07e6,0.08e6,0.1e6,0.2e6,0.35e6,0.6e6,0.800e6,1.495e6,2.05e6,3.95e6]
-# table_losses = [7,8,9,8.5,12,16,18,22,31,33] # W/m
-# list_losses = [heat/pipe_length for heat in list_heat_transfer_rate]
-
-# fig, ax = plt.subplots()
-
-# ax.plot([-pc for pc in list_pc],
-#         list_losses)
-
-# ax.plot(table_phc,
-#         table_losses)
-
-# ax.set(xlabel='pipe heat capacity (kW)', 
-#         ylabel='Specific heat losses [-]',
-#         title='Specific heat losses as a function of pipe heat capacity')
-
-# ax.grid()
-
-# # fig.savefig("test.png")
-# plt.show()
-
-# *****************************************************************************
-# *****************************************************************************
-# *****************************************************************************
-# *****************************************************************************
 # *****************************************************************************
 # ***************************************************************************** 
 
-# # plot the pipe heat capacity as a function of the pipe diameter
-
-# # Röder2021: http://doi.org/10.5278/ijsepm.6248
-
-# fig, ax = plt.subplots()
-
-# fig.set_size_inches(15,10)
+# plot of the pipe heat capacity as a function of the diameter
 
-# for max_specific_pressure_loss in list_max_specific_pressure_loss:
+fig, ax = plt.subplots()
+fig.set_size_inches(15,10)
 
-#     ax.plot([1000*pipe.d_int
-#              for pipe in dict_single_trench[max_specific_pressure_loss].supply_pipe],
-#             [htr/1e3
-#              for htr in dict_single_capacity[max_specific_pressure_loss]],
-#             'ro-',
-#             label='Results @ '+str(max_specific_pressure_loss)+' Pa/m')
+cpdt = 4187*30*(3600/1000)/1000 # m in tons per hour; cpdt has to be in J/Kg
+        
+max_specific_pressure_loss = 80
+        
+# single pipe
+ax.semilogy(
+    [d for d in m_pipes], 
+    [cpdt*m[0] for d, m in m_pipes.items()],
+    'go-',
+    markersize=10,
+    label='isoplus, 2x single, 60 Pa/m (datasheet)'
+    )
+            
+# single pipe
+ax.semilogy(
+    [d for d in m_pipes], 
+    [cpdt*m[1] for d, m in m_pipes.items()],
+    'ro-',
+    markersize=10,
+    label='isoplus, 2x single, 80 Pa/m (datasheet)'
+    )
 
-# # *****************************************************************************
+for max_specific_pressure_loss in list_max_specific_pressure_loss:
+    
+    # the friction factor is correct at DN600 but not the RE and the fluid speed
+    
+    # model, single
+    for tech_index, _single_pipe_tuples in single_pipe_tuples_per_tech.items():
+        _indices = [list_single_pipe_tuples.index(pipe_tuple) for pipe_tuple in _single_pipe_tuples]
+        ax.semilogy(
+            [1000*list_single_pipes[index].d_int for index in _indices], 
+            [dict_single_capacity[max_specific_pressure_loss][list_single_pipe_tuples.index(pipe_tuple)]/1e3
+             for pipe_tuple in _single_pipe_tuples],
+            # [1000*pipe.d_int for pipe in list_single_pipes],
+            # [dict_single_capacity[max_specific_pressure_loss][i]/1e3
+            #  for i, pipe_tuple in enumerate(list_single_pipe_tuples)],
+            'gx',
+            markersize=10,
+            label='isoplus, 2x single (model)')
+        break
 
-# ax.plot(table_dn,
-#         #[d_int*1000 for d_int in table_d_int],
-#         table_power,
-#         'bx-',
-#         label='Röder et al. (2021)')
+# ax.semilogy([1000*pipe.d_int for pipe in list_twin_pipes],
+#         [dict_twin_capacity[max_specific_pressure_loss][i]/1e3
+#          for i, pipe_tuple in enumerate(list_twin_pipe_tuples)],
+#         'k^',
+#         markersize=10,
+#         label='isoplus, 1x twin (model)')
 
-# ax.set(xlabel='Nominal diameter [mm]', 
-#        ylabel='Heat transfer rate [kW]',
-#        title='Pipe design capacity comparison: own vs Röder et al. (2021)')
+ax.set(xlabel='Nominal diameter (DN)', 
+       ylabel='Capacity [kW]',
+       title='Specific heat losses as a function of pipe diameter')
 
-# ax.grid()
+ax.grid()
 
-# ax.legend()
+ax.legend()
 
-# # fig.savefig("test.png")
-# plt.show()
+# fig.savefig("test.png")
+plt.show()
 
-# *****************************************************************************
-# *****************************************************************************
-# *****************************************************************************
-# *****************************************************************************
 # *****************************************************************************
 # *****************************************************************************
\ No newline at end of file
diff --git a/src/topupheat/pipes/utils.py b/src/topupheat/pipes/utils.py
index de8bc6d..30a4719 100644
--- a/src/topupheat/pipes/utils.py
+++ b/src/topupheat/pipes/utils.py
@@ -306,6 +306,90 @@ def recommended_minimum_interpipe_distance(pipe: fic.InsulatedPipe):
     else:
         
         return pipe.d_cas+300/1000
-             
+    
+# *****************************************************************************
+# *****************************************************************************
+        
+def minimum_assembling_distance_isoplus(pipe_outer_diameter: float):
+    """
+    Returns the minimum recommended distance between two (single) pipes in a 
+    district heating trench, according to the manufacturer isoplus.
+    
+    The distance is measured from the outer surface of the pipes.
+
+    Parameters
+    ----------
+    pipe_outer_diameter : float
+        The outer diameter of the pipe.
+
+    Raises
+    ------
+    NotImplementedError
+        This error is raised if the pipe diameter is too large.
+
+    Returns
+    -------
+    float
+        The pipe distance in meters.
+
+    """
+    
+    if pipe_outer_diameter <= 0.065:
+        return 0.100
+    elif pipe_outer_diameter <= 0.075:
+        return 0.100    
+    elif pipe_outer_diameter <= 0.090:
+        return 0.100    
+    elif pipe_outer_diameter <= 0.110:
+        return 0.150    
+    elif pipe_outer_diameter <= 0.125:
+        return 0.150    
+    elif pipe_outer_diameter <= 0.140:
+        return 0.150
+    elif pipe_outer_diameter <= 0.160:
+        return 0.200    
+    elif pipe_outer_diameter <= 0.180:
+        return 0.200    
+    elif pipe_outer_diameter <= 0.200:
+        return 0.200    
+    elif pipe_outer_diameter <= 0.225:
+        return 0.200
+    elif pipe_outer_diameter <= 0.250:
+        return 0.200    
+    elif pipe_outer_diameter <= 0.280:
+        return 0.300
+    elif pipe_outer_diameter <= 0.315:
+        return 0.300
+    elif pipe_outer_diameter <= 0.355:
+        return 0.300   
+    elif pipe_outer_diameter <= 0.400:
+        return 0.400    
+    elif pipe_outer_diameter <= 0.450:
+        return 0.400
+    elif pipe_outer_diameter <= 0.500:
+        return 0.400    
+    elif pipe_outer_diameter <= 0.560:
+        return 0.500    
+    elif pipe_outer_diameter <= 0.630:
+        return 0.500    
+    elif pipe_outer_diameter <= 0.670:
+        return 0.600
+    elif pipe_outer_diameter <= 0.710:
+        return 0.600
+    elif pipe_outer_diameter <= 0.800:
+        return 0.700
+    elif pipe_outer_diameter <= 0.900:
+        return 0.700
+    elif pipe_outer_diameter <= 1.000:
+        return 0.800
+    elif pipe_outer_diameter <= 1.100:
+        return 0.800
+    elif pipe_outer_diameter <= 1.200:
+        return 0.900
+    elif pipe_outer_diameter <= 1.300:
+        return 0.900
+    else:
+        raise NotImplementedError
+    
 # *****************************************************************************
 # *****************************************************************************
\ No newline at end of file
diff --git a/tests/test_all.py b/tests/test_all.py
index 061fae1..ffb4263 100644
--- a/tests/test_all.py
+++ b/tests/test_all.py
@@ -20,15 +20,15 @@ def test_suite():
     # load fluid data
     
     # load pipe data
-    singlepipedata_files = ['tests/data/isoplus_singlepipes_s1.csv',
-                            'tests/data/isoplus_singlepipes_s2.csv',
-                            'tests/data/isoplus_singlepipes_s3.csv']
+    singlepipedata_files = ['tests/data/isoplus_single_disconti_s1.csv',
+                            'tests/data/isoplus_single_disconti_s1.csv',
+                            'tests/data/isoplus_single_disconti_s1.csv']
     singlepipedb = StandardisedPipeDatabase(source=singlepipedata_files)
     
     # twin pipe data files
-    twinpipedata_files = ['tests/data/isoplus_twinpipes_s1.csv',
-                          'tests/data/isoplus_twinpipes_s2.csv',
-                          'tests/data/isoplus_twinpipes_s3.csv']
+    twinpipedata_files = ['tests/data/isoplus_twin_disconti_s1.csv',
+                          'tests/data/isoplus_twin_disconti_s2.csv',
+                          'tests/data/isoplus_twin_disconti_s3.csv']
     twinpipedb = StandardisedPipeDatabase(source=twinpipedata_files)
     
     # get oil properties' database
diff --git a/tests/test_pipes.py b/tests/test_pipes.py
index 7c5f643..c47ea5e 100644
--- a/tests/test_pipes.py
+++ b/tests/test_pipes.py
@@ -186,9 +186,9 @@ class TestPipe:
         
         # twin pipe data files
         
-        twinpipedata_files = ['tests/data/isoplus_twinpipes_s1.csv',
-                              'tests/data/isoplus_twinpipes_s2.csv',
-                              'tests/data/isoplus_twinpipes_s3.csv']
+        twinpipedata_files = ['tests/data/isoplus_twin_disconti_s1.csv',
+                              'tests/data/isoplus_twin_disconti_s2.csv',
+                              'tests/data/isoplus_twin_disconti_s3.csv']
         
         pipedb = StandardisedPipeDatabase(source=twinpipedata_files)
         
@@ -245,9 +245,9 @@ class TestPipe:
         
     def test_create_standardised_pipe_via_db(self):
         
-        singlepipedata_files = ['tests/data/isoplus_singlepipes_s1.csv',
-                                'tests/data/isoplus_singlepipes_s2.csv',
-                                'tests/data/isoplus_singlepipes_s3.csv']
+        singlepipedata_files = ['tests/data/isoplus_single_disconti_s1.csv',
+                                'tests/data/isoplus_single_disconti_s1.csv',
+                                'tests/data/isoplus_single_disconti_s3.csv']
         
         pipedb = StandardisedPipeDatabase(source=singlepipedata_files)
         
@@ -323,34 +323,34 @@ class TestPipe:
     def test_create_single_standardised_db(self):
         
         pipe_files = [
-            'tests/data/caldopex_single.csv',
+            'tests/data/enerpipe_caldopex_single.csv',
             ]
         pipedb = StandardisedPipeDatabase(source=pipe_files)
         
         # specify
         true_pipe_tuples = [
             # single
-            (25,1,'caldopex','25-76'),
-            (25,2,'caldopex','PLUS 25-91'),
-            (32,1,'caldopex','32-76'),
-            (32,2,'caldopex','PLUS 32-91'),
-            (40,1,'caldopex','40-91'),
-            (40,2,'caldopex','PLUS 40-111'),
-            (50,1,'caldopex','50-111'),
-            (50,2,'caldopex','PLUS 50-126'),
-            (63,1,'caldopex','63-126'),
-            (63,2,'caldopex','PLUS 63-142'),
-            (75,1,'caldopex','75-142'),
-            (75,2,'caldopex','PLUS 75-162'),
-            (90,1,'caldopex','90-162'),
-            (90,2,'caldopex','PLUS 90-182'),
-            (110,1,'caldopex','110-162'),
-            (110,2,'caldopex','110-182'),
-            (110,3,'caldopex','PLUS 110-202'),
+            (20,1,'caldopex','25-76'),
+            (20,2,'caldopex','PLUS 25-91'),
+            (25,1,'caldopex','32-76'),
+            (25,2,'caldopex','PLUS 32-91'),
+            (32,1,'caldopex','40-91'),
+            (32,2,'caldopex','PLUS 40-111'),
+            (40,1,'caldopex','50-111'),
+            (40,2,'caldopex','PLUS 50-126'),
+            (50,1,'caldopex','63-126'),
+            (50,2,'caldopex','PLUS 63-142'),
+            (65,1,'caldopex','75-142'),
+            (65,2,'caldopex','PLUS 75-162'),
+            (80,1,'caldopex','90-162'),
+            (80,2,'caldopex','PLUS 90-182'),
+            (100,1,'caldopex','110-162'),
+            (100,2,'caldopex','110-182'),
+            (100,3,'caldopex','PLUS 110-202'),
             (125,1,'caldopex','125-182'),
             (125,2,'caldopex','PLUS 125-202'),
-            (140,1,'caldopex','140-202'),
-            (160,1,'caldopex','160-250'),
+            (125,3,'caldopex','140-202'),
+            (150,1,'caldopex','160-250'),
             ]
         pipe_tuples = list(pipedb.pipe_tuples)
         assert len(pipe_tuples) == len(true_pipe_tuples)
@@ -364,7 +364,7 @@ class TestPipe:
     def test_create_twin_standardised_db(self):
         
         pipe_files = [
-            'tests/data/caldopex_twin.csv'
+            'tests/data/enerpipe_caldopex_twin.csv'
             ]
         pipedb = StandardisedPipeDatabase(source=pipe_files)
         
@@ -374,7 +374,7 @@ class TestPipe:
             (20,1,'caldopex','25+25-91'),
             (20,2,'caldopex','PLUS 25+25-111'),
             (25,1,'caldopex','32+32-111'),
-            (25,2,'caldopex','PLUS 32 +32-126'),
+            (25,2,'caldopex','PLUS 32+32-126'),
             (32,1,'caldopex','40+40-126'),
             (32,2,'caldopex','PLUS 40+40-142'),
             (40,1,'caldopex','50+50-162'),
@@ -398,40 +398,40 @@ class TestPipe:
     def test_create_mixed_standardised_db(self):
         
         pipe_files = [
-            'tests/data/caldopex_single.csv',
-            'tests/data/caldopex_twin.csv'
+            'tests/data/enerpipe_caldopex_single.csv',
+            'tests/data/enerpipe_caldopex_twin.csv'
             ]
         pipedb = StandardisedPipeDatabase(source=pipe_files)
         
         # specify
         true_pipe_tuples = [
             # single
-            (25,1,'caldopex','25-76'),
-            (25,2,'caldopex','PLUS 25-91'),
-            (32,1,'caldopex','32-76'),
-            (32,2,'caldopex','PLUS 32-91'),
-            (40,1,'caldopex','40-91'),
-            (40,2,'caldopex','PLUS 40-111'),
-            (50,1,'caldopex','50-111'),
-            (50,2,'caldopex','PLUS 50-126'),
-            (63,1,'caldopex','63-126'),
-            (63,2,'caldopex','PLUS 63-142'),
-            (75,1,'caldopex','75-142'),
-            (75,2,'caldopex','PLUS 75-162'),
-            (90,1,'caldopex','90-162'),
-            (90,2,'caldopex','PLUS 90-182'),
-            (110,1,'caldopex','110-162'),
-            (110,2,'caldopex','110-182'),
-            (110,3,'caldopex','PLUS 110-202'),
+            (20,1,'caldopex','25-76'),
+            (20,2,'caldopex','PLUS 25-91'),
+            (25,1,'caldopex','32-76'),
+            (25,2,'caldopex','PLUS 32-91'),
+            (32,1,'caldopex','40-91'),
+            (32,2,'caldopex','PLUS 40-111'),
+            (40,1,'caldopex','50-111'),
+            (40,2,'caldopex','PLUS 50-126'),
+            (50,1,'caldopex','63-126'),
+            (50,2,'caldopex','PLUS 63-142'),
+            (65,1,'caldopex','75-142'),
+            (65,2,'caldopex','PLUS 75-162'),
+            (80,1,'caldopex','90-162'),
+            (80,2,'caldopex','PLUS 90-182'),
+            (100,1,'caldopex','110-162'),
+            (100,2,'caldopex','110-182'),
+            (100,3,'caldopex','PLUS 110-202'),
             (125,1,'caldopex','125-182'),
             (125,2,'caldopex','PLUS 125-202'),
-            (140,1,'caldopex','140-202'),
-            (160,1,'caldopex','160-250'),
+            (125,3,'caldopex','140-202'),
+            (150,1,'caldopex','160-250'),
             # twin
             (20,1,'caldopex','25+25-91'),
             (20,2,'caldopex','PLUS 25+25-111'),
             (25,1,'caldopex','32+32-111'),
-            (25,2,'caldopex','PLUS 32 +32-126'),
+            (25,2,'caldopex','PLUS 32+32-126'),
             (32,1,'caldopex','40+40-126'),
             (32,2,'caldopex','PLUS 40+40-142'),
             (40,1,'caldopex','50+50-162'),
diff --git a/tests/test_system.py b/tests/test_system.py
index 4a8273d..284036f 100644
--- a/tests/test_system.py
+++ b/tests/test_system.py
@@ -16,7 +16,7 @@ class TestPipeSystem:
         
         # load pipe data
             
-        singlepipedata_files = ['tests/data/caldopex_single.csv']
+        singlepipedata_files = ['tests/data/enerpipe_caldopex_single.csv']
         singlepipedb = StandardisedPipeDatabase(source=singlepipedata_files)
         
         # water 
@@ -36,16 +36,16 @@ class TestPipeSystem:
         temperature_surroundings = 10+273.15
         
         pipe_tuples = [
-            (25,2),     # 1
-            (32,2),     # 2
-            (40,2),     # 3
-            (50,2),     # 4 
-            (63,2),     # 5 
-            (75,2),     # 6 twin pipe too! the DN is all that matters here
-            (90,2),     # 7
-            (110,2),    # 8
+            (20,2),     # 1
+            (25,2),     # 2
+            (32,2),     # 3
+            (40,2),     # 4 
+            (50,2),     # 5 
+            (65,2),     # 6 twin pipe too! the DN is all that matters here
+            (80,2),     # 7
+            (100,2),    # 8
             (125,2),    # 9
-            (160,1)     # 11
+            (150,1)     # 11
             ]
     
         pipes = {
@@ -234,7 +234,7 @@ class TestPipeSystem:
         
         # load pipe data
             
-        singlepipedata_files = ['tests/data/caldopex_single.csv']
+        singlepipedata_files = ['tests/data/enerpipe_caldopex_single.csv']
         singlepipedb = StandardisedPipeDatabase(source=singlepipedata_files)
         
         # water 
@@ -254,16 +254,16 @@ class TestPipeSystem:
         temperature_surroundings = 10+273.15
         
         pipe_tuples = [
-            (25,2),     # 1
-            (32,2),     # 2
-            (40,2),     # 3
-            (50,2),     # 4 
-            (63,2),     # 5 
-            (75,2),     # 6 twin pipe too! the DN is all that matters here
-            (90,2),     # 7
-            (110,2),    # 8
+            (20,2),     # 1
+            (25,2),     # 2
+            (32,2),     # 3
+            (40,2),     # 4 
+            (50,2),     # 5 
+            (65,2),     # 6 twin pipe too! the DN is all that matters here
+            (80,2),     # 7
+            (100,2),    # 8
             (125,2),    # 9
-            (160,1)     # 11
+            (150,1)     # 11
             ]
     
         pipes = {
diff --git a/tests/test_trenches.py b/tests/test_trenches.py
index c288613..d47da40 100644
--- a/tests/test_trenches.py
+++ b/tests/test_trenches.py
@@ -2510,233 +2510,12 @@ class TestPipeTrench:
        
     # *************************************************************************
     
-    def test_roder2021(self):
-        
-        # load pipe data
-            
-        singlepipedata_files = [
-            'tests/data/caldopex_single.csv',
-            'tests/data/caldopex_twin.csv'
-            ]
-        pipedb = StandardisedPipeDatabase(source=singlepipedata_files)
-        
-        # water 
-        
-        waterdata_file = 'tests/data/incropera2006_saturated_water.csv'
-        phase = FluidDatabase.fluid_LIQUID
-        fluid_db = FluidDatabase(
-            fluid='fluid',
-            phase=phase,
-            source=waterdata_file
-            )
-        
-        supply_temperature = 80+273.15
-        return_temperature = 50+273.15
-        pressure = 1e5
-        max_specific_pressure_loss = 100 # Pa/m
-        pipe_depth_top = 0.8 # m
-        pipe_distance_edge = 0.1 # m
-        
-        ground_air_heat_transfer_coefficient = inf
-        ground_thermal_conductivity = 1.0
-        temperature_surroundings = 10+273.15
-        
-        pipe_tuples = [
-            # single
-            # (25,1,'caldopex','25/76'),
-            # (25,2,'caldopex','PLUS 25/91'),
-            # (32,1,'caldopex','32/76'),
-            # (32,2,'caldopex','PLUS 32/91'),
-            # (40,1,'caldopex','40/91'),
-            # (40,2,'caldopex','PLUS 40/111'),
-            # (50,1,'caldopex','50/111'),
-            # (50,2,'caldopex','PLUS 50/126'),
-            # (63,1,'caldopex','63/126'),
-            # (63,2,'caldopex','PLUS 63/142'),
-            # (75,1,'caldopex','75/142'),
-            (75,2,'caldopex','PLUS 75/162'),
-            # (90,1,'caldopex','90/162'),
-            (90,2,'caldopex','PLUS 90/182'),
-            # (110,1,'caldopex','110/162'),
-            # (110,2,'caldopex','110/182'),
-            (110,3,'caldopex','PLUS 110/202'),
-            # (125,1,'caldopex','125/182'),
-            (125,2,'caldopex','PLUS 125/202'),
-            # (140,1,'caldopex','140/202'),
-            (160,1,'caldopex','160/250'),
-            # twin
-            # (20,1,'caldopex','25+25/91'),
-            (20,2,'caldopex','PLUS 25+25/111'),
-            # (25,1,'caldopex','32+32/111'),
-            (25,2,'caldopex','PLUS 32 +32/126'),
-            # (32,1,'caldopex','40+40/126'),
-            (32,2,'caldopex','PLUS 40+40/142'),
-            # (40,1,'caldopex','50+50/162'),
-            (40,2,'caldopex','PLUS 50+50/182'),
-            # (50,1,'caldopex','63+63/182'),
-            (50,2,'caldopex','PLUS 63+63/202'),
-            (65,1,'caldopex','75+75/202'),
-            ]
-        
-        pipe_tuples = [
-            (25,2),     # 1
-            (32,2),     # 2
-            (40,2),     # 3
-            (50,2),     # 4 
-            (63,2),     # 5 
-            (75,2),     # 6
-            (90,2),     # 7
-            (110,3),    # 8
-            (125,2),    # 9
-            # (140,1)     # 10 is skipped
-            (160,1)     # 11
-            ]
-        
-        pipes = {
-            pipe_tuple[0:2]: StandardisedPipe(
-                pipe_tuple=pipe_tuple,
-                db=pipedb)
-            for pipe_tuple in pipedb.pipe_tuples
-            }
-        # TODO: remove?
-        # pipes = {
-        #     pipe_tuple[0:2]: (
-        #         StandardisedPipe(
-        #             pipe_tuple=pipe_tuple,
-        #             db=pipedb) 
-        #         if not pipedb.is_twin[pipe_tuple] else 
-        #         StandardisedTwinPipe(
-        #             pipe_tuple=pipe_tuple,
-        #             db=pipedb
-        #             )
-        #         )
-        #     for pipe_tuple in pipedb.pipe_tuples
-        #     }
-                
-        # specific heat losses extracted graphically from the paper
-        specific_heat_losses = [
-            7.653,      # 1
-            8.6724,     # 2
-            9.5565,     # 3
-            9.1742,     # 4
-            11.3841,    # 5
-            15.4729,    # 6
-            19.2494,    # 7
-            21.9193,    # 8
-            30.4776,    # 9
-            # 33.3056?     # 10
-            33.3056     # 11
-            ]
-        
-        specific_heat_losses_tol = [
-            2.881, # 1 : 2.8801695747536327 = probably twin pipe
-            2.279, # 2 : 2.2787650775221096 = probably twin pipe
-            2.264, # 3 : 2.263605513858751 = probably twin pipe
-            5.183, # 4 : 5.182379194066426 = probably twin pipe
-            4.762, # 5 : 4.761194064520637 = probably twin pipe
-            1.530, # 6 : 1.5296911919026677 = probably twin pipe
-            0.786, # 7 : 0.7853882010245385
-            0.861, # 8 : 0.8604246920874736
-            0.622, # 9 : 0.6219928712608258
-            # 10: ?
-            5.703, # 11: 5.702268587107991 = error in the model?
-            ]
-        
-        # rated capacities extracted graphically from the paper
-        rhcs = [
-            27.05e3,
-            53.21e3,
-            95.27e3,
-            178.6e3,
-            331.04e3,
-            533.06e3,
-            863.46e3,
-            1471.64e3,
-            2061.87e3,
-            3969.41e3
-            ]
-        
-        rhcs_tol = [
-            127, # 126.99937119106471
-            256, # 255.7967837826509
-            1308, # 1307.91125542394
-            2774.1, # 2774.0678334724507
-            4579.4, # 4579.386440035771
-            12933, # 12932.995288044156
-            17733.4, # 17733.337934178766
-            29023, # 29022.9469330227
-            35771, # 35770.98168226797
-            69648, # 69647.97366023948
-            ]
-        
-        # pipe
-        for pipe_tuple, sht, sht_tol, rhc, rhc_tol in zip(
-                pipe_tuples, 
-                specific_heat_losses, 
-                specific_heat_losses_tol,
-                rhcs,
-                rhcs_tol
-                ):
-            
-            if isinstance(pipes[pipe_tuple], StandardisedTwinPipe):
-                # twin pipe
-                trench = trenches.TwinPipeTrench(
-                    pipe_center_depth=(
-                        pipe_depth_top+pipes[pipe_tuple].d_cas/2
-                        ), 
-                    fluid_db=fluid_db, 
-                    phase=phase, 
-                    pressure=pressure, 
-                    supply_temperature=supply_temperature, 
-                    return_temperature=return_temperature, 
-                    max_specific_pressure_loss=max_specific_pressure_loss, 
-                    supply_pipe=pipes[pipe_tuple])
-            else:
-                trench = trenches.SupplyReturnPipeTrench(
-                    pipe_center_depth=(
-                        pipe_depth_top+pipes[pipe_tuple].d_cas/2
-                        ), 
-                    pipe_center_distance=(
-                        pipe_distance_edge+pipes[pipe_tuple].d_cas
-                        ), 
-                    fluid_db=fluid_db, 
-                    phase=phase, 
-                    pressure=pressure, 
-                    supply_temperature=supply_temperature, 
-                    return_temperature=return_temperature, 
-                    max_specific_pressure_loss=max_specific_pressure_loss, 
-                    supply_pipe=pipes[pipe_tuple])
-    
-            # rated heat capacity
-            # assert isclose(
-            #     trench.rated_heat_capacity(),
-            #     rhc,
-            #     abs_tol=rhc_tol
-            #     )
-            # print('next')
-            # print(rhc)
-            # print(trench.rated_heat_capacity())
-            
-            # specific heat transfer
-            assert isclose(
-                sum(
-                    trench.specific_heat_transfer_surroundings(
-                    ground_air_heat_transfer_coefficient=ground_air_heat_transfer_coefficient,
-                    ground_thermal_conductivity=ground_thermal_conductivity,
-                    temperature_surroundings=temperature_surroundings)
-                    ),
-                sht,
-                abs_tol=sht_tol
-                )
-            
-            assert type(trench.printable_description()) == str
-    
     def test_caldopex(self):
         
         # load pipe data
         pipedata_files = [
-            'tests/data/caldopex_single.csv',
-            'tests/data/caldopex_twin.csv'
+            'tests/data/enerpipe_caldopex_single.csv',
+            'tests/data/enerpipe_caldopex_twin.csv'
             ]
         pipedb = StandardisedPipeDatabase(source=pipedata_files)
         
@@ -2762,32 +2541,32 @@ class TestPipeTrench:
         
         pipe_tuples = [
             # single
-            (25,1,'caldopex','25-76'),
-            (25,2,'caldopex','PLUS 25-91'),
-            (32,1,'caldopex','32-76'),
-            (32,2,'caldopex','PLUS 32-91'),
-            (40,1,'caldopex','40-91'),
-            (40,2,'caldopex','PLUS 40-111'),
-            (50,1,'caldopex','50-111'),
-            (50,2,'caldopex','PLUS 50-126'),
-            (63,1,'caldopex','63-126'),
-            (63,2,'caldopex','PLUS 63-142'),
-            (75,1,'caldopex','75-142'),
-            (75,2,'caldopex','PLUS 75-162'),
-            (90,1,'caldopex','90-162'),
-            (90,2,'caldopex','PLUS 90-182'),
-            (110,1,'caldopex','110-162'),
-            (110,2,'caldopex','110-182'),
-            (110,3,'caldopex','PLUS 110-202'),
+            (20,1,'caldopex','25-76'),
+            (20,2,'caldopex','PLUS 25-91'),
+            (25,1,'caldopex','32-76'),
+            (25,2,'caldopex','PLUS 32-91'),
+            (32,1,'caldopex','40-91'),
+            (32,2,'caldopex','PLUS 40-111'),
+            (40,1,'caldopex','50-111'),
+            (40,2,'caldopex','PLUS 50-126'),
+            (50,1,'caldopex','63-126'),
+            (50,2,'caldopex','PLUS 63-142'),
+            (65,1,'caldopex','75-142'),
+            (65,2,'caldopex','PLUS 75-162'),
+            (80,1,'caldopex','90-162'),
+            (80,2,'caldopex','PLUS 90-182'),
+            (100,1,'caldopex','110-162'),
+            (100,2,'caldopex','110-182'),
+            (100,3,'caldopex','PLUS 110-202'),
             (125,1,'caldopex','125-182'),
             (125,2,'caldopex','PLUS 125-202'),
-            (140,1,'caldopex','140-202'),
-            (160,1,'caldopex','160-250'),
+            (125,3,'caldopex','140-202'),
+            (150,1,'caldopex','160-250'),
             # twin
             (20,1,'caldopex','25+25-91'),
             (20,2,'caldopex','PLUS 25+25-111'),
             (25,1,'caldopex','32+32-111'),
-            (25,2,'caldopex','PLUS 32 +32-126'),
+            (25,2,'caldopex','PLUS 32+32-126'),
             (32,1,'caldopex','40+40-126'),
             (32,2,'caldopex','PLUS 40+40-142'),
             (40,1,'caldopex','50+50-162'),
@@ -2812,44 +2591,44 @@ class TestPipeTrench:
             }
         
         true_capacity = {
-            (25, 1, 'caldopex', '25-76'): 20881.479233138303,  
-            (25, 2, 'caldopex', 'PLUS 25-91'): 20881.479233138303,        
-            (32, 1, 'caldopex', '32-76'):40793.37028711016,            
-            (32, 2, 'caldopex', 'PLUS 32-91'): 40793.37028711016,
-            (40, 1, 'caldopex', '40-91'): 73880.93921875181,
-            (40, 2, 'caldopex', 'PLUS 40-111'): 73880.93921875181,
-            (50, 1, 'caldopex', '50-111'): 134495.59672187426,
-            (50, 2, 'caldopex', 'PLUS 50-126'): 134495.59672187426,
-            (63, 1, 'caldopex', '63-126'):
+            (20, 1, 'caldopex', '25-76'): 20881.479233138303,  
+            (20, 2, 'caldopex', 'PLUS 25-91'): 20881.479233138303,        
+            (25, 1, 'caldopex', '32-76'):40793.37028711016,            
+            (25, 2, 'caldopex', 'PLUS 32-91'): 40793.37028711016,
+            (32, 1, 'caldopex', '40-91'): 73880.93921875181,
+            (32, 2, 'caldopex', 'PLUS 40-111'): 73880.93921875181,
+            (40, 1, 'caldopex', '50-111'): 134495.59672187426,
+            (40, 2, 'caldopex', 'PLUS 50-126'): 134495.59672187426,
+            (50, 1, 'caldopex', '63-126'):
             249246.5864686179,
-            (63, 2, 'caldopex', 'PLUS 63-142'):
+            (50, 2, 'caldopex', 'PLUS 63-142'):
             249246.5864686179,
-            (75, 1, 'caldopex', '75-142'):
+            (65, 1, 'caldopex', '75-142'):
             398186.48902504705,
-            (75, 2, 'caldopex', 'PLUS 75-162'):
+            (65, 2, 'caldopex', 'PLUS 75-162'):
             398186.48902504705,
-            (90, 1, 'caldopex', '90-162'):
+            (80, 1, 'caldopex', '90-162'):
             645626.6619794322,
-            (90, 2, 'caldopex', 'PLUS 90-182'):
+            (80, 2, 'caldopex', 'PLUS 90-182'):
             645626.6619794322,
-            (110, 1, 'caldopex', '110-162'):
+            (100, 1, 'caldopex', '110-162'):
             1099995.669180083,
-            (110, 2, 'caldopex', '110-182'):
+            (100, 2, 'caldopex', '110-182'):
             1099995.669180083,
-            (110, 3, 'caldopex', 'PLUS 110-202'):
+            (100, 3, 'caldopex', 'PLUS 110-202'):
             1099995.669180083,
             (125, 1, 'caldopex', '125-182'):
             1541776.6632286548,
             (125, 2, 'caldopex', 'PLUS 125-202'):
             1541776.6632286548,
-            (140, 1, 'caldopex', '140-202'):
+            (125, 3, 'caldopex', '140-202'):
             2083512.017509401,
-            (160, 1, 'caldopex', '160-250'):
+            (150, 1, 'caldopex', '160-250'):
             2960054.629960731,
             (20, 1, 'caldopex', '25+25-91'): 20881.479233138303,
             (20, 2, 'caldopex', 'PLUS 25+25-111'): 20881.479233138303,            
             (25, 1, 'caldopex', '32+32-111'): 40793.37028711016,            
-            (25, 2, 'caldopex', 'PLUS 32 +32-126'): 40793.37028711016,
+            (25, 2, 'caldopex', 'PLUS 32+32-126'): 40793.37028711016,
             (32, 1, 'caldopex', '40+40-126'): 73880.93921875181,
             (32, 2, 'caldopex', 'PLUS 40+40-142'): 73880.93921875181,
             (40, 1, 'caldopex', '50+50-162'): 134495.59672187426,
@@ -3168,12 +2947,10 @@ class TestPipeTrench:
     def test_district_cooling(self):
         
         # load pipe data
-            
-        singlepipedata_files = ['tests/data/caldopex_single.csv']
+        singlepipedata_files = ['tests/data/enerpipe_caldopex_single.csv']
         singlepipedb = StandardisedPipeDatabase(source=singlepipedata_files)
         
         # water 
-        
         waterdata_file = 'tests/data/incropera2006_saturated_water.csv'
         phase = FluidDatabase.fluid_LIQUID
         fluid_db = FluidDatabase(
@@ -3194,7 +2971,7 @@ class TestPipeTrench:
         temperature_surroundings = 10+273.15
         
         pipe_tuples = [
-            (25,2),     # 1
+            (20,2),     # 1
             ]
         
         pipes = {
diff --git a/tests/test_utils.py b/tests/test_utils.py
index bfcef59..3704a92 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -153,11 +153,11 @@ class TestUtils:
     def test_validate_minimum_trench_dimensions(self):
         
         # load pipe data
-        singlepipedata_files = ['tests/data/isoplus_singlepipes_s1.csv']
+        singlepipedata_files = ['tests/data/isoplus_single_disconti_s1.csv']
         singlepipedb = StandardisedPipeDatabase(source=singlepipedata_files)
         
         # twin pipe data files
-        twinpipedata_files = ['tests/data/isoplus_twinpipes_s1.csv']
+        twinpipedata_files = ['tests/data/isoplus_twin_disconti_s1.csv']
         twinpipedb = StandardisedPipeDatabase(source=twinpipedata_files)
         
         # water pipes
@@ -264,23 +264,25 @@ class TestUtils:
                 
                 pipe.ValidateInsulatedPipe()
                 
-                pipe_depth = utils.recommended_minimum_pipe_center_depth(pipe)
-                
+                pipe_depth = utils.recommended_minimum_pipe_center_depth(pipe)                
                 assert pipe_depth > 0 
-                
                 assert pipe_depth > pipe.d_cas/2
                 
                 pipe_distance = utils.recommended_minimum_interpipe_distance(
                     pipe)
-                
                 assert pipe_distance > 0
-                
                 assert pipe_distance > pipe.d_cas
+                
+                # minimum distances according to isoplus
+                pipe_distance = utils.minimum_assembling_distance_isoplus(
+                    pipe.d_cas)
+                assert pipe_distance > 0
+                assert pipe_distance >= 0
             
             # else:
                 
             #     raise NotImplementedError
-            
+            # minimum_assembling_distance
     
     # *************************************************************************
     # *************************************************************************
-- 
GitLab