Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions wisdem/rotorse/rotor_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def setup(self):
self.add_input("precurve", val=np.zeros(n_span), units="m", desc="location in blade x-coordinate")
self.add_input("presweep", val=np.zeros(n_span), units="m", desc="location in blade y-coordinate")
self.add_input("precone", val=0.0, units="deg", desc="precone angle")
self.add_input("Rhub", val=0.0, units="m", desc="hub radius")
self.add_input("blade_span_cg", val=0.0, units="m", desc="Distance along the blade span for its center of gravity")

# Outputs
Expand All @@ -49,12 +48,12 @@ def setup(self):
self.add_output("blades_cg_hubcc", val=0.0, units="m", desc="cg of all blades relative to hub along shaft axis. Distance is should be interpreted as negative for upwind and positive for downwind turbines")

def compute(self, inputs, outputs):
# Note that r[0]=Rhub here
r = inputs["r"]
precurve = inputs["precurve"]
presweep = inputs["presweep"]
precone = inputs["precone"]
r_cg = inputs["blade_span_cg"]
Rhub = inputs["Rhub"]

n = len(r)
dx_dx = np.eye(3 * n)
Expand All @@ -74,7 +73,7 @@ def compute(self, inputs, outputs):

# Compute cg location of all blades in hub coordinates
cone_cg = np.interp(r_cg, r, totalCone)
cg = (r_cg + Rhub) * np.sin(np.deg2rad(cone_cg))
cg = r_cg * np.sin(np.deg2rad(cone_cg))
outputs["blades_cg_hubcc"] = cg


Expand Down Expand Up @@ -1125,7 +1124,7 @@ def setup(self):
self.add_subsystem(
"curvature",
BladeCurvature(modeling_options=modeling_options),
promotes=["r", "precone", "precurve", "presweep", "Rhub", "blade_span_cg", "3d_curv", "x_az", "y_az", "z_az"],
promotes=["r", "precone", "precurve", "presweep", "blade_span_cg", "3d_curv", "x_az", "y_az", "z_az"],
)
promoteListTotalBladeLoads = ["r", "theta", "tilt", "rhoA", "3d_curv", "z_az"]
self.add_subsystem(
Expand Down
2 changes: 1 addition & 1 deletion wisdem/test/test_postprocessing/test_getters.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def testAll(self):
npt.assert_almost_equal(getter.get_monopile_cost(prob), 3108099.1, 1)
npt.assert_almost_equal(getter.get_structural_mass(prob), getter.get_tower_mass(prob)+getter.get_monopile_mass(prob))
npt.assert_almost_equal(getter.get_structural_cost(prob), getter.get_tower_cost(prob)+getter.get_monopile_cost(prob))
npt.assert_almost_equal(getter.get_tower_freqs(prob), np.array([0.1744686, 0.175398 , 0.7489153, 0.8640253, 0.9475382, 1.8933329]))
npt.assert_almost_equal(getter.get_tower_freqs(prob), np.array([0.1744692, 0.1754122, 0.7511913, 0.8640732, 0.9489718, 1.8933818]), decimal=3)
npt.assert_almost_equal(getter.get_tower_cm(prob), 52.18670343496422, 2)
npt.assert_almost_equal(getter.get_tower_cg(prob), 52.18670343496422, 2)

Expand Down
9 changes: 4 additions & 5 deletions wisdem/test/test_rotorse/test_rotor_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ def testBladeCurvature(self):
myobj = rs.BladeCurvature(modeling_options=options)

# Straight blade: Z is 'r'
inputs["r"] = np.linspace(0, 100, npts)
inputs["r"] = np.linspace(1, 101, npts) # assumes rhub=1
inputs["precurve"] = myzero
inputs["presweep"] = myzero
inputs["precone"] = 0.0
inputs["Rhub"] = 1.0
inputs["blade_span_cg"] = 0.5 * inputs["r"].max()
inputs["blade_span_cg"] = inputs["r"].mean()
myobj.compute(inputs, outputs)
npt.assert_equal(outputs["3d_curv"], myzero)
npt.assert_equal(outputs["x_az"], myzero)
Expand All @@ -52,7 +51,7 @@ def testBladeCurvature(self):
inputs["precurve"] = np.linspace(0, 1, npts)
inputs["precone"] = 0.0
myobj.compute(inputs, outputs)
cone = -np.rad2deg(np.arctan(inputs["precurve"] / (inputs["r"] + 1e-20)))
cone = -np.rad2deg(np.arctan(inputs["precurve"] / (inputs["r"] - 1.0 + 1e-20)))
cone[0] = cone[1]
npt.assert_almost_equal(outputs["3d_curv"], cone)
npt.assert_equal(outputs["x_az"], inputs["precurve"])
Expand All @@ -75,7 +74,7 @@ def testBladeCurvature(self):
inputs["presweep"] = np.linspace(0, 1, npts)
inputs["precone"] = 0.0
myobj.compute(inputs, outputs)
cone = -np.rad2deg(np.arctan(inputs["precurve"] / (inputs["r"] + 1e-20)))
cone = -np.rad2deg(np.arctan(inputs["precurve"] / (inputs["r"] - 1.0 + 1e-20)))
cone[0] = cone[1]
npt.assert_almost_equal(outputs["3d_curv"], cone)
npt.assert_equal(outputs["x_az"], inputs["precurve"])
Expand Down
Loading