diff --git a/packages/dtocean-core/example_data/environmental_example_data.py b/packages/dtocean-core/example_data/environmental_example_data.py index 562be28..91a273e 100644 --- a/packages/dtocean-core/example_data/environmental_example_data.py +++ b/packages/dtocean-core/example_data/environmental_example_data.py @@ -583,7 +583,7 @@ name_map1 ={ "subclass or group": "Subclass or Group", "observed": "Observed"} protected_table = protected_table.rename(columns=name_map1) -print protected_table +print(protected_table) table_path = os.path.join(env_dir, "species_receptors.csv") receptors_table = pd.read_csv(table_path, index_col=None) @@ -766,5 +766,5 @@ file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_10_scenario.py b/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_10_scenario.py index 3e7647c..186f5a5 100644 --- a/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_10_scenario.py +++ b/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_10_scenario.py @@ -6,9 +6,9 @@ """ import os + import numpy as np import pandas as pd - from scipy.stats import multivariate_normal, norm from dtocean_core.utils.moorings import get_moorings_tables @@ -21,139 +21,151 @@ ## CONSTANTS -gravity = 9.80665 #gravity -seaden = 1025.0 #sea water density -airden = 1.226 #air density - -#cylinder drag coefficients -dragcoefcyl = [[0.0, 0.0, 1e-5, 1e-2], - [1e4, 1.2, 1.2, 1.15], - [2e4, 1.2, 1.2, 1.05], - [3e4, 1.2, 1.2, 0.87], - [4e4, 1.2, 1.15, 0.82], - [5e4, 1.2, 1.0, 0.8], - [6e4, 1.2, 0.9, 0.8], - [7e4, 1.2, 0.85, 0.83], - [8e4, 1.2, 0.7, 0.9], - [9e4, 1.2, 0.65, 0.94], - [1e5, 1.2, 0.6, 0.95], - [2e5, 1.2, 0.35, 1.02], - [3e5, 1.15, 0.3, 1.03], - [4e5, 0.95, 0.33, 1.05], - [5e5, 0.6, 0.35, 1.06], - [6e5, 0.35, 0.38, 1.07], - [7e5, 0.29, 0.4, 1.07], - [8e5, 0.31, 0.43, 1.08], - [9e5, 0.33, 0.45, 1.08], - [1e6, 0.35, 0.47, 1.08], - [2e6, 0.54, 0.53, 1.08], - [3e6, 0.62, 0.62, 1.08], - [4e6, 0.67, 0.67, 1.08]] - -#cylinder wake amplification factors -wakeampfactorcyl = [[0.0, 2.0, 2.0], - [5.0, 0.4, 0.8], - [10.0, 0.78, 1.3], - [15.0, 1.07, 1.4], - [20.0, 1.25, 1.25], - [25.0, 1.2, 1.2], - [30.0, 1.18, 1.18], - [35.0, 1.12, 1.12], - [40.0, 1.1, 1.1], - [45.0, 1.06, 1.06], - [50.0, 1.03, 1.03], - [55.0, 1.01, 1.01], - [60.0, 1.0, 1.0]] - -#rectangular section wind drag coefficients -winddragcoefrect = [[4.0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.6, 1.6], - [3.0, 1.1, 1.2, 1.25, 1.35, 1.4, 1.4, 1.4], - [2.0, 1.0, 1.05, 1.1, 1.15, 1.2, 1.2, 1.2], - [1.5, 0.95, 1.0, 1.05, 1.1, 1.15, 1.15, 1.15], - [1.0, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4], - [0.6667, 0.8, 0.85, 0.9, 0.95, 1.0, 1.0, 1.0], - [0.5, 0.75, 0.75, 0.8, 0.85, 0.9, 0.9, 0.9], - [0.3333, 0.7, 0.75, 0.75, 0.75, 0.8, 0.8, 0.8], - [0.25, 0.7, 0.7, 0.75, 0.75, 0.75, 0.75, 0.75]] - -#rectangular section current drag coefficients -currentdragcoefrect = [[10.0000, 1.88], - [5.0000, 1.95], - [3.3333, 2.06], - [2.5000, 2.24], - [2.0000, 2.39], - [1.6667, 2.6], - [1.4286, 2.73], - [1.2500, 2.5], - [1.1111, 2.31], - [1.0000, 2.19], - [0.9091, 2.06], - [0.8333, 1.95], - [0.7692, 1.87], - [0.7143, 1.8], - [0.6667, 1.73], - [0.6250, 1.67], - [0.5882, 1.63], - [0.5556, 1.58], - [0.5263, 1.52], - [0.5000, 1.49], - [0.4762, 1.46], - [0.4545, 1.44], - [0.4348, 1.41], - [0.4167, 1.37], - [0.4000, 1.35], - [0.3846, 1.32], - [0.3704, 1.29], - [0.3571, 1.26], - [0.3448, 1.25], - [0.3333, 1.23], - [0.3226, 1.21], - [0.3125, 1.2], - [0.3030, 1.19], - [0.2941, 1.18], - [0.2857, 1.16], - [0.2778, 1.15], - [0.2703, 1.15], - [0.2632, 1.15], - [0.2564, 1.15], - [0.2500, 1.15]] - -#rectangular section wave drift coefficients -driftcoeffloatrect = [[0.0, 0.0], - [0.1, 0.02], - [0.2, 0.06], - [0.3, 0.15], - [0.4, 0.28], - [0.5, 0.44], - [0.6, 0.60], - [0.7, 0.74], - [0.8, 0.84], - [0.9, 0.91], - [1.0, 0.94], - [1.1, 0.97], - [1.2, 0.98], - [1.3, 0.99], - [1.4, 1.0], - [1.5, 1.0]] - -#rectangular section wave inertia coefficients -waveinertiacoefrect = [[10.0, 2.23], - [5.0, 1.98], - [2.0, 1.7], - [1.0, 1.51], - [0.5, 1.36], - [0.2, 1.21], - [0.1, 1.14]] +gravity = 9.80665 # gravity +seaden = 1025.0 # sea water density +airden = 1.226 # air density + +# cylinder drag coefficients +dragcoefcyl = [ + [0.0, 0.0, 1e-5, 1e-2], + [1e4, 1.2, 1.2, 1.15], + [2e4, 1.2, 1.2, 1.05], + [3e4, 1.2, 1.2, 0.87], + [4e4, 1.2, 1.15, 0.82], + [5e4, 1.2, 1.0, 0.8], + [6e4, 1.2, 0.9, 0.8], + [7e4, 1.2, 0.85, 0.83], + [8e4, 1.2, 0.7, 0.9], + [9e4, 1.2, 0.65, 0.94], + [1e5, 1.2, 0.6, 0.95], + [2e5, 1.2, 0.35, 1.02], + [3e5, 1.15, 0.3, 1.03], + [4e5, 0.95, 0.33, 1.05], + [5e5, 0.6, 0.35, 1.06], + [6e5, 0.35, 0.38, 1.07], + [7e5, 0.29, 0.4, 1.07], + [8e5, 0.31, 0.43, 1.08], + [9e5, 0.33, 0.45, 1.08], + [1e6, 0.35, 0.47, 1.08], + [2e6, 0.54, 0.53, 1.08], + [3e6, 0.62, 0.62, 1.08], + [4e6, 0.67, 0.67, 1.08], +] + +# cylinder wake amplification factors +wakeampfactorcyl = [ + [0.0, 2.0, 2.0], + [5.0, 0.4, 0.8], + [10.0, 0.78, 1.3], + [15.0, 1.07, 1.4], + [20.0, 1.25, 1.25], + [25.0, 1.2, 1.2], + [30.0, 1.18, 1.18], + [35.0, 1.12, 1.12], + [40.0, 1.1, 1.1], + [45.0, 1.06, 1.06], + [50.0, 1.03, 1.03], + [55.0, 1.01, 1.01], + [60.0, 1.0, 1.0], +] + +# rectangular section wind drag coefficients +winddragcoefrect = [ + [4.0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.6, 1.6], + [3.0, 1.1, 1.2, 1.25, 1.35, 1.4, 1.4, 1.4], + [2.0, 1.0, 1.05, 1.1, 1.15, 1.2, 1.2, 1.2], + [1.5, 0.95, 1.0, 1.05, 1.1, 1.15, 1.15, 1.15], + [1.0, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4], + [0.6667, 0.8, 0.85, 0.9, 0.95, 1.0, 1.0, 1.0], + [0.5, 0.75, 0.75, 0.8, 0.85, 0.9, 0.9, 0.9], + [0.3333, 0.7, 0.75, 0.75, 0.75, 0.8, 0.8, 0.8], + [0.25, 0.7, 0.7, 0.75, 0.75, 0.75, 0.75, 0.75], +] + +# rectangular section current drag coefficients +currentdragcoefrect = [ + [10.0000, 1.88], + [5.0000, 1.95], + [3.3333, 2.06], + [2.5000, 2.24], + [2.0000, 2.39], + [1.6667, 2.6], + [1.4286, 2.73], + [1.2500, 2.5], + [1.1111, 2.31], + [1.0000, 2.19], + [0.9091, 2.06], + [0.8333, 1.95], + [0.7692, 1.87], + [0.7143, 1.8], + [0.6667, 1.73], + [0.6250, 1.67], + [0.5882, 1.63], + [0.5556, 1.58], + [0.5263, 1.52], + [0.5000, 1.49], + [0.4762, 1.46], + [0.4545, 1.44], + [0.4348, 1.41], + [0.4167, 1.37], + [0.4000, 1.35], + [0.3846, 1.32], + [0.3704, 1.29], + [0.3571, 1.26], + [0.3448, 1.25], + [0.3333, 1.23], + [0.3226, 1.21], + [0.3125, 1.2], + [0.3030, 1.19], + [0.2941, 1.18], + [0.2857, 1.16], + [0.2778, 1.15], + [0.2703, 1.15], + [0.2632, 1.15], + [0.2564, 1.15], + [0.2500, 1.15], +] + +# rectangular section wave drift coefficients +driftcoeffloatrect = [ + [0.0, 0.0], + [0.1, 0.02], + [0.2, 0.06], + [0.3, 0.15], + [0.4, 0.28], + [0.5, 0.44], + [0.6, 0.60], + [0.7, 0.74], + [0.8, 0.84], + [0.9, 0.91], + [1.0, 0.94], + [1.1, 0.97], + [1.2, 0.98], + [1.3, 0.99], + [1.4, 1.0], + [1.5, 1.0], +] + +# rectangular section wave inertia coefficients +waveinertiacoefrect = [ + [10.0, 2.23], + [5.0, 1.98], + [2.0, 1.7], + [1.0, 1.51], + [0.5, 1.36], + [0.2, 1.21], + [0.1, 1.14], +] ## LEASE AREA -startx = 1000. -endx = 2000. -dx = 10. +startx = 1000.0 +endx = 2000.0 +dx = 10.0 numx = int(float(endx - startx) / dx) + 1 -starty = 0. -endy = 2500. -dy = 10. +starty = 0.0 +endy = 2500.0 +dy = 10.0 numy = int(float(endy - starty) / dy) + 1 x = np.linspace(startx, endx, numx) @@ -162,54 +174,53 @@ ny = len(y) # Bathymetry -X, Y = np.meshgrid(x,y) -Z = np.zeros(X.shape) - 50. +X, Y = np.meshgrid(x, y) +Z = np.zeros(X.shape) - 50.0 depths = Z.T[:, :, np.newaxis] -sediments = np.chararray((nx,ny,1), itemsize=20) +sediments = np.chararray((nx, ny, 1), itemsize=20) sediments[:] = "loose sand" - -strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} + +strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} # Soil characteristics -max_temp = 10. -max_soil_res = 10. +max_temp = 10.0 +max_soil_res = 10.0 target_burial_depth = 10 # Polygons -lease_area = [(startx, starty), - (endx, starty), - (endx, endy), - (startx, endy)] - -#nogo_areas = [np.array([[50., 50.],[60., 50.],[60., 60.],[50., 60.]])] +lease_area = [(startx, starty), (endx, starty), (endx, endy), (startx, endy)] + +# nogo_areas = [np.array([[50., 50.],[60., 50.],[60., 60.],[50., 60.]])] nogo_areas = None - + # Tidal time series n_bins = 6 time_points = 48 t = np.linspace(0, 1, time_points) rv = norm() -time_sin = np.sin(np.linspace(0, 4*np.pi, time_points)) -time_scaled = time_sin * (1. / np.amax(time_sin)) +time_sin = np.sin(np.linspace(0, 4 * np.pi, time_points)) +time_scaled = time_sin * (1.0 / np.amax(time_sin)) -xgrid, ygrid = np.meshgrid(x,y) +xgrid, ygrid = np.meshgrid(x, y) pos = np.dstack((xgrid, ygrid)) -rv = multivariate_normal([500., 150.], [[max(x)*5., max(y)*2.], - [max(y)*2., max(x)*5.]]) +rv = multivariate_normal( + [500.0, 150.0], [[max(x) * 5.0, max(y) * 2.0], [max(y) * 2.0, max(x) * 5.0]] +) -u_max = 0. -v_max = 6. -ssh_max = 1. +u_max = 0.0 +v_max = 6.0 +ssh_max = 1.0 TI = 0.1 grid_pdf = rv.pdf(pos).T -#u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) +# u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) u_scaled = np.ones((nx, ny)) * u_max v_scaled = np.ones((nx, ny)) * v_max ssh_scaled = grid_pdf * (ssh_max / np.amax(grid_pdf)) @@ -219,7 +230,6 @@ ssh_arrays = [] for multiplier in time_scaled: - u_arrays.append(np.abs(u_scaled * multiplier)) v_arrays.append(np.abs(v_scaled * multiplier)) ssh_arrays.append(ssh_scaled * multiplier) @@ -229,31 +239,30 @@ SSH = np.dstack(ssh_arrays) TI = np.ones(SSH.shape) * TI -tidal_series_raw = {"values": {"U": U, - "V": V, - "SSH": SSH, - "TI": TI}, - "coords": [x, y, t]} - -xc = x[int(nx/2)] -yc = y[int(ny/2)] +tidal_series_raw = { + "values": {"U": U, "V": V, "SSH": SSH, "TI": TI}, + "coords": [x, y, t], +} + +xc = x[int(nx / 2)] +yc = y[int(ny / 2)] tidal_point = (xc, yc) # Tidal flow characteristics (hydro) -power_law_exponent = np.array([7.]) -blockage_ratio = 1. +power_law_exponent = np.array([7.0]) +blockage_ratio = 1.0 # Tidal flow characteristics (moorings) -max_10year_current = 6. -max_10year_current_dir = 0. -current_profile = "1/7 Power Law" #current profile alternatives: "Uniform" - # "1/7 Power Law" +max_10year_current = 6.0 +max_10year_current_dir = 0.0 +current_profile = "1/7 Power Law" # current profile alternatives: "Uniform" +# "1/7 Power Law" # Wave characterists -predominant_100year_wave_dir = 0. +predominant_100year_wave_dir = 0.0 max_100year_hs = 0.5 -max_100year_tp = 10. -max_100year_gamma = 1. +max_100year_tp = 10.0 +max_100year_gamma = 1.0 # Wind characteristics mean_100_year_wind_speed = 2.0 @@ -262,19 +271,19 @@ max_100_year_gust_dir = 0.0 # Water level characterists -max_50_year_water_level = 5.0 #water level maximum offset -min_50_year_water_level = 0.0 #water level minimum offset +max_50_year_water_level = 5.0 # water level maximum offset +min_50_year_water_level = 0.0 # water level minimum offset ## CABLE CORRIDOR -startx = 0. -endx = 1000. -dx = 10. +startx = 0.0 +endx = 1000.0 +dx = 10.0 numx = int(float(endx - startx) / dx) -starty = 1000. -endy = 1500. -dy = 10. +starty = 1000.0 +endy = 1500.0 +dy = 10.0 numy = int(float(endy - starty) / dy) + 1 x = np.linspace(startx, endx, numx) @@ -283,185 +292,356 @@ ny = len(y) # Bathymetry -X, Y = np.meshgrid(x,y) -Z = np.zeros(X.shape) - 50. +X, Y = np.meshgrid(x, y) +Z = np.zeros(X.shape) - 50.0 depths = Z.T[:, :, np.newaxis] -sediments = np.chararray((nx,ny,1), itemsize=20) +sediments = np.chararray((nx, ny, 1), itemsize=20) sediments[:] = "loose sand" - -export_strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} -# Soil characteristics -corridor_max_temp = 10. -corridor_max_soil_res = 10. -corridor_target_burial_depth = 20. +export_strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} + +# Soil characteristics +corridor_max_temp = 10.0 +corridor_max_soil_res = 10.0 +corridor_target_burial_depth = 20.0 # Polygons corridor_nogo_areas = None # Tidal flow characteristics -corridor_10year_current = 6. -corridor_10year_current_dir = 0. +corridor_10year_current = 6.0 +corridor_10year_current_dir = 0.0 # Wave characterists -corridor_100year_wave_dir = 0. +corridor_100year_wave_dir = 0.0 ## SHORELINE - -landing_point = (0., 1250.) -onshore_infrastructure_cost = 1000000. - + +landing_point = (0.0, 1250.0) +onshore_infrastructure_cost = 1000000.0 + # MACHINE -X = np.array([ 0. , 0.1010101 , 0.2020202 , 0.3030303 , - 0.4040404 , 0.50505051, 0.60606061, 0.70707071, - 0.80808081, 0.90909091, 1.01010101, 1.11111111, - 1.21212121, 1.31313131, 1.41414141, 1.51515152, - 1.61616162, 1.71717172, 1.81818182, 1.91919192, - 2.02020202, 2.12121212, 2.22222222, 2.32323232, - 2.42424242, 2.52525253, 2.62626263, 2.72727273, - 2.82828283, 2.92929293, 3.03030303, 3.13131313, - 3.23232323, 3.33333333, 3.43434343, 3.53535354, - 3.63636364, 3.73737374, 3.83838384, 3.93939394, - 4.04040404, 4.14141414, 4.24242424, 4.34343434, - 4.44444444, 4.54545455, 4.64646465, 4.74747475, - 4.84848485, 4.94949495, 5.05050505, 5.15151515, - 5.25252525, 5.35353535, 5.45454545, 5.55555556, - 5.65656566, 5.75757576, 5.85858586, 5.95959596, - 6.06060606, 6.16161616, 6.26262626, 6.36363636, - 6.46464646, 6.56565657, 6.66666667, 6.76767677, - 6.86868687, 6.96969697, 7.07070707, 7.17171717, - 7.27272727, 7.37373737, 7.47474747, 7.57575758, - 7.67676768, 7.77777778, 7.87878788, 7.97979798, - 8.08080808, 8.18181818, 8.28282828, 8.38383838, - 8.48484848, 8.58585859, 8.68686869, 8.78787879, - 8.88888889, 8.98989899, 9.09090909, 9.19191919, - 9.29292929, 9.39393939, 9.49494949, 9.5959596 , - 9.6969697 , 9.7979798 , 9.8989899 , 10. ]) - -Cp = np.array([ 0. , 0. , 0. , 0. , 0. , - 0. , 0. , 0. , 0. , 0. , - 0.00248182, 0.0273 , 0.05211818, 0.07693636, 0.10175455, - 0.12657273, 0.15139091, 0.17620909, 0.20102727, 0.22584545, - 0.25066364, 0.27548182, 0.3003 , 0.32511818, 0.34993636, - 0.37475455, 0.39957273, 0.42439091, 0.44920909, 0.47402727, - 0.49884545, 0.52366364, 0.54848182, 0.5733 , 0.59811818, - 0.62293636, 0.64775455, 0.67257273, 0.69739091, 0.72220909, - 0.74702727, 0.77184545, 0.79666364, 0.82148182, 0.8463 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 - ]) - -Ct = 0.4*np.ones((100)) +X = np.array( + [ + 0.0, + 0.1010101, + 0.2020202, + 0.3030303, + 0.4040404, + 0.50505051, + 0.60606061, + 0.70707071, + 0.80808081, + 0.90909091, + 1.01010101, + 1.11111111, + 1.21212121, + 1.31313131, + 1.41414141, + 1.51515152, + 1.61616162, + 1.71717172, + 1.81818182, + 1.91919192, + 2.02020202, + 2.12121212, + 2.22222222, + 2.32323232, + 2.42424242, + 2.52525253, + 2.62626263, + 2.72727273, + 2.82828283, + 2.92929293, + 3.03030303, + 3.13131313, + 3.23232323, + 3.33333333, + 3.43434343, + 3.53535354, + 3.63636364, + 3.73737374, + 3.83838384, + 3.93939394, + 4.04040404, + 4.14141414, + 4.24242424, + 4.34343434, + 4.44444444, + 4.54545455, + 4.64646465, + 4.74747475, + 4.84848485, + 4.94949495, + 5.05050505, + 5.15151515, + 5.25252525, + 5.35353535, + 5.45454545, + 5.55555556, + 5.65656566, + 5.75757576, + 5.85858586, + 5.95959596, + 6.06060606, + 6.16161616, + 6.26262626, + 6.36363636, + 6.46464646, + 6.56565657, + 6.66666667, + 6.76767677, + 6.86868687, + 6.96969697, + 7.07070707, + 7.17171717, + 7.27272727, + 7.37373737, + 7.47474747, + 7.57575758, + 7.67676768, + 7.77777778, + 7.87878788, + 7.97979798, + 8.08080808, + 8.18181818, + 8.28282828, + 8.38383838, + 8.48484848, + 8.58585859, + 8.68686869, + 8.78787879, + 8.88888889, + 8.98989899, + 9.09090909, + 9.19191919, + 9.29292929, + 9.39393939, + 9.49494949, + 9.5959596, + 9.6969697, + 9.7979798, + 9.8989899, + 10.0, + ] +) + +Cp = np.array( + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.00248182, + 0.0273, + 0.05211818, + 0.07693636, + 0.10175455, + 0.12657273, + 0.15139091, + 0.17620909, + 0.20102727, + 0.22584545, + 0.25066364, + 0.27548182, + 0.3003, + 0.32511818, + 0.34993636, + 0.37475455, + 0.39957273, + 0.42439091, + 0.44920909, + 0.47402727, + 0.49884545, + 0.52366364, + 0.54848182, + 0.5733, + 0.59811818, + 0.62293636, + 0.64775455, + 0.67257273, + 0.69739091, + 0.72220909, + 0.74702727, + 0.77184545, + 0.79666364, + 0.82148182, + 0.8463, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + ] +) -# Performance curves are matched to the same veloity abscissae -tidal_performance = {"Velocity": X, - "Coefficient of Power": Cp, - "Coefficient of Thrust": Ct} +Ct = 0.4 * np.ones((100)) -# Device characterists -turbine_hub_height = 20. -rotor_diam = 18. +# Performance curves are matched to the same veloity abscissae +tidal_performance = { + "Velocity": X, + "Coefficient of Power": Cp, + "Coefficient of Thrust": Ct, +} + +# Device characterists +turbine_hub_height = 20.0 +rotor_diam = 18.0 turbine_interdist = None min_install = -np.inf -max_install = -40. -min_dist_x = 40. -min_dist_y = 40. +max_install = -40.0 +min_dist_x = 40.0 +min_dist_y = 40.0 bidirection = True -rated_power_device = 1. -device_voltage= 10. -yaw_angle = 0. -cut_in = 1. -cut_out = 5. -connection = 'Wet-Mate' -footprint_radius = 20. +rated_power_device = 1.0 +device_voltage = 10.0 +yaw_angle = 0.0 +cut_in = 1.0 +cut_out = 5.0 +connection = "Wet-Mate" +footprint_radius = 20.0 device_draft = None umbilical_connection = None umbilical_safety = None power_factor = 0.98 - -sys_prof = "Cylindrical" #device profile options: "Cylindrical" "Rectangular" -sys_mass = 300.0e3 #device mass -sys_cog = [0.0, 0.0, 15.0] #device centre of gravity -sys_vol = 148.44 #device displaced volume -sys_height = 21.0 #device height -sys_width = 3.0 #device width -sys_length = 3.0 #device length -sys_dry_frontal = 0.0 #device dry frontal area -sys_dry_beam = 0.0 #device dry beam area -sys_wet_frontal = 63.0 #device wet frontal area -sys_wet_beam = 63.0 #device wet beam area -sys_rough = 0.9e-2 #device surface roughness - -#predefined foundation type: Shallow, Gravity, Pile, Suction Caisson, - # Direct Embedment, Drag -prefound = None - -#foundation locations (from device origin) -found_loc = np.array([[-10.0, -10.0, 0.0], - [-10.0, 10.0, 0.0], - [ 10.0, 10.0, 0.0], - [ 10.0, -10.0, 0.0]]) - + +sys_prof = "Cylindrical" # device profile options: "Cylindrical" "Rectangular" +sys_mass = 300.0e3 # device mass +sys_cog = [0.0, 0.0, 15.0] # device centre of gravity +sys_vol = 148.44 # device displaced volume +sys_height = 21.0 # device height +sys_width = 3.0 # device width +sys_length = 3.0 # device length +sys_dry_frontal = 0.0 # device dry frontal area +sys_dry_beam = 0.0 # device dry beam area +sys_wet_frontal = 63.0 # device wet frontal area +sys_wet_beam = 63.0 # device wet beam area +sys_rough = 0.9e-2 # device surface roughness + +# predefined foundation type: Shallow, Gravity, Pile, Suction Caisson, +# Direct Embedment, Drag +prefound = None + +# foundation locations (from device origin) +found_loc = np.array( + [ + [-10.0, -10.0, 0.0], + [-10.0, 10.0, 0.0], + [10.0, 10.0, 0.0], + [10.0, -10.0, 0.0], + ] +) + # ARRAY LAYOUT -user_array_option = 'User Defined Fixed' - -pos = [(1250., 250.), - (1750., 250.), - (1250., 750.), - (1750., 750.), - (1250., 1250.), - (1750., 1250.), - (1250., 1750.), - (1750., 1750.), - (1250., 2250.), - (1750., 2250.)] - +user_array_option = "User Defined Fixed" + +pos = [ + (1250.0, 250.0), + (1750.0, 250.0), + (1250.0, 750.0), + (1750.0, 750.0), + (1250.0, 1250.0), + (1750.0, 1250.0), + (1250.0, 1750.0), + (1750.0, 1750.0), + (1250.0, 2250.0), + (1750.0, 2250.0), +] + user_array_layout = np.array(pos) main_direction = None -rated_array_power = 5. +rated_array_power = 5.0 ## ELECTRICAL NETWORK # Farm devices_per_string = 10 network_configuration = ["Radial"] -min_voltage = 15. -max_voltage = 30. +min_voltage = 15.0 +max_voltage = 30.0 connector_type = "Wet-Mate" collection_point_type = "Subsea" # Corridor -corridor_voltage = 120. +corridor_voltage = 120.0 number_of_export_cables = None ## FOUNDATIONS -found_safety = 1.5 #foundation safety factor -grout_safety = 6.0 #grout safety factor -fab_cost = None # 1.0 #optional fabrication cost factor +found_safety = 1.5 # foundation safety factor +grout_safety = 6.0 # grout safety factor +fab_cost = None # 1.0 #optional fabrication cost factor ## COMPONENT DATA # Electrical -component_data_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(component_data_path, encoding = 'utf-8') +component_data_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(component_data_path) sheet_names = xls_file.sheet_names static_cable = xls_file.parse(sheet_names[0]) @@ -471,146 +651,148 @@ transformers = xls_file.parse(sheet_names[4]) collection_points = xls_file.parse(sheet_names[5]) -collection_point_cog = {11: [0,0,0], - 12: [0,0,0], - 22: [0,0,0], - 23: [0,0,0], - 24: [0,0,0], - 25: [0,0,0] - } - -collection_point_found = {11: [0,0,0], - 12: [0,0,0], - 22: [0,0,0], - 23: [0,0,0], - 24: [0,0,0], - 25: [0,0,0] - } - -compat_data_path = os.path.join(elec_dir, - 'equipment_compatibility_matrix.xlsx') -xls_file = pd.ExcelFile(compat_data_path, encoding='utf-8') +collection_point_cog = { + 11: [0, 0, 0], + 12: [0, 0, 0], + 22: [0, 0, 0], + 23: [0, 0, 0], + 24: [0, 0, 0], + 25: [0, 0, 0], +} + +collection_point_found = { + 11: [0, 0, 0], + 12: [0, 0, 0], + 22: [0, 0, 0], + 23: [0, 0, 0], + 24: [0, 0, 0], + 25: [0, 0, 0], +} + +compat_data_path = os.path.join(elec_dir, "equipment_compatibility_matrix.xlsx") +xls_file = pd.ExcelFile(compat_data_path) sheet_names = xls_file.sheet_names -installation_soil_compatibility = xls_file.parse(sheet_names[0], - index_col=None) -installation_soil_compatibility.columns = ['Technique', - 'Loose Sand', - 'Medium Sand', - 'Dense Sand', - 'Very Soft Clay', - 'Soft Clay', - 'Firm Clay', - 'Stiff Clay', - 'Hard Glacial Till', - 'Cemented', - 'Soft Rock Coral', - 'Hard Rock', - 'Gravel Cobble'] - -equipment_gradient_constraint = 14. +installation_soil_compatibility = xls_file.parse(sheet_names[0], index_col=None) +installation_soil_compatibility.columns = [ + "Technique", + "Loose Sand", + "Medium Sand", + "Dense Sand", + "Very Soft Clay", + "Soft Clay", + "Firm Clay", + "Stiff Clay", + "Hard Glacial Till", + "Cemented", + "Soft Rock Coral", + "Hard Rock", + "Gravel Cobble", +] + +equipment_gradient_constraint = 14.0 # Moorings and Foundations -compdict = eval(open(os.path.join(moor_dir, 'dummycompdb.txt')).read()) -comp_tables = get_moorings_tables(compdict) #component database - -cost_steel = 1.0 #steel cost -cost_grout = 0.1 #grout cost -cost_concrete = 0.11 #concrete cost -grout_strength = 125.0 #grout strength +compdict = eval(open(os.path.join(moor_dir, "dummycompdb.txt")).read()) +comp_tables = get_moorings_tables(compdict) # component database + +cost_steel = 1.0 # steel cost +cost_grout = 0.1 # grout cost +cost_concrete = 0.11 # concrete cost +grout_strength = 125.0 # grout strength ## MATERIALS # Foundations -steelden = 7750.0 #steel density -conden = 2400.0 #concrete density -groutden = 2450.0 #grout density +steelden = 7750.0 # steel density +conden = 2400.0 # concrete density +groutden = 2450.0 # grout density # Substrate -draincoh = 0.0 #drained soil cohesion -unsfang = 5.0 #undrained soil friction angle -dsfang = 35.0 #drained soil friction angle -soilweight = 9.4285e+03 #buoyant soil weight -relsoilden = 50.0 #relative soil density +draincoh = 0.0 # drained soil cohesion +unsfang = 5.0 # undrained soil friction angle +dsfang = 35.0 # drained soil friction angle +soilweight = 9.4285e03 # buoyant soil weight +relsoilden = 50.0 # relative soil density undrained_soil_shear_strength_constant = 1.45e3 -undrained_soil_shear_strength_dependent = 2e3 #undrained shear friction angle -soilsen = 3.0 #soil sensitivity -rockcomstr = 206843.0 #rock compressive strength +undrained_soil_shear_strength_dependent = 2e3 # undrained shear friction angle +soilsen = 3.0 # soil sensitivity +rockcomstr = 206843.0 # rock compressive strength # default soil properties table -soilprops = pd.read_csv(os.path.join(moor_dir, 'soilprops.txt'), - sep='\t', - header=0, - index_col=False) +soilprops = pd.read_csv( + os.path.join(moor_dir, "soilprops.txt"), sep="\t", header=0, index_col=False +) # buried line bearing capacity factors -line_bcf = [[20, 3], - [25, 5], - [30, 8], - [35, 12], - [40, 22], - [45, 36]] - -#subgrade reaction coefficients -k1coeff = [[1, 100, 200], - [2, 57, 119], - [3, 45.75, 94], - [4, 34.5, 69], - [5, 30.75, 56], - [6, 27, 43], - [7, 25.25, 38], - [8, 23.5, 33], - [9, 22.25, 29], - [10, 21, 25], - [11, 19.75, 22.5], - [12, 18.5, 20], - [13, 17.75, 19], - [14, 17, 18], - [15, 16.5, 17.5], - [16, 16, 17], - [17, 15.75, 16.75], - [18, 15.5, 16.5], - [19, 15.25, 16.25], - [20, 15, 16]] - -#subgrade soil reaction coefficients cohesionless -subgradereaccoef = [[0.5, 4886048.0, 12893739.0, 24158795.0, 32573656.0], - [1.0, 3800260.0, 10043544.0, 17644064.0, 24430242.0], - [1.5, 3257366.0, 7464796.0, 14115251.0, 19272747.0], - [2.0, 2850195.0, 6107561.0, 11672227.0, 16286828.0], - [2.5, 2443024.0, 5428943.0, 10179268.0, 14658145.0], - [3.0, 2171577.0, 5021772.0, 9229203.0, 13300910.0], - [3.5, 2035854.0, 4750325.0, 8414861.0, 11943674.0], - [4.0, 1764406.0, 4411016.0, 7736243.0, 10857885.0], - [4.5, 1628683.0, 4139569.0, 7193349.0, 10043544.0], - [5.0, 1560821.0, 3935983.0, 6650455.0, 9229203.0], - [5.5, 1425097.0, 3732398.0, 6107561.0, 8686308.0], - [6.0, 1357236.0, 3596675.0, 5768252.0, 8143414.0], - [6.5, 1289374.0, 3393089.0, 5361081.0, 7736243.0], - [7.0, 1221512.0, 3257366.0, 5021772.0, 7261211.0], - [7.5, 1153650.0, 3053780.0, 4818187.0, 6854040.0], - [8.0, 1085789.0, 2850195.0, 4614601.0, 6514731.0], - [8.5, 1017927.0, 2646610.0, 4411016.0, 6243284.0], - [9.0, 950065.0, 2443024.0, 4207431.0, 5971837.0], - [9.5, 814341.0, 2307301.0, 4003845.0, 5700390.0], - [10.0, 678618.0, 2239439.0, 3868122.0, 5428943.0]] - -#pile deflection coefficients -piledefcoef = [[2.0, 4.65, 3.4], - [2.25, 3.51, 2.4], - [2.5, 2.95, 2.05], - [2.75, 2.77, 1.85], - [3.0, 2.75, 1.8], - [3.25, 2.73, 1.77], - [3.5, 2.7, 1.75], - [3.75, 2.67, 1.72], - [4.0, 2.65, 1.7], - [4.25, 2.637, 1.7], - [4.5, 2.63, 1.7], - [4.75, 2.62, 1.7], - [5.0, 2.61, 1.7]] - -#pile moment coefficients am +line_bcf = [[20, 3], [25, 5], [30, 8], [35, 12], [40, 22], [45, 36]] + +# subgrade reaction coefficients +k1coeff = [ + [1, 100, 200], + [2, 57, 119], + [3, 45.75, 94], + [4, 34.5, 69], + [5, 30.75, 56], + [6, 27, 43], + [7, 25.25, 38], + [8, 23.5, 33], + [9, 22.25, 29], + [10, 21, 25], + [11, 19.75, 22.5], + [12, 18.5, 20], + [13, 17.75, 19], + [14, 17, 18], + [15, 16.5, 17.5], + [16, 16, 17], + [17, 15.75, 16.75], + [18, 15.5, 16.5], + [19, 15.25, 16.25], + [20, 15, 16], +] + +# subgrade soil reaction coefficients cohesionless +subgradereaccoef = [ + [0.5, 4886048.0, 12893739.0, 24158795.0, 32573656.0], + [1.0, 3800260.0, 10043544.0, 17644064.0, 24430242.0], + [1.5, 3257366.0, 7464796.0, 14115251.0, 19272747.0], + [2.0, 2850195.0, 6107561.0, 11672227.0, 16286828.0], + [2.5, 2443024.0, 5428943.0, 10179268.0, 14658145.0], + [3.0, 2171577.0, 5021772.0, 9229203.0, 13300910.0], + [3.5, 2035854.0, 4750325.0, 8414861.0, 11943674.0], + [4.0, 1764406.0, 4411016.0, 7736243.0, 10857885.0], + [4.5, 1628683.0, 4139569.0, 7193349.0, 10043544.0], + [5.0, 1560821.0, 3935983.0, 6650455.0, 9229203.0], + [5.5, 1425097.0, 3732398.0, 6107561.0, 8686308.0], + [6.0, 1357236.0, 3596675.0, 5768252.0, 8143414.0], + [6.5, 1289374.0, 3393089.0, 5361081.0, 7736243.0], + [7.0, 1221512.0, 3257366.0, 5021772.0, 7261211.0], + [7.5, 1153650.0, 3053780.0, 4818187.0, 6854040.0], + [8.0, 1085789.0, 2850195.0, 4614601.0, 6514731.0], + [8.5, 1017927.0, 2646610.0, 4411016.0, 6243284.0], + [9.0, 950065.0, 2443024.0, 4207431.0, 5971837.0], + [9.5, 814341.0, 2307301.0, 4003845.0, 5700390.0], + [10.0, 678618.0, 2239439.0, 3868122.0, 5428943.0], +] + +# pile deflection coefficients +piledefcoef = [ + [2.0, 4.65, 3.4], + [2.25, 3.51, 2.4], + [2.5, 2.95, 2.05], + [2.75, 2.77, 1.85], + [3.0, 2.75, 1.8], + [3.25, 2.73, 1.77], + [3.5, 2.7, 1.75], + [3.75, 2.67, 1.72], + [4.0, 2.65, 1.7], + [4.25, 2.637, 1.7], + [4.5, 2.63, 1.7], + [4.75, 2.62, 1.7], + [5.0, 2.61, 1.7], +] + +# pile moment coefficients am pilemomcoefam = [ [0, 0, 0, 0, 0, 0], [0.25, 0.255751417, 0.255752104, 0.25576445, 0.243605698, 0.227417941], @@ -630,10 +812,10 @@ [3.75, 0.03435529, 0.048391189, 0.023458111, 0, 0], [4, -0.008, 0.021, 0.008, 0, 0], [4.25, -0.04560529, 0.004858811, 0, 0, 0], - [4.5, -0.076, 0.003, 0, 0, 0] - ] - -#pile moment coefficients bm + [4.5, -0.076, 0.003, 0, 0, 0], +] + +# pile moment coefficients bm pilemomcoefbm = [ [0, 1, 1, 1, 1, 1], [0.25, 0.987315551, 0.987332937, 0.98122151, 0.992090215, 0.969472347], @@ -653,16 +835,18 @@ [3.75, -0.099507477, -0.047911693, 0.003155466, 0, 0], [4, -0.111648, -0.044108, -0.000686, 0, 0], [4.25, -0.111554773, -0.028243057, 0, 0, 0], - [4.5, -0.102084, -0.001464, 0, 0, 0] - ] - -#pile limiting values non calcaeous soils -pilefricresnoncal = [[35, 30, 40, 95.761e3, 9576.051e3], - [30, 25, 20, 81.396e3, 4788.026e3], - [25, 20, 12, 67.032e3, 2872.815e3], - [20, 15, 8, 47.880e3, 1915.210e3]] - -#plate anchor holding capacity factors + [4.5, -0.102084, -0.001464, 0, 0, 0], +] + +# pile limiting values non calcaeous soils +pilefricresnoncal = [ + [35, 30, 40, 95.761e3, 9576.051e3], + [30, 25, 20, 81.396e3, 4788.026e3], + [25, 20, 12, 67.032e3, 2872.815e3], + [20, 15, 8, 47.880e3, 1915.210e3], +] + +# plate anchor holding capacity factors hcfdrsoil = [ [1.0, 1.638945315, 1.994698838, 2.307140604, 2.784, 3.396946397], [2.0, 2.250880594, 3.062312263, 3.879752818, 5.05497647, 6.628796215], @@ -676,141 +860,139 @@ [10.0, 3.345993542, 5.688597794, 11.18491233, 21.95043482, 50.76899705], [11.0, 3.396495827, 5.789632743, 11.47106897, 22.74735899, 53.1019566], [12.0, 3.446998112, 5.890667693, 11.75722561, 23.54428317, 55.43491614], - [13.0, 3.497500397, 5.991702643, 12.04338224, 24.34120734, 57.76787568] - ] + [13.0, 3.497500397, 5.991702643, 12.04338224, 24.34120734, 57.76787568], +] # SOLVER OPTIONS -op_threshold = 0. +op_threshold = 0.0 # LOAD VARIABLES test_data = { - "bathymetry.layers": strata, - "constants.line_bearing_capacity_factor": line_bcf, - "constants.pile_Am_moment_coefficient": pilemomcoefam, - "constants.pile_Bm_moment_coefficient": pilemomcoefbm, - "constants.pile_deflection_coefficients": piledefcoef, - "constants.pile_skin_friction_end_bearing_capacity": pilefricresnoncal, - "constants.soil_cohesionless_reaction_coefficient": subgradereaccoef, - "constants.soil_cohesive_reaction_coefficient": k1coeff, - "constants.soil_drained_holding_capacity_factor": hcfdrsoil, - "farm.soil_sensitivity": soilsen, - "constants.soilprops": soilprops, - "constants.gravity": gravity, - "constants.sea_water_density": seaden, - "constants.air_density": airden, - "constants.steel_density": steelden, - "constants.concrete_density": conden, - "constants.grout_density": groutden, - "constants.grout_compressive_strength": grout_strength, - "constants.cylinder_drag": dragcoefcyl, - "constants.cylinder_wake_amplificiation": wakeampfactorcyl, - "constants.rectangular_wind_drag": winddragcoefrect, - "constants.rectangular_current_drag": currentdragcoefrect, - "constants.rectangular_drift": driftcoeffloatrect, - "constants.rectangular_wave_inertia": waveinertiacoefrect, - "corridor.layers": export_strata, - "farm.collection_point_type": collection_point_type, - "farm.connector_type": connector_type, - "component.collection_points": collection_points, - "component.collection_point_cog": collection_point_cog, - "component.collection_point_foundations": collection_point_found, - "component.dry_mate_connectors": dry_mate_connectors, - "component.dynamic_cable": dynamic_cable, - "project.equipment_gradient_constraint": equipment_gradient_constraint, - "component.installation_soil_compatibility": installation_soil_compatibility, - "component.static_cable": static_cable, - "component.transformers": transformers, - "component.wet_mate_connectors": wet_mate_connectors, - "project.fabrication_cost": fab_cost, - "corridor.number_of_export_cables": number_of_export_cables, - "project.export_voltage": corridor_voltage, - "corridor.landing_point": landing_point, - "corridor.nogo_areas": corridor_nogo_areas, - "project.export_target_burial_depth": corridor_target_burial_depth, - "device.bidirection": bidirection, - "device.connector_type": connection, - "device.turbine_hub_height": turbine_hub_height, - "device.cut_in_velocity": cut_in, - "device.cut_out_velocity": cut_out, - "device.installation_depth_max": max_install, - "device.installation_depth_min": min_install, - "device.minimum_distance_x": min_dist_x, - "device.minimum_distance_y": min_dist_y, - "device.constant_power_factor": power_factor, - "device.power_rating": rated_power_device, - "device.prescribed_footprint_radius": footprint_radius, - "device.system_draft": device_draft, - "device.turbine_diameter": rotor_diam, - "device.turbine_interdistance": turbine_interdist, - "device.turbine_performance": tidal_performance, - "device.umbilical_connection_point": umbilical_connection, - "project.umbilical_safety_factor": umbilical_safety, - "device.voltage": device_voltage, - "device.yaw": yaw_angle, - "device.dry_beam_area": sys_dry_beam, - "device.dry_frontal_area": sys_dry_frontal, - "device.foundation_location": found_loc, - "project.foundation_safety_factor": found_safety, - "device.foundation_type": prefound, - "device.system_centre_of_gravity": sys_cog, - "device.system_displaced_volume": sys_vol, - "device.system_height": sys_height, - "device.system_length": sys_length, - "device.system_mass": sys_mass, - "device.system_profile": sys_prof, - "device.system_roughness": sys_rough, - "device.system_width": sys_width, - "device.wet_beam_area": sys_wet_beam, - "device.wet_frontal_area": sys_wet_frontal, - "farm.blockage_ratio": blockage_ratio, - "project.devices_per_string": devices_per_string, - "farm.direction_of_max_surface_current": max_10year_current_dir, - "project.main_direction": main_direction, - "farm.max_surface_current_10_year": max_10year_current, - "project.network_configuration": network_configuration, - "farm.nogo_areas": nogo_areas, - "project.onshore_infrastructure_cost": onshore_infrastructure_cost, -# "farm.power_law_exponent": power_law_exponent, - "project.rated_power": rated_array_power, - "project.target_burial_depth": target_burial_depth, - "project.tidal_occurrence_nbins": n_bins, - "farm.tidal_occurrence_point": tidal_point, - "farm.tidal_series": tidal_series_raw, - "farm.wave_direction_100_year": predominant_100year_wave_dir, - "farm.current_profile": current_profile, - "project.grout_strength_safety_factor": grout_safety, - "farm.max_gust_wind_direction_100_year": max_100_year_gust_dir, - "farm.max_gust_wind_speed_100_year": max_100_year_gust_speed, - "farm.max_hs_100_year": max_100year_hs, - "farm.max_tp_100_year": max_100year_tp, - "farm.max_water_level_50_year": max_50_year_water_level, - "farm.mean_wind_direction_100_year": mean_100_year_wind_dir, - "farm.mean_wind_speed_100_year": mean_100_year_wind_speed, - "farm.min_water_level_50_year": min_50_year_water_level, - "farm.wave_gamma_100_year": max_100year_gamma, - "project.cost_of_concrete": cost_concrete, - "project.cost_of_grout": cost_grout, - "project.cost_of_steel": cost_steel, - "options.optimisation_threshold": op_threshold, - "options.user_array_layout": user_array_layout, - "options.user_array_option": user_array_option, - "site.lease_boundary": lease_area, - 'component.foundations_anchor': comp_tables["drag anchor"], - 'component.foundations_pile': comp_tables["pile"], - 'component.foundations_anchor_sand': comp_tables["drag anchor sand"], - 'component.foundations_anchor_soft': comp_tables["drag anchor soft"] - } - + "bathymetry.layers": strata, + "constants.line_bearing_capacity_factor": line_bcf, + "constants.pile_Am_moment_coefficient": pilemomcoefam, + "constants.pile_Bm_moment_coefficient": pilemomcoefbm, + "constants.pile_deflection_coefficients": piledefcoef, + "constants.pile_skin_friction_end_bearing_capacity": pilefricresnoncal, + "constants.soil_cohesionless_reaction_coefficient": subgradereaccoef, + "constants.soil_cohesive_reaction_coefficient": k1coeff, + "constants.soil_drained_holding_capacity_factor": hcfdrsoil, + "farm.soil_sensitivity": soilsen, + "constants.soilprops": soilprops, + "constants.gravity": gravity, + "constants.sea_water_density": seaden, + "constants.air_density": airden, + "constants.steel_density": steelden, + "constants.concrete_density": conden, + "constants.grout_density": groutden, + "constants.grout_compressive_strength": grout_strength, + "constants.cylinder_drag": dragcoefcyl, + "constants.cylinder_wake_amplificiation": wakeampfactorcyl, + "constants.rectangular_wind_drag": winddragcoefrect, + "constants.rectangular_current_drag": currentdragcoefrect, + "constants.rectangular_drift": driftcoeffloatrect, + "constants.rectangular_wave_inertia": waveinertiacoefrect, + "corridor.layers": export_strata, + "farm.collection_point_type": collection_point_type, + "farm.connector_type": connector_type, + "component.collection_points": collection_points, + "component.collection_point_cog": collection_point_cog, + "component.collection_point_foundations": collection_point_found, + "component.dry_mate_connectors": dry_mate_connectors, + "component.dynamic_cable": dynamic_cable, + "project.equipment_gradient_constraint": equipment_gradient_constraint, + "component.installation_soil_compatibility": installation_soil_compatibility, + "component.static_cable": static_cable, + "component.transformers": transformers, + "component.wet_mate_connectors": wet_mate_connectors, + "project.fabrication_cost": fab_cost, + "corridor.number_of_export_cables": number_of_export_cables, + "project.export_voltage": corridor_voltage, + "corridor.landing_point": landing_point, + "corridor.nogo_areas": corridor_nogo_areas, + "project.export_target_burial_depth": corridor_target_burial_depth, + "device.bidirection": bidirection, + "device.connector_type": connection, + "device.turbine_hub_height": turbine_hub_height, + "device.cut_in_velocity": cut_in, + "device.cut_out_velocity": cut_out, + "device.installation_depth_max": max_install, + "device.installation_depth_min": min_install, + "device.minimum_distance_x": min_dist_x, + "device.minimum_distance_y": min_dist_y, + "device.constant_power_factor": power_factor, + "device.power_rating": rated_power_device, + "device.prescribed_footprint_radius": footprint_radius, + "device.system_draft": device_draft, + "device.turbine_diameter": rotor_diam, + "device.turbine_interdistance": turbine_interdist, + "device.turbine_performance": tidal_performance, + "device.umbilical_connection_point": umbilical_connection, + "project.umbilical_safety_factor": umbilical_safety, + "device.voltage": device_voltage, + "device.yaw": yaw_angle, + "device.dry_beam_area": sys_dry_beam, + "device.dry_frontal_area": sys_dry_frontal, + "device.foundation_location": found_loc, + "project.foundation_safety_factor": found_safety, + "device.foundation_type": prefound, + "device.system_centre_of_gravity": sys_cog, + "device.system_displaced_volume": sys_vol, + "device.system_height": sys_height, + "device.system_length": sys_length, + "device.system_mass": sys_mass, + "device.system_profile": sys_prof, + "device.system_roughness": sys_rough, + "device.system_width": sys_width, + "device.wet_beam_area": sys_wet_beam, + "device.wet_frontal_area": sys_wet_frontal, + "farm.blockage_ratio": blockage_ratio, + "project.devices_per_string": devices_per_string, + "farm.direction_of_max_surface_current": max_10year_current_dir, + "project.main_direction": main_direction, + "farm.max_surface_current_10_year": max_10year_current, + "project.network_configuration": network_configuration, + "farm.nogo_areas": nogo_areas, + "project.onshore_infrastructure_cost": onshore_infrastructure_cost, + # "farm.power_law_exponent": power_law_exponent, + "project.rated_power": rated_array_power, + "project.target_burial_depth": target_burial_depth, + "project.tidal_occurrence_nbins": n_bins, + "farm.tidal_occurrence_point": tidal_point, + "farm.tidal_series": tidal_series_raw, + "farm.wave_direction_100_year": predominant_100year_wave_dir, + "farm.current_profile": current_profile, + "project.grout_strength_safety_factor": grout_safety, + "farm.max_gust_wind_direction_100_year": max_100_year_gust_dir, + "farm.max_gust_wind_speed_100_year": max_100_year_gust_speed, + "farm.max_hs_100_year": max_100year_hs, + "farm.max_tp_100_year": max_100year_tp, + "farm.max_water_level_50_year": max_50_year_water_level, + "farm.mean_wind_direction_100_year": mean_100_year_wind_dir, + "farm.mean_wind_speed_100_year": mean_100_year_wind_speed, + "farm.min_water_level_50_year": min_50_year_water_level, + "farm.wave_gamma_100_year": max_100year_gamma, + "project.cost_of_concrete": cost_concrete, + "project.cost_of_grout": cost_grout, + "project.cost_of_steel": cost_steel, + "options.optimisation_threshold": op_threshold, + "options.user_array_layout": user_array_layout, + "options.user_array_option": user_array_option, + "site.lease_boundary": lease_area, + "component.foundations_anchor": comp_tables["drag anchor"], + "component.foundations_pile": comp_tables["pile"], + "component.foundations_anchor_sand": comp_tables["drag anchor sand"], + "component.foundations_anchor_soft": comp_tables["drag anchor soft"], +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_reliability.py b/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_reliability.py index b7d70d4..02ec3ad 100644 --- a/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_reliability.py +++ b/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_reliability.py @@ -6,18 +6,17 @@ """ import os + import numpy as np import pandas as pd - from scipy.stats import multivariate_normal, norm from dtocean_core.utils.moorings import get_moorings_tables +from dtocean_core.utils.reliability import ( + compdict_from_mock, + get_reliability_tables, +) -from dtocean_core.utils.reliability import (get_reliability_tables, - compdict_from_mock) - -from collections import Counter - # Note that the electrical folder in the test_data directory should be # placed in the same folder as this file this_dir = os.path.dirname(os.path.realpath(__file__)) @@ -27,139 +26,151 @@ ## CONSTANTS -gravity = 9.80665 #gravity -seaden = 1025.0 #sea water density -airden = 1.226 #air density - -#cylinder drag coefficients -dragcoefcyl = [[0.0, 0.0, 1e-5, 1e-2], - [1e4, 1.2, 1.2, 1.15], - [2e4, 1.2, 1.2, 1.05], - [3e4, 1.2, 1.2, 0.87], - [4e4, 1.2, 1.15, 0.82], - [5e4, 1.2, 1.0, 0.8], - [6e4, 1.2, 0.9, 0.8], - [7e4, 1.2, 0.85, 0.83], - [8e4, 1.2, 0.7, 0.9], - [9e4, 1.2, 0.65, 0.94], - [1e5, 1.2, 0.6, 0.95], - [2e5, 1.2, 0.35, 1.02], - [3e5, 1.15, 0.3, 1.03], - [4e5, 0.95, 0.33, 1.05], - [5e5, 0.6, 0.35, 1.06], - [6e5, 0.35, 0.38, 1.07], - [7e5, 0.29, 0.4, 1.07], - [8e5, 0.31, 0.43, 1.08], - [9e5, 0.33, 0.45, 1.08], - [1e6, 0.35, 0.47, 1.08], - [2e6, 0.54, 0.53, 1.08], - [3e6, 0.62, 0.62, 1.08], - [4e6, 0.67, 0.67, 1.08]] - -#cylinder wake amplification factors -wakeampfactorcyl = [[0.0, 2.0, 2.0], - [5.0, 0.4, 0.8], - [10.0, 0.78, 1.3], - [15.0, 1.07, 1.4], - [20.0, 1.25, 1.25], - [25.0, 1.2, 1.2], - [30.0, 1.18, 1.18], - [35.0, 1.12, 1.12], - [40.0, 1.1, 1.1], - [45.0, 1.06, 1.06], - [50.0, 1.03, 1.03], - [55.0, 1.01, 1.01], - [60.0, 1.0, 1.0]] - -#rectangular section wind drag coefficients -winddragcoefrect = [[4.0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.6, 1.6], - [3.0, 1.1, 1.2, 1.25, 1.35, 1.4, 1.4, 1.4], - [2.0, 1.0, 1.05, 1.1, 1.15, 1.2, 1.2, 1.2], - [1.5, 0.95, 1.0, 1.05, 1.1, 1.15, 1.15, 1.15], - [1.0, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4], - [0.6667, 0.8, 0.85, 0.9, 0.95, 1.0, 1.0, 1.0], - [0.5, 0.75, 0.75, 0.8, 0.85, 0.9, 0.9, 0.9], - [0.3333, 0.7, 0.75, 0.75, 0.75, 0.8, 0.8, 0.8], - [0.25, 0.7, 0.7, 0.75, 0.75, 0.75, 0.75, 0.75]] - -#rectangular section current drag coefficients -currentdragcoefrect = [[10.0000, 1.88], - [5.0000, 1.95], - [3.3333, 2.06], - [2.5000, 2.24], - [2.0000, 2.39], - [1.6667, 2.6], - [1.4286, 2.73], - [1.2500, 2.5], - [1.1111, 2.31], - [1.0000, 2.19], - [0.9091, 2.06], - [0.8333, 1.95], - [0.7692, 1.87], - [0.7143, 1.8], - [0.6667, 1.73], - [0.6250, 1.67], - [0.5882, 1.63], - [0.5556, 1.58], - [0.5263, 1.52], - [0.5000, 1.49], - [0.4762, 1.46], - [0.4545, 1.44], - [0.4348, 1.41], - [0.4167, 1.37], - [0.4000, 1.35], - [0.3846, 1.32], - [0.3704, 1.29], - [0.3571, 1.26], - [0.3448, 1.25], - [0.3333, 1.23], - [0.3226, 1.21], - [0.3125, 1.2], - [0.3030, 1.19], - [0.2941, 1.18], - [0.2857, 1.16], - [0.2778, 1.15], - [0.2703, 1.15], - [0.2632, 1.15], - [0.2564, 1.15], - [0.2500, 1.15]] - -#rectangular section wave drift coefficients -driftcoeffloatrect = [[0.0, 0.0], - [0.1, 0.02], - [0.2, 0.06], - [0.3, 0.15], - [0.4, 0.28], - [0.5, 0.44], - [0.6, 0.60], - [0.7, 0.74], - [0.8, 0.84], - [0.9, 0.91], - [1.0, 0.94], - [1.1, 0.97], - [1.2, 0.98], - [1.3, 0.99], - [1.4, 1.0], - [1.5, 1.0]] - -#rectangular section wave inertia coefficients -waveinertiacoefrect = [[10.0, 2.23], - [5.0, 1.98], - [2.0, 1.7], - [1.0, 1.51], - [0.5, 1.36], - [0.2, 1.21], - [0.1, 1.14]] +gravity = 9.80665 # gravity +seaden = 1025.0 # sea water density +airden = 1.226 # air density + +# cylinder drag coefficients +dragcoefcyl = [ + [0.0, 0.0, 1e-5, 1e-2], + [1e4, 1.2, 1.2, 1.15], + [2e4, 1.2, 1.2, 1.05], + [3e4, 1.2, 1.2, 0.87], + [4e4, 1.2, 1.15, 0.82], + [5e4, 1.2, 1.0, 0.8], + [6e4, 1.2, 0.9, 0.8], + [7e4, 1.2, 0.85, 0.83], + [8e4, 1.2, 0.7, 0.9], + [9e4, 1.2, 0.65, 0.94], + [1e5, 1.2, 0.6, 0.95], + [2e5, 1.2, 0.35, 1.02], + [3e5, 1.15, 0.3, 1.03], + [4e5, 0.95, 0.33, 1.05], + [5e5, 0.6, 0.35, 1.06], + [6e5, 0.35, 0.38, 1.07], + [7e5, 0.29, 0.4, 1.07], + [8e5, 0.31, 0.43, 1.08], + [9e5, 0.33, 0.45, 1.08], + [1e6, 0.35, 0.47, 1.08], + [2e6, 0.54, 0.53, 1.08], + [3e6, 0.62, 0.62, 1.08], + [4e6, 0.67, 0.67, 1.08], +] + +# cylinder wake amplification factors +wakeampfactorcyl = [ + [0.0, 2.0, 2.0], + [5.0, 0.4, 0.8], + [10.0, 0.78, 1.3], + [15.0, 1.07, 1.4], + [20.0, 1.25, 1.25], + [25.0, 1.2, 1.2], + [30.0, 1.18, 1.18], + [35.0, 1.12, 1.12], + [40.0, 1.1, 1.1], + [45.0, 1.06, 1.06], + [50.0, 1.03, 1.03], + [55.0, 1.01, 1.01], + [60.0, 1.0, 1.0], +] + +# rectangular section wind drag coefficients +winddragcoefrect = [ + [4.0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.6, 1.6], + [3.0, 1.1, 1.2, 1.25, 1.35, 1.4, 1.4, 1.4], + [2.0, 1.0, 1.05, 1.1, 1.15, 1.2, 1.2, 1.2], + [1.5, 0.95, 1.0, 1.05, 1.1, 1.15, 1.15, 1.15], + [1.0, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4], + [0.6667, 0.8, 0.85, 0.9, 0.95, 1.0, 1.0, 1.0], + [0.5, 0.75, 0.75, 0.8, 0.85, 0.9, 0.9, 0.9], + [0.3333, 0.7, 0.75, 0.75, 0.75, 0.8, 0.8, 0.8], + [0.25, 0.7, 0.7, 0.75, 0.75, 0.75, 0.75, 0.75], +] + +# rectangular section current drag coefficients +currentdragcoefrect = [ + [10.0000, 1.88], + [5.0000, 1.95], + [3.3333, 2.06], + [2.5000, 2.24], + [2.0000, 2.39], + [1.6667, 2.6], + [1.4286, 2.73], + [1.2500, 2.5], + [1.1111, 2.31], + [1.0000, 2.19], + [0.9091, 2.06], + [0.8333, 1.95], + [0.7692, 1.87], + [0.7143, 1.8], + [0.6667, 1.73], + [0.6250, 1.67], + [0.5882, 1.63], + [0.5556, 1.58], + [0.5263, 1.52], + [0.5000, 1.49], + [0.4762, 1.46], + [0.4545, 1.44], + [0.4348, 1.41], + [0.4167, 1.37], + [0.4000, 1.35], + [0.3846, 1.32], + [0.3704, 1.29], + [0.3571, 1.26], + [0.3448, 1.25], + [0.3333, 1.23], + [0.3226, 1.21], + [0.3125, 1.2], + [0.3030, 1.19], + [0.2941, 1.18], + [0.2857, 1.16], + [0.2778, 1.15], + [0.2703, 1.15], + [0.2632, 1.15], + [0.2564, 1.15], + [0.2500, 1.15], +] + +# rectangular section wave drift coefficients +driftcoeffloatrect = [ + [0.0, 0.0], + [0.1, 0.02], + [0.2, 0.06], + [0.3, 0.15], + [0.4, 0.28], + [0.5, 0.44], + [0.6, 0.60], + [0.7, 0.74], + [0.8, 0.84], + [0.9, 0.91], + [1.0, 0.94], + [1.1, 0.97], + [1.2, 0.98], + [1.3, 0.99], + [1.4, 1.0], + [1.5, 1.0], +] + +# rectangular section wave inertia coefficients +waveinertiacoefrect = [ + [10.0, 2.23], + [5.0, 1.98], + [2.0, 1.7], + [1.0, 1.51], + [0.5, 1.36], + [0.2, 1.21], + [0.1, 1.14], +] ## LEASE AREA -startx = 1000. -endx = 2000. -dx = 10. +startx = 1000.0 +endx = 2000.0 +dx = 10.0 numx = int(float(endx - startx) / dx) + 1 -starty = 0. -endy = 2500. -dy = 10. +starty = 0.0 +endy = 2500.0 +dy = 10.0 numy = int(float(endy - starty) / dy) + 1 x = np.linspace(startx, endx, numx) @@ -168,54 +179,53 @@ ny = len(y) # Bathymetry -X, Y = np.meshgrid(x,y) -Z = np.zeros(X.shape) - 50. +X, Y = np.meshgrid(x, y) +Z = np.zeros(X.shape) - 50.0 depths = Z.T[:, :, np.newaxis] -sediments = np.chararray((nx,ny,1), itemsize=20) +sediments = np.chararray((nx, ny, 1), itemsize=20) sediments[:] = "loose sand" - -strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} + +strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} # Soil characteristics -max_temp = 10. -max_soil_res = 10. +max_temp = 10.0 +max_soil_res = 10.0 target_burial_depth = 10 # Polygons -lease_area = [(startx, starty), - (endx, starty), - (endx, endy), - (startx, endy)] - -#nogo_areas = [np.array([[50., 50.],[60., 50.],[60., 60.],[50., 60.]])] +lease_area = [(startx, starty), (endx, starty), (endx, endy), (startx, endy)] + +# nogo_areas = [np.array([[50., 50.],[60., 50.],[60., 60.],[50., 60.]])] nogo_areas = None - + # Tidal time series n_bins = 6 time_points = 48 t = np.linspace(0, 1, time_points) rv = norm() -time_sin = np.sin(np.linspace(0, 4*np.pi, time_points)) -time_scaled = time_sin * (1. / np.amax(time_sin)) +time_sin = np.sin(np.linspace(0, 4 * np.pi, time_points)) +time_scaled = time_sin * (1.0 / np.amax(time_sin)) -xgrid, ygrid = np.meshgrid(x,y) +xgrid, ygrid = np.meshgrid(x, y) pos = np.dstack((xgrid, ygrid)) -rv = multivariate_normal([500., 150.], [[max(x)*5., max(y)*2.], - [max(y)*2., max(x)*5.]]) +rv = multivariate_normal( + [500.0, 150.0], [[max(x) * 5.0, max(y) * 2.0], [max(y) * 2.0, max(x) * 5.0]] +) -u_max = 0. -v_max = 6. -ssh_max = 1. +u_max = 0.0 +v_max = 6.0 +ssh_max = 1.0 TI = 0.1 grid_pdf = rv.pdf(pos).T -#u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) +# u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) u_scaled = np.ones((nx, ny)) * u_max v_scaled = np.ones((nx, ny)) * v_max ssh_scaled = grid_pdf * (ssh_max / np.amax(grid_pdf)) @@ -225,7 +235,6 @@ ssh_arrays = [] for multiplier in time_scaled: - u_arrays.append(np.abs(u_scaled * multiplier)) v_arrays.append(np.abs(v_scaled * multiplier)) ssh_arrays.append(ssh_scaled * multiplier) @@ -235,30 +244,29 @@ SSH = np.dstack(ssh_arrays) TI = np.ones(SSH.shape) * TI -tidal_series_raw = {"values": {"U": U, - "V": V, - "SSH": SSH, - "TI": TI}, - "coords": [x, y, t]} - -xc = x[int(nx/2)] -yc = y[int(ny/2)] +tidal_series_raw = { + "values": {"U": U, "V": V, "SSH": SSH, "TI": TI}, + "coords": [x, y, t], +} + +xc = x[int(nx / 2)] +yc = y[int(ny / 2)] tidal_point = (xc, yc) # Tidal flow characteristics (hydro) -power_law_exponent = np.array([7.]) -blockage_ratio = 1. +power_law_exponent = np.array([7.0]) +blockage_ratio = 1.0 # Tidal flow characteristics (moorings) -max_10year_current = 6. -max_10year_current_dir = 0. -current_profile = "1/7 Power Law" #current profile alternatives: "Uniform" - # "1/7 Power Law" +max_10year_current = 6.0 +max_10year_current_dir = 0.0 +current_profile = "1/7 Power Law" # current profile alternatives: "Uniform" +# "1/7 Power Law" # Wave characterists -predominant_100year_wave_dir = 0. +predominant_100year_wave_dir = 0.0 max_100year_hs = 0.5 -max_100year_tp = 10. +max_100year_tp = 10.0 spectrum_gamma_farm = 3.3 # Wind characteristics @@ -268,20 +276,20 @@ max_100_year_gust_dir = 0.0 # Water level characterists -max_50_year_water_level = 5.0 #water level maximum offset -min_50_year_water_level = 0.0 #water level minimum offset +max_50_year_water_level = 5.0 # water level maximum offset +min_50_year_water_level = 0.0 # water level minimum offset ## CABLE CORRIDOR -startx = 0. -endx = 1000. -dx = 10. +startx = 0.0 +endx = 1000.0 +dx = 10.0 numx = int(float(endx - startx) / dx) -starty = 1000. -endy = 1500. -dy = 10. +starty = 1000.0 +endy = 1500.0 +dy = 10.0 numy = int(float(endy - starty) / dy) + 1 x = np.linspace(startx, endx, numx) @@ -290,154 +298,325 @@ ny = len(y) # Bathymetry -X, Y = np.meshgrid(x,y) -Z = np.zeros(X.shape) - 50. +X, Y = np.meshgrid(x, y) +Z = np.zeros(X.shape) - 50.0 depths = Z.T[:, :, np.newaxis] -sediments = np.chararray((nx,ny,1), itemsize=20) +sediments = np.chararray((nx, ny, 1), itemsize=20) sediments[:] = "loose sand" - -export_strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} -# Soil characteristics -corridor_max_temp = 10. -corridor_max_soil_res = 10. -corridor_target_burial_depth = 20. +export_strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} + +# Soil characteristics +corridor_max_temp = 10.0 +corridor_max_soil_res = 10.0 +corridor_target_burial_depth = 20.0 # Polygons corridor_nogo_areas = None # Tidal flow characteristics -corridor_10year_current = 6. -corridor_10year_current_dir = 0. +corridor_10year_current = 6.0 +corridor_10year_current_dir = 0.0 # Wave characterists -corridor_100year_wave_dir = 0. - +corridor_100year_wave_dir = 0.0 + ## SHORELINE - -landing_point = (0., 1250.) -onshore_infrastructure_cost = 1000000. - + +landing_point = (0.0, 1250.0) +onshore_infrastructure_cost = 1000000.0 + # MACHINE -X = np.array([ 0. , 0.1010101 , 0.2020202 , 0.3030303 , - 0.4040404 , 0.50505051, 0.60606061, 0.70707071, - 0.80808081, 0.90909091, 1.01010101, 1.11111111, - 1.21212121, 1.31313131, 1.41414141, 1.51515152, - 1.61616162, 1.71717172, 1.81818182, 1.91919192, - 2.02020202, 2.12121212, 2.22222222, 2.32323232, - 2.42424242, 2.52525253, 2.62626263, 2.72727273, - 2.82828283, 2.92929293, 3.03030303, 3.13131313, - 3.23232323, 3.33333333, 3.43434343, 3.53535354, - 3.63636364, 3.73737374, 3.83838384, 3.93939394, - 4.04040404, 4.14141414, 4.24242424, 4.34343434, - 4.44444444, 4.54545455, 4.64646465, 4.74747475, - 4.84848485, 4.94949495, 5.05050505, 5.15151515, - 5.25252525, 5.35353535, 5.45454545, 5.55555556, - 5.65656566, 5.75757576, 5.85858586, 5.95959596, - 6.06060606, 6.16161616, 6.26262626, 6.36363636, - 6.46464646, 6.56565657, 6.66666667, 6.76767677, - 6.86868687, 6.96969697, 7.07070707, 7.17171717, - 7.27272727, 7.37373737, 7.47474747, 7.57575758, - 7.67676768, 7.77777778, 7.87878788, 7.97979798, - 8.08080808, 8.18181818, 8.28282828, 8.38383838, - 8.48484848, 8.58585859, 8.68686869, 8.78787879, - 8.88888889, 8.98989899, 9.09090909, 9.19191919, - 9.29292929, 9.39393939, 9.49494949, 9.5959596 , - 9.6969697 , 9.7979798 , 9.8989899 , 10. ]) - -Cp = np.array([ 0. , 0. , 0. , 0. , 0. , - 0. , 0. , 0. , 0. , 0. , - 0.00248182, 0.0273 , 0.05211818, 0.07693636, 0.10175455, - 0.12657273, 0.15139091, 0.17620909, 0.20102727, 0.22584545, - 0.25066364, 0.27548182, 0.3003 , 0.32511818, 0.34993636, - 0.37475455, 0.39957273, 0.42439091, 0.44920909, 0.47402727, - 0.49884545, 0.52366364, 0.54848182, 0.5733 , 0.59811818, - 0.62293636, 0.64775455, 0.67257273, 0.69739091, 0.72220909, - 0.74702727, 0.77184545, 0.79666364, 0.82148182, 0.8463 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 - ]) - -Ct = 0.4*np.ones((100)) +X = np.array( + [ + 0.0, + 0.1010101, + 0.2020202, + 0.3030303, + 0.4040404, + 0.50505051, + 0.60606061, + 0.70707071, + 0.80808081, + 0.90909091, + 1.01010101, + 1.11111111, + 1.21212121, + 1.31313131, + 1.41414141, + 1.51515152, + 1.61616162, + 1.71717172, + 1.81818182, + 1.91919192, + 2.02020202, + 2.12121212, + 2.22222222, + 2.32323232, + 2.42424242, + 2.52525253, + 2.62626263, + 2.72727273, + 2.82828283, + 2.92929293, + 3.03030303, + 3.13131313, + 3.23232323, + 3.33333333, + 3.43434343, + 3.53535354, + 3.63636364, + 3.73737374, + 3.83838384, + 3.93939394, + 4.04040404, + 4.14141414, + 4.24242424, + 4.34343434, + 4.44444444, + 4.54545455, + 4.64646465, + 4.74747475, + 4.84848485, + 4.94949495, + 5.05050505, + 5.15151515, + 5.25252525, + 5.35353535, + 5.45454545, + 5.55555556, + 5.65656566, + 5.75757576, + 5.85858586, + 5.95959596, + 6.06060606, + 6.16161616, + 6.26262626, + 6.36363636, + 6.46464646, + 6.56565657, + 6.66666667, + 6.76767677, + 6.86868687, + 6.96969697, + 7.07070707, + 7.17171717, + 7.27272727, + 7.37373737, + 7.47474747, + 7.57575758, + 7.67676768, + 7.77777778, + 7.87878788, + 7.97979798, + 8.08080808, + 8.18181818, + 8.28282828, + 8.38383838, + 8.48484848, + 8.58585859, + 8.68686869, + 8.78787879, + 8.88888889, + 8.98989899, + 9.09090909, + 9.19191919, + 9.29292929, + 9.39393939, + 9.49494949, + 9.5959596, + 9.6969697, + 9.7979798, + 9.8989899, + 10.0, + ] +) + +Cp = np.array( + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.00248182, + 0.0273, + 0.05211818, + 0.07693636, + 0.10175455, + 0.12657273, + 0.15139091, + 0.17620909, + 0.20102727, + 0.22584545, + 0.25066364, + 0.27548182, + 0.3003, + 0.32511818, + 0.34993636, + 0.37475455, + 0.39957273, + 0.42439091, + 0.44920909, + 0.47402727, + 0.49884545, + 0.52366364, + 0.54848182, + 0.5733, + 0.59811818, + 0.62293636, + 0.64775455, + 0.67257273, + 0.69739091, + 0.72220909, + 0.74702727, + 0.77184545, + 0.79666364, + 0.82148182, + 0.8463, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + ] +) -# Performance curves are matched to the same veloity abscissae -tidal_performance = {"Velocity": X, - "Coefficient of Power": Cp, - "Coefficient of Thrust": Ct} +Ct = 0.4 * np.ones((100)) -# Device characterists -turbine_hub_height = 20. -rotor_diam = 18. +# Performance curves are matched to the same veloity abscissae +tidal_performance = { + "Velocity": X, + "Coefficient of Power": Cp, + "Coefficient of Thrust": Ct, +} + +# Device characterists +turbine_hub_height = 20.0 +rotor_diam = 18.0 turbine_interdist = None min_install = -np.inf -max_install = -40. -min_dist_x = 40. -min_dist_y = 40. +max_install = -40.0 +min_dist_x = 40.0 +min_dist_y = 40.0 bidirection = True -rated_power_device = 1. -device_voltage= 11000. -yaw_angle = 0. -cut_in = 1. -cut_out = 5. -connection = 'Wet-Mate' -footprint_radius = 20. +rated_power_device = 1.0 +device_voltage = 11000.0 +yaw_angle = 0.0 +cut_in = 1.0 +cut_out = 5.0 +connection = "Wet-Mate" +footprint_radius = 20.0 device_draft = None umbilical_connection = None umbilical_safety = None power_factor = 0.98 - -sys_prof = "Cylindrical" #device profile options: "Cylindrical" "Rectangular" -sys_mass = 300.0e3 #device mass -sys_cog = [0.0, 0.0, 15.0] #device centre of gravity -sys_vol = 148.44 #device displaced volume -sys_height = 21.0 #device height -sys_width = 3.0 #device width -sys_length = 3.0 #device length -sys_dry_frontal = 0.0 #device dry frontal area -sys_dry_beam = 0.0 #device dry beam area -sys_wet_frontal = 63.0 #device wet frontal area -sys_wet_beam = 63.0 #device wet beam area -sys_rough = 0.9e-2 #device surface roughness - -#predefined foundation type: Shallow, Gravity, Pile, Suction Caisson, - # Direct Embedment, Drag -prefound = None - -#foundation locations (from device origin) -found_loc = np.array([[-10.0, -10.0, 0.0], - [-10.0, 10.0, 0.0], - [ 10.0, 10.0, 0.0], - [ 10.0, -10.0, 0.0]]) - + +sys_prof = "Cylindrical" # device profile options: "Cylindrical" "Rectangular" +sys_mass = 300.0e3 # device mass +sys_cog = [0.0, 0.0, 15.0] # device centre of gravity +sys_vol = 148.44 # device displaced volume +sys_height = 21.0 # device height +sys_width = 3.0 # device width +sys_length = 3.0 # device length +sys_dry_frontal = 0.0 # device dry frontal area +sys_dry_beam = 0.0 # device dry beam area +sys_wet_frontal = 63.0 # device wet frontal area +sys_wet_beam = 63.0 # device wet beam area +sys_rough = 0.9e-2 # device surface roughness + +# predefined foundation type: Shallow, Gravity, Pile, Suction Caisson, +# Direct Embedment, Drag +prefound = None + +# foundation locations (from device origin) +found_loc = np.array( + [ + [-10.0, -10.0, 0.0], + [-10.0, 10.0, 0.0], + [10.0, 10.0, 0.0], + [10.0, -10.0, 0.0], + ] +) + # ARRAY LAYOUT -user_array_option = 'User Defined Fixed' +user_array_option = "User Defined Fixed" + +pos = [ + (1250.0, 500.0), + (1750.0, 500.0), + (1500.0, 1250.0), + (1250.0, 2000.0), + (1750, 2000.0), +] -pos = [(1250., 500.), - (1750., 500.), - (1500., 1250.), - (1250., 2000.), - (1750, 2000.)] - user_array_layout = np.array(pos) -main_direction = 0. -rated_array_power = 5. +main_direction = 0.0 +rated_array_power = 5.0 ## ELECTRICAL NETWORK @@ -448,19 +627,19 @@ max_voltage = 1.0 # Corridor -corridor_voltage = 33000. +corridor_voltage = 33000.0 ## FOUNDATIONS -found_safety = 1.5 #foundation safety factor -grout_safety = 6.0 #grout safety factor -fab_cost = None # 1.0 #optional fabrication cost factor +found_safety = 1.5 # foundation safety factor +grout_safety = 6.0 # grout safety factor +fab_cost = None # 1.0 #optional fabrication cost factor ## COMPONENT DATA # Electrical -component_data_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(component_data_path, encoding = 'utf-8') +component_data_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(component_data_path) sheet_names = xls_file.sheet_names static_cable = xls_file.parse(sheet_names[0]) @@ -470,146 +649,148 @@ transformers = xls_file.parse(sheet_names[4]) collection_points = xls_file.parse(sheet_names[5]) -collection_point_cog = {11: [0,0,0], - 12: [0,0,0], - 22: [0,0,0], - 23: [0,0,0], - 24: [0,0,0], - 25: [0,0,0] - } - -collection_point_found = {11: [[0,0,0]], - 12: [[0,0,0]], - 22: [[0,0,0]], - 23: [[0,0,0]], - 24: [[0,0,0]], - 25: [[0,0,0]] - } - -compat_data_path = os.path.join(elec_dir, - 'equipment_compatibility_matrix.xlsx') -xls_file = pd.ExcelFile(compat_data_path, encoding='utf-8') +collection_point_cog = { + 11: [0, 0, 0], + 12: [0, 0, 0], + 22: [0, 0, 0], + 23: [0, 0, 0], + 24: [0, 0, 0], + 25: [0, 0, 0], +} + +collection_point_found = { + 11: [[0, 0, 0]], + 12: [[0, 0, 0]], + 22: [[0, 0, 0]], + 23: [[0, 0, 0]], + 24: [[0, 0, 0]], + 25: [[0, 0, 0]], +} + +compat_data_path = os.path.join(elec_dir, "equipment_compatibility_matrix.xlsx") +xls_file = pd.ExcelFile(compat_data_path) sheet_names = xls_file.sheet_names -installation_soil_compatibility = xls_file.parse(sheet_names[0], - index_col=None) -installation_soil_compatibility.columns = ['Technique', - 'Loose Sand', - 'Medium Sand', - 'Dense Sand', - 'Very Soft Clay', - 'Soft Clay', - 'Firm Clay', - 'Stiff Clay', - 'Hard Glacial Till', - 'Cemented', - 'Soft Rock Coral', - 'Hard Rock', - 'Gravel Cobble'] - -equipment_gradient_constraint = 14. +installation_soil_compatibility = xls_file.parse(sheet_names[0], index_col=None) +installation_soil_compatibility.columns = [ + "Technique", + "Loose Sand", + "Medium Sand", + "Dense Sand", + "Very Soft Clay", + "Soft Clay", + "Firm Clay", + "Stiff Clay", + "Hard Glacial Till", + "Cemented", + "Soft Rock Coral", + "Hard Rock", + "Gravel Cobble", +] + +equipment_gradient_constraint = 14.0 # Moorings and Foundations -compdict = eval(open(os.path.join(moor_dir, 'dummycompdb.txt')).read()) -comp_tables = get_moorings_tables(compdict) #component database - -cost_steel = 1.0 #steel cost -cost_grout = 0.1 #grout cost -cost_concrete = 0.11 #concrete cost -grout_strength = 125.0 #grout strength +compdict = eval(open(os.path.join(moor_dir, "dummycompdb.txt")).read()) +comp_tables = get_moorings_tables(compdict) # component database + +cost_steel = 1.0 # steel cost +cost_grout = 0.1 # grout cost +cost_concrete = 0.11 # concrete cost +grout_strength = 125.0 # grout strength ## MATERIALS # Foundations -steelden = 7750.0 #steel density -conden = 2400.0 #concrete density -groutden = 2450.0 #grout density +steelden = 7750.0 # steel density +conden = 2400.0 # concrete density +groutden = 2450.0 # grout density # Substrate -draincoh = 0.0 #drained soil cohesion -unsfang = 5.0 #undrained soil friction angle -dsfang = 35.0 #drained soil friction angle -soilweight = 9.4285e+03 #buoyant soil weight -relsoilden = 50.0 #relative soil density +draincoh = 0.0 # drained soil cohesion +unsfang = 5.0 # undrained soil friction angle +dsfang = 35.0 # drained soil friction angle +soilweight = 9.4285e03 # buoyant soil weight +relsoilden = 50.0 # relative soil density undrained_soil_shear_strength_constant = 1.45e3 -undrained_soil_shear_strength_dependent = 2e3 #undrained shear friction angle -soilsen = 3.0 #soil sensitivity -rockcomstr = 206843.0 #rock compressive strength +undrained_soil_shear_strength_dependent = 2e3 # undrained shear friction angle +soilsen = 3.0 # soil sensitivity +rockcomstr = 206843.0 # rock compressive strength # default soil properties table -soilprops = pd.read_csv(os.path.join(moor_dir, 'soilprops.txt'), - sep='\t', - header=0, - index_col=False) +soilprops = pd.read_csv( + os.path.join(moor_dir, "soilprops.txt"), sep="\t", header=0, index_col=False +) # buried line bearing capacity factors -line_bcf = [[20, 3], - [25, 5], - [30, 8], - [35, 12], - [40, 22], - [45, 36]] - -#subgrade reaction coefficients -k1coeff = [[1, 100, 200], - [2, 57, 119], - [3, 45.75, 94], - [4, 34.5, 69], - [5, 30.75, 56], - [6, 27, 43], - [7, 25.25, 38], - [8, 23.5, 33], - [9, 22.25, 29], - [10, 21, 25], - [11, 19.75, 22.5], - [12, 18.5, 20], - [13, 17.75, 19], - [14, 17, 18], - [15, 16.5, 17.5], - [16, 16, 17], - [17, 15.75, 16.75], - [18, 15.5, 16.5], - [19, 15.25, 16.25], - [20, 15, 16]] - -#subgrade soil reaction coefficients cohesionless -subgradereaccoef = [[0.5, 4886048.0, 12893739.0, 24158795.0, 32573656.0], - [1.0, 3800260.0, 10043544.0, 17644064.0, 24430242.0], - [1.5, 3257366.0, 7464796.0, 14115251.0, 19272747.0], - [2.0, 2850195.0, 6107561.0, 11672227.0, 16286828.0], - [2.5, 2443024.0, 5428943.0, 10179268.0, 14658145.0], - [3.0, 2171577.0, 5021772.0, 9229203.0, 13300910.0], - [3.5, 2035854.0, 4750325.0, 8414861.0, 11943674.0], - [4.0, 1764406.0, 4411016.0, 7736243.0, 10857885.0], - [4.5, 1628683.0, 4139569.0, 7193349.0, 10043544.0], - [5.0, 1560821.0, 3935983.0, 6650455.0, 9229203.0], - [5.5, 1425097.0, 3732398.0, 6107561.0, 8686308.0], - [6.0, 1357236.0, 3596675.0, 5768252.0, 8143414.0], - [6.5, 1289374.0, 3393089.0, 5361081.0, 7736243.0], - [7.0, 1221512.0, 3257366.0, 5021772.0, 7261211.0], - [7.5, 1153650.0, 3053780.0, 4818187.0, 6854040.0], - [8.0, 1085789.0, 2850195.0, 4614601.0, 6514731.0], - [8.5, 1017927.0, 2646610.0, 4411016.0, 6243284.0], - [9.0, 950065.0, 2443024.0, 4207431.0, 5971837.0], - [9.5, 814341.0, 2307301.0, 4003845.0, 5700390.0], - [10.0, 678618.0, 2239439.0, 3868122.0, 5428943.0]] - -#pile deflection coefficients -piledefcoef = [[2.0, 4.65, 3.4], - [2.25, 3.51, 2.4], - [2.5, 2.95, 2.05], - [2.75, 2.77, 1.85], - [3.0, 2.75, 1.8], - [3.25, 2.73, 1.77], - [3.5, 2.7, 1.75], - [3.75, 2.67, 1.72], - [4.0, 2.65, 1.7], - [4.25, 2.637, 1.7], - [4.5, 2.63, 1.7], - [4.75, 2.62, 1.7], - [5.0, 2.61, 1.7]] - -#pile moment coefficients am +line_bcf = [[20, 3], [25, 5], [30, 8], [35, 12], [40, 22], [45, 36]] + +# subgrade reaction coefficients +k1coeff = [ + [1, 100, 200], + [2, 57, 119], + [3, 45.75, 94], + [4, 34.5, 69], + [5, 30.75, 56], + [6, 27, 43], + [7, 25.25, 38], + [8, 23.5, 33], + [9, 22.25, 29], + [10, 21, 25], + [11, 19.75, 22.5], + [12, 18.5, 20], + [13, 17.75, 19], + [14, 17, 18], + [15, 16.5, 17.5], + [16, 16, 17], + [17, 15.75, 16.75], + [18, 15.5, 16.5], + [19, 15.25, 16.25], + [20, 15, 16], +] + +# subgrade soil reaction coefficients cohesionless +subgradereaccoef = [ + [0.5, 4886048.0, 12893739.0, 24158795.0, 32573656.0], + [1.0, 3800260.0, 10043544.0, 17644064.0, 24430242.0], + [1.5, 3257366.0, 7464796.0, 14115251.0, 19272747.0], + [2.0, 2850195.0, 6107561.0, 11672227.0, 16286828.0], + [2.5, 2443024.0, 5428943.0, 10179268.0, 14658145.0], + [3.0, 2171577.0, 5021772.0, 9229203.0, 13300910.0], + [3.5, 2035854.0, 4750325.0, 8414861.0, 11943674.0], + [4.0, 1764406.0, 4411016.0, 7736243.0, 10857885.0], + [4.5, 1628683.0, 4139569.0, 7193349.0, 10043544.0], + [5.0, 1560821.0, 3935983.0, 6650455.0, 9229203.0], + [5.5, 1425097.0, 3732398.0, 6107561.0, 8686308.0], + [6.0, 1357236.0, 3596675.0, 5768252.0, 8143414.0], + [6.5, 1289374.0, 3393089.0, 5361081.0, 7736243.0], + [7.0, 1221512.0, 3257366.0, 5021772.0, 7261211.0], + [7.5, 1153650.0, 3053780.0, 4818187.0, 6854040.0], + [8.0, 1085789.0, 2850195.0, 4614601.0, 6514731.0], + [8.5, 1017927.0, 2646610.0, 4411016.0, 6243284.0], + [9.0, 950065.0, 2443024.0, 4207431.0, 5971837.0], + [9.5, 814341.0, 2307301.0, 4003845.0, 5700390.0], + [10.0, 678618.0, 2239439.0, 3868122.0, 5428943.0], +] + +# pile deflection coefficients +piledefcoef = [ + [2.0, 4.65, 3.4], + [2.25, 3.51, 2.4], + [2.5, 2.95, 2.05], + [2.75, 2.77, 1.85], + [3.0, 2.75, 1.8], + [3.25, 2.73, 1.77], + [3.5, 2.7, 1.75], + [3.75, 2.67, 1.72], + [4.0, 2.65, 1.7], + [4.25, 2.637, 1.7], + [4.5, 2.63, 1.7], + [4.75, 2.62, 1.7], + [5.0, 2.61, 1.7], +] + +# pile moment coefficients am pilemomcoefam = [ [0, 0, 0, 0, 0, 0], [0.25, 0.255751417, 0.255752104, 0.25576445, 0.243605698, 0.227417941], @@ -629,10 +810,10 @@ [3.75, 0.03435529, 0.048391189, 0.023458111, 0, 0], [4, -0.008, 0.021, 0.008, 0, 0], [4.25, -0.04560529, 0.004858811, 0, 0, 0], - [4.5, -0.076, 0.003, 0, 0, 0] - ] - -#pile moment coefficients bm + [4.5, -0.076, 0.003, 0, 0, 0], +] + +# pile moment coefficients bm pilemomcoefbm = [ [0, 1, 1, 1, 1, 1], [0.25, 0.987315551, 0.987332937, 0.98122151, 0.992090215, 0.969472347], @@ -652,16 +833,18 @@ [3.75, -0.099507477, -0.047911693, 0.003155466, 0, 0], [4, -0.111648, -0.044108, -0.000686, 0, 0], [4.25, -0.111554773, -0.028243057, 0, 0, 0], - [4.5, -0.102084, -0.001464, 0, 0, 0] - ] - -#pile limiting values non calcaeous soils -pilefricresnoncal = [[35, 30, 40, 95.761e3, 9576.051e3], - [30, 25, 20, 81.396e3, 4788.026e3], - [25, 20, 12, 67.032e3, 2872.815e3], - [20, 15, 8, 47.880e3, 1915.210e3]] - -#plate anchor holding capacity factors + [4.5, -0.102084, -0.001464, 0, 0, 0], +] + +# pile limiting values non calcaeous soils +pilefricresnoncal = [ + [35, 30, 40, 95.761e3, 9576.051e3], + [30, 25, 20, 81.396e3, 4788.026e3], + [25, 20, 12, 67.032e3, 2872.815e3], + [20, 15, 8, 47.880e3, 1915.210e3], +] + +# plate anchor holding capacity factors hcfdrsoil = [ [1.0, 1.638945315, 1.994698838, 2.307140604, 2.784, 3.396946397], [2.0, 2.250880594, 3.062312263, 3.879752818, 5.05497647, 6.628796215], @@ -675,30 +858,30 @@ [10.0, 3.345993542, 5.688597794, 11.18491233, 21.95043482, 50.76899705], [11.0, 3.396495827, 5.789632743, 11.47106897, 22.74735899, 53.1019566], [12.0, 3.446998112, 5.890667693, 11.75722561, 23.54428317, 55.43491614], - [13.0, 3.497500397, 5.991702643, 12.04338224, 24.34120734, 57.76787568] - ] + [13.0, 3.497500397, 5.991702643, 12.04338224, 24.34120734, 57.76787568], +] # SOLVER OPTIONS -op_threshold = 0. +op_threshold = 0.0 # RELIABILITY DATA -mission_time = 20 # in years -mttfreq = 0.5 # 50 % of the lifetime +mission_time = 20 # in years +mttfreq = 0.5 # 50 % of the lifetime -#moor_found_network = {"topology" : eval(open(os.path.join(reli_dir , +# moor_found_network = {"topology" : eval(open(os.path.join(reli_dir , # 'dummymoorhier.txt')).read()), # "nodes" : eval(open(os.path.join(reli_dir , # 'dummymoorbom.txt')).read())} -#electrical_network = {"topology" : eval(open(os.path.join(reli_dir , +# electrical_network = {"topology" : eval(open(os.path.join(reli_dir , # 'dummyelechier.txt')).read()), # "nodes" : eval(open(os.path.join(reli_dir , # 'dummyelecbom.txt')).read())} - -component_data_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(component_data_path, encoding = 'utf-8') + +component_data_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(component_data_path) elec_dict = compdict_from_mock(xls_file) compdict.update(elec_dict) @@ -706,158 +889,157 @@ comp_tables_rel = get_reliability_tables(compdict) - # LOAD VARIABLES test_data = { - "bathymetry.layers": strata, - "constants.line_bearing_capacity_factor": line_bcf, - "constants.pile_Am_moment_coefficient": pilemomcoefam, - "constants.pile_Bm_moment_coefficient": pilemomcoefbm, - "constants.pile_deflection_coefficients": piledefcoef, - "constants.pile_skin_friction_end_bearing_capacity": pilefricresnoncal, - "constants.soil_cohesionless_reaction_coefficient": subgradereaccoef, - "constants.soil_cohesive_reaction_coefficient": k1coeff, - "constants.soil_drained_holding_capacity_factor": hcfdrsoil, - "farm.soil_sensitivity": soilsen, - "constants.soilprops": soilprops, - "constants.gravity": gravity, - "constants.sea_water_density": seaden, - "constants.air_density": airden, - "constants.steel_density": steelden, - "constants.concrete_density": conden, - "constants.grout_density": groutden, - "constants.grout_compressive_strength": grout_strength, - "constants.cylinder_drag": dragcoefcyl, - "constants.cylinder_wake_amplificiation": wakeampfactorcyl, - "constants.rectangular_wind_drag": winddragcoefrect, - "constants.rectangular_current_drag": currentdragcoefrect, - "constants.rectangular_drift": driftcoeffloatrect, - "constants.rectangular_wave_inertia": waveinertiacoefrect, - "corridor.layers": export_strata, - "component.collection_points": collection_points, - "component.collection_point_cog": collection_point_cog, - "component.collection_point_foundations": collection_point_found, - "component.dry_mate_connectors": dry_mate_connectors, - "component.dynamic_cable": dynamic_cable, - "project.equipment_gradient_constraint": equipment_gradient_constraint, - "component.installation_soil_compatibility": installation_soil_compatibility, - "component.static_cable": static_cable, - "component.transformers": transformers, - "component.wet_mate_connectors": wet_mate_connectors, - "project.fabrication_cost": fab_cost, - "project.export_voltage": corridor_voltage, - "corridor.landing_point": landing_point, - "corridor.nogo_areas": corridor_nogo_areas, - "project.export_target_burial_depth": corridor_target_burial_depth, - "device.bidirection": bidirection, - "device.connector_type": connection, - "device.turbine_hub_height": turbine_hub_height, - "device.cut_in_velocity": cut_in, - "device.cut_out_velocity": cut_out, - "device.installation_depth_max": max_install, - "device.installation_depth_min": min_install, - "device.minimum_distance_x": min_dist_x, - "device.minimum_distance_y": min_dist_y, - "device.constant_power_factor": power_factor, - "device.power_rating": rated_power_device, - "device.prescribed_footprint_radius": footprint_radius, - "device.system_draft": device_draft, - "device.turbine_diameter": rotor_diam, - "device.turbine_interdistance": turbine_interdist, - "device.turbine_performance": tidal_performance, - "device.umbilical_connection_point": umbilical_connection, - "project.umbilical_safety_factor": umbilical_safety, - "device.voltage": device_voltage, - "device.yaw": yaw_angle, - "device.dry_beam_area": sys_dry_beam, - "device.dry_frontal_area": sys_dry_frontal, - "device.foundation_location": found_loc, - "project.foundation_safety_factor": found_safety, - "device.foundation_type": prefound, - "device.system_centre_of_gravity": sys_cog, - "device.system_displaced_volume": sys_vol, - "device.system_height": sys_height, - "device.system_length": sys_length, - "device.system_mass": sys_mass, - "device.system_profile": sys_prof, - "device.system_roughness": sys_rough, - "device.system_width": sys_width, - "device.wet_beam_area": sys_wet_beam, - "device.wet_frontal_area": sys_wet_frontal, - "farm.blockage_ratio": blockage_ratio, - "project.devices_per_string": devices_per_string, - "farm.direction_of_max_surface_current": max_10year_current_dir, - "project.main_direction": main_direction, - "farm.max_surface_current_10_year": max_10year_current, - "project.network_configuration": network_configuration, - "farm.nogo_areas": nogo_areas, - "project.onshore_infrastructure_cost": onshore_infrastructure_cost, -# "farm.power_law_exponent": power_law_exponent, - "project.rated_power": rated_array_power, - "farm.spec_gamma": spectrum_gamma_farm, - "project.target_burial_depth": target_burial_depth, - "project.tidal_occurrence_nbins": n_bins, - "farm.tidal_occurrence_point": tidal_point, - "farm.tidal_series": tidal_series_raw, - "farm.wave_direction_100_year": predominant_100year_wave_dir, - "farm.current_profile": current_profile, - "project.grout_strength_safety_factor": grout_safety, - "farm.max_gust_wind_direction_100_year": max_100_year_gust_dir, - "farm.max_gust_wind_speed_100_year": max_100_year_gust_speed, - "farm.max_hs_100_year": max_100year_hs, - "farm.max_tp_100_year": max_100year_tp, - "farm.max_water_level_50_year": max_50_year_water_level, - "farm.mean_wind_direction_100_year": mean_100_year_wind_dir, - "farm.mean_wind_speed_100_year": mean_100_year_wind_speed, - "farm.min_water_level_50_year": min_50_year_water_level, - "project.cost_of_concrete": cost_concrete, - "project.cost_of_grout": cost_grout, - "project.cost_of_steel": cost_steel, - "options.optimisation_threshold": op_threshold, - "options.user_array_layout": user_array_layout, - "options.user_array_option": user_array_option, - "site.lease_boundary": lease_area, - 'component.foundations_anchor': comp_tables["drag anchor"], - 'component.foundations_pile': comp_tables["pile"], - 'component.foundations_anchor_sand': comp_tables["drag anchor sand"], - 'component.foundations_anchor_soft': comp_tables["drag anchor soft"], - "project.lifetime" : mission_time, - "project.mttfreq" : mttfreq, - "component.moorings_chain_NCFR" : comp_tables_rel["chain NCFR"], - "component.moorings_chain_CFR" : comp_tables_rel["chain CFR"], - "component.moorings_forerunner_NCFR" :comp_tables_rel["forerunner NCFR"], - "component.moorings_forerunner_CFR" : comp_tables_rel["forerunner CFR"], - "component.moorings_shackle_NCFR" :comp_tables_rel["shackle NCFR"], - "component.moorings_shackle_CFR" : comp_tables_rel["shackle CFR"], - "component.moorings_swivel_NCFR" :comp_tables_rel["swivel NCFR"], - "component.moorings_swivel_CFR" : comp_tables_rel["swivel CFR"], - "component.foundations_anchor_NCFR" :comp_tables_rel["anchor NCFR"], - "component.foundations_anchor_CFR" : comp_tables_rel["anchor CFR"], - "component.foundations_pile_NCFR" :comp_tables_rel["pile NCFR"], - "component.foundations_pile_CFR" : comp_tables_rel["pile CFR"], - "component.moorings_rope_NCFR" :comp_tables_rel["rope NCFR"], - "component.moorings_rope_CFR" : comp_tables_rel["rope CFR"], - "component.static_cable_NCFR" :comp_tables_rel["static_cable NCFR"], - "component.static_cable_CFR" : comp_tables_rel["static_cable CFR"], - "component.dynamic_cable_NCFR" :comp_tables_rel["dynamic_cable NCFR"], - "component.dynamic_cable_CFR" : comp_tables_rel["dynamic_cable CFR"], - "component.wet_mate_connectors_NCFR" :comp_tables_rel["wet_mate NCFR"], - "component.wet_mate_connectors_CFR" : comp_tables_rel["wet_mate CFR"], - "component.dry_mate_connectors_NCFR" :comp_tables_rel["dry_mate NCFR"], - "component.dry_mate_connectors_CFR" : comp_tables_rel["dry_mate CFR"], - "component.transformers_NCFR" :comp_tables_rel["transformer NCFR"], - "component.transformers_CFR" : comp_tables_rel["transformer CFR"], - "component.collection_points_NCFR" :comp_tables_rel["collection_point NCFR"], - "component.collection_points_CFR" : comp_tables_rel["collection_point CFR"], - } - + "bathymetry.layers": strata, + "constants.line_bearing_capacity_factor": line_bcf, + "constants.pile_Am_moment_coefficient": pilemomcoefam, + "constants.pile_Bm_moment_coefficient": pilemomcoefbm, + "constants.pile_deflection_coefficients": piledefcoef, + "constants.pile_skin_friction_end_bearing_capacity": pilefricresnoncal, + "constants.soil_cohesionless_reaction_coefficient": subgradereaccoef, + "constants.soil_cohesive_reaction_coefficient": k1coeff, + "constants.soil_drained_holding_capacity_factor": hcfdrsoil, + "farm.soil_sensitivity": soilsen, + "constants.soilprops": soilprops, + "constants.gravity": gravity, + "constants.sea_water_density": seaden, + "constants.air_density": airden, + "constants.steel_density": steelden, + "constants.concrete_density": conden, + "constants.grout_density": groutden, + "constants.grout_compressive_strength": grout_strength, + "constants.cylinder_drag": dragcoefcyl, + "constants.cylinder_wake_amplificiation": wakeampfactorcyl, + "constants.rectangular_wind_drag": winddragcoefrect, + "constants.rectangular_current_drag": currentdragcoefrect, + "constants.rectangular_drift": driftcoeffloatrect, + "constants.rectangular_wave_inertia": waveinertiacoefrect, + "corridor.layers": export_strata, + "component.collection_points": collection_points, + "component.collection_point_cog": collection_point_cog, + "component.collection_point_foundations": collection_point_found, + "component.dry_mate_connectors": dry_mate_connectors, + "component.dynamic_cable": dynamic_cable, + "project.equipment_gradient_constraint": equipment_gradient_constraint, + "component.installation_soil_compatibility": installation_soil_compatibility, + "component.static_cable": static_cable, + "component.transformers": transformers, + "component.wet_mate_connectors": wet_mate_connectors, + "project.fabrication_cost": fab_cost, + "project.export_voltage": corridor_voltage, + "corridor.landing_point": landing_point, + "corridor.nogo_areas": corridor_nogo_areas, + "project.export_target_burial_depth": corridor_target_burial_depth, + "device.bidirection": bidirection, + "device.connector_type": connection, + "device.turbine_hub_height": turbine_hub_height, + "device.cut_in_velocity": cut_in, + "device.cut_out_velocity": cut_out, + "device.installation_depth_max": max_install, + "device.installation_depth_min": min_install, + "device.minimum_distance_x": min_dist_x, + "device.minimum_distance_y": min_dist_y, + "device.constant_power_factor": power_factor, + "device.power_rating": rated_power_device, + "device.prescribed_footprint_radius": footprint_radius, + "device.system_draft": device_draft, + "device.turbine_diameter": rotor_diam, + "device.turbine_interdistance": turbine_interdist, + "device.turbine_performance": tidal_performance, + "device.umbilical_connection_point": umbilical_connection, + "project.umbilical_safety_factor": umbilical_safety, + "device.voltage": device_voltage, + "device.yaw": yaw_angle, + "device.dry_beam_area": sys_dry_beam, + "device.dry_frontal_area": sys_dry_frontal, + "device.foundation_location": found_loc, + "project.foundation_safety_factor": found_safety, + "device.foundation_type": prefound, + "device.system_centre_of_gravity": sys_cog, + "device.system_displaced_volume": sys_vol, + "device.system_height": sys_height, + "device.system_length": sys_length, + "device.system_mass": sys_mass, + "device.system_profile": sys_prof, + "device.system_roughness": sys_rough, + "device.system_width": sys_width, + "device.wet_beam_area": sys_wet_beam, + "device.wet_frontal_area": sys_wet_frontal, + "farm.blockage_ratio": blockage_ratio, + "project.devices_per_string": devices_per_string, + "farm.direction_of_max_surface_current": max_10year_current_dir, + "project.main_direction": main_direction, + "farm.max_surface_current_10_year": max_10year_current, + "project.network_configuration": network_configuration, + "farm.nogo_areas": nogo_areas, + "project.onshore_infrastructure_cost": onshore_infrastructure_cost, + # "farm.power_law_exponent": power_law_exponent, + "project.rated_power": rated_array_power, + "farm.spec_gamma": spectrum_gamma_farm, + "project.target_burial_depth": target_burial_depth, + "project.tidal_occurrence_nbins": n_bins, + "farm.tidal_occurrence_point": tidal_point, + "farm.tidal_series": tidal_series_raw, + "farm.wave_direction_100_year": predominant_100year_wave_dir, + "farm.current_profile": current_profile, + "project.grout_strength_safety_factor": grout_safety, + "farm.max_gust_wind_direction_100_year": max_100_year_gust_dir, + "farm.max_gust_wind_speed_100_year": max_100_year_gust_speed, + "farm.max_hs_100_year": max_100year_hs, + "farm.max_tp_100_year": max_100year_tp, + "farm.max_water_level_50_year": max_50_year_water_level, + "farm.mean_wind_direction_100_year": mean_100_year_wind_dir, + "farm.mean_wind_speed_100_year": mean_100_year_wind_speed, + "farm.min_water_level_50_year": min_50_year_water_level, + "project.cost_of_concrete": cost_concrete, + "project.cost_of_grout": cost_grout, + "project.cost_of_steel": cost_steel, + "options.optimisation_threshold": op_threshold, + "options.user_array_layout": user_array_layout, + "options.user_array_option": user_array_option, + "site.lease_boundary": lease_area, + "component.foundations_anchor": comp_tables["drag anchor"], + "component.foundations_pile": comp_tables["pile"], + "component.foundations_anchor_sand": comp_tables["drag anchor sand"], + "component.foundations_anchor_soft": comp_tables["drag anchor soft"], + "project.lifetime": mission_time, + "project.mttfreq": mttfreq, + "component.moorings_chain_NCFR": comp_tables_rel["chain NCFR"], + "component.moorings_chain_CFR": comp_tables_rel["chain CFR"], + "component.moorings_forerunner_NCFR": comp_tables_rel["forerunner NCFR"], + "component.moorings_forerunner_CFR": comp_tables_rel["forerunner CFR"], + "component.moorings_shackle_NCFR": comp_tables_rel["shackle NCFR"], + "component.moorings_shackle_CFR": comp_tables_rel["shackle CFR"], + "component.moorings_swivel_NCFR": comp_tables_rel["swivel NCFR"], + "component.moorings_swivel_CFR": comp_tables_rel["swivel CFR"], + "component.foundations_anchor_NCFR": comp_tables_rel["anchor NCFR"], + "component.foundations_anchor_CFR": comp_tables_rel["anchor CFR"], + "component.foundations_pile_NCFR": comp_tables_rel["pile NCFR"], + "component.foundations_pile_CFR": comp_tables_rel["pile CFR"], + "component.moorings_rope_NCFR": comp_tables_rel["rope NCFR"], + "component.moorings_rope_CFR": comp_tables_rel["rope CFR"], + "component.static_cable_NCFR": comp_tables_rel["static_cable NCFR"], + "component.static_cable_CFR": comp_tables_rel["static_cable CFR"], + "component.dynamic_cable_NCFR": comp_tables_rel["dynamic_cable NCFR"], + "component.dynamic_cable_CFR": comp_tables_rel["dynamic_cable CFR"], + "component.wet_mate_connectors_NCFR": comp_tables_rel["wet_mate NCFR"], + "component.wet_mate_connectors_CFR": comp_tables_rel["wet_mate CFR"], + "component.dry_mate_connectors_NCFR": comp_tables_rel["dry_mate NCFR"], + "component.dry_mate_connectors_CFR": comp_tables_rel["dry_mate CFR"], + "component.transformers_NCFR": comp_tables_rel["transformer NCFR"], + "component.transformers_CFR": comp_tables_rel["transformer CFR"], + "component.collection_points_NCFR": comp_tables_rel[ + "collection_point NCFR" + ], + "component.collection_points_CFR": comp_tables_rel["collection_point CFR"], +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_scenario.py b/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_scenario.py index 0db0bbb..785dc2d 100644 --- a/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_scenario.py +++ b/packages/dtocean-core/example_data/fixed_tidal_fixed_layout_scenario.py @@ -6,17 +6,18 @@ """ import os -import datetime as dt -import utm import numpy as np import pandas as pd +import utm from scipy.stats import multivariate_normal, norm from shapely.geometry import Point from dtocean_core.utils.moorings import get_moorings_tables -from dtocean_core.utils.reliability import (get_reliability_tables, - compdict_from_mock) +from dtocean_core.utils.reliability import ( + compdict_from_mock, + get_reliability_tables, +) # Note that the electrical folder in the test_data directory should be # placed in the same folder as this file @@ -29,144 +30,157 @@ ### CONSTANTS -gravity = 9.80665 #gravity -seaden = 1025.0 #sea water density -airden = 1.226 #air density - -#cylinder drag coefficients -dragcoefcyl = [[0.0, 0.0, 1e-5, 1e-2], - [1e4, 1.2, 1.2, 1.15], - [2e4, 1.2, 1.2, 1.05], - [3e4, 1.2, 1.2, 0.87], - [4e4, 1.2, 1.15, 0.82], - [5e4, 1.2, 1.0, 0.8], - [6e4, 1.2, 0.9, 0.8], - [7e4, 1.2, 0.85, 0.83], - [8e4, 1.2, 0.7, 0.9], - [9e4, 1.2, 0.65, 0.94], - [1e5, 1.2, 0.6, 0.95], - [2e5, 1.2, 0.35, 1.02], - [3e5, 1.15, 0.3, 1.03], - [4e5, 0.95, 0.33, 1.05], - [5e5, 0.6, 0.35, 1.06], - [6e5, 0.35, 0.38, 1.07], - [7e5, 0.29, 0.4, 1.07], - [8e5, 0.31, 0.43, 1.08], - [9e5, 0.33, 0.45, 1.08], - [1e6, 0.35, 0.47, 1.08], - [2e6, 0.54, 0.53, 1.08], - [3e6, 0.62, 0.62, 1.08], - [4e6, 0.67, 0.67, 1.08]] - -#cylinder wake amplification factors -wakeampfactorcyl = [[0.0, 2.0, 2.0], - [5.0, 0.4, 0.8], - [10.0, 0.78, 1.3], - [15.0, 1.07, 1.4], - [20.0, 1.25, 1.25], - [25.0, 1.2, 1.2], - [30.0, 1.18, 1.18], - [35.0, 1.12, 1.12], - [40.0, 1.1, 1.1], - [45.0, 1.06, 1.06], - [50.0, 1.03, 1.03], - [55.0, 1.01, 1.01], - [60.0, 1.0, 1.0]] - -#rectangular section wind drag coefficients -winddragcoefrect = [[4.0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.6, 1.6], - [3.0, 1.1, 1.2, 1.25, 1.35, 1.4, 1.4, 1.4], - [2.0, 1.0, 1.05, 1.1, 1.15, 1.2, 1.2, 1.2], - [1.5, 0.95, 1.0, 1.05, 1.1, 1.15, 1.15, 1.15], - [1.0, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4], - [0.6667, 0.8, 0.85, 0.9, 0.95, 1.0, 1.0, 1.0], - [0.5, 0.75, 0.75, 0.8, 0.85, 0.9, 0.9, 0.9], - [0.3333, 0.7, 0.75, 0.75, 0.75, 0.8, 0.8, 0.8], - [0.25, 0.7, 0.7, 0.75, 0.75, 0.75, 0.75, 0.75]] - -#rectangular section current drag coefficients -currentdragcoefrect = [[10.0000, 1.88], - [5.0000, 1.95], - [3.3333, 2.06], - [2.5000, 2.24], - [2.0000, 2.39], - [1.6667, 2.6], - [1.4286, 2.73], - [1.2500, 2.5], - [1.1111, 2.31], - [1.0000, 2.19], - [0.9091, 2.06], - [0.8333, 1.95], - [0.7692, 1.87], - [0.7143, 1.8], - [0.6667, 1.73], - [0.6250, 1.67], - [0.5882, 1.63], - [0.5556, 1.58], - [0.5263, 1.52], - [0.5000, 1.49], - [0.4762, 1.46], - [0.4545, 1.44], - [0.4348, 1.41], - [0.4167, 1.37], - [0.4000, 1.35], - [0.3846, 1.32], - [0.3704, 1.29], - [0.3571, 1.26], - [0.3448, 1.25], - [0.3333, 1.23], - [0.3226, 1.21], - [0.3125, 1.2], - [0.3030, 1.19], - [0.2941, 1.18], - [0.2857, 1.16], - [0.2778, 1.15], - [0.2703, 1.15], - [0.2632, 1.15], - [0.2564, 1.15], - [0.2500, 1.15]] - -#rectangular section wave drift coefficients -driftcoeffloatrect = [[0.0, 0.0], - [0.1, 0.02], - [0.2, 0.06], - [0.3, 0.15], - [0.4, 0.28], - [0.5, 0.44], - [0.6, 0.60], - [0.7, 0.74], - [0.8, 0.84], - [0.9, 0.91], - [1.0, 0.94], - [1.1, 0.97], - [1.2, 0.98], - [1.3, 0.99], - [1.4, 1.0], - [1.5, 1.0]] - -#rectangular section wave inertia coefficients -waveinertiacoefrect = [[10.0, 2.23], - [5.0, 1.98], - [2.0, 1.7], - [1.0, 1.51], - [0.5, 1.36], - [0.2, 1.21], - [0.1, 1.14]] +gravity = 9.80665 # gravity +seaden = 1025.0 # sea water density +airden = 1.226 # air density + +# cylinder drag coefficients +dragcoefcyl = [ + [0.0, 0.0, 1e-5, 1e-2], + [1e4, 1.2, 1.2, 1.15], + [2e4, 1.2, 1.2, 1.05], + [3e4, 1.2, 1.2, 0.87], + [4e4, 1.2, 1.15, 0.82], + [5e4, 1.2, 1.0, 0.8], + [6e4, 1.2, 0.9, 0.8], + [7e4, 1.2, 0.85, 0.83], + [8e4, 1.2, 0.7, 0.9], + [9e4, 1.2, 0.65, 0.94], + [1e5, 1.2, 0.6, 0.95], + [2e5, 1.2, 0.35, 1.02], + [3e5, 1.15, 0.3, 1.03], + [4e5, 0.95, 0.33, 1.05], + [5e5, 0.6, 0.35, 1.06], + [6e5, 0.35, 0.38, 1.07], + [7e5, 0.29, 0.4, 1.07], + [8e5, 0.31, 0.43, 1.08], + [9e5, 0.33, 0.45, 1.08], + [1e6, 0.35, 0.47, 1.08], + [2e6, 0.54, 0.53, 1.08], + [3e6, 0.62, 0.62, 1.08], + [4e6, 0.67, 0.67, 1.08], +] + +# cylinder wake amplification factors +wakeampfactorcyl = [ + [0.0, 2.0, 2.0], + [5.0, 0.4, 0.8], + [10.0, 0.78, 1.3], + [15.0, 1.07, 1.4], + [20.0, 1.25, 1.25], + [25.0, 1.2, 1.2], + [30.0, 1.18, 1.18], + [35.0, 1.12, 1.12], + [40.0, 1.1, 1.1], + [45.0, 1.06, 1.06], + [50.0, 1.03, 1.03], + [55.0, 1.01, 1.01], + [60.0, 1.0, 1.0], +] + +# rectangular section wind drag coefficients +winddragcoefrect = [ + [4.0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.6, 1.6], + [3.0, 1.1, 1.2, 1.25, 1.35, 1.4, 1.4, 1.4], + [2.0, 1.0, 1.05, 1.1, 1.15, 1.2, 1.2, 1.2], + [1.5, 0.95, 1.0, 1.05, 1.1, 1.15, 1.15, 1.15], + [1.0, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4], + [0.6667, 0.8, 0.85, 0.9, 0.95, 1.0, 1.0, 1.0], + [0.5, 0.75, 0.75, 0.8, 0.85, 0.9, 0.9, 0.9], + [0.3333, 0.7, 0.75, 0.75, 0.75, 0.8, 0.8, 0.8], + [0.25, 0.7, 0.7, 0.75, 0.75, 0.75, 0.75, 0.75], +] + +# rectangular section current drag coefficients +currentdragcoefrect = [ + [10.0000, 1.88], + [5.0000, 1.95], + [3.3333, 2.06], + [2.5000, 2.24], + [2.0000, 2.39], + [1.6667, 2.6], + [1.4286, 2.73], + [1.2500, 2.5], + [1.1111, 2.31], + [1.0000, 2.19], + [0.9091, 2.06], + [0.8333, 1.95], + [0.7692, 1.87], + [0.7143, 1.8], + [0.6667, 1.73], + [0.6250, 1.67], + [0.5882, 1.63], + [0.5556, 1.58], + [0.5263, 1.52], + [0.5000, 1.49], + [0.4762, 1.46], + [0.4545, 1.44], + [0.4348, 1.41], + [0.4167, 1.37], + [0.4000, 1.35], + [0.3846, 1.32], + [0.3704, 1.29], + [0.3571, 1.26], + [0.3448, 1.25], + [0.3333, 1.23], + [0.3226, 1.21], + [0.3125, 1.2], + [0.3030, 1.19], + [0.2941, 1.18], + [0.2857, 1.16], + [0.2778, 1.15], + [0.2703, 1.15], + [0.2632, 1.15], + [0.2564, 1.15], + [0.2500, 1.15], +] + +# rectangular section wave drift coefficients +driftcoeffloatrect = [ + [0.0, 0.0], + [0.1, 0.02], + [0.2, 0.06], + [0.3, 0.15], + [0.4, 0.28], + [0.5, 0.44], + [0.6, 0.60], + [0.7, 0.74], + [0.8, 0.84], + [0.9, 0.91], + [1.0, 0.94], + [1.1, 0.97], + [1.2, 0.98], + [1.3, 0.99], + [1.4, 1.0], + [1.5, 1.0], +] + +# rectangular section wave inertia coefficients +waveinertiacoefrect = [ + [10.0, 2.23], + [5.0, 1.98], + [2.0, 1.7], + [1.0, 1.51], + [0.5, 1.36], + [0.2, 1.21], + [0.1, 1.14], +] ### LEASE AREA # Projection and extent -lease_utm_zone = \ +lease_utm_zone = ( "+proj=utm +zone=30 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" +) -startx = 101000. -endx = 102000. -dx = 10. +startx = 101000.0 +endx = 102000.0 +dx = 10.0 numx = int(float(endx - startx) / dx) + 1 -starty = 0. -endy = 2500. -dy = 10. +starty = 0.0 +endy = 2500.0 +dy = 10.0 numy = int(float(endy - starty) / dy) + 1 x = np.linspace(startx, endx, numx) @@ -175,65 +189,63 @@ ny = len(y) # Bathymetry -X, Y = np.meshgrid(x,y) -Z = np.zeros(X.shape) - 50. +X, Y = np.meshgrid(x, y) +Z = np.zeros(X.shape) - 50.0 depths = Z.T[:, :, np.newaxis] -sediments = np.chararray((nx,ny,1), itemsize=20) +sediments = np.chararray((nx, ny, 1), itemsize=20) sediments[:] = "loose sand" - -strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} + +strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} # Soil characteristics -max_temp = 10. -max_soil_res = 10. +max_temp = 10.0 +max_soil_res = 10.0 target_burial_depth = 10 # Polygons -lease_area = [(startx, starty), - (endx, starty), - (endx, endy), - (startx, endy)] - -#nogo_areas = [np.array([[50., 50.],[60., 50.],[60., 60.],[50., 60.]])] +lease_area = [(startx, starty), (endx, starty), (endx, endy), (startx, endy)] + +# nogo_areas = [np.array([[50., 50.],[60., 50.],[60., 60.],[50., 60.]])] nogo_areas = None - + # Tidal time series n_bins = 6 time_points = 48 t = np.linspace(0, 1, time_points) rv = norm() -time_sin = np.sin(np.linspace(0, 4*np.pi, time_points)) -time_scaled = time_sin * (1. / np.amax(time_sin)) +time_sin = np.sin(np.linspace(0, 4 * np.pi, time_points)) +time_scaled = time_sin * (1.0 / np.amax(time_sin)) -xgrid, ygrid = np.meshgrid(x,y) +xgrid, ygrid = np.meshgrid(x, y) pos = np.dstack((xgrid, ygrid)) -rv = multivariate_normal([500., 150.], [[max(x)*5., max(y)*2.], - [max(y)*2., max(x)*5.]]) +rv = multivariate_normal( + [500.0, 150.0], [[max(x) * 5.0, max(y) * 2.0], [max(y) * 2.0, max(x) * 5.0]] +) -u_max = 0. -v_max = 6. -ssh_max = 1. +u_max = 0.0 +v_max = 6.0 +ssh_max = 1.0 TI = 0.1 grid_pdf = rv.pdf(pos).T -#u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) +# u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) u_scaled = np.ones((nx, ny)) * u_max v_scaled = np.ones((nx, ny)) * v_max ssh_scaled = np.ones((nx, ny)) * ssh_max -#ssh_scaled = grid_pdf * (ssh_max / np.amax(grid_pdf)) +# ssh_scaled = grid_pdf * (ssh_max / np.amax(grid_pdf)) u_arrays = [] v_arrays = [] ssh_arrays = [] for multiplier in time_scaled: - u_arrays.append(np.abs(u_scaled * multiplier)) v_arrays.append(np.abs(v_scaled * multiplier)) ssh_arrays.append(ssh_scaled * multiplier) @@ -243,30 +255,29 @@ SSH = np.dstack(ssh_arrays) TI = np.ones(SSH.shape) * TI -tidal_series_raw = {"values": {"U": U, - "V": V, - "SSH": SSH, - "TI": TI}, - "coords": [x, y, t]} - -xc = x[int(nx/2)] -yc = y[int(ny/2)] +tidal_series_raw = { + "values": {"U": U, "V": V, "SSH": SSH, "TI": TI}, + "coords": [x, y, t], +} + +xc = x[int(nx / 2)] +yc = y[int(ny / 2)] tidal_point = (xc, yc) # Tidal flow characteristics (hydro) -power_law_exponent = np.array([7.]) -blockage_ratio = 1. +power_law_exponent = np.array([7.0]) +blockage_ratio = 1.0 # Tidal flow characteristics (moorings) -max_10year_current = 6. -max_10year_current_dir = 0. -current_profile = "1/7 Power Law" #current profile alternatives: "Uniform" - # "1/7 Power Law" +max_10year_current = 6.0 +max_10year_current_dir = 0.0 +current_profile = "1/7 Power Law" # current profile alternatives: "Uniform" +# "1/7 Power Law" # Wave characterists -predominant_100year_wave_dir = 0. +predominant_100year_wave_dir = 0.0 max_100year_hs = 0.5 -max_100year_tp = 10. +max_100year_tp = 10.0 spectrum_gamma_farm = 3.3 # Wind characteristics @@ -276,47 +287,49 @@ max_100_year_gust_dir = 0.0 # Water level characterists -max_50_year_water_level = 5.0 #water level maximum offset -min_50_year_water_level = 0.0 #water level minimum offset - +max_50_year_water_level = 5.0 # water level maximum offset +min_50_year_water_level = 0.0 # water level minimum offset + # Logistics entry_point = (102000.0, 1250.0) # Long Term Metocean Data -file_path = os.path.join(inst_dir, 'inputs_user.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') -metocean = xls_file.parse('metocean', index_col = 0) +file_path = os.path.join(inst_dir, "inputs_user.xlsx") +xls_file = pd.ExcelFile(file_path) +metocean = xls_file.parse("metocean", index_col=0) fmtStr = "%Y-%m-%d %H:%M:%S.%f" -datetime_index_dict = {'year': metocean['year'], - 'month': metocean['month'], - 'day' : metocean['day'], - 'hour' : metocean['hour']} - -wave_series = metocean.loc[:, ['Hs', 'Tp']] -wave_series['DateTime'] = pd.to_datetime(datetime_index_dict, format = fmtStr) -#wave_series = wave_series.set_index(["DateTime"]) - -tidal_series = metocean.loc[:, ['Cs']] -tidal_series['DateTime'] = pd.to_datetime(datetime_index_dict, format =fmtStr) +datetime_index_dict = { + "year": metocean["year"], + "month": metocean["month"], + "day": metocean["day"], + "hour": metocean["hour"], +} + +wave_series = metocean.loc[:, ["Hs", "Tp"]] +wave_series["DateTime"] = pd.to_datetime(datetime_index_dict, format=fmtStr) +# wave_series = wave_series.set_index(["DateTime"]) + +tidal_series = metocean.loc[:, ["Cs"]] +tidal_series["DateTime"] = pd.to_datetime(datetime_index_dict, format=fmtStr) tidal_series = tidal_series.set_index(["DateTime"]) tidal_series = tidal_series.to_records(convert_datetime64=True) -wind_series = metocean.loc[:, ['Ws']] -wind_series['DateTime'] = pd.to_datetime(datetime_index_dict, format = fmtStr) +wind_series = metocean.loc[:, ["Ws"]] +wind_series["DateTime"] = pd.to_datetime(datetime_index_dict, format=fmtStr) wind_series = wind_series.set_index(["DateTime"]) wind_series = wind_series.to_records(convert_datetime64=True) - + ### CABLE CORRIDOR -startx = 100000. -endx = 101000. -dx = 10. +startx = 100000.0 +endx = 101000.0 +dx = 10.0 numx = int(float(endx - startx) / dx) -starty = 1000. -endy = 1500. -dy = 10. +starty = 1000.0 +endy = 1500.0 +dy = 10.0 numy = int(float(endy - starty) / dy) + 1 x = np.linspace(startx, endx, numx) @@ -325,143 +338,312 @@ ny = len(y) # Bathymetry -X, Y = np.meshgrid(x,y) -Z = np.zeros(X.shape) - 50. +X, Y = np.meshgrid(x, y) +Z = np.zeros(X.shape) - 50.0 depths = Z.T[:, :, np.newaxis] -sediments = np.chararray((nx,ny,1), itemsize=20) +sediments = np.chararray((nx, ny, 1), itemsize=20) sediments[:] = "loose sand" - -export_strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} -# Soil characteristics -corridor_max_temp = 10. -corridor_max_soil_res = 10. -corridor_target_burial_depth = 20. +export_strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} + +# Soil characteristics +corridor_max_temp = 10.0 +corridor_max_soil_res = 10.0 +corridor_target_burial_depth = 20.0 # Polygons corridor_nogo_areas = None # Tidal flow characteristics -corridor_10year_current = 6. -corridor_10year_current_dir = 0. +corridor_10year_current = 6.0 +corridor_10year_current_dir = 0.0 # Wave characterists -corridor_100year_wave_dir = 0. - -# Logistics +corridor_100year_wave_dir = 0.0 + +# Logistics landfall_contruction_technique = "Open Cut Trenching" - + ### SHORELINE - -landing_point = (100000., 1250.) -onshore_infrastructure_cost = 1000000. - - + +landing_point = (100000.0, 1250.0) +onshore_infrastructure_cost = 1000000.0 + + ### MACHINE -X = np.array([ 0. , 0.1010101 , 0.2020202 , 0.3030303 , - 0.4040404 , 0.50505051, 0.60606061, 0.70707071, - 0.80808081, 0.90909091, 1.01010101, 1.11111111, - 1.21212121, 1.31313131, 1.41414141, 1.51515152, - 1.61616162, 1.71717172, 1.81818182, 1.91919192, - 2.02020202, 2.12121212, 2.22222222, 2.32323232, - 2.42424242, 2.52525253, 2.62626263, 2.72727273, - 2.82828283, 2.92929293, 3.03030303, 3.13131313, - 3.23232323, 3.33333333, 3.43434343, 3.53535354, - 3.63636364, 3.73737374, 3.83838384, 3.93939394, - 4.04040404, 4.14141414, 4.24242424, 4.34343434, - 4.44444444, 4.54545455, 4.64646465, 4.74747475, - 4.84848485, 4.94949495, 5.05050505, 5.15151515, - 5.25252525, 5.35353535, 5.45454545, 5.55555556, - 5.65656566, 5.75757576, 5.85858586, 5.95959596, - 6.06060606, 6.16161616, 6.26262626, 6.36363636, - 6.46464646, 6.56565657, 6.66666667, 6.76767677, - 6.86868687, 6.96969697, 7.07070707, 7.17171717, - 7.27272727, 7.37373737, 7.47474747, 7.57575758, - 7.67676768, 7.77777778, 7.87878788, 7.97979798, - 8.08080808, 8.18181818, 8.28282828, 8.38383838, - 8.48484848, 8.58585859, 8.68686869, 8.78787879, - 8.88888889, 8.98989899, 9.09090909, 9.19191919, - 9.29292929, 9.39393939, 9.49494949, 9.5959596 , - 9.6969697 , 9.7979798 , 9.8989899 , 10. ]) - -Cp = np.array([ 0. , 0. , 0. , 0. , 0. , - 0. , 0. , 0. , 0. , 0. , - 0.00248182, 0.0273 , 0.05211818, 0.07693636, 0.10175455, - 0.12657273, 0.15139091, 0.17620909, 0.20102727, 0.22584545, - 0.25066364, 0.27548182, 0.3003 , 0.32511818, 0.34993636, - 0.37475455, 0.39957273, 0.42439091, 0.44920909, 0.47402727, - 0.49884545, 0.52366364, 0.54848182, 0.5733 , 0.59811818, - 0.62293636, 0.64775455, 0.67257273, 0.69739091, 0.72220909, - 0.74702727, 0.77184545, 0.79666364, 0.82148182, 0.8463 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 - ]) - -Ct = 0.4*np.ones((100)) +X = np.array( + [ + 0.0, + 0.1010101, + 0.2020202, + 0.3030303, + 0.4040404, + 0.50505051, + 0.60606061, + 0.70707071, + 0.80808081, + 0.90909091, + 1.01010101, + 1.11111111, + 1.21212121, + 1.31313131, + 1.41414141, + 1.51515152, + 1.61616162, + 1.71717172, + 1.81818182, + 1.91919192, + 2.02020202, + 2.12121212, + 2.22222222, + 2.32323232, + 2.42424242, + 2.52525253, + 2.62626263, + 2.72727273, + 2.82828283, + 2.92929293, + 3.03030303, + 3.13131313, + 3.23232323, + 3.33333333, + 3.43434343, + 3.53535354, + 3.63636364, + 3.73737374, + 3.83838384, + 3.93939394, + 4.04040404, + 4.14141414, + 4.24242424, + 4.34343434, + 4.44444444, + 4.54545455, + 4.64646465, + 4.74747475, + 4.84848485, + 4.94949495, + 5.05050505, + 5.15151515, + 5.25252525, + 5.35353535, + 5.45454545, + 5.55555556, + 5.65656566, + 5.75757576, + 5.85858586, + 5.95959596, + 6.06060606, + 6.16161616, + 6.26262626, + 6.36363636, + 6.46464646, + 6.56565657, + 6.66666667, + 6.76767677, + 6.86868687, + 6.96969697, + 7.07070707, + 7.17171717, + 7.27272727, + 7.37373737, + 7.47474747, + 7.57575758, + 7.67676768, + 7.77777778, + 7.87878788, + 7.97979798, + 8.08080808, + 8.18181818, + 8.28282828, + 8.38383838, + 8.48484848, + 8.58585859, + 8.68686869, + 8.78787879, + 8.88888889, + 8.98989899, + 9.09090909, + 9.19191919, + 9.29292929, + 9.39393939, + 9.49494949, + 9.5959596, + 9.6969697, + 9.7979798, + 9.8989899, + 10.0, + ] +) + +Cp = np.array( + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.00248182, + 0.0273, + 0.05211818, + 0.07693636, + 0.10175455, + 0.12657273, + 0.15139091, + 0.17620909, + 0.20102727, + 0.22584545, + 0.25066364, + 0.27548182, + 0.3003, + 0.32511818, + 0.34993636, + 0.37475455, + 0.39957273, + 0.42439091, + 0.44920909, + 0.47402727, + 0.49884545, + 0.52366364, + 0.54848182, + 0.5733, + 0.59811818, + 0.62293636, + 0.64775455, + 0.67257273, + 0.69739091, + 0.72220909, + 0.74702727, + 0.77184545, + 0.79666364, + 0.82148182, + 0.8463, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + ] +) -# Performance curves are matched to the same veloity abscissae -tidal_performance = {"Velocity": X, - "Coefficient of Power": Cp, - "Coefficient of Thrust": Ct} +Ct = 0.4 * np.ones((100)) -# Device characterists -turbine_hub_height = 20. -rotor_diam = 18. +# Performance curves are matched to the same veloity abscissae +tidal_performance = { + "Velocity": X, + "Coefficient of Power": Cp, + "Coefficient of Thrust": Ct, +} + +# Device characterists +turbine_hub_height = 20.0 +rotor_diam = 18.0 turbine_interdist = None min_install = -np.inf -max_install = -40. -min_dist_x = 40. -min_dist_y = 40. +max_install = -40.0 +min_dist_x = 40.0 +min_dist_y = 40.0 bidirection = True rated_power_device = 1.25 -device_voltage = 11000. -yaw_angle = 0. -cut_in = 1. -cut_out = 4. -connection = 'Wet-Mate' -footprint_radius = 20. +device_voltage = 11000.0 +yaw_angle = 0.0 +cut_in = 1.0 +cut_out = 4.0 +connection = "Wet-Mate" +footprint_radius = 20.0 device_draft = None umbilical_connection = None umbilical_safety = None power_factor = 0.98 - -sys_prof = "Cylindrical" #device profile options: "Cylindrical" "Rectangular" -sys_mass = 300.0e3 #device mass -sys_cog = [0.0, 0.0, 15.0] #device centre of gravity -sys_vol = 148.44 #device displaced volume -sys_height = 21.0 #device height -sys_width = 3.0 #device width -sys_length = 3.0 #device length -sys_dry_frontal = 0.0 #device dry frontal area -sys_dry_beam = 0.0 #device dry beam area -sys_wet_frontal = 63.0 #device wet frontal area -sys_wet_beam = 63.0 #device wet beam area -sys_rough = 0.9e-2 #device surface roughness - -#predefined foundation type: Shallow, Gravity, Pile, Suction Caisson, - # Direct Embedment, Drag -prefound = None - -#foundation locations (from device origin) -found_loc = np.array([[-10.0, -10.0, 0.0], - [-10.0, 10.0, 0.0], - [ 10.0, 10.0, 0.0], - [ 10.0, -10.0, 0.0]]) + +sys_prof = "Cylindrical" # device profile options: "Cylindrical" "Rectangular" +sys_mass = 300.0e3 # device mass +sys_cog = [0.0, 0.0, 15.0] # device centre of gravity +sys_vol = 148.44 # device displaced volume +sys_height = 21.0 # device height +sys_width = 3.0 # device width +sys_length = 3.0 # device length +sys_dry_frontal = 0.0 # device dry frontal area +sys_dry_beam = 0.0 # device dry beam area +sys_wet_frontal = 63.0 # device wet frontal area +sys_wet_beam = 63.0 # device wet beam area +sys_rough = 0.9e-2 # device surface roughness + +# predefined foundation type: Shallow, Gravity, Pile, Suction Caisson, +# Direct Embedment, Drag +prefound = None + +# foundation locations (from device origin) +found_loc = np.array( + [ + [-10.0, -10.0, 0.0], + [-10.0, 10.0, 0.0], + [10.0, 10.0, 0.0], + [10.0, -10.0, 0.0], + ] +) # Installation details assembly_duration = 12 @@ -472,52 +654,62 @@ disconnect_duration = 1 installation_limit_Hs = 1.5 -installation_limit_Tp = 10. -installation_limit_Ws = 20. -installation_limit_Cs = 1. +installation_limit_Tp = 10.0 +installation_limit_Ws = 20.0 +installation_limit_Cs = 1.0 -device_failure_rates = {'Prime Mover': 0.5, - 'PTO': 0.25, - 'Control': 0.1, - 'Support Structure': 0.05} +device_failure_rates = { + "Prime Mover": 0.5, + "PTO": 0.25, + "Control": 0.1, + "Support Structure": 0.05, +} book_path = os.path.join(op_dir, "device_requirements.xlsx") device_onsite_requirements = pd.read_excel(book_path, sheet_name="On-Site") -device_replacement_requirements = pd.read_excel(book_path, - sheet_name="Replacement") -device_inspections_requirements = pd.read_excel(book_path, - sheet_name="Inspections") +device_replacement_requirements = pd.read_excel( + book_path, sheet_name="Replacement" +) +device_inspections_requirements = pd.read_excel( + book_path, sheet_name="Inspections" +) book_path = os.path.join(op_dir, "device_parts.xlsx") device_onsite_parts = pd.read_excel(book_path, sheet_name="On-Site") device_replacement_parts = pd.read_excel(book_path, sheet_name="Replacement") -device_lead_times = {'Prime Mover': 120., - 'PTO': 96., - 'Control': 48., - 'Support Structure': 48.} - -device_costs = {'Prime Mover': 200000., - 'PTO': 150000., - 'Control': 10000., - 'Support Structure': 30000.} +device_lead_times = { + "Prime Mover": 120.0, + "PTO": 96.0, + "Control": 48.0, + "Support Structure": 48.0, +} + +device_costs = { + "Prime Mover": 200000.0, + "PTO": 150000.0, + "Control": 10000.0, + "Support Structure": 30000.0, +} ### SUB-SYSTEMS -file_path = os.path.join(inst_dir, 'inputs_user.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') -sub_device = xls_file.parse('sub_device') - +file_path = os.path.join(inst_dir, "inputs_user.xlsx") +xls_file = pd.ExcelFile(file_path) +sub_device = xls_file.parse("sub_device") + ### ARRAY LAYOUT -user_array_option = 'User Defined Fixed' +user_array_option = "User Defined Fixed" + +pos = [ + (101250.0, 500.0), + (101750.0, 500.0), + (101500.0, 1250.0), + (101250.0, 2000.0), + (101750, 2000.0), +] -pos = [(101250., 500.), - (101750., 500.), - (101500., 1250.), - (101250., 2000.), - (101750, 2000.)] - user_array_layout = np.array(pos) main_direction = None @@ -531,48 +723,52 @@ network_configuration = "Star" min_voltage = 0.9 max_voltage = 1.0 - + book_path = os.path.join(op_dir, "electrical_requirements.xlsx") electrical_onsite_requirements = pd.read_excel(book_path, sheet_name="On-Site") -electrical_inspections_requirements = pd.read_excel(book_path, - sheet_name="Inspections") +electrical_inspections_requirements = pd.read_excel( + book_path, sheet_name="Inspections" +) book_path = os.path.join(op_dir, "electrical_parts.xlsx") electrical_onsite_parts = pd.read_excel(book_path, sheet_name="On-Site") -electrical_lead_times = {'Inter-Array Cables': 48., - 'Substations': 120., - 'Export Cable': 240.} +electrical_lead_times = { + "Inter-Array Cables": 48.0, + "Substations": 120.0, + "Export Cable": 240.0, +} # Corridor -corridor_voltage = 33000. +corridor_voltage = 33000.0 ### FOUNDATIONS -found_safety = 1.5 #foundation safety factor -grout_safety = 6.0 #grout safety factor -fab_cost = None # 1.0 #optional fabrication cost factor - +found_safety = 1.5 # foundation safety factor +grout_safety = 6.0 # grout safety factor +fab_cost = None # 1.0 #optional fabrication cost factor + book_path = os.path.join(op_dir, "moorings_requirements.xlsx") moorings_onsite_requirements = pd.read_excel(book_path, sheet_name="On-Site") -moorings_inspections_requirements = pd.read_excel(book_path, - sheet_name="Inspections") +moorings_inspections_requirements = pd.read_excel( + book_path, sheet_name="Inspections" +) book_path = os.path.join(op_dir, "moorings_parts.xlsx") moorings_onsite_parts = pd.read_excel(book_path, sheet_name="On-Site") -moorings_lead_times = {"Foundations": 48.} +moorings_lead_times = {"Foundations": 48.0} ### LOGISTICS # Equipment -file_path = os.path.join(inst_dir, 'logisticsDB_equipment_python.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +file_path = os.path.join(inst_dir, "logisticsDB_equipment_python.xlsx") +xls_file = pd.ExcelFile(file_path) sheet_names = xls_file.sheet_names -equipment_rov= xls_file.parse(sheet_names[0]) +equipment_rov = xls_file.parse(sheet_names[0]) equipment_divers = xls_file.parse(sheet_names[1]) equipment_cable_burial = xls_file.parse(sheet_names[2]) equipment_excavating = xls_file.parse(sheet_names[3]) @@ -584,8 +780,8 @@ equipment_vibro_driver = xls_file.parse(sheet_names[9]) # Ports -file_path = os.path.join(inst_dir, 'logisticsDB_ports_python.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +file_path = os.path.join(inst_dir, "logisticsDB_ports_python.xlsx") +xls_file = pd.ExcelFile(file_path) ports = xls_file.parse() port_names = ports["Name"] @@ -596,18 +792,17 @@ port_points = [] for x, y, zone_str in zip(port_x, port_y, port_utm): - zone_number_str, zone_letter = zone_str.split() lat, lon = utm.to_latlon(x, y, int(zone_number_str), zone_letter) point = Point(lon, lat) port_points.append(point) - + port_locations = {name: point for name, point in zip(port_names, port_points)} ### VESSELS -file_path = os.path.join(inst_dir, 'logisticsDB_vessel_python.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +file_path = os.path.join(inst_dir, "logisticsDB_vessel_python.xlsx") +xls_file = pd.ExcelFile(file_path) helicopter_df = xls_file.parse(sheet_name="Helicopter") ahts_df = xls_file.parse(sheet_name="AHTS") multicat_df = xls_file.parse(sheet_name="Multicat") @@ -634,105 +829,114 @@ calendar_based_maintenance = True condition_based_maintenance = False - -calendar_maintenance_interval = {'Prime Mover': 5., - 'PTO': 1., - 'Control': 5., - 'Support Structure': 10., - 'Umbilical Cable': 10., - 'Inter-Array Cables': np.nan, - 'Substations': 10., - 'Export Cable': 10., - 'Foundations': 10., - 'Mooring Lines': 10.} - -condition_maintenance_soh = {'Prime Mover': 50., - 'PTO': 50., - 'Control': 50., - 'Support Structure': np.nan, - 'Umbilical Cable': 50., - 'Inter-Array Cables': np.nan, - 'Substations': 50., - 'Export Cable': 50., - 'Foundations': 50., - 'Mooring Lines': 50.} - -condition_maintenance_cost = {'Prime Mover': 30000., - 'PTO': 20000., - 'Control': 0., - 'Support Structure': 15000., - 'Umbilical Cable': np.nan, - 'Inter-Array Cables': 0., - 'Substations': 0., - 'Export Cable': 0., - 'Foundations': 15000., - 'Mooring Lines': np.nan} - + +calendar_maintenance_interval = { + "Prime Mover": 5.0, + "PTO": 1.0, + "Control": 5.0, + "Support Structure": 10.0, + "Umbilical Cable": 10.0, + "Inter-Array Cables": np.nan, + "Substations": 10.0, + "Export Cable": 10.0, + "Foundations": 10.0, + "Mooring Lines": 10.0, +} + +condition_maintenance_soh = { + "Prime Mover": 50.0, + "PTO": 50.0, + "Control": 50.0, + "Support Structure": np.nan, + "Umbilical Cable": 50.0, + "Inter-Array Cables": np.nan, + "Substations": 50.0, + "Export Cable": 50.0, + "Foundations": 50.0, + "Mooring Lines": 50.0, +} + +condition_maintenance_cost = { + "Prime Mover": 30000.0, + "PTO": 20000.0, + "Control": 0.0, + "Support Structure": 15000.0, + "Umbilical Cable": np.nan, + "Inter-Array Cables": 0.0, + "Substations": 0.0, + "Export Cable": 0.0, + "Foundations": 15000.0, + "Mooring Lines": np.nan, +} + ### OPERATION TYPE SELECTIONS - -operations_onsite_maintenance = {'Prime Mover': True, - 'PTO': True, - 'Control': True, - 'Support Structure': True, - 'Umbilical Cable': True, - 'Inter-Array Cables': True, - 'Substations': True, - 'Export Cable': True, - 'Foundations': True, - 'Mooring Lines': True} - -operations_replacements = {'Prime Mover': True, - 'PTO': True, - 'Control': True, - 'Support Structure': True, - 'Umbilical Cable': True, - 'Mooring Lines': True} - -operations_inspections = {'Prime Mover': True, - 'PTO': True, - 'Control': True, - 'Support Structure': True, - 'Umbilical Cable': True, - 'Inter-Array Cables': True, - 'Substations': True, - 'Export Cable': True, - 'Foundations': True, - 'Mooring Lines': True} - + +operations_onsite_maintenance = { + "Prime Mover": True, + "PTO": True, + "Control": True, + "Support Structure": True, + "Umbilical Cable": True, + "Inter-Array Cables": True, + "Substations": True, + "Export Cable": True, + "Foundations": True, + "Mooring Lines": True, +} + +operations_replacements = { + "Prime Mover": True, + "PTO": True, + "Control": True, + "Support Structure": True, + "Umbilical Cable": True, + "Mooring Lines": True, +} + +operations_inspections = { + "Prime Mover": True, + "PTO": True, + "Control": True, + "Support Structure": True, + "Umbilical Cable": True, + "Inter-Array Cables": True, + "Substations": True, + "Export Cable": True, + "Foundations": True, + "Mooring Lines": True, +} + ### OPERATION WEIGHTINGS -full_weightings = {'On-Site Maintenance': 4, - 'Replacement': 4, - 'Inspections': 2} - -site_weightings = {'On-Site Maintenance': 4, - 'Inspections': 2} - - +full_weightings = {"On-Site Maintenance": 4, "Replacement": 4, "Inspections": 2} + +site_weightings = {"On-Site Maintenance": 4, "Inspections": 2} + + ### OPERATION COSTS transit_cost_multiplier = 0.03 loading_cost_multiplier = 0.01 - + ### PROJECT DATES annual_maintenance_start = "April" annual_maintenance_end = "October" -lifetime = 7. # 'project.lifetime', +lifetime = 7.0 # 'project.lifetime', ### CREW SPECIFICATION -duration_shift = 8. +duration_shift = 8.0 helideck = False number_crews_available = 8 number_crews_per_shift = 4 number_shifts_per_day = 3 -wage_specialist_day = 200. -wage_specialist_night = 300. -wage_technician_day = 100. -wage_technician_night = 150. +wage_specialist_day = 200.0 +wage_specialist_night = 300.0 +wage_technician_day = 100.0 +wage_technician_night = 150.0 workdays_summer = 7 workdays_winter = 7 @@ -740,8 +944,8 @@ ### COMPONENT DATA # Electrical -component_data_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(component_data_path, encoding = 'utf-8') +component_data_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(component_data_path) sheet_names = xls_file.sheet_names static_cable = xls_file.parse(sheet_names[0]) @@ -751,127 +955,137 @@ transformers = xls_file.parse(sheet_names[4]) collection_points = xls_file.parse(sheet_names[5]) -collection_point_cog = {11: [0,0,0], - 12: [0,0,0], - 22: [0,0,0], - 23: [0,0,0], - 24: [0,0,0], - 25: [0,0,0] - } - -collection_point_found = {11: [[0,0,0]], - 12: [[0,0,0]], - 22: [[0,0,0]], - 23: [[0,0,0]], - 24: [[0,0,0]], - 25: [[0,0,0]] - } - -compat_data_path = os.path.join(elec_dir, - 'equipment_compatibility_matrix.xlsx') -xls_file = pd.ExcelFile(compat_data_path, encoding='utf-8') +collection_point_cog = { + 11: [0, 0, 0], + 12: [0, 0, 0], + 22: [0, 0, 0], + 23: [0, 0, 0], + 24: [0, 0, 0], + 25: [0, 0, 0], +} + +collection_point_found = { + 11: [[0, 0, 0]], + 12: [[0, 0, 0]], + 22: [[0, 0, 0]], + 23: [[0, 0, 0]], + 24: [[0, 0, 0]], + 25: [[0, 0, 0]], +} + +compat_data_path = os.path.join(elec_dir, "equipment_compatibility_matrix.xlsx") +xls_file = pd.ExcelFile(compat_data_path) sheet_names = xls_file.sheet_names -installation_soil_compatibility = xls_file.parse(sheet_names[0], - index_col=None) -installation_soil_compatibility.columns = ['Technique', - 'Loose Sand', - 'Medium Sand', - 'Dense Sand', - 'Very Soft Clay', - 'Soft Clay', - 'Firm Clay', - 'Stiff Clay', - 'Hard Glacial Till', - 'Cemented', - 'Soft Rock Coral', - 'Hard Rock', - 'Gravel Cobble'] - -equipment_gradient_constraint = 14. +installation_soil_compatibility = xls_file.parse(sheet_names[0], index_col=None) +installation_soil_compatibility.columns = [ + "Technique", + "Loose Sand", + "Medium Sand", + "Dense Sand", + "Very Soft Clay", + "Soft Clay", + "Firm Clay", + "Stiff Clay", + "Hard Glacial Till", + "Cemented", + "Soft Rock Coral", + "Hard Rock", + "Gravel Cobble", +] + +equipment_gradient_constraint = 14.0 # Moorings and Foundations -compdict = eval(open(os.path.join(moor_dir, 'dummycompdb.txt')).read()) -comp_tables = get_moorings_tables(compdict) #component database - -cost_steel = 1.0 #steel cost -cost_grout = 0.1 #grout cost -cost_concrete = 0.11 #concrete cost -grout_strength = 125.0 #grout strength +compdict = eval(open(os.path.join(moor_dir, "dummycompdb.txt")).read()) +comp_tables = get_moorings_tables(compdict) # component database + +cost_steel = 1.0 # steel cost +cost_grout = 0.1 # grout cost +cost_concrete = 0.11 # concrete cost +grout_strength = 125.0 # grout strength ### SAFETY FACTORS -port_sf_dict = {"Parameter": ["Terminal area [m^2]", - "Terminal load bearing [t/m^2]"], - "Safety Factor": [0.2, 0.2] - } +port_sf_dict = { + "Parameter": ["Terminal area [m^2]", "Terminal load bearing [t/m^2]"], + "Safety Factor": [0.2, 0.2], +} port_sf = pd.DataFrame(port_sf_dict) -vessel_sf_dict = {"Parameter": ['Deck space [m^2]', - 'Deck loading [t/m^2]', - 'Max. cargo [t]', - 'Crane capacity [t]', - 'Bollard pull [t]', - 'Turntable loading [t]', - 'Turntable inner diameter [m]', - 'AH winch rated pull [t]', - 'AH drum capacity [m]', - 'JackUp max payload [t]', - 'JackUp max water depth [m]'], - "Safety Factor": [0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.0, - 0.0, - 0.2, - 0.2] - } +vessel_sf_dict = { + "Parameter": [ + "Deck space [m^2]", + "Deck loading [t/m^2]", + "Max. cargo [t]", + "Crane capacity [t]", + "Bollard pull [t]", + "Turntable loading [t]", + "Turntable inner diameter [m]", + "AH winch rated pull [t]", + "AH drum capacity [m]", + "JackUp max payload [t]", + "JackUp max water depth [m]", + ], + "Safety Factor": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.0, 0.0, 0.2, 0.2], +} vessel_sf = pd.DataFrame(vessel_sf_dict) -rov_sf_dict = {"Parameter": ["Manipulator grip force [N]", "Depth rating [m]"], - "Safety Factor": [0.2, 0.]} +rov_sf_dict = { + "Parameter": ["Manipulator grip force [N]", "Depth rating [m]"], + "Safety Factor": [0.2, 0.0], +} rov_sf = pd.DataFrame(rov_sf_dict) -divers_sf_dict = {"Parameter": ["Max operating depth [m]"], - "Safety Factor": [0.]} +divers_sf_dict = { + "Parameter": ["Max operating depth [m]"], + "Safety Factor": [0.0], +} divers_sf = pd.DataFrame(divers_sf_dict) -hammer_sf_dict = {"Parameter": ["Max pile diameter [mm]"], - "Safety Factor": [0.2]} +hammer_sf_dict = { + "Parameter": ["Max pile diameter [mm]"], + "Safety Factor": [0.2], +} hammer_sf = pd.DataFrame(hammer_sf_dict) -vibro_driver_sf_dict = {"Parameter": ['Max pile diameter [mm]', - 'Max pile weight [t]', - 'Depth rating [m]'], - "Safety Factor": [0.2, 0.2, 0.]} +vibro_driver_sf_dict = { + "Parameter": [ + "Max pile diameter [mm]", + "Max pile weight [t]", + "Depth rating [m]", + ], + "Safety Factor": [0.2, 0.2, 0.0], +} vibro_driver_sf = pd.DataFrame(vibro_driver_sf_dict) -cable_burial_sf_dict = {"Parameter": ['Jetting trench depth [m]', - 'Ploughing trench depth [m]', - 'Cutting trench depth [m]', - 'Max cable diameter [mm]', - 'Min cable bending radius [m]', - 'Max operating depth [m]'], - "Safety Factor": [0, 0, 0, 0, 0, 0]} +cable_burial_sf_dict = { + "Parameter": [ + "Jetting trench depth [m]", + "Ploughing trench depth [m]", + "Cutting trench depth [m]", + "Max cable diameter [mm]", + "Min cable bending radius [m]", + "Max operating depth [m]", + ], + "Safety Factor": [0, 0, 0, 0, 0, 0], +} cable_burial_sf = pd.DataFrame(cable_burial_sf_dict) -split_pipe_sf_dict = {"Parameter": ['Max cable size [mm]', - 'Min bending radius [m]'], - "Safety Factor": [0., 0.]} +split_pipe_sf_dict = { + "Parameter": ["Max cable size [mm]", "Min bending radius [m]"], + "Safety Factor": [0.0, 0.0], +} split_pipe_sf = pd.DataFrame(split_pipe_sf_dict) #### RELIABILITY DATA -compdict = eval(open(os.path.join(moor_dir, 'dummycompdb.txt')).read()) +compdict = eval(open(os.path.join(moor_dir, "dummycompdb.txt")).read()) -component_data_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(component_data_path, encoding = 'utf-8') +component_data_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(component_data_path) elec_dict = compdict_from_mock(xls_file) compdict.update(elec_dict) @@ -881,12 +1095,12 @@ ### RATES -file_path = os.path.join(inst_dir, 'equipment_perf_rates.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') -equipment_penetration_rates = xls_file.parse('penet') +file_path = os.path.join(inst_dir, "equipment_perf_rates.xlsx") +xls_file = pd.ExcelFile(file_path) +equipment_penetration_rates = xls_file.parse("penet") -surface_laying_rate = 1000. -split_pipe_laying_rate = 300. +surface_laying_rate = 1000.0 +split_pipe_laying_rate = 300.0 loading_rate = 450 grout_rate = 20 fuel_cost_rate = 1.5 @@ -895,95 +1109,95 @@ ### MATERIALS # Foundations -steelden = 7750.0 #steel density -conden = 2400.0 #concrete density -groutden = 2450.0 #grout density +steelden = 7750.0 # steel density +conden = 2400.0 # concrete density +groutden = 2450.0 # grout density # Substrate -draincoh = 0.0 #drained soil cohesion -unsfang = 5.0 #undrained soil friction angle -dsfang = 35.0 #drained soil friction angle -soilweight = 9.4285e+03 #buoyant soil weight -relsoilden = 50.0 #relative soil density +draincoh = 0.0 # drained soil cohesion +unsfang = 5.0 # undrained soil friction angle +dsfang = 35.0 # drained soil friction angle +soilweight = 9.4285e03 # buoyant soil weight +relsoilden = 50.0 # relative soil density undrained_soil_shear_strength_constant = 1.45e3 -undrained_soil_shear_strength_dependent = 2e3 #undrained shear friction angle -soilsen = 3.0 #soil sensitivity -rockcomstr = 206843.0 #rock compressive strength +undrained_soil_shear_strength_dependent = 2e3 # undrained shear friction angle +soilsen = 3.0 # soil sensitivity +rockcomstr = 206843.0 # rock compressive strength # default soil properties table -soilprops = pd.read_csv(os.path.join(moor_dir, 'soilprops.txt'), - sep='\t', - header=0, - index_col=False) +soilprops = pd.read_csv( + os.path.join(moor_dir, "soilprops.txt"), sep="\t", header=0, index_col=False +) # buried line bearing capacity factors -line_bcf = [[20, 3], - [25, 5], - [30, 8], - [35, 12], - [40, 22], - [45, 36]] - -#subgrade reaction coefficients -k1coeff = [[1, 100, 200], - [2, 57, 119], - [3, 45.75, 94], - [4, 34.5, 69], - [5, 30.75, 56], - [6, 27, 43], - [7, 25.25, 38], - [8, 23.5, 33], - [9, 22.25, 29], - [10, 21, 25], - [11, 19.75, 22.5], - [12, 18.5, 20], - [13, 17.75, 19], - [14, 17, 18], - [15, 16.5, 17.5], - [16, 16, 17], - [17, 15.75, 16.75], - [18, 15.5, 16.5], - [19, 15.25, 16.25], - [20, 15, 16]] - -#subgrade soil reaction coefficients cohesionless -subgradereaccoef = [[0.5, 4886048.0, 12893739.0, 24158795.0, 32573656.0], - [1.0, 3800260.0, 10043544.0, 17644064.0, 24430242.0], - [1.5, 3257366.0, 7464796.0, 14115251.0, 19272747.0], - [2.0, 2850195.0, 6107561.0, 11672227.0, 16286828.0], - [2.5, 2443024.0, 5428943.0, 10179268.0, 14658145.0], - [3.0, 2171577.0, 5021772.0, 9229203.0, 13300910.0], - [3.5, 2035854.0, 4750325.0, 8414861.0, 11943674.0], - [4.0, 1764406.0, 4411016.0, 7736243.0, 10857885.0], - [4.5, 1628683.0, 4139569.0, 7193349.0, 10043544.0], - [5.0, 1560821.0, 3935983.0, 6650455.0, 9229203.0], - [5.5, 1425097.0, 3732398.0, 6107561.0, 8686308.0], - [6.0, 1357236.0, 3596675.0, 5768252.0, 8143414.0], - [6.5, 1289374.0, 3393089.0, 5361081.0, 7736243.0], - [7.0, 1221512.0, 3257366.0, 5021772.0, 7261211.0], - [7.5, 1153650.0, 3053780.0, 4818187.0, 6854040.0], - [8.0, 1085789.0, 2850195.0, 4614601.0, 6514731.0], - [8.5, 1017927.0, 2646610.0, 4411016.0, 6243284.0], - [9.0, 950065.0, 2443024.0, 4207431.0, 5971837.0], - [9.5, 814341.0, 2307301.0, 4003845.0, 5700390.0], - [10.0, 678618.0, 2239439.0, 3868122.0, 5428943.0]] - -#pile deflection coefficients -piledefcoef = [[2.0, 4.65, 3.4], - [2.25, 3.51, 2.4], - [2.5, 2.95, 2.05], - [2.75, 2.77, 1.85], - [3.0, 2.75, 1.8], - [3.25, 2.73, 1.77], - [3.5, 2.7, 1.75], - [3.75, 2.67, 1.72], - [4.0, 2.65, 1.7], - [4.25, 2.637, 1.7], - [4.5, 2.63, 1.7], - [4.75, 2.62, 1.7], - [5.0, 2.61, 1.7]] - -#pile moment coefficients am +line_bcf = [[20, 3], [25, 5], [30, 8], [35, 12], [40, 22], [45, 36]] + +# subgrade reaction coefficients +k1coeff = [ + [1, 100, 200], + [2, 57, 119], + [3, 45.75, 94], + [4, 34.5, 69], + [5, 30.75, 56], + [6, 27, 43], + [7, 25.25, 38], + [8, 23.5, 33], + [9, 22.25, 29], + [10, 21, 25], + [11, 19.75, 22.5], + [12, 18.5, 20], + [13, 17.75, 19], + [14, 17, 18], + [15, 16.5, 17.5], + [16, 16, 17], + [17, 15.75, 16.75], + [18, 15.5, 16.5], + [19, 15.25, 16.25], + [20, 15, 16], +] + +# subgrade soil reaction coefficients cohesionless +subgradereaccoef = [ + [0.5, 4886048.0, 12893739.0, 24158795.0, 32573656.0], + [1.0, 3800260.0, 10043544.0, 17644064.0, 24430242.0], + [1.5, 3257366.0, 7464796.0, 14115251.0, 19272747.0], + [2.0, 2850195.0, 6107561.0, 11672227.0, 16286828.0], + [2.5, 2443024.0, 5428943.0, 10179268.0, 14658145.0], + [3.0, 2171577.0, 5021772.0, 9229203.0, 13300910.0], + [3.5, 2035854.0, 4750325.0, 8414861.0, 11943674.0], + [4.0, 1764406.0, 4411016.0, 7736243.0, 10857885.0], + [4.5, 1628683.0, 4139569.0, 7193349.0, 10043544.0], + [5.0, 1560821.0, 3935983.0, 6650455.0, 9229203.0], + [5.5, 1425097.0, 3732398.0, 6107561.0, 8686308.0], + [6.0, 1357236.0, 3596675.0, 5768252.0, 8143414.0], + [6.5, 1289374.0, 3393089.0, 5361081.0, 7736243.0], + [7.0, 1221512.0, 3257366.0, 5021772.0, 7261211.0], + [7.5, 1153650.0, 3053780.0, 4818187.0, 6854040.0], + [8.0, 1085789.0, 2850195.0, 4614601.0, 6514731.0], + [8.5, 1017927.0, 2646610.0, 4411016.0, 6243284.0], + [9.0, 950065.0, 2443024.0, 4207431.0, 5971837.0], + [9.5, 814341.0, 2307301.0, 4003845.0, 5700390.0], + [10.0, 678618.0, 2239439.0, 3868122.0, 5428943.0], +] + +# pile deflection coefficients +piledefcoef = [ + [2.0, 4.65, 3.4], + [2.25, 3.51, 2.4], + [2.5, 2.95, 2.05], + [2.75, 2.77, 1.85], + [3.0, 2.75, 1.8], + [3.25, 2.73, 1.77], + [3.5, 2.7, 1.75], + [3.75, 2.67, 1.72], + [4.0, 2.65, 1.7], + [4.25, 2.637, 1.7], + [4.5, 2.63, 1.7], + [4.75, 2.62, 1.7], + [5.0, 2.61, 1.7], +] + +# pile moment coefficients am pilemomcoefam = [ [0, 0, 0, 0, 0, 0], [0.25, 0.255751417, 0.255752104, 0.25576445, 0.243605698, 0.227417941], @@ -1003,10 +1217,10 @@ [3.75, 0.03435529, 0.048391189, 0.023458111, 0, 0], [4, -0.008, 0.021, 0.008, 0, 0], [4.25, -0.04560529, 0.004858811, 0, 0, 0], - [4.5, -0.076, 0.003, 0, 0, 0] - ] - -#pile moment coefficients bm + [4.5, -0.076, 0.003, 0, 0, 0], +] + +# pile moment coefficients bm pilemomcoefbm = [ [0, 1, 1, 1, 1, 1], [0.25, 0.987315551, 0.987332937, 0.98122151, 0.992090215, 0.969472347], @@ -1026,16 +1240,18 @@ [3.75, -0.099507477, -0.047911693, 0.003155466, 0, 0], [4, -0.111648, -0.044108, -0.000686, 0, 0], [4.25, -0.111554773, -0.028243057, 0, 0, 0], - [4.5, -0.102084, -0.001464, 0, 0, 0] - ] - -#pile limiting values non calcaeous soils -pilefricresnoncal = [[35, 30, 40, 95.761e3, 9576.051e3], - [30, 25, 20, 81.396e3, 4788.026e3], - [25, 20, 12, 67.032e3, 2872.815e3], - [20, 15, 8, 47.880e3, 1915.210e3]] - -#plate anchor holding capacity factors + [4.5, -0.102084, -0.001464, 0, 0, 0], +] + +# pile limiting values non calcaeous soils +pilefricresnoncal = [ + [35, 30, 40, 95.761e3, 9576.051e3], + [30, 25, 20, 81.396e3, 4788.026e3], + [25, 20, 12, 67.032e3, 2872.815e3], + [20, 15, 8, 47.880e3, 1915.210e3], +] + +# plate anchor holding capacity factors hcfdrsoil = [ [1.0, 1.638945315, 1.994698838, 2.307140604, 2.784, 3.396946397], [2.0, 2.250880594, 3.062312263, 3.879752818, 5.05497647, 6.628796215], @@ -1049,13 +1265,13 @@ [10.0, 3.345993542, 5.688597794, 11.18491233, 21.95043482, 50.76899705], [11.0, 3.396495827, 5.789632743, 11.47106897, 22.74735899, 53.1019566], [12.0, 3.446998112, 5.890667693, 11.75722561, 23.54428317, 55.43491614], - [13.0, 3.497500397, 5.991702643, 12.04338224, 24.34120734, 57.76787568] - ] + [13.0, 3.497500397, 5.991702643, 12.04338224, 24.34120734, 57.76787568], +] ### SOLVER OPTIONS -op_threshold = 0. +op_threshold = 0.0 power_bin_width = 0.05 skip_phase = True @@ -1063,320 +1279,271 @@ ### LOAD VARIABLES test_data = { - "bathymetry.layers": strata, - "constants.line_bearing_capacity_factor": line_bcf, - "constants.pile_Am_moment_coefficient": pilemomcoefam, - "constants.pile_Bm_moment_coefficient": pilemomcoefbm, - "constants.pile_deflection_coefficients": piledefcoef, - "constants.pile_skin_friction_end_bearing_capacity": pilefricresnoncal, - "constants.soil_cohesionless_reaction_coefficient": subgradereaccoef, - "constants.soil_cohesive_reaction_coefficient": k1coeff, - "constants.soil_drained_holding_capacity_factor": hcfdrsoil, - "farm.soil_sensitivity": soilsen, - "constants.soilprops": soilprops, - "constants.gravity": gravity, - "constants.sea_water_density": seaden, - "constants.air_density": airden, - "constants.steel_density": steelden, - "constants.concrete_density": conden, - "constants.grout_density": groutden, - "constants.grout_compressive_strength": grout_strength, - "constants.cylinder_drag": dragcoefcyl, - "constants.cylinder_wake_amplificiation": wakeampfactorcyl, - "constants.rectangular_wind_drag": winddragcoefrect, - "constants.rectangular_current_drag": currentdragcoefrect, - "constants.rectangular_drift": driftcoeffloatrect, - "constants.rectangular_wave_inertia": waveinertiacoefrect, - "corridor.layers": export_strata, - "component.collection_points": collection_points, - "component.collection_point_cog": collection_point_cog, - "component.collection_point_foundations": collection_point_found, - "component.dry_mate_connectors": dry_mate_connectors, - "component.dynamic_cable": dynamic_cable, - "project.equipment_gradient_constraint": equipment_gradient_constraint, - "component.installation_soil_compatibility": installation_soil_compatibility, - "component.static_cable": static_cable, - "component.transformers": transformers, - "component.wet_mate_connectors": wet_mate_connectors, - "project.fabrication_cost": fab_cost, - "project.export_voltage": corridor_voltage, - "corridor.landing_point": landing_point, - "corridor.nogo_areas": corridor_nogo_areas, - "project.export_target_burial_depth": corridor_target_burial_depth, - "device.bidirection": bidirection, - "device.connector_type": connection, - "device.turbine_hub_height": turbine_hub_height, - "device.cut_in_velocity": cut_in, - "device.cut_out_velocity": cut_out, - "device.installation_depth_max": max_install, - "device.installation_depth_min": min_install, - "device.minimum_distance_x": min_dist_x, - "device.minimum_distance_y": min_dist_y, - "device.constant_power_factor": power_factor, - "device.power_rating": rated_power_device, - "device.prescribed_footprint_radius": footprint_radius, - "device.system_draft": device_draft, - "device.turbine_diameter": rotor_diam, - "device.turbine_interdistance": turbine_interdist, - "device.turbine_performance": tidal_performance, - "device.umbilical_connection_point": umbilical_connection, - "project.umbilical_safety_factor": umbilical_safety, - "device.voltage": device_voltage, - "device.yaw": yaw_angle, - "device.dry_beam_area": sys_dry_beam, - "device.dry_frontal_area": sys_dry_frontal, - "device.foundation_location": found_loc, - "project.foundation_safety_factor": found_safety, - "device.foundation_type": prefound, - "device.system_centre_of_gravity": sys_cog, - "device.system_displaced_volume": sys_vol, - "device.system_height": sys_height, - "device.system_length": sys_length, - "device.system_mass": sys_mass, - "device.system_profile": sys_prof, - "device.system_roughness": sys_rough, - "device.system_width": sys_width, - "device.wet_beam_area": sys_wet_beam, - "device.wet_frontal_area": sys_wet_frontal, - "farm.blockage_ratio": blockage_ratio, - "project.devices_per_string": devices_per_string, - "farm.direction_of_max_surface_current": max_10year_current_dir, - "project.main_direction": main_direction, - "farm.max_surface_current_10_year": max_10year_current, - "project.network_configuration": network_configuration, - "farm.nogo_areas": nogo_areas, - "project.onshore_infrastructure_cost": onshore_infrastructure_cost, -# "farm.power_law_exponent": power_law_exponent, - "project.rated_power": rated_array_power, - "farm.spec_gamma": spectrum_gamma_farm, - "project.target_burial_depth": target_burial_depth, - "project.tidal_occurrence_nbins": n_bins, - "farm.tidal_occurrence_point": tidal_point, - "farm.tidal_series": tidal_series_raw, - "farm.wave_direction_100_year": predominant_100year_wave_dir, - "farm.current_profile": current_profile, - "project.grout_strength_safety_factor": grout_safety, - "farm.max_gust_wind_direction_100_year": max_100_year_gust_dir, - "farm.max_gust_wind_speed_100_year": max_100_year_gust_speed, - "farm.max_hs_100_year": max_100year_hs, - "farm.max_tp_100_year": max_100year_tp, - "farm.max_water_level_50_year": max_50_year_water_level, - "farm.mean_wind_direction_100_year": mean_100_year_wind_dir, - "farm.mean_wind_speed_100_year": mean_100_year_wind_speed, - "farm.min_water_level_50_year": min_50_year_water_level, - "project.cost_of_concrete": cost_concrete, - "project.cost_of_grout": cost_grout, - "project.cost_of_steel": cost_steel, - "options.optimisation_threshold": op_threshold, - "options.user_array_layout": user_array_layout, - "options.user_array_option": user_array_option, - "site.lease_boundary": lease_area, - 'component.foundations_anchor': comp_tables["drag anchor"], - 'component.foundations_pile': comp_tables["pile"], - 'component.foundations_anchor_sand': comp_tables["drag anchor sand"], - 'component.foundations_anchor_soft': comp_tables["drag anchor soft"], - 'options.power_bin_width': power_bin_width, - - "component.rov" : equipment_rov, - "component.divers" : equipment_divers, - "component.cable_burial" : equipment_cable_burial, - "component.excavating" : equipment_excavating, - "component.mattress_installation" : equipment_mattress, - "component.rock_bags_installation" : equipment_rock_filter_bags, - "component.split_pipes_installation" : equipment_split_pipe, - "component.hammer" : equipment_hammer, - "component.drilling_rigs" : equipment_drilling_rigs, - "component.vibro_driver" : equipment_vibro_driver, - "component.vehicle_helicopter": helicopter_df, - "component.vehicle_vessel_ahts": ahts_df, - "component.vehicle_vessel_multicat": multicat_df, - "component.vehicle_vessel_crane_barge": crane_barge_df, - "component.vehicle_vessel_barge": barge_df, - "component.vehicle_vessel_crane_vessel": crane_vessel_df, - "component.vehicle_vessel_csv": csv_df, - "component.vehicle_vessel_ctv": ctv_df, - "component.vehicle_vessel_clb": clb_df, - "component.vehicle_vessel_clv": clv_df, - "component.vehicle_vessel_jackup_barge": jackup_barge_df, - "component.vehicle_vessel_jackup_vessel": jackup_vssel_df, - "component.vehicle_vessel_tugboat": tugboat_df, - "component.ports" : ports, - "component.port_locations": port_locations, - - "project.port_safety_factors": port_sf, - "project.vessel_safety_factors": vessel_sf, - "project.rov_safety_factors": rov_sf, - "project.divers_safety_factors": divers_sf, - "project.hammer_safety_factors": hammer_sf, - "project.vibro_driver_safety_factors": vibro_driver_sf, - "project.cable_burial_safety_factors": cable_burial_sf, - "project.split_pipe_safety_factors": split_pipe_sf, - - "component.equipment_penetration_rates": - equipment_penetration_rates, - "project.surface_laying_rate": surface_laying_rate, - "project.split_pipe_laying_rate": split_pipe_laying_rate, - "project.loading_rate": loading_rate, - "project.grout_rate": grout_rate, - "project.fuel_cost_rate": fuel_cost_rate, - - "project.landfall_contruction_technique": - landfall_contruction_technique, - - "device.assembly_duration": assembly_duration, - "device.bollard_pull": bollard_pull, - "device.connect_duration": connect_duration, - "device.disconnect_duration": disconnect_duration, - "device.installation_limit_Cs": installation_limit_Cs, - "device.installation_limit_Hs": installation_limit_Hs, - "device.installation_limit_Tp": installation_limit_Tp, - "device.installation_limit_Ws": installation_limit_Ws, - "device.load_out_method": load_out_method, - "device.transportation_method": transportation_method, - - "device.subsystem_installation": sub_device, - - "project.port_percentage_cost": port_percentage_cost, - "project.commissioning_time": comissioning_time, - "project.cost_contingency": cost_contingency, - "project.start_date": project_start_date, - - "project.lease_area_entry_point": entry_point, - "farm.wave_series_installation" : wave_series, - "farm.tidal_series_installation" : tidal_series, - "farm.wind_series_installation" : wind_series, - - "site.projection": lease_utm_zone, - - "options.skip_phase": skip_phase, - - "project.calendar_based_maintenance": calendar_based_maintenance, - "project.condition_based_maintenance": condition_based_maintenance, - "project.duration_shift": duration_shift, - "farm.helideck": helideck, - "project.number_crews_available": number_crews_available, - "project.number_crews_per_shift": number_crews_per_shift, - "project.number_shifts_per_day": number_shifts_per_day, - "project.wage_specialist_day": wage_specialist_day, - "project.wage_specialist_night": wage_specialist_night, - "project.wage_technician_day": wage_technician_day, - "project.wage_technician_night": wage_technician_night, - "project.workdays_summer": workdays_summer, - "project.workdays_winter": workdays_winter, - "project.energy_selling_price": 0.2, - - 'options.annual_maintenance_start': annual_maintenance_start, - 'options.annual_maintenance_end': annual_maintenance_end, - 'project.lifetime': lifetime, - - "options.operations_onsite_maintenance": - operations_onsite_maintenance, - "options.operations_replacements": operations_replacements, - "options.operations_inspections": operations_inspections, - - 'device.prime_mover_operations_weighting': full_weightings, - 'device.pto_operations_weighting': full_weightings, - 'device.control_operations_weighting': full_weightings, - 'device.support_operations_weighting': full_weightings, - 'project.umbilical_operations_weighting': full_weightings, - 'project.array_cables_operations_weighting': site_weightings, - 'project.substations_operations_weighting': site_weightings, - 'project.export_cable_operations_weighting': site_weightings, - 'project.foundations_operations_weighting': site_weightings, - 'project.moorings_operations_weighting': full_weightings, - - 'device.subsystem_failure_rates': device_failure_rates, - - 'options.condition_maintenance_soh': condition_maintenance_soh, - 'options.calendar_maintenance_interval': - calendar_maintenance_interval, - - 'device.onsite_maintenance_requirements': - device_onsite_requirements, - 'project.electrical_onsite_maintenance_requirements': - electrical_onsite_requirements, - 'project.moorings_onsite_maintenance_requirements': - moorings_onsite_requirements, - - 'device.replacement_requirements': - device_replacement_requirements, - 'project.electrical_replacement_requirements': None, - 'project.moorings_replacement_requirements': None, - - 'device.inspections_requirements': - device_inspections_requirements, - 'project.electrical_inspections_requirements': - electrical_inspections_requirements, - 'project.moorings_inspections_requirements': - moorings_inspections_requirements, - - 'device.onsite_maintenance_parts': device_onsite_parts, - 'project.electrical_onsite_maintenance_parts': - electrical_onsite_parts, - 'project.moorings_onsite_maintenance_parts': moorings_onsite_parts, - 'device.replacement_parts': device_replacement_parts, - 'project.electrical_replacement_parts': None, - 'project.moorings_replacement_parts': None, - 'device.subsystem_lead_times': device_lead_times, - 'project.electrical_subsystem_lead_times': electrical_lead_times, - 'project.moorings_subsystem_lead_times': moorings_lead_times, - - 'device.subsystem_costs': device_costs, - 'options.subsystem_monitering_costs': condition_maintenance_cost, - 'options.transit_cost_multiplier': transit_cost_multiplier, - 'options.loading_cost_multiplier': loading_cost_multiplier, - - "component.moorings_chain_NCFR": comp_tables_rel["chain NCFR"], - "component.moorings_chain_CFR": comp_tables_rel["chain CFR"], - "component.moorings_forerunner_NCFR": - comp_tables_rel["forerunner NCFR"], - "component.moorings_forerunner_CFR": - comp_tables_rel["forerunner CFR"], - "component.moorings_shackle_NCFR": - comp_tables_rel["shackle NCFR"], - "component.moorings_shackle_CFR": comp_tables_rel["shackle CFR"], - "component.moorings_swivel_NCFR": comp_tables_rel["swivel NCFR"], - "component.moorings_swivel_CFR": comp_tables_rel["swivel CFR"], - "component.foundations_anchor_NCFR": - comp_tables_rel["anchor NCFR"], - "component.foundations_anchor_CFR": - comp_tables_rel["anchor CFR"], - "component.foundations_pile_NCFR": comp_tables_rel["pile NCFR"], - "component.foundations_pile_CFR": comp_tables_rel["pile CFR"], - "component.moorings_rope_NCFR":comp_tables_rel["rope NCFR"], - "component.moorings_rope_CFR": comp_tables_rel["rope CFR"], - "component.static_cable_NCFR": - comp_tables_rel["static_cable NCFR"], - "component.static_cable_CFR": - comp_tables_rel["static_cable CFR"], - "component.dynamic_cable_NCFR": - comp_tables_rel["dynamic_cable NCFR"], - "component.dynamic_cable_CFR": - comp_tables_rel["dynamic_cable CFR"], - "component.wet_mate_connectors_NCFR": - comp_tables_rel["wet_mate NCFR"], - "component.wet_mate_connectors_CFR": - comp_tables_rel["wet_mate CFR"], - "component.dry_mate_connectors_NCFR": - comp_tables_rel["dry_mate NCFR"], - "component.dry_mate_connectors_CFR": - comp_tables_rel["dry_mate CFR"], - "component.transformers_NCFR": - comp_tables_rel["transformer NCFR"], - "component.transformers_CFR": - comp_tables_rel["transformer CFR"], - "component.collection_points_NCFR": - comp_tables_rel["collection_point NCFR"], - "component.collection_points_CFR": - comp_tables_rel["collection_point CFR"] - - } - + "bathymetry.layers": strata, + "constants.line_bearing_capacity_factor": line_bcf, + "constants.pile_Am_moment_coefficient": pilemomcoefam, + "constants.pile_Bm_moment_coefficient": pilemomcoefbm, + "constants.pile_deflection_coefficients": piledefcoef, + "constants.pile_skin_friction_end_bearing_capacity": pilefricresnoncal, + "constants.soil_cohesionless_reaction_coefficient": subgradereaccoef, + "constants.soil_cohesive_reaction_coefficient": k1coeff, + "constants.soil_drained_holding_capacity_factor": hcfdrsoil, + "farm.soil_sensitivity": soilsen, + "constants.soilprops": soilprops, + "constants.gravity": gravity, + "constants.sea_water_density": seaden, + "constants.air_density": airden, + "constants.steel_density": steelden, + "constants.concrete_density": conden, + "constants.grout_density": groutden, + "constants.grout_compressive_strength": grout_strength, + "constants.cylinder_drag": dragcoefcyl, + "constants.cylinder_wake_amplificiation": wakeampfactorcyl, + "constants.rectangular_wind_drag": winddragcoefrect, + "constants.rectangular_current_drag": currentdragcoefrect, + "constants.rectangular_drift": driftcoeffloatrect, + "constants.rectangular_wave_inertia": waveinertiacoefrect, + "corridor.layers": export_strata, + "component.collection_points": collection_points, + "component.collection_point_cog": collection_point_cog, + "component.collection_point_foundations": collection_point_found, + "component.dry_mate_connectors": dry_mate_connectors, + "component.dynamic_cable": dynamic_cable, + "project.equipment_gradient_constraint": equipment_gradient_constraint, + "component.installation_soil_compatibility": installation_soil_compatibility, + "component.static_cable": static_cable, + "component.transformers": transformers, + "component.wet_mate_connectors": wet_mate_connectors, + "project.fabrication_cost": fab_cost, + "project.export_voltage": corridor_voltage, + "corridor.landing_point": landing_point, + "corridor.nogo_areas": corridor_nogo_areas, + "project.export_target_burial_depth": corridor_target_burial_depth, + "device.bidirection": bidirection, + "device.connector_type": connection, + "device.turbine_hub_height": turbine_hub_height, + "device.cut_in_velocity": cut_in, + "device.cut_out_velocity": cut_out, + "device.installation_depth_max": max_install, + "device.installation_depth_min": min_install, + "device.minimum_distance_x": min_dist_x, + "device.minimum_distance_y": min_dist_y, + "device.constant_power_factor": power_factor, + "device.power_rating": rated_power_device, + "device.prescribed_footprint_radius": footprint_radius, + "device.system_draft": device_draft, + "device.turbine_diameter": rotor_diam, + "device.turbine_interdistance": turbine_interdist, + "device.turbine_performance": tidal_performance, + "device.umbilical_connection_point": umbilical_connection, + "project.umbilical_safety_factor": umbilical_safety, + "device.voltage": device_voltage, + "device.yaw": yaw_angle, + "device.dry_beam_area": sys_dry_beam, + "device.dry_frontal_area": sys_dry_frontal, + "device.foundation_location": found_loc, + "project.foundation_safety_factor": found_safety, + "device.foundation_type": prefound, + "device.system_centre_of_gravity": sys_cog, + "device.system_displaced_volume": sys_vol, + "device.system_height": sys_height, + "device.system_length": sys_length, + "device.system_mass": sys_mass, + "device.system_profile": sys_prof, + "device.system_roughness": sys_rough, + "device.system_width": sys_width, + "device.wet_beam_area": sys_wet_beam, + "device.wet_frontal_area": sys_wet_frontal, + "farm.blockage_ratio": blockage_ratio, + "project.devices_per_string": devices_per_string, + "farm.direction_of_max_surface_current": max_10year_current_dir, + "project.main_direction": main_direction, + "farm.max_surface_current_10_year": max_10year_current, + "project.network_configuration": network_configuration, + "farm.nogo_areas": nogo_areas, + "project.onshore_infrastructure_cost": onshore_infrastructure_cost, + # "farm.power_law_exponent": power_law_exponent, + "project.rated_power": rated_array_power, + "farm.spec_gamma": spectrum_gamma_farm, + "project.target_burial_depth": target_burial_depth, + "project.tidal_occurrence_nbins": n_bins, + "farm.tidal_occurrence_point": tidal_point, + "farm.tidal_series": tidal_series_raw, + "farm.wave_direction_100_year": predominant_100year_wave_dir, + "farm.current_profile": current_profile, + "project.grout_strength_safety_factor": grout_safety, + "farm.max_gust_wind_direction_100_year": max_100_year_gust_dir, + "farm.max_gust_wind_speed_100_year": max_100_year_gust_speed, + "farm.max_hs_100_year": max_100year_hs, + "farm.max_tp_100_year": max_100year_tp, + "farm.max_water_level_50_year": max_50_year_water_level, + "farm.mean_wind_direction_100_year": mean_100_year_wind_dir, + "farm.mean_wind_speed_100_year": mean_100_year_wind_speed, + "farm.min_water_level_50_year": min_50_year_water_level, + "project.cost_of_concrete": cost_concrete, + "project.cost_of_grout": cost_grout, + "project.cost_of_steel": cost_steel, + "options.optimisation_threshold": op_threshold, + "options.user_array_layout": user_array_layout, + "options.user_array_option": user_array_option, + "site.lease_boundary": lease_area, + "component.foundations_anchor": comp_tables["drag anchor"], + "component.foundations_pile": comp_tables["pile"], + "component.foundations_anchor_sand": comp_tables["drag anchor sand"], + "component.foundations_anchor_soft": comp_tables["drag anchor soft"], + "options.power_bin_width": power_bin_width, + "component.rov": equipment_rov, + "component.divers": equipment_divers, + "component.cable_burial": equipment_cable_burial, + "component.excavating": equipment_excavating, + "component.mattress_installation": equipment_mattress, + "component.rock_bags_installation": equipment_rock_filter_bags, + "component.split_pipes_installation": equipment_split_pipe, + "component.hammer": equipment_hammer, + "component.drilling_rigs": equipment_drilling_rigs, + "component.vibro_driver": equipment_vibro_driver, + "component.vehicle_helicopter": helicopter_df, + "component.vehicle_vessel_ahts": ahts_df, + "component.vehicle_vessel_multicat": multicat_df, + "component.vehicle_vessel_crane_barge": crane_barge_df, + "component.vehicle_vessel_barge": barge_df, + "component.vehicle_vessel_crane_vessel": crane_vessel_df, + "component.vehicle_vessel_csv": csv_df, + "component.vehicle_vessel_ctv": ctv_df, + "component.vehicle_vessel_clb": clb_df, + "component.vehicle_vessel_clv": clv_df, + "component.vehicle_vessel_jackup_barge": jackup_barge_df, + "component.vehicle_vessel_jackup_vessel": jackup_vssel_df, + "component.vehicle_vessel_tugboat": tugboat_df, + "component.ports": ports, + "component.port_locations": port_locations, + "project.port_safety_factors": port_sf, + "project.vessel_safety_factors": vessel_sf, + "project.rov_safety_factors": rov_sf, + "project.divers_safety_factors": divers_sf, + "project.hammer_safety_factors": hammer_sf, + "project.vibro_driver_safety_factors": vibro_driver_sf, + "project.cable_burial_safety_factors": cable_burial_sf, + "project.split_pipe_safety_factors": split_pipe_sf, + "component.equipment_penetration_rates": equipment_penetration_rates, + "project.surface_laying_rate": surface_laying_rate, + "project.split_pipe_laying_rate": split_pipe_laying_rate, + "project.loading_rate": loading_rate, + "project.grout_rate": grout_rate, + "project.fuel_cost_rate": fuel_cost_rate, + "project.landfall_contruction_technique": landfall_contruction_technique, + "device.assembly_duration": assembly_duration, + "device.bollard_pull": bollard_pull, + "device.connect_duration": connect_duration, + "device.disconnect_duration": disconnect_duration, + "device.installation_limit_Cs": installation_limit_Cs, + "device.installation_limit_Hs": installation_limit_Hs, + "device.installation_limit_Tp": installation_limit_Tp, + "device.installation_limit_Ws": installation_limit_Ws, + "device.load_out_method": load_out_method, + "device.transportation_method": transportation_method, + "device.subsystem_installation": sub_device, + "project.port_percentage_cost": port_percentage_cost, + "project.commissioning_time": comissioning_time, + "project.cost_contingency": cost_contingency, + "project.start_date": project_start_date, + "project.lease_area_entry_point": entry_point, + "farm.wave_series_installation": wave_series, + "farm.tidal_series_installation": tidal_series, + "farm.wind_series_installation": wind_series, + "site.projection": lease_utm_zone, + "options.skip_phase": skip_phase, + "project.calendar_based_maintenance": calendar_based_maintenance, + "project.condition_based_maintenance": condition_based_maintenance, + "project.duration_shift": duration_shift, + "farm.helideck": helideck, + "project.number_crews_available": number_crews_available, + "project.number_crews_per_shift": number_crews_per_shift, + "project.number_shifts_per_day": number_shifts_per_day, + "project.wage_specialist_day": wage_specialist_day, + "project.wage_specialist_night": wage_specialist_night, + "project.wage_technician_day": wage_technician_day, + "project.wage_technician_night": wage_technician_night, + "project.workdays_summer": workdays_summer, + "project.workdays_winter": workdays_winter, + "project.energy_selling_price": 0.2, + "options.annual_maintenance_start": annual_maintenance_start, + "options.annual_maintenance_end": annual_maintenance_end, + "project.lifetime": lifetime, + "options.operations_onsite_maintenance": operations_onsite_maintenance, + "options.operations_replacements": operations_replacements, + "options.operations_inspections": operations_inspections, + "device.prime_mover_operations_weighting": full_weightings, + "device.pto_operations_weighting": full_weightings, + "device.control_operations_weighting": full_weightings, + "device.support_operations_weighting": full_weightings, + "project.umbilical_operations_weighting": full_weightings, + "project.array_cables_operations_weighting": site_weightings, + "project.substations_operations_weighting": site_weightings, + "project.export_cable_operations_weighting": site_weightings, + "project.foundations_operations_weighting": site_weightings, + "project.moorings_operations_weighting": full_weightings, + "device.subsystem_failure_rates": device_failure_rates, + "options.condition_maintenance_soh": condition_maintenance_soh, + "options.calendar_maintenance_interval": calendar_maintenance_interval, + "device.onsite_maintenance_requirements": device_onsite_requirements, + "project.electrical_onsite_maintenance_requirements": electrical_onsite_requirements, + "project.moorings_onsite_maintenance_requirements": moorings_onsite_requirements, + "device.replacement_requirements": device_replacement_requirements, + "project.electrical_replacement_requirements": None, + "project.moorings_replacement_requirements": None, + "device.inspections_requirements": device_inspections_requirements, + "project.electrical_inspections_requirements": electrical_inspections_requirements, + "project.moorings_inspections_requirements": moorings_inspections_requirements, + "device.onsite_maintenance_parts": device_onsite_parts, + "project.electrical_onsite_maintenance_parts": electrical_onsite_parts, + "project.moorings_onsite_maintenance_parts": moorings_onsite_parts, + "device.replacement_parts": device_replacement_parts, + "project.electrical_replacement_parts": None, + "project.moorings_replacement_parts": None, + "device.subsystem_lead_times": device_lead_times, + "project.electrical_subsystem_lead_times": electrical_lead_times, + "project.moorings_subsystem_lead_times": moorings_lead_times, + "device.subsystem_costs": device_costs, + "options.subsystem_monitering_costs": condition_maintenance_cost, + "options.transit_cost_multiplier": transit_cost_multiplier, + "options.loading_cost_multiplier": loading_cost_multiplier, + "component.moorings_chain_NCFR": comp_tables_rel["chain NCFR"], + "component.moorings_chain_CFR": comp_tables_rel["chain CFR"], + "component.moorings_forerunner_NCFR": comp_tables_rel["forerunner NCFR"], + "component.moorings_forerunner_CFR": comp_tables_rel["forerunner CFR"], + "component.moorings_shackle_NCFR": comp_tables_rel["shackle NCFR"], + "component.moorings_shackle_CFR": comp_tables_rel["shackle CFR"], + "component.moorings_swivel_NCFR": comp_tables_rel["swivel NCFR"], + "component.moorings_swivel_CFR": comp_tables_rel["swivel CFR"], + "component.foundations_anchor_NCFR": comp_tables_rel["anchor NCFR"], + "component.foundations_anchor_CFR": comp_tables_rel["anchor CFR"], + "component.foundations_pile_NCFR": comp_tables_rel["pile NCFR"], + "component.foundations_pile_CFR": comp_tables_rel["pile CFR"], + "component.moorings_rope_NCFR": comp_tables_rel["rope NCFR"], + "component.moorings_rope_CFR": comp_tables_rel["rope CFR"], + "component.static_cable_NCFR": comp_tables_rel["static_cable NCFR"], + "component.static_cable_CFR": comp_tables_rel["static_cable CFR"], + "component.dynamic_cable_NCFR": comp_tables_rel["dynamic_cable NCFR"], + "component.dynamic_cable_CFR": comp_tables_rel["dynamic_cable CFR"], + "component.wet_mate_connectors_NCFR": comp_tables_rel["wet_mate NCFR"], + "component.wet_mate_connectors_CFR": comp_tables_rel["wet_mate CFR"], + "component.dry_mate_connectors_NCFR": comp_tables_rel["dry_mate NCFR"], + "component.dry_mate_connectors_CFR": comp_tables_rel["dry_mate CFR"], + "component.transformers_NCFR": comp_tables_rel["transformer NCFR"], + "component.transformers_CFR": comp_tables_rel["transformer CFR"], + "component.collection_points_NCFR": comp_tables_rel[ + "collection_point NCFR" + ], + "component.collection_points_CFR": comp_tables_rel["collection_point CFR"], +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + + print("generate test data: {}".format(pkl_path)) + + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/example_data/fixed_tidal_staggered_layout_scenario.py b/packages/dtocean-core/example_data/fixed_tidal_staggered_layout_scenario.py index ad5eba3..ce54e69 100644 --- a/packages/dtocean-core/example_data/fixed_tidal_staggered_layout_scenario.py +++ b/packages/dtocean-core/example_data/fixed_tidal_staggered_layout_scenario.py @@ -6,9 +6,9 @@ """ import os + import numpy as np import pandas as pd - from scipy.stats import multivariate_normal, norm from dtocean_core.utils.moorings import get_moorings_tables @@ -22,139 +22,151 @@ ## CONSTANTS -gravity = 9.80665 #gravity -seaden = 1025.0 #sea water density -airden = 1.226 #air density - -#cylinder drag coefficients -dragcoefcyl = [[0.0, 0.0, 1e-5, 1e-2], - [1e4, 1.2, 1.2, 1.15], - [2e4, 1.2, 1.2, 1.05], - [3e4, 1.2, 1.2, 0.87], - [4e4, 1.2, 1.15, 0.82], - [5e4, 1.2, 1.0, 0.8], - [6e4, 1.2, 0.9, 0.8], - [7e4, 1.2, 0.85, 0.83], - [8e4, 1.2, 0.7, 0.9], - [9e4, 1.2, 0.65, 0.94], - [1e5, 1.2, 0.6, 0.95], - [2e5, 1.2, 0.35, 1.02], - [3e5, 1.15, 0.3, 1.03], - [4e5, 0.95, 0.33, 1.05], - [5e5, 0.6, 0.35, 1.06], - [6e5, 0.35, 0.38, 1.07], - [7e5, 0.29, 0.4, 1.07], - [8e5, 0.31, 0.43, 1.08], - [9e5, 0.33, 0.45, 1.08], - [1e6, 0.35, 0.47, 1.08], - [2e6, 0.54, 0.53, 1.08], - [3e6, 0.62, 0.62, 1.08], - [4e6, 0.67, 0.67, 1.08]] - -#cylinder wake amplification factors -wakeampfactorcyl = [[0.0, 2.0, 2.0], - [5.0, 0.4, 0.8], - [10.0, 0.78, 1.3], - [15.0, 1.07, 1.4], - [20.0, 1.25, 1.25], - [25.0, 1.2, 1.2], - [30.0, 1.18, 1.18], - [35.0, 1.12, 1.12], - [40.0, 1.1, 1.1], - [45.0, 1.06, 1.06], - [50.0, 1.03, 1.03], - [55.0, 1.01, 1.01], - [60.0, 1.0, 1.0]] - -#rectangular section wind drag coefficients -winddragcoefrect = [[4.0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.6, 1.6], - [3.0, 1.1, 1.2, 1.25, 1.35, 1.4, 1.4, 1.4], - [2.0, 1.0, 1.05, 1.1, 1.15, 1.2, 1.2, 1.2], - [1.5, 0.95, 1.0, 1.05, 1.1, 1.15, 1.15, 1.15], - [1.0, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4], - [0.6667, 0.8, 0.85, 0.9, 0.95, 1.0, 1.0, 1.0], - [0.5, 0.75, 0.75, 0.8, 0.85, 0.9, 0.9, 0.9], - [0.3333, 0.7, 0.75, 0.75, 0.75, 0.8, 0.8, 0.8], - [0.25, 0.7, 0.7, 0.75, 0.75, 0.75, 0.75, 0.75]] - -#rectangular section current drag coefficients -currentdragcoefrect = [[10.0000, 1.88], - [5.0000, 1.95], - [3.3333, 2.06], - [2.5000, 2.24], - [2.0000, 2.39], - [1.6667, 2.6], - [1.4286, 2.73], - [1.2500, 2.5], - [1.1111, 2.31], - [1.0000, 2.19], - [0.9091, 2.06], - [0.8333, 1.95], - [0.7692, 1.87], - [0.7143, 1.8], - [0.6667, 1.73], - [0.6250, 1.67], - [0.5882, 1.63], - [0.5556, 1.58], - [0.5263, 1.52], - [0.5000, 1.49], - [0.4762, 1.46], - [0.4545, 1.44], - [0.4348, 1.41], - [0.4167, 1.37], - [0.4000, 1.35], - [0.3846, 1.32], - [0.3704, 1.29], - [0.3571, 1.26], - [0.3448, 1.25], - [0.3333, 1.23], - [0.3226, 1.21], - [0.3125, 1.2], - [0.3030, 1.19], - [0.2941, 1.18], - [0.2857, 1.16], - [0.2778, 1.15], - [0.2703, 1.15], - [0.2632, 1.15], - [0.2564, 1.15], - [0.2500, 1.15]] - -#rectangular section wave drift coefficients -driftcoeffloatrect = [[0.0, 0.0], - [0.1, 0.02], - [0.2, 0.06], - [0.3, 0.15], - [0.4, 0.28], - [0.5, 0.44], - [0.6, 0.60], - [0.7, 0.74], - [0.8, 0.84], - [0.9, 0.91], - [1.0, 0.94], - [1.1, 0.97], - [1.2, 0.98], - [1.3, 0.99], - [1.4, 1.0], - [1.5, 1.0]] - -#rectangular section wave inertia coefficients -waveinertiacoefrect = [[10.0, 2.23], - [5.0, 1.98], - [2.0, 1.7], - [1.0, 1.51], - [0.5, 1.36], - [0.2, 1.21], - [0.1, 1.14]] +gravity = 9.80665 # gravity +seaden = 1025.0 # sea water density +airden = 1.226 # air density + +# cylinder drag coefficients +dragcoefcyl = [ + [0.0, 0.0, 1e-5, 1e-2], + [1e4, 1.2, 1.2, 1.15], + [2e4, 1.2, 1.2, 1.05], + [3e4, 1.2, 1.2, 0.87], + [4e4, 1.2, 1.15, 0.82], + [5e4, 1.2, 1.0, 0.8], + [6e4, 1.2, 0.9, 0.8], + [7e4, 1.2, 0.85, 0.83], + [8e4, 1.2, 0.7, 0.9], + [9e4, 1.2, 0.65, 0.94], + [1e5, 1.2, 0.6, 0.95], + [2e5, 1.2, 0.35, 1.02], + [3e5, 1.15, 0.3, 1.03], + [4e5, 0.95, 0.33, 1.05], + [5e5, 0.6, 0.35, 1.06], + [6e5, 0.35, 0.38, 1.07], + [7e5, 0.29, 0.4, 1.07], + [8e5, 0.31, 0.43, 1.08], + [9e5, 0.33, 0.45, 1.08], + [1e6, 0.35, 0.47, 1.08], + [2e6, 0.54, 0.53, 1.08], + [3e6, 0.62, 0.62, 1.08], + [4e6, 0.67, 0.67, 1.08], +] + +# cylinder wake amplification factors +wakeampfactorcyl = [ + [0.0, 2.0, 2.0], + [5.0, 0.4, 0.8], + [10.0, 0.78, 1.3], + [15.0, 1.07, 1.4], + [20.0, 1.25, 1.25], + [25.0, 1.2, 1.2], + [30.0, 1.18, 1.18], + [35.0, 1.12, 1.12], + [40.0, 1.1, 1.1], + [45.0, 1.06, 1.06], + [50.0, 1.03, 1.03], + [55.0, 1.01, 1.01], + [60.0, 1.0, 1.0], +] + +# rectangular section wind drag coefficients +winddragcoefrect = [ + [4.0, 1.2, 1.3, 1.4, 1.5, 1.6, 1.6, 1.6], + [3.0, 1.1, 1.2, 1.25, 1.35, 1.4, 1.4, 1.4], + [2.0, 1.0, 1.05, 1.1, 1.15, 1.2, 1.2, 1.2], + [1.5, 0.95, 1.0, 1.05, 1.1, 1.15, 1.15, 1.15], + [1.0, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2, 1.4], + [0.6667, 0.8, 0.85, 0.9, 0.95, 1.0, 1.0, 1.0], + [0.5, 0.75, 0.75, 0.8, 0.85, 0.9, 0.9, 0.9], + [0.3333, 0.7, 0.75, 0.75, 0.75, 0.8, 0.8, 0.8], + [0.25, 0.7, 0.7, 0.75, 0.75, 0.75, 0.75, 0.75], +] + +# rectangular section current drag coefficients +currentdragcoefrect = [ + [10.0000, 1.88], + [5.0000, 1.95], + [3.3333, 2.06], + [2.5000, 2.24], + [2.0000, 2.39], + [1.6667, 2.6], + [1.4286, 2.73], + [1.2500, 2.5], + [1.1111, 2.31], + [1.0000, 2.19], + [0.9091, 2.06], + [0.8333, 1.95], + [0.7692, 1.87], + [0.7143, 1.8], + [0.6667, 1.73], + [0.6250, 1.67], + [0.5882, 1.63], + [0.5556, 1.58], + [0.5263, 1.52], + [0.5000, 1.49], + [0.4762, 1.46], + [0.4545, 1.44], + [0.4348, 1.41], + [0.4167, 1.37], + [0.4000, 1.35], + [0.3846, 1.32], + [0.3704, 1.29], + [0.3571, 1.26], + [0.3448, 1.25], + [0.3333, 1.23], + [0.3226, 1.21], + [0.3125, 1.2], + [0.3030, 1.19], + [0.2941, 1.18], + [0.2857, 1.16], + [0.2778, 1.15], + [0.2703, 1.15], + [0.2632, 1.15], + [0.2564, 1.15], + [0.2500, 1.15], +] + +# rectangular section wave drift coefficients +driftcoeffloatrect = [ + [0.0, 0.0], + [0.1, 0.02], + [0.2, 0.06], + [0.3, 0.15], + [0.4, 0.28], + [0.5, 0.44], + [0.6, 0.60], + [0.7, 0.74], + [0.8, 0.84], + [0.9, 0.91], + [1.0, 0.94], + [1.1, 0.97], + [1.2, 0.98], + [1.3, 0.99], + [1.4, 1.0], + [1.5, 1.0], +] + +# rectangular section wave inertia coefficients +waveinertiacoefrect = [ + [10.0, 2.23], + [5.0, 1.98], + [2.0, 1.7], + [1.0, 1.51], + [0.5, 1.36], + [0.2, 1.21], + [0.1, 1.14], +] ## LEASE AREA -startx = 1000. -endx = 2000. -dx = 10. +startx = 1000.0 +endx = 2000.0 +dx = 10.0 numx = int(float(endx - startx) / dx) + 1 -starty = 0. -endy = 2500. -dy = 10. +starty = 0.0 +endy = 2500.0 +dy = 10.0 numy = int(float(endy - starty) / dy) + 1 x = np.linspace(startx, endx, numx) @@ -163,56 +175,55 @@ ny = len(y) # Bathymetry -X, Y = np.meshgrid(x,y) -Z = np.zeros(X.shape) - 50. +X, Y = np.meshgrid(x, y) +Z = np.zeros(X.shape) - 50.0 depths = Z.T[:, :, np.newaxis] -sediments = np.chararray((nx,ny,1), itemsize=20) +sediments = np.chararray((nx, ny, 1), itemsize=20) sediments[:] = "loose sand" -strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} +strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} # Soil characteristics -max_temp = 10. -max_soil_res = 10. +max_temp = 10.0 +max_soil_res = 10.0 target_burial_depth = 10 # Polygons -lease_area = [(startx, starty), - (endx, starty), - (endx, endy), - (startx, endy)] - -#nogo_areas = [np.array([[50., 50.],[60., 50.],[60., 60.],[50., 60.]])] +lease_area = [(startx, starty), (endx, starty), (endx, endy), (startx, endy)] + +# nogo_areas = [np.array([[50., 50.],[60., 50.],[60., 60.],[50., 60.]])] nogo_areas = None -boundary_padding = 200. - +boundary_padding = 200.0 + # Tidal time series n_bins = 6 time_points = 48 t = np.linspace(0, 1, time_points) rv = norm() -time_sin = np.sin(np.linspace(0, 4*np.pi, time_points)) -time_scaled = time_sin * (1. / np.amax(time_sin)) +time_sin = np.sin(np.linspace(0, 4 * np.pi, time_points)) +time_scaled = time_sin * (1.0 / np.amax(time_sin)) -xgrid, ygrid = np.meshgrid(x,y) +xgrid, ygrid = np.meshgrid(x, y) pos = np.dstack((xgrid, ygrid)) -rv = multivariate_normal([500., 150.], [[max(x)*5., max(y)*2.], - [max(y)*2., max(x)*5.]]) +rv = multivariate_normal( + [500.0, 150.0], [[max(x) * 5.0, max(y) * 2.0], [max(y) * 2.0, max(x) * 5.0]] +) -u_max = 0. -v_max = 6. -ssh_max = 1. +u_max = 0.0 +v_max = 6.0 +ssh_max = 1.0 TI = 0.1 grid_pdf = rv.pdf(pos).T -#u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) +# u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) u_scaled = np.ones((nx, ny)) * u_max v_scaled = np.ones((nx, ny)) * v_max ssh_scaled = grid_pdf * (ssh_max / np.amax(grid_pdf)) @@ -222,7 +233,6 @@ ssh_arrays = [] for multiplier in time_scaled: - u_arrays.append(np.abs(u_scaled * multiplier)) v_arrays.append(np.abs(v_scaled * multiplier)) ssh_arrays.append(ssh_scaled * multiplier) @@ -232,31 +242,30 @@ SSH = np.dstack(ssh_arrays) TI = np.ones(SSH.shape) * TI -tidal_series_raw = {"values": {"U": U, - "V": V, - "SSH": SSH, - "TI": TI}, - "coords": [x, y, t]} - -xc = x[int(nx/2)] -yc = y[int(ny/2)] +tidal_series_raw = { + "values": {"U": U, "V": V, "SSH": SSH, "TI": TI}, + "coords": [x, y, t], +} + +xc = x[int(nx / 2)] +yc = y[int(ny / 2)] tidal_point = (xc, yc) # Tidal flow characteristics (hydro) -power_law_exponent = np.array([7.]) -blockage_ratio = 1. +power_law_exponent = np.array([7.0]) +blockage_ratio = 1.0 # Tidal flow characteristics (moorings) -max_10year_current = 6. -max_10year_current_dir = 0. -current_profile = "1/7 Power Law" #current profile alternatives: "Uniform" - # "1/7 Power Law" +max_10year_current = 6.0 +max_10year_current_dir = 0.0 +current_profile = "1/7 Power Law" # current profile alternatives: "Uniform" +# "1/7 Power Law" # Wave characterists -predominant_100year_wave_dir = 0. +predominant_100year_wave_dir = 0.0 max_100year_hs = 0.5 -max_100year_tp = 10. -max_100year_gamma = 1. +max_100year_tp = 10.0 +max_100year_gamma = 1.0 # Wind characteristics mean_100_year_wind_speed = 2.0 @@ -265,20 +274,20 @@ max_100_year_gust_dir = 0.0 # Water level characterists -max_50_year_water_level = 5.0 #water level maximum offset -min_50_year_water_level = 0.0 #water level minimum offset +max_50_year_water_level = 5.0 # water level maximum offset +min_50_year_water_level = 0.0 # water level minimum offset ## CABLE CORRIDOR -startx = 0. -endx = 1000. -dx = 10. +startx = 0.0 +endx = 1000.0 +dx = 10.0 numx = int(float(endx - startx) / dx) -starty = 1000. -endy = 1500. -dy = 10. +starty = 1000.0 +endy = 1500.0 +dy = 10.0 numy = int(float(endy - starty) / dy) + 1 x = np.linspace(startx, endx, numx) @@ -287,180 +296,349 @@ ny = len(y) # Bathymetry -X, Y = np.meshgrid(x,y) -Z = np.zeros(X.shape) - 50. +X, Y = np.meshgrid(x, y) +Z = np.zeros(X.shape) - 50.0 depths = Z.T[:, :, np.newaxis] -sediments = np.chararray((nx,ny,1), itemsize=20) +sediments = np.chararray((nx, ny, 1), itemsize=20) sediments[:] = "loose sand" - -export_strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} -# Soil characteristics -corridor_max_temp = 10. -corridor_max_soil_res = 10. -corridor_target_burial_depth = 20. +export_strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} + +# Soil characteristics +corridor_max_temp = 10.0 +corridor_max_soil_res = 10.0 +corridor_target_burial_depth = 20.0 # Polygons corridor_nogo_areas = None # Tidal flow characteristics -corridor_10year_current = 6. -corridor_10year_current_dir = 0. +corridor_10year_current = 6.0 +corridor_10year_current_dir = 0.0 # Wave characterists -corridor_100year_wave_dir = 0. - +corridor_100year_wave_dir = 0.0 + ## SHORELINE - -landing_point = (0., 1250.) -onshore_infrastructure_cost = 1000000. - + +landing_point = (0.0, 1250.0) +onshore_infrastructure_cost = 1000000.0 + # MACHINE -X = np.array([ 0. , 0.1010101 , 0.2020202 , 0.3030303 , - 0.4040404 , 0.50505051, 0.60606061, 0.70707071, - 0.80808081, 0.90909091, 1.01010101, 1.11111111, - 1.21212121, 1.31313131, 1.41414141, 1.51515152, - 1.61616162, 1.71717172, 1.81818182, 1.91919192, - 2.02020202, 2.12121212, 2.22222222, 2.32323232, - 2.42424242, 2.52525253, 2.62626263, 2.72727273, - 2.82828283, 2.92929293, 3.03030303, 3.13131313, - 3.23232323, 3.33333333, 3.43434343, 3.53535354, - 3.63636364, 3.73737374, 3.83838384, 3.93939394, - 4.04040404, 4.14141414, 4.24242424, 4.34343434, - 4.44444444, 4.54545455, 4.64646465, 4.74747475, - 4.84848485, 4.94949495, 5.05050505, 5.15151515, - 5.25252525, 5.35353535, 5.45454545, 5.55555556, - 5.65656566, 5.75757576, 5.85858586, 5.95959596, - 6.06060606, 6.16161616, 6.26262626, 6.36363636, - 6.46464646, 6.56565657, 6.66666667, 6.76767677, - 6.86868687, 6.96969697, 7.07070707, 7.17171717, - 7.27272727, 7.37373737, 7.47474747, 7.57575758, - 7.67676768, 7.77777778, 7.87878788, 7.97979798, - 8.08080808, 8.18181818, 8.28282828, 8.38383838, - 8.48484848, 8.58585859, 8.68686869, 8.78787879, - 8.88888889, 8.98989899, 9.09090909, 9.19191919, - 9.29292929, 9.39393939, 9.49494949, 9.5959596 , - 9.6969697 , 9.7979798 , 9.8989899 , 10. ]) - -Cp = np.array([ 0. , 0. , 0. , 0. , 0. , - 0. , 0. , 0. , 0. , 0. , - 0.00248182, 0.0273 , 0.05211818, 0.07693636, 0.10175455, - 0.12657273, 0.15139091, 0.17620909, 0.20102727, 0.22584545, - 0.25066364, 0.27548182, 0.3003 , 0.32511818, 0.34993636, - 0.37475455, 0.39957273, 0.42439091, 0.44920909, 0.47402727, - 0.49884545, 0.52366364, 0.54848182, 0.5733 , 0.59811818, - 0.62293636, 0.64775455, 0.67257273, 0.69739091, 0.72220909, - 0.74702727, 0.77184545, 0.79666364, 0.82148182, 0.8463 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 - ]) - -Ct = 0.4*np.ones((100)) +X = np.array( + [ + 0.0, + 0.1010101, + 0.2020202, + 0.3030303, + 0.4040404, + 0.50505051, + 0.60606061, + 0.70707071, + 0.80808081, + 0.90909091, + 1.01010101, + 1.11111111, + 1.21212121, + 1.31313131, + 1.41414141, + 1.51515152, + 1.61616162, + 1.71717172, + 1.81818182, + 1.91919192, + 2.02020202, + 2.12121212, + 2.22222222, + 2.32323232, + 2.42424242, + 2.52525253, + 2.62626263, + 2.72727273, + 2.82828283, + 2.92929293, + 3.03030303, + 3.13131313, + 3.23232323, + 3.33333333, + 3.43434343, + 3.53535354, + 3.63636364, + 3.73737374, + 3.83838384, + 3.93939394, + 4.04040404, + 4.14141414, + 4.24242424, + 4.34343434, + 4.44444444, + 4.54545455, + 4.64646465, + 4.74747475, + 4.84848485, + 4.94949495, + 5.05050505, + 5.15151515, + 5.25252525, + 5.35353535, + 5.45454545, + 5.55555556, + 5.65656566, + 5.75757576, + 5.85858586, + 5.95959596, + 6.06060606, + 6.16161616, + 6.26262626, + 6.36363636, + 6.46464646, + 6.56565657, + 6.66666667, + 6.76767677, + 6.86868687, + 6.96969697, + 7.07070707, + 7.17171717, + 7.27272727, + 7.37373737, + 7.47474747, + 7.57575758, + 7.67676768, + 7.77777778, + 7.87878788, + 7.97979798, + 8.08080808, + 8.18181818, + 8.28282828, + 8.38383838, + 8.48484848, + 8.58585859, + 8.68686869, + 8.78787879, + 8.88888889, + 8.98989899, + 9.09090909, + 9.19191919, + 9.29292929, + 9.39393939, + 9.49494949, + 9.5959596, + 9.6969697, + 9.7979798, + 9.8989899, + 10.0, + ] +) + +Cp = np.array( + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.00248182, + 0.0273, + 0.05211818, + 0.07693636, + 0.10175455, + 0.12657273, + 0.15139091, + 0.17620909, + 0.20102727, + 0.22584545, + 0.25066364, + 0.27548182, + 0.3003, + 0.32511818, + 0.34993636, + 0.37475455, + 0.39957273, + 0.42439091, + 0.44920909, + 0.47402727, + 0.49884545, + 0.52366364, + 0.54848182, + 0.5733, + 0.59811818, + 0.62293636, + 0.64775455, + 0.67257273, + 0.69739091, + 0.72220909, + 0.74702727, + 0.77184545, + 0.79666364, + 0.82148182, + 0.8463, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + ] +) -# Performance curves are matched to the same veloity abscissae -tidal_performance = {"Velocity": X, - "Coefficient of Power": Cp, - "Coefficient of Thrust": Ct} +Ct = 0.4 * np.ones((100)) -# Device characterists -turbine_hub_height = 20. -rotor_diam = 18. +# Performance curves are matched to the same veloity abscissae +tidal_performance = { + "Velocity": X, + "Coefficient of Power": Cp, + "Coefficient of Thrust": Ct, +} + +# Device characterists +turbine_hub_height = 20.0 +rotor_diam = 18.0 turbine_interdist = None min_install = -np.inf -max_install = -40. -min_dist_x = 200. -min_dist_y = 200. +max_install = -40.0 +min_dist_x = 200.0 +min_dist_y = 200.0 bidirection = True -rated_power_device = 1. -device_voltage= 10. -yaw_angle = 0. -cut_in = 1. -cut_out = 5. -connection = 'Wet-Mate' -footprint_radius = 20. +rated_power_device = 1.0 +device_voltage = 10.0 +yaw_angle = 0.0 +cut_in = 1.0 +cut_out = 5.0 +connection = "Wet-Mate" +footprint_radius = 20.0 device_draft = None umbilical_connection = None umbilical_safety = None power_factor = 0.98 - -sys_prof = "Cylindrical" #device profile options: "Cylindrical" "Rectangular" -sys_mass = 300.0e3 #device mass -sys_cog = [0.0, 0.0, 15.0] #device centre of gravity -sys_vol = 148.44 #device displaced volume -sys_height = 21.0 #device height -sys_width = 3.0 #device width -sys_length = 3.0 #device length -sys_dry_frontal = 0.0 #device dry frontal area -sys_dry_beam = 0.0 #device dry beam area -sys_wet_frontal = 63.0 #device wet frontal area -sys_wet_beam = 63.0 #device wet beam area -sys_rough = 0.9e-2 #device surface roughness - -#predefined foundation type: Shallow, Gravity, Pile, Suction Caisson, - # Direct Embedment, Drag -prefound = None - -#foundation locations (from device origin) -found_loc = np.array([[-10.0, -10.0, 0.0], - [-10.0, 10.0, 0.0], - [ 10.0, 10.0, 0.0], - [ 10.0, -10.0, 0.0]]) - + +sys_prof = "Cylindrical" # device profile options: "Cylindrical" "Rectangular" +sys_mass = 300.0e3 # device mass +sys_cog = [0.0, 0.0, 15.0] # device centre of gravity +sys_vol = 148.44 # device displaced volume +sys_height = 21.0 # device height +sys_width = 3.0 # device width +sys_length = 3.0 # device length +sys_dry_frontal = 0.0 # device dry frontal area +sys_dry_beam = 0.0 # device dry beam area +sys_wet_frontal = 63.0 # device wet frontal area +sys_wet_beam = 63.0 # device wet beam area +sys_rough = 0.9e-2 # device surface roughness + +# predefined foundation type: Shallow, Gravity, Pile, Suction Caisson, +# Direct Embedment, Drag +prefound = None + +# foundation locations (from device origin) +found_loc = np.array( + [ + [-10.0, -10.0, 0.0], + [-10.0, 10.0, 0.0], + [10.0, 10.0, 0.0], + [10.0, -10.0, 0.0], + ] +) + # ARRAY LAYOUT -user_array_option = 'Staggered' +user_array_option = "Staggered" -#pos = [(1250., 500.), +# pos = [(1250., 500.), # (1750., 500.), # (1500., 1250.), # (1250., 2000.), # (1750, 2000.)] -# -#user_array_layout = np.array(pos) +# +# user_array_layout = np.array(pos) main_direction = None -rated_array_power = 5. +rated_array_power = 5.0 ## ELECTRICAL NETWORK # Farm devices_per_string = 10 network_configuration = ["Radial"] -min_voltage = 15. -max_voltage = 30. +min_voltage = 15.0 +max_voltage = 30.0 connector_type = "Wet-Mate" collection_point_type = "Subsea" # Corridor -corridor_voltage = 120. +corridor_voltage = 120.0 number_of_export_cables = None ## FOUNDATIONS -found_safety = 1.5 #foundation safety factor -grout_safety = 6.0 #grout safety factor -fab_cost = None # 1.0 #optional fabrication cost factor +found_safety = 1.5 # foundation safety factor +grout_safety = 6.0 # grout safety factor +fab_cost = None # 1.0 #optional fabrication cost factor ## COMPONENT DATA # Electrical -component_data_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(component_data_path, encoding = 'utf-8') +component_data_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(component_data_path) sheet_names = xls_file.sheet_names static_cable = xls_file.parse(sheet_names[0]) @@ -470,146 +648,148 @@ transformers = xls_file.parse(sheet_names[4]) collection_points = xls_file.parse(sheet_names[5]) -collection_point_cog = {11: [0,0,0], - 12: [0,0,0], - 22: [0,0,0], - 23: [0,0,0], - 24: [0,0,0], - 25: [0,0,0] - } - -collection_point_found = {11: [0,0,0], - 12: [0,0,0], - 22: [0,0,0], - 23: [0,0,0], - 24: [0,0,0], - 25: [0,0,0] - } - -compat_data_path = os.path.join(elec_dir, - 'equipment_compatibility_matrix.xlsx') -xls_file = pd.ExcelFile(compat_data_path, encoding='utf-8') +collection_point_cog = { + 11: [0, 0, 0], + 12: [0, 0, 0], + 22: [0, 0, 0], + 23: [0, 0, 0], + 24: [0, 0, 0], + 25: [0, 0, 0], +} + +collection_point_found = { + 11: [0, 0, 0], + 12: [0, 0, 0], + 22: [0, 0, 0], + 23: [0, 0, 0], + 24: [0, 0, 0], + 25: [0, 0, 0], +} + +compat_data_path = os.path.join(elec_dir, "equipment_compatibility_matrix.xlsx") +xls_file = pd.ExcelFile(compat_data_path) sheet_names = xls_file.sheet_names -installation_soil_compatibility = xls_file.parse(sheet_names[0], - index_col=None) -installation_soil_compatibility.columns = ['Technique', - 'Loose Sand', - 'Medium Sand', - 'Dense Sand', - 'Very Soft Clay', - 'Soft Clay', - 'Firm Clay', - 'Stiff Clay', - 'Hard Glacial Till', - 'Cemented', - 'Soft Rock Coral', - 'Hard Rock', - 'Gravel Cobble'] - -equipment_gradient_constraint = 14. +installation_soil_compatibility = xls_file.parse(sheet_names[0], index_col=None) +installation_soil_compatibility.columns = [ + "Technique", + "Loose Sand", + "Medium Sand", + "Dense Sand", + "Very Soft Clay", + "Soft Clay", + "Firm Clay", + "Stiff Clay", + "Hard Glacial Till", + "Cemented", + "Soft Rock Coral", + "Hard Rock", + "Gravel Cobble", +] + +equipment_gradient_constraint = 14.0 # Moorings and Foundations -compdict = eval(open(os.path.join(moor_dir, 'dummycompdb.txt')).read()) -comp_tables = get_moorings_tables(compdict) #component database - -cost_steel = 1.0 #steel cost -cost_grout = 0.1 #grout cost -cost_concrete = 0.11 #concrete cost -grout_strength = 125.0 #grout strength +compdict = eval(open(os.path.join(moor_dir, "dummycompdb.txt")).read()) +comp_tables = get_moorings_tables(compdict) # component database + +cost_steel = 1.0 # steel cost +cost_grout = 0.1 # grout cost +cost_concrete = 0.11 # concrete cost +grout_strength = 125.0 # grout strength ## MATERIALS # Foundations -steelden = 7750.0 #steel density -conden = 2400.0 #concrete density -groutden = 2450.0 #grout density +steelden = 7750.0 # steel density +conden = 2400.0 # concrete density +groutden = 2450.0 # grout density # Substrate -draincoh = 0.0 #drained soil cohesion -unsfang = 5.0 #undrained soil friction angle -dsfang = 35.0 #drained soil friction angle -soilweight = 9.4285e+03 #buoyant soil weight -relsoilden = 50.0 #relative soil density +draincoh = 0.0 # drained soil cohesion +unsfang = 5.0 # undrained soil friction angle +dsfang = 35.0 # drained soil friction angle +soilweight = 9.4285e03 # buoyant soil weight +relsoilden = 50.0 # relative soil density undrained_soil_shear_strength_constant = 1.45e3 -undrained_soil_shear_strength_dependent = 2e3 #undrained shear friction angle -soilsen = 3.0 #soil sensitivity -rockcomstr = 206843.0 #rock compressive strength +undrained_soil_shear_strength_dependent = 2e3 # undrained shear friction angle +soilsen = 3.0 # soil sensitivity +rockcomstr = 206843.0 # rock compressive strength # default soil properties table -soilprops = pd.read_csv(os.path.join(moor_dir, 'soilprops.txt'), - sep='\t', - header=0, - index_col=False) +soilprops = pd.read_csv( + os.path.join(moor_dir, "soilprops.txt"), sep="\t", header=0, index_col=False +) # buried line bearing capacity factors -line_bcf = [[20, 3], - [25, 5], - [30, 8], - [35, 12], - [40, 22], - [45, 36]] - -#subgrade reaction coefficients -k1coeff = [[1, 100, 200], - [2, 57, 119], - [3, 45.75, 94], - [4, 34.5, 69], - [5, 30.75, 56], - [6, 27, 43], - [7, 25.25, 38], - [8, 23.5, 33], - [9, 22.25, 29], - [10, 21, 25], - [11, 19.75, 22.5], - [12, 18.5, 20], - [13, 17.75, 19], - [14, 17, 18], - [15, 16.5, 17.5], - [16, 16, 17], - [17, 15.75, 16.75], - [18, 15.5, 16.5], - [19, 15.25, 16.25], - [20, 15, 16]] - -#subgrade soil reaction coefficients cohesionless -subgradereaccoef = [[0.5, 4886048.0, 12893739.0, 24158795.0, 32573656.0], - [1.0, 3800260.0, 10043544.0, 17644064.0, 24430242.0], - [1.5, 3257366.0, 7464796.0, 14115251.0, 19272747.0], - [2.0, 2850195.0, 6107561.0, 11672227.0, 16286828.0], - [2.5, 2443024.0, 5428943.0, 10179268.0, 14658145.0], - [3.0, 2171577.0, 5021772.0, 9229203.0, 13300910.0], - [3.5, 2035854.0, 4750325.0, 8414861.0, 11943674.0], - [4.0, 1764406.0, 4411016.0, 7736243.0, 10857885.0], - [4.5, 1628683.0, 4139569.0, 7193349.0, 10043544.0], - [5.0, 1560821.0, 3935983.0, 6650455.0, 9229203.0], - [5.5, 1425097.0, 3732398.0, 6107561.0, 8686308.0], - [6.0, 1357236.0, 3596675.0, 5768252.0, 8143414.0], - [6.5, 1289374.0, 3393089.0, 5361081.0, 7736243.0], - [7.0, 1221512.0, 3257366.0, 5021772.0, 7261211.0], - [7.5, 1153650.0, 3053780.0, 4818187.0, 6854040.0], - [8.0, 1085789.0, 2850195.0, 4614601.0, 6514731.0], - [8.5, 1017927.0, 2646610.0, 4411016.0, 6243284.0], - [9.0, 950065.0, 2443024.0, 4207431.0, 5971837.0], - [9.5, 814341.0, 2307301.0, 4003845.0, 5700390.0], - [10.0, 678618.0, 2239439.0, 3868122.0, 5428943.0]] - -#pile deflection coefficients -piledefcoef = [[2.0, 4.65, 3.4], - [2.25, 3.51, 2.4], - [2.5, 2.95, 2.05], - [2.75, 2.77, 1.85], - [3.0, 2.75, 1.8], - [3.25, 2.73, 1.77], - [3.5, 2.7, 1.75], - [3.75, 2.67, 1.72], - [4.0, 2.65, 1.7], - [4.25, 2.637, 1.7], - [4.5, 2.63, 1.7], - [4.75, 2.62, 1.7], - [5.0, 2.61, 1.7]] - -#pile moment coefficients am +line_bcf = [[20, 3], [25, 5], [30, 8], [35, 12], [40, 22], [45, 36]] + +# subgrade reaction coefficients +k1coeff = [ + [1, 100, 200], + [2, 57, 119], + [3, 45.75, 94], + [4, 34.5, 69], + [5, 30.75, 56], + [6, 27, 43], + [7, 25.25, 38], + [8, 23.5, 33], + [9, 22.25, 29], + [10, 21, 25], + [11, 19.75, 22.5], + [12, 18.5, 20], + [13, 17.75, 19], + [14, 17, 18], + [15, 16.5, 17.5], + [16, 16, 17], + [17, 15.75, 16.75], + [18, 15.5, 16.5], + [19, 15.25, 16.25], + [20, 15, 16], +] + +# subgrade soil reaction coefficients cohesionless +subgradereaccoef = [ + [0.5, 4886048.0, 12893739.0, 24158795.0, 32573656.0], + [1.0, 3800260.0, 10043544.0, 17644064.0, 24430242.0], + [1.5, 3257366.0, 7464796.0, 14115251.0, 19272747.0], + [2.0, 2850195.0, 6107561.0, 11672227.0, 16286828.0], + [2.5, 2443024.0, 5428943.0, 10179268.0, 14658145.0], + [3.0, 2171577.0, 5021772.0, 9229203.0, 13300910.0], + [3.5, 2035854.0, 4750325.0, 8414861.0, 11943674.0], + [4.0, 1764406.0, 4411016.0, 7736243.0, 10857885.0], + [4.5, 1628683.0, 4139569.0, 7193349.0, 10043544.0], + [5.0, 1560821.0, 3935983.0, 6650455.0, 9229203.0], + [5.5, 1425097.0, 3732398.0, 6107561.0, 8686308.0], + [6.0, 1357236.0, 3596675.0, 5768252.0, 8143414.0], + [6.5, 1289374.0, 3393089.0, 5361081.0, 7736243.0], + [7.0, 1221512.0, 3257366.0, 5021772.0, 7261211.0], + [7.5, 1153650.0, 3053780.0, 4818187.0, 6854040.0], + [8.0, 1085789.0, 2850195.0, 4614601.0, 6514731.0], + [8.5, 1017927.0, 2646610.0, 4411016.0, 6243284.0], + [9.0, 950065.0, 2443024.0, 4207431.0, 5971837.0], + [9.5, 814341.0, 2307301.0, 4003845.0, 5700390.0], + [10.0, 678618.0, 2239439.0, 3868122.0, 5428943.0], +] + +# pile deflection coefficients +piledefcoef = [ + [2.0, 4.65, 3.4], + [2.25, 3.51, 2.4], + [2.5, 2.95, 2.05], + [2.75, 2.77, 1.85], + [3.0, 2.75, 1.8], + [3.25, 2.73, 1.77], + [3.5, 2.7, 1.75], + [3.75, 2.67, 1.72], + [4.0, 2.65, 1.7], + [4.25, 2.637, 1.7], + [4.5, 2.63, 1.7], + [4.75, 2.62, 1.7], + [5.0, 2.61, 1.7], +] + +# pile moment coefficients am pilemomcoefam = [ [0, 0, 0, 0, 0, 0], [0.25, 0.255751417, 0.255752104, 0.25576445, 0.243605698, 0.227417941], @@ -629,10 +809,10 @@ [3.75, 0.03435529, 0.048391189, 0.023458111, 0, 0], [4, -0.008, 0.021, 0.008, 0, 0], [4.25, -0.04560529, 0.004858811, 0, 0, 0], - [4.5, -0.076, 0.003, 0, 0, 0] - ] - -#pile moment coefficients bm + [4.5, -0.076, 0.003, 0, 0, 0], +] + +# pile moment coefficients bm pilemomcoefbm = [ [0, 1, 1, 1, 1, 1], [0.25, 0.987315551, 0.987332937, 0.98122151, 0.992090215, 0.969472347], @@ -652,16 +832,18 @@ [3.75, -0.099507477, -0.047911693, 0.003155466, 0, 0], [4, -0.111648, -0.044108, -0.000686, 0, 0], [4.25, -0.111554773, -0.028243057, 0, 0, 0], - [4.5, -0.102084, -0.001464, 0, 0, 0] - ] - -#pile limiting values non calcaeous soils -pilefricresnoncal = [[35, 30, 40, 95.761e3, 9576.051e3], - [30, 25, 20, 81.396e3, 4788.026e3], - [25, 20, 12, 67.032e3, 2872.815e3], - [20, 15, 8, 47.880e3, 1915.210e3]] - -#plate anchor holding capacity factors + [4.5, -0.102084, -0.001464, 0, 0, 0], +] + +# pile limiting values non calcaeous soils +pilefricresnoncal = [ + [35, 30, 40, 95.761e3, 9576.051e3], + [30, 25, 20, 81.396e3, 4788.026e3], + [25, 20, 12, 67.032e3, 2872.815e3], + [20, 15, 8, 47.880e3, 1915.210e3], +] + +# plate anchor holding capacity factors hcfdrsoil = [ [1.0, 1.638945315, 1.994698838, 2.307140604, 2.784, 3.396946397], [2.0, 2.250880594, 3.062312263, 3.879752818, 5.05497647, 6.628796215], @@ -675,39 +857,39 @@ [10.0, 3.345993542, 5.688597794, 11.18491233, 21.95043482, 50.76899705], [11.0, 3.396495827, 5.789632743, 11.47106897, 22.74735899, 53.1019566], [12.0, 3.446998112, 5.890667693, 11.75722561, 23.54428317, 55.43491614], - [13.0, 3.497500397, 5.991702643, 12.04338224, 24.34120734, 57.76787568] - ] - - + [13.0, 3.497500397, 5.991702643, 12.04338224, 24.34120734, 57.76787568], +] + + # ENVIRONMENTAL INPUT table_path = os.path.join(env_dir, "species_protected.csv") protected_table = pd.read_csv(table_path, index_col=None) -name_map1 ={ "subclass or group" : "Subclass or Group", - "observed" : "Observed"} +name_map1 = {"subclass or group": "Subclass or Group", "observed": "Observed"} protected_table = protected_table.rename(columns=name_map1) -print protected_table +print(protected_table) table_path = os.path.join(env_dir, "species_receptors.csv") receptors_table = pd.read_csv(table_path, index_col=None) -name_map2 ={ "subclass or group" : "Subclass or Group", - "observed" : "Observed", - "observed january" : "Observed January", - "observed february" : "Observed February", - "observed march" : "Observed March", - "observed april" : "Observed April", - "observed may" : "Observed May", - "observed june" : "Observed June", - "observed july" : "Observed July", - "observed august" : "Observed August", - "observed september" : "Observed September", - "observed october" : "Observed October", - "observed november" : "Observed November", - "observed december" : "Observed December" - } - +name_map2 = { + "subclass or group": "Subclass or Group", + "observed": "Observed", + "observed january": "Observed January", + "observed february": "Observed February", + "observed march": "Observed March", + "observed april": "Observed April", + "observed may": "Observed May", + "observed june": "Observed June", + "observed july": "Observed July", + "observed august": "Observed August", + "observed september": "Observed September", + "observed october": "Observed October", + "observed november": "Observed November", + "observed december": "Observed December", +} + receptors_table = receptors_table.rename(columns=name_map2) hydro_energy_modif_weight = "Gravel Cobble" @@ -724,182 +906,176 @@ hydro_resting_place_weight = "Blades" -initial_turbidity =50 +initial_turbidity = 50 hydro_measured_turbidity = 70 -initial_noise =60 +initial_noise = 60 hydro_measured_noise = 151 elec_measured_noise = 151 moor_measured_noise = 151 initial_elec_field = 60 -elec_measured_elec_field =1000 -initial_magnetic_field =60 +elec_measured_elec_field = 1000 +initial_magnetic_field = 60 elec_measured_magnetic_field = 1000 initial_temeprature = 15 elec_measured_temperature = 18 -fishery_restricted_area = 1000. +fishery_restricted_area = 1000.0 # SOLVER OPTIONS -op_threshold = 0. +op_threshold = 0.0 # LOAD VARIABLES test_data = { - "bathymetry.layers": strata, - "constants.line_bearing_capacity_factor": line_bcf, - "constants.pile_Am_moment_coefficient": pilemomcoefam, - "constants.pile_Bm_moment_coefficient": pilemomcoefbm, - "constants.pile_deflection_coefficients": piledefcoef, - "constants.pile_skin_friction_end_bearing_capacity": pilefricresnoncal, - "constants.soil_cohesionless_reaction_coefficient": subgradereaccoef, - "constants.soil_cohesive_reaction_coefficient": k1coeff, - "constants.soil_drained_holding_capacity_factor": hcfdrsoil, - "farm.soil_sensitivity": soilsen, - "constants.soilprops": soilprops, - "constants.gravity": gravity, - "constants.sea_water_density": seaden, - "constants.air_density": airden, - "constants.steel_density": steelden, - "constants.concrete_density": conden, - "constants.grout_density": groutden, - "constants.grout_compressive_strength": grout_strength, - "constants.cylinder_drag": dragcoefcyl, - "constants.cylinder_wake_amplificiation": wakeampfactorcyl, - "constants.rectangular_wind_drag": winddragcoefrect, - "constants.rectangular_current_drag": currentdragcoefrect, - "constants.rectangular_drift": driftcoeffloatrect, - "constants.rectangular_wave_inertia": waveinertiacoefrect, - "corridor.layers": export_strata, - "farm.collection_point_type": collection_point_type, - "farm.connector_type": connector_type, - "component.collection_points": collection_points, - "component.collection_point_cog": collection_point_cog, - "component.collection_point_foundations": collection_point_found, - "component.dry_mate_connectors": dry_mate_connectors, - "component.dynamic_cable": dynamic_cable, - "project.equipment_gradient_constraint": equipment_gradient_constraint, - "component.installation_soil_compatibility": installation_soil_compatibility, - "component.static_cable": static_cable, - "component.transformers": transformers, - "component.wet_mate_connectors": wet_mate_connectors, - "project.fabrication_cost": fab_cost, - "corridor.number_of_export_cables": number_of_export_cables, - "project.export_voltage": corridor_voltage, - "corridor.landing_point": landing_point, - "corridor.nogo_areas": corridor_nogo_areas, - "project.export_target_burial_depth": corridor_target_burial_depth, - "device.bidirection": bidirection, - "device.connector_type": connection, - "device.turbine_hub_height": turbine_hub_height, - "device.cut_in_velocity": cut_in, - "device.cut_out_velocity": cut_out, - "device.installation_depth_max": max_install, - "device.installation_depth_min": min_install, - "device.minimum_distance_x": min_dist_x, - "device.minimum_distance_y": min_dist_y, - "device.constant_power_factor": power_factor, - "device.power_rating": rated_power_device, - "device.prescribed_footprint_radius": footprint_radius, - "device.system_draft": device_draft, - "device.turbine_diameter": rotor_diam, - "device.turbine_interdistance": turbine_interdist, - "device.turbine_performance": tidal_performance, - "device.umbilical_connection_point": umbilical_connection, - "project.umbilical_safety_factor": umbilical_safety, - "device.voltage": device_voltage, - "device.yaw": yaw_angle, - "device.dry_beam_area": sys_dry_beam, - "device.dry_frontal_area": sys_dry_frontal, - "device.foundation_location": found_loc, - "project.foundation_safety_factor": found_safety, - "device.foundation_type": prefound, - "device.system_centre_of_gravity": sys_cog, - "device.system_displaced_volume": sys_vol, - "device.system_height": sys_height, - "device.system_length": sys_length, - "device.system_mass": sys_mass, - "device.system_profile": sys_prof, - "device.system_roughness": sys_rough, - "device.system_width": sys_width, - "device.wet_beam_area": sys_wet_beam, - "device.wet_frontal_area": sys_wet_frontal, - "farm.blockage_ratio": blockage_ratio, - "project.devices_per_string": devices_per_string, - "farm.direction_of_max_surface_current": max_10year_current_dir, - "project.main_direction": main_direction, - "farm.max_surface_current_10_year": max_10year_current, - "project.network_configuration": network_configuration, - "farm.nogo_areas": nogo_areas, - "project.onshore_infrastructure_cost": onshore_infrastructure_cost, -# "farm.power_law_exponent": power_law_exponent, - "project.rated_power": rated_array_power, - "project.target_burial_depth": target_burial_depth, - "project.tidal_occurrence_nbins": n_bins, - "farm.tidal_occurrence_point": tidal_point, - "farm.tidal_series": tidal_series_raw, - "farm.wave_direction_100_year": predominant_100year_wave_dir, - "farm.current_profile": current_profile, - "project.grout_strength_safety_factor": grout_safety, - "farm.max_gust_wind_direction_100_year": max_100_year_gust_dir, - "farm.max_gust_wind_speed_100_year": max_100_year_gust_speed, - "farm.max_hs_100_year": max_100year_hs, - "farm.max_tp_100_year": max_100year_tp, - "farm.max_water_level_50_year": max_50_year_water_level, - "farm.mean_wind_direction_100_year": mean_100_year_wind_dir, - "farm.mean_wind_speed_100_year": mean_100_year_wind_speed, - "farm.min_water_level_50_year": min_50_year_water_level, - "farm.wave_gamma_100_year": max_100year_gamma, - - "farm.protected_table" : protected_table, - "farm.receptors_table" : receptors_table, - "farm.hydro_energy_modif_weight" : hydro_energy_modif_weight, - "farm.hydro_collision_risk_weight" : hydro_collision_risk_weight, - "farm.hydro_turbidity_risk_weight" : hydro_turbidity_risk_weight, - "device.hydro_underwater_noise_risk_weight" : hydro_underwater_noise_risk_weight, - "farm.hydro_reserve_effect_weight" : hydro_reserve_effect_weight, - "device.hydro_reef_effect_weight" : hydro_reef_effect_weight, - "device.hydro_resting_place_weight" : hydro_resting_place_weight, - "farm.initial_turbidity" : initial_turbidity, - "project.hydro_measured_turbidity" : hydro_measured_turbidity, - "farm.initial_noise" : initial_noise, - "project.hydro_measured_noise" : hydro_measured_noise, - "project.elec_measured_noise" : elec_measured_noise, - "project.moor_measured_noise" : moor_measured_noise, - "project.fishery_restricted_area" : fishery_restricted_area, - "farm.initial_elec_field" : initial_elec_field, - "project.elec_measured_elec_field" : elec_measured_elec_field, - "farm.initial_magnetic_field" : initial_magnetic_field, - "project.elec_measured_magnetic_field" : elec_measured_magnetic_field, - "farm.initial_temperature" : initial_temeprature, - "project.elec_measured_temperature" : elec_measured_temperature, - - - - "project.cost_of_concrete": cost_concrete, - "project.cost_of_grout": cost_grout, - "project.cost_of_steel": cost_steel, - "options.optimisation_threshold": op_threshold, - "options.boundary_padding" : boundary_padding, -# "options.user_array_layout": user_array_layout, - "options.user_array_option": user_array_option, - "site.lease_boundary": lease_area, - 'component.foundations_anchor': comp_tables["drag anchor"], - 'component.foundations_pile': comp_tables["pile"], - 'component.foundations_anchor_sand': comp_tables["drag anchor sand"], - 'component.foundations_anchor_soft': comp_tables["drag anchor soft"] - } - + "bathymetry.layers": strata, + "constants.line_bearing_capacity_factor": line_bcf, + "constants.pile_Am_moment_coefficient": pilemomcoefam, + "constants.pile_Bm_moment_coefficient": pilemomcoefbm, + "constants.pile_deflection_coefficients": piledefcoef, + "constants.pile_skin_friction_end_bearing_capacity": pilefricresnoncal, + "constants.soil_cohesionless_reaction_coefficient": subgradereaccoef, + "constants.soil_cohesive_reaction_coefficient": k1coeff, + "constants.soil_drained_holding_capacity_factor": hcfdrsoil, + "farm.soil_sensitivity": soilsen, + "constants.soilprops": soilprops, + "constants.gravity": gravity, + "constants.sea_water_density": seaden, + "constants.air_density": airden, + "constants.steel_density": steelden, + "constants.concrete_density": conden, + "constants.grout_density": groutden, + "constants.grout_compressive_strength": grout_strength, + "constants.cylinder_drag": dragcoefcyl, + "constants.cylinder_wake_amplificiation": wakeampfactorcyl, + "constants.rectangular_wind_drag": winddragcoefrect, + "constants.rectangular_current_drag": currentdragcoefrect, + "constants.rectangular_drift": driftcoeffloatrect, + "constants.rectangular_wave_inertia": waveinertiacoefrect, + "corridor.layers": export_strata, + "farm.collection_point_type": collection_point_type, + "farm.connector_type": connector_type, + "component.collection_points": collection_points, + "component.collection_point_cog": collection_point_cog, + "component.collection_point_foundations": collection_point_found, + "component.dry_mate_connectors": dry_mate_connectors, + "component.dynamic_cable": dynamic_cable, + "project.equipment_gradient_constraint": equipment_gradient_constraint, + "component.installation_soil_compatibility": installation_soil_compatibility, + "component.static_cable": static_cable, + "component.transformers": transformers, + "component.wet_mate_connectors": wet_mate_connectors, + "project.fabrication_cost": fab_cost, + "corridor.number_of_export_cables": number_of_export_cables, + "project.export_voltage": corridor_voltage, + "corridor.landing_point": landing_point, + "corridor.nogo_areas": corridor_nogo_areas, + "project.export_target_burial_depth": corridor_target_burial_depth, + "device.bidirection": bidirection, + "device.connector_type": connection, + "device.turbine_hub_height": turbine_hub_height, + "device.cut_in_velocity": cut_in, + "device.cut_out_velocity": cut_out, + "device.installation_depth_max": max_install, + "device.installation_depth_min": min_install, + "device.minimum_distance_x": min_dist_x, + "device.minimum_distance_y": min_dist_y, + "device.constant_power_factor": power_factor, + "device.power_rating": rated_power_device, + "device.prescribed_footprint_radius": footprint_radius, + "device.system_draft": device_draft, + "device.turbine_diameter": rotor_diam, + "device.turbine_interdistance": turbine_interdist, + "device.turbine_performance": tidal_performance, + "device.umbilical_connection_point": umbilical_connection, + "project.umbilical_safety_factor": umbilical_safety, + "device.voltage": device_voltage, + "device.yaw": yaw_angle, + "device.dry_beam_area": sys_dry_beam, + "device.dry_frontal_area": sys_dry_frontal, + "device.foundation_location": found_loc, + "project.foundation_safety_factor": found_safety, + "device.foundation_type": prefound, + "device.system_centre_of_gravity": sys_cog, + "device.system_displaced_volume": sys_vol, + "device.system_height": sys_height, + "device.system_length": sys_length, + "device.system_mass": sys_mass, + "device.system_profile": sys_prof, + "device.system_roughness": sys_rough, + "device.system_width": sys_width, + "device.wet_beam_area": sys_wet_beam, + "device.wet_frontal_area": sys_wet_frontal, + "farm.blockage_ratio": blockage_ratio, + "project.devices_per_string": devices_per_string, + "farm.direction_of_max_surface_current": max_10year_current_dir, + "project.main_direction": main_direction, + "farm.max_surface_current_10_year": max_10year_current, + "project.network_configuration": network_configuration, + "farm.nogo_areas": nogo_areas, + "project.onshore_infrastructure_cost": onshore_infrastructure_cost, + # "farm.power_law_exponent": power_law_exponent, + "project.rated_power": rated_array_power, + "project.target_burial_depth": target_burial_depth, + "project.tidal_occurrence_nbins": n_bins, + "farm.tidal_occurrence_point": tidal_point, + "farm.tidal_series": tidal_series_raw, + "farm.wave_direction_100_year": predominant_100year_wave_dir, + "farm.current_profile": current_profile, + "project.grout_strength_safety_factor": grout_safety, + "farm.max_gust_wind_direction_100_year": max_100_year_gust_dir, + "farm.max_gust_wind_speed_100_year": max_100_year_gust_speed, + "farm.max_hs_100_year": max_100year_hs, + "farm.max_tp_100_year": max_100year_tp, + "farm.max_water_level_50_year": max_50_year_water_level, + "farm.mean_wind_direction_100_year": mean_100_year_wind_dir, + "farm.mean_wind_speed_100_year": mean_100_year_wind_speed, + "farm.min_water_level_50_year": min_50_year_water_level, + "farm.wave_gamma_100_year": max_100year_gamma, + "farm.protected_table": protected_table, + "farm.receptors_table": receptors_table, + "farm.hydro_energy_modif_weight": hydro_energy_modif_weight, + "farm.hydro_collision_risk_weight": hydro_collision_risk_weight, + "farm.hydro_turbidity_risk_weight": hydro_turbidity_risk_weight, + "device.hydro_underwater_noise_risk_weight": hydro_underwater_noise_risk_weight, + "farm.hydro_reserve_effect_weight": hydro_reserve_effect_weight, + "device.hydro_reef_effect_weight": hydro_reef_effect_weight, + "device.hydro_resting_place_weight": hydro_resting_place_weight, + "farm.initial_turbidity": initial_turbidity, + "project.hydro_measured_turbidity": hydro_measured_turbidity, + "farm.initial_noise": initial_noise, + "project.hydro_measured_noise": hydro_measured_noise, + "project.elec_measured_noise": elec_measured_noise, + "project.moor_measured_noise": moor_measured_noise, + "project.fishery_restricted_area": fishery_restricted_area, + "farm.initial_elec_field": initial_elec_field, + "project.elec_measured_elec_field": elec_measured_elec_field, + "farm.initial_magnetic_field": initial_magnetic_field, + "project.elec_measured_magnetic_field": elec_measured_magnetic_field, + "farm.initial_temperature": initial_temeprature, + "project.elec_measured_temperature": elec_measured_temperature, + "project.cost_of_concrete": cost_concrete, + "project.cost_of_grout": cost_grout, + "project.cost_of_steel": cost_steel, + "options.optimisation_threshold": op_threshold, + "options.boundary_padding": boundary_padding, + # "options.user_array_layout": user_array_layout, + "options.user_array_option": user_array_option, + "site.lease_boundary": lease_area, + "component.foundations_anchor": comp_tables["drag anchor"], + "component.foundations_pile": comp_tables["pile"], + "component.foundations_anchor_sand": comp_tables["drag anchor sand"], + "component.foundations_anchor_soft": comp_tables["drag anchor soft"], +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/example_data/fixed_wave_fixed_layout_scenario.py b/packages/dtocean-core/example_data/fixed_wave_fixed_layout_scenario.py index 5984e97..06b8151 100644 --- a/packages/dtocean-core/example_data/fixed_wave_fixed_layout_scenario.py +++ b/packages/dtocean-core/example_data/fixed_wave_fixed_layout_scenario.py @@ -710,5 +710,5 @@ file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/example_data/fixed_wave_staggered_layout_scenario.py b/packages/dtocean-core/example_data/fixed_wave_staggered_layout_scenario.py index 7d932e1..b0f32b7 100644 --- a/packages/dtocean-core/example_data/fixed_wave_staggered_layout_scenario.py +++ b/packages/dtocean-core/example_data/fixed_wave_staggered_layout_scenario.py @@ -808,5 +808,5 @@ file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/example_data/floating_wave_fixed_layout_scenario.py b/packages/dtocean-core/example_data/floating_wave_fixed_layout_scenario.py index f8172c6..a68c719 100644 --- a/packages/dtocean-core/example_data/floating_wave_fixed_layout_scenario.py +++ b/packages/dtocean-core/example_data/floating_wave_fixed_layout_scenario.py @@ -739,5 +739,5 @@ file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/example_data/floating_wave_staggered_layout_scenario.py b/packages/dtocean-core/example_data/floating_wave_staggered_layout_scenario.py index 945942b..c39f699 100644 --- a/packages/dtocean-core/example_data/floating_wave_staggered_layout_scenario.py +++ b/packages/dtocean-core/example_data/floating_wave_staggered_layout_scenario.py @@ -833,5 +833,5 @@ file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/example_data/inputs_plots.py b/packages/dtocean-core/example_data/inputs_plots.py index 09011d4..aca6dd5 100644 --- a/packages/dtocean-core/example_data/inputs_plots.py +++ b/packages/dtocean-core/example_data/inputs_plots.py @@ -241,5 +241,5 @@ file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/src/dtocean_core/core.py b/packages/dtocean-core/src/dtocean_core/core.py index 6ac1288..167df54 100644 --- a/packages/dtocean-core/src/dtocean_core/core.py +++ b/packages/dtocean-core/src/dtocean_core/core.py @@ -1155,7 +1155,7 @@ def load_datastate(self, project, load_path, exclude=None, overwrite=True): with open(load_path, "rb") as json_file: dump_dict = json.load(json_file) - state_data = dump_dict["data"] + state_data: dict = dump_dict["data"] # Now unpickle the pool pool_file_path = os.path.join(dts_dir_path, "pool.pkl") @@ -1180,7 +1180,7 @@ def load_datastate(self, project, load_path, exclude=None, overwrite=True): var_ids = [] var_objs = [] - for var_id, data_index in state_data.iteritems(): + for var_id, data_index in state_data.items(): if not self.is_valid_variable(var_id): msgStr = ( 'Variable ID "{}" is not contained in the data ' "catalog" diff --git a/packages/dtocean-core/src/dtocean_core/utils/execute.py b/packages/dtocean-core/src/dtocean_core/utils/execute.py index 4b60187..7a762a3 100644 --- a/packages/dtocean-core/src/dtocean_core/utils/execute.py +++ b/packages/dtocean-core/src/dtocean_core/utils/execute.py @@ -15,168 +15,168 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import argparse import os import sys import time -import argparse -import warnings import traceback +import warnings from .. import start_logging from ..core import Core -from ..menu import ModuleMenu from ..extensions import StrategyManager +from ..menu import ModuleMenu -def warn_with_traceback(message, - category, - filename, - lineno, - logfile=None, - line=None): - - log = logfile if hasattr(logfile, 'write') else sys.stderr +def warn_with_traceback( + message, category, filename, lineno, logfile=None, line=None +): + log = logfile if hasattr(logfile, "write") else sys.stderr traceback.print_stack(file=log) - log.write(warnings.formatwarning(message, - category, - filename, - lineno, - line)) - + log.write(warnings.formatwarning(message, category, filename, lineno, line)) + return -def main(fpath, - save=True, - full=False, - warn=False, - log=False): - +def main(fpath, save=True, full=False, warn=False, log=False): if full: action_str = "all scheduled modules" else: action_str = "next scheduled module" - + msg_str = "\n>>> Executing {} in project '{}'".format(action_str, fpath) extra_string = "" - + if warn: extra_string += "warning tracebacks" - + if log: if extra_string: extra_string += " and " extra_string += "logging" - + if extra_string: msg_str = "{} with {}".format(msg_str, extra_string) - + msg_str += "\n" - print msg_str - + print(msg_str) + if warn: warnings.showwarning = warn_with_traceback - + if log: start_logging() - + my_core = Core() my_project = my_core.load_project(fpath) - + if full: - strategy_manager = StrategyManager() basic_strategy = strategy_manager.get_strategy("Basic") - + start_time = time.time() basic_strategy.execute(my_core, my_project) - + else: - my_menu = ModuleMenu() - + start_time = time.time() my_menu.execute_current(my_core, my_project) - + msg_str = "\n>>> Execution time: {}s".format(time.time() - start_time) - print msg_str - - if not save: return - - if save is True: + print(msg_str) + + if not save: + return + + if save is True: prepath, ext = os.path.splitext(fpath) save_path = "{}_complete{}".format(prepath, ext) else: save_path = save - + msg_str = "\n>>> Saving project to: {}".format(save_path) - print msg_str - + print(msg_str) + my_core.dump_project(my_project, save_path) - + return def main_interface(): - '''Command line interface for execute_dtocean_project. - + """Command line interface for execute_dtocean_project. + Example: - + To get help:: - + $ python execute_dtocean_project -h - - ''' - - desStr = ("Execute DTOcean .prj project files. By default, the next " - "module scheduled is executed. All scheduled modules can also " - "be run using the appropriate option. Completed simulations are " - "saved to a new project file with '_complete' appended to the " - "file path.") - + + """ + + desStr = ( + "Execute DTOcean .prj project files. By default, the next " + "module scheduled is executed. All scheduled modules can also " + "be run using the appropriate option. Completed simulations are " + "saved to a new project file with '_complete' appended to the " + "file path." + ) + parser = argparse.ArgumentParser(description=desStr) - - parser.add_argument("fpath", - help=("path to DTOcean project file"), - type=str) - - parser.add_argument("-o", "--out", - help=("specify output path for results file"), - type=str, - default=None) - - parser.add_argument("-f", "--full", - help=("execute all scheduled modules"), - action='store_true') - - parser.add_argument("-n", "--no-save", - help=("do not save the results"), - action='store_true') - - parser.add_argument("-w", "--warnings", - help=("show tracebacks for all warnings"), - action='store_true') - - parser.add_argument("-l", "--logging", - help=("activate the DTOcean logging system"), - action='store_true') - + + parser.add_argument( + "fpath", help=("path to DTOcean project file"), type=str + ) + + parser.add_argument( + "-o", + "--out", + help=("specify output path for results file"), + type=str, + default=None, + ) + + parser.add_argument( + "-f", + "--full", + help=("execute all scheduled modules"), + action="store_true", + ) + + parser.add_argument( + "-n", "--no-save", help=("do not save the results"), action="store_true" + ) + + parser.add_argument( + "-w", + "--warnings", + help=("show tracebacks for all warnings"), + action="store_true", + ) + + parser.add_argument( + "-l", + "--logging", + help=("activate the DTOcean logging system"), + action="store_true", + ) + args = parser.parse_args() - + fpath = args.fpath rpath = args.out full = args.full warn = args.warnings no_save = args.no_save log = args.logging - + if no_save is True: save = False elif rpath is not None: save = rpath.strip() else: save = True - + main(fpath, save, full, warn, log) - + return diff --git a/packages/dtocean-core/src/dtocean_core/utils/moorings.py b/packages/dtocean-core/src/dtocean_core/utils/moorings.py index 1007022..30370ff 100644 --- a/packages/dtocean-core/src/dtocean_core/utils/moorings.py +++ b/packages/dtocean-core/src/dtocean_core/utils/moorings.py @@ -15,286 +15,360 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from typing import Any + import pandas as pd -def get_component_dict(component_type, - data_table, - rope_data=None, - sand_data=None, - soft_data=None, - check_keys=None): - - valid_components = ["cable", - "chain", - "drag anchor", - "forerunner assembly", - "pile", - "rope", - "shackle", - "swivel"] - +def get_component_dict( + component_type, + data_table, + rope_data=None, + sand_data=None, + soft_data=None, + check_keys=None, +): + valid_components = [ + "cable", + "chain", + "drag anchor", + "forerunner assembly", + "pile", + "rope", + "shackle", + "swivel", + ] + if component_type not in valid_components: - valid_str = ", ".join(valid_components) - errStr = ("Argument system_type must be one of '{}' not " - "'{}'").format(valid_str, component_type) + errStr = ( + "Argument system_type must be one of '{}' not " "'{}'" + ).format(valid_str, component_type) raise ValueError(errStr) - + if component_type in ["drag anchor", "pile"]: system_type = "foundation system" else: system_type = "mooring system" - - compdict = {} - if check_keys is None: check_keys = [] - + + compdict: dict[str, dict[str, Any]] = {} + if check_keys is None: + check_keys = [] + key_ids = data_table["Key Identifier"] - + for key_id in key_ids: - # Check for duplicates if key_id in check_keys: - errStr = "Key identifier {} has been duplicated".format(key_id) raise KeyError(errStr) - + # Start building the value dictionary - data_dict = {"item1": system_type, - "item2": component_type} - - record = data_table.loc[data_table['Key Identifier'] == key_id] - + data_dict: dict[str, Any] = { + "item1": system_type, + "item2": component_type, + } + + record = data_table.loc[data_table["Key Identifier"] == key_id] + # Build shared items data_dict["item3"] = record.iloc[0]["Name"] - + # Build component specific items if component_type in ["chain", "forerunner assembly"]: - - data_dict["item5"] = [record.iloc[0]["Min Break Load"], - record.iloc[0]["Axial Stiffness"]] - data_dict["item6"] = [record.iloc[0]["Diameter"], - record.iloc[0]["Connecting Length"]] - data_dict["item7"] = [record.iloc[0]["Dry Mass per Unit Length"], - record.iloc[0]["Wet Mass per Unit Length"]] + data_dict["item5"] = [ + record.iloc[0]["Min Break Load"], + record.iloc[0]["Axial Stiffness"], + ] + data_dict["item6"] = [ + record.iloc[0]["Diameter"], + record.iloc[0]["Connecting Length"], + ] + data_dict["item7"] = [ + record.iloc[0]["Dry Mass per Unit Length"], + record.iloc[0]["Wet Mass per Unit Length"], + ] data_dict["item11"] = record.iloc[0]["Cost per Unit Length"] - + elif component_type in ["shackle", "swivel"]: - - data_dict["item5"] = [record.iloc[0]["Min Break Load"], - record.iloc[0]["Axial Stiffness"]] - data_dict["item6"] = [record.iloc[0]["Nominal Diameter"], - record.iloc[0]["Connecting Length"]] - data_dict["item7"] = [record.iloc[0]["Dry Unit Mass"], - record.iloc[0]["Wet Unit Mass"]] + data_dict["item5"] = [ + record.iloc[0]["Min Break Load"], + record.iloc[0]["Axial Stiffness"], + ] + data_dict["item6"] = [ + record.iloc[0]["Nominal Diameter"], + record.iloc[0]["Connecting Length"], + ] + data_dict["item7"] = [ + record.iloc[0]["Dry Unit Mass"], + record.iloc[0]["Wet Unit Mass"], + ] data_dict["item11"] = record.iloc[0]["Cost"] - + elif component_type == "pile": - - data_dict["item5"] = [record.iloc[0]["Yield Stress"], - record.iloc[0]["Youngs Modulus"]] - data_dict["item6"] = [record.iloc[0]["Diameter"], - record.iloc[0]["Wall Thickness"]] - data_dict["item7"] = [record.iloc[0]["Dry Mass per Unit Length"], - record.iloc[0]["Wet Mass per Unit Length"]] + data_dict["item5"] = [ + record.iloc[0]["Yield Stress"], + record.iloc[0]["Youngs Modulus"], + ] + data_dict["item6"] = [ + record.iloc[0]["Diameter"], + record.iloc[0]["Wall Thickness"], + ] + data_dict["item7"] = [ + record.iloc[0]["Dry Mass per Unit Length"], + record.iloc[0]["Wet Mass per Unit Length"], + ] data_dict["item11"] = record.iloc[0]["Cost per Unit Length"] - + elif component_type == "drag anchor": - if sand_data is None or soft_data is None: - errStr = ("Arguments 'sand_data' and 'soft_data' must be " - "supplied if component_type is 'drag anchor'") + errStr = ( + "Arguments 'sand_data' and 'soft_data' must be " + "supplied if component_type is 'drag anchor'" + ) raise ValueError(errStr) - - data_dict["item5"] = [record.iloc[0]["Min Break Load"], - record.iloc[0]["Axial Stiffness"]] - data_dict["item6"] = [record.iloc[0]["Width"], - record.iloc[0]["Depth"], - record.iloc[0]["Height"], - record.iloc[0]["Connecting Size"]] - data_dict["item7"] = [record.iloc[0]["Dry Unit Mass"], - record.iloc[0]["Wet Unit Mass"]] - + + data_dict["item5"] = [ + record.iloc[0]["Min Break Load"], + record.iloc[0]["Axial Stiffness"], + ] + data_dict["item6"] = [ + record.iloc[0]["Width"], + record.iloc[0]["Depth"], + record.iloc[0]["Height"], + record.iloc[0]["Connecting Size"], + ] + data_dict["item7"] = [ + record.iloc[0]["Dry Unit Mass"], + record.iloc[0]["Wet Unit Mass"], + ] + # Add anchor coefficients - sand_coeffs = sand_data.loc[sand_data['Key Identifier'] == key_id] - soft_coeffs = sand_data.loc[soft_data['Key Identifier'] == key_id] - - sand_df = sand_coeffs[['Holding Capacity Coefficient 1', - 'Holding Capacity Coefficient 2', - 'Penetration Coefficient 1', - 'Penetration Coefficient 2']] - - soft_df = soft_coeffs[['Holding Capacity Coefficient 1', - 'Holding Capacity Coefficient 2', - 'Penetration Coefficient 1', - 'Penetration Coefficient 2']] - - data_dict["item9"] = {'sand': sand_df.values.tolist()[0], - 'soft': soft_df.values.tolist()[0]} + sand_coeffs = sand_data.loc[sand_data["Key Identifier"] == key_id] + soft_coeffs = sand_data.loc[soft_data["Key Identifier"] == key_id] + + sand_df = sand_coeffs[ + [ + "Holding Capacity Coefficient 1", + "Holding Capacity Coefficient 2", + "Penetration Coefficient 1", + "Penetration Coefficient 2", + ] + ] + + soft_df = soft_coeffs[ + [ + "Holding Capacity Coefficient 1", + "Holding Capacity Coefficient 2", + "Penetration Coefficient 1", + "Penetration Coefficient 2", + ] + ] + + data_dict["item9"] = { + "sand": sand_df.values.tolist()[0], + "soft": soft_df.values.tolist()[0], + } data_dict["item11"] = record.iloc[0]["Cost"] - + elif component_type == "rope": - # Build rope axial stiffness list if rope_data is None: - errStr = ("Argument 'rope_data' must be supplied if " - "component_type is 'rope'") + errStr = ( + "Argument 'rope_data' must be supplied if " + "component_type is 'rope'" + ) raise ValueError(errStr) - + rope_array = rope_data[key_id] - + data_dict["item4"] = [record.iloc[0]["Material"]] - data_dict["item5"] = [record.iloc[0]["Min Break Load"], - rope_array.tolist()] + data_dict["item5"] = [ + record.iloc[0]["Min Break Load"], + rope_array.tolist(), + ] data_dict["item6"] = [record.iloc[0]["Diameter"]] - data_dict["item7"] = [record.iloc[0]["Dry Mass per Unit Length"], - record.iloc[0]["Wet Mass per Unit Length"]] + data_dict["item7"] = [ + record.iloc[0]["Dry Mass per Unit Length"], + record.iloc[0]["Wet Mass per Unit Length"], + ] data_dict["item11"] = record.iloc[0]["Cost per Unit Length"] - + elif component_type == "cable": - - data_dict["item5"] = [record.iloc[0]["Min Break Load"], - record.iloc[0]["Min Bend Radius"]] + data_dict["item5"] = [ + record.iloc[0]["Min Break Load"], + record.iloc[0]["Min Bend Radius"], + ] data_dict["item6"] = [record.iloc[0]["Diameter"]] - data_dict["item7"] = [record.iloc[0]["Dry Mass per Unit Length"], - record.iloc[0]["Wet Mass per Unit Length"]] + data_dict["item7"] = [ + record.iloc[0]["Dry Mass per Unit Length"], + record.iloc[0]["Wet Mass per Unit Length"], + ] data_dict["item11"] = record.iloc[0]["Cost per Unit Length"] else: - errStr = "RUN FOR THE HILLS!!!!1!!" raise RuntimeError(errStr) - + compdict[key_id] = data_dict check_keys.append(key_id) - + return compdict - -def get_moorings_tables(compdict): - - cable_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Name', - 'Min Break Load', - 'Min Bend Radius', - 'Diameter', - 'Dry Mass per Unit Length', - 'Wet Mass per Unit Length', - 'Cost per Unit Length', - 'Environmental Impact']) - - chain_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Name', - 'Min Break Load', - 'Axial Stiffness', - 'Diameter', - 'Connecting Length', - 'Dry Mass per Unit Length', - 'Wet Mass per Unit Length', - 'Cost per Unit Length', - 'Environmental Impact']) - - forerunner_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Name', - 'Min Break Load', - 'Axial Stiffness', - 'Diameter', - 'Connecting Length', - 'Dry Mass per Unit Length', - 'Wet Mass per Unit Length', - 'Cost per Unit Length', - 'Environmental Impact']) - - shackle_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Name', - 'Min Break Load', - 'Axial Stiffness', - 'Width', - 'Depth', - 'Height', - 'Nominal Diameter', - 'Connecting Length', - 'Dry Unit Mass', - 'Wet Unit Mass', - 'Cost', - 'Environmental Impact']) - - swivel_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Name', - 'Min Break Load', - 'Axial Stiffness', - 'Width', - 'Depth', - 'Height', - 'Nominal Diameter', - 'Connecting Length', - 'Dry Unit Mass', - 'Wet Unit Mass', - 'Cost', - 'Environmental Impact']) - - pile_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Name', - 'Yield Stress', - 'Youngs Modulus', - 'Diameter', - 'Wall Thickness', - 'Dry Mass per Unit Length', - 'Wet Mass per Unit Length', - 'Cost per Unit Length', - 'Environmental Impact']) - - anchor_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Name', - 'Min Break Load', - 'Axial Stiffness', - 'Width', - 'Depth', - 'Height', - 'Connecting Size', - 'Dry Unit Mass', - 'Wet Unit Mass', - 'Cost', - 'Environmental Impact']) - - anchor_sand_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Holding Capacity Coefficient 1', - 'Holding Capacity Coefficient 2', - 'Penetration Coefficient 1', - 'Penetration Coefficient 2']) - - anchor_soft_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Holding Capacity Coefficient 1', - 'Holding Capacity Coefficient 2', - 'Penetration Coefficient 1', - 'Penetration Coefficient 2']) - - rope_df = pd.DataFrame(columns=[ - 'Key Identifier', - 'Name', - 'Material', - 'Min Break Load', - 'Diameter', - 'Dry Mass per Unit Length', - 'Wet Mass per Unit Length', - 'Cost per Unit Length', - 'Environmental Impact']) - + + +def get_moorings_tables(compdict: dict[str, dict[str, Any]]): + cable_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Name", + "Min Break Load", + "Min Bend Radius", + "Diameter", + "Dry Mass per Unit Length", + "Wet Mass per Unit Length", + "Cost per Unit Length", + "Environmental Impact", + ] + ) + + chain_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Name", + "Min Break Load", + "Axial Stiffness", + "Diameter", + "Connecting Length", + "Dry Mass per Unit Length", + "Wet Mass per Unit Length", + "Cost per Unit Length", + "Environmental Impact", + ] + ) + + forerunner_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Name", + "Min Break Load", + "Axial Stiffness", + "Diameter", + "Connecting Length", + "Dry Mass per Unit Length", + "Wet Mass per Unit Length", + "Cost per Unit Length", + "Environmental Impact", + ] + ) + + shackle_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Name", + "Min Break Load", + "Axial Stiffness", + "Width", + "Depth", + "Height", + "Nominal Diameter", + "Connecting Length", + "Dry Unit Mass", + "Wet Unit Mass", + "Cost", + "Environmental Impact", + ] + ) + + swivel_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Name", + "Min Break Load", + "Axial Stiffness", + "Width", + "Depth", + "Height", + "Nominal Diameter", + "Connecting Length", + "Dry Unit Mass", + "Wet Unit Mass", + "Cost", + "Environmental Impact", + ] + ) + + pile_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Name", + "Yield Stress", + "Youngs Modulus", + "Diameter", + "Wall Thickness", + "Dry Mass per Unit Length", + "Wet Mass per Unit Length", + "Cost per Unit Length", + "Environmental Impact", + ] + ) + + anchor_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Name", + "Min Break Load", + "Axial Stiffness", + "Width", + "Depth", + "Height", + "Connecting Size", + "Dry Unit Mass", + "Wet Unit Mass", + "Cost", + "Environmental Impact", + ] + ) + + anchor_sand_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Holding Capacity Coefficient 1", + "Holding Capacity Coefficient 2", + "Penetration Coefficient 1", + "Penetration Coefficient 2", + ] + ) + + anchor_soft_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Holding Capacity Coefficient 1", + "Holding Capacity Coefficient 2", + "Penetration Coefficient 1", + "Penetration Coefficient 2", + ] + ) + + rope_df = pd.DataFrame( + columns=[ + "Key Identifier", + "Name", + "Material", + "Min Break Load", + "Diameter", + "Dry Mass per Unit Length", + "Wet Mass per Unit Length", + "Cost per Unit Length", + "Environmental Impact", + ] + ) + rope_dict = {} - - for key_id, data_dict in compdict.iteritems(): - + + for key_id, data_dict in compdict.items(): values = [] columns = [] - + # Get component type component_type = data_dict["item2"] @@ -303,229 +377,231 @@ def get_moorings_tables(compdict): values.append(key_id) columns.append("Name") - values.append(data_dict["item3"]) - + values.append(data_dict["item3"]) + # Build component specific items if component_type in ["chain", "forerunner assembly"]: - columns.append("Min Break Load") values.append(data_dict["item5"][0]) - + columns.append("Axial Stiffness") values.append(data_dict["item5"][1]) - + columns.append("Diameter") values.append(data_dict["item6"][0]) - + columns.append("Connecting Length") values.append(data_dict["item6"][1]) - + columns.append("Dry Mass per Unit Length") values.append(data_dict["item7"][0]) - + columns.append("Wet Mass per Unit Length") values.append(data_dict["item7"][1]) - + columns.append("Cost per Unit Length") values.append(data_dict["item11"]) record = pd.Series(values, index=columns) - + if component_type == "chain": - chain_df = chain_df.append(record, ignore_index=True) + chain_df = pd.concat([chain_df, record], ignore_index=True) else: - forerunner_df = forerunner_df.append(record, ignore_index=True) - + forerunner_df = pd.concat( + [forerunner_df, record], ignore_index=True + ) + elif component_type in ["shackle", "swivel"]: - columns.append("Min Break Load") values.append(data_dict["item5"][0]) - + columns.append("Axial Stiffness") values.append(data_dict["item5"][1]) - + columns.append("Width") values.append(data_dict["item6"][0]) - + columns.append("Depth") values.append(data_dict["item6"][0]) - + columns.append("Height") values.append(data_dict["item6"][0]) - + columns.append("Nominal Diameter") values.append(data_dict["item6"][0]) - + columns.append("Connecting Length") values.append(data_dict["item6"][1]) - + columns.append("Dry Unit Mass") values.append(data_dict["item7"][0]) - + columns.append("Wet Unit Mass") values.append(data_dict["item7"][1]) - + columns.append("Cost") values.append(data_dict["item11"]) - + record = pd.Series(values, index=columns) - + if component_type == "shackle": - shackle_df = shackle_df.append(record, ignore_index=True) + shackle_df = pd.concat([shackle_df, record], ignore_index=True) else: - swivel_df = swivel_df.append(record, ignore_index=True) - + swivel_df = pd.concat([swivel_df, record], ignore_index=True) + elif component_type == "pile": - columns.append("Yield Stress") values.append(data_dict["item5"][0]) - + columns.append("Youngs Modulus") values.append(data_dict["item5"][1]) - + columns.append("Diameter") values.append(data_dict["item6"][0]) - + columns.append("Wall Thickness") values.append(data_dict["item6"][1]) - + columns.append("Dry Mass per Unit Length") values.append(data_dict["item7"][0]) - + columns.append("Wet Mass per Unit Length") values.append(data_dict["item7"][1]) - + columns.append("Cost per Unit Length") values.append(data_dict["item11"]) - + record = pd.Series(values, index=columns) - pile_df = pile_df.append(record, ignore_index=True) - + pile_df = pd.concat([pile_df, record], ignore_index=True) + elif component_type == "drag anchor": - columns.append("Min Break Load") values.append(data_dict["item5"][0]) - + columns.append("Axial Stiffness") values.append(data_dict["item5"][1]) - + columns.append("Width") values.append(data_dict["item6"][0]) - + columns.append("Depth") values.append(data_dict["item6"][1]) - + columns.append("Height") values.append(data_dict["item6"][2]) - + columns.append("Connecting Size") values.append(data_dict["item6"][3]) - + columns.append("Dry Unit Mass") values.append(data_dict["item7"][0]) - + columns.append("Wet Unit Mass") values.append(data_dict["item7"][1]) - + columns.append("Cost") values.append(data_dict["item11"]) - + record = pd.Series(values, index=columns) - anchor_df = anchor_df.append(record, ignore_index=True) + anchor_df = pd.concat([anchor_df, record], ignore_index=True) # Anchor coefficients - coef_cols = ['Key Identifier', - 'Holding Capacity Coefficient 1', - 'Holding Capacity Coefficient 2', - 'Penetration Coefficient 1', - 'Penetration Coefficient 2'] - - sand_list = [key_id] - soft_list = [key_id] + coef_cols = [ + "Key Identifier", + "Holding Capacity Coefficient 1", + "Holding Capacity Coefficient 2", + "Penetration Coefficient 1", + "Penetration Coefficient 2", + ] + + sand_list: list[Any] = [key_id] + soft_list: list[Any] = [key_id] sand_list.extend(data_dict["item9"]["sand"]) soft_list.extend(data_dict["item9"]["soft"]) - + # Fix error in data - if len(sand_list) == 4: sand_list.append(0.) - if len(soft_list) == 4: soft_list.append(0.) + if len(sand_list) == 4: + sand_list.append(0.0) + if len(soft_list) == 4: + soft_list.append(0.0) sand_record = pd.Series(sand_list, index=coef_cols) soft_record = pd.Series(soft_list, index=coef_cols) - - anchor_sand_df = anchor_sand_df.append(sand_record, - ignore_index=True) - anchor_soft_df = anchor_sand_df.append(soft_record, - ignore_index=True) - + anchor_sand_df = pd.concat( + [anchor_sand_df, sand_record], ignore_index=True + ) + anchor_soft_df = pd.concat( + [anchor_sand_df, soft_record], ignore_index=True + ) + elif component_type == "rope": - columns.append("Material") values.append(data_dict["item4"][0]) - + columns.append("Min Break Load") values.append(data_dict["item5"][0]) - + columns.append("Diameter") values.append(data_dict["item6"][0]) - + columns.append("Dry Mass per Unit Length") values.append(data_dict["item7"][0]) - + columns.append("Wet Mass per Unit Length") values.append(data_dict["item7"][1]) - + columns.append("Cost per Unit Length") values.append(data_dict["item11"]) - + record = pd.Series(values, index=columns) - rope_df = rope_df.append(record, ignore_index=True) - + rope_df = pd.concat([rope_df, record], ignore_index=True) + # Collect the rope axial stress data rope_dict[key_id] = data_dict["item5"][1] elif component_type == "cable": - columns.append("Min Break Load") values.append(data_dict["item5"][0]) - + columns.append("Min Bend Radius") values.append(data_dict["item5"][1]) - + columns.append("Diameter") values.append(data_dict["item6"][0]) - + columns.append("Dry Mass per Unit Length") values.append(data_dict["item7"][0]) - + columns.append("Wet Mass per Unit Length") values.append(data_dict["item7"][1]) - + columns.append("Cost per Unit Length") values.append(data_dict["item11"]) - + record = pd.Series(values, index=columns) - cable_df = cable_df.append(record, ignore_index=True) + cable_df = pd.concat([cable_df, record], ignore_index=True) else: - - errStr = ("The blue meanies are coming! Or, there was an unknown " - "component type: {}").format(component_type) + errStr = ( + "The blue meanies are coming! Or, there was an unknown " + "component type: {}" + ).format(component_type) raise RuntimeError(errStr) - - - tables = {"cable": cable_df, - "chain": chain_df, - "forerunner assembly": forerunner_df, - "shackle": shackle_df, - "swivel": swivel_df, - "pile": pile_df, - "drag anchor": anchor_df, - "drag anchor sand": anchor_sand_df, - "drag anchor soft": anchor_soft_df, - "rope": rope_df, - "rope axial stiffness": rope_dict} - - return tables + tables = { + "cable": cable_df, + "chain": chain_df, + "forerunner assembly": forerunner_df, + "shackle": shackle_df, + "swivel": swivel_df, + "pile": pile_df, + "drag anchor": anchor_df, + "drag anchor sand": anchor_sand_df, + "drag anchor soft": anchor_soft_df, + "rope": rope_df, + "rope axial stiffness": rope_dict, + } + + return tables diff --git a/packages/dtocean-core/src/dtocean_core/utils/reliability.py b/packages/dtocean-core/src/dtocean_core/utils/reliability.py index 8a43611..40306ba 100644 --- a/packages/dtocean-core/src/dtocean_core/utils/reliability.py +++ b/packages/dtocean-core/src/dtocean_core/utils/reliability.py @@ -16,157 +16,163 @@ # along with this program. If not, see . from collections import OrderedDict +from typing import Any, Optional, Sequence import pandas as pd -def get_component_dict(component_type, - data_table_cfr, - data_table_ncfr, - check_keys=None): - - valid_components = ["chain", - "forerunner", - "shackle", - "swivel", - "anchor", - "pile", - "rope", - "static cable", - "dynamic cable", - "wet mate", - "dry mate", - "transformer", - "collection point", - 'user-defined'] - +def get_component_dict( + component_type, + data_table_cfr, + data_table_ncfr, + check_keys: Optional[Sequence[str]] = None, +): + valid_components = [ + "chain", + "forerunner", + "shackle", + "swivel", + "anchor", + "pile", + "rope", + "static cable", + "dynamic cable", + "wet mate", + "dry mate", + "transformer", + "collection point", + "user-defined", + ] + if component_type not in valid_components: - valid_str = ", ".join(valid_components) - errStr = ("Argument system_type must be one of '{}' not " - "'{}'").format(valid_str, component_type) + errStr = ( + "Argument system_type must be one of '{}' not " "'{}'" + ).format(valid_str, component_type) raise ValueError(errStr) - if component_type in ["static cable", - "dynamic cable", - "wet mate", - "dry mate", - "transformer", - "collection point"]: - + if component_type in [ + "static cable", + "dynamic cable", + "wet mate", + "dry mate", + "transformer", + "collection point", + ]: system_type = "electrical system" - elif component_type in ['user-defined']: - - system_type = 'user-defined' - + elif component_type in ["user-defined"]: + system_type = "user-defined" + elif component_type in ["drag anchor", "pile"]: - system_type = "foundation system" - + else: - system_type = "mooring system" - - compdict = {} - - if check_keys is None: check_keys = [] - + + compdict: dict[str, dict[str, Any]] = {} + + if check_keys is None: + check_keys = [] + else: + check_keys = list(check_keys) + key_ids = data_table_cfr["Key Identifier"] - + for key_id in key_ids: - # Check for duplicates if key_id in check_keys: - errStr = "Key identifier {} has been duplicated".format(key_id) raise KeyError(errStr) - + # Start building the value dictionary - data_dict = {"item1": system_type, - "item2": component_type} - + data_dict: dict[str, Any] = { + "item1": system_type, + "item2": component_type, + } + record_cfr = data_table_cfr.loc[ - data_table_cfr['Key Identifier'] == key_id] + data_table_cfr["Key Identifier"] == key_id + ] record_ncfr = data_table_ncfr.loc[ - data_table_ncfr['Key Identifier'] == key_id] - + data_table_ncfr["Key Identifier"] == key_id + ] + # Build shared items + data_dict["item10"] = { + "failratecrit": [ + record_cfr.iloc[0]["Lower Bound"], + record_cfr.iloc[0]["Mean"], + record_cfr.iloc[0]["Upper Bound"], + ], + "failratenoncrit": [ + record_ncfr.iloc[0]["Lower Bound"], + record_ncfr.iloc[0]["Mean"], + record_ncfr.iloc[0]["Upper Bound"], + ], + } - data_dict["item10"] = {"failratecrit" : [ - record_cfr.iloc[0]["Lower Bound"], - record_cfr.iloc[0]["Mean"], - record_cfr.iloc[0]["Upper Bound"]], - "failratenoncrit" : [ - record_ncfr.iloc[0]["Lower Bound"], - record_ncfr.iloc[0]["Mean"], - record_ncfr.iloc[0]["Upper Bound"]] - } - compdict[key_id] = data_dict check_keys.append(key_id) return compdict -def get_reliability_tables(compdict): - +def get_reliability_tables(compdict: dict[str, dict[str, Any]]): def key_to_int(df): - key = 'Key Identifier' + key = "Key Identifier" try: df[key] = df[key].astype(int) except: pass - - base_df = pd.DataFrame(columns=['Key Identifier', - 'Lower Bound', - 'Mean', - 'Upper Bound']) - + + base_df = pd.DataFrame( + columns=["Key Identifier", "Lower Bound", "Mean", "Upper Bound"] + ) + chain_CFR_df = base_df.copy() chain_NCFR_df = base_df.copy() - + forerunner_CFR_df = base_df.copy() forerunner_NCFR_df = base_df.copy() - + shackle_CFR_df = base_df.copy() shackle_NCFR_df = base_df.copy() - + swivel_CFR_df = base_df.copy() swivel_NCFR_df = base_df.copy() - + anchor_CFR_df = base_df.copy() anchor_NCFR_df = base_df.copy() - + pile_CFR_df = base_df.copy() pile_NCFR_df = base_df.copy() rope_CFR_df = base_df.copy() rope_NCFR_df = base_df.copy() - + static_cable_CFR_df = base_df.copy() static_cable_NCFR_df = base_df.copy() - + dynamic_cable_CFR_df = base_df.copy() dynamic_cable_NCFR_df = base_df.copy() - + wet_mate_CFR_df = base_df.copy() wet_mate_NCFR_df = base_df.copy() - + dry_mate_CFR_df = base_df.copy() dry_mate_NCFR_df = base_df.copy() - + transformer_CFR_df = base_df.copy() transformer_NCFR_df = base_df.copy() - + collection_point_CFR_df = base_df.copy() collection_point_NCFR_df = base_df.copy() - for key_id, data_dict in compdict.iteritems(): - + for key_id, data_dict in compdict.items(): # Get component type component_type = data_dict["item2"] - + values_CFR = [] values_NCFR = [] columns = [] @@ -174,312 +180,304 @@ def key_to_int(df): columns.append("Key Identifier") values_CFR.append(key_id) values_NCFR.append(key_id) - + columns.append("Lower Bound") values_CFR.append(data_dict["item10"]["failratecrit"][0]) values_NCFR.append(data_dict["item10"]["failratenoncrit"][0]) - + columns.append("Mean") values_CFR.append(data_dict["item10"]["failratecrit"][1]) values_NCFR.append(data_dict["item10"]["failratenoncrit"][1]) - + columns.append("Upper Bound") values_CFR.append(data_dict["item10"]["failratecrit"][2]) - values_NCFR.append(data_dict["item10"]["failratenoncrit"][2]) - + values_NCFR.append(data_dict["item10"]["failratenoncrit"][2]) + record_CFR = pd.Series(values_CFR, index=columns) record_NCFR = pd.Series(values_NCFR, index=columns) - + # Build component specific items - if component_type == 'chain': - - chain_CFR_df = chain_CFR_df.append(record_CFR, - ignore_index=True) - chain_NCFR_df = chain_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'forerunner assembly': - - forerunner_CFR_df = forerunner_CFR_df.append(record_CFR, - ignore_index=True) - forerunner_NCFR_df = forerunner_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'shackle': - - shackle_CFR_df = shackle_CFR_df.append(record_CFR, - ignore_index=True) - shackle_NCFR_df = shackle_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'swivel': - - swivel_CFR_df = swivel_CFR_df.append(record_CFR, - ignore_index=True) - swivel_NCFR_df = swivel_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'anchor': - - anchor_CFR_df = anchor_CFR_df.append(record_CFR, - ignore_index=True) - anchor_NCFR_df = anchor_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'pile': - - pile_CFR_df = pile_CFR_df.append(record_CFR, - ignore_index=True) - pile_NCFR_df = pile_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'rope': - - rope_CFR_df = rope_CFR_df.append(record_CFR, - ignore_index=True) - rope_NCFR_df = rope_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'static cable': - - static_cable_CFR_df = static_cable_CFR_df.append(record_CFR, - ignore_index=True) - static_cable_NCFR_df = static_cable_NCFR_df.append( - record_NCFR, - ignore_index=True) - - if component_type == 'dynamic cable': - - dynamic_cable_CFR_df = dynamic_cable_CFR_df.append( - record_CFR, - ignore_index=True) - dynamic_cable_NCFR_df = dynamic_cable_NCFR_df.append( - record_NCFR, - ignore_index=True) - - if component_type == 'wet mate': - - wet_mate_CFR_df = wet_mate_CFR_df.append(record_CFR, - ignore_index=True) - wet_mate_NCFR_df = wet_mate_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'dry mate': - - dry_mate_CFR_df = dry_mate_CFR_df.append(record_CFR, - ignore_index=True) - dry_mate_NCFR_df = dry_mate_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'transformer': - - transformer_CFR_df = transformer_CFR_df.append(record_CFR, - ignore_index=True) - transformer_NCFR_df = transformer_NCFR_df.append(record_NCFR, - ignore_index=True) - - if component_type == 'collection point': - - collection_point_CFR_df = collection_point_CFR_df.append( - record_CFR, - ignore_index=True) - collection_point_NCFR_df = collection_point_NCFR_df.append( - record_NCFR, - ignore_index=True) - + if component_type == "chain": + chain_CFR_df = pd.concat( + [chain_CFR_df, record_CFR], ignore_index=True + ) + chain_NCFR_df = pd.concat( + [chain_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "forerunner assembly": + forerunner_CFR_df = pd.concat( + [forerunner_CFR_df, record_CFR], ignore_index=True + ) + forerunner_NCFR_df = pd.concat( + [forerunner_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "shackle": + shackle_CFR_df = pd.concat( + [shackle_CFR_df, record_CFR], ignore_index=True + ) + shackle_NCFR_df = pd.concat( + [shackle_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "swivel": + swivel_CFR_df = pd.concat( + [swivel_CFR_df, record_CFR], ignore_index=True + ) + swivel_NCFR_df = pd.concat( + [swivel_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "anchor": + anchor_CFR_df = pd.concat( + [anchor_CFR_df, record_CFR], ignore_index=True + ) + anchor_NCFR_df = pd.concat( + [anchor_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "pile": + pile_CFR_df = pd.concat( + [pile_CFR_df, record_CFR], ignore_index=True + ) + pile_NCFR_df = pd.concat( + [pile_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "rope": + rope_CFR_df = pd.concat( + [rope_CFR_df, record_CFR], ignore_index=True + ) + rope_NCFR_df = pd.concat( + [rope_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "static cable": + static_cable_CFR_df = pd.concat( + [static_cable_CFR_df, record_CFR], ignore_index=True + ) + static_cable_NCFR_df = pd.concat( + [static_cable_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "dynamic cable": + dynamic_cable_CFR_df = pd.concat( + [dynamic_cable_CFR_df, record_CFR], ignore_index=True + ) + dynamic_cable_NCFR_df = pd.concat( + [dynamic_cable_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "wet mate": + wet_mate_CFR_df = pd.concat( + [wet_mate_CFR_df, record_CFR], ignore_index=True + ) + wet_mate_NCFR_df = pd.concat( + [wet_mate_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "dry mate": + dry_mate_CFR_df = pd.concat( + [dry_mate_CFR_df, record_CFR], ignore_index=True + ) + dry_mate_NCFR_df = pd.concat( + [dry_mate_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "transformer": + transformer_CFR_df = pd.concat( + [transformer_CFR_df, record_CFR], ignore_index=True + ) + transformer_NCFR_df = pd.concat( + [transformer_NCFR_df, record_NCFR], ignore_index=True + ) + + if component_type == "collection point": + collection_point_CFR_df = pd.concat( + [collection_point_CFR_df, record_CFR], ignore_index=True + ) + collection_point_NCFR_df = pd.concat( + [collection_point_NCFR_df, record_NCFR], ignore_index=True + ) + key_to_int(chain_CFR_df) key_to_int(chain_NCFR_df) - + key_to_int(forerunner_CFR_df) key_to_int(forerunner_NCFR_df) - + key_to_int(shackle_CFR_df) key_to_int(shackle_NCFR_df) - + key_to_int(swivel_CFR_df) key_to_int(swivel_NCFR_df) - + key_to_int(anchor_CFR_df) key_to_int(anchor_NCFR_df) - + key_to_int(pile_CFR_df) key_to_int(pile_NCFR_df) - + key_to_int(rope_CFR_df) key_to_int(rope_NCFR_df) - + key_to_int(static_cable_CFR_df) key_to_int(static_cable_NCFR_df) - + key_to_int(dynamic_cable_CFR_df) key_to_int(dynamic_cable_NCFR_df) - + key_to_int(wet_mate_CFR_df) key_to_int(wet_mate_NCFR_df) - + key_to_int(dry_mate_CFR_df) key_to_int(dry_mate_NCFR_df) - + key_to_int(transformer_CFR_df) key_to_int(transformer_NCFR_df) - + key_to_int(collection_point_CFR_df) key_to_int(collection_point_NCFR_df) - + tables = { - 'chain CFR': chain_CFR_df, - 'chain NCFR': chain_NCFR_df, - - 'forerunner CFR': forerunner_CFR_df, - 'forerunner NCFR': forerunner_NCFR_df, - - 'shackle CFR': shackle_CFR_df, - 'shackle NCFR': shackle_NCFR_df, - - 'swivel CFR': swivel_CFR_df, - 'swivel NCFR': swivel_NCFR_df, - - 'anchor CFR': anchor_CFR_df, - 'anchor NCFR': anchor_NCFR_df, - - 'pile CFR': pile_CFR_df, - 'pile NCFR': pile_NCFR_df, - - 'rope CFR': rope_CFR_df, - 'rope NCFR': rope_NCFR_df, - - 'static_cable CFR': static_cable_CFR_df, - 'static_cable NCFR': static_cable_NCFR_df, - - 'dynamic_cable CFR': dynamic_cable_CFR_df, - 'dynamic_cable NCFR': dynamic_cable_NCFR_df, - - 'wet_mate CFR': wet_mate_CFR_df, - 'wet_mate NCFR': wet_mate_NCFR_df, - - 'dry_mate CFR': dry_mate_CFR_df, - 'dry_mate NCFR': dry_mate_NCFR_df, - - 'transformer CFR': transformer_CFR_df, - 'transformer NCFR': transformer_NCFR_df, - - 'collection_point CFR': collection_point_CFR_df, - 'collection_point NCFR': collection_point_NCFR_df, - } + "chain CFR": chain_CFR_df, + "chain NCFR": chain_NCFR_df, + "forerunner CFR": forerunner_CFR_df, + "forerunner NCFR": forerunner_NCFR_df, + "shackle CFR": shackle_CFR_df, + "shackle NCFR": shackle_NCFR_df, + "swivel CFR": swivel_CFR_df, + "swivel NCFR": swivel_NCFR_df, + "anchor CFR": anchor_CFR_df, + "anchor NCFR": anchor_NCFR_df, + "pile CFR": pile_CFR_df, + "pile NCFR": pile_NCFR_df, + "rope CFR": rope_CFR_df, + "rope NCFR": rope_NCFR_df, + "static_cable CFR": static_cable_CFR_df, + "static_cable NCFR": static_cable_NCFR_df, + "dynamic_cable CFR": dynamic_cable_CFR_df, + "dynamic_cable NCFR": dynamic_cable_NCFR_df, + "wet_mate CFR": wet_mate_CFR_df, + "wet_mate NCFR": wet_mate_NCFR_df, + "dry_mate CFR": dry_mate_CFR_df, + "dry_mate NCFR": dry_mate_NCFR_df, + "transformer CFR": transformer_CFR_df, + "transformer NCFR": transformer_NCFR_df, + "collection_point CFR": collection_point_CFR_df, + "collection_point NCFR": collection_point_NCFR_df, + } return tables -def compdict_from_mock(xls_file, - default_lower=1., - default_mean=1., - default_upper=1.): - +def compdict_from_mock( + xls_file, default_lower=1.0, default_mean=1.0, default_upper=1.0 +): def key_to_int(df): - key = 'Key Identifier' + key = "Key Identifier" try: df[key] = df[key].astype(int) except: pass - + sheet_names = xls_file.sheet_names - - base_df = pd.DataFrame(columns=['Key Identifier', - 'Lower Bound', - 'Mean', - 'Upper Bound']) - + + base_df = pd.DataFrame( + columns=["Key Identifier", "Lower Bound", "Mean", "Upper Bound"] + ) + compdict = {} - + for comp_type in sheet_names: - - comp_df = xls_file.parse(comp_type) + comp_df: pd.DataFrame = xls_file.parse(comp_type) CFR_df = base_df.copy() NCFR_df = base_df.copy() - - for record in comp_df.itertuples(): - + + for i, record in enumerate(comp_df.itertuples()): values_CFR = [] values_NCFR = [] columns = [] - + columns.append("Key Identifier") values_CFR.append(record[1]) values_NCFR.append(record[1]) - + columns.append("Lower Bound") values_CFR.append(default_lower) values_NCFR.append(default_lower) - + columns.append("Mean") values_CFR.append(default_mean) values_NCFR.append(default_mean) - + columns.append("Upper Bound") values_CFR.append(default_upper) - values_NCFR.append(default_upper) - + values_NCFR.append(default_upper) + record_CFR = pd.Series(values_CFR, index=columns) record_NCFR = pd.Series(values_NCFR, index=columns) - - CFR_df = CFR_df.append(record_CFR, ignore_index=True) - NCFR_df = NCFR_df.append(record_NCFR, ignore_index=True) - + + CFR_df.loc[i] = record_CFR + NCFR_df.loc[i] = record_NCFR + key_to_int(CFR_df) key_to_int(NCFR_df) - - comp_type_dict = get_component_dict(comp_type.replace("_", " "), - CFR_df, - NCFR_df, - check_keys=compdict.keys()) + + comp_type_dict = get_component_dict( + comp_type.replace("_", " "), + CFR_df, + NCFR_df, + check_keys=list(compdict.keys()), + ) compdict.update(comp_type_dict) - + return compdict -def get_reliability_dict(reliability_network, - electrical_layout=None): - +def get_reliability_dict(reliability_network, electrical_layout=None): """Borrows code / ideas from the dtocean-maintenance module, originally authored by Bahram Panahandeh """ - - if electrical_layout is None: electrical_layout = 'radial' - + + if electrical_layout is None: + electrical_layout = "radial" + system_ids = [] subsystem_ids = [] reliability_metric = [] # read the failure rates from reliability_network for system_group in reliability_network: - - if (system_group[0] not in ["PAR", "SER"] and - system_group[0][1] in ['Substation', 'Export Cable'] and - 'array' in system_group[0][2]): - + if ( + system_group[0] not in ["PAR", "SER"] + and system_group[0][1] in ["Substation", "Export Cable"] + and "array" in system_group[0][2] + ): reliability_metric.append(system_group[0][-1]) system_ids.append("-") subsystem_ids.append(system_group[0][1]) continue - if (electrical_layout == 'radial' or - electrical_layout == 'singlesidedstring' or - electrical_layout == 'doublesidedstring'): - + if ( + electrical_layout == "radial" + or electrical_layout == "singlesidedstring" + or electrical_layout == "doublesidedstring" + ): # Groups of devices for device_group in system_group: - flagMFSubSystem = False # Number of subsystems for subsystem in device_group: - device_name = subsystem[2] - - if 'device' not in device_name: - - msgStr = ("Device number not detected in subsystem " - "data. Found '{}'").format(device_name) + + if "device" not in device_name: + msgStr = ( + "Device number not detected in subsystem " + "data. Found '{}'" + ).format(device_name) raise RuntimeError(msgStr) subsystem_name = subsystem[1] @@ -487,18 +485,17 @@ def get_reliability_dict(reliability_network, # E-Mail of Sam # The first one is for the mooring/Foundation # (mooring line/anchor) - if ('M&F sub-system' in subsystem_name and - not flagMFSubSystem): - - subsystem_name += ' mooring foundation' + if ( + "M&F sub-system" in subsystem_name + and not flagMFSubSystem + ): + subsystem_name += " mooring foundation" flagMFSubSystem = True # The second one is for the the umbilical # cable - elif ('M&F sub-system' in subsystem_name and - flagMFSubSystem): - - subsystem_name += ' dynamic cable' + elif "M&F sub-system" in subsystem_name and flagMFSubSystem: + subsystem_name += " dynamic cable" system_ids.append(device_name) subsystem_ids.append(subsystem_name) @@ -507,73 +504,78 @@ def get_reliability_dict(reliability_network, # 'doublesidedstring' failure rate is a list subsystem_fr = subsystem[-1] - if (type(subsystem_fr) == list and - 'Array elec sub-system' in subsystem_name): + if ( + isinstance(subsystem_fr, list) + and "Array elec sub-system" in subsystem_name + ): reliability_metric.append(subsystem_fr[1]) else: reliability_metric.append(subsystem_fr) - elif electrical_layout == 'multiplehubs': - - if 'subhub' not in system_group[1][0][0][2]: - - msgStr = ("Subhub not detected in system hierarchy. Found " - "'{}'").format(system_group[1][0][0][2]) + elif electrical_layout == "multiplehubs": + if "subhub" not in system_group[1][0][0][2]: + msgStr = ( + "Subhub not detected in system hierarchy. Found " "'{}'" + ).format(system_group[1][0][0][2]) raise RuntimeError(msgStr) - - # loop over subhubs - for hub_group in system_group[1]: - - if ('Substation' in hub_group[0][1] or - 'Elec sub-system' in hub_group[0][1]): + # loop over subhubs + for hub_group in system_group[1]: + if ( + "Substation" in hub_group[0][1] + or "Elec sub-system" in hub_group[0][1] + ): reliability_metric.append(hub_group[0][-1]) subsystem_ids.append(hub_group[0][1]) system_ids.append(hub_group[0][2]) - + continue # device_group for device_group in hub_group: - flagMFSubSystem = False - + # Number of subsystems for subsystem in device_group: - device_name = subsystem[2] - - if 'device' not in device_name: - - msgStr = ("Device number not detected in " - "subsystem data. Found '{}'").format( - device_name) + + if "device" not in device_name: + msgStr = ( + "Device number not detected in " + "subsystem data. Found '{}'" + ).format(device_name) raise RuntimeError(msgStr) - + subsystem_name = subsystem[1] - + # E-Mail of Sam # The first one is for the mooring/Foundation # (mooring line/anchor) - if ('M&F sub-system' in subsystem_name and - not flagMFSubSystem): - - subsystem_name += ' mooring foundation' + if ( + "M&F sub-system" in subsystem_name + and not flagMFSubSystem + ): + subsystem_name += " mooring foundation" flagMFSubSystem = True - + # The second one is for the the umbilical # cable - elif ('M&F sub-system' in subsystem_name and - flagMFSubSystem): - - subsystem_name += ' dynamic cable' + elif ( + "M&F sub-system" in subsystem_name + and flagMFSubSystem + ): + subsystem_name += " dynamic cable" subsystem_ids.append(subsystem_name) system_ids.append(device_name) reliability_metric.append(subsystem[-1]) - ram_dict = OrderedDict([("system id [-]", system_ids), - ("subsystem id [-]", subsystem_ids), - ("reliability metric", reliability_metric)]) - + ram_dict = OrderedDict( + [ + ("system id [-]", system_ids), + ("subsystem id [-]", subsystem_ids), + ("reliability metric", reliability_metric), + ] + ) + return ram_dict diff --git a/packages/dtocean-core/test_data/inputs_boundary.py b/packages/dtocean-core/test_data/inputs_boundary.py index bcb80a6..d32ac7b 100644 --- a/packages/dtocean-core/test_data/inputs_boundary.py +++ b/packages/dtocean-core/test_data/inputs_boundary.py @@ -6,58 +6,60 @@ """ import os + import numpy as np import pandas as pd +site_boundary = np.array([[0.0, 0.0], [0.1, 0.0], [0.1, 0.1], [0.0, 0.1]]) -site_boundary = np.array([[0.0, 0.0], - [0.1, 0.0], - [0.1, 0.1], - [0.0, 0.1]]) - -lease_boundary = np.array([[ 0., 0.], - [100., 0.], - [100., 200.], - [ 0., 200.]]) +lease_boundary = np.array( + [[0.0, 0.0], [100.0, 0.0], [100.0, 200.0], [0.0, 200.0]] +) -cable_boundary = np.array([[ 0., 0.], - [100., 0.], - [100., 100.], - [ 0., 100.]]) +cable_boundary = np.array( + [[0.0, 0.0], [100.0, 0.0], [100.0, 100.0], [0.0, 100.0]] +) test_proj = "+proj=utm +zone=31 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" -site_boundaries = {"site one": np.copy(site_boundary), - "site_two": np.copy(site_boundary)} -lease_boundaries = {"site one": np.copy(lease_boundary), - "site_two": np.copy(lease_boundary)} -cable_boundaries = {"site one": np.copy(cable_boundary), - "site_two": np.copy(cable_boundary)} -landing_points = {"site one": (0, 0), - "site_two": (0, 0)} -entry_point = (100., 0.) - -sites_dict = {"id": [1, 2], - "site_name": ["site one", "site_two"], - "lease_area_proj4_string": [test_proj, test_proj]} +site_boundaries = { + "site one": np.copy(site_boundary), + "site_two": np.copy(site_boundary), +} +lease_boundaries = { + "site one": np.copy(lease_boundary), + "site_two": np.copy(lease_boundary), +} +cable_boundaries = { + "site one": np.copy(cable_boundary), + "site_two": np.copy(cable_boundary), +} +landing_points = {"site one": (0, 0), "site_two": (0, 0)} +entry_point = (100.0, 0.0) + +sites_dict = { + "id": [1, 2], + "site_name": ["site one", "site_two"], + "lease_area_proj4_string": [test_proj, test_proj], +} sites_df = pd.DataFrame(sites_dict) selected_site = "site one" -test_data = {"hidden.available_sites": sites_df, - "hidden.corridor_boundaries": cable_boundaries, - "hidden.lease_boundaries": lease_boundaries, - "hidden.landing_points": landing_points, - "project.lease_area_entry_point": entry_point, - "site.selected_name": selected_site, - "hidden.site_boundaries": site_boundaries} - +test_data = { + "hidden.available_sites": sites_df, + "hidden.corridor_boundaries": cable_boundaries, + "hidden.lease_boundaries": lease_boundaries, + "hidden.landing_points": landing_points, + "project.lease_area_entry_point": entry_point, + "site.selected_name": selected_site, + "hidden.site_boundaries": site_boundaries, +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_economics.py b/packages/dtocean-core/test_data/inputs_economics.py index 212d706..321fae1 100644 --- a/packages/dtocean-core/test_data/inputs_economics.py +++ b/packages/dtocean-core/test_data/inputs_economics.py @@ -11,49 +11,51 @@ discount_rate = 0.1 electrical_network_efficiency = 0.99 -capex_oandm = 100. +capex_oandm = 100.0 externalities_capex = 1e6 -zero_bom_dict = {"Key Identifier": [0, 1], - "Quantity": [5, 10], - "Cost": [100, 50], - "Year": [0, 0]} +zero_bom_dict = { + "Key Identifier": [0, 1], + "Quantity": [5, 10], + "Cost": [100, 50], + "Year": [0, 0], +} zero_bom = pd.DataFrame(zero_bom_dict) electrical_bom = zero_bom.copy() moorings_bom = zero_bom.copy() -install_bom_dict = {"Key Identifier": [0, 1], - "Quantity": [1, 1], - "Cost": [1000, 2000], - "Year": [1, 2]} +install_bom_dict = { + "Key Identifier": [0, 1], + "Quantity": [1, 1], + "Cost": [1000, 2000], + "Year": [1, 2], +} install_bom = pd.DataFrame(install_bom_dict) -opex_bom_dict = {"Cost": [1000, 2000], - "Year": [3, 4]} +opex_bom_dict = {"Cost": [1000, 2000], "Year": [3, 4]} opex_bom = pd.DataFrame(opex_bom_dict) -energy_record_dict = {"Energy": [10000, 20000], - "Year": [3, 4]} +energy_record_dict = {"Energy": [10000, 20000], "Year": [3, 4]} energy_record = pd.DataFrame(energy_record_dict) -test_data = {"project.discount_rate": discount_rate, - "project.electrical_economics_data": electrical_bom, - "project.moorings_foundations_economics_data": moorings_bom, - "project.installation_economics_data": install_bom, - "project.capex_oandm": capex_oandm, - "project.opex_per_year": opex_bom, - "project.energy_per_year": energy_record, - 'project.electrical_network_efficiency': - electrical_network_efficiency, - 'project.externalities_capex': externalities_capex} - +test_data = { + "project.discount_rate": discount_rate, + "project.electrical_economics_data": electrical_bom, + "project.moorings_foundations_economics_data": moorings_bom, + "project.installation_economics_data": install_bom, + "project.capex_oandm": capex_oandm, + "project.opex_per_year": opex_bom, + "project.energy_per_year": energy_record, + "project.electrical_network_efficiency": electrical_network_efficiency, + "project.externalities_capex": externalities_capex, +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_economics_estimate.py b/packages/dtocean-core/test_data/inputs_economics_estimate.py index a0cf8ba..f54fc72 100644 --- a/packages/dtocean-core/test_data/inputs_economics_estimate.py +++ b/packages/dtocean-core/test_data/inputs_economics_estimate.py @@ -6,27 +6,28 @@ """ import os - -test_data = {"project.discount_rate": 0.1, - 'project.lifetime': 20, - "project.number_of_devices": 5, - "device.system_cost": 1e6, - "device.power_rating": 1., - 'project.electrical_cost_estimate': 1e5, - 'project.moorings_cost_estimate': 1e5, - 'project.installation_cost_estimate': 1e5, - 'project.opex_estimate': 1e4, - 'project.annual_repair_cost_estimate': 1e4, - 'project.annual_array_mttf_estimate': 10000., - 'project.electrical_network_efficiency': 0.95, - "project.annual_energy": 10000., - 'project.estimate_energy_record': True} - + +test_data = { + "project.discount_rate": 0.1, + "project.lifetime": 20, + "project.number_of_devices": 5, + "device.system_cost": 1e6, + "device.power_rating": 1.0, + "project.electrical_cost_estimate": 1e5, + "project.moorings_cost_estimate": 1e5, + "project.installation_cost_estimate": 1e5, + "project.opex_estimate": 1e4, + "project.annual_repair_cost_estimate": 1e4, + "project.annual_array_mttf_estimate": 10000.0, + "project.electrical_network_efficiency": 0.95, + "project.annual_energy": 10000.0, + "project.estimate_energy_record": True, +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_environmental.py b/packages/dtocean-core/test_data/inputs_environmental.py index 969b6fd..fdde5d8 100644 --- a/packages/dtocean-core/test_data/inputs_environmental.py +++ b/packages/dtocean-core/test_data/inputs_environmental.py @@ -6,33 +6,33 @@ """ import os -import pandas as pd + import numpy as np -import cPickle as pickle +import pandas as pd -#test_data_dir = os.path.dirname(os.path.realpath(__file__)) -#data_dir = os.path.join(test_data_dir, "environmental") +# test_data_dir = os.path.dirname(os.path.realpath(__file__)) +# data_dir = os.path.join(test_data_dir, "environmental") # -#table_path = os.path.join(data_dir, "species_protected.csv") +# table_path = os.path.join(data_dir, "species_protected.csv") # # # -#protected_table = pd.read_csv(table_path, index_col=None) +# protected_table = pd.read_csv(table_path, index_col=None) # -#name_map1 ={ "subclass or group": "Subclass or Group", +# name_map1 ={ "subclass or group": "Subclass or Group", # "observed": "Observed"} -# -# -#protected_table = protected_table.rename(columns=name_map1) +# +# +# protected_table = protected_table.rename(columns=name_map1) # # # -#table_path = os.path.join(data_dir, "species_receptors.csv") -#receptors_table = pd.read_csv(table_path, index_col=None) +# table_path = os.path.join(data_dir, "species_receptors.csv") +# receptors_table = pd.read_csv(table_path, index_col=None) # # -#name_map2 ={ "subclass or group": "Subclass or Group", +# name_map2 ={ "subclass or group": "Subclass or Group", # "observed": "Observed", # "observed january": "Observed January", # "observed february": "Observed February", @@ -45,18 +45,17 @@ # "observed september": "Observed September", # "observed october": "Observed October", # "observed november": "Observed November", -# "observed december": "Observed December" +# "observed december": "Observed December" # } -# -#receptors_table = receptors_table.rename(columns=name_map2) +# +# receptors_table = receptors_table.rename(columns=name_map2) ## - protected_species = None receptor_species = None -#receptors_fishes = receptors_fishes_df1.set_index("Subclass or Group") +# receptors_fishes = receptors_fishes_df1.set_index("Subclass or Group") hydro_energy_modif_weight = "Gravel Cobble" @@ -75,91 +74,91 @@ resource_reduction = 0.9 -layout = {'Device001': (100.,900.,0.), -# 'Device002': (300.,900.,0.), -# 'Device003': (400.,600.,0.) - } - -initial_turbidity =50. +layout = { + "Device001": (100.0, 900.0, 0.0), + # 'Device002': (300.,900.,0.), + # 'Device003': (400.,600.,0.) +} + +initial_turbidity = 50.0 measured_turbidity = 0.1 -initial_noise = 60. -measured_noise = 75. +initial_noise = 60.0 +measured_noise = 75.0 number_of_devices = 2 -device_draft = 20. +device_draft = 20.0 -device_width = 10. +device_width = 10.0 -device_length = 10. +device_length = 10.0 -device_height = 20. +device_height = 20.0 -current_direction = 45. +current_direction = 45.0 -dry_frontal_area = 10. +dry_frontal_area = 10.0 -wet_frontal_area = 20. +wet_frontal_area = 20.0 -fishery_restricted_area = 1159. +fishery_restricted_area = 1159.0 -#fishery_restricted_area = None +# fishery_restricted_area = None -lease_boundary = lease_area = np.array([[50., 50.], - [950., 50.], - [950., 250.], - [50., 250.]], dtype=float) +lease_boundary = lease_area = np.array( + [[50.0, 50.0], [950.0, 50.0], [950.0, 250.0], [50.0, 250.0]], dtype=float +) ## Setup -#x = np.linspace(0.,1000.,100) -#y = np.linspace(0.,1000.,100) -#nx = len(x) -#ny = len(y) +# x = np.linspace(0.,1000.,100) +# y = np.linspace(0.,1000.,100) +# nx = len(x) +# ny = len(y) # ## Bathymetry? -#X, Y = np.meshgrid(x,y) -#Z = -X * 0.1 - 50 -#xyz = np.vstack((X.ravel(),Y.ravel(),Z.ravel())).T -#depth = xyz +# X, Y = np.meshgrid(x,y) +# Z = -X * 0.1 - 50 +# xyz = np.vstack((X.ravel(),Y.ravel(),Z.ravel())).T +# depth = xyz this_dir = os.path.dirname(os.path.realpath(__file__)) data_dir = os.path.join(this_dir, "moorings") -bathy_table = pd.read_csv(os.path.join(data_dir, 'aegirbath2.txt'), - delimiter="\t", - header=None) +bathy_table = pd.read_csv( + os.path.join(data_dir, "aegirbath2.txt"), delimiter="\t", header=None +) -soil_grid = pd.read_csv(os.path.join(data_dir, 'aegirsoil2.txt'), - delimiter="\t", - header=None) +soil_grid = pd.read_csv( + os.path.join(data_dir, "aegirsoil2.txt"), delimiter="\t", header=None +) -Z1=bathy_table[2] -dZ=soil_grid[3] +Z1 = bathy_table[2] +dZ = soil_grid[3] -Z=np.array([Z1.values,(Z1-dZ).values]).T -sediment = np.array([soil_grid[2].values,soil_grid[4].values]).T +Z = np.array([Z1.values, (Z1 - dZ).values]).T +sediment = np.array([soil_grid[2].values, soil_grid[4].values]).T x_max = bathy_table.max()[0] y_max = bathy_table.max()[1] x_min = bathy_table.min()[0] y_min = bathy_table.min()[1] -nx=144 -ny=176 +nx = 144 +ny = 176 -dx = (x_max-x_min)/(nx-1) -dy = (y_max-y_min)/(ny-1) +dx = (x_max - x_min) / (nx - 1) +dy = (y_max - y_min) / (ny - 1) -x= np.linspace(x_min , x_max , nx) -y = np.linspace(y_min , y_max , ny) -[X,Y] = np.meshgrid(x,y) +x = np.linspace(x_min, x_max, nx) +y = np.linspace(y_min, y_max, ny) +[X, Y] = np.meshgrid(x, y) -bathy_table[0]=np.ravel(X) -bathy_table[1]=np.ravel(Y) +bathy_table[0] = np.ravel(X) +bathy_table[1] = np.ravel(Y) -layers = (0,1) +layers = (0, 1) depth_layers = [] @@ -171,79 +170,76 @@ d = [] s = [] for x_count in x: - point_df = bathy_table[(bathy_table[0] == x_count) & - (bathy_table[1] == y_count)].index[0] - - d.append(Z[point_df,z]) - s.append(sediment[point_df,z]) - + point_df = bathy_table[ + (bathy_table[0] == x_count) & (bathy_table[1] == y_count) + ].index[0] + + d.append(Z[point_df, z]) + s.append(sediment[point_df, z]) + depths.append(d) sediments.append(s) - + depth_layers.append(depths) sediment_layers.append(sediments) - + depth_array = np.swapaxes(np.array(depth_layers, dtype=float), 0, 2) sediment_array = np.swapaxes(np.array(sediment_layers), 0, 2) layer_names = ["layer {}".format(x_layers) for x_layers in layers] -strata = strata={"values": {"depth": depth_array, - 'sediment': sediment_array}, - "coords": [x, y, layer_names]} - -test_data = { -# "farm.protected_table": protected_table, -# "farm.receptors_table": receptors_table, - "farm.hydro_energy_modif_weight": hydro_energy_modif_weight, - "project.hydro_collision_risk_weight": - hydro_collision_risk_weight, - "farm.hydro_turbidity_risk_weight": hydro_turbidity_risk_weight, - "device.hydro_underwater_noise_risk_weight": - hydro_underwater_noise_risk_weight, - "farm.hydro_reserve_effect_weight": hydro_reserve_effect_weight, - "device.hydro_reef_effect_weight": hydro_reef_effect_weight, - "device.hydro_resting_place_weight": hydro_resting_place_weight, -# "project.resource_reduction": resource_reduction, - "project.layout": layout, - "farm.initial_turbidity": initial_turbidity, - "project.hydro_measured_turbidity": measured_turbidity, - "farm.initial_noise": initial_turbidity, - "project.hydro_measured_noise": measured_noise, - "project.number_of_devices": number_of_devices, -# "device.system_draft": device_draft, -# "device.system_width": device_width, -# "device.system_length": device_length, -# "device.system_height": device_height, -# "farm.direction_of_max_surface_current": current_direction, -# "project.fishery_restricted_area": fishery_restricted_area, - "site.lease_boundary": lease_boundary, - "bathymetry.layers": strata, - "farm.protected_species": protected_species, - "farm.receptor_species": receptor_species, -# "farm.receptors_soft_habitat": receptors_soft_habitat, -# "farm.receptors_particular_habitat": receptors_particular_habitat, -# "farm.receptors_shallow_diving_birds": receptors_shallow_diving_birds, -# "farm.receptors_medium_diving_birds": receptors_medium_diving_birds, -# "farm.receptors_deep_diving_birds": receptors_deep_diving_birds, -# "farm.receptors_fishes": receptors_fishes, -# "farm.receptors_elasmobranchs": receptors_elasmobranchs, -# "farm.receptors_mysticete": receptors_mysticete, -# "farm.receptors_odontocete": receptors_odontocete, -# "farm.receptors_seals": receptors_seals, -# "farm.receptors_magnetosensitive_species": receptors_magnetosensitive_species, -# "farm.receptors_electrosensitive_species": receptors_electrosensitive_species, -# 'bathymetry.mooring_buried_line_bearing_capacity_factor': linebcf - } - +strata = strata = { + "values": {"depth": depth_array, "sediment": sediment_array}, + "coords": [x, y, layer_names], +} + +test_data = { + # "farm.protected_table": protected_table, + # "farm.receptors_table": receptors_table, + "farm.hydro_energy_modif_weight": hydro_energy_modif_weight, + "project.hydro_collision_risk_weight": hydro_collision_risk_weight, + "farm.hydro_turbidity_risk_weight": hydro_turbidity_risk_weight, + "device.hydro_underwater_noise_risk_weight": hydro_underwater_noise_risk_weight, + "farm.hydro_reserve_effect_weight": hydro_reserve_effect_weight, + "device.hydro_reef_effect_weight": hydro_reef_effect_weight, + "device.hydro_resting_place_weight": hydro_resting_place_weight, + # "project.resource_reduction": resource_reduction, + "project.layout": layout, + "farm.initial_turbidity": initial_turbidity, + "project.hydro_measured_turbidity": measured_turbidity, + "farm.initial_noise": initial_turbidity, + "project.hydro_measured_noise": measured_noise, + "project.number_of_devices": number_of_devices, + # "device.system_draft": device_draft, + # "device.system_width": device_width, + # "device.system_length": device_length, + # "device.system_height": device_height, + # "farm.direction_of_max_surface_current": current_direction, + # "project.fishery_restricted_area": fishery_restricted_area, + "site.lease_boundary": lease_boundary, + "bathymetry.layers": strata, + "farm.protected_species": protected_species, + "farm.receptor_species": receptor_species, + # "farm.receptors_soft_habitat": receptors_soft_habitat, + # "farm.receptors_particular_habitat": receptors_particular_habitat, + # "farm.receptors_shallow_diving_birds": receptors_shallow_diving_birds, + # "farm.receptors_medium_diving_birds": receptors_medium_diving_birds, + # "farm.receptors_deep_diving_birds": receptors_deep_diving_birds, + # "farm.receptors_fishes": receptors_fishes, + # "farm.receptors_elasmobranchs": receptors_elasmobranchs, + # "farm.receptors_mysticete": receptors_mysticete, + # "farm.receptors_odontocete": receptors_odontocete, + # "farm.receptors_seals": receptors_seals, + # "farm.receptors_magnetosensitive_species": receptors_magnetosensitive_species, + # "farm.receptors_electrosensitive_species": receptors_electrosensitive_species, + # 'bathymetry.mooring_buried_line_bearing_capacity_factor': linebcf +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) - + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_environmental_not_none.py b/packages/dtocean-core/test_data/inputs_environmental_not_none.py index f5be924..2159bc5 100644 --- a/packages/dtocean-core/test_data/inputs_environmental_not_none.py +++ b/packages/dtocean-core/test_data/inputs_environmental_not_none.py @@ -6,33 +6,33 @@ """ import os -import pandas as pd + import numpy as np -import cPickle as pickle +import pandas as pd -#test_data_dir = os.path.dirname(os.path.realpath(__file__)) -#data_dir = os.path.join(test_data_dir, "environmental") +# test_data_dir = os.path.dirname(os.path.realpath(__file__)) +# data_dir = os.path.join(test_data_dir, "environmental") # -#table_path = os.path.join(data_dir, "species_protected.csv") +# table_path = os.path.join(data_dir, "species_protected.csv") # # # -#protected_table = pd.read_csv(table_path, index_col=None) +# protected_table = pd.read_csv(table_path, index_col=None) # -#name_map1 ={ "subclass or group": "Subclass or Group", +# name_map1 ={ "subclass or group": "Subclass or Group", # "observed": "Observed"} -# -# -#protected_table = protected_table.rename(columns=name_map1) +# +# +# protected_table = protected_table.rename(columns=name_map1) # # # -#table_path = os.path.join(data_dir, "species_receptors.csv") -#receptors_table = pd.read_csv(table_path, index_col=None) +# table_path = os.path.join(data_dir, "species_receptors.csv") +# receptors_table = pd.read_csv(table_path, index_col=None) # # -#name_map2 ={ "subclass or group": "Subclass or Group", +# name_map2 ={ "subclass or group": "Subclass or Group", # "observed": "Observed", # "observed january": "Observed January", # "observed february": "Observed February", @@ -45,57 +45,246 @@ # "observed september": "Observed September", # "observed october": "Observed October", # "observed november": "Observed November", -# "observed december": "Observed December" +# "observed december": "Observed December" # } -# -#receptors_table = receptors_table.rename(columns=name_map2) +# +# receptors_table = receptors_table.rename(columns=name_map2) ## protected_species = None -column_names = ["Subclass or Group","Year","January","February","March", - "April","May","June","July","August","September","October", - "November","December"] -values=[["Observation of Hard substrate benthic habitat","true","false","true", - "true","false","false","true","true","false","false","false","true", - "false"], - ["Observation of Soft substrate benthic habitat","false","true","true", - "false","false","false","true","false","false","true","false","false", - "false"], - ["Observation of Particular habitat","true","false","true","false", - "true","false","false","true","false","false","true","false","true"], - ["Observation of Shallow diving birds","true","true","false","false", - "true","true","true","false","true","true","true","false","false"], - ["Observation of Medium diving birds","true","true","true","true", - "true","false","false","true","false","false","true","true","true"], - ["Observation of Deep diving birds","false","false","false","true", - "false","true","false","true","true","true","true","false","true"], - ["Observation of Fishes","true","false","true","false","true","true", - "true","false","true","true","true","false","true"], - ["Observation of Elasmobranchs","false","true","true","false","false", - "false","true","false","true","false","true","true","true"], - ["Observation of Large odontocete_Mysticete","false","true","true", - "true","true","true","true","false","false","true","true","true", - "true"], - ["Observation of Odontoncete_dolphinds","false","true","true","false", - "false","false","true","true","true","true","true","true","true"], - ["Observation of Seals","false","true","true","true","true","true", - "false","true","true","true","false","true","true"], - ["Observation of Magnetosensitive species","true","true","true", - "false","true","true","false","true","true","true","true","true", - "false"], - ["Observation of Electrosensitive species","true","false","true", - "false","true","true","false","false","false","false","false","false", - "false"] - ] - - - -receptor_species = pd.DataFrame(values,columns=column_names) - -#receptor_species = receptor_species.set_index("Subclass or Group") - +column_names = [ + "Subclass or Group", + "Year", + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", +] +values = [ + [ + "Observation of Hard substrate benthic habitat", + "true", + "false", + "true", + "true", + "false", + "false", + "true", + "true", + "false", + "false", + "false", + "true", + "false", + ], + [ + "Observation of Soft substrate benthic habitat", + "false", + "true", + "true", + "false", + "false", + "false", + "true", + "false", + "false", + "true", + "false", + "false", + "false", + ], + [ + "Observation of Particular habitat", + "true", + "false", + "true", + "false", + "true", + "false", + "false", + "true", + "false", + "false", + "true", + "false", + "true", + ], + [ + "Observation of Shallow diving birds", + "true", + "true", + "false", + "false", + "true", + "true", + "true", + "false", + "true", + "true", + "true", + "false", + "false", + ], + [ + "Observation of Medium diving birds", + "true", + "true", + "true", + "true", + "true", + "false", + "false", + "true", + "false", + "false", + "true", + "true", + "true", + ], + [ + "Observation of Deep diving birds", + "false", + "false", + "false", + "true", + "false", + "true", + "false", + "true", + "true", + "true", + "true", + "false", + "true", + ], + [ + "Observation of Fishes", + "true", + "false", + "true", + "false", + "true", + "true", + "true", + "false", + "true", + "true", + "true", + "false", + "true", + ], + [ + "Observation of Elasmobranchs", + "false", + "true", + "true", + "false", + "false", + "false", + "true", + "false", + "true", + "false", + "true", + "true", + "true", + ], + [ + "Observation of Large odontocete_Mysticete", + "false", + "true", + "true", + "true", + "true", + "true", + "true", + "false", + "false", + "true", + "true", + "true", + "true", + ], + [ + "Observation of Odontoncete_dolphinds", + "false", + "true", + "true", + "false", + "false", + "false", + "true", + "true", + "true", + "true", + "true", + "true", + "true", + ], + [ + "Observation of Seals", + "false", + "true", + "true", + "true", + "true", + "true", + "false", + "true", + "true", + "true", + "false", + "true", + "true", + ], + [ + "Observation of Magnetosensitive species", + "true", + "true", + "true", + "false", + "true", + "true", + "false", + "true", + "true", + "true", + "true", + "true", + "false", + ], + [ + "Observation of Electrosensitive species", + "true", + "false", + "true", + "false", + "true", + "true", + "false", + "false", + "false", + "false", + "false", + "false", + "false", + ], +] + + +receptor_species = pd.DataFrame(values, columns=column_names) + +# receptor_species = receptor_species.set_index("Subclass or Group") hydro_energy_modif_weight = "Gravel Cobble" @@ -114,91 +303,91 @@ resource_reduction = 0.9 -layout = {'Device001': (100.,900.,0.), -# 'Device002': (300.,900.,0.), -# 'Device003': (400.,600.,0.) - } - -initial_turbidity =50. +layout = { + "Device001": (100.0, 900.0, 0.0), + # 'Device002': (300.,900.,0.), + # 'Device003': (400.,600.,0.) +} + +initial_turbidity = 50.0 measured_turbidity = 0.1 -initial_noise = 60. -measured_noise = 75. +initial_noise = 60.0 +measured_noise = 75.0 -number_of_devices = 2. +number_of_devices = 2.0 -device_draft = 20. +device_draft = 20.0 -device_width = 10. +device_width = 10.0 -device_length = 10. +device_length = 10.0 -device_height = 20. +device_height = 20.0 -current_direction = 45. +current_direction = 45.0 -dry_frontal_area = 10. +dry_frontal_area = 10.0 -wet_frontal_area = 20. +wet_frontal_area = 20.0 -fishery_restricted_area = 1159. +fishery_restricted_area = 1159.0 -#fishery_restricted_area = None +# fishery_restricted_area = None -lease_boundary = lease_area = np.array([[50., 50.], - [950., 50.], - [950., 250.], - [50., 250.]], dtype=float) +lease_boundary = lease_area = np.array( + [[50.0, 50.0], [950.0, 50.0], [950.0, 250.0], [50.0, 250.0]], dtype=float +) ## Setup -#x = np.linspace(0.,1000.,100) -#y = np.linspace(0.,1000.,100) -#nx = len(x) -#ny = len(y) +# x = np.linspace(0.,1000.,100) +# y = np.linspace(0.,1000.,100) +# nx = len(x) +# ny = len(y) # ## Bathymetry? -#X, Y = np.meshgrid(x,y) -#Z = -X * 0.1 - 50 -#xyz = np.vstack((X.ravel(),Y.ravel(),Z.ravel())).T -#depth = xyz +# X, Y = np.meshgrid(x,y) +# Z = -X * 0.1 - 50 +# xyz = np.vstack((X.ravel(),Y.ravel(),Z.ravel())).T +# depth = xyz this_dir = os.path.dirname(os.path.realpath(__file__)) data_dir = os.path.join(this_dir, "moorings") -bathy_table = pd.read_csv(os.path.join(data_dir, 'aegirbath2.txt'), - delimiter="\t", - header=None) +bathy_table = pd.read_csv( + os.path.join(data_dir, "aegirbath2.txt"), delimiter="\t", header=None +) -soil_grid = pd.read_csv(os.path.join(data_dir, 'aegirsoil2.txt'), - delimiter="\t", - header=None) +soil_grid = pd.read_csv( + os.path.join(data_dir, "aegirsoil2.txt"), delimiter="\t", header=None +) -Z1=bathy_table[2] -dZ=soil_grid[3] +Z1 = bathy_table[2] +dZ = soil_grid[3] -Z=np.array([Z1.values,(Z1-dZ).values]).T -sediment = np.array([soil_grid[2].values,soil_grid[4].values]).T +Z = np.array([Z1.values, (Z1 - dZ).values]).T +sediment = np.array([soil_grid[2].values, soil_grid[4].values]).T x_max = bathy_table.max()[0] y_max = bathy_table.max()[1] x_min = bathy_table.min()[0] y_min = bathy_table.min()[1] -nx=144 -ny=176 +nx = 144 +ny = 176 -dx = (x_max-x_min)/(nx-1) -dy = (y_max-y_min)/(ny-1) +dx = (x_max - x_min) / (nx - 1) +dy = (y_max - y_min) / (ny - 1) -x= np.linspace(x_min , x_max , nx) -y = np.linspace(y_min , y_max , ny) -[X,Y] = np.meshgrid(x,y) +x = np.linspace(x_min, x_max, nx) +y = np.linspace(y_min, y_max, ny) +[X, Y] = np.meshgrid(x, y) -bathy_table[0]=np.ravel(X) -bathy_table[1]=np.ravel(Y) +bathy_table[0] = np.ravel(X) +bathy_table[1] = np.ravel(Y) -layers = (0,1) +layers = (0, 1) depth_layers = [] @@ -210,69 +399,64 @@ d = [] s = [] for x_count in x: - point_df = bathy_table[(bathy_table[0] == x_count) & - (bathy_table[1] == y_count)].index[0] - - d.append(Z[point_df,z]) - s.append(sediment[point_df,z]) - + point_df = bathy_table[ + (bathy_table[0] == x_count) & (bathy_table[1] == y_count) + ].index[0] + + d.append(Z[point_df, z]) + s.append(sediment[point_df, z]) + depths.append(d) sediments.append(s) - + depth_layers.append(depths) sediment_layers.append(sediments) - + depth_array = np.swapaxes(np.array(depth_layers, dtype=float), 0, 2) sediment_array = np.swapaxes(np.array(sediment_layers), 0, 2) layer_names = ["layer {}".format(x_layers) for x_layers in layers] -strata = strata={"values": {"depth": depth_array, - 'sediment': sediment_array}, - "coords": [x, y, layer_names]} - -test_data = { -# "farm.protected_table": protected_table, -# "farm.receptors_table": receptors_table, - "farm.hydro_energy_modif_weight": hydro_energy_modif_weight, - "project.hydro_collision_risk_weight": - hydro_collision_risk_weight, - "farm.hydro_turbidity_risk_weight": hydro_turbidity_risk_weight, - "device.hydro_underwater_noise_risk_weight": - hydro_underwater_noise_risk_weight, - "farm.hydro_reserve_effect_weight": hydro_reserve_effect_weight, - "device.hydro_reef_effect_weight": hydro_reef_effect_weight, - "device.hydro_resting_place_weight": hydro_resting_place_weight, -# "project.resource_reduction": resource_reduction, - "project.layout": layout, - "farm.initial_turbidity": initial_turbidity, - "project.hydro_measured_turbidity": measured_turbidity, - "farm.initial_noise": initial_turbidity, - "project.hydro_measured_noise": measured_noise, - "project.number_of_devices": number_of_devices, -# "device.system_draft": device_draft, -# "device.system_width": device_width, -# "device.system_length": device_length, -# "device.system_height": device_height, -# "farm.direction_of_max_surface_current": current_direction, - "project.fishery_restricted_area": fishery_restricted_area, - "site.lease_boundary": lease_boundary, - "bathymetry.layers": strata, - "farm.protected_species": protected_species, - "farm.receptor_species": receptor_species, -# 'bathymetry.mooring_buried_line_bearing_capacity_factor': linebcf - } - - - - +strata = strata = { + "values": {"depth": depth_array, "sediment": sediment_array}, + "coords": [x, y, layer_names], +} + +test_data = { + # "farm.protected_table": protected_table, + # "farm.receptors_table": receptors_table, + "farm.hydro_energy_modif_weight": hydro_energy_modif_weight, + "project.hydro_collision_risk_weight": hydro_collision_risk_weight, + "farm.hydro_turbidity_risk_weight": hydro_turbidity_risk_weight, + "device.hydro_underwater_noise_risk_weight": hydro_underwater_noise_risk_weight, + "farm.hydro_reserve_effect_weight": hydro_reserve_effect_weight, + "device.hydro_reef_effect_weight": hydro_reef_effect_weight, + "device.hydro_resting_place_weight": hydro_resting_place_weight, + # "project.resource_reduction": resource_reduction, + "project.layout": layout, + "farm.initial_turbidity": initial_turbidity, + "project.hydro_measured_turbidity": measured_turbidity, + "farm.initial_noise": initial_turbidity, + "project.hydro_measured_noise": measured_noise, + "project.number_of_devices": number_of_devices, + # "device.system_draft": device_draft, + # "device.system_width": device_width, + # "device.system_length": device_length, + # "device.system_height": device_height, + # "farm.direction_of_max_surface_current": current_direction, + "project.fishery_restricted_area": fishery_restricted_area, + "site.lease_boundary": lease_boundary, + "bathymetry.layers": strata, + "farm.protected_species": protected_species, + "farm.receptor_species": receptor_species, + # 'bathymetry.mooring_buried_line_bearing_capacity_factor': linebcf +} + + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) - + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_reliability.py b/packages/dtocean-core/test_data/inputs_reliability.py index 092a057..e7df560 100644 --- a/packages/dtocean-core/test_data/inputs_reliability.py +++ b/packages/dtocean-core/test_data/inputs_reliability.py @@ -6,76 +6,75 @@ """ import os -from collections import Counter +from collections import Counter # noqa: F401 import pandas as pd -from dtocean_core.utils.reliability import (get_reliability_tables, - compdict_from_mock) +from dtocean_core.utils.reliability import ( + compdict_from_mock, + get_reliability_tables, +) this_dir = os.path.dirname(os.path.realpath(__file__)) moor_dir = os.path.join(this_dir, "moorings") elec_dir = os.path.join(this_dir, "electrical") reli_dir = os.path.join(this_dir, "reliability") -compdict = eval(open(os.path.join(moor_dir, 'dummycompdb.txt')).read()) +compdict = eval(open(os.path.join(moor_dir, "dummycompdb.txt")).read()) -component_data_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(component_data_path, encoding = 'utf-8') +component_data_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(component_data_path) elec_dict = compdict_from_mock(xls_file) - compdict.update(elec_dict) -comp_tables = get_reliability_tables(compdict) #component database - -moor_found_network = {"topology": eval(open(os.path.join(reli_dir , - 'dummymoorhier.txt')).read()), - "nodes": eval(open(os.path.join(reli_dir , - 'dummymoorbom.txt')).read())} - -electrical_network = {"topology": eval(open(os.path.join(reli_dir , - 'dummyelechier.txt')).read()), - "nodes": eval(open(os.path.join(reli_dir , - 'dummyelecbom.txt')).read())} - -test_data = {"project.moorings_foundations_network": moor_found_network, - "project.electrical_network": electrical_network, - "component.moorings_chain_NCFR": comp_tables["chain NCFR"], - "component.moorings_chain_CFR": comp_tables["chain CFR"], - "component.moorings_forerunner_NCFR":comp_tables["forerunner NCFR"], - "component.moorings_forerunner_CFR": comp_tables["forerunner CFR"], - "component.moorings_shackle_NCFR":comp_tables["shackle NCFR"], - "component.moorings_shackle_CFR": comp_tables["shackle CFR"], - "component.moorings_swivel_NCFR":comp_tables["swivel NCFR"], - "component.moorings_swivel_CFR": comp_tables["swivel CFR"], - "component.foundations_anchor_NCFR":comp_tables["anchor NCFR"], - "component.foundations_anchor_CFR": comp_tables["anchor CFR"], - "component.foundations_pile_NCFR":comp_tables["pile NCFR"], - "component.foundations_pile_CFR": comp_tables["pile CFR"], - "component.moorings_rope_NCFR":comp_tables["rope NCFR"], - "component.moorings_rope_CFR": comp_tables["rope CFR"], - "component.static_cable_NCFR":comp_tables["static_cable NCFR"], - "component.static_cable_CFR": comp_tables["static_cable CFR"], - "component.dynamic_cable_NCFR":comp_tables["dynamic_cable NCFR"], - "component.dynamic_cable_CFR": comp_tables["dynamic_cable CFR"], - "component.wet_mate_connectors_NCFR":comp_tables["wet_mate NCFR"], - "component.wet_mate_connectors_CFR": comp_tables["wet_mate CFR"], - "component.dry_mate_connectors_NCFR":comp_tables["dry_mate NCFR"], - "component.dry_mate_connectors_CFR": comp_tables["dry_mate CFR"], - "component.transformers_NCFR":comp_tables["transformer NCFR"], - "component.transformers_CFR": comp_tables["transformer CFR"], - "component.collection_points_NCFR":comp_tables["collection_point NCFR"], - "component.collection_points_CFR": comp_tables["collection_point CFR"], - } +comp_tables = get_reliability_tables(compdict) # component database + +moor_found_network = { + "topology": eval(open(os.path.join(reli_dir, "dummymoorhier.txt")).read()), + "nodes": eval(open(os.path.join(reli_dir, "dummymoorbom.txt")).read()), +} + +electrical_network = { + "topology": eval(open(os.path.join(reli_dir, "dummyelechier.txt")).read()), + "nodes": eval(open(os.path.join(reli_dir, "dummyelecbom.txt")).read()), +} + +test_data = { + "project.moorings_foundations_network": moor_found_network, + "project.electrical_network": electrical_network, + "component.moorings_chain_NCFR": comp_tables["chain NCFR"], + "component.moorings_chain_CFR": comp_tables["chain CFR"], + "component.moorings_forerunner_NCFR": comp_tables["forerunner NCFR"], + "component.moorings_forerunner_CFR": comp_tables["forerunner CFR"], + "component.moorings_shackle_NCFR": comp_tables["shackle NCFR"], + "component.moorings_shackle_CFR": comp_tables["shackle CFR"], + "component.moorings_swivel_NCFR": comp_tables["swivel NCFR"], + "component.moorings_swivel_CFR": comp_tables["swivel CFR"], + "component.foundations_anchor_NCFR": comp_tables["anchor NCFR"], + "component.foundations_anchor_CFR": comp_tables["anchor CFR"], + "component.foundations_pile_NCFR": comp_tables["pile NCFR"], + "component.foundations_pile_CFR": comp_tables["pile CFR"], + "component.moorings_rope_NCFR": comp_tables["rope NCFR"], + "component.moorings_rope_CFR": comp_tables["rope CFR"], + "component.static_cable_NCFR": comp_tables["static_cable NCFR"], + "component.static_cable_CFR": comp_tables["static_cable CFR"], + "component.dynamic_cable_NCFR": comp_tables["dynamic_cable NCFR"], + "component.dynamic_cable_CFR": comp_tables["dynamic_cable CFR"], + "component.wet_mate_connectors_NCFR": comp_tables["wet_mate NCFR"], + "component.wet_mate_connectors_CFR": comp_tables["wet_mate CFR"], + "component.dry_mate_connectors_NCFR": comp_tables["dry_mate NCFR"], + "component.dry_mate_connectors_CFR": comp_tables["dry_mate CFR"], + "component.transformers_NCFR": comp_tables["transformer NCFR"], + "component.transformers_CFR": comp_tables["transformer CFR"], + "component.collection_points_NCFR": comp_tables["collection_point NCFR"], + "component.collection_points_CFR": comp_tables["collection_point CFR"], +} if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) - + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_wp2_tidal.py b/packages/dtocean-core/test_data/inputs_wp2_tidal.py index 9de99c4..344f336 100644 --- a/packages/dtocean-core/test_data/inputs_wp2_tidal.py +++ b/packages/dtocean-core/test_data/inputs_wp2_tidal.py @@ -6,113 +6,280 @@ """ import os + import numpy as np import pandas as pd - from scipy.stats import multivariate_normal, norm # Setup -x = np.linspace(0.,1100.,100) -y = np.linspace(0.,300.,30) +x = np.linspace(0.0, 1100.0, 100) +y = np.linspace(0.0, 300.0, 30) nx = len(x) ny = len(y) # Bathymetry? -X, Y = np.meshgrid(x,y) +X, Y = np.meshgrid(x, y) Z = -X * 0.1 - 1 depths = Z.T[:, :, np.newaxis] sediments = np.full((nx, ny, 1), "rock") - -strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} + +strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} # Machine data -X = np.array([ 0. , 0.1010101 , 0.2020202 , 0.3030303 , - 0.4040404 , 0.50505051, 0.60606061, 0.70707071, - 0.80808081, 0.90909091, 1.01010101, 1.11111111, - 1.21212121, 1.31313131, 1.41414141, 1.51515152, - 1.61616162, 1.71717172, 1.81818182, 1.91919192, - 2.02020202, 2.12121212, 2.22222222, 2.32323232, - 2.42424242, 2.52525253, 2.62626263, 2.72727273, - 2.82828283, 2.92929293, 3.03030303, 3.13131313, - 3.23232323, 3.33333333, 3.43434343, 3.53535354, - 3.63636364, 3.73737374, 3.83838384, 3.93939394, - 4.04040404, 4.14141414, 4.24242424, 4.34343434, - 4.44444444, 4.54545455, 4.64646465, 4.74747475, - 4.84848485, 4.94949495, 5.05050505, 5.15151515, - 5.25252525, 5.35353535, 5.45454545, 5.55555556, - 5.65656566, 5.75757576, 5.85858586, 5.95959596, - 6.06060606, 6.16161616, 6.26262626, 6.36363636, - 6.46464646, 6.56565657, 6.66666667, 6.76767677, - 6.86868687, 6.96969697, 7.07070707, 7.17171717, - 7.27272727, 7.37373737, 7.47474747, 7.57575758, - 7.67676768, 7.77777778, 7.87878788, 7.97979798, - 8.08080808, 8.18181818, 8.28282828, 8.38383838, - 8.48484848, 8.58585859, 8.68686869, 8.78787879, - 8.88888889, 8.98989899, 9.09090909, 9.19191919, - 9.29292929, 9.39393939, 9.49494949, 9.5959596 , - 9.6969697 , 9.7979798 , 9.8989899 , 10. ]) - -Cp = np.array([ 0. , 0. , 0. , 0. , 0. , - 0. , 0. , 0. , 0. , 0. , - 0.00248182, 0.0273 , 0.05211818, 0.07693636, 0.10175455, - 0.12657273, 0.15139091, 0.17620909, 0.20102727, 0.22584545, - 0.25066364, 0.27548182, 0.3003 , 0.32511818, 0.34993636, - 0.37475455, 0.39957273, 0.42439091, 0.44920909, 0.47402727, - 0.49884545, 0.52366364, 0.54848182, 0.5733 , 0.59811818, - 0.62293636, 0.64775455, 0.67257273, 0.69739091, 0.72220909, - 0.74702727, 0.77184545, 0.79666364, 0.82148182, 0.8463 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 - ]) - -Ct = 0.4*np.ones((100)) - -#p = np.array([1.]) -#N = len(p) -#V = 1.*np.ones((ny,nx,N)) -#U = 2.*np.ones((ny,nx,N)) -#SSH = 3.0*np.ones((N)) -#tide_matrix = {'V':V,'U':U,'p':p,'TI':TI,'x':x,'y':y,'SSH':SSH} +X = np.array( + [ + 0.0, + 0.1010101, + 0.2020202, + 0.3030303, + 0.4040404, + 0.50505051, + 0.60606061, + 0.70707071, + 0.80808081, + 0.90909091, + 1.01010101, + 1.11111111, + 1.21212121, + 1.31313131, + 1.41414141, + 1.51515152, + 1.61616162, + 1.71717172, + 1.81818182, + 1.91919192, + 2.02020202, + 2.12121212, + 2.22222222, + 2.32323232, + 2.42424242, + 2.52525253, + 2.62626263, + 2.72727273, + 2.82828283, + 2.92929293, + 3.03030303, + 3.13131313, + 3.23232323, + 3.33333333, + 3.43434343, + 3.53535354, + 3.63636364, + 3.73737374, + 3.83838384, + 3.93939394, + 4.04040404, + 4.14141414, + 4.24242424, + 4.34343434, + 4.44444444, + 4.54545455, + 4.64646465, + 4.74747475, + 4.84848485, + 4.94949495, + 5.05050505, + 5.15151515, + 5.25252525, + 5.35353535, + 5.45454545, + 5.55555556, + 5.65656566, + 5.75757576, + 5.85858586, + 5.95959596, + 6.06060606, + 6.16161616, + 6.26262626, + 6.36363636, + 6.46464646, + 6.56565657, + 6.66666667, + 6.76767677, + 6.86868687, + 6.96969697, + 7.07070707, + 7.17171717, + 7.27272727, + 7.37373737, + 7.47474747, + 7.57575758, + 7.67676768, + 7.77777778, + 7.87878788, + 7.97979798, + 8.08080808, + 8.18181818, + 8.28282828, + 8.38383838, + 8.48484848, + 8.58585859, + 8.68686869, + 8.78787879, + 8.88888889, + 8.98989899, + 9.09090909, + 9.19191919, + 9.29292929, + 9.39393939, + 9.49494949, + 9.5959596, + 9.6969697, + 9.7979798, + 9.8989899, + 10.0, + ] +) + +Cp = np.array( + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.00248182, + 0.0273, + 0.05211818, + 0.07693636, + 0.10175455, + 0.12657273, + 0.15139091, + 0.17620909, + 0.20102727, + 0.22584545, + 0.25066364, + 0.27548182, + 0.3003, + 0.32511818, + 0.34993636, + 0.37475455, + 0.39957273, + 0.42439091, + 0.44920909, + 0.47402727, + 0.49884545, + 0.52366364, + 0.54848182, + 0.5733, + 0.59811818, + 0.62293636, + 0.64775455, + 0.67257273, + 0.69739091, + 0.72220909, + 0.74702727, + 0.77184545, + 0.79666364, + 0.82148182, + 0.8463, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + ] +) + +Ct = 0.4 * np.ones((100)) + +# p = np.array([1.]) +# N = len(p) +# V = 1.*np.ones((ny,nx,N)) +# U = 2.*np.ones((ny,nx,N)) +# SSH = 3.0*np.ones((N)) +# tide_matrix = {'V':V,'U':U,'p':p,'TI':TI,'x':x,'y':y,'SSH':SSH} # Performance curves are matched to the same veloity abscissae -tidal_performance = {"Velocity": X, - "Coefficient of Power": Cp, - "Coefficient of Thrust": Ct} - +tidal_performance = { + "Velocity": X, + "Coefficient of Power": Cp, + "Coefficient of Thrust": Ct, +} + # Tidal time series n_bins = 6 time_points = 48 -t = pd.date_range('1/1/2011', periods=time_points, freq='H') +t = pd.date_range("1/1/2011", periods=time_points, freq="h") rv = norm() -time_sin = np.sin(np.linspace(0, 4*np.pi, time_points)) -time_scaled = time_sin * (1. / np.amax(time_sin)) +time_sin = np.sin(np.linspace(0, 4 * np.pi, time_points)) +time_scaled = time_sin * (1.0 / np.amax(time_sin)) -xgrid, ygrid = np.meshgrid(x,y) +xgrid, ygrid = np.meshgrid(x, y) pos = np.dstack((xgrid, ygrid)) -rv = multivariate_normal([500., 150.], [[max(x)*5., max(y)*2.], - [max(y)*2., max(x)*5.]]) +rv = multivariate_normal( + [500.0, 150.0], + [[max(x) * 5.0, max(y) * 2.0], [max(y) * 2.0, max(x) * 5.0]], # type: ignore +) -u_max = 0. -v_max = 6. -ssh_max = 1. +u_max = 0.0 +v_max = 6.0 +ssh_max = 1.0 TI = 0.1 grid_pdf = rv.pdf(pos).T -#u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) +# u_scaled = grid_pdf * (u_max / np.amax(grid_pdf)) u_scaled = np.ones((nx, ny)) * u_max v_scaled = np.ones((nx, ny)) * v_max ssh_scaled = grid_pdf * (ssh_max / np.amax(grid_pdf)) @@ -122,7 +289,6 @@ ssh_arrays = [] for multiplier in time_scaled: - u_arrays.append(np.abs(u_scaled * multiplier)) v_arrays.append(np.abs(v_scaled * multiplier)) ssh_arrays.append(ssh_scaled * multiplier) @@ -132,86 +298,82 @@ SSH = np.dstack(ssh_arrays) TI = np.ones(SSH.shape) * TI -tidal_series_raw = {"values": {"U": U, - "V": V, - "SSH": SSH, - "TI": TI}, - "coords": [x, y, t]} - -xc = x[int(nx/2)] -yc = y[int(ny/2)] +tidal_series_raw = { + "values": {"U": U, "V": V, "SSH": SSH, "TI": TI}, + "coords": [x, y, t], +} + +xc = x[int(nx / 2)] +yc = y[int(ny / 2)] tidal_point = (xc, yc) # Fixed array layout -pos = [(450., 100.), - (550., 100.), - (450., 150.), - (550., 150.)] +pos = [(450.0, 100.0), (550.0, 100.0), (450.0, 150.0), (550.0, 150.0)] FixedArrayLayout = np.array(pos) # Lease area is extended beyond bathymetry limits. -lease_area = np.array([[50., 50.], - [1050., 50.], - [1050., 250.], - [50., 250.]], - dtype=float) -power_law_exponent = np.array([7.]) -nogo_areas = {"a": np.array([[50., 50.],[60., 50.],[60., 60.],[50., 60.]])} -rated_array_power = 10. +lease_area = np.array( + [[50.0, 50.0], [1050.0, 50.0], [1050.0, 250.0], [50.0, 250.0]], dtype=float +) +power_law_exponent = np.array([7.0]) +nogo_areas = { + "a": np.array([[50.0, 50.0], [60.0, 50.0], [60.0, 60.0], [50.0, 60.0]]) +} +rated_array_power = 10.0 main_direction = None -blockage_ratio = 1. -turbine_hub_height = 20. -user_array_option = 'User Defined Fixed' +blockage_ratio = 1.0 +turbine_hub_height = 20.0 +user_array_option = "User Defined Fixed" user_array_layout = FixedArrayLayout -rotor_diam = 8. -turbine_interdist = 20. +rotor_diam = 8.0 +turbine_interdist = 20.0 min_install = -np.inf -max_install = 0. -min_dist_x = 40. -min_dist_y = 40. +max_install = 0.0 +min_dist_x = 40.0 +min_dist_y = 40.0 bidirection = True -rated_power_device = 1. -yaw_angle = 0. -cut_in = 1. -cut_out = 5. -op_threshold = 0. - -landing_point = (0.,0.) - -test_data = {'bathymetry.layers': strata, - 'corridor.landing_point': landing_point, - 'device.bidirection': bidirection, - 'device.turbine_hub_height': turbine_hub_height, - 'device.cut_in_velocity': cut_in, - 'device.cut_out_velocity': cut_out, - 'device.installation_depth_max': max_install, - 'device.installation_depth_min': min_install, - 'device.minimum_distance_x': min_dist_x, - 'device.minimum_distance_y': min_dist_y, - 'options.optimisation_threshold': op_threshold, - 'device.power_rating': rated_power_device, - 'device.turbine_diameter': rotor_diam, - 'device.turbine_interdistance': turbine_interdist, - 'device.turbine_performance': tidal_performance, - 'device.yaw': yaw_angle, - 'farm.blockage_ratio': blockage_ratio, - 'site.lease_boundary': lease_area, - 'project.main_direction': main_direction, - 'farm.nogo_areas': nogo_areas, - 'project.rated_power': rated_array_power, - 'farm.tidal_series': tidal_series_raw, - 'project.tidal_occurrence_nbins': n_bins, - 'farm.tidal_occurrence_point': tidal_point, - 'options.user_array_layout': user_array_layout, - 'options.user_array_option': user_array_option} - +rated_power_device = 1.0 +yaw_angle = 0.0 +cut_in = 1.0 +cut_out = 5.0 +op_threshold = 0.0 + +landing_point = (0.0, 0.0) + +test_data = { + "bathymetry.layers": strata, + "corridor.landing_point": landing_point, + "device.bidirection": bidirection, + "device.turbine_hub_height": turbine_hub_height, + "device.cut_in_velocity": cut_in, + "device.cut_out_velocity": cut_out, + "device.installation_depth_max": max_install, + "device.installation_depth_min": min_install, + "device.minimum_distance_x": min_dist_x, + "device.minimum_distance_y": min_dist_y, + "options.optimisation_threshold": op_threshold, + "device.power_rating": rated_power_device, + "device.turbine_diameter": rotor_diam, + "device.turbine_interdistance": turbine_interdist, + "device.turbine_performance": tidal_performance, + "device.yaw": yaw_angle, + "farm.blockage_ratio": blockage_ratio, + "site.lease_boundary": lease_area, + "project.main_direction": main_direction, + "farm.nogo_areas": nogo_areas, + "project.rated_power": rated_array_power, + "farm.tidal_series": tidal_series_raw, + "project.tidal_occurrence_nbins": n_bins, + "farm.tidal_occurrence_point": tidal_point, + "options.user_array_layout": user_array_layout, + "options.user_array_option": user_array_option, +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_wp2_wave.py b/packages/dtocean-core/test_data/inputs_wp2_wave.py index ca84cd5..73ca35f 100644 --- a/packages/dtocean-core/test_data/inputs_wp2_wave.py +++ b/packages/dtocean-core/test_data/inputs_wp2_wave.py @@ -10,119 +10,115 @@ import numpy as np - dir_path = os.path.dirname(__file__) # Setup -x = np.linspace(0.,1000.,20.) -y = np.linspace(0.,300.,20.) +x = np.linspace(0.0, 1000.0, 20) +y = np.linspace(0.0, 300.0, 20) nx = len(x) ny = len(y) # Bathymetry? -X, Y = np.meshgrid(x,y) +X, Y = np.meshgrid(x, y) Z = -X * 0.1 - 1 depths = Z.T[:, :, np.newaxis] sediments = np.full((nx, ny, 1), "rock") - -strata = {"values": {'depth': depths, - 'sediment': sediments}, - "coords": [x, y, ["layer 1"]]} + +strata = { + "values": {"depth": depths, "sediment": sediments}, + "coords": [x, y, ["layer 1"]], +} sample_size = 1000 dates = [] -dt = datetime(2010, 12, 01) +dt = datetime(2010, 12, 1) step = timedelta(seconds=3600) - + for _ in range(sample_size): dates.append(dt) dt += step - -Hm0 = 9. * np.random.random_sample(sample_size) -direction = 360. * np.random.random_sample(sample_size) -Te = 15. * np.random.random_sample(sample_size) -wave_series = {"DateTime": dates, - "Te": Te, - "Hm0": Hm0, - "Dir": direction} +Hm0 = 9.0 * np.random.random_sample(sample_size) +direction = 360.0 * np.random.random_sample(sample_size) +Te = 15.0 * np.random.random_sample(sample_size) + +wave_series = {"DateTime": dates, "Te": Te, "Hm0": Hm0, "Dir": direction} # Fixed array layout -pos = [(450., 100.), - (550., 100.), - (450., 150.), - (550., 150.)] +pos = [(450.0, 100.0), (550.0, 100.0), (450.0, 150.0), (550.0, 150.0)] FixedArrayLayout = np.array(pos) - -#wave_xgrid = None -#B= np.array([0.,270.])/180*np.pi -#H= np.array([1.]) -#T= np.array([6.]) -#p= 1.0/len(B)/len(H)/len(T)* np.ones((len(T),len(H),len(B))) -# -#occurrence_matrix_coords = [T,H,B] -#wave_xgrid = {"values": p, + +# wave_xgrid = None +# B= np.array([0.,270.])/180*np.pi +# H= np.array([1.]) +# T= np.array([6.]) +# p= 1.0/len(B)/len(H)/len(T)* np.ones((len(T),len(H),len(B))) +# +# occurrence_matrix_coords = [T,H,B] +# wave_xgrid = {"values": p, # "coords": occurrence_matrix_coords} -lease_area = np.array([[50., 50.],[950., 50.],[950., 250.],[50., 250.]],dtype=float) -power_law_exponent = np.array([7.]) -nogo_areas = {"a": np.array([[0, 0],[.1, 0],[.1, .1],[0, .1]])} -rated_array_power = 5. +lease_area = np.array( + [[50.0, 50.0], [950.0, 50.0], [950.0, 250.0], [50.0, 250.0]], dtype=float +) +power_law_exponent = np.array([7.0]) +nogo_areas = {"a": np.array([[0, 0], [0.1, 0], [0.1, 0.1], [0, 0.1]])} +rated_array_power = 5.0 main_direction = None -blockage_ratio = 1. -spectrum_type_farm = 'JONSWAP' +blockage_ratio = 1.0 +spectrum_type_farm = "JONSWAP" spectrum_gamma_farm = 3.3 -spectrum_dir_spreading_farm = 0. -point_SSH = 0. -#user_array_option = 'rectangular' -#user_array_layout = None -user_array_option = 'User Defined Fixed' +spectrum_dir_spreading_farm = 0.0 +point_SSH = 0.0 +# user_array_option = 'rectangular' +# user_array_layout = None +user_array_option = "User Defined Fixed" user_array_layout = FixedArrayLayout wave_data_directory = os.path.abspath(os.path.join(dir_path, "nemoh")) float_flag = False min_install = -np.inf -max_install = 0. -min_dist_x = 40. -min_dist_y = 40. -yaw_angle = 0. -rated_power_device = 1. -op_threshold = 0. - -landing_point = (0.,0.) - -test_data = {'bathymetry.layers': strata, - 'corridor.landing_point': landing_point, - 'device.installation_depth_max': max_install, - 'device.installation_depth_min': min_install, - 'device.minimum_distance_x': min_dist_x, - 'device.minimum_distance_y': min_dist_y, - 'options.optimisation_threshold': op_threshold, - 'device.power_rating': rated_power_device, - 'device.wave_data_directory': wave_data_directory, - 'device.yaw': yaw_angle, - 'farm.blockage_ratio': blockage_ratio, - 'site.lease_boundary': lease_area, - 'project.main_direction': main_direction, - 'farm.nogo_areas': nogo_areas, -# 'farm.point_sea_surface_height': point_SSH, -# 'farm.power_law_exponent': power_law_exponent, - 'project.rated_power': rated_array_power, - 'farm.spec_gamma': spectrum_gamma_farm, - 'farm.spec_spread': spectrum_dir_spreading_farm, - 'farm.spectrum_name': spectrum_type_farm, -# 'farm.wave_occurrence': wave_xgrid, - 'farm.wave_series': wave_series, - 'options.user_array_layout': user_array_layout, - 'options.user_array_option': user_array_option} - +max_install = 0.0 +min_dist_x = 40.0 +min_dist_y = 40.0 +yaw_angle = 0.0 +rated_power_device = 1.0 +op_threshold = 0.0 + +landing_point = (0.0, 0.0) + +test_data = { + "bathymetry.layers": strata, + "corridor.landing_point": landing_point, + "device.installation_depth_max": max_install, + "device.installation_depth_min": min_install, + "device.minimum_distance_x": min_dist_x, + "device.minimum_distance_y": min_dist_y, + "options.optimisation_threshold": op_threshold, + "device.power_rating": rated_power_device, + "device.wave_data_directory": wave_data_directory, + "device.yaw": yaw_angle, + "farm.blockage_ratio": blockage_ratio, + "site.lease_boundary": lease_area, + "project.main_direction": main_direction, + "farm.nogo_areas": nogo_areas, + # 'farm.point_sea_surface_height': point_SSH, + # 'farm.power_law_exponent': power_law_exponent, + "project.rated_power": rated_array_power, + "farm.spec_gamma": spectrum_gamma_farm, + "farm.spec_spread": spectrum_dir_spreading_farm, + "farm.spectrum_name": spectrum_type_farm, + # 'farm.wave_occurrence': wave_xgrid, + "farm.wave_series": wave_series, + "options.user_array_layout": user_array_layout, + "options.user_array_option": user_array_option, +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_wp3.py b/packages/dtocean-core/test_data/inputs_wp3.py index 10cd119..e132260 100644 --- a/packages/dtocean-core/test_data/inputs_wp3.py +++ b/packages/dtocean-core/test_data/inputs_wp3.py @@ -6,22 +6,24 @@ """ import os -import pandas as pd + import numpy as np -#from shapely.geometry import Polygon +import pandas as pd + +# from shapely.geometry import Polygon this_dir = os.path.dirname(os.path.realpath(__file__)) elec_dir = os.path.join(this_dir, "electrical") - -file_path = os.path.join(elec_dir, 'lease_area.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') + +file_path = os.path.join(elec_dir, "lease_area.xlsx") +xls_file = pd.ExcelFile(file_path) sheet_names = xls_file.sheet_names lease_bathymetry = xls_file.parse(sheet_names[0]) layers = [1] Z = np.array([lease_bathymetry["layer 1 start"]]).T - + sediment = np.array([lease_bathymetry["layer 1 type"]]).T x_max = lease_bathymetry.max()["x"] @@ -29,71 +31,72 @@ x_min = lease_bathymetry.min()["x"] y_min = lease_bathymetry.min()["y"] -num_x = (lease_bathymetry.max()["i"]-lease_bathymetry.min()["i"])+1 -num_y = (lease_bathymetry.max()["j"]-lease_bathymetry.min()["j"])+1 +num_x = (lease_bathymetry.max()["i"] - lease_bathymetry.min()["i"]) + 1 +num_y = (lease_bathymetry.max()["j"] - lease_bathymetry.min()["j"]) + 1 -x= np.linspace(x_min , x_max , num_x) -y = np.linspace(y_min , y_max , num_y) +x = np.linspace(x_min, x_max, num_x) +y = np.linspace(y_min, y_max, num_y) depth_layers = [] sediment_layers = [] for z in layers: - depths = [] sediments = [] - + for y_count in y: - d = [] s = [] - + for x_count in x: - - point_df = lease_bathymetry[(lease_bathymetry["x"] == x_count) & - (lease_bathymetry["y"] == y_count) - ].index[0] - - if Z[point_df,z-1] == "None": - Z[point_df,z-1] = np.nan - - d.append(Z[point_df,z-1]) - s.append(sediment[point_df,z-1]) - + point_df = lease_bathymetry[ + (lease_bathymetry["x"] == x_count) + & (lease_bathymetry["y"] == y_count) + ].index[0] + + if Z[point_df, z - 1] == "None": + Z[point_df, z - 1] = np.nan + + d.append(Z[point_df, z - 1]) + s.append(sediment[point_df, z - 1]) + depths.append(d) sediments.append(s) - + depth_layers.append(depths) sediment_layers.append(sediments) - + depth_array = np.swapaxes(np.array(depth_layers, dtype=float), 0, 2) sediment_array = np.swapaxes(np.array(sediment_layers), 0, 2) layer_names = ["layer {}".format(x_layers) for x_layers in layers] -strata = {"values": {"depth": depth_array, - 'sediment': sediment_array}, - "coords": [x, y, layer_names]} - -nogo_areas = {"a": [(40.,40.),(40.,110.),(110.,110.), (110.,40.)]} - -current_dir = 0. -max_surf_current = 0. -wave_dir = 0. -power_rating = 1. - -layout = {'Device001': (1100.,600.,0.), - 'Device002': (1250.,900.,0.), - 'Device003': (1400.,1600.,0.)} - -connection = 'Wet-Mate' - +strata = { + "values": {"depth": depth_array, "sediment": sediment_array}, + "coords": [x, y, layer_names], +} + +nogo_areas = {"a": [(40.0, 40.0), (40.0, 110.0), (110.0, 110.0), (110.0, 40.0)]} + +current_dir = 0.0 +max_surf_current = 0.0 +wave_dir = 0.0 +power_rating = 1.0 + +layout = { + "Device001": (1100.0, 600.0, 0.0), + "Device002": (1250.0, 900.0, 0.0), + "Device003": (1400.0, 1600.0, 0.0), +} + +connection = "Wet-Mate" + number_devices = len(layout) -annual_power = 10. +annual_power = 10.0 -file_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +file_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(file_path) sheet_names = xls_file.sheet_names static_cable = xls_file.parse(sheet_names[0]) @@ -103,54 +106,55 @@ transformers = xls_file.parse(sheet_names[4]) collection_points = xls_file.parse(sheet_names[5]) -collection_point_cog = {11: [0,0,0], - 12: [0,0,0], - 22: [0,0,0], - 23: [0,0,0], - 24: [0,0,0], - 25: [0,0,0] - } - -collection_point_found = {11: [[0,0,0],[0,0,0]], - 12: [[0,0,0]], - 22: [[0,0,0],[0,0,0]], - 23: [[0,0,0],[0,0,0]], - 24: [[0,0,0],[0,0,0]], - 25: [[0,0,0],[0,0,0]] - } - -max_temp= 10. -max_soil_res = 10. -voltage = 11000. +collection_point_cog = { + 11: [0, 0, 0], + 12: [0, 0, 0], + 22: [0, 0, 0], + 23: [0, 0, 0], + 24: [0, 0, 0], + 25: [0, 0, 0], +} + +collection_point_found = { + 11: [[0, 0, 0], [0, 0, 0]], + 12: [[0, 0, 0]], + 22: [[0, 0, 0], [0, 0, 0]], + 23: [[0, 0, 0], [0, 0, 0]], + 24: [[0, 0, 0], [0, 0, 0]], + 25: [[0, 0, 0], [0, 0, 0]], +} + +max_temp = 10.0 +max_soil_res = 10.0 +voltage = 11000.0 mean_power_hist_per_device = { - 'Device001': ([0, 1.33, 1.33, 1.34], - [0, 0.25, 0.5, 0.75, 1]), - 'Device002': ([0, 4, 0, 0], - [0, 0.25, 0.5, 0.75, 1]), - 'Device003': ([0, 0.4, 2.4, 1.2], - [0, 0.25, 0.5, 0.75, 1]) - } + "Device001": ([0, 1.33, 1.33, 1.34], [0, 0.25, 0.5, 0.75, 1]), + "Device002": ([0, 4, 0, 0], [0, 0.25, 0.5, 0.75, 1]), + "Device003": ([0, 0.4, 2.4, 1.2], [0, 0.25, 0.5, 0.75, 1]), +} network_configuration = "Radial" -target_burial_depth = 10. +target_burial_depth = 10.0 devices_per_string = 10 -corridor_current_dir = 0. -corridor_nogo_areas = {"a": [(40.,40.),(40.,110.),(110.,110.), (110.,40.)]} - -corridor_max_surf_current = 0. -corridor_wave_dir = 0. -corridor_target_burial_depth= 20. -corridor_landing_point = [0,0,1] - -file_path = os.path.join(elec_dir, 'export_area.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +corridor_current_dir = 0.0 +corridor_nogo_areas = { + "a": [(40.0, 40.0), (40.0, 110.0), (110.0, 110.0), (110.0, 40.0)] +} + +corridor_max_surf_current = 0.0 +corridor_wave_dir = 0.0 +corridor_target_burial_depth = 20.0 +corridor_landing_point = [0, 0, 1] + +file_path = os.path.join(elec_dir, "export_area.xlsx") +xls_file = pd.ExcelFile(file_path) sheet_names = xls_file.sheet_names corridor_depth = xls_file.parse(sheet_names[0]) export_layers = [1] -export_Z=np.array([corridor_depth["layer 1 start"]]).T -export_sediment=np.array([corridor_depth["layer 1 type"]]).T +export_Z = np.array([corridor_depth["layer 1 start"]]).T +export_sediment = np.array([corridor_depth["layer 1 type"]]).T x_max = corridor_depth.max()["x"] y_max = corridor_depth.max()["y"] @@ -160,137 +164,131 @@ num_x = (corridor_depth.max()["i"] - corridor_depth.min()["i"]) + 1 num_y = (corridor_depth.max()["j"] - corridor_depth.min()["j"]) + 1 -x= np.linspace(x_min , x_max , num_x) -y = np.linspace(y_min , y_max , num_y) +x = np.linspace(x_min, x_max, num_x) +y = np.linspace(y_min, y_max, num_y) export_depth_layers = [] export_sediment_layers = [] for z in export_layers: - export_depths = [] export_sediments = [] - + for y_count in y: - export_d = [] export_s = [] - + for x_count in x: - - point_df = corridor_depth[(corridor_depth["x"] == x_count) & - (corridor_depth["y"] == y_count) - ].index[0] - - if export_Z[point_df,z-1] == "None": - export_Z[point_df,z-1] = np.nan - - export_d.append(export_Z[point_df,z-1]) - export_s.append(export_sediment[point_df,z-1]) - + point_df = corridor_depth[ + (corridor_depth["x"] == x_count) + & (corridor_depth["y"] == y_count) + ].index[0] + + if export_Z[point_df, z - 1] == "None": + export_Z[point_df, z - 1] = np.nan + + export_d.append(export_Z[point_df, z - 1]) + export_s.append(export_sediment[point_df, z - 1]) + export_depths.append(export_d) export_sediments.append(export_s) - + export_depth_layers.append(export_depths) export_sediment_layers.append(export_sediments) - -export_depth_array = np.swapaxes(np.array(export_depth_layers, dtype=float), - 0, 2) + +export_depth_array = np.swapaxes( + np.array(export_depth_layers, dtype=float), 0, 2 +) export_sediment_array = np.swapaxes(np.array(export_sediment_layers), 0, 2) -export_layer_names = ["layer {}".format(x_layers) - for x_layers in export_layers] +export_layer_names = ["layer {}".format(x_layers) for x_layers in export_layers] -export_strata = {"values": {"depth": export_depth_array, - 'sediment': export_sediment_array}, - "coords": [x, y, export_layer_names]} +export_strata = { + "values": {"depth": export_depth_array, "sediment": export_sediment_array}, + "coords": [x, y, export_layer_names], +} -corridor_max_temp = 10. -corridor_max_soil_res = 10. -corridor_voltage = 33000. +corridor_max_temp = 10.0 +corridor_max_soil_res = 10.0 +corridor_voltage = 33000.0 min_voltage = 0.9 max_voltage = 1.0 power_factor = 0.98 -equipment_gradient_constraint = 14. +equipment_gradient_constraint = 14.0 -file_path = os.path.join(elec_dir, 'equipment_compatibility_matrix.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +file_path = os.path.join(elec_dir, "equipment_compatibility_matrix.xlsx") +xls_file = pd.ExcelFile(file_path) sheet_names = xls_file.sheet_names -installation_soil_compatibility = xls_file.parse(sheet_names[0], - index_col=None) -installation_soil_compatibility.columns = ['Technique', - 'Loose Sand', - 'Medium Sand', - 'Dense Sand', - 'Very Soft Clay', - 'Soft Clay', - 'Firm Clay', - 'Stiff Clay', - 'Hard Glacial Till', - 'Cemented', - 'Soft Rock Coral', - 'Hard Rock', - 'Gravel Cobble'] +installation_soil_compatibility = xls_file.parse(sheet_names[0], index_col=None) +installation_soil_compatibility.columns = [ + "Technique", + "Loose Sand", + "Medium Sand", + "Dense Sand", + "Very Soft Clay", + "Soft Clay", + "Firm Clay", + "Stiff Clay", + "Hard Glacial Till", + "Cemented", + "Soft Rock Coral", + "Hard Rock", + "Gravel Cobble", +] footprint_radius = 20.0 -#footprint_coords = [(0.0,25.0,0.), (-25.0,-25.0,0.), (25.,-25.,0.)] -onshore_infrastructure_cost = 1000000. +# footprint_coords = [(0.0,25.0,0.), (-25.0,-25.0,0.), (25.,-25.,0.)] +onshore_infrastructure_cost = 1000000.0 -device_draft = 1. -umbilical_connection = [0,0,-0.5] +device_draft = 1.0 +umbilical_connection = [0, 0, -0.5] umbsf = 2.0 -gravity = 9.80665 #gravity - -test_data = { "bathymetry.layers": strata, - "farm.nogo_areas": nogo_areas, - "device.power_rating": power_rating, - "project.layout": layout, - "project.number_of_devices": number_devices, - "project.annual_energy": annual_power, - "component.static_cable": static_cable , - "component.dynamic_cable": dynamic_cable , - "component.wet_mate_connectors": wet_mate_connectors, - "component.dry_mate_connectors": dry_mate_connectors , - "component.transformers": transformers, - "component.collection_points": collection_points, - "component.collection_point_cog": collection_point_cog, - "component.collection_point_foundations": collection_point_found, - "device.voltage": voltage, - "device.connector_type": connection, - "project.network_configuration": network_configuration , - "project.target_burial_depth": target_burial_depth, - "project.devices_per_string": devices_per_string, - "corridor.nogo_areas": corridor_nogo_areas, - "project.export_target_burial_depth": - corridor_target_burial_depth, - "corridor.landing_point": corridor_landing_point, - "corridor.layers": export_strata, - "project.export_voltage": corridor_voltage, - "project.equipment_gradient_constraint": - equipment_gradient_constraint, - "component.installation_soil_compatibility": - installation_soil_compatibility, - "device.constant_power_factor": power_factor, - "device.prescribed_footprint_radius": footprint_radius, - "project.onshore_infrastructure_cost": - onshore_infrastructure_cost, - "project.mean_power_hist_per_device": mean_power_hist_per_device, - "device.system_draft": device_draft, - 'device.umbilical_connection_point': umbilical_connection, - "project.umbilical_safety_factor": umbsf, - 'constants.gravity': gravity, - } +gravity = 9.80665 # gravity + +test_data = { + "bathymetry.layers": strata, + "farm.nogo_areas": nogo_areas, + "device.power_rating": power_rating, + "project.layout": layout, + "project.number_of_devices": number_devices, + "project.annual_energy": annual_power, + "component.static_cable": static_cable, + "component.dynamic_cable": dynamic_cable, + "component.wet_mate_connectors": wet_mate_connectors, + "component.dry_mate_connectors": dry_mate_connectors, + "component.transformers": transformers, + "component.collection_points": collection_points, + "component.collection_point_cog": collection_point_cog, + "component.collection_point_foundations": collection_point_found, + "device.voltage": voltage, + "device.connector_type": connection, + "project.network_configuration": network_configuration, + "project.target_burial_depth": target_burial_depth, + "project.devices_per_string": devices_per_string, + "corridor.nogo_areas": corridor_nogo_areas, + "project.export_target_burial_depth": corridor_target_burial_depth, + "corridor.landing_point": corridor_landing_point, + "corridor.layers": export_strata, + "project.export_voltage": corridor_voltage, + "project.equipment_gradient_constraint": equipment_gradient_constraint, + "component.installation_soil_compatibility": installation_soil_compatibility, + "device.constant_power_factor": power_factor, + "device.prescribed_footprint_radius": footprint_radius, + "project.onshore_infrastructure_cost": onshore_infrastructure_cost, + "project.mean_power_hist_per_device": mean_power_hist_per_device, + "device.system_draft": device_draft, + "device.umbilical_connection_point": umbilical_connection, + "project.umbilical_safety_factor": umbsf, + "constants.gravity": gravity, +} if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) - + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_wp4.py b/packages/dtocean-core/test_data/inputs_wp4.py index 6891c12..0111a3b 100644 --- a/packages/dtocean-core/test_data/inputs_wp4.py +++ b/packages/dtocean-core/test_data/inputs_wp4.py @@ -6,9 +6,9 @@ """ import os -import pandas as pd + import numpy as np -import cPickle as pickle +import pandas as pd from dtocean_core.utils.moorings import get_moorings_tables @@ -16,84 +16,86 @@ data_dir = os.path.join(this_dir, "moorings") elec_dir = os.path.join(this_dir, "electrical") -#fex = pickle.load(open(str(data_dir)+'\\fex_pelamiscuboid.pkl','rb')) - -substparams = pd.read_csv(os.path.join(data_dir, 'substparams_aegir.txt'), - sep='\t', - index_col=False, - header=0) #substation parameters - -name_map = {'presubstfound': 'Type', - 'subcog': 'Centre of Gravity [x, y, z]', - 'subdryba': 'Dry Beam Area', - 'subdryfa': 'Dry Frontal Area', - 'subheight': 'Height', - 'sublength': 'Length', - 'submass': 'Mass', - 'suborienang': 'Orientation Angle', - 'suborig': 'Origin [x, y, z]', - 'subprof': 'Profile', - 'subrough': 'Surface Roughness', - 'substloc': 'Foundation Locations [x, y, z]', - 'subvol': 'Volume', - 'subwetba': 'Wet Beam Area', - 'subwetfa': 'Wet Frontal Area', - 'subwidth': 'Width', - 'substid': 'Substation Identifier'} - +# fex = pickle.load(open(str(data_dir)+'\\fex_pelamiscuboid.pkl','rb')) + +substparams = pd.read_csv( + os.path.join(data_dir, "substparams_aegir.txt"), + sep="\t", + index_col=False, + header=0, +) # substation parameters + +name_map = { + "presubstfound": "Type", + "subcog": "Centre of Gravity [x, y, z]", + "subdryba": "Dry Beam Area", + "subdryfa": "Dry Frontal Area", + "subheight": "Height", + "sublength": "Length", + "submass": "Mass", + "suborienang": "Orientation Angle", + "suborig": "Origin [x, y, z]", + "subprof": "Profile", + "subrough": "Surface Roughness", + "substloc": "Foundation Locations [x, y, z]", + "subvol": "Volume", + "subwetba": "Wet Beam Area", + "subwetfa": "Wet Frontal Area", + "subwidth": "Width", + "substid": "Substation Identifier", +} + substparams = substparams.rename(columns=name_map) substparams["Marker"] = range(len(substparams)) -sub_ids = substparams['Substation Identifier'] -subcog = substparams.pop('Centre of Gravity [x, y, z]') -suborig = substparams.pop('Origin [x, y, z]') -substloc = substparams.pop('Foundation Locations [x, y, z]') +sub_ids = substparams["Substation Identifier"] +subcog = substparams.pop("Centre of Gravity [x, y, z]") +suborig = substparams.pop("Origin [x, y, z]") +substloc = substparams.pop("Foundation Locations [x, y, z]") raw_origin_dict = {} raw_cog_dict = {} raw_found_dict = {} for i, sub_id in enumerate(sub_ids): - raw_origin_dict[sub_id] = eval(suborig.iloc[i]) raw_cog_dict[sub_id] = eval(subcog.iloc[i]) raw_found_dict[sub_id] = eval(substloc.iloc[i]) -bathy_table = pd.read_csv(os.path.join(data_dir, 'aegirbath2.txt'), - delimiter="\t", - header=None) - -soil_grid = pd.read_csv(os.path.join(data_dir, 'aegirsoil2.txt'), - delimiter="\t", - header=None) - -soilprops = pd.read_csv(os.path.join(data_dir, 'soilprops.txt'), - sep='\t', - header=0, - index_col=False) - -Z1=bathy_table[2] -dZ=soil_grid[3] - -Z=np.array([Z1.values,(Z1-dZ).values]).T -sediment = np.array([soil_grid[2].values,soil_grid[4].values]).T +bathy_table = pd.read_csv( + os.path.join(data_dir, "aegirbath2.txt"), delimiter="\t", header=None +) + +soil_grid = pd.read_csv( + os.path.join(data_dir, "aegirsoil2.txt"), delimiter="\t", header=None +) + +soilprops = pd.read_csv( + os.path.join(data_dir, "soilprops.txt"), sep="\t", header=0, index_col=False +) + +Z1 = bathy_table[2] +dZ = soil_grid[3] + +Z = np.array([Z1.values, (Z1 - dZ).values]).T +sediment = np.array([soil_grid[2].values, soil_grid[4].values]).T x_max = bathy_table.max()[0] y_max = bathy_table.max()[1] x_min = bathy_table.min()[0] y_min = bathy_table.min()[1] -nx=144 -ny=176 +nx = 144 +ny = 176 -dx = (x_max-x_min)/(nx-1) -dy = (y_max-y_min)/(ny-1) +dx = (x_max - x_min) / (nx - 1) +dy = (y_max - y_min) / (ny - 1) -x= np.linspace(x_min , x_max , nx) -y = np.linspace(y_min , y_max , ny) -[X,Y] = np.meshgrid(x,y) +x = np.linspace(x_min, x_max, nx) +y = np.linspace(y_min, y_max, ny) +[X, Y] = np.meshgrid(x, y) -bathy_table[0]=np.ravel(X) -bathy_table[1]=np.ravel(Y) +bathy_table[0] = np.ravel(X) +bathy_table[1] = np.ravel(Y) layers = (1,) @@ -103,421 +105,615 @@ for z in layers: depths = [] sediments = [] - + for y_count in y: - d = [] s = [] - + for x_count in x: - - point_df = bathy_table[(bathy_table[0] == x_count) & - (bathy_table[1] == y_count)].index[0] - - d.append(Z[point_df,z]) - s.append(sediment[point_df,z]) - + point_df = bathy_table[ + (bathy_table[0] == x_count) & (bathy_table[1] == y_count) + ].index[0] + + d.append(Z[point_df, z]) + s.append(sediment[point_df, z]) + depths.append(d) sediments.append(s) - + depth_layers.append(depths) sediment_layers.append(sediments) - + depth_array = np.swapaxes(np.array(depth_layers, dtype=float), 0, 2) sediment_array = np.swapaxes(np.array(sediment_layers), 0, 2).astype(object) layer_names = ["layer {}".format(x_layers) for x_layers in layers] -strata = {"values": {"depth": depth_array, - 'sediment': sediment_array}, - "coords": [x, y, layer_names]} - - -turbine_hub_height = 20. +strata = { + "values": {"depth": depth_array, "sediment": sediment_array}, + "coords": [x, y, layer_names], +} + -gravity = 9.80665 #gravity -seaden = 1025.0 #sea water density -airden = 1.226 #air density -steelden = 7750.0 #steel density -conden = 2400.0 #concrete density -groutden = 2450.0 #grout density +turbine_hub_height = 20.0 -compdict = eval(open(os.path.join(data_dir, 'dummycompdb.txt')).read()) -comp_tables = get_moorings_tables(compdict) #component database +gravity = 9.80665 # gravity +seaden = 1025.0 # sea water density +airden = 1.226 # air density +steelden = 7750.0 # steel density +conden = 2400.0 # concrete density +groutden = 2450.0 # grout density + +compdict = eval(open(os.path.join(data_dir, "dummycompdb.txt")).read()) +comp_tables = get_moorings_tables(compdict) # component database # Umbilical Cables -component_data_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(component_data_path, encoding = 'utf-8') +component_data_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(component_data_path) sheet_names = xls_file.sheet_names dynamic_cable = xls_file.parse(sheet_names[1]) -wlevmax = 5.0 #water level maximum offset -wlevmin = 0.0 #water level minimum offset -currentvel = 1.25 #current velocity -currentdir = 0.0 #current direction -currentprof = "1/7 Power Law" #current profile alternatives: "uniform" "1/7 power law" -wavedir = 0.0 #wave direction -hs = 0.5 #significant wave height. Leave the square bracket blank if there are no wave conditions to analyse -tp = 10.0 #peak wave period -gamma = 1.0 #jonswap gamma -windvel = 2.0 #wind velocity -winddir = 0.0 #wind direction -windgustvel = 6.0 #wind gust velocity -windgustdir = 0.0 #wind gust direction -draincoh = 0.0 #drained soil cohesion -unsfang = 5.0 #undrained soil friction angle -dsfang = 35.0 #drained soil friction angle -soilweight = 9.4285e+03 #buoyant soil weight -relsoilden = 50.0 #relative soil density +wlevmax = 5.0 # water level maximum offset +wlevmin = 0.0 # water level minimum offset +currentvel = 1.25 # current velocity +currentdir = 0.0 # current direction +currentprof = ( + "1/7 Power Law" # current profile alternatives: "uniform" "1/7 power law" +) +wavedir = 0.0 # wave direction +hs = 0.5 # significant wave height. Leave the square bracket blank if there are no wave conditions to analyse +tp = 10.0 # peak wave period +gamma = 1.0 # jonswap gamma +windvel = 2.0 # wind velocity +winddir = 0.0 # wind direction +windgustvel = 6.0 # wind gust velocity +windgustdir = 0.0 # wind gust direction +draincoh = 0.0 # drained soil cohesion +unsfang = 5.0 # undrained soil friction angle +dsfang = 35.0 # drained soil friction angle +soilweight = 9.4285e03 # buoyant soil weight +relsoilden = 50.0 # relative soil density undrained_soil_shear_strength_constant = 1.45e3 -undrained_soil_shear_strength_dependent = 2e3 #undrained shear friction angle -soilsen = 3.0 #soil sensitivity - -#buried line bearing capacity factors -linebcf = np.genfromtxt(os.path.join(data_dir, 'linebcf.txt'), - delimiter="\t") - -#subgrade reaction coefficients -k1coef = pd.read_csv(os.path.join(data_dir, - 'subgradereactioncoefficientk1_cohesive.txt'), - delimiter="\t", - header=None, - index_col=False, - names=['Allowable Deflection / Diameter', - 'Soft Clay Coefficient', - 'Stiff Clay Coefficient']) - -#subgrade cohesionless soil reaction coefficients -subgradereaccoef = pd.read_csv(os.path.join(data_dir, - 'subgradereactioncoefficient_cohesionless.txt'), - delimiter="\t", - header=None, - index_col=False, - names=['Allowable Deflection / Diameter', - '35% Relative Density Coefficient', - '50% Relative Density Coefficient', - '65% Relative Density Coefficient', - '85% Relative Density Coefficient']) - -#pile deflection coefficients -piledefcoef = pd.read_csv(os.path.join(data_dir, - 'piledeflectioncoefficients.txt'), - delimiter="\t", - header=None, - index_col=False, - names=['Depth Coefficient', 'Ay', 'By']) - -#pile moment coefficients am -pilemomcoefam = pd.read_csv(os.path.join(data_dir, - 'pilemomentcoefficientsam.txt'), - delimiter="\t", - header=None, - index_col=False, - names=[ - 'Depth Coefficient', - 'Pile Length / Relative Soil-Pile Stiffness = 10', - 'Pile Length / Relative Soil-Pile Stiffness = 5', - 'Pile Length / Relative Soil-Pile Stiffness = 4', - 'Pile Length / Relative Soil-Pile Stiffness = 3', - 'Pile Length / Relative Soil-Pile Stiffness = 2']) - -#pile moment coefficients bm -pilemomcoefbm = pd.read_csv(os.path.join(data_dir, - 'pilemomentcoefficientsbm.txt'), - delimiter="\t", - header=None, - index_col=False, - names=[ - 'Depth Coefficient', - 'Pile Length / Relative Soil-Pile Stiffness = 10', - 'Pile Length / Relative Soil-Pile Stiffness = 5', - 'Pile Length / Relative Soil-Pile Stiffness = 4', - 'Pile Length / Relative Soil-Pile Stiffness = 3', - 'Pile Length / Relative Soil-Pile Stiffness = 2']) - -#pile limiting values non calcaeous soils -pilefricresnoncal = pd.read_csv(os.path.join(data_dir, - 'pilelimitingvaluesnoncalcareous.txt'), - delimiter="\t", - header=None, - index_col=False, - names=['Soil Friction Angle', - 'Friction Angle Sand-Pile', - 'Max Bearing Capacity Factor', - 'Max Unit Skin Friction', - 'Max End Bearing Capacity']) - -#plate anchor holding capacity factors -hcfdrsoil = pd.read_csv(os.path.join(data_dir, - 'holdingcapacityfactorsplateanchors.txt'), - delimiter="\t", - header=None, - index_col=False, - names=['Relative Embedment Depth', - 'Drained Friction Angle = 20 degrees', - 'Drained Friction Angle = 25 degrees', - 'Drained Friction Angle = 30 degrees', - 'Drained Friction Angle = 35 degrees', - 'Drained Friction Angle = 40 degrees']) - -rockcomstr = 206843.0 #rock compressive strength - -#cylinder drag coefficients -dragcoefcyl = np.loadtxt(os.path.join(data_dir, - 'dragcoefcyl.txt'), - delimiter="\t") - -#cylinder wake amplification factors -wakeampfactorcyl = np.loadtxt(os.path.join(data_dir, - 'wakeamplificationfactorcyl.txt'), - delimiter="\t") - -#rectangular wind drag coefficients -winddragcoefrect = np.loadtxt(os.path.join(data_dir, - 'winddragcoefrect.txt'), - delimiter="\t") - -#rectangular current drag coefficients -currentdragcoefrect = np.loadtxt(os.path.join(data_dir, - 'currentdragcoeffrect.txt'), - delimiter="\t") - -#rectangular wave drift coefficients -driftcoeffloatrect = np.loadtxt(os.path.join(data_dir, - 'driftcoefficientfloatrect.txt'), - delimiter="\t") +undrained_soil_shear_strength_dependent = 2e3 # undrained shear friction angle +soilsen = 3.0 # soil sensitivity + +# buried line bearing capacity factors +linebcf = np.genfromtxt(os.path.join(data_dir, "linebcf.txt"), delimiter="\t") + +# subgrade reaction coefficients +k1coef = pd.read_csv( + os.path.join(data_dir, "subgradereactioncoefficientk1_cohesive.txt"), + delimiter="\t", + header=None, + index_col=False, + names=[ + "Allowable Deflection / Diameter", + "Soft Clay Coefficient", + "Stiff Clay Coefficient", + ], +) + +# subgrade cohesionless soil reaction coefficients +subgradereaccoef = pd.read_csv( + os.path.join(data_dir, "subgradereactioncoefficient_cohesionless.txt"), + delimiter="\t", + header=None, + index_col=False, + names=[ + "Allowable Deflection / Diameter", + "35% Relative Density Coefficient", + "50% Relative Density Coefficient", + "65% Relative Density Coefficient", + "85% Relative Density Coefficient", + ], +) + +# pile deflection coefficients +piledefcoef = pd.read_csv( + os.path.join(data_dir, "piledeflectioncoefficients.txt"), + delimiter="\t", + header=None, + index_col=False, + names=["Depth Coefficient", "Ay", "By"], +) + +# pile moment coefficients am +pilemomcoefam = pd.read_csv( + os.path.join(data_dir, "pilemomentcoefficientsam.txt"), + delimiter="\t", + header=None, + index_col=False, + names=[ + "Depth Coefficient", + "Pile Length / Relative Soil-Pile Stiffness = 10", + "Pile Length / Relative Soil-Pile Stiffness = 5", + "Pile Length / Relative Soil-Pile Stiffness = 4", + "Pile Length / Relative Soil-Pile Stiffness = 3", + "Pile Length / Relative Soil-Pile Stiffness = 2", + ], +) + +# pile moment coefficients bm +pilemomcoefbm = pd.read_csv( + os.path.join(data_dir, "pilemomentcoefficientsbm.txt"), + delimiter="\t", + header=None, + index_col=False, + names=[ + "Depth Coefficient", + "Pile Length / Relative Soil-Pile Stiffness = 10", + "Pile Length / Relative Soil-Pile Stiffness = 5", + "Pile Length / Relative Soil-Pile Stiffness = 4", + "Pile Length / Relative Soil-Pile Stiffness = 3", + "Pile Length / Relative Soil-Pile Stiffness = 2", + ], +) + +# pile limiting values non calcaeous soils +pilefricresnoncal = pd.read_csv( + os.path.join(data_dir, "pilelimitingvaluesnoncalcareous.txt"), + delimiter="\t", + header=None, + index_col=False, + names=[ + "Soil Friction Angle", + "Friction Angle Sand-Pile", + "Max Bearing Capacity Factor", + "Max Unit Skin Friction", + "Max End Bearing Capacity", + ], +) + +# plate anchor holding capacity factors +hcfdrsoil = pd.read_csv( + os.path.join(data_dir, "holdingcapacityfactorsplateanchors.txt"), + delimiter="\t", + header=None, + index_col=False, + names=[ + "Relative Embedment Depth", + "Drained Friction Angle = 20 degrees", + "Drained Friction Angle = 25 degrees", + "Drained Friction Angle = 30 degrees", + "Drained Friction Angle = 35 degrees", + "Drained Friction Angle = 40 degrees", + ], +) + +rockcomstr = 206843.0 # rock compressive strength + +# cylinder drag coefficients +dragcoefcyl = np.loadtxt( + os.path.join(data_dir, "dragcoefcyl.txt"), delimiter="\t" +) + +# cylinder wake amplification factors +wakeampfactorcyl = np.loadtxt( + os.path.join(data_dir, "wakeamplificationfactorcyl.txt"), delimiter="\t" +) + +# rectangular wind drag coefficients +winddragcoefrect = np.loadtxt( + os.path.join(data_dir, "winddragcoefrect.txt"), delimiter="\t" +) + +# rectangular current drag coefficients +currentdragcoefrect = np.loadtxt( + os.path.join(data_dir, "currentdragcoeffrect.txt"), delimiter="\t" +) + +# rectangular wave drift coefficients +driftcoeffloatrect = np.loadtxt( + os.path.join(data_dir, "driftcoefficientfloatrect.txt"), delimiter="\t" +) # Machine data -X = np.array([ 0. , 0.1010101 , 0.2020202 , 0.3030303 , - 0.4040404 , 0.50505051, 0.60606061, 0.70707071, - 0.80808081, 0.90909091, 1.01010101, 1.11111111, - 1.21212121, 1.31313131, 1.41414141, 1.51515152, - 1.61616162, 1.71717172, 1.81818182, 1.91919192, - 2.02020202, 2.12121212, 2.22222222, 2.32323232, - 2.42424242, 2.52525253, 2.62626263, 2.72727273, - 2.82828283, 2.92929293, 3.03030303, 3.13131313, - 3.23232323, 3.33333333, 3.43434343, 3.53535354, - 3.63636364, 3.73737374, 3.83838384, 3.93939394, - 4.04040404, 4.14141414, 4.24242424, 4.34343434, - 4.44444444, 4.54545455, 4.64646465, 4.74747475, - 4.84848485, 4.94949495, 5.05050505, 5.15151515, - 5.25252525, 5.35353535, 5.45454545, 5.55555556, - 5.65656566, 5.75757576, 5.85858586, 5.95959596, - 6.06060606, 6.16161616, 6.26262626, 6.36363636, - 6.46464646, 6.56565657, 6.66666667, 6.76767677, - 6.86868687, 6.96969697, 7.07070707, 7.17171717, - 7.27272727, 7.37373737, 7.47474747, 7.57575758, - 7.67676768, 7.77777778, 7.87878788, 7.97979798, - 8.08080808, 8.18181818, 8.28282828, 8.38383838, - 8.48484848, 8.58585859, 8.68686869, 8.78787879, - 8.88888889, 8.98989899, 9.09090909, 9.19191919, - 9.29292929, 9.39393939, 9.49494949, 9.5959596 , - 9.6969697 , 9.7979798 , 9.8989899 , 10. ]) - -Cp = np.array([ 0. , 0. , 0. , 0. , 0. , - 0. , 0. , 0. , 0. , 0. , - 0.00248182, 0.0273 , 0.05211818, 0.07693636, 0.10175455, - 0.12657273, 0.15139091, 0.17620909, 0.20102727, 0.22584545, - 0.25066364, 0.27548182, 0.3003 , 0.32511818, 0.34993636, - 0.37475455, 0.39957273, 0.42439091, 0.44920909, 0.47402727, - 0.49884545, 0.52366364, 0.54848182, 0.5733 , 0.59811818, - 0.62293636, 0.64775455, 0.67257273, 0.69739091, 0.72220909, - 0.74702727, 0.77184545, 0.79666364, 0.82148182, 0.8463 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 , - 0.86 , 0.86 , 0.86 , 0.86 , 0.86 - ]) - -Ct = 0.4*np.ones((100)) - -depvar = False #depth variation permitted -sysprof = "Rectangular" #device profile options: "cylindrical" "rectangular" -sysmass = 4.5e5 #device mass -syscog = [0.0, 0.0, 0] #device centre of gravity -sysvol = 440.0 #device displaced volume -sysheight = 6. #device height -syswidth = 15.0 #device width -syslength = 22.0 #device length -sysrough = 0.9e-2 #device surface roughness - -layout = {'device001': [585500.0, 6650000.0, 0.0]} - -fairloc = np.array([[-15., 15., 0.], - [ 15., 15., 0.], - [ 15., -15., 0.], - [-15., -15., 0.]]) #fairlead locations (from device origin) - -foundloc = np.array([[-100, 100., 0.], - [ 100, 100., 0.], - [ 100., -100., 0.], - [-100., -100., 0.]]) #foundation locations (from device origin) - -sysdryfa = 8.0 #device dry frontal area -sysdryba = 360.0 #device dry beam area +X = np.array( + [ + 0.0, + 0.1010101, + 0.2020202, + 0.3030303, + 0.4040404, + 0.50505051, + 0.60606061, + 0.70707071, + 0.80808081, + 0.90909091, + 1.01010101, + 1.11111111, + 1.21212121, + 1.31313131, + 1.41414141, + 1.51515152, + 1.61616162, + 1.71717172, + 1.81818182, + 1.91919192, + 2.02020202, + 2.12121212, + 2.22222222, + 2.32323232, + 2.42424242, + 2.52525253, + 2.62626263, + 2.72727273, + 2.82828283, + 2.92929293, + 3.03030303, + 3.13131313, + 3.23232323, + 3.33333333, + 3.43434343, + 3.53535354, + 3.63636364, + 3.73737374, + 3.83838384, + 3.93939394, + 4.04040404, + 4.14141414, + 4.24242424, + 4.34343434, + 4.44444444, + 4.54545455, + 4.64646465, + 4.74747475, + 4.84848485, + 4.94949495, + 5.05050505, + 5.15151515, + 5.25252525, + 5.35353535, + 5.45454545, + 5.55555556, + 5.65656566, + 5.75757576, + 5.85858586, + 5.95959596, + 6.06060606, + 6.16161616, + 6.26262626, + 6.36363636, + 6.46464646, + 6.56565657, + 6.66666667, + 6.76767677, + 6.86868687, + 6.96969697, + 7.07070707, + 7.17171717, + 7.27272727, + 7.37373737, + 7.47474747, + 7.57575758, + 7.67676768, + 7.77777778, + 7.87878788, + 7.97979798, + 8.08080808, + 8.18181818, + 8.28282828, + 8.38383838, + 8.48484848, + 8.58585859, + 8.68686869, + 8.78787879, + 8.88888889, + 8.98989899, + 9.09090909, + 9.19191919, + 9.29292929, + 9.39393939, + 9.49494949, + 9.5959596, + 9.6969697, + 9.7979798, + 9.8989899, + 10.0, + ] +) + +Cp = np.array( + [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.00248182, + 0.0273, + 0.05211818, + 0.07693636, + 0.10175455, + 0.12657273, + 0.15139091, + 0.17620909, + 0.20102727, + 0.22584545, + 0.25066364, + 0.27548182, + 0.3003, + 0.32511818, + 0.34993636, + 0.37475455, + 0.39957273, + 0.42439091, + 0.44920909, + 0.47402727, + 0.49884545, + 0.52366364, + 0.54848182, + 0.5733, + 0.59811818, + 0.62293636, + 0.64775455, + 0.67257273, + 0.69739091, + 0.72220909, + 0.74702727, + 0.77184545, + 0.79666364, + 0.82148182, + 0.8463, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + 0.86, + ] +) + +Ct = 0.4 * np.ones((100)) + +depvar = False # depth variation permitted +sysprof = "Rectangular" # device profile options: "cylindrical" "rectangular" +sysmass = 4.5e5 # device mass +syscog = [0.0, 0.0, 0] # device centre of gravity +sysvol = 440.0 # device displaced volume +sysheight = 6.0 # device height +syswidth = 15.0 # device width +syslength = 22.0 # device length +sysrough = 0.9e-2 # device surface roughness + +layout = {"device001": [585500.0, 6650000.0, 0.0]} + +fairloc = np.array( + [ + [-15.0, 15.0, 0.0], + [15.0, 15.0, 0.0], + [15.0, -15.0, 0.0], + [-15.0, -15.0, 0.0], + ] +) # fairlead locations (from device origin) + +foundloc = np.array( + [ + [-100, 100.0, 0.0], + [100, 100.0, 0.0], + [100.0, -100.0, 0.0], + [-100.0, -100.0, 0.0], + ] +) # foundation locations (from device origin) + +sysdryfa = 8.0 # device dry frontal area +sysdryba = 360.0 # device dry beam area # Performance curves are matched to the same veloity abscissae -tidal_performance = {"Velocity": X, - "Coefficient of Power": Cp, - "Coefficient of Thrust": Ct} - -rotor_diam = 23. -turbine_interdist = 0. -hubheight = -25. #hub height -sysorienang = 0. #device orientation angle -loadraos = np.loadtxt(os.path.join(data_dir, 'loadraos.txt'), delimiter="\t") #device load raos -addmass = np.loadtxt(os.path.join(data_dir, 'addmass.txt'), delimiter="\t") #device added mass -raddamp = np.loadtxt(os.path.join(data_dir, 'raddamp.txt'), delimiter="\t") #device radiation damping -hydrostiff = 66.394e3 #device hydrostatic stiffness -premoor = "Taut" #predefined mooring system type options:, 'catenary', 'taut' -maxdisp = [75.0, 75.0, 10.0] #device maximum displacements in surge, sway and heave -prefound = None #predefined foundation type -coststeel = 1.0 #steel cost -costgrout = 0.1 #grout cost -costcon = 0.11 #concrete cost -groutstr = 125.0 #grout strength - -preumb = "id743" #predefined umbilical type -umbsf = 2.0 #umbilical safety factor -foundsf = 1.5 #foundation safety factor -prefootrad = None #predefined footprint radius -seabed_connection = {'device001': [585146.00, 6650764.00, -121.0000]} - -moorsfuls = 1.7 #mooring ultimate limit state safety factor -moorsfals = 1.1 #mooring accident limit state safety factor - -groutsf = 6.0 #grout safety factor -syswetfa = 98.6 #device wet frontal area -syswetba = 132.5 #device wet beam area -sysdraft = 2.0 #device equilibrium draft without mooring system - -waveinertiacoefrect = np.loadtxt(os.path.join(data_dir, 'waveinertiacoefrect.txt'), delimiter="\t") - -preline = [] #predefined mooring line component list e.g. ['shackle001','rope','shackle002'] -fabcost = 1.0 #optional fabrication cost factor - -umbilical_connection = [0,0,-0.5] +tidal_performance = { + "Velocity": X, + "Coefficient of Power": Cp, + "Coefficient of Thrust": Ct, +} + +rotor_diam = 23.0 +turbine_interdist = 0.0 +hubheight = -25.0 # hub height +sysorienang = 0.0 # device orientation angle +loadraos = np.loadtxt( + os.path.join(data_dir, "loadraos.txt"), delimiter="\t" +) # device load raos +addmass = np.loadtxt( + os.path.join(data_dir, "addmass.txt"), delimiter="\t" +) # device added mass +raddamp = np.loadtxt( + os.path.join(data_dir, "raddamp.txt"), delimiter="\t" +) # device radiation damping +hydrostiff = 66.394e3 # device hydrostatic stiffness +premoor = "Taut" # predefined mooring system type options:, 'catenary', 'taut' +maxdisp = [ + 75.0, + 75.0, + 10.0, +] # device maximum displacements in surge, sway and heave +prefound = None # predefined foundation type +coststeel = 1.0 # steel cost +costgrout = 0.1 # grout cost +costcon = 0.11 # concrete cost +groutstr = 125.0 # grout strength + +preumb = "id743" # predefined umbilical type +umbsf = 2.0 # umbilical safety factor +foundsf = 1.5 # foundation safety factor +prefootrad = None # predefined footprint radius +seabed_connection = {"device001": [585146.00, 6650764.00, -121.0000]} + +moorsfuls = 1.7 # mooring ultimate limit state safety factor +moorsfals = 1.1 # mooring accident limit state safety factor + +groutsf = 6.0 # grout safety factor +syswetfa = 98.6 # device wet frontal area +syswetba = 132.5 # device wet beam area +sysdraft = 2.0 # device equilibrium draft without mooring system + +waveinertiacoefrect = np.loadtxt( + os.path.join(data_dir, "waveinertiacoefrect.txt"), delimiter="\t" +) + +preline = [] # predefined mooring line component list e.g. ['shackle001','rope','shackle002'] +fabcost = 1.0 # optional fabrication cost factor + +umbilical_connection = [0, 0, -0.5] use_max_thrust = True -test_data = {'constants.line_bearing_capacity_factor': linebcf, - 'constants.pile_Am_moment_coefficient': pilemomcoefam, - 'constants.pile_Bm_moment_coefficient': pilemomcoefbm, - 'constants.pile_deflection_coefficients': piledefcoef, - 'constants.pile_skin_friction_end_bearing_capacity': - pilefricresnoncal, - "constants.soilprops" : soilprops, - 'constants.soil_cohesive_reaction_coefficient': k1coef, - "constants.soil_cohesionless_reaction_coefficient": - subgradereaccoef, - 'constants.soil_drained_holding_capacity_factor': hcfdrsoil, - 'farm.soil_sensitivity': soilsen, - 'constants.air_density': airden, - 'constants.concrete_density': conden, - 'constants.gravity': gravity, - 'constants.grout_compressive_strength': groutstr, - 'constants.grout_density': groutden, - 'constants.sea_water_density': seaden, - 'constants.steel_density': steelden, - 'device.turbine_hub_height': turbine_hub_height, - 'constants.cylinder_drag': dragcoefcyl, - 'constants.cylinder_wake_amplificiation': wakeampfactorcyl, - 'device.depth_variation_permitted': depvar, - 'device.dry_beam_area': sysdryba, - 'device.dry_frontal_area': sysdryfa, - 'device.fairlead_location': fairloc, - 'device.foundation_location': foundloc, - 'project.foundation_safety_factor': foundsf, - 'device.foundation_type': prefound, - 'device.maximum_displacement': maxdisp, - 'device.mooring_system_type': premoor, - 'project.main_direction': sysorienang, - 'device.prescribed_footprint_radius': prefootrad, - 'device.umbilical_connection_point': umbilical_connection, - 'constants.rectangular_current_drag': currentdragcoefrect, - 'constants.rectangular_drift': driftcoeffloatrect, - 'constants.rectangular_wind_drag': winddragcoefrect, - 'device.system_centre_of_gravity': syscog, - 'device.system_displaced_volume': sysvol, - 'device.system_draft': sysdraft, - 'device.system_height': sysheight, - 'device.system_length': syslength, - 'device.system_mass': sysmass, - 'device.system_profile': sysprof, - 'device.system_roughness': sysrough, - 'device.system_width': syswidth, - 'device.turbine_diameter': rotor_diam, - 'device.turbine_interdistance': turbine_interdist, - 'device.turbine_performance': tidal_performance, - 'project.umbilical_safety_factor': umbsf, - 'device.umbilical_type': preumb, - 'device.wet_beam_area': syswetba, - 'device.wet_frontal_area': syswetfa, - 'bathymetry.layers': strata, - 'farm.current_profile': currentprof, - 'farm.direction_of_max_surface_current': currentdir, - 'project.grout_strength_safety_factor': groutsf, - 'project.layout': layout, - 'farm.max_gust_wind_direction_100_year': windgustdir, - 'farm.max_gust_wind_speed_100_year': windgustvel, - 'farm.max_hs_100_year': hs, - 'farm.max_surface_current_10_year': currentvel, - 'farm.max_tp_100_year': tp, - 'farm.max_gamma_100_year': gamma, - 'farm.max_water_level_50_year': wlevmax, - 'farm.mean_wind_direction_100_year': winddir, - 'farm.mean_wind_speed_100_year': windvel, - 'farm.min_water_level_50_year': wlevmin, - 'project.mooring_ALS_safety_factor': moorsfals, - 'project.mooring_ULS_safety_factor': moorsfuls, - 'farm.wave_direction_100_year': wavedir, - 'farm.spec_gamma': gamma, - 'project.cost_of_concrete': costcon, - 'project.cost_of_grout': costgrout, - 'project.cost_of_steel': coststeel, - 'constants.rectangular_wave_inertia' : waveinertiacoefrect, - 'project.predefined_mooring_list' : preline, - 'project.fabrication_cost' : fabcost, -# "farm.fex" : fex, - "project.substation_props" : substparams, - 'project.substation_layout': raw_origin_dict, - 'project.substation_cog': raw_cog_dict, - 'project.substation_foundation_location': raw_found_dict, - "project.umbilical_seabed_connection" : seabed_connection, - 'component.foundations_anchor': comp_tables["drag anchor"], - 'component.foundations_pile': comp_tables["pile"], - 'component.moorings_chain': comp_tables["chain"], - 'component.moorings_forerunner': - comp_tables["forerunner assembly"], - 'component.moorings_rope': comp_tables["rope"], - 'component.moorings_rope_stiffness': - comp_tables["rope axial stiffness"], - 'component.moorings_shackle': comp_tables["shackle"], - 'component.moorings_swivel': comp_tables["swivel"], - "component.dynamic_cable" : dynamic_cable, - 'component.foundations_anchor_sand': - comp_tables["drag anchor sand"], - 'component.foundations_anchor_soft': - comp_tables["drag anchor soft"], - 'options.use_max_thrust': use_max_thrust - } +test_data = { + "constants.line_bearing_capacity_factor": linebcf, + "constants.pile_Am_moment_coefficient": pilemomcoefam, + "constants.pile_Bm_moment_coefficient": pilemomcoefbm, + "constants.pile_deflection_coefficients": piledefcoef, + "constants.pile_skin_friction_end_bearing_capacity": pilefricresnoncal, + "constants.soilprops": soilprops, + "constants.soil_cohesive_reaction_coefficient": k1coef, + "constants.soil_cohesionless_reaction_coefficient": subgradereaccoef, + "constants.soil_drained_holding_capacity_factor": hcfdrsoil, + "farm.soil_sensitivity": soilsen, + "constants.air_density": airden, + "constants.concrete_density": conden, + "constants.gravity": gravity, + "constants.grout_compressive_strength": groutstr, + "constants.grout_density": groutden, + "constants.sea_water_density": seaden, + "constants.steel_density": steelden, + "device.turbine_hub_height": turbine_hub_height, + "constants.cylinder_drag": dragcoefcyl, + "constants.cylinder_wake_amplificiation": wakeampfactorcyl, + "device.depth_variation_permitted": depvar, + "device.dry_beam_area": sysdryba, + "device.dry_frontal_area": sysdryfa, + "device.fairlead_location": fairloc, + "device.foundation_location": foundloc, + "project.foundation_safety_factor": foundsf, + "device.foundation_type": prefound, + "device.maximum_displacement": maxdisp, + "device.mooring_system_type": premoor, + "project.main_direction": sysorienang, + "device.prescribed_footprint_radius": prefootrad, + "device.umbilical_connection_point": umbilical_connection, + "constants.rectangular_current_drag": currentdragcoefrect, + "constants.rectangular_drift": driftcoeffloatrect, + "constants.rectangular_wind_drag": winddragcoefrect, + "device.system_centre_of_gravity": syscog, + "device.system_displaced_volume": sysvol, + "device.system_draft": sysdraft, + "device.system_height": sysheight, + "device.system_length": syslength, + "device.system_mass": sysmass, + "device.system_profile": sysprof, + "device.system_roughness": sysrough, + "device.system_width": syswidth, + "device.turbine_diameter": rotor_diam, + "device.turbine_interdistance": turbine_interdist, + "device.turbine_performance": tidal_performance, + "project.umbilical_safety_factor": umbsf, + "device.umbilical_type": preumb, + "device.wet_beam_area": syswetba, + "device.wet_frontal_area": syswetfa, + "bathymetry.layers": strata, + "farm.current_profile": currentprof, + "farm.direction_of_max_surface_current": currentdir, + "project.grout_strength_safety_factor": groutsf, + "project.layout": layout, + "farm.max_gust_wind_direction_100_year": windgustdir, + "farm.max_gust_wind_speed_100_year": windgustvel, + "farm.max_hs_100_year": hs, + "farm.max_surface_current_10_year": currentvel, + "farm.max_tp_100_year": tp, + "farm.max_gamma_100_year": gamma, + "farm.max_water_level_50_year": wlevmax, + "farm.mean_wind_direction_100_year": winddir, + "farm.mean_wind_speed_100_year": windvel, + "farm.min_water_level_50_year": wlevmin, + "project.mooring_ALS_safety_factor": moorsfals, + "project.mooring_ULS_safety_factor": moorsfuls, + "farm.wave_direction_100_year": wavedir, + "farm.spec_gamma": gamma, + "project.cost_of_concrete": costcon, + "project.cost_of_grout": costgrout, + "project.cost_of_steel": coststeel, + "constants.rectangular_wave_inertia": waveinertiacoefrect, + "project.predefined_mooring_list": preline, + "project.fabrication_cost": fabcost, + # "farm.fex" : fex, + "project.substation_props": substparams, + "project.substation_layout": raw_origin_dict, + "project.substation_cog": raw_cog_dict, + "project.substation_foundation_location": raw_found_dict, + "project.umbilical_seabed_connection": seabed_connection, + "component.foundations_anchor": comp_tables["drag anchor"], + "component.foundations_pile": comp_tables["pile"], + "component.moorings_chain": comp_tables["chain"], + "component.moorings_forerunner": comp_tables["forerunner assembly"], + "component.moorings_rope": comp_tables["rope"], + "component.moorings_rope_stiffness": comp_tables["rope axial stiffness"], + "component.moorings_shackle": comp_tables["shackle"], + "component.moorings_swivel": comp_tables["swivel"], + "component.dynamic_cable": dynamic_cable, + "component.foundations_anchor_sand": comp_tables["drag anchor sand"], + "component.foundations_anchor_soft": comp_tables["drag anchor soft"], + "options.use_max_thrust": use_max_thrust, +} if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) - + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_wp5.py b/packages/dtocean-core/test_data/inputs_wp5.py index 634cc27..d780cd4 100644 --- a/packages/dtocean-core/test_data/inputs_wp5.py +++ b/packages/dtocean-core/test_data/inputs_wp5.py @@ -5,14 +5,14 @@ @author: acollin """ -import os import datetime +import os from collections import Counter -from dateutil.parser import parse -import utm import numpy as np import pandas as pd +import utm +from dateutil.parser import parse from shapely.geometry import Point this_dir = os.path.dirname(os.path.realpath(__file__)) @@ -20,8 +20,8 @@ elec_dir = os.path.join(this_dir, "electrical") ### Equipment -file_path = os.path.join(installation_dir, 'logisticsDB_equipment_python.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +file_path = os.path.join(installation_dir, "logisticsDB_equipment_python.xlsx") +xls_file = pd.ExcelFile(file_path) sheet_names = xls_file.sheet_names equipment_rov = xls_file.parse("rov") @@ -38,59 +38,62 @@ # OLC updates hs_olc_names = [ - "Vessel Positioning + Connection to cable pull-head + Cable float-out + Cable lay into pre-excavated trench", - "Vessel positioning + Connection to cable pull-head + Cable float-out + Cable pull-in through HDD conduit", - "Deploy of Cable Burial Tool", - "Recover cable burial tool", - "Cable lay and burial through cable route", - "Cable lay through cable route", - "Cable lay through open trench", - "Cable lay with split pipes", - "Cable lay with buoyancy modules", - "Conduct dry-mate connection on deck", - "Conduct splice connection on deck", - "Connect to guide wire + Lower cable and connection equip + Perform wet-mate connect + Recover connection equip", - "J-tube entrance inspection + Guide wire connection + Cable lay + Cable pull + Cable connection", - "Lower cable-end to the seabed", - "Lift cable-end from seabed", - "Lower collection point to the seabed", - "Lift top-side platform", - "Connect top-side platform to the support structure", - "Lift and overboard concrete mattress + Lower concrete mattress to seabed + Position and release concrete mattress + Recover installation frame", - "Lift and overboard rock filter bag + Lower rock filter bag to seabed + Position and release concrete mattress"] - -hs_olc_values = [0.75, - 0.75, - 1.75, - 1.75, - 1.75, - 1.75, - 1.75, - 1.75, - 1.75, - 2., - 2., - 2.25, - 2., - 2., - 1.5, - 2., - 2., - 2., - 2., - 2.] + "Vessel Positioning + Connection to cable pull-head + Cable float-out + Cable lay into pre-excavated trench", + "Vessel positioning + Connection to cable pull-head + Cable float-out + Cable pull-in through HDD conduit", + "Deploy of Cable Burial Tool", + "Recover cable burial tool", + "Cable lay and burial through cable route", + "Cable lay through cable route", + "Cable lay through open trench", + "Cable lay with split pipes", + "Cable lay with buoyancy modules", + "Conduct dry-mate connection on deck", + "Conduct splice connection on deck", + "Connect to guide wire + Lower cable and connection equip + Perform wet-mate connect + Recover connection equip", + "J-tube entrance inspection + Guide wire connection + Cable lay + Cable pull + Cable connection", + "Lower cable-end to the seabed", + "Lift cable-end from seabed", + "Lower collection point to the seabed", + "Lift top-side platform", + "Connect top-side platform to the support structure", + "Lift and overboard concrete mattress + Lower concrete mattress to seabed + Position and release concrete mattress + Recover installation frame", + "Lift and overboard rock filter bag + Lower rock filter bag to seabed + Position and release concrete mattress", +] + +hs_olc_values = [ + 0.75, + 0.75, + 1.75, + 1.75, + 1.75, + 1.75, + 1.75, + 1.75, + 1.75, + 2.0, + 2.0, + 2.25, + 2.0, + 2.0, + 1.5, + 2.0, + 2.0, + 2.0, + 2.0, + 2.0, +] hs_olc_dict = {k: v for k, v in zip(hs_olc_names, hs_olc_values)} - -tp_olc_dict = {"Seafloor & equipment preparation": 15.} -ws_olc_dict = {"Seafloor & equipment preparation": 15.} + +tp_olc_dict = {"Seafloor & equipment preparation": 15.0} +ws_olc_dict = {"Seafloor & equipment preparation": 15.0} cs_olc_dict = {"Seafloor & equipment preparation": 1.5} ### Ports -file_path = os.path.join(installation_dir, 'logisticsDB_ports_python.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') -ports = xls_file.parse() +file_path = os.path.join(installation_dir, "logisticsDB_ports_python.xlsx") +xls_file = pd.ExcelFile(file_path) +ports = xls_file.parse() # type: ignore port_names = ports["Name"] port_x = ports.pop("UTM x") @@ -100,17 +103,16 @@ port_points = [] for x, y, zone_str in zip(port_x, port_y, port_utm): - zone_number_str, zone_letter = zone_str.split() lat, lon = utm.to_latlon(x, y, int(zone_number_str), zone_letter) point = Point(lon, lat) port_points.append(point) - + port_locations = {name: point for name, point in zip(port_names, port_points)} ### Vessels -file_path = os.path.join(installation_dir, 'logisticsDB_vessel_python.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +file_path = os.path.join(installation_dir, "logisticsDB_vessel_python.xlsx") +xls_file = pd.ExcelFile(file_path) helicopter_df = xls_file.parse(sheet_name="Helicopter") ahts_df = xls_file.parse(sheet_name="AHTS") multicat_df = xls_file.parse(sheet_name="Multicat") @@ -126,15 +128,15 @@ tugboat_df = xls_file.parse(sheet_name="Tugboat") ### Export -file_path = os.path.join(installation_dir, 'export_area_30.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +file_path = os.path.join(installation_dir, "export_area_30.xlsx") +xls_file = pd.ExcelFile(file_path) sheet_names = xls_file.sheet_names lease_bathymetry = xls_file.parse(sheet_names[0]) layers = [1] Z = np.array([lease_bathymetry["layer 1 start"]]).T - + sediment = np.array([lease_bathymetry["layer 1 type"]]).T x_max = lease_bathymetry.max()["x"] @@ -142,64 +144,63 @@ x_min = lease_bathymetry.min()["x"] y_min = lease_bathymetry.min()["y"] -num_x = (lease_bathymetry.max()["i"]-lease_bathymetry.min()["i"])+1 -num_y = (lease_bathymetry.max()["j"]-lease_bathymetry.min()["j"])+1 +num_x = (lease_bathymetry.max()["i"] - lease_bathymetry.min()["i"]) + 1 +num_y = (lease_bathymetry.max()["j"] - lease_bathymetry.min()["j"]) + 1 -x= np.linspace(x_min , x_max , num_x) -y = np.linspace(y_min , y_max , num_y) +x = np.linspace(x_min, x_max, num_x) +y = np.linspace(y_min, y_max, num_y) depth_layers = [] sediment_layers = [] for z in layers: - depths = [] sediments = [] - + for y_count in y: - d = [] s = [] - + for x_count in x: - - point_df = lease_bathymetry[(lease_bathymetry["x"] == x_count) & - (lease_bathymetry["y"] == y_count) - ].index[0] - - if Z[point_df,z-1] == "None": - Z[point_df,z-1] = np.nan - - d.append(Z[point_df,z-1]) - s.append(sediment[point_df,z-1]) - + point_df = lease_bathymetry[ + (lease_bathymetry["x"] == x_count) + & (lease_bathymetry["y"] == y_count) + ].index[0] + + if Z[point_df, z - 1] == "None": + Z[point_df, z - 1] = np.nan + + d.append(Z[point_df, z - 1]) + s.append(sediment[point_df, z - 1]) + depths.append(d) sediments.append(s) - + depth_layers.append(depths) sediment_layers.append(sediments) - + depth_array = np.swapaxes(np.array(depth_layers, dtype=float), 0, 2) sediment_array = np.swapaxes(np.array(sediment_layers), 0, 2) layer_names = ["layer {}".format(x_layers) for x_layers in layers] -export_strata = {"values": {"depth": depth_array, - 'sediment': sediment_array}, - "coords": [x, y, layer_names]} +export_strata = { + "values": {"depth": depth_array, "sediment": sediment_array}, + "coords": [x, y, layer_names], +} ### Site -file_path = os.path.join(installation_dir, 'lease_area_30.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') +file_path = os.path.join(installation_dir, "lease_area_30.xlsx") +xls_file = pd.ExcelFile(file_path) sheet_names = xls_file.sheet_names lease_bathymetry = xls_file.parse(sheet_names[0]) layers = [1] Z = np.array([lease_bathymetry["layer 1 start"]]).T - + sediment = np.array([lease_bathymetry["layer 1 type"]]).T x_max = lease_bathymetry.max()["x"] @@ -207,1182 +208,1231 @@ x_min = lease_bathymetry.min()["x"] y_min = lease_bathymetry.min()["y"] -num_x = (lease_bathymetry.max()["i"]-lease_bathymetry.min()["i"])+1 -num_y = (lease_bathymetry.max()["j"]-lease_bathymetry.min()["j"])+1 +num_x = (lease_bathymetry.max()["i"] - lease_bathymetry.min()["i"]) + 1 +num_y = (lease_bathymetry.max()["j"] - lease_bathymetry.min()["j"]) + 1 -x= np.linspace(x_min , x_max , num_x) -y = np.linspace(y_min , y_max , num_y) +x = np.linspace(x_min, x_max, num_x) +y = np.linspace(y_min, y_max, num_y) depth_layers = [] sediment_layers = [] for z in layers: - depths = [] sediments = [] - + for y_count in y: - d = [] s = [] - + for x_count in x: - - point_df = lease_bathymetry[(lease_bathymetry["x"] == x_count) & - (lease_bathymetry["y"] == y_count) - ].index[0] - - if Z[point_df,z-1] == "None": - Z[point_df,z-1] = np.nan - - d.append(Z[point_df,z-1]) - s.append(sediment[point_df,z-1]) - + point_df = lease_bathymetry[ + (lease_bathymetry["x"] == x_count) + & (lease_bathymetry["y"] == y_count) + ].index[0] + + if Z[point_df, z - 1] == "None": + Z[point_df, z - 1] = np.nan + + d.append(Z[point_df, z - 1]) + s.append(sediment[point_df, z - 1]) + depths.append(d) sediments.append(s) - + depth_layers.append(depths) sediment_layers.append(sediments) - + depth_array = np.swapaxes(np.array(depth_layers, dtype=float), 0, 2) sediment_array = np.swapaxes(np.array(sediment_layers), 0, 2) layer_names = ["layer {}".format(x_layers) for x_layers in layers] -strata = {"values": {"depth": depth_array, - 'sediment': sediment_array}, - "coords": [x, y, layer_names]} +strata = { + "values": {"depth": depth_array, "sediment": sediment_array}, + "coords": [x, y, layer_names], +} -lease_utm_zone = \ +lease_utm_zone = ( "+proj=utm +zone=30 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" +) ### Metocean -file_path = os.path.join(installation_dir, 'inputs_user.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') -metocean = xls_file.parse('metocean', index_col = 0) +file_path = os.path.join(installation_dir, "inputs_user.xlsx") +xls_file = pd.ExcelFile(file_path) +metocean = xls_file.parse("metocean", index_col=0) -date_index = metocean[['year', - 'month', - 'day', - 'hour']].apply(lambda s: datetime.datetime(*s), axis=1) +date_index = metocean[["year", "month", "day", "hour"]].apply( + lambda s: datetime.datetime(*s), axis=1 +) -wave_series = metocean.loc[:, ['Hs', 'Tp']] -wave_series['DateTime'] = date_index.copy() +wave_series = metocean.loc[:, ["Hs", "Tp"]] +wave_series["DateTime"] = date_index.copy() -tidal_series = metocean.loc[:, ['Cs']] -tidal_series['DateTime'] = date_index.copy() +tidal_series = metocean.loc[:, ["Cs"]] +tidal_series["DateTime"] = date_index.copy() tidal_series = tidal_series.set_index(["DateTime"]) -tidal_series = tidal_series.to_records(convert_datetime64=True) +tidal_series = tidal_series.to_records() tidal_series = [(x, float(y)) for x, y in tidal_series] -wind_series = metocean.loc[:, ['Ws']] -wind_series['DateTime'] = date_index.copy() +wind_series = metocean.loc[:, ["Ws"]] +wind_series["DateTime"] = date_index.copy() wind_series = wind_series.set_index(["DateTime"]) -wind_series = wind_series.to_records(convert_datetime64=True) +wind_series = wind_series.to_records() wind_series = [(x, float(y)) for x, y in wind_series] ### Device -device = xls_file.parse('device', index_col = 0) -device = device.apply(pd.to_numeric, errors='ignore') - -system_type = device['type'].values.item() -system_length = float(device['length'].values.item()) -system_width = float(device['width'].values.item()) -system_height = float(device['height'].values.item()) -system_mass = float(device['dry mass'].values.item()) -assembly_duration = float(device['assembly duration'].values.item()) -load_out_method = device['load out'].values.item() -transportation_method = device['transportation method'].values.item() -bollard_pull = float(device['bollard pull'].values.item()) -connect_duration = float(device['connect duration'].values.item()) -disconnect_duration = float(device['disconnect duration'].values.item()) - -start_date_str = device['Project start date'].values.item() +device = xls_file.parse("device", index_col=0) +device = device.apply(pd.to_numeric, errors="ignore") + +system_type = device["type"].to_numpy().item() +system_length = float(device["length"].to_numpy().item()) +system_width = float(device["width"].to_numpy().item()) +system_height = float(device["height"].to_numpy().item()) +system_mass = float(device["dry mass"].to_numpy().item()) +assembly_duration = float(device["assembly duration"].to_numpy().item()) +load_out_method = device["load out"].to_numpy().item() +transportation_method = device["transportation method"].to_numpy().item() +bollard_pull = float(device["bollard pull"].to_numpy().item()) +connect_duration = float(device["connect duration"].to_numpy().item()) +disconnect_duration = float(device["disconnect duration"].to_numpy().item()) + +start_date_str = device["Project start date"].to_numpy().item() project_start_date = parse(start_date_str) -#sub_systems = device['sub system list'].values.item() +# sub_systems = device['sub system list'].to_numpy().item() ### Subdevice -sub_device = xls_file.parse('sub_device') +sub_device = xls_file.parse("sub_device") ### Landfall landfall = "Open Cut Trenching" ### Rates -file_path = os.path.join(installation_dir, 'equipment_perf_rates.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') - -equipment_penetration_rates = xls_file.parse('penet') -installation_soil_compatibility = xls_file.parse('laying') -temp_other = xls_file.parse('other') - -surface_laying_rate = temp_other[temp_other.index == - 'Surface laying [m/h]'].values[0][0] -split_pipe_laying_rate = temp_other[temp_other.index == - 'Installation of iron cast split pipes [m/h]'].values[0][0] -loading_rate = temp_other[temp_other.index == - 'Loading rate [m/h]'].values[0][0] -grout_rate = temp_other[temp_other.index == - 'Grout rate [m3/h]'].values[0][0] -fuel_cost_rate = temp_other[temp_other.index == - 'Fuel cost rate [EUR/l]'].values[0][0] -port_percentage_cost = temp_other[temp_other.index == - 'Port percentual cost [%]'].values[0][0] -comissioning_time = temp_other[temp_other.index == - 'Comissioning time [weeks]'].values[0][0] -cost_contingency = temp_other[temp_other.index == - 'Cost Contingency [%]'].values[0][0] +file_path = os.path.join(installation_dir, "equipment_perf_rates.xlsx") +xls_file = pd.ExcelFile(file_path) + +equipment_penetration_rates = xls_file.parse("penet") +installation_soil_compatibility = xls_file.parse("laying") +temp_other = xls_file.parse("other", index_col=0) + +surface_laying_rate = temp_other[ + temp_other.index == "Surface laying [m/h]" +].values[0][0] +split_pipe_laying_rate = temp_other[ + temp_other.index == "Installation of iron cast split pipes [m/h]" +].values[0][0] +loading_rate = temp_other[temp_other.index == "Loading rate [m/h]"].values[0][0] +grout_rate = temp_other[temp_other.index == "Grout rate [m3/h]"].values[0][0] +fuel_cost_rate = temp_other[ + temp_other.index == "Fuel cost rate [EUR/l]" +].values[0][0] +port_percentage_cost = temp_other[ + temp_other.index == "Port percentual cost [%]" +].values[0][0] +comissioning_time = temp_other[ + temp_other.index == "Comissioning time [weeks]" +].values[0][0] +cost_contingency = temp_other[ + temp_other.index == "Cost Contingency [%]" +].values[0][0] ### Safety factors -port_sf_dict = {"Parameter": ["Terminal area [m^2]", - "Terminal load bearing [t/m^2]"], - "Safety Factor": [0.2, 0.2] - } +port_sf_dict = { + "Parameter": ["Terminal area [m^2]", "Terminal load bearing [t/m^2]"], + "Safety Factor": [0.2, 0.2], +} port_sf = pd.DataFrame(port_sf_dict) -vessel_sf_dict = {"Parameter": ['Deck space [m^2]', - 'Deck loading [t/m^2]', - 'Max. cargo [t]', - 'Crane capacity [t]', - 'Bollard pull [t]', - 'Turntable loading [t]', - 'Turntable inner diameter [m]', - 'AH winch rated pull [t]', - 'AH drum capacity [m]', - 'JackUp max payload [t]', - 'JackUp max water depth [m]'], - "Safety Factor": [0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.0, - 0.0, - 0.2, - 0.2] - } +vessel_sf_dict = { + "Parameter": [ + "Deck space [m^2]", + "Deck loading [t/m^2]", + "Max. cargo [t]", + "Crane capacity [t]", + "Bollard pull [t]", + "Turntable loading [t]", + "Turntable inner diameter [m]", + "AH winch rated pull [t]", + "AH drum capacity [m]", + "JackUp max payload [t]", + "JackUp max water depth [m]", + ], + "Safety Factor": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.0, 0.0, 0.2, 0.2], +} vessel_sf = pd.DataFrame(vessel_sf_dict) -rov_sf_dict = {"Parameter": ["Manipulator grip force [N]", "Depth rating [m]"], - "Safety Factor": [0.2, 0.]} +rov_sf_dict = { + "Parameter": ["Manipulator grip force [N]", "Depth rating [m]"], + "Safety Factor": [0.2, 0.0], +} rov_sf = pd.DataFrame(rov_sf_dict) -divers_sf_dict = {"Parameter": ["Max operating depth [m]"], - "Safety Factor": [0.]} +divers_sf_dict = { + "Parameter": ["Max operating depth [m]"], + "Safety Factor": [0.0], +} divers_sf = pd.DataFrame(divers_sf_dict) -hammer_sf_dict = {"Parameter": ["Max pile diameter [mm]"], - "Safety Factor": [0.2]} +hammer_sf_dict = { + "Parameter": ["Max pile diameter [mm]"], + "Safety Factor": [0.2], +} hammer_sf = pd.DataFrame(hammer_sf_dict) -vibro_driver_sf_dict = {"Parameter": ['Max pile diameter [mm]', - 'Max pile weight [t]', - 'Depth rating [m]'], - "Safety Factor": [0.2, 0.2, 0.]} +vibro_driver_sf_dict = { + "Parameter": [ + "Max pile diameter [mm]", + "Max pile weight [t]", + "Depth rating [m]", + ], + "Safety Factor": [0.2, 0.2, 0.0], +} vibro_driver_sf = pd.DataFrame(vibro_driver_sf_dict) -cable_burial_sf_dict = {"Parameter": ['Jetting trench depth [m]', - 'Ploughing trench depth [m]', - 'Cutting trench depth [m]', - 'Max cable diameter [mm]', - 'Min cable bending radius [m]', - 'Max operating depth [m]'], - "Safety Factor": [0, 0, 0, 0, 0, 0]} +cable_burial_sf_dict = { + "Parameter": [ + "Jetting trench depth [m]", + "Ploughing trench depth [m]", + "Cutting trench depth [m]", + "Max cable diameter [mm]", + "Min cable bending radius [m]", + "Max operating depth [m]", + ], + "Safety Factor": [0, 0, 0, 0, 0, 0], +} cable_burial_sf = pd.DataFrame(cable_burial_sf_dict) -split_pipe_sf_dict = {"Parameter": ['Max cable size [mm]', - 'Min bending radius [m]'], - "Safety Factor": [0., 0.]} +split_pipe_sf_dict = { + "Parameter": ["Max cable size [mm]", "Min bending radius [m]"], + "Safety Factor": [0.0, 0.0], +} split_pipe_sf = pd.DataFrame(split_pipe_sf_dict) ### Configuration options # lease area entry point -file_path = os.path.join(installation_dir, 'inputs_user.xlsx') -xls_file = pd.ExcelFile(file_path, encoding = 'utf-8') -entry_point = xls_file.parse('entry_point', index_col = 0) +file_path = os.path.join(installation_dir, "inputs_user.xlsx") +xls_file = pd.ExcelFile(file_path) +entry_point = xls_file.parse("entry_point", index_col=0) -x = entry_point.loc[:, 'x coord'].item() -y = entry_point.loc[:, 'y coord'].item() +x = entry_point.loc[:, "x coord"].item() +y = entry_point.loc[:, "y coord"].item() -entry_point_shapely = Point(x,y) +entry_point_shapely = Point(x, y) ### Hydrodynamic -layout_dict = {'device001': [587850.,6650550.], - 'device002': [587850.,6650700.]} +layout_dict = { + "device001": [587850.0, 6650550.0], + "device002": [587850.0, 6650700.0], +} -#for _, device in layout.iterrows(): +# for _, device in layout.iterrows(): # # layout_dict[device['device']] = (device['x coord'], device['y coord'], 0) ### Electrical -tool = 'Jetting' +tool = "Jetting" electrical_network = { - 'nodes': {'array': {'Export cable': {'marker': [[0, 1]], - 'quantity': Counter({"6": 1, "17": 1})}, - 'Substation': {'marker': [[2]], - 'quantity': Counter({"12": 1})}}, - 'device001': {'marker': [[35, 8, 9, 32, 33]], - 'quantity': Counter({"2": 1, "6": 3, 'id743': 1})}, - 'device002': {'marker': [[36, 6, 7, 73, 34]], - 'quantity': Counter({"2": 1, "6": 3, 'id743': 1})}}, - 'topology': {'array': {'Export cable': [["17", "6"]], - 'Substation': [["12"]], - 'layout': [['device002', - 'device001']]}, - 'device001': {'Elec sub-system': [["6", "2", "6", 'id743', "6"]]}, - 'device002': {'Elec sub-system': [["6", "2", "6", 'id743', "6"]]}}} - - -electrical_components_dict = { 'Installation Type': {0: 'wet-mate', - 2: 'wet-mate', - 3: 'wet-mate', - 6: 'export', - 8: 'array', - 9: 'array', - 11: 'substation', - 12: 'umbilical', - 13: 'umbilical', - 14: 'wet-mate', - 15: 'wet-mate', - 16: 'wet-mate', - 17: 'wet-mate',}, - 'Key Identifier': {0: 6, - 2: 6, - 3: 6, - 6: 17, - 8: 2, - 9: 2, - 11: 12, - 12: 'id743', - 13: 'id743', - 14: 6, - 15: 6, - 16: 6, - 17: 6}, - 'Marker': {0: 1, - 2: 7, - 3: 9, - 6: 0, - 8: 6, - 9: 8, - 11: 2, - 12: 32, - 13: 73, - 14: 33, - 15: 34, - 16: 35, - 17: 36}, - - 'Quantity': {0: 1.0, - 2: 1.0, - 3: 1.0, - 6: 688.2842712474619, - 8: 150.0, - 9: 150.0, - 11: 1.0, - 12: 932., - 13: 312., - 14: 1., - 15: 1., - 16: 1., - 17: 1.}, - - 'UTM X': {0: 587770.0, - 2: 587850.0, - 3: 587850.0, - 6: 'None', - 8: 'None', - 9: 'None', - 11: 587770.0, - 12: 'None', - 13: 'None', - 14: 587850.0, - 15: 587850.0, - 16: 587850.0, - 17: 587850.0,}, - 'UTM Y': {0: 6650820.0, - 2: 6650700.0, - 3: 6650550.0, - 6: 'None', - 8: 'None', - 9: 'None', - 11: 6650820.0, - 12: 'None', - 13: 'None', - 14: 587850.0, - 15: 587850.0, - 16: 587850.0, - 17: 587850.0,}} + "nodes": { + "array": { + "Export cable": { + "marker": [[0, 1]], + "quantity": Counter({"6": 1, "17": 1}), + }, + "Substation": {"marker": [[2]], "quantity": Counter({"12": 1})}, + }, + "device001": { + "marker": [[35, 8, 9, 32, 33]], + "quantity": Counter({"2": 1, "6": 3, "id743": 1}), + }, + "device002": { + "marker": [[36, 6, 7, 73, 34]], + "quantity": Counter({"2": 1, "6": 3, "id743": 1}), + }, + }, + "topology": { + "array": { + "Export cable": [["17", "6"]], + "Substation": [["12"]], + "layout": [["device002", "device001"]], + }, + "device001": {"Elec sub-system": [["6", "2", "6", "id743", "6"]]}, + "device002": {"Elec sub-system": [["6", "2", "6", "id743", "6"]]}, + }, +} + + +electrical_components_dict = { + "Installation Type": { + 0: "wet-mate", + 2: "wet-mate", + 3: "wet-mate", + 6: "export", + 8: "array", + 9: "array", + 11: "substation", + 12: "umbilical", + 13: "umbilical", + 14: "wet-mate", + 15: "wet-mate", + 16: "wet-mate", + 17: "wet-mate", + }, + "Key Identifier": { + 0: 6, + 2: 6, + 3: 6, + 6: 17, + 8: 2, + 9: 2, + 11: 12, + 12: "id743", + 13: "id743", + 14: 6, + 15: 6, + 16: 6, + 17: 6, + }, + "Marker": { + 0: 1, + 2: 7, + 3: 9, + 6: 0, + 8: 6, + 9: 8, + 11: 2, + 12: 32, + 13: 73, + 14: 33, + 15: 34, + 16: 35, + 17: 36, + }, + "Quantity": { + 0: 1.0, + 2: 1.0, + 3: 1.0, + 6: 688.2842712474619, + 8: 150.0, + 9: 150.0, + 11: 1.0, + 12: 932.0, + 13: 312.0, + 14: 1.0, + 15: 1.0, + 16: 1.0, + 17: 1.0, + }, + "UTM X": { + 0: 587770.0, + 2: 587850.0, + 3: 587850.0, + 6: "None", + 8: "None", + 9: "None", + 11: 587770.0, + 12: "None", + 13: "None", + 14: 587850.0, + 15: 587850.0, + 16: 587850.0, + 17: 587850.0, + }, + "UTM Y": { + 0: 6650820.0, + 2: 6650700.0, + 3: 6650550.0, + 6: "None", + 8: "None", + 9: "None", + 11: 6650820.0, + 12: "None", + 13: "None", + 14: 587850.0, + 15: 587850.0, + 16: 587850.0, + 17: 587850.0, + }, +} electrical_components = pd.DataFrame(electrical_components_dict) -cable_routes_dict = {'Burial Depth': { - 13: 1.0, - 14: 1.0, - 15: 1.0, - 16: 1.0, - 17: 1.0, - 18: 1.0, - 19: 1.0, - 20: 1.0, - 21: 1.0, - 22: 1.0, - 23: 1.0, - 24: 1.0, - 25: 1.0, - 26: 1.0, - 27: 1.0, - 28: 1.0, - 29: 1.0, - 30: 1.0, - 31: 1.0, - 32: 1.0, - 33: 1.0, - 34: 1.0, - 35: 1.0, - 36: 1.0, - 37: 1.0, - 38: 1.0, - 39: 1.0, - 40: 1.0, - 41: 1.0, - 42: 1.0, - 43: 1.0, - 44: 1.0, - - 61: 2.0, - 62: 2.0, - 63: 2.0, - 64: 2.0, - 65: 2.0, - 66: 2.0, - 67: 2.0, - 68: 2.0, - 69: 2.0, - 70: 2.0, - 71: 2.0, - 72: 2.0, - 73: 2.0, - 74: 2.0, - 75: 2.0, - 76: 2.0, - 77: 2.0, - 78: 2.0, - 79: 2.0, - 80: 2.0, - 81: 2.0, - 82: 2.0, - 83: 2.0, - 84: 2.0, - 85: 2.0, - 86: 2.0, - 87: 2.0, - 88: 2.0, - 89: 2.0, - 90: 2.0, - 91: 2.0, - 92: 2.0, - 93: 2.0, - 94: 2.0, - 95: 2.0, - 96: 2.0, - 97: 2.0, - 98: 2.0, - 99: 2.0, - 100: 2.0, - 101: 2.0, - 102: 2.0, - 103: 2.0, - 104: 2.0, - 105: 2.0, - 106: 2.0, - 107: 2.0, - 108: 2.0, - 109: 2.0, - 110: 2.0, - 111: 2.0, - 112: 2.0, - 113: 2.0, - 114: 2.0, - 115: 2.0, - 116: 2.0, - 117: 2.0, - 118: 2.0, - 119: 2.0, - 120: 2.0, - 121: 2.0, - 122: 2.0, - 123: 2.0, - 124: 2.0, - 125: 2.0, - 126: 2.0, - 127: 2.0, - 128: 2.0, - 129: 2.0}, - 'Key Identifier': { - 13: 2, - 14: 2, - 15: 2, - 16: 2, - 17: 2, - 18: 2, - 19: 2, - 20: 2, - 21: 2, - 22: 2, - 23: 2, - 24: 2, - 25: 2, - 26: 2, - 27: 2, - 28: 2, - 29: 2, - 30: 2, - 31: 2, - 32: 2, - 33: 2, - 34: 2, - 35: 2, - 36: 2, - 37: 2, - 38: 2, - 39: 2, - 40: 2, - 41: 2, - 42: 2, - 43: 2, - 44: 2, - - 61: 17, - 62: 17, - 63: 17, - 64: 17, - 65: 17, - 66: 17, - 67: 17, - 68: 17, - 69: 17, - 70: 17, - 71: 17, - 72: 17, - 73: 17, - 74: 17, - 75: 17, - 76: 17, - 77: 17, - 78: 17, - 79: 17, - 80: 17, - 81: 17, - 82: 17, - 83: 17, - 84: 17, - 85: 17, - 86: 17, - 87: 17, - 88: 17, - 89: 17, - 90: 17, - 91: 17, - 92: 17, - 93: 17, - 94: 17, - 95: 17, - 96: 17, - 97: 17, - 98: 17, - 99: 17, - 100: 17, - 101: 17, - 102: 17, - 103: 17, - 104: 17, - 105: 17, - 106: 17, - 107: 17, - 108: 17, - 109: 17, - 110: 17, - 111: 17, - 112: 17, - 113: 17, - 114: 17, - 115: 17, - 116: 17, - 117: 17, - 118: 17, - 119: 17, - 120: 17, - 121: 17, - 122: 17, - 123: 17, - 124: 17, - 125: 17, - 126: 17, - 127: 17, - 128: 17, - 129: 17}, - 'Marker': { - 13: 6, - 14: 6, - 15: 6, - 16: 6, - 17: 6, - 18: 6, - 19: 6, - 20: 6, - 21: 6, - 22: 6, - 23: 6, - 24: 6, - 25: 6, - 26: 6, - 27: 6, - 28: 6, - 29: 8, - 30: 8, - 31: 8, - 32: 8, - 33: 8, - 34: 8, - 35: 8, - 36: 8, - 37: 8, - 38: 8, - 39: 8, - 40: 8, - 41: 8, - 42: 8, - 43: 8, - 44: 8, - 61: 0, - 62: 0, - 63: 0, - 64: 0, - 65: 0, - 66: 0, - 67: 0, - 68: 0, - 69: 0, - 70: 0, - 71: 0, - 72: 0, - 73: 0, - 74: 0, - 75: 0, - 76: 0, - 77: 0, - 78: 0, - 79: 0, - 80: 0, - 81: 0, - 82: 0, - 83: 0, - 84: 0, - 85: 0, - 86: 0, - 87: 0, - 88: 0, - 89: 0, - 90: 0, - 91: 0, - 92: 0, - 93: 0, - 94: 0, - 95: 0, - 96: 0, - 97: 0, - 98: 0, - 99: 0, - 100: 0, - 101: 0, - 102: 0, - 103: 0, - 104: 0, - 105: 0, - 106: 0, - 107: 0, - 108: 0, - 109: 0, - 110: 0, - 111: 0, - 112: 0, - 113: 0, - 114: 0, - 115: 0, - 116: 0, - 117: 0, - 118: 0, - 119: 0, - 120: 0, - 121: 0, - 122: 0, - 123: 0, - 124: 0, - 125: 0, - 126: 0, - 127: 0, - 128: 0, - 129: 0}, - 'Split Pipe': { - 13: False, - 14: False, - 15: False, - 16: False, - 17: False, - 18: False, - 19: False, - 20: False, - 21: False, - 22: False, - 23: False, - 24: False, - 25: False, - 26: False, - 27: False, - 28: False, - 29: False, - 30: False, - 31: False, - 32: False, - 33: False, - 34: False, - 35: False, - 36: False, - 37: False, - 38: False, - 39: False, - 40: False, - 41: False, - 42: False, - 43: False, - 44: False, - - 61: False, - 62: False, - 63: False, - 64: False, - 65: False, - 66: False, - 67: False, - 68: False, - 69: False, - 70: False, - 71: False, - 72: False, - 73: False, - 74: False, - 75: False, - 76: False, - 77: False, - 78: False, - 79: False, - 80: False, - 81: False, - 82: False, - 83: False, - 84: False, - 85: False, - 86: False, - 87: False, - 88: False, - 89: False, - 90: False, - 91: False, - 92: False, - 93: False, - 94: False, - 95: False, - 96: False, - 97: False, - 98: False, - 99: False, - 100: False, - 101: False, - 102: False, - 103: False, - 104: False, - 105: False, - 106: False, - 107: False, - 108: False, - 109: False, - 110: False, - 111: False, - 112: False, - 113: False, - 114: False, - 115: False, - 116: False, - 117: False, - 118: False, - 119: False, - 120: False, - 121: False, - 122: False, - 123: False, - 124: False, - 125: False, - 126: False, - 127: False, - 128: False, - 129: False}, - 'UTM X': { - 13: 587700, - 14: 587710, - 15: 587720, - 16: 587730, - 17: 587740, - 18: 587750, - 19: 587760, - 20: 587770, - 21: 587780, - 22: 587790, - 23: 587800, - 24: 587810, - 25: 587820, - 26: 587830, - 27: 587840, - 28: 587850, - 29: 587850, - 30: 587850, - 31: 587850, - 32: 587850, - 33: 587850, - 34: 587850, - 35: 587850, - 36: 587850, - 37: 587850, - 38: 587850, - 39: 587850, - 40: 587850, - 41: 587850, - 42: 587850, - 43: 587850, - 44: 587850, - - 61: 587750, - 62: 587750, - 63: 587750, - 64: 587750, - 65: 587750, - 66: 587750, - 67: 587750, - 68: 587750, - 69: 587750, - 70: 587750, - 71: 587750, - 72: 587750, - 73: 587750, - 74: 587750, - 75: 587750, - 76: 587750, - 77: 587750, - 78: 587750, - 79: 587750, - 80: 587750, - 81: 587750, - 82: 587750, - 83: 587750, - 84: 587750, - 85: 587750, - 86: 587750, - 87: 587750, - 88: 587750, - 89: 587750, - 90: 587750, - 91: 587750, - 92: 587750, - 93: 587750, - 94: 587750, - 95: 587750, - 96: 587750, - 97: 587750, - 98: 587750, - 99: 587750, - 100: 587750, - 101: 587750, - 102: 587750, - 103: 587750, - 104: 587750, - 105: 587750, - 106: 587750, - 107: 587750, - 108: 587750, - 109: 587750, - 110: 587750, - 111: 587750, - 112: 587750, - 113: 587750, - 114: 587750, - 115: 587750, - 116: 587750, - 117: 587750, - 118: 587750, - 119: 587750, - 120: 587750, - 121: 587750, - 122: 587750, - 123: 587750, - 124: 587750, - 125: 587750, - 126: 587750, - 127: 587750, - 128: 587760, - 129: 587770}, - 'UTM Y': { - 13: 6650700, - 14: 6650700, - 15: 6650700, - 16: 6650700, - 17: 6650700, - 18: 6650700, - 19: 6650700, - 20: 6650700, - 21: 6650700, - 22: 6650700, - 23: 6650700, - 24: 6650700, - 25: 6650700, - 26: 6650700, - 27: 6650700, - 28: 6650700, - 29: 6650700, - 30: 6650690, - 31: 6650680, - 32: 6650670, - 33: 6650660, - 34: 6650650, - 35: 6650640, - 36: 6650630, - 37: 6650620, - 38: 6650610, - 39: 6650600, - 40: 6650590, - 41: 6650580, - 42: 6650570, - 43: 6650560, - 44: 6650550, - - 61: 6651500, - 62: 6651490, - 63: 6651480, - 64: 6651470, - 65: 6651460, - 66: 6651450, - 67: 6651440, - 68: 6651430, - 69: 6651420, - 70: 6651410, - 71: 6651400, - 72: 6651390, - 73: 6651380, - 74: 6651370, - 75: 6651360, - 76: 6651350, - 77: 6651340, - 78: 6651330, - 79: 6651320, - 80: 6651310, - 81: 6651300, - 82: 6651290, - 83: 6651280, - 84: 6651270, - 85: 6651260, - 86: 6651250, - 87: 6651240, - 88: 6651230, - 89: 6651220, - 90: 6651210, - 91: 6651200, - 92: 6651190, - 93: 6651180, - 94: 6651170, - 95: 6651160, - 96: 6651150, - 97: 6651140, - 98: 6651130, - 99: 6651120, - 100: 6651110, - 101: 6651100, - 102: 6651090, - 103: 6651080, - 104: 6651070, - 105: 6651060, - 106: 6651050, - 107: 6651040, - 108: 6651030, - 109: 6651020, - 110: 6651010, - 111: 6651000, - 112: 6650990, - 113: 6650980, - 114: 6650970, - 115: 6650960, - 116: 6650950, - 117: 6650940, - 118: 6650930, - 119: 6650920, - 120: 6650910, - 121: 6650900, - 122: 6650890, - 123: 6650880, - 124: 6650870, - 125: 6650860, - 126: 6650850, - 127: 6650840, - 128: 6650830, - 129: 6650820}, - 'Depth': {13: -30.0, - 14: -30.0, - 15: -30.0, - 16: -30.0, - 17: -30.0, - 18: -30.0, - 19: -30.0, - 20: -30.0, - 21: -30.0, - 22: -30.0, - 23: -30.0, - 24: -30.0, - 25: -30.0, - 26: -30.0, - 27: -30.0, - 28: -30.0, - 29: -30.0, - 30: -30.0, - 31: -30.0, - 32: -30.0, - 33: -30.0, - 34: -30.0, - 35: -30.0, - 36: -30.0, - 37: -30.0, - 38: -30.0, - 39: -30.0, - 40: -30.0, - 41: -30.0, - 42: -30.0, - 43: -30.0, - 44: -30.0, - 61: -30.0, - 62: -30.0, - 63: -30.0, - 64: -30.0, - 65: -30.0, - 66: -30.0, - 67: -30.0, - 68: -30.0, - 69: -30.0, - 70: -30.0, - 71: -30.0, - 72: -30.0, - 73: -30.0, - 74: -30.0, - 75: -30.0, - 76: -30.0, - 77: -30.0, - 78: -30.0, - 79: -30.0, - 80: -30.0, - 81: -30.0, - 82: -30.0, - 83: -30.0, - 84: -30.0, - 85: -30.0, - 86: -30.0, - 87: -30.0, - 88: -30.0, - 89: -30.0, - 90: -30.0, - 91: -30.0, - 92: -30.0, - 93: -30.0, - 94: -30.0, - 95: -30.0, - 96: -30.0, - 97: -30.0, - 98: -30.0, - 99: -30.0, - 100: -30.0, - 101: -30.0, - 102: -30.0, - 103: -30.0, - 104: -30.0, - 105: -30.0, - 106: -30.0, - 107: -30.0, - 108: -30.0, - 109: -30.0, - 110: -30.0, - 111: -30.0, - 112: -30.0, - 113: -30.0, - 114: -30.0, - 115: -30.0, - 116: -30.0, - 117: -30.0, - 118: -30.0, - 119: -30.0, - 120: -30.0, - 121: -30.0, - 122: -30.0, - 123: -30.0, - 124: -30.0, - 125: -30.0, - 126: -30.0, - 127: -30.0, - 128: -30.0, - 129: -30.0}, - "Sediment": {13: 'soft clay', - 14: 'soft clay', - 15: 'soft clay', - 16: 'soft clay', - 17: 'soft clay', - 18: 'soft clay', - 19: 'soft clay', - 20: 'soft clay', - 21: 'soft clay', - 22: 'soft clay', - 23: 'soft clay', - 24: 'soft clay', - 25: 'soft clay', - 26: 'soft clay', - 27: 'soft clay', - 28: 'soft clay', - 29: 'soft clay', - 30: 'soft clay', - 31: 'soft clay', - 32: 'soft clay', - 33: 'soft clay', - 34: 'soft clay', - 35: 'soft clay', - 36: 'soft clay', - 37: 'soft clay', - 38: 'soft clay', - 39: 'soft clay', - 40: 'soft clay', - 41: 'soft clay', - 42: 'soft clay', - 43: 'soft clay', - 44: 'soft clay', - 61: 'soft clay', - 62: 'soft clay', - 63: 'soft clay', - 64: 'soft clay', - 65: 'soft clay', - 66: 'soft clay', - 67: 'soft clay', - 68: 'soft clay', - 69: 'soft clay', - 70: 'soft clay', - 71: 'soft clay', - 72: 'soft clay', - 73: 'soft clay', - 74: 'soft clay', - 75: 'soft clay', - 76: 'soft clay', - 77: 'soft clay', - 78: 'soft clay', - 79: 'soft clay', - 80: 'soft clay', - 81: 'soft clay', - 82: 'soft clay', - 83: 'soft clay', - 84: 'soft clay', - 85: 'soft clay', - 86: 'soft clay', - 87: 'soft clay', - 88: 'soft clay', - 89: 'soft clay', - 90: 'soft clay', - 91: 'soft clay', - 92: 'soft clay', - 93: 'soft clay', - 94: 'soft clay', - 95: 'soft clay', - 96: 'soft clay', - 97: 'soft clay', - 98: 'soft clay', - 99: 'soft clay', - 100: 'soft clay', - 101: 'soft clay', - 102: 'soft clay', - 103: 'soft clay', - 104: 'soft clay', - 105: 'soft clay', - 106: 'soft clay', - 107: 'soft clay', - 108: 'soft clay', - 109: 'soft clay', - 110: 'soft clay', - 111: 'soft clay', - 112: 'soft clay', - 113: 'soft clay', - 114: 'soft clay', - 115: 'soft clay', - 116: 'soft clay', - 117: 'soft clay', - 118: 'soft clay', - 119: 'soft clay', - 120: 'soft clay', - 121: 'soft clay', - 122: 'soft clay', - 123: 'soft clay', - 124: 'soft clay', - 125: 'soft clay', - 126: 'soft clay', - 127: 'soft clay', - 128: 'soft clay', - 129: 'soft clay'}} - +cable_routes_dict = { + "Burial Depth": { + 13: 1.0, + 14: 1.0, + 15: 1.0, + 16: 1.0, + 17: 1.0, + 18: 1.0, + 19: 1.0, + 20: 1.0, + 21: 1.0, + 22: 1.0, + 23: 1.0, + 24: 1.0, + 25: 1.0, + 26: 1.0, + 27: 1.0, + 28: 1.0, + 29: 1.0, + 30: 1.0, + 31: 1.0, + 32: 1.0, + 33: 1.0, + 34: 1.0, + 35: 1.0, + 36: 1.0, + 37: 1.0, + 38: 1.0, + 39: 1.0, + 40: 1.0, + 41: 1.0, + 42: 1.0, + 43: 1.0, + 44: 1.0, + 61: 2.0, + 62: 2.0, + 63: 2.0, + 64: 2.0, + 65: 2.0, + 66: 2.0, + 67: 2.0, + 68: 2.0, + 69: 2.0, + 70: 2.0, + 71: 2.0, + 72: 2.0, + 73: 2.0, + 74: 2.0, + 75: 2.0, + 76: 2.0, + 77: 2.0, + 78: 2.0, + 79: 2.0, + 80: 2.0, + 81: 2.0, + 82: 2.0, + 83: 2.0, + 84: 2.0, + 85: 2.0, + 86: 2.0, + 87: 2.0, + 88: 2.0, + 89: 2.0, + 90: 2.0, + 91: 2.0, + 92: 2.0, + 93: 2.0, + 94: 2.0, + 95: 2.0, + 96: 2.0, + 97: 2.0, + 98: 2.0, + 99: 2.0, + 100: 2.0, + 101: 2.0, + 102: 2.0, + 103: 2.0, + 104: 2.0, + 105: 2.0, + 106: 2.0, + 107: 2.0, + 108: 2.0, + 109: 2.0, + 110: 2.0, + 111: 2.0, + 112: 2.0, + 113: 2.0, + 114: 2.0, + 115: 2.0, + 116: 2.0, + 117: 2.0, + 118: 2.0, + 119: 2.0, + 120: 2.0, + 121: 2.0, + 122: 2.0, + 123: 2.0, + 124: 2.0, + 125: 2.0, + 126: 2.0, + 127: 2.0, + 128: 2.0, + 129: 2.0, + }, + "Key Identifier": { + 13: 2, + 14: 2, + 15: 2, + 16: 2, + 17: 2, + 18: 2, + 19: 2, + 20: 2, + 21: 2, + 22: 2, + 23: 2, + 24: 2, + 25: 2, + 26: 2, + 27: 2, + 28: 2, + 29: 2, + 30: 2, + 31: 2, + 32: 2, + 33: 2, + 34: 2, + 35: 2, + 36: 2, + 37: 2, + 38: 2, + 39: 2, + 40: 2, + 41: 2, + 42: 2, + 43: 2, + 44: 2, + 61: 17, + 62: 17, + 63: 17, + 64: 17, + 65: 17, + 66: 17, + 67: 17, + 68: 17, + 69: 17, + 70: 17, + 71: 17, + 72: 17, + 73: 17, + 74: 17, + 75: 17, + 76: 17, + 77: 17, + 78: 17, + 79: 17, + 80: 17, + 81: 17, + 82: 17, + 83: 17, + 84: 17, + 85: 17, + 86: 17, + 87: 17, + 88: 17, + 89: 17, + 90: 17, + 91: 17, + 92: 17, + 93: 17, + 94: 17, + 95: 17, + 96: 17, + 97: 17, + 98: 17, + 99: 17, + 100: 17, + 101: 17, + 102: 17, + 103: 17, + 104: 17, + 105: 17, + 106: 17, + 107: 17, + 108: 17, + 109: 17, + 110: 17, + 111: 17, + 112: 17, + 113: 17, + 114: 17, + 115: 17, + 116: 17, + 117: 17, + 118: 17, + 119: 17, + 120: 17, + 121: 17, + 122: 17, + 123: 17, + 124: 17, + 125: 17, + 126: 17, + 127: 17, + 128: 17, + 129: 17, + }, + "Marker": { + 13: 6, + 14: 6, + 15: 6, + 16: 6, + 17: 6, + 18: 6, + 19: 6, + 20: 6, + 21: 6, + 22: 6, + 23: 6, + 24: 6, + 25: 6, + 26: 6, + 27: 6, + 28: 6, + 29: 8, + 30: 8, + 31: 8, + 32: 8, + 33: 8, + 34: 8, + 35: 8, + 36: 8, + 37: 8, + 38: 8, + 39: 8, + 40: 8, + 41: 8, + 42: 8, + 43: 8, + 44: 8, + 61: 0, + 62: 0, + 63: 0, + 64: 0, + 65: 0, + 66: 0, + 67: 0, + 68: 0, + 69: 0, + 70: 0, + 71: 0, + 72: 0, + 73: 0, + 74: 0, + 75: 0, + 76: 0, + 77: 0, + 78: 0, + 79: 0, + 80: 0, + 81: 0, + 82: 0, + 83: 0, + 84: 0, + 85: 0, + 86: 0, + 87: 0, + 88: 0, + 89: 0, + 90: 0, + 91: 0, + 92: 0, + 93: 0, + 94: 0, + 95: 0, + 96: 0, + 97: 0, + 98: 0, + 99: 0, + 100: 0, + 101: 0, + 102: 0, + 103: 0, + 104: 0, + 105: 0, + 106: 0, + 107: 0, + 108: 0, + 109: 0, + 110: 0, + 111: 0, + 112: 0, + 113: 0, + 114: 0, + 115: 0, + 116: 0, + 117: 0, + 118: 0, + 119: 0, + 120: 0, + 121: 0, + 122: 0, + 123: 0, + 124: 0, + 125: 0, + 126: 0, + 127: 0, + 128: 0, + 129: 0, + }, + "Split Pipe": { + 13: False, + 14: False, + 15: False, + 16: False, + 17: False, + 18: False, + 19: False, + 20: False, + 21: False, + 22: False, + 23: False, + 24: False, + 25: False, + 26: False, + 27: False, + 28: False, + 29: False, + 30: False, + 31: False, + 32: False, + 33: False, + 34: False, + 35: False, + 36: False, + 37: False, + 38: False, + 39: False, + 40: False, + 41: False, + 42: False, + 43: False, + 44: False, + 61: False, + 62: False, + 63: False, + 64: False, + 65: False, + 66: False, + 67: False, + 68: False, + 69: False, + 70: False, + 71: False, + 72: False, + 73: False, + 74: False, + 75: False, + 76: False, + 77: False, + 78: False, + 79: False, + 80: False, + 81: False, + 82: False, + 83: False, + 84: False, + 85: False, + 86: False, + 87: False, + 88: False, + 89: False, + 90: False, + 91: False, + 92: False, + 93: False, + 94: False, + 95: False, + 96: False, + 97: False, + 98: False, + 99: False, + 100: False, + 101: False, + 102: False, + 103: False, + 104: False, + 105: False, + 106: False, + 107: False, + 108: False, + 109: False, + 110: False, + 111: False, + 112: False, + 113: False, + 114: False, + 115: False, + 116: False, + 117: False, + 118: False, + 119: False, + 120: False, + 121: False, + 122: False, + 123: False, + 124: False, + 125: False, + 126: False, + 127: False, + 128: False, + 129: False, + }, + "UTM X": { + 13: 587700, + 14: 587710, + 15: 587720, + 16: 587730, + 17: 587740, + 18: 587750, + 19: 587760, + 20: 587770, + 21: 587780, + 22: 587790, + 23: 587800, + 24: 587810, + 25: 587820, + 26: 587830, + 27: 587840, + 28: 587850, + 29: 587850, + 30: 587850, + 31: 587850, + 32: 587850, + 33: 587850, + 34: 587850, + 35: 587850, + 36: 587850, + 37: 587850, + 38: 587850, + 39: 587850, + 40: 587850, + 41: 587850, + 42: 587850, + 43: 587850, + 44: 587850, + 61: 587750, + 62: 587750, + 63: 587750, + 64: 587750, + 65: 587750, + 66: 587750, + 67: 587750, + 68: 587750, + 69: 587750, + 70: 587750, + 71: 587750, + 72: 587750, + 73: 587750, + 74: 587750, + 75: 587750, + 76: 587750, + 77: 587750, + 78: 587750, + 79: 587750, + 80: 587750, + 81: 587750, + 82: 587750, + 83: 587750, + 84: 587750, + 85: 587750, + 86: 587750, + 87: 587750, + 88: 587750, + 89: 587750, + 90: 587750, + 91: 587750, + 92: 587750, + 93: 587750, + 94: 587750, + 95: 587750, + 96: 587750, + 97: 587750, + 98: 587750, + 99: 587750, + 100: 587750, + 101: 587750, + 102: 587750, + 103: 587750, + 104: 587750, + 105: 587750, + 106: 587750, + 107: 587750, + 108: 587750, + 109: 587750, + 110: 587750, + 111: 587750, + 112: 587750, + 113: 587750, + 114: 587750, + 115: 587750, + 116: 587750, + 117: 587750, + 118: 587750, + 119: 587750, + 120: 587750, + 121: 587750, + 122: 587750, + 123: 587750, + 124: 587750, + 125: 587750, + 126: 587750, + 127: 587750, + 128: 587760, + 129: 587770, + }, + "UTM Y": { + 13: 6650700, + 14: 6650700, + 15: 6650700, + 16: 6650700, + 17: 6650700, + 18: 6650700, + 19: 6650700, + 20: 6650700, + 21: 6650700, + 22: 6650700, + 23: 6650700, + 24: 6650700, + 25: 6650700, + 26: 6650700, + 27: 6650700, + 28: 6650700, + 29: 6650700, + 30: 6650690, + 31: 6650680, + 32: 6650670, + 33: 6650660, + 34: 6650650, + 35: 6650640, + 36: 6650630, + 37: 6650620, + 38: 6650610, + 39: 6650600, + 40: 6650590, + 41: 6650580, + 42: 6650570, + 43: 6650560, + 44: 6650550, + 61: 6651500, + 62: 6651490, + 63: 6651480, + 64: 6651470, + 65: 6651460, + 66: 6651450, + 67: 6651440, + 68: 6651430, + 69: 6651420, + 70: 6651410, + 71: 6651400, + 72: 6651390, + 73: 6651380, + 74: 6651370, + 75: 6651360, + 76: 6651350, + 77: 6651340, + 78: 6651330, + 79: 6651320, + 80: 6651310, + 81: 6651300, + 82: 6651290, + 83: 6651280, + 84: 6651270, + 85: 6651260, + 86: 6651250, + 87: 6651240, + 88: 6651230, + 89: 6651220, + 90: 6651210, + 91: 6651200, + 92: 6651190, + 93: 6651180, + 94: 6651170, + 95: 6651160, + 96: 6651150, + 97: 6651140, + 98: 6651130, + 99: 6651120, + 100: 6651110, + 101: 6651100, + 102: 6651090, + 103: 6651080, + 104: 6651070, + 105: 6651060, + 106: 6651050, + 107: 6651040, + 108: 6651030, + 109: 6651020, + 110: 6651010, + 111: 6651000, + 112: 6650990, + 113: 6650980, + 114: 6650970, + 115: 6650960, + 116: 6650950, + 117: 6650940, + 118: 6650930, + 119: 6650920, + 120: 6650910, + 121: 6650900, + 122: 6650890, + 123: 6650880, + 124: 6650870, + 125: 6650860, + 126: 6650850, + 127: 6650840, + 128: 6650830, + 129: 6650820, + }, + "Depth": { + 13: -30.0, + 14: -30.0, + 15: -30.0, + 16: -30.0, + 17: -30.0, + 18: -30.0, + 19: -30.0, + 20: -30.0, + 21: -30.0, + 22: -30.0, + 23: -30.0, + 24: -30.0, + 25: -30.0, + 26: -30.0, + 27: -30.0, + 28: -30.0, + 29: -30.0, + 30: -30.0, + 31: -30.0, + 32: -30.0, + 33: -30.0, + 34: -30.0, + 35: -30.0, + 36: -30.0, + 37: -30.0, + 38: -30.0, + 39: -30.0, + 40: -30.0, + 41: -30.0, + 42: -30.0, + 43: -30.0, + 44: -30.0, + 61: -30.0, + 62: -30.0, + 63: -30.0, + 64: -30.0, + 65: -30.0, + 66: -30.0, + 67: -30.0, + 68: -30.0, + 69: -30.0, + 70: -30.0, + 71: -30.0, + 72: -30.0, + 73: -30.0, + 74: -30.0, + 75: -30.0, + 76: -30.0, + 77: -30.0, + 78: -30.0, + 79: -30.0, + 80: -30.0, + 81: -30.0, + 82: -30.0, + 83: -30.0, + 84: -30.0, + 85: -30.0, + 86: -30.0, + 87: -30.0, + 88: -30.0, + 89: -30.0, + 90: -30.0, + 91: -30.0, + 92: -30.0, + 93: -30.0, + 94: -30.0, + 95: -30.0, + 96: -30.0, + 97: -30.0, + 98: -30.0, + 99: -30.0, + 100: -30.0, + 101: -30.0, + 102: -30.0, + 103: -30.0, + 104: -30.0, + 105: -30.0, + 106: -30.0, + 107: -30.0, + 108: -30.0, + 109: -30.0, + 110: -30.0, + 111: -30.0, + 112: -30.0, + 113: -30.0, + 114: -30.0, + 115: -30.0, + 116: -30.0, + 117: -30.0, + 118: -30.0, + 119: -30.0, + 120: -30.0, + 121: -30.0, + 122: -30.0, + 123: -30.0, + 124: -30.0, + 125: -30.0, + 126: -30.0, + 127: -30.0, + 128: -30.0, + 129: -30.0, + }, + "Sediment": { + 13: "soft clay", + 14: "soft clay", + 15: "soft clay", + 16: "soft clay", + 17: "soft clay", + 18: "soft clay", + 19: "soft clay", + 20: "soft clay", + 21: "soft clay", + 22: "soft clay", + 23: "soft clay", + 24: "soft clay", + 25: "soft clay", + 26: "soft clay", + 27: "soft clay", + 28: "soft clay", + 29: "soft clay", + 30: "soft clay", + 31: "soft clay", + 32: "soft clay", + 33: "soft clay", + 34: "soft clay", + 35: "soft clay", + 36: "soft clay", + 37: "soft clay", + 38: "soft clay", + 39: "soft clay", + 40: "soft clay", + 41: "soft clay", + 42: "soft clay", + 43: "soft clay", + 44: "soft clay", + 61: "soft clay", + 62: "soft clay", + 63: "soft clay", + 64: "soft clay", + 65: "soft clay", + 66: "soft clay", + 67: "soft clay", + 68: "soft clay", + 69: "soft clay", + 70: "soft clay", + 71: "soft clay", + 72: "soft clay", + 73: "soft clay", + 74: "soft clay", + 75: "soft clay", + 76: "soft clay", + 77: "soft clay", + 78: "soft clay", + 79: "soft clay", + 80: "soft clay", + 81: "soft clay", + 82: "soft clay", + 83: "soft clay", + 84: "soft clay", + 85: "soft clay", + 86: "soft clay", + 87: "soft clay", + 88: "soft clay", + 89: "soft clay", + 90: "soft clay", + 91: "soft clay", + 92: "soft clay", + 93: "soft clay", + 94: "soft clay", + 95: "soft clay", + 96: "soft clay", + 97: "soft clay", + 98: "soft clay", + 99: "soft clay", + 100: "soft clay", + 101: "soft clay", + 102: "soft clay", + 103: "soft clay", + 104: "soft clay", + 105: "soft clay", + 106: "soft clay", + 107: "soft clay", + 108: "soft clay", + 109: "soft clay", + 110: "soft clay", + 111: "soft clay", + 112: "soft clay", + 113: "soft clay", + 114: "soft clay", + 115: "soft clay", + 116: "soft clay", + 117: "soft clay", + 118: "soft clay", + 119: "soft clay", + 120: "soft clay", + 121: "soft clay", + 122: "soft clay", + 123: "soft clay", + 124: "soft clay", + 125: "soft clay", + 126: "soft clay", + 127: "soft clay", + 128: "soft clay", + 129: "soft clay", + }, +} + cable_routes = pd.DataFrame(cable_routes_dict) -substations_dict = { 'Dry Beam Area': {0: 0}, - 'Dry Frontal Area': {0: 0}, - 'Height': {0: 10}, - 'Length': {0: 10}, - 'Marker': {0: 2}, - 'Mass': {0: 100}, - 'Orientation Angle': {0: 0}, - 'Profile': {0: 'rectangular'}, - 'Substation Identifier': {0: 'array'}, - 'Surface Roughness': {0: 9.9999999999999995e-07}, - 'Type': {0: u'subsea'}, - 'Volume': {0: 1000}, - 'Wet Beam Area': {0: 0}, - 'Wet Frontal Area': {0: 0}, - 'Width': {0: 10}} +substations_dict = { + "Dry Beam Area": {0: 0}, + "Dry Frontal Area": {0: 0}, + "Height": {0: 10}, + "Length": {0: 10}, + "Marker": {0: 2}, + "Mass": {0: 100}, + "Orientation Angle": {0: 0}, + "Profile": {0: "rectangular"}, + "Substation Identifier": {0: "array"}, + "Surface Roughness": {0: 9.9999999999999995e-07}, + "Type": {0: "subsea"}, + "Volume": {0: 1000}, + "Wet Beam Area": {0: 0}, + "Wet Frontal Area": {0: 0}, + "Width": {0: 10}, +} substations = pd.DataFrame(substations_dict) umbilical_data_dict = { - 'Dry Mass': {0: 10251.058909500687, 1: 3436.7119045633135}, - 'Floatation Length': {0: 186.38288926364888, 1: 62.48567099206025}, - 'Key Identifier': {0: 'id743', 1: 'id743'}, - 'Length': {0: 931.91444631824436, 1: 312.42835496030125}, - 'Marker': {0: 32, 1: 73}, - 'Required Floatation': {0: 151.02240999999998, 1: 151.02240999999998}} + "Dry Mass": {0: 10251.058909500687, 1: 3436.7119045633135}, + "Floatation Length": {0: 186.38288926364888, 1: 62.48567099206025}, + "Key Identifier": {0: "id743", 1: "id743"}, + "Length": {0: 931.91444631824436, 1: 312.42835496030125}, + "Marker": {0: 32, 1: 73}, + "Required Floatation": {0: 151.02240999999998, 1: 151.02240999999998}, +} umbilicals = pd.DataFrame(umbilical_data_dict) -umbilical_terminations = {'device001': [587875.,6650550.], - 'device002': [587875.,6650700.]} +umbilical_terminations = { + "device001": [587875.0, 6650550.0], + "device002": [587875.0, 6650700.0], +} # modify electrical solution to force installation solution -cable_routes.loc[:, 'Burial Depth'] = [0.5]*len(cable_routes) -electrical_components.loc[:, 'Quantity'] = [1]*len(electrical_components) +cable_routes.loc[:, "Burial Depth"] = [0.5] * len(cable_routes) +electrical_components.loc[:, "Quantity"] = [1] * len(electrical_components) # elec db -file_name = 'mock_db.xlsx' -xls_file = pd.ExcelFile(os.path.join(elec_dir, file_name), - encoding = 'utf-8') +file_name = "mock_db.xlsx" +xls_file = pd.ExcelFile(os.path.join(elec_dir, file_name)) sheet_names = xls_file.sheet_names static_cables = xls_file.parse(sheet_names[0]) dynamic_cables = xls_file.parse(sheet_names[1]) @@ -1394,628 +1444,615 @@ ### M & F mf_network = { - 'nodes': {'array': {'Substation foundation': {'marker': [[82, 83]], - 'quantity': Counter({'id718': 1, - 'grout': 1})}}, - 'device001': {'Foundation': {'marker': [[33, 34], - [35, 36], - [37, 38], - [39, 40]], - 'quantity': Counter({'grout': 4, - 'id516': 3, - 'id528': 1})}, - 'Mooring system': {'marker': [[0, - 1, - 2, - 3, - 4, - 5, - 6, - 7], - [8, - 9, - 10, - 11, - 12, - 13, - 14, - 15], - [16, - 17, - 18, - 19, - 20, - 21, - 22, - 23], - [24, - 25, - 26, - 27, - 28, - 29, - 30, - 31]], - 'quantity': Counter({'id316': 16, - 'id471': 4, - 'id422': 4, - 'id68': 4, - 'id338': 4})}, - 'Umbilical': {'marker': [[32]], - 'quantity': Counter({'id743': 1})}}, - 'device002': {'Foundation': {'marker': [[74, 75], - [76, 77], - [78, 79], - [80, 81]], - 'quantity': Counter({'grout': 4, - 'id516': 3, - 'id528': 1})}, - 'Mooring system': {'marker': [[41, - 42, - 43, - 44, - 45, - 46, - 47, - 48], - [49, - 50, - 51, - 52, - 53, - 54, - 55, - 56], - [57, - 58, - 59, - 60, - 61, - 62, - 63, - 64], - [65, - 66, - 67, - 68, - 69, - 70, - 71, - 72]], - 'quantity': Counter({'id316': 16, - 'id471': 4, - 'id422': 4, - 'id68': 4, - 'id338': 4})}, - 'Umbilical': {'marker': [[73]], - 'quantity': Counter({'id743': 1})}}}, - 'topology': {'array': {'Substation foundation': [['id718', 'grout']]}, - 'device001': {'Foundation': [['id516', 'grout'], - ['id516', 'grout'], - ['id528', 'grout'], - ['id516', 'grout']], - 'Mooring system': [['id471', - 'id316', - 'id68', - 'id316', - 'id422', - 'id316', - 'id338', - 'id316'], - ['id471', - 'id316', - 'id68', - 'id316', - 'id422', - 'id316', - 'id338', - 'id316'], - ['id471', - 'id316', - 'id68', - 'id316', - 'id422', - 'id316', - 'id338', - 'id316'], - ['id471', - 'id316', - 'id68', - 'id316', - 'id422', - 'id316', - 'id338', - 'id316']], - 'Umbilical': [['id743']]}, - 'device002': {'Foundation': [['id516', 'grout'], - ['id516', 'grout'], - ['id528', 'grout'], - ['id516', 'grout']], - 'Mooring system': [['id471', - 'id316', - 'id68', - 'id316', - 'id422', - 'id316', - 'id338', - 'id316'], - ['id471', - 'id316', - 'id68', - 'id316', - 'id422', - 'id316', - 'id338', - 'id316'], - ['id471', - 'id316', - 'id68', - 'id316', - 'id422', - 'id316', - 'id338', - 'id316'], - ['id471', - 'id316', - 'id68', - 'id316', - 'id422', - 'id316', - 'id338', - 'id316']], - 'Umbilical': [['id743']]}}} - -foundations_data_dict = {'Depth': {0: -129.64764390798447, - 1: -131.06535602160358, - 2: -122.02807331534915, - 3: -114.17057764339403, - 4: -123.39040119401608, - 5: -116.04659899761107, - 6: -129.18197837246262, - 7: -121.65903920188651, - 8: -112.8361895661229}, - 'Dry Mass': {0: 157.55159536731895, - 1: 157.55159536731895, - 2: 6391.8893307176222, - 3: 861.87962454769695, - 4: 157.55159536731895, - 5: 157.55159536731895, - 6: 6391.8893307176222, - 7: 861.87962454769695, - 8: 90193.46400008176}, - 'Grout Type': {0: 'grout', - 1: 'grout', - 2: 'grout', - 3: 'grout', - 4: 'grout', - 5: 'grout', - 6: 'grout', - 7: 'grout', - 8: 'grout'}, - 'Grout Volume': {0: 0.016196675543330975, - 1: 0.016196675543330975, - 2: 0.477247220095879, - 3: 0.088603257895683671, - 4: 0.016196675543330975, - 5: 0.016196675543330975, - 6: 0.477247220095879, - 7: 0.088603257895683671, - 8: 7.9546039748529802}, - 'Height': {0: 0.91400000000000003, - 1: 0.91400000000000003, - 2: 18.0, - 3: 5.0, - 4: 0.91400000000000003, - 5: 0.91400000000000003, - 6: 18.0, - 7: 5.0, - 8: 15.0}, - 'Installation Depth': {0: 0.91400000000000003, - 1: 0.91400000000000003, - 2: 18.0, - 3: 5.0, - 4: 0.91400000000000003, - 5: 0.91400000000000003, - 6: 18.0, - 7: 5.0, - 8: 15.0}, - 'Length': {0: 0.45700000000000002, - 1: 0.45700000000000002, - 2: 0.55900000000000005, - 3: 0.45700000000000002, - 4: 0.45700000000000002, - 5: 0.45700000000000002, - 6: 0.55900000000000005, - 7: 0.45700000000000002, - 8: 2.5}, - 'Marker': {0: 33, - 1: 35, - 2: 37, - 3: 39, - 4: 74, - 5: 76, - 6: 78, - 7: 80, - 8: 82}, - 'Sub-Type': {0: 'pipe pile', - 1: 'pipe pile', - 2: 'pipe pile', - 3: 'pipe pile', - 4: 'pipe pile', - 5: 'pipe pile', - 6: 'pipe pile', - 7: 'pipe pile', - 8: 'pipe pile'}, - 'Type': {0: 'pile', - 1: 'pile', - 2: 'pile', - 3: 'pile', - 4: 'pile', - 5: 'pile', - 6: 'pile', - 7: 'pile', - 8: 'pile'}, - 'UTM X': {0: 587490.0, - 1: 587600.0, - 2: 587600.0, - 3: 587490.0, - 4: 587700.0, - 5: 587900.0, - 6: 587900.0, - 7: 587700.0, - 8: 587490.0}, - 'UTM Y': {0: 6650600.0, - 1: 6650600.0, - 2: 6650500.0, - 3: 6650500.0, - 4: 6650800.0, - 5: 6650800.0, - 6: 6650600.0, - 7: 6650600.0, - 8: 6651060.0}, - 'Width': {0: 0.45700000000000002, - 1: 0.45700000000000002, - 2: 0.55900000000000005, - 3: 0.45700000000000002, - 4: 0.45700000000000002, - 5: 0.45700000000000002, - 6: 0.55900000000000005, - 7: 0.45700000000000002, - 8: 2.5}} - + "nodes": { + "array": { + "Substation foundation": { + "marker": [[82, 83]], + "quantity": Counter({"id718": 1, "grout": 1}), + } + }, + "device001": { + "Foundation": { + "marker": [[33, 34], [35, 36], [37, 38], [39, 40]], + "quantity": Counter({"grout": 4, "id516": 3, "id528": 1}), + }, + "Mooring system": { + "marker": [ + [0, 1, 2, 3, 4, 5, 6, 7], + [8, 9, 10, 11, 12, 13, 14, 15], + [16, 17, 18, 19, 20, 21, 22, 23], + [24, 25, 26, 27, 28, 29, 30, 31], + ], + "quantity": Counter( + {"id316": 16, "id471": 4, "id422": 4, "id68": 4, "id338": 4} + ), + }, + "Umbilical": {"marker": [[32]], "quantity": Counter({"id743": 1})}, + }, + "device002": { + "Foundation": { + "marker": [[74, 75], [76, 77], [78, 79], [80, 81]], + "quantity": Counter({"grout": 4, "id516": 3, "id528": 1}), + }, + "Mooring system": { + "marker": [ + [41, 42, 43, 44, 45, 46, 47, 48], + [49, 50, 51, 52, 53, 54, 55, 56], + [57, 58, 59, 60, 61, 62, 63, 64], + [65, 66, 67, 68, 69, 70, 71, 72], + ], + "quantity": Counter( + {"id316": 16, "id471": 4, "id422": 4, "id68": 4, "id338": 4} + ), + }, + "Umbilical": {"marker": [[73]], "quantity": Counter({"id743": 1})}, + }, + }, + "topology": { + "array": {"Substation foundation": [["id718", "grout"]]}, + "device001": { + "Foundation": [ + ["id516", "grout"], + ["id516", "grout"], + ["id528", "grout"], + ["id516", "grout"], + ], + "Mooring system": [ + [ + "id471", + "id316", + "id68", + "id316", + "id422", + "id316", + "id338", + "id316", + ], + [ + "id471", + "id316", + "id68", + "id316", + "id422", + "id316", + "id338", + "id316", + ], + [ + "id471", + "id316", + "id68", + "id316", + "id422", + "id316", + "id338", + "id316", + ], + [ + "id471", + "id316", + "id68", + "id316", + "id422", + "id316", + "id338", + "id316", + ], + ], + "Umbilical": [["id743"]], + }, + "device002": { + "Foundation": [ + ["id516", "grout"], + ["id516", "grout"], + ["id528", "grout"], + ["id516", "grout"], + ], + "Mooring system": [ + [ + "id471", + "id316", + "id68", + "id316", + "id422", + "id316", + "id338", + "id316", + ], + [ + "id471", + "id316", + "id68", + "id316", + "id422", + "id316", + "id338", + "id316", + ], + [ + "id471", + "id316", + "id68", + "id316", + "id422", + "id316", + "id338", + "id316", + ], + [ + "id471", + "id316", + "id68", + "id316", + "id422", + "id316", + "id338", + "id316", + ], + ], + "Umbilical": [["id743"]], + }, + }, +} + +foundations_data_dict = { + "Depth": { + 0: -129.64764390798447, + 1: -131.06535602160358, + 2: -122.02807331534915, + 3: -114.17057764339403, + 4: -123.39040119401608, + 5: -116.04659899761107, + 6: -129.18197837246262, + 7: -121.65903920188651, + 8: -112.8361895661229, + }, + "Dry Mass": { + 0: 157.55159536731895, + 1: 157.55159536731895, + 2: 6391.8893307176222, + 3: 861.87962454769695, + 4: 157.55159536731895, + 5: 157.55159536731895, + 6: 6391.8893307176222, + 7: 861.87962454769695, + 8: 90193.46400008176, + }, + "Grout Type": { + 0: "grout", + 1: "grout", + 2: "grout", + 3: "grout", + 4: "grout", + 5: "grout", + 6: "grout", + 7: "grout", + 8: "grout", + }, + "Grout Volume": { + 0: 0.016196675543330975, + 1: 0.016196675543330975, + 2: 0.477247220095879, + 3: 0.088603257895683671, + 4: 0.016196675543330975, + 5: 0.016196675543330975, + 6: 0.477247220095879, + 7: 0.088603257895683671, + 8: 7.9546039748529802, + }, + "Height": { + 0: 0.91400000000000003, + 1: 0.91400000000000003, + 2: 18.0, + 3: 5.0, + 4: 0.91400000000000003, + 5: 0.91400000000000003, + 6: 18.0, + 7: 5.0, + 8: 15.0, + }, + "Installation Depth": { + 0: 0.91400000000000003, + 1: 0.91400000000000003, + 2: 18.0, + 3: 5.0, + 4: 0.91400000000000003, + 5: 0.91400000000000003, + 6: 18.0, + 7: 5.0, + 8: 15.0, + }, + "Length": { + 0: 0.45700000000000002, + 1: 0.45700000000000002, + 2: 0.55900000000000005, + 3: 0.45700000000000002, + 4: 0.45700000000000002, + 5: 0.45700000000000002, + 6: 0.55900000000000005, + 7: 0.45700000000000002, + 8: 2.5, + }, + "Marker": {0: 33, 1: 35, 2: 37, 3: 39, 4: 74, 5: 76, 6: 78, 7: 80, 8: 82}, + "Sub-Type": { + 0: "pipe pile", + 1: "pipe pile", + 2: "pipe pile", + 3: "pipe pile", + 4: "pipe pile", + 5: "pipe pile", + 6: "pipe pile", + 7: "pipe pile", + 8: "pipe pile", + }, + "Type": { + 0: "pile", + 1: "pile", + 2: "pile", + 3: "pile", + 4: "pile", + 5: "pile", + 6: "pile", + 7: "pile", + 8: "pile", + }, + "UTM X": { + 0: 587490.0, + 1: 587600.0, + 2: 587600.0, + 3: 587490.0, + 4: 587700.0, + 5: 587900.0, + 6: 587900.0, + 7: 587700.0, + 8: 587490.0, + }, + "UTM Y": { + 0: 6650600.0, + 1: 6650600.0, + 2: 6650500.0, + 3: 6650500.0, + 4: 6650800.0, + 5: 6650800.0, + 6: 6650600.0, + 7: 6650600.0, + 8: 6651060.0, + }, + "Width": { + 0: 0.45700000000000002, + 1: 0.45700000000000002, + 2: 0.55900000000000005, + 3: 0.45700000000000002, + 4: 0.45700000000000002, + 5: 0.45700000000000002, + 6: 0.55900000000000005, + 7: 0.45700000000000002, + 8: 2.5, + }, +} + foundations_data_df = pd.DataFrame(foundations_data_dict) -foundations_layers_dict = { 'Depth': {0: np.inf, - 1: np.inf, - 2: np.inf, - 3: np.inf, - 4: np.inf, - 5: np.inf, - 6: np.inf, - 7: np.inf, - 8: np.inf}, - 'Layer Number': {0: 0, - 1: 0, - 2: 0, - 3: 0, - 4: 0, - 5: 0, - 6: 0, - 7: 0, - 8: 0}, - 'Marker': {0: 33, - 1: 35, - 2: 37, - 3: 39, - 4: 74, - 5: 76, - 6: 78, - 7: 80, - 8: 82}, - 'Soil Type': {0: 'soft rock coral', - 1: 'soft rock coral', - 2: 'soft rock coral', - 3: 'soft rock coral', - 4: 'soft rock coral', - 5: 'soft rock coral', - 6: 'soft rock coral', - 7: 'soft rock coral', - 8: 'soft rock coral'}} +foundations_layers_dict = { + "Depth": { + 0: np.inf, + 1: np.inf, + 2: np.inf, + 3: np.inf, + 4: np.inf, + 5: np.inf, + 6: np.inf, + 7: np.inf, + 8: np.inf, + }, + "Layer Number": {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0}, + "Marker": {0: 33, 1: 35, 2: 37, 3: 39, 4: 74, 5: 76, 6: 78, 7: 80, 8: 82}, + "Soil Type": { + 0: "soft rock coral", + 1: "soft rock coral", + 2: "soft rock coral", + 3: "soft rock coral", + 4: "soft rock coral", + 5: "soft rock coral", + 6: "soft rock coral", + 7: "soft rock coral", + 8: "soft rock coral", + }, +} foundations_layers_df = pd.DataFrame(foundations_layers_dict) -moorings_data_dict= {'Line Identifier': {0: 'line000', - 1: 'line000', - 2: 'line000', - 3: 'line000', - 4: 'line000', - 5: 'line000', - 6: 'line000', - 7: 'line000', - 8: 'line000', - 9: 'line000', - 10: 'line000', - 11: 'line000', - 12: 'line000', - 13: 'line000', - 14: 'line000', - 15: 'line000', - 16: 'line000', - 17: 'line000', - 18: 'line000', - 19: 'line000', - 20: 'line000', - 21: 'line000', - 22: 'line000', - 23: 'line000', - 24: 'line000', - 25: 'line000', - 26: 'line000', - 27: 'line000', - 28: 'line000', - 29: 'line000', - 30: 'line000', - 31: 'line000', - 32: 'line001', - 33: 'line001', - 34: 'line001', - 35: 'line001', - 36: 'line001', - 37: 'line001', - 38: 'line001', - 39: 'line001', - 40: 'line001', - 41: 'line001', - 42: 'line001', - 43: 'line001', - 44: 'line001', - 45: 'line001', - 46: 'line001', - 47: 'line001', - 48: 'line001', - 49: 'line001', - 50: 'line001', - 51: 'line001', - 52: 'line001', - 53: 'line001', - 54: 'line001', - 55: 'line001', - 56: 'line001', - 57: 'line001', - 58: 'line001', - 59: 'line001', - 60: 'line001', - 61: 'line001', - 62: 'line001', - 63: 'line001'}, - 'Marker': {0: 0, - 1: 1, - 2: 2, - 3: 3, - 4: 4, - 5: 5, - 6: 6, - 7: 7, - 8: 8, - 9: 9, - 10: 10, - 11: 11, - 12: 12, - 13: 13, - 14: 14, - 15: 15, - 16: 16, - 17: 17, - 18: 18, - 19: 19, - 20: 20, - 21: 21, - 22: 22, - 23: 23, - 24: 24, - 25: 25, - 26: 26, - 27: 27, - 28: 28, - 29: 29, - 30: 30, - 31: 31, - 32: 41, - 33: 42, - 34: 43, - 35: 44, - 36: 45, - 37: 46, - 38: 47, - 39: 48, - 40: 49, - 41: 50, - 42: 51, - 43: 52, - 44: 53, - 45: 54, - 46: 55, - 47: 56, - 48: 57, - 49: 58, - 50: 59, - 51: 60, - 52: 61, - 53: 62, - 54: 63, - 55: 64, - 56: 65, - 57: 66, - 58: 67, - 59: 68, - 60: 69, - 61: 70, - 62: 71, - 63: 72}} +moorings_data_dict = { + "Line Identifier": { + 0: "line000", + 1: "line000", + 2: "line000", + 3: "line000", + 4: "line000", + 5: "line000", + 6: "line000", + 7: "line000", + 8: "line000", + 9: "line000", + 10: "line000", + 11: "line000", + 12: "line000", + 13: "line000", + 14: "line000", + 15: "line000", + 16: "line000", + 17: "line000", + 18: "line000", + 19: "line000", + 20: "line000", + 21: "line000", + 22: "line000", + 23: "line000", + 24: "line000", + 25: "line000", + 26: "line000", + 27: "line000", + 28: "line000", + 29: "line000", + 30: "line000", + 31: "line000", + 32: "line001", + 33: "line001", + 34: "line001", + 35: "line001", + 36: "line001", + 37: "line001", + 38: "line001", + 39: "line001", + 40: "line001", + 41: "line001", + 42: "line001", + 43: "line001", + 44: "line001", + 45: "line001", + 46: "line001", + 47: "line001", + 48: "line001", + 49: "line001", + 50: "line001", + 51: "line001", + 52: "line001", + 53: "line001", + 54: "line001", + 55: "line001", + 56: "line001", + 57: "line001", + 58: "line001", + 59: "line001", + 60: "line001", + 61: "line001", + 62: "line001", + 63: "line001", + }, + "Marker": { + 0: 0, + 1: 1, + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, + 10: 10, + 11: 11, + 12: 12, + 13: 13, + 14: 14, + 15: 15, + 16: 16, + 17: 17, + 18: 18, + 19: 19, + 20: 20, + 21: 21, + 22: 22, + 23: 23, + 24: 24, + 25: 25, + 26: 26, + 27: 27, + 28: 28, + 29: 29, + 30: 30, + 31: 31, + 32: 41, + 33: 42, + 34: 43, + 35: 44, + 36: 45, + 37: 46, + 38: 47, + 39: 48, + 40: 49, + 41: 50, + 42: 51, + 43: 52, + 44: 53, + 45: 54, + 46: 55, + 47: 56, + 48: 57, + 49: 58, + 50: 59, + 51: 60, + 52: 61, + 53: 62, + 54: 63, + 55: 64, + 56: 65, + 57: 66, + 58: 67, + 59: 68, + 60: 69, + 61: 70, + 62: 71, + 63: 72, + }, +} moorings_data_df = pd.DataFrame(moorings_data_dict) -line_data_dict= {'Dry Mass': {0: 1430.591229948034, - 1: 1415.9397801046453, - 2: 1512.30941757388, - 3: 1602.3805965050158, - 4: 1486.827523054319, - 5: 1569.8098504574803, - 6: 1424.9535521548576, - 7: 1505.9152289116521}, - 'Length': {0: 219.17430632967253, - 1: 220.46777728340797, - 2: 212.34089037366172, - 3: 205.51854572965507, - 4: 213.54752655309315, - 5: 207.12551577682427, - 6: 218.75091293642907, - 7: 212.01520310580992}, - 'Line Identifier': {0: 'line000', - 1: 'line000', - 2: 'line000', - 3: 'line000', - 4: 'line001', - 5: 'line001', - 6: 'line001', - 7: 'line001'}, - 'Type': {0: 'catenary', - 1: 'catenary', - 2: 'catenary', - 3: 'catenary', - 4: 'catenary', - 5: 'catenary', - 6: 'catenary', - 7: 'catenary'}} +line_data_dict = { + "Dry Mass": { + 0: 1430.591229948034, + 1: 1415.9397801046453, + 2: 1512.30941757388, + 3: 1602.3805965050158, + 4: 1486.827523054319, + 5: 1569.8098504574803, + 6: 1424.9535521548576, + 7: 1505.9152289116521, + }, + "Length": { + 0: 219.17430632967253, + 1: 220.46777728340797, + 2: 212.34089037366172, + 3: 205.51854572965507, + 4: 213.54752655309315, + 5: 207.12551577682427, + 6: 218.75091293642907, + 7: 212.01520310580992, + }, + "Line Identifier": { + 0: "line000", + 1: "line000", + 2: "line000", + 3: "line000", + 4: "line001", + 5: "line001", + 6: "line001", + 7: "line001", + }, + "Type": { + 0: "catenary", + 1: "catenary", + 2: "catenary", + 3: "catenary", + 4: "catenary", + 5: "catenary", + 6: "catenary", + 7: "catenary", + }, +} line_data_df = pd.DataFrame(line_data_dict) -lines_id = ['line' + str(n).zfill(3) for n in range(len(line_data_df))] +lines_id = ["line" + str(n).zfill(3) for n in range(len(line_data_df))] -line_data_df['Line Identifier'] = \ - pd.Series(lines_id, index = line_data_df.index) +line_data_df["Line Identifier"] = pd.Series(lines_id, index=line_data_df.index) line_markers = np.repeat(lines_id, 8) -moorings_data_df['Line Identifier'] = \ - pd.Series(line_markers, index = moorings_data_df.index) +moorings_data_df["Line Identifier"] = pd.Series( + line_markers, index=moorings_data_df.index +) ## reset index as must be sequential foundations_data_df.reset_index(drop=True, inplace=True) # collect together -test_data = {"component.rov" : equipment_rov, - "component.divers" : equipment_divers, - "component.cable_burial" : equipment_cable_burial, - "component.excavating" : equipment_excavating, - "component.mattress_installation" : equipment_mattress, - "component.rock_bags_installation" : equipment_rock_filter_bags, - "component.split_pipes_installation" : equipment_split_pipe, - "component.hammer" : equipment_hammer, - "component.drilling_rigs" : equipment_drilling_rigs, - "component.vibro_driver" : equipment_vibro_driver, - "component.vehicle_helicopter": helicopter_df, - "component.vehicle_vessel_ahts": ahts_df, - "component.vehicle_vessel_multicat": multicat_df, - "component.vehicle_vessel_crane_barge": crane_barge_df, - "component.vehicle_vessel_barge": barge_df, - "component.vehicle_vessel_crane_vessel": crane_vessel_df, - "component.vehicle_vessel_csv": csv_df, - "component.vehicle_vessel_ctv": ctv_df, - "component.vehicle_vessel_clb": clb_df, - "component.vehicle_vessel_clv": clv_df, - "component.vehicle_vessel_jackup_barge": jackup_barge_df, - "component.vehicle_vessel_jackup_vessel": jackup_vssel_df, - "component.vehicle_vessel_tugboat": tugboat_df, - "component.ports" : ports, - "component.port_locations": port_locations, - - "project.electrical_network" : electrical_network, - "project.electrical_component_data" : electrical_components, - "project.cable_routes" : cable_routes, - "project.substation_props" : substations, - "project.umbilical_cable_data" : umbilicals, - "project.umbilical_seabed_connection" : umbilical_terminations, - - "project.moorings_foundations_network" : mf_network, - "project.foundations_component_data" : foundations_data_df, - "project.foundations_soil_data" : foundations_layers_df, - "project.moorings_component_data" : moorings_data_df, - "project.moorings_line_data" : line_data_df, - - "component.equipment_penetration_rates" : - equipment_penetration_rates, - "component.installation_soil_compatibility" : - installation_soil_compatibility, - "project.surface_laying_rate" : surface_laying_rate, - "project.split_pipe_laying_rate" : split_pipe_laying_rate, - "project.loading_rate" : loading_rate, - "project.grout_rate" : grout_rate, - "project.fuel_cost_rate" : fuel_cost_rate, - - "project.port_percentage_cost" : port_percentage_cost, - "project.commissioning_time" : comissioning_time, - "project.cost_contingency" : cost_contingency, - - "project.port_safety_factors" : port_sf, - "project.vessel_safety_factors" : vessel_sf, - "project.rov_safety_factors": rov_sf, - "project.divers_safety_factors": divers_sf, - "project.hammer_safety_factors": hammer_sf, - "project.vibro_driver_safety_factors": vibro_driver_sf, - "project.cable_burial_safety_factors": cable_burial_sf, - "project.split_pipe_safety_factors": split_pipe_sf, - "project.lease_area_entry_point" : entry_point_shapely, - "project.layout" : layout_dict, - - "device.system_type" : system_type, - "device.system_length" : system_length, - "device.system_width" : system_width, - "device.system_height" : system_height, - "device.system_mass": system_mass, - "device.assembly_duration" : assembly_duration, - "device.load_out_method" : load_out_method, - "device.transportation_method" : transportation_method, - "device.bollard_pull" : bollard_pull, - "device.connect_duration" : connect_duration, - "device.disconnect_duration" : disconnect_duration, - "project.start_date" : project_start_date, - - "device.subsystem_installation" : sub_device, - - "farm.wave_series_installation" : wave_series, - "farm.tidal_series_installation" : tidal_series, - "farm.wind_series_installation" : wind_series, - - "bathymetry.layers" : strata, - "corridor.layers" : export_strata, - - "project.landfall_contruction_technique" : landfall, - - "site.projection" : lease_utm_zone, - - "component.dry_mate_connectors" : dry_mate, - "component.dynamic_cable" : dynamic_cables, - "component.static_cable" : static_cables, - "component.wet_mate_connectors" : wet_mate, - "component.collection_points" : collection_point, - "component.transformers" : transformer, - - "component.operations_limit_hs": hs_olc_dict, - "component.operations_limit_tp": tp_olc_dict, - "component.operations_limit_ws": ws_olc_dict, - "component.operations_limit_cs": cs_olc_dict, - - "project.selected_installation_tool": tool, - "options.skip_phase": True - - } +test_data = { + "component.rov": equipment_rov, + "component.divers": equipment_divers, + "component.cable_burial": equipment_cable_burial, + "component.excavating": equipment_excavating, + "component.mattress_installation": equipment_mattress, + "component.rock_bags_installation": equipment_rock_filter_bags, + "component.split_pipes_installation": equipment_split_pipe, + "component.hammer": equipment_hammer, + "component.drilling_rigs": equipment_drilling_rigs, + "component.vibro_driver": equipment_vibro_driver, + "component.vehicle_helicopter": helicopter_df, + "component.vehicle_vessel_ahts": ahts_df, + "component.vehicle_vessel_multicat": multicat_df, + "component.vehicle_vessel_crane_barge": crane_barge_df, + "component.vehicle_vessel_barge": barge_df, + "component.vehicle_vessel_crane_vessel": crane_vessel_df, + "component.vehicle_vessel_csv": csv_df, + "component.vehicle_vessel_ctv": ctv_df, + "component.vehicle_vessel_clb": clb_df, + "component.vehicle_vessel_clv": clv_df, + "component.vehicle_vessel_jackup_barge": jackup_barge_df, + "component.vehicle_vessel_jackup_vessel": jackup_vssel_df, + "component.vehicle_vessel_tugboat": tugboat_df, + "component.ports": ports, + "component.port_locations": port_locations, + "project.electrical_network": electrical_network, + "project.electrical_component_data": electrical_components, + "project.cable_routes": cable_routes, + "project.substation_props": substations, + "project.umbilical_cable_data": umbilicals, + "project.umbilical_seabed_connection": umbilical_terminations, + "project.moorings_foundations_network": mf_network, + "project.foundations_component_data": foundations_data_df, + "project.foundations_soil_data": foundations_layers_df, + "project.moorings_component_data": moorings_data_df, + "project.moorings_line_data": line_data_df, + "component.equipment_penetration_rates": equipment_penetration_rates, + "component.installation_soil_compatibility": installation_soil_compatibility, + "project.surface_laying_rate": surface_laying_rate, + "project.split_pipe_laying_rate": split_pipe_laying_rate, + "project.loading_rate": loading_rate, + "project.grout_rate": grout_rate, + "project.fuel_cost_rate": fuel_cost_rate, + "project.port_percentage_cost": port_percentage_cost, + "project.commissioning_time": comissioning_time, + "project.cost_contingency": cost_contingency, + "project.port_safety_factors": port_sf, + "project.vessel_safety_factors": vessel_sf, + "project.rov_safety_factors": rov_sf, + "project.divers_safety_factors": divers_sf, + "project.hammer_safety_factors": hammer_sf, + "project.vibro_driver_safety_factors": vibro_driver_sf, + "project.cable_burial_safety_factors": cable_burial_sf, + "project.split_pipe_safety_factors": split_pipe_sf, + "project.lease_area_entry_point": entry_point_shapely, + "project.layout": layout_dict, + "device.system_type": system_type, + "device.system_length": system_length, + "device.system_width": system_width, + "device.system_height": system_height, + "device.system_mass": system_mass, + "device.assembly_duration": assembly_duration, + "device.load_out_method": load_out_method, + "device.transportation_method": transportation_method, + "device.bollard_pull": bollard_pull, + "device.connect_duration": connect_duration, + "device.disconnect_duration": disconnect_duration, + "project.start_date": project_start_date, + "device.subsystem_installation": sub_device, + "farm.wave_series_installation": wave_series, + "farm.tidal_series_installation": tidal_series, + "farm.wind_series_installation": wind_series, + "bathymetry.layers": strata, + "corridor.layers": export_strata, + "project.landfall_contruction_technique": landfall, + "site.projection": lease_utm_zone, + "component.dry_mate_connectors": dry_mate, + "component.dynamic_cable": dynamic_cables, + "component.static_cable": static_cables, + "component.wet_mate_connectors": wet_mate, + "component.collection_points": collection_point, + "component.transformers": transformer, + "component.operations_limit_hs": hs_olc_dict, + "component.operations_limit_tp": tp_olc_dict, + "component.operations_limit_ws": ws_olc_dict, + "component.operations_limit_cs": cs_olc_dict, + "project.selected_installation_tool": tool, + "options.skip_phase": True, +} if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/test_data/inputs_wp6.py b/packages/dtocean-core/test_data/inputs_wp6.py index 0ad9127..b9b0b2a 100644 --- a/packages/dtocean-core/test_data/inputs_wp6.py +++ b/packages/dtocean-core/test_data/inputs_wp6.py @@ -5,98 +5,100 @@ @author: 108630 """ -import os import datetime as dt -from collections import Counter +import os import numpy as np import pandas as pd - -from dtocean_core.utils.reliability import (get_reliability_tables, - compdict_from_mock) - from inputs_wp4 import comp_tables -from inputs_wp5 import (equipment_cable_burial, - cable_burial_sf, - collection_point, - equipment_divers, - divers_sf, - equipment_drilling_rigs, - dry_mate, - dynamic_cables, - equipment_penetration_rates, - equipment_excavating, - fuel_cost_rate, - grout_rate, - equipment_hammer, - hammer_sf, - installation_soil_compatibility, - loading_rate, - equipment_mattress, - port_locations, - port_sf, - ports, - equipment_rock_filter_bags, - equipment_rov, - rov_sf, - split_pipe_laying_rate, - split_pipe_sf, - equipment_split_pipe, - static_cables, - surface_laying_rate, - transformer, - vessel_sf, - helicopter_df, - ahts_df, - multicat_df, - crane_barge_df, - barge_df, - crane_vessel_df, - csv_df, - ctv_df, - clb_df, - clv_df, - jackup_barge_df, - jackup_vssel_df, - tugboat_df, - equipment_vibro_driver, - vibro_driver_sf, - wet_mate, - landfall, - export_strata, - assembly_duration, - bollard_pull, - connect_duration, - disconnect_duration, - load_out_method, - sub_device, - system_height, - system_length, - system_mass, - system_width, - transportation_method, - cable_routes, - electrical_components, - entry_point_shapely, - foundations_data_df, - foundations_layers_df, - line_data_df, - moorings_data_df, - tool, - substations, - tidal_series, - umbilicals, - umbilical_terminations, - wave_series, - wind_series, - comissioning_time, - cost_contingency, - port_percentage_cost, - project_start_date, - lease_utm_zone, - electrical_network, - mf_network, - strata) +from inputs_wp5 import ( + ahts_df, + assembly_duration, + barge_df, + bollard_pull, + cable_burial_sf, + cable_routes, + clb_df, + clv_df, + collection_point, + comissioning_time, + connect_duration, + cost_contingency, + crane_barge_df, + crane_vessel_df, + csv_df, + ctv_df, + disconnect_duration, + divers_sf, + dry_mate, + dynamic_cables, + electrical_components, + electrical_network, + entry_point_shapely, + equipment_cable_burial, + equipment_divers, + equipment_drilling_rigs, + equipment_excavating, + equipment_hammer, + equipment_mattress, + equipment_penetration_rates, + equipment_rock_filter_bags, + equipment_rov, + equipment_split_pipe, + equipment_vibro_driver, + export_strata, + foundations_data_df, + foundations_layers_df, + fuel_cost_rate, + grout_rate, + hammer_sf, + helicopter_df, + installation_soil_compatibility, + jackup_barge_df, + jackup_vssel_df, + landfall, + lease_utm_zone, + line_data_df, + load_out_method, + loading_rate, + mf_network, + moorings_data_df, + multicat_df, + port_locations, + port_percentage_cost, + port_sf, + ports, + project_start_date, + rov_sf, + split_pipe_laying_rate, + split_pipe_sf, + static_cables, + strata, + sub_device, + substations, + surface_laying_rate, + system_height, + system_length, + system_mass, + system_width, + tidal_series, + tool, + transformer, + transportation_method, + tugboat_df, + umbilical_terminations, + umbilicals, + vessel_sf, + vibro_driver_sf, + wave_series, + wet_mate, + wind_series, +) + +from dtocean_core.utils.reliability import ( + compdict_from_mock, + get_reliability_tables, +) this_dir = os.path.dirname(os.path.realpath(__file__)) elec_dir = os.path.join(this_dir, "electrical") @@ -105,25 +107,31 @@ ### ARRAY LAYOUT -array_layout = {'device001': [587850.,6650550.], - 'device002': [587850.,6650700.]} +array_layout = { + "device001": [587850.0, 6650550.0], + "device002": [587850.0, 6650700.0], +} ### MACHINE -device_failure_rates = {'Prime Mover': 0.5, - 'PTO': 0.25, - 'Support Structure': 0.05} +device_failure_rates = { + "Prime Mover": 0.5, + "PTO": 0.25, + "Support Structure": 0.05, +} -control_failure_rates = {'Control': 0.1} +control_failure_rates = {"Control": 0.1} book_path = os.path.join(op_dir, "device_access.xlsx") device_access = pd.read_excel(book_path, sheet_name="Access") book_path = os.path.join(op_dir, "device_requirements.xlsx") device_onsite_requirements = pd.read_excel(book_path, sheet_name="On-Site") -device_replacement_requirements = pd.read_excel(book_path, - sheet_name="Replacement") -device_inspections_requirements = pd.read_excel(book_path, - sheet_name="Inspections") +device_replacement_requirements = pd.read_excel( + book_path, sheet_name="Replacement" +) +device_inspections_requirements = pd.read_excel( + book_path, sheet_name="Inspections" +) book_path = os.path.join(op_dir, "device_parts.xlsx") device_onsite_parts = pd.read_excel(book_path, sheet_name="On-Site") @@ -133,390 +141,432 @@ book_path = os.path.join(op_dir, "control_requirements.xlsx") control_onsite_requirements = pd.read_excel(book_path, sheet_name="On-Site") -control_replacement_requirements = pd.read_excel(book_path, - sheet_name="Replacement") -control_inspections_requirements = pd.read_excel(book_path, - sheet_name="Inspections") +control_replacement_requirements = pd.read_excel( + book_path, sheet_name="Replacement" +) +control_inspections_requirements = pd.read_excel( + book_path, sheet_name="Inspections" +) book_path = os.path.join(op_dir, "control_parts.xlsx") control_onsite_parts = pd.read_excel(book_path, sheet_name="On-Site") -device_lead_times = {'Prime Mover': 120., - 'PTO': 96., - 'Control': 48., - 'Support Structure': 48.} - -device_costs = {'Prime Mover': 200000., - 'PTO': 150000., - 'Support Structure': 30000.} - -control_costs = {'Control': 10000.} - -device_weightings_dict = {'Sub-System': ['Prime Mover', - 'PTO', - 'Support Structure'], - 'On-Site Maintenance': [4, 4, 4], - 'Replacement': [4, 4, 4], - 'Inspections': [2, 2, 2]} - +device_lead_times = { + "Prime Mover": 120.0, + "PTO": 96.0, + "Control": 48.0, + "Support Structure": 48.0, +} + +device_costs = { + "Prime Mover": 200000.0, + "PTO": 150000.0, + "Support Structure": 30000.0, +} + +control_costs = {"Control": 10000.0} + +device_weightings_dict = { + "Sub-System": ["Prime Mover", "PTO", "Support Structure"], + "On-Site Maintenance": [4, 4, 4], + "Replacement": [4, 4, 4], + "Inspections": [2, 2, 2], +} + device_weightings = pd.DataFrame(device_weightings_dict) -control_weightings_dict = {'Sub-System': ['Control'], - 'On-Site Maintenance': [4], - 'Replacement': [4], - 'Inspections': [2]} - +control_weightings_dict = { + "Sub-System": ["Control"], + "On-Site Maintenance": [4], + "Replacement": [4], + "Inspections": [2], +} + control_weightings = pd.DataFrame(control_weightings_dict) - + ### ELECTRICAL NETWORK network_configuration = "Radial" -elec_bom = {'Cost': {0: 800.0, - 1: 700.0, - 2: 150000.0, - 3: 200000.0, - 4: 800.0, - 5: 1000000.0}, - 'Key Identifier': {0: 17, - 1: 2, - 2: 12, - 3: 6, - 4: u'id742', - 5: None}, - 'Quantity': {0: 1240.0, - 1: 1330.0, - 2: 1.0, - 3: 9.0, - 4: 443.16388122792671, - 5: 1.0}, - 'Year': {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0}} - +elec_bom = { + "Cost": { + 0: 800.0, + 1: 700.0, + 2: 150000.0, + 3: 200000.0, + 4: 800.0, + 5: 1000000.0, + }, + "Key Identifier": {0: 17, 1: 2, 2: 12, 3: 6, 4: "id742", 5: None}, + "Quantity": { + 0: 1240.0, + 1: 1330.0, + 2: 1.0, + 3: 9.0, + 4: 443.16388122792671, + 5: 1.0, + }, + "Year": {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0}, +} + book_path = os.path.join(op_dir, "electrical_requirements.xlsx") electrical_onsite_requirements = pd.read_excel(book_path, sheet_name="On-Site") -electrical_inspections_requirements = pd.read_excel(book_path, - sheet_name="Inspections") +electrical_inspections_requirements = pd.read_excel( + book_path, sheet_name="Inspections" +) book_path = os.path.join(op_dir, "electrical_parts.xlsx") electrical_onsite_parts = pd.read_excel(book_path, sheet_name="On-Site") -electrical_lead_times = {'Inter-Array Cables': 48., - 'Substations': 120., - 'Export Cable': 240.} - -substation_layout = {"array": [587850., 6651000]} +electrical_lead_times = { + "Inter-Array Cables": 48.0, + "Substations": 120.0, + "Export Cable": 240.0, +} + +substation_layout = {"array": [587850.0, 6651000]} ### MOORINGS AND FOUNDATIONS -moor_bom = {'Cost': {0: 46595.722315912215, - 1: 1389.3599999999999, - 2: 67.5, - 3: 1015.1542266412166, - 4: 67.5, - 5: 2641.0434122155366, - 6: 67.5, - 7: 746.27999999999997, - 8: 67.5, - 9: 1389.3599999999999, - 10: 67.5, - 11: 984.6647815996198, - 12: 67.5, - 13: 2658.3589043289548, - 14: 67.5, - 15: 746.27999999999997, - 16: 67.5, - 17: 1389.3599999999999, - 18: 67.5, - 19: 1183.2695849394572, - 20: 67.5, - 21: 2548.2325014520047, - 22: 67.5, - 23: 746.27999999999997, - 24: 67.5, - 25: 1389.3599999999999, - 26: 67.5, - 27: 1364.9571491938545, - 28: 67.5, - 29: 2452.9502245316494, - 30: 67.5, - 31: 746.27999999999997, - 32: 67.5, - 33: 629.4563710162322, - 34: 629.4563710162322, - 35: 21573.884218325431, - 36: 3443.415596368885, - 37: 376287.75594767794, - 38: 26196.859407966593, - 39: 26196.859407966593}, - 'Key Identifier': {0: 'id743', - 1: 'id472', - 2: 'id316', - 3: 'id69', - 4: 'id316', - 5: 'id422', - 6: 'id316', - 7: 'id339', - 8: 'id316', - 9: 'id472', - 10: 'id316', - 11: 'id69', - 12: 'id316', - 13: 'id422', - 14: 'id316', - 15: 'id339', - 16: 'id316', - 17: 'id472', - 18: 'id316', - 19: 'id69', - 20: 'id316', - 21: 'id422', - 22: 'id316', - 23: 'id339', - 24: 'id316', - 25: 'id472', - 26: 'id316', - 27: 'id69', - 28: 'id316', - 29: 'id422', - 30: 'id316', - 31: 'id339', - 32: 'id316', - 33: 'id516', - 34: 'id516', - 35: 'id528', - 36: 'id516', - 37: 'id718', - 38: 'id528', - 39: 'id528'}, - 'Quantity': {0: 1.0, - 1: 1.0, - 2: 1.0, - 3: 1.0, - 4: 1.0, - 5: 1.0, - 6: 1.0, - 7: 1.0, - 8: 1.0, - 9: 1.0, - 10: 1.0, - 11: 1.0, - 12: 1.0, - 13: 1.0, - 14: 1.0, - 15: 1.0, - 16: 1.0, - 17: 1.0, - 18: 1.0, - 19: 1.0, - 20: 1.0, - 21: 1.0, - 22: 1.0, - 23: 1.0, - 24: 1.0, - 25: 1.0, - 26: 1.0, - 27: 1.0, - 28: 1.0, - 29: 1.0, - 30: 1.0, - 31: 1.0, - 32: 1.0, - 33: 1.0, - 34: 1.0, - 35: 1.0, - 36: 1.0, - 37: 1.0, - 38: 1.0, - 39: 1.0}, - 'Year': {0: 0.0, - 1: 0.0, - 2: 0.0, - 3: 0.0, - 4: 0.0, - 5: 0.0, - 6: 0.0, - 7: 0.0, - 8: 0.0, - 9: 0.0, - 10: 0.0, - 11: 0.0, - 12: 0.0, - 13: 0.0, - 14: 0.0, - 15: 0.0, - 16: 0.0, - 17: 0.0, - 18: 0.0, - 19: 0.0, - 20: 0.0, - 21: 0.0, - 22: 0.0, - 23: 0.0, - 24: 0.0, - 25: 0.0, - 26: 0.0, - 27: 0.0, - 28: 0.0, - 29: 0.0, - 30: 0.0, - 31: 0.0, - 32: 0.0, - 33: 0.0, - 34: 0.0, - 35: 0.0, - 36: 0.0, - 37: 0.0, - 38: 0.0, - 39: 0.0}} - +moor_bom = { + "Cost": { + 0: 46595.722315912215, + 1: 1389.3599999999999, + 2: 67.5, + 3: 1015.1542266412166, + 4: 67.5, + 5: 2641.0434122155366, + 6: 67.5, + 7: 746.27999999999997, + 8: 67.5, + 9: 1389.3599999999999, + 10: 67.5, + 11: 984.6647815996198, + 12: 67.5, + 13: 2658.3589043289548, + 14: 67.5, + 15: 746.27999999999997, + 16: 67.5, + 17: 1389.3599999999999, + 18: 67.5, + 19: 1183.2695849394572, + 20: 67.5, + 21: 2548.2325014520047, + 22: 67.5, + 23: 746.27999999999997, + 24: 67.5, + 25: 1389.3599999999999, + 26: 67.5, + 27: 1364.9571491938545, + 28: 67.5, + 29: 2452.9502245316494, + 30: 67.5, + 31: 746.27999999999997, + 32: 67.5, + 33: 629.4563710162322, + 34: 629.4563710162322, + 35: 21573.884218325431, + 36: 3443.415596368885, + 37: 376287.75594767794, + 38: 26196.859407966593, + 39: 26196.859407966593, + }, + "Key Identifier": { + 0: "id743", + 1: "id472", + 2: "id316", + 3: "id69", + 4: "id316", + 5: "id422", + 6: "id316", + 7: "id339", + 8: "id316", + 9: "id472", + 10: "id316", + 11: "id69", + 12: "id316", + 13: "id422", + 14: "id316", + 15: "id339", + 16: "id316", + 17: "id472", + 18: "id316", + 19: "id69", + 20: "id316", + 21: "id422", + 22: "id316", + 23: "id339", + 24: "id316", + 25: "id472", + 26: "id316", + 27: "id69", + 28: "id316", + 29: "id422", + 30: "id316", + 31: "id339", + 32: "id316", + 33: "id516", + 34: "id516", + 35: "id528", + 36: "id516", + 37: "id718", + 38: "id528", + 39: "id528", + }, + "Quantity": { + 0: 1.0, + 1: 1.0, + 2: 1.0, + 3: 1.0, + 4: 1.0, + 5: 1.0, + 6: 1.0, + 7: 1.0, + 8: 1.0, + 9: 1.0, + 10: 1.0, + 11: 1.0, + 12: 1.0, + 13: 1.0, + 14: 1.0, + 15: 1.0, + 16: 1.0, + 17: 1.0, + 18: 1.0, + 19: 1.0, + 20: 1.0, + 21: 1.0, + 22: 1.0, + 23: 1.0, + 24: 1.0, + 25: 1.0, + 26: 1.0, + 27: 1.0, + 28: 1.0, + 29: 1.0, + 30: 1.0, + 31: 1.0, + 32: 1.0, + 33: 1.0, + 34: 1.0, + 35: 1.0, + 36: 1.0, + 37: 1.0, + 38: 1.0, + 39: 1.0, + }, + "Year": { + 0: 0.0, + 1: 0.0, + 2: 0.0, + 3: 0.0, + 4: 0.0, + 5: 0.0, + 6: 0.0, + 7: 0.0, + 8: 0.0, + 9: 0.0, + 10: 0.0, + 11: 0.0, + 12: 0.0, + 13: 0.0, + 14: 0.0, + 15: 0.0, + 16: 0.0, + 17: 0.0, + 18: 0.0, + 19: 0.0, + 20: 0.0, + 21: 0.0, + 22: 0.0, + 23: 0.0, + 24: 0.0, + 25: 0.0, + 26: 0.0, + 27: 0.0, + 28: 0.0, + 29: 0.0, + 30: 0.0, + 31: 0.0, + 32: 0.0, + 33: 0.0, + 34: 0.0, + 35: 0.0, + 36: 0.0, + 37: 0.0, + 38: 0.0, + 39: 0.0, + }, +} + book_path = os.path.join(op_dir, "moorings_requirements.xlsx") moorings_onsite_requirements = pd.read_excel(book_path, sheet_name="On-Site") -moorings_inspections_requirements = pd.read_excel(book_path, - sheet_name="Inspections") +moorings_inspections_requirements = pd.read_excel( + book_path, sheet_name="Inspections" +) book_path = os.path.join(op_dir, "moorings_parts.xlsx") moorings_onsite_parts = pd.read_excel(book_path, sheet_name="On-Site") -moorings_lead_times = {"Foundations": 48.} +moorings_lead_times = {"Foundations": 48.0} # MAINTENANCE TYPE SELECTIONS calendar_based_maintenance = True condition_based_maintenance = True - -calendar_maintenance_interval = {'Prime Mover': 5., - 'PTO': 1., - 'Control': 5., - 'Support Structure': 10., - 'Umbilical Cable': 10., - 'Inter-Array Cables': np.nan, - 'Substations': 10., - 'Export Cable': 10., - 'Foundations': 10., - 'Mooring Lines': 10.} - -condition_maintenance_soh = {'Prime Mover': 50., - 'PTO': 50., - 'Control': 50., - 'Support Structure': np.nan, - 'Umbilical Cable': 50., - 'Inter-Array Cables': np.nan, - 'Substations': 50., - 'Export Cable': 50., - 'Foundations': 50., - 'Mooring Lines': 50.} - -condition_maintenance_cost = {'Prime Mover': 30000., - 'PTO': 20000., - 'Control': 0., - 'Support Structure': 15000., - 'Umbilical Cable': np.nan, - 'Inter-Array Cables': 0., - 'Substations': 0., - 'Export Cable': 0., - 'Foundations': 15000., - 'Mooring Lines': np.nan} - + +calendar_maintenance_interval = { + "Prime Mover": 5.0, + "PTO": 1.0, + "Control": 5.0, + "Support Structure": 10.0, + "Umbilical Cable": 10.0, + "Inter-Array Cables": np.nan, + "Substations": 10.0, + "Export Cable": 10.0, + "Foundations": 10.0, + "Mooring Lines": 10.0, +} + +condition_maintenance_soh = { + "Prime Mover": 50.0, + "PTO": 50.0, + "Control": 50.0, + "Support Structure": np.nan, + "Umbilical Cable": 50.0, + "Inter-Array Cables": np.nan, + "Substations": 50.0, + "Export Cable": 50.0, + "Foundations": 50.0, + "Mooring Lines": 50.0, +} + +condition_maintenance_cost = { + "Prime Mover": 30000.0, + "PTO": 20000.0, + "Control": 0.0, + "Support Structure": 15000.0, + "Umbilical Cable": np.nan, + "Inter-Array Cables": 0.0, + "Substations": 0.0, + "Export Cable": 0.0, + "Foundations": 15000.0, + "Mooring Lines": np.nan, +} + ### OPERATION TYPE SELECTIONS - -operations_onsite_maintenance = {'Prime Mover': True, - 'PTO': True, - 'Control': True, - 'Support Structure': True, - 'Umbilical Cable': True, - 'Inter-Array Cables': True, - 'Substations': True, - 'Export Cable': True, - 'Foundations': True, - 'Mooring Lines': True} - -operations_replacements = {'Prime Mover': True, - 'PTO': True, - 'Control': True, - 'Support Structure': True, - 'Umbilical Cable': False, - 'Mooring Lines': False} - -operations_inspections = {'Prime Mover': True, - 'PTO': True, - 'Control': True, - 'Support Structure': True, - 'Umbilical Cable': True, - 'Inter-Array Cables': True, - 'Substations': True, - 'Export Cable': True, - 'Foundations': True, - 'Mooring Lines': True} - + +operations_onsite_maintenance = { + "Prime Mover": True, + "PTO": True, + "Control": True, + "Support Structure": True, + "Umbilical Cable": True, + "Inter-Array Cables": True, + "Substations": True, + "Export Cable": True, + "Foundations": True, + "Mooring Lines": True, +} + +operations_replacements = { + "Prime Mover": True, + "PTO": True, + "Control": True, + "Support Structure": True, + "Umbilical Cable": False, + "Mooring Lines": False, +} + +operations_inspections = { + "Prime Mover": True, + "PTO": True, + "Control": True, + "Support Structure": True, + "Umbilical Cable": True, + "Inter-Array Cables": True, + "Substations": True, + "Export Cable": True, + "Foundations": True, + "Mooring Lines": True, +} + ### OPERATION WEIGHTINGS -full_weightings = {'On-Site Maintenance': 4., - 'Replacement': 4., - 'Inspections': 2.} - -site_weightings = {'On-Site Maintenance': 4., - 'Inspections': 2.} - - +full_weightings = { + "On-Site Maintenance": 4.0, + "Replacement": 4.0, + "Inspections": 2.0, +} + +site_weightings = {"On-Site Maintenance": 4.0, "Inspections": 2.0} + + ### OPERATION COSTS transit_cost_multiplier = 0.03 loading_cost_multiplier = 0.01 - + ### PROJECT DATES commissioning_date = dt.datetime(1992, 1, 5) annual_maintenance_start = "April" annual_maintenance_end = "October" -lifetime = 7 # 'project.lifetime', +lifetime = 7 # 'project.lifetime', ### CREW SPECIFICATION helideck = False -wage_specialist_day = 200. -wage_specialist_night = 300. -wage_technician_day = 100. -wage_technician_night = 150. +wage_specialist_day = 200.0 +wage_specialist_night = 300.0 +wage_technician_day = 100.0 +wage_technician_night = 150.0 workdays_summer = 7 workdays_winter = 7 #### POWER -mean_power_per_device = {'device001': 1.2698047018309357, # 'project.mean_power_per_device' - 'device002': 1.2698047018309357} - -annual_energy_per_device = {'device001': 11123.489188038995, # 'project.annual_energy_per_device' - 'device002': 11123.489188038995} +mean_power_per_device = { + "device001": 1.2698047018309357, # 'project.mean_power_per_device' + "device002": 1.2698047018309357, +} + +annual_energy_per_device = { + "device001": 11123.489188038995, # 'project.annual_energy_per_device' + "device002": 11123.489188038995, +} + - #### COMPONENTS -collection_point_cog = {11: [0,0,0], - 12: [0,0,0], - 22: [0,0,0], - 23: [0,0,0], - 24: [0,0,0], - 25: [0,0,0] - } - -collection_point_found = {11: [[0,0,0],[0,0,0]], - 12: [[0,0,0]], - 22: [[0,0,0],[0,0,0]], - 23: [[0,0,0],[0,0,0]], - 24: [[0,0,0],[0,0,0]], - 25: [[0,0,0],[0,0,0]] - } +collection_point_cog = { + 11: [0, 0, 0], + 12: [0, 0, 0], + 22: [0, 0, 0], + 23: [0, 0, 0], + 24: [0, 0, 0], + 25: [0, 0, 0], +} + +collection_point_found = { + 11: [[0, 0, 0], [0, 0, 0]], + 12: [[0, 0, 0]], + 22: [[0, 0, 0], [0, 0, 0]], + 23: [[0, 0, 0], [0, 0, 0]], + 24: [[0, 0, 0], [0, 0, 0]], + 25: [[0, 0, 0], [0, 0, 0]], +} #### RELIABILITY DATA -compdict = eval(open(os.path.join(moor_dir, 'dummycompdb.txt')).read()) +compdict = eval(open(os.path.join(moor_dir, "dummycompdb.txt")).read()) -component_data_path = os.path.join(elec_dir, 'mock_db.xlsx') -xls_file = pd.ExcelFile(component_data_path, encoding = 'utf-8') +component_data_path = os.path.join(elec_dir, "mock_db.xlsx") +xls_file = pd.ExcelFile(component_data_path) elec_dict = compdict_from_mock(xls_file) compdict.update(elec_dict) @@ -527,249 +577,198 @@ ### LOAD VARIABLES test_data = { - "project.calendar_based_maintenance": calendar_based_maintenance, - "project.condition_based_maintenance": condition_based_maintenance, - "farm.helideck": helideck, - "project.wage_specialist_day": wage_specialist_day, - "project.wage_specialist_night": wage_specialist_night, - "project.wage_technician_day": wage_technician_day, - "project.wage_technician_night": wage_technician_night, - "project.workdays_summer": workdays_summer, - "project.workdays_winter": workdays_winter, - "project.energy_selling_price": 0.2, - - "project.network_configuration": network_configuration, - "project.layout": array_layout, - "bathymetry.layers": strata, - "project.commissioning_date": commissioning_date, - 'options.annual_maintenance_start': annual_maintenance_start, - 'options.annual_maintenance_end': annual_maintenance_end, - "project.electrical_economics_data": elec_bom, - "project.moorings_foundations_economics_data": moor_bom, - - "options.operations_onsite_maintenance": - operations_onsite_maintenance, - "options.operations_replacements": operations_replacements, - "options.operations_inspections": operations_inspections, - - 'project.umbilical_operations_weighting': full_weightings, - 'project.array_cables_operations_weighting': site_weightings, - 'project.substations_operations_weighting': site_weightings, - 'project.export_cable_operations_weighting': site_weightings, - 'project.foundations_operations_weighting': site_weightings, - 'project.moorings_operations_weighting': full_weightings, - - 'options.condition_maintenance_soh': condition_maintenance_soh, - 'options.calendar_maintenance_interval': - calendar_maintenance_interval, - - 'device.subsystem_access': device_access, - 'device.subsystem_costs': device_costs, - 'device.subsystem_failure_rates': device_failure_rates, - 'device.subsystem_inspections': device_inspections_requirements, - 'device.subsystem_maintenance': device_onsite_requirements, - 'device.subsystem_maintenance_parts': device_onsite_parts, - 'device.subsystem_operation_weightings': device_weightings, - 'device.subsystem_replacement': device_replacement_requirements, - - 'device.control_subsystem_access': control_access, - 'device.control_subsystem_costs': control_costs, - 'device.control_subsystem_failure_rates': control_failure_rates, - 'device.control_subsystem_inspections': - control_inspections_requirements, - 'device.control_subsystem_maintenance': - control_onsite_requirements, - 'device.control_subsystem_maintenance_parts': - control_onsite_parts, - 'device.control_subsystem_operation_weightings': - control_weightings, - 'device.control_subsystem_replacement': - control_replacement_requirements, - - 'project.electrical_onsite_maintenance_requirements': - electrical_onsite_requirements, - 'project.moorings_onsite_maintenance_requirements': - moorings_onsite_requirements, - - 'project.electrical_replacement_requirements': None, - 'project.moorings_replacement_requirements': None, - - 'project.electrical_inspections_requirements': - electrical_inspections_requirements, - 'project.moorings_inspections_requirements': - moorings_inspections_requirements, - - 'project.electrical_onsite_maintenance_parts': - electrical_onsite_parts, - 'project.moorings_onsite_maintenance_parts': moorings_onsite_parts, - - 'project.electrical_replacement_parts': None, - 'project.moorings_replacement_parts': None, - - 'options.subsystem_monitering_costs': condition_maintenance_cost, - 'options.transit_cost_multiplier': transit_cost_multiplier, - 'options.loading_cost_multiplier': loading_cost_multiplier, - - "project.electrical_network": electrical_network, - "project.moorings_foundations_network": mf_network, - "component.moorings_chain_NCFR": comp_tables_rel["chain NCFR"], - "component.moorings_chain_CFR": comp_tables_rel["chain CFR"], - "component.moorings_forerunner_NCFR": - comp_tables_rel["forerunner NCFR"], - "component.moorings_forerunner_CFR": - comp_tables_rel["forerunner CFR"], - "component.moorings_shackle_NCFR": - comp_tables_rel["shackle NCFR"], - "component.moorings_shackle_CFR": comp_tables_rel["shackle CFR"], - "component.moorings_swivel_NCFR": comp_tables_rel["swivel NCFR"], - "component.moorings_swivel_CFR": comp_tables_rel["swivel CFR"], - "component.foundations_anchor_NCFR": - comp_tables_rel["anchor NCFR"], - "component.foundations_anchor_CFR": - comp_tables_rel["anchor CFR"], - "component.foundations_pile_NCFR": comp_tables_rel["pile NCFR"], - "component.foundations_pile_CFR": comp_tables_rel["pile CFR"], - "component.moorings_rope_NCFR":comp_tables_rel["rope NCFR"], - "component.moorings_rope_CFR": comp_tables_rel["rope CFR"], - "component.static_cable_NCFR": - comp_tables_rel["static_cable NCFR"], - "component.static_cable_CFR": - comp_tables_rel["static_cable CFR"], - "component.dynamic_cable_NCFR": - comp_tables_rel["dynamic_cable NCFR"], - "component.dynamic_cable_CFR": - comp_tables_rel["dynamic_cable CFR"], - "component.wet_mate_connectors_NCFR": - comp_tables_rel["wet_mate NCFR"], - "component.wet_mate_connectors_CFR": - comp_tables_rel["wet_mate CFR"], - "component.dry_mate_connectors_NCFR": - comp_tables_rel["dry_mate NCFR"], - "component.dry_mate_connectors_CFR": - comp_tables_rel["dry_mate CFR"], - "component.transformers_NCFR": - comp_tables_rel["transformer NCFR"], - "component.transformers_CFR": - comp_tables_rel["transformer CFR"], - "component.collection_points_NCFR": - comp_tables_rel["collection_point NCFR"], - "component.collection_points_CFR": - comp_tables_rel["collection_point CFR"], - - 'component.cable_burial': equipment_cable_burial, - 'project.cable_burial_safety_factors': cable_burial_sf, - 'component.collection_points': collection_point, - "component.collection_point_cog": collection_point_cog, - "component.collection_point_foundations": collection_point_found, - 'component.divers': equipment_divers, - 'project.divers_safety_factors': divers_sf, - 'component.drilling_rigs': equipment_drilling_rigs, - 'component.dry_mate_connectors': dry_mate, - 'component.equipment_penetration_rates': - equipment_penetration_rates, - 'component.excavating': equipment_excavating, - 'project.fuel_cost_rate': fuel_cost_rate, - 'project.grout_rate': grout_rate, - 'component.hammer': equipment_hammer, - 'project.hammer_safety_factors': hammer_sf, - 'component.installation_soil_compatibility': - installation_soil_compatibility, - 'project.loading_rate': loading_rate, - 'component.mattress_installation': equipment_mattress, - 'component.port_locations': port_locations, - 'project.port_safety_factors': port_sf, - 'component.ports': ports, - 'component.rock_bags_installation': equipment_rock_filter_bags, - 'component.rov': equipment_rov, - 'project.rov_safety_factors': rov_sf, - 'project.split_pipe_laying_rate': split_pipe_laying_rate, - 'project.split_pipe_safety_factors': split_pipe_sf, - 'component.split_pipes_installation': equipment_split_pipe, - 'component.static_cable': static_cables, - 'project.surface_laying_rate': surface_laying_rate, - 'component.transformers': transformer, - 'project.vessel_safety_factors': vessel_sf, - "component.vehicle_helicopter": helicopter_df, - "component.vehicle_vessel_ahts": ahts_df, - "component.vehicle_vessel_multicat": multicat_df, - "component.vehicle_vessel_crane_barge": crane_barge_df, - "component.vehicle_vessel_barge": barge_df, - "component.vehicle_vessel_crane_vessel": crane_vessel_df, - "component.vehicle_vessel_csv": csv_df, - "component.vehicle_vessel_ctv": ctv_df, - "component.vehicle_vessel_clb": clb_df, - "component.vehicle_vessel_clv": clv_df, - "component.vehicle_vessel_jackup_barge": jackup_barge_df, - "component.vehicle_vessel_jackup_vessel": jackup_vssel_df, - "component.vehicle_vessel_tugboat": tugboat_df, - 'component.vibro_driver': equipment_vibro_driver, - 'project.vibro_driver_safety_factors': vibro_driver_sf, - 'component.wet_mate_connectors': wet_mate, - 'project.landfall_contruction_technique': landfall, - 'corridor.layers': export_strata, - 'device.assembly_duration': assembly_duration, - 'device.bollard_pull': bollard_pull, - 'device.connect_duration': connect_duration, - 'device.disconnect_duration': disconnect_duration, - 'device.load_out_method': load_out_method, - 'device.subsystem_installation': sub_device, - 'device.system_height': system_height, - 'device.system_length': system_length, - 'device.system_mass': system_mass, - 'device.system_width': system_width, - 'device.transportation_method': transportation_method, - 'project.cable_routes': cable_routes, - 'project.electrical_component_data': electrical_components, - 'project.lease_area_entry_point': entry_point_shapely, - 'project.foundations_component_data': foundations_data_df, - 'project.foundations_soil_data': foundations_layers_df, - 'project.moorings_line_data': line_data_df, - 'project.moorings_component_data': moorings_data_df, - 'project.selected_installation_tool': tool, - 'project.substation_props': substations, - 'farm.tidal_series_installation': tidal_series, - 'project.umbilical_cable_data': umbilicals, - 'project.umbilical_seabed_connection': umbilical_terminations, - 'farm.wave_series_installation': wave_series, - 'farm.wind_series_installation': wind_series, - 'project.commissioning_time': comissioning_time, - 'project.cost_contingency': cost_contingency, - 'project.port_percentage_cost': port_percentage_cost, - 'project.start_date': project_start_date, - 'project.lifetime': lifetime, - 'site.projection': lease_utm_zone, - - 'project.mean_power_per_device': mean_power_per_device, - 'project.annual_energy_per_device': annual_energy_per_device, - "project.substation_layout": substation_layout, - - 'component.foundations_anchor': comp_tables["drag anchor"], - 'component.foundations_pile': comp_tables["pile"], - 'component.moorings_chain': comp_tables["chain"], - 'component.moorings_forerunner': - comp_tables["forerunner assembly"], - 'component.moorings_rope': comp_tables["rope"], - 'component.moorings_rope_stiffness': - comp_tables["rope axial stiffness"], - 'component.moorings_shackle': comp_tables["shackle"], - 'component.moorings_swivel': comp_tables["swivel"], - "component.dynamic_cable" : dynamic_cables, - 'component.foundations_anchor_sand': - comp_tables["drag anchor sand"], - 'component.foundations_anchor_soft': - comp_tables["drag anchor soft"], - - 'options.maintenance_data_points': 3, - 'project.discount_rate': 0.05 - - } - + "project.calendar_based_maintenance": calendar_based_maintenance, + "project.condition_based_maintenance": condition_based_maintenance, + "farm.helideck": helideck, + "project.wage_specialist_day": wage_specialist_day, + "project.wage_specialist_night": wage_specialist_night, + "project.wage_technician_day": wage_technician_day, + "project.wage_technician_night": wage_technician_night, + "project.workdays_summer": workdays_summer, + "project.workdays_winter": workdays_winter, + "project.energy_selling_price": 0.2, + "project.network_configuration": network_configuration, + "project.layout": array_layout, + "bathymetry.layers": strata, + "project.commissioning_date": commissioning_date, + "options.annual_maintenance_start": annual_maintenance_start, + "options.annual_maintenance_end": annual_maintenance_end, + "project.electrical_economics_data": elec_bom, + "project.moorings_foundations_economics_data": moor_bom, + "options.operations_onsite_maintenance": operations_onsite_maintenance, + "options.operations_replacements": operations_replacements, + "options.operations_inspections": operations_inspections, + "project.umbilical_operations_weighting": full_weightings, + "project.array_cables_operations_weighting": site_weightings, + "project.substations_operations_weighting": site_weightings, + "project.export_cable_operations_weighting": site_weightings, + "project.foundations_operations_weighting": site_weightings, + "project.moorings_operations_weighting": full_weightings, + "options.condition_maintenance_soh": condition_maintenance_soh, + "options.calendar_maintenance_interval": calendar_maintenance_interval, + "device.subsystem_access": device_access, + "device.subsystem_costs": device_costs, + "device.subsystem_failure_rates": device_failure_rates, + "device.subsystem_inspections": device_inspections_requirements, + "device.subsystem_maintenance": device_onsite_requirements, + "device.subsystem_maintenance_parts": device_onsite_parts, + "device.subsystem_operation_weightings": device_weightings, + "device.subsystem_replacement": device_replacement_requirements, + "device.control_subsystem_access": control_access, + "device.control_subsystem_costs": control_costs, + "device.control_subsystem_failure_rates": control_failure_rates, + "device.control_subsystem_inspections": control_inspections_requirements, + "device.control_subsystem_maintenance": control_onsite_requirements, + "device.control_subsystem_maintenance_parts": control_onsite_parts, + "device.control_subsystem_operation_weightings": control_weightings, + "device.control_subsystem_replacement": control_replacement_requirements, + "project.electrical_onsite_maintenance_requirements": electrical_onsite_requirements, + "project.moorings_onsite_maintenance_requirements": moorings_onsite_requirements, + "project.electrical_replacement_requirements": None, + "project.moorings_replacement_requirements": None, + "project.electrical_inspections_requirements": electrical_inspections_requirements, + "project.moorings_inspections_requirements": moorings_inspections_requirements, + "project.electrical_onsite_maintenance_parts": electrical_onsite_parts, + "project.moorings_onsite_maintenance_parts": moorings_onsite_parts, + "project.electrical_replacement_parts": None, + "project.moorings_replacement_parts": None, + "options.subsystem_monitering_costs": condition_maintenance_cost, + "options.transit_cost_multiplier": transit_cost_multiplier, + "options.loading_cost_multiplier": loading_cost_multiplier, + "project.electrical_network": electrical_network, + "project.moorings_foundations_network": mf_network, + "component.moorings_chain_NCFR": comp_tables_rel["chain NCFR"], + "component.moorings_chain_CFR": comp_tables_rel["chain CFR"], + "component.moorings_forerunner_NCFR": comp_tables_rel["forerunner NCFR"], + "component.moorings_forerunner_CFR": comp_tables_rel["forerunner CFR"], + "component.moorings_shackle_NCFR": comp_tables_rel["shackle NCFR"], + "component.moorings_shackle_CFR": comp_tables_rel["shackle CFR"], + "component.moorings_swivel_NCFR": comp_tables_rel["swivel NCFR"], + "component.moorings_swivel_CFR": comp_tables_rel["swivel CFR"], + "component.foundations_anchor_NCFR": comp_tables_rel["anchor NCFR"], + "component.foundations_anchor_CFR": comp_tables_rel["anchor CFR"], + "component.foundations_pile_NCFR": comp_tables_rel["pile NCFR"], + "component.foundations_pile_CFR": comp_tables_rel["pile CFR"], + "component.moorings_rope_NCFR": comp_tables_rel["rope NCFR"], + "component.moorings_rope_CFR": comp_tables_rel["rope CFR"], + "component.static_cable_NCFR": comp_tables_rel["static_cable NCFR"], + "component.static_cable_CFR": comp_tables_rel["static_cable CFR"], + "component.dynamic_cable_NCFR": comp_tables_rel["dynamic_cable NCFR"], + "component.dynamic_cable_CFR": comp_tables_rel["dynamic_cable CFR"], + "component.wet_mate_connectors_NCFR": comp_tables_rel["wet_mate NCFR"], + "component.wet_mate_connectors_CFR": comp_tables_rel["wet_mate CFR"], + "component.dry_mate_connectors_NCFR": comp_tables_rel["dry_mate NCFR"], + "component.dry_mate_connectors_CFR": comp_tables_rel["dry_mate CFR"], + "component.transformers_NCFR": comp_tables_rel["transformer NCFR"], + "component.transformers_CFR": comp_tables_rel["transformer CFR"], + "component.collection_points_NCFR": comp_tables_rel[ + "collection_point NCFR" + ], + "component.collection_points_CFR": comp_tables_rel["collection_point CFR"], + "component.cable_burial": equipment_cable_burial, + "project.cable_burial_safety_factors": cable_burial_sf, + "component.collection_points": collection_point, + "component.collection_point_cog": collection_point_cog, + "component.collection_point_foundations": collection_point_found, + "component.divers": equipment_divers, + "project.divers_safety_factors": divers_sf, + "component.drilling_rigs": equipment_drilling_rigs, + "component.dry_mate_connectors": dry_mate, + "component.equipment_penetration_rates": equipment_penetration_rates, + "component.excavating": equipment_excavating, + "project.fuel_cost_rate": fuel_cost_rate, + "project.grout_rate": grout_rate, + "component.hammer": equipment_hammer, + "project.hammer_safety_factors": hammer_sf, + "component.installation_soil_compatibility": installation_soil_compatibility, + "project.loading_rate": loading_rate, + "component.mattress_installation": equipment_mattress, + "component.port_locations": port_locations, + "project.port_safety_factors": port_sf, + "component.ports": ports, + "component.rock_bags_installation": equipment_rock_filter_bags, + "component.rov": equipment_rov, + "project.rov_safety_factors": rov_sf, + "project.split_pipe_laying_rate": split_pipe_laying_rate, + "project.split_pipe_safety_factors": split_pipe_sf, + "component.split_pipes_installation": equipment_split_pipe, + "component.static_cable": static_cables, + "project.surface_laying_rate": surface_laying_rate, + "component.transformers": transformer, + "project.vessel_safety_factors": vessel_sf, + "component.vehicle_helicopter": helicopter_df, + "component.vehicle_vessel_ahts": ahts_df, + "component.vehicle_vessel_multicat": multicat_df, + "component.vehicle_vessel_crane_barge": crane_barge_df, + "component.vehicle_vessel_barge": barge_df, + "component.vehicle_vessel_crane_vessel": crane_vessel_df, + "component.vehicle_vessel_csv": csv_df, + "component.vehicle_vessel_ctv": ctv_df, + "component.vehicle_vessel_clb": clb_df, + "component.vehicle_vessel_clv": clv_df, + "component.vehicle_vessel_jackup_barge": jackup_barge_df, + "component.vehicle_vessel_jackup_vessel": jackup_vssel_df, + "component.vehicle_vessel_tugboat": tugboat_df, + "component.vibro_driver": equipment_vibro_driver, + "project.vibro_driver_safety_factors": vibro_driver_sf, + "component.wet_mate_connectors": wet_mate, + "project.landfall_contruction_technique": landfall, + "corridor.layers": export_strata, + "device.assembly_duration": assembly_duration, + "device.bollard_pull": bollard_pull, + "device.connect_duration": connect_duration, + "device.disconnect_duration": disconnect_duration, + "device.load_out_method": load_out_method, + "device.subsystem_installation": sub_device, + "device.system_height": system_height, + "device.system_length": system_length, + "device.system_mass": system_mass, + "device.system_width": system_width, + "device.transportation_method": transportation_method, + "project.cable_routes": cable_routes, + "project.electrical_component_data": electrical_components, + "project.lease_area_entry_point": entry_point_shapely, + "project.foundations_component_data": foundations_data_df, + "project.foundations_soil_data": foundations_layers_df, + "project.moorings_line_data": line_data_df, + "project.moorings_component_data": moorings_data_df, + "project.selected_installation_tool": tool, + "project.substation_props": substations, + "farm.tidal_series_installation": tidal_series, + "project.umbilical_cable_data": umbilicals, + "project.umbilical_seabed_connection": umbilical_terminations, + "farm.wave_series_installation": wave_series, + "farm.wind_series_installation": wind_series, + "project.commissioning_time": comissioning_time, + "project.cost_contingency": cost_contingency, + "project.port_percentage_cost": port_percentage_cost, + "project.start_date": project_start_date, + "project.lifetime": lifetime, + "site.projection": lease_utm_zone, + "project.mean_power_per_device": mean_power_per_device, + "project.annual_energy_per_device": annual_energy_per_device, + "project.substation_layout": substation_layout, + "component.foundations_anchor": comp_tables["drag anchor"], + "component.foundations_pile": comp_tables["pile"], + "component.moorings_chain": comp_tables["chain"], + "component.moorings_forerunner": comp_tables["forerunner assembly"], + "component.moorings_rope": comp_tables["rope"], + "component.moorings_rope_stiffness": comp_tables["rope axial stiffness"], + "component.moorings_shackle": comp_tables["shackle"], + "component.moorings_swivel": comp_tables["swivel"], + "component.dynamic_cable": dynamic_cables, + "component.foundations_anchor_sand": comp_tables["drag anchor sand"], + "component.foundations_anchor_soft": comp_tables["drag anchor soft"], + "options.maintenance_data_points": 3, + "project.discount_rate": 0.05, +} + if __name__ == "__main__": - from dtocean_core.utils.files import pickle_test_data file_path = os.path.abspath(__file__) pkl_path = pickle_test_data(file_path, test_data) - - print "generate test data: {}".format(pkl_path) + print("generate test data: {}".format(pkl_path)) + + print("generate test data: {}".format(pkl_path)) diff --git a/packages/dtocean-core/tests/conftest.py b/packages/dtocean-core/tests/conftest.py new file mode 100644 index 0000000..b6d124e --- /dev/null +++ b/packages/dtocean-core/tests/conftest.py @@ -0,0 +1,36 @@ +import glob +import os +import shutil + + +def pytest_sessionstart(session): + # Pickle data files and move to test directory + data_dir = "test_data" + test_dir = "tests" + search_path = os.path.join(data_dir, "*.py") + test_data_files = glob.glob(search_path) + + for test_data_path in test_data_files: + src_path_root = os.path.splitext(test_data_path)[0] + src_path = "{}.pkl".format(src_path_root) + src_file = os.path.split(src_path)[1] + dst_path = os.path.join(test_dir, src_file) + dst_path = os.path.abspath(dst_path) + + sys_command = "python {}".format(test_data_path) + os.system(sys_command) + + print("add test data: {}".format(dst_path)) + shutil.move(src_path, dst_path) + + # Move yaml definitions to test directory + search_path = os.path.join(data_dir, "*.yaml") + test_def_files = glob.glob(search_path) + + for test_def_path in test_def_files: + src_file = os.path.split(test_def_path)[1] + dst_path = os.path.join(test_dir, src_file) + dst_path = os.path.abspath(dst_path) + + print("add data definitions: {}".format(dst_path)) + shutil.move(test_def_path, dst_path) diff --git a/packages/mdo-engine/src/mdo_engine/utilities/plugins.py b/packages/mdo-engine/src/mdo_engine/utilities/plugins.py index c984494..46ff944 100644 --- a/packages/mdo-engine/src/mdo_engine/utilities/plugins.py +++ b/packages/mdo-engine/src/mdo_engine/utilities/plugins.py @@ -24,7 +24,7 @@ def _discover_plugins(self, package, super_cls, warn_import=False): names = get_module_names_from_package(package) names.append(package.__name__) - cls_map = {} + cls_map: dict[str, type] = {} for mod_name in names: data_sub_mods = get_subclass_names_from_module(mod_name, super_cls)