Skip to content

Commit

Permalink
Update for more modern numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Sep 28, 2020
1 parent b6a6f87 commit 41034bc
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ROSCO_toolbox/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,26 +366,27 @@ def tune_flap_controller(self,turbine):
phi_vec.append(self.pitch_op[i] + turbine.twist*deg2rad)

# Lift and drag coefficients
Cl0 = np.zeros_like(turbine.af_data)
Cd0 = np.zeros_like(turbine.af_data)
Clp = np.zeros_like(turbine.af_data)
Cdp = np.zeros_like(turbine.af_data)
Clm = np.zeros_like(turbine.af_data)
Cdm = np.zeros_like(turbine.af_data)
num_af = len(turbine.af_data) # number of airfoils
Cl0 = np.zeros(num_af)
Cd0 = np.zeros(num_af)
Clp = np.zeros(num_af)
Cdp = np.zeros(num_af)
Clm = np.zeros(num_af)
Cdm = np.zeros(num_af)

for i,section in enumerate(turbine.af_data):
# assume airfoil section as AOA of zero for slope calculations - for now
a0_ind = section[0]['Alpha'].index(np.min(np.abs(section[0]['Alpha'])))
# Coefficients
if section[0]['NumTabs'] == 3: # sections with flaps
if section[0]['NumTabs'] == 3: # sections with 3 flaps
Clm[i,] = section[0]['Cl'][a0_ind]
Cdm[i,] = section[0]['Cd'][a0_ind]
Cl0[i,] = section[1]['Cl'][a0_ind]
Cd0[i,] = section[1]['Cd'][a0_ind]
Clp[i,] = section[2]['Cl'][a0_ind]
Cdp[i,] = section[2]['Cd'][a0_ind]
Ctrl_flp = float(section[2]['Ctrl'])
else: # sections without flaps
else: # sections without 3 flaps
Cl0[i,] = Clp[i,] = Clm[i,] = section[0]['Cl'][a0_ind]
Cd0[i,] = Cdp[i,] = Cdm[i,] = section[0]['Cd'][a0_ind]
Ctrl = float(section[0]['Ctrl'])
Expand Down

0 comments on commit 41034bc

Please sign in to comment.