Skip to content

Commit

Permalink
Merge pull request #513 from WISDEM/compare_designs
Browse files Browse the repository at this point in the history
Compare designs
  • Loading branch information
ptrbortolotti committed Apr 12, 2024
2 parents a59baf0 + 409f195 commit 4bc31cb
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 143 deletions.
4 changes: 2 additions & 2 deletions docs/wisdem/drivetrainse/layout.rst
Expand Up @@ -51,7 +51,7 @@ In addition to the user-defined dimensions, the other values are derived in the
L_{nose} &= L_{12} + L_{2n}\\
L_{drive} &= L_{h1} + L_{12} + L_{2n}\\
L_{bedplate} &= L_{overhang} - L_{drive}\cos \gamma\\
H_{bedplate} &= H_{htt} - L_{drive}\sin \gamma
H_{bedplate} &= H_{htt} - (L_{drive} + D_{hub}/2)\sin \gamma
Here the length from the hub flange to the generator rotor attachment, :math:`L_{grs}`, is assumed to be at the halfway point between the flange and the first main bearing, :math:`L_{h1}`. Similarly, the distance between the second main bearing and the nose/turret interface with the bedplate, :math:`L_{2n}`, is twice the distance as that from the same interface to the generator stator attachment, :math:`L_{gsn}`. After adding up the total length of the low speed shaft and nose/turret, the total drivetrain length from bedplate to hub can be determined. Then, the bedplate dimensions are determined in order to meet the target overhang and hub-to-tower top height. To ensure that these layout dimensions are adequately satisfied during a design optimization, a constraint is enforced such that :math:`L_{bed} \geq 0.5 D_{top}`.

Expand Down Expand Up @@ -104,6 +104,6 @@ In addition to the user-defined dimensions, the other values are derived in the
L_{lss} &= L_{12} + L_{h1} + \delta\\
L_{drive} &= L_{lss} + L_{gearbox} + L_{hss} + L_{generator}\\
L_{bedplate} &= L_{drive} \cos \gamma \\
H_{bedplate} &= H_{htt} - L_{drive} \sin \gamma
H_{bedplate} &= H_{htt} - (L_{drive} + D_{hub}/2) \sin \gamma
The dimension, :math:`\delta` is the space between the second main bearing and the gearbox attachment where the shrink disk lies. This is assumed to be 0.1 meters. The bedplate height is sized to ensure that the desired height from tower top to hub is obtained. To achieve the desired overhang distance, the tower is centered at the exact overhang distance from the hub and a constraint is enforced such that the drivetrain length is sufficient to extend past the tower, :math:`L_{drive} \cos \gamma - L_{overhang} \geq 0.5 D_{top}`.
5 changes: 4 additions & 1 deletion wisdem/glue_code/gc_LoadInputs.py
Expand Up @@ -641,7 +641,10 @@ def recursive_flag(d):
else:
self.analysis_options["opt_flag"] = recursive_flag(self.analysis_options["design_variables"])

if self.analysis_options["opt_flag"] == False and self.analysis_options["driver"]["step_size_study"]["flag"] == True:
if self.analysis_options["opt_flag"] == False and (
self.analysis_options["driver"]["step_size_study"]["flag"] == True or
self.analysis_options["driver"]["design_of_experiments"]["flag"] == True
):
self.analysis_options["opt_flag"] = True

# Blade design variables
Expand Down
176 changes: 36 additions & 140 deletions wisdem/postprocessing/compare_designs.py
Expand Up @@ -99,6 +99,7 @@ def create_all_plots(
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "twist_opt" + extension
ftw.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()
except KeyError:
pass

Expand Down Expand Up @@ -146,149 +147,37 @@ def create_all_plots(
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "chord" + extension
fc.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()
except KeyError:
pass

# Spar caps
try:
fsc, axsc = plt.subplots(1, 1, figsize=(5.3, 4))

for idx, (yaml_data, label) in enumerate(zip(list_of_sims, list_of_labels)):
s_opt_sc = yaml_data["blade.opt_var.s_opt_spar_cap_ss"]
sc_opt = yaml_data["blade.opt_var.spar_cap_ss_opt"] * 1e3
n_layers = yaml_data["blade.ps.layer_thickness_param"].shape[0]
ilayer = None
if ilayer is None:
for i in range(n_layers):
layer_name = modeling_options["WISDEM"]["RotorSE"]["layer_name"][i]
if modeling_options["WISDEM"]["RotorSE"]["spar_cap_ss"] == layer_name:
ilayer = i

if ilayer is None:
raise KeyError("Suction side spar cap layer not found")
axsc.plot(
yaml_data["blade.outer_shape_bem.s"],
yaml_data["blade.ps.layer_thickness_param"][ilayer, :] * 1e3,
"-",
color=colors[idx],
label=label,
)
axsc.plot(s_opt_sc, sc_opt, "o", color=colors[idx], markersize=3)

s_opt_sc = list_of_sims[0]["blade.outer_shape_bem.s"]
sc_opt = list_of_sims[0]["blade.ps.layer_thickness_param"][ilayer, :] * 1e3
axsc.plot(
s_opt_sc,
np.array(analysis_options["design_variables"]["blade"]["structure"]["spar_cap_ss"]["max_decrease"])
* sc_opt,
":o",
color=colors[idx + 1],
markersize=3,
label="Bounds",
)
axsc.plot(
s_opt_sc,
np.array(analysis_options["design_variables"]["blade"]["structure"]["spar_cap_ss"]["max_increase"])
* sc_opt,
":o",
color=colors[idx + 1],
markersize=3,
)

if mult_flag:
axsc.legend(fontsize=font_size)
plt.xlabel("Blade Nondimensional Span [-]", fontsize=font_size + 2, fontweight="bold")
plt.ylabel("Spar Caps Thickness [mm]", fontsize=font_size + 2, fontweight="bold")
plt.xticks(fontsize=font_size)
plt.yticks(fontsize=font_size)
plt.grid(color=[0.8, 0.8, 0.8], linestyle="--")
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "sc_opt" + extension
fsc.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
except KeyError:
pass

# Trailing edge reinforcements
try:
fte, axte = plt.subplots(1, 1, figsize=(5.3, 4))

for idx, (yaml_data, label) in enumerate(zip(list_of_sims, list_of_labels)):
s_opt_te = yaml_data["blade.opt_var.s_opt_te_ss"]
te_opt = yaml_data["blade.opt_var.te_ss_opt"] * 1e3
n_layers = yaml_data["blade.ps.layer_thickness_param"].shape[0]
ilayer = None
if ilayer is None:
for i in range(n_layers):
layer_name = modeling_options["WISDEM"]["RotorSE"]["layer_name"][i]
if modeling_options["WISDEM"]["RotorSE"]["te_ss"] == layer_name:
ilayer = i

if ilayer is None:
raise KeyError("Suction side TE layer not found")
axte.plot(
yaml_data["blade.outer_shape_bem.s"],
yaml_data["blade.ps.layer_thickness_param"][ilayer, :] * 1e3,
"-",
color=colors[idx],
label=label,
)
axte.plot(s_opt_te, te_opt, "o", color=colors[idx], markersize=3)

s_opt_te = list_of_sims[0]["blade.outer_shape_bem.s"]
te_opt = list_of_sims[0]["blade.ps.layer_thickness_param"][ilayer, :] * 1e3
axte.plot(
s_opt_te,
np.array(analysis_options["design_variables"]["blade"]["structure"]["te_ss"]["max_decrease"]) * te_opt,
":o",
color=colors[idx + 1],
markersize=3,
label="Bounds",
)
axte.plot(
s_opt_te,
np.array(analysis_options["design_variables"]["blade"]["structure"]["te_ss"]["max_increase"]) * te_opt,
":o",
color=colors[idx + 1],
markersize=3,
)

if mult_flag:
axte.legend(fontsize=font_size)
plt.xlabel("Blade Nondimensional Span [-]", fontsize=font_size + 2, fontweight="bold")
plt.ylabel("TE Reinforcement Thickness [mm]", fontsize=font_size + 2, fontweight="bold")
plt.xticks(fontsize=font_size)
plt.yticks(fontsize=font_size)
plt.grid(color=[0.8, 0.8, 0.8], linestyle="--")
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "te_opt" + extension
fte.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
except KeyError:
pass

# Skins
try:
f, ax = plt.subplots(1, 1, figsize=(5.3, 4))
for idx, (yaml_data, label) in enumerate(zip(list_of_sims, list_of_labels)):
ax.plot(
yaml_data["blade.outer_shape_bem.s"],
yaml_data["blade.internal_structure_2d_fem.layer_thickness"][1, :] * 1e3,
"-",
color=colors[idx],
label=label,
)
if mult_flag:
ax.legend(fontsize=font_size)
# plt.ylim([0., 120])
plt.xlabel("Blade Nondimensional Span [-]", fontsize=font_size + 2, fontweight="bold")
plt.ylabel("Outer Shell Skin Thickness [mm]", fontsize=font_size + 2, fontweight="bold")
plt.xticks(fontsize=font_size)
plt.yticks(fontsize=font_size)
plt.grid(color=[0.8, 0.8, 0.8], linestyle="--")
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "skin_opt" + extension
f.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
except KeyError:
pass
# Struct Layers Blade
n_layers = modeling_options["WISDEM"]["RotorSE"]["n_layers"]
layer_name = modeling_options["WISDEM"]["RotorSE"]["layer_name"]
for i in range(n_layers):
try:
f, ax = plt.subplots(1, 1, figsize=(5.3, 4))
for idx, (yaml_data, label) in enumerate(zip(list_of_sims, list_of_labels)):
ax.plot(
yaml_data["blade.outer_shape_bem.s"],
yaml_data["blade.ps.layer_thickness_param"][i, :] * 1e3,
"-",
color=colors[idx],
label=label + ' %s'%layer_name[i],
)
if mult_flag:
ax.legend(fontsize=font_size)
plt.xlabel("Blade Nondimensional Span [-]", fontsize=font_size + 2, fontweight="bold")
plt.ylabel("Layer Thickness [mm]", fontsize=font_size + 2, fontweight="bold")
plt.xticks(fontsize=font_size)
plt.yticks(fontsize=font_size)
plt.grid(color=[0.8, 0.8, 0.8], linestyle="--")
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "blade_layer_%d_thick"%i + extension
f.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()
except KeyError:
pass

# Strains spar caps
try:
Expand Down Expand Up @@ -319,6 +208,7 @@ def create_all_plots(
plt.subplots_adjust(bottom=0.15, left=0.2)
fig_name = "strains_sc_opt" + extension
feps.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()
except KeyError:
pass

Expand Down Expand Up @@ -351,6 +241,7 @@ def create_all_plots(
plt.subplots_adjust(bottom=0.15, left=0.2)
fig_name = "strains_te_opt" + extension
fete.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()
except KeyError:
pass

Expand Down Expand Up @@ -383,6 +274,7 @@ def create_all_plots(
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "aoa" + extension
faoa.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()
except KeyError:
pass

Expand All @@ -407,6 +299,7 @@ def create_all_plots(
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "af_efficiency" + extension
feff.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()
except KeyError:
pass

Expand All @@ -431,6 +324,7 @@ def create_all_plots(
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "prebend" + extension
fbend.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()

fsweep, axsweep = plt.subplots(1, 1, figsize=(5.3, 4))
for idx, (yaml_data, label) in enumerate(zip(list_of_sims, list_of_labels)):
Expand All @@ -451,6 +345,7 @@ def create_all_plots(
plt.subplots_adjust(bottom=0.15, left=0.15)
fig_name = "sweep" + extension
fsweep.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()
except KeyError:
pass

Expand Down Expand Up @@ -512,6 +407,7 @@ def create_all_plots(
fig_name = "tower-monopile_geometry" + extension
ftow.subplots_adjust(hspace=0.02, wspace=0.02, bottom=0.15, left=0.15)
ftow.savefig(os.path.join(folder_output, fig_name), pad_inches=0.1, bbox_inches="tight")
plt.close()
# except KeyError:
# pass

Expand Down

0 comments on commit 4bc31cb

Please sign in to comment.