From aa2b46fcc38db27c7cb2c6fcf31eb8ff770ab090 Mon Sep 17 00:00:00 2001 From: Lucas-Carmo Date: Fri, 23 Aug 2024 16:04:20 -0600 Subject: [PATCH] Option to specify position of the RNA + slight change in test_rotor - Besides the already available option of specifying the hub height (using input key `hHub`), now the user can also specify the coordinates of the RNA reference position (with respect to the FOWT reference frame) via the input key `rRNA`. For multirotor designs, the user needs to provide `rRNA` for each RNA/rotor - moved the flagSaveValues to be an input of test_calcAero --- examples/VolturnUS-S_example.yaml | 3 ++- raft/raft_rotor.py | 19 ++++++++++--------- tests/test_rotor.py | 8 +++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/VolturnUS-S_example.yaml b/examples/VolturnUS-S_example.yaml index a0ea0df..2c14782 100644 --- a/examples/VolturnUS-S_example.yaml +++ b/examples/VolturnUS-S_example.yaml @@ -31,7 +31,8 @@ turbine: IxRNA : 0 # [kg-m2] RNA moment of inertia about local x axis (assumed to be identical to rotor axis for now, as approx) [kg-m^2] IrRNA : 0 # [kg-m2] RNA moment of inertia about local y or z axes [kg-m^2] xCG_RNA : 0 # [m] x location of RNA center of mass [m] (Actual is ~= -0.27 m) - hHub : 150.0 # [m] hub height above water line [m] + hHub : 150.0 # [m] hub height above water line [m] + #rRNA : [0,0, 148.742] # [m] Can use the position of the RNA reference point (which the RNA yaws about) with respect to the FOWT reference point. If also providing hHub, the z coord be overwritten. Fthrust : 1500.0E3 # [N] temporary thrust force to use I_drivetrain: 318628138.0 # full rotor + drivetrain inertia as felt on the high-speed shaft diff --git a/raft/raft_rotor.py b/raft/raft_rotor.py index a462864..1f4464e 100644 --- a/raft/raft_rotor.py +++ b/raft/raft_rotor.py @@ -46,12 +46,13 @@ def __init__(self, turbine, w, ir): self.turbine = turbine # store dictionary for later use # self.r_rel is the position of the RNA reference point (which the RNA yaws about) on the FOWT - if 'rotorCoords' in turbine: - print("WARNING: turbine rotorCoords input is deprecated - use position.") - self.r_rel = getFromDict(turbine, 'rotorCoords', dtype=list, shape=turbine['nrotors'], default=[[0,0,100.]])[ir] - - self.r_rel = getFromDict(turbine, 'position', dtype=list, shape=turbine['nrotors'], default=[[0,0,100.]])[ir] - + if 'rRNA' in turbine: # Temporary if statement. Need to fix getFromDict to handle this + self.r_rel = getFromDict(turbine, 'rRNA', shape=[turbine['nrotors'], 3])[ir] + else: + if turbine['nrotors'] > 1: + raise Exception("For designs with more than one rotor, the RNA reference point must be specified for each of them.") + self.r_rel = [0, 0, 100.] + self.overhang = getFromDict(turbine, 'overhang', shape=turbine['nrotors'])[ir] # rotor offset in +x before yaw [m] if self.overhang > 0: print("WARNING: The turbine overhang input was positive for upwind turbines.") @@ -105,12 +106,12 @@ def __init__(self, turbine, w, ir): self.R_ptfm = np.ones(3) # rotation matrix for platform orientation + # If `hHub` is specified, we overwrite the z-coordinate of the RNA reference point if 'hHub' in turbine: - print("WARNING: turbine hHub input is deprecated - use position [x y z].") hHub = getFromDict(turbine, 'hHub' , shape=turbine['nrotors'])[ir] # overwrites r_rel[2] [m] self.r_rel[2] = hHub - self.q[2]*self.overhang - self.hHub = hHub # we may not need this anymore - self.Zhub = self.hHub + self.hHub = self.r_rel[2] + self.q[2]*self.overhang # we may not need this anymore + self.Zhub = self.hHub # below is initialization, needs to be updated by setPosition... self.r_RRP = np.array(self.r_rel) # RNA reference point diff --git a/tests/test_rotor.py b/tests/test_rotor.py index 9eb2173..5f2d155 100644 --- a/tests/test_rotor.py +++ b/tests/test_rotor.py @@ -80,18 +80,16 @@ def index_and_rotor(request): ''' Test functions ''' -def test_calcAero(index_and_rotor): +def test_calcAero(index_and_rotor, flagSaveValues=False): ''' Verify rotor.calcAero for many combinations of wind speed, heading, TI, and yaw mode. Some combinations seem to be outside the validity of CCBlade (e.g., yaw_mode=1, wind direction=90, and turbine_heading=0), but they are tested nonetheless. + Set flagSaveValues to true to replace the true values file with the values calculated below ''' index, rotor = index_and_rotor rotor.setPosition() - # Set this flag to true to replace the true values file - flagSaveValues = False - if 'IEA15MW' in list_files[index]: U_rated = 10.59 elif 'NREL5MW' in list_files[index]: @@ -160,5 +158,5 @@ def test_calcAero(index_and_rotor): index = 0 rotor = create_rotor(list_files[index]) - test_calcAero((index, rotor)) + test_calcAero((index, rotor), flagSaveValues=False)