def test_get_tforce(self): airfoil_dir = '/home/aa/vawt_env/learn/AeroDyn polars/naca0018_360' op_interp_dir = '/home/aa/vawt_env/vawt/physical_model/pitch_optimizer/exps/naca0018_RL_4/' # joint_name, chord_length, height, offset, sa_radius, airfoil_dir, op_interpolator_dir blade_1 = RotorBlade('blade_1_joint', 0.2, 2, 0, 1, airfoil_dir, op_interp_dir) blade_2 = RotorBlade('blade_2_joint', 0.2, 2, np.pi, 1, airfoil_dir, op_interp_dir) # blade, wind_direction, wind_speed, rotor_speed, theta, tf data = [(blade_1, 0, 8, 40, -1, 75.8169500791), (blade_1, 0, 8, 40, -3, 75.8169500791), (blade_1, 0, 3, 3, 0, 2.44937957791787), (blade_1, np.pi, 3, 3, np.pi, 2.44937957791787), (blade_1, 0, 6, 12, 0, 13.297044148331983), (blade_2, np.pi, 3, 3, 0, 2.44937957791787), (blade_2, 0, 3, 3, np.pi, 2.44937957791787), (blade_2, 0, 6, 12, np.pi, 13.297044148331983)] for blade, wind_direction, wind_speed, rotor_speed, theta, tf in data: wind_vector = bc.get_wind_vector(wind_direction, wind_speed) # TSR = ωR/V∞ -> w=TSR*wind_speed/R tsr = rotor_speed * blade.sa_radius / wind_speed # set pitch blade.pitch = blade.get_optimal_pitch(tsr, theta, wind_direction) calculated = blade.get_tforce(wind_vector, rotor_speed, theta) self.assertAlmostEqual(calculated, tf, 7, 'Wrong Ft calculation')
def tf_data(self): wind_direction = 0 wind_speed = 6 rotor_speed = 6 wind_vector = bc.get_wind_vector(wind_direction, wind_speed) theta_range = [x * math.tau / 360 for x in range(-180, 180, 5)] pitch_range = [x * math.tau / 360 for x in range(-180, 180, 5)] thetas = [] for theta in theta_range: theta_ct_polar = [ blade.get_tangential_force(wind_vector, rotor_speed, theta, pitch) for pitch in pitch_range ] thetas.append(theta_ct_polar) df = pd.DataFrame(thetas, index=theta_range, columns=pitch_range) return df
def test_blade_tangent_line_angle(self): wind_direction = 0 wind_speed = 3 wind_vector = bc.get_wind_vector(wind_direction, wind_speed) # rotor_speed = 0.0001 rotor_speed = 3 # airfoil_dir = '/home/aa/vawt_env/learn/AeroDyn polars/cp10_360' airfoil_dir = '/home/aa/vawt_env/learn/AeroDyn polars/naca0018_360' blade = vb.VawtBlade(0.2, airfoil_dir, 1) theta_pitch = [(-2, 0, 0.252998783), (-1, 0, -0.1313296584), (-1, 20 * math.tau / 360, -1.4047434233043994), (-2, -2, -5.047621777237812)] for theta, pitch, ft in theta_pitch: self.assertAlmostEqual( blade.get_tangential_force(wind_vector, rotor_speed, theta, pitch), ft, 7, 'tangent_line_angle')
def test_tangential_force(self): wind_direction = 0 wind_speed = 3 wind_vector = bc.get_wind_vector(wind_direction, wind_speed) # rotor_speed = 0.0001 rotor_speed = 3 # airfoil_dir = '/home/aa/vawt_env/learn/AeroDyn polars/cp10_360' airfoil_dir = '/home/aa/vawt_env/learn/AeroDyn polars/naca0018_360' blade = vb.VawtBlade(0.2, airfoil_dir, 1) theta_pitch = [ (-1, 0.5, -0.70448212), (-2, 0, 0.252998783), (-1, 0, -0.13132965), (-2, -2, -6.32908050) ] for theta, pitch, ft in theta_pitch: self.assertAlmostEqual(blade.get_tangential_force(wind_vector, rotor_speed, theta, pitch), ft, 7, 'Wrong Ft calculation')
import pandas as pd import numpy as np import matplotlib.pyplot as plt import vec import learn.airfoil_dynamics.ct_plot.vawt_blade as vb import math import learn.airfoil_dynamics.ct_plot.base_calculus as bc # plots tangential force in function of aoa and rotora blade theta wind_direction = 0 wind_speed = 3 wind_vector = bc.get_wind_vector(wind_direction, wind_speed) # rotor_speed = 0.0001 rotor_speed = 3 # airfoil_dir = '/home/aa/vawt_env/learn/AeroDyn polars/cp10_360' airfoil_dir = '/home/aa/vawt_env/learn/AeroDyn polars/naca0018_360' blade = vb.VawtBlade(0.2, airfoil_dir, 1) theta_range = [x * math.tau / 360 for x in range(-180, 180, 5)] pitch_range = [x * math.tau / 360 for x in range(-180, 180, 5)] # theta_range = [x*math.tau/360 for x in range(-180, 179, 5)] # theta_range = [x*math.tau/360 for x in range(-540, 540, 10)] # pitch_range = [x*math.tau/360 for x in range(-180, 179, 5)] # pitch_range = [x*math.tau/360 for x in range(-90, 90, 5)] # pitch_range = [x*math.tau/360 for x in range(-20, 20, 1)] # pitch_range = [x*math.tau/360 for x in range(-60, 60, 1)] # theta_range = [x for x in range(0, 10, 1)]