import dynamics from dynamics import System, ModalElement, Integrator, RigidConnection, rotmat_y, \ RigidBody from blade import Tower #from loading import PointLoading import dynvis from linearisation import LinearisedSystem dynamics.OPT_GRAVITY = False modes_path = '/bladed/simple_tower/point_load/tower_2modes_only' bladed_path = '/bladed/simple_tower/point_load/flextower_rigidblades_2modes' # Modal element using data from Bladed model print "Loading tower from '%s'..." % modes_path tower = Tower(modes_path+'.$pj') modes = tower.modal_rep() # Load Bladed data for comparison import pybladed.data brun = pybladed.data.BladedRun(bladed_path) thrust = brun.get('rotating hub Fx') bladed_defl = np.c_[ brun.get('Nacelle fore-aft displacement'), brun.get('Nacelle nod angle'), ] #loading = PointLoading(blade, wind_table, None) thrust_time = [0, 1, 2, 10 ] thrust_force = [0, 0, 10e3, 10e3] thrust = np.c_[ thrust_force, np.zeros((4,2)) ].T
import dynamics from dynamics import System, ModalElement, Integrator, RigidConnection, rotmat_y, \ RigidBody from blade import Tower #from loading import PointLoading import dynvis from linearisation import LinearisedSystem dynamics.OPT_GRAVITY = False modes_path = '/bladed/simple_tower/point_load/tower_2modes_only' bladed_path = '/bladed/simple_tower/point_load/flextower_rigidblades_2modes' # Modal element using data from Bladed model print "Loading tower from '%s'..." % modes_path tower = Tower(modes_path + '.$pj') modes = tower.modal_rep() # Load Bladed data for comparison import pybladed.data brun = pybladed.data.BladedRun(bladed_path) thrust = brun.get('rotating hub Fx') bladed_defl = np.c_[brun.get('Nacelle fore-aft displacement'), brun.get('Nacelle nod angle'), ] #loading = PointLoading(blade, wind_table, None) thrust_time = [0, 1, 2, 10] thrust_force = [0, 0, 10e3, 10e3] thrust = np.c_[thrust_force, np.zeros((4, 2))].T loadfunc = scipy.interpolate.interp1d(thrust_time, thrust)
from dynamics import System, ModalElement, Integrator, RigidConnection, rotmat_y, \ RigidBody from blade import Tower #from loading import PointLoading import dynvis from linearisation import LinearisedSystem dynamics.OPT_GRAVITY = False modes_path = '/media/data/bladed/nrel_tower/point_load/tower_7modes_only' bladed_path = '/media/data/bladed/nrel_tower/point_load/flextower_rigidblades_7modes' # Modal element using data from Bladed model print "Loading tower from '%s'..." % modes_path #tower = Tower(modes_path+'.$pj') tower = Tower(bladed_path+'.$PJ') modes = tower.modal_rep(False) # Get combined tower frequencies #tower2 = Tower(bladed_path+'.$pj') #modes2 = tower2.modal_rep() isolated_freqs = 2*np.pi*np.array([1.28, 1.28, 20, 5.75, 5.75, 5.29, 5.29]) combined_freqs = modes.freqs modes.freqs = isolated_freqs # to get correct stiffness # Load Bladed data for comparison import pybladed.data brun = pybladed.data.BladedRun(bladed_path) bladed_defl = np.c_[ brun.get('Nacelle fore-aft displacement'),
import dynamics from dynamics import System, ModalElement, Integrator, RigidConnection, rotmat_y, \ RigidBody, DistalModalElement from blade import Tower #from loading import PointLoading import dynvis from linearisation import LinearisedSystem dynamics.OPT_GRAVITY = False modes_path = '/media/data/bladed/simple_tower/point_load/tower_7modes_only' bladed_path = '/media/data/bladed/simple_tower/point_load/flextower_rigidblades_7modes' # Modal element using data from Bladed model print "Loading tower from '%s'..." % modes_path tower = Tower(modes_path + '.$PJ') modes = tower.modal_rep(rejig=True) # Get combined tower frequencies tower2 = Tower(bladed_path + '.$PJ') modes2 = tower2.modal_rep(rejig=True) # Load Bladed data for comparison import pybladed.data brun = pybladed.data.BladedRun(bladed_path) thrust = brun.get('rotating hub Fx') bladed_defl = np.c_[brun.get('Nacelle fore-aft displacement'), brun.get('Nacelle nod angle'), ] #loading = PointLoading(blade, wind_table, None) thrust_time = [0, 1, 2, 10]
from dynamics import System, ModalElement, Integrator, RigidConnection, rotmat_y, \ RigidBody from blade import Tower #from loading import PointLoading import dynvis from linearisation import LinearisedSystem dynamics.OPT_GRAVITY = False modes_path = '/media/data/bladed/nrel_tower/point_load/tower_7modes_only' bladed_path = '/media/data/bladed/nrel_tower/point_load/flextower_rigidblades_7modes' # Modal element using data from Bladed model print "Loading tower from '%s'..." % modes_path #tower = Tower(modes_path+'.$pj') tower = Tower(bladed_path + '.$PJ') modes = tower.modal_rep(False) # Get combined tower frequencies #tower2 = Tower(bladed_path+'.$pj') #modes2 = tower2.modal_rep() isolated_freqs = 2 * np.pi * np.array([1.28, 1.28, 20, 5.75, 5.75, 5.29, 5.29]) combined_freqs = modes.freqs modes.freqs = isolated_freqs # to get correct stiffness # Load Bladed data for comparison import pybladed.data brun = pybladed.data.BladedRun(bladed_path) bladed_defl = np.c_[brun.get('Nacelle fore-aft displacement'), brun.get('Nacelle nod angle'), ]
from numpy import pi, array, dot import matplotlib.pylab as plt import matplotlib.gridspec as gridspec import dynamics from dynamics import (ModalElement, System, Integrator, RigidBody) from blade import Tower # Options dynamics.OPT_GRAVITY = True dynamics.OPT_GEOMETRIC_STIFFNESS = False # Create model bladed_file = r'C:\Users\Rick Lupton\Dropbox\phd\Bladed\Models\OC3-Hywind_SparBuoy_NREL5MW.prj' print "Loading modes from '%s'..." % bladed_file towerdef = Tower(bladed_file) modes = towerdef.modal_rep() endmass = 100000 endinertia = 100 el1 = ModalElement('el', modes, distal=False) system1 = System(el1) el2 = ModalElement('el', modes, distal=True) body = RigidBody('body', endmass, inertia=endinertia*np.eye(3)) el2.add_leaf(body) system2 = System(el2) integ1 = Integrator(system1) integ1.add_output(el1.output_positions())
from numpy import pi, array, dot import matplotlib.pylab as plt import matplotlib.gridspec as gridspec import dynamics from dynamics import (ModalElement, System, Integrator, RigidBody) from blade import Tower # Options dynamics.OPT_GRAVITY = True dynamics.OPT_GEOMETRIC_STIFFNESS = False # Create model bladed_file = r'C:\Users\Rick Lupton\Dropbox\phd\Bladed\Models\OC3-Hywind_SparBuoy_NREL5MW.prj' print "Loading modes from '%s'..." % bladed_file towerdef = Tower(bladed_file) modes = towerdef.modal_rep() endmass = 100000 endinertia = 100 el1 = ModalElement('el', modes, distal=False) system1 = System(el1) el2 = ModalElement('el', modes, distal=True) body = RigidBody('body', endmass, inertia=endinertia * np.eye(3)) el2.add_leaf(body) system2 = System(el2) integ1 = Integrator(system1) integ1.add_output(el1.output_positions())
def __init__(self, bladed_file, root_length=0, rigid=False): # Modal element using data from Bladed model print "Loading modes from '%s'..." % bladed_file self.blade = Blade(bladed_file) self.tower = Tower(bladed_file) self.modes = self.blade.modal_rep() Ry = rotmat_y(-pi / 2) Rhb1 = rotmat_x(0 * 2 * pi / 3) Rhb2 = rotmat_x(1 * 2 * pi / 3) Rhb3 = rotmat_x(2 * 2 * pi / 3) self.base = FreeJoint('base') self.towerlink = RigidConnection('tower', [0, 0, self.tower.hubheight]) self.bearing = Hinge('bearing', [1, 0, 0]) root1 = RigidConnection('root1', root_length * np.dot(Rhb1, [0, 0, 1]), dot(Rhb1, Ry)) root2 = RigidConnection('root2', root_length * np.dot(Rhb2, [0, 0, 1]), dot(Rhb2, Ry)) root3 = RigidConnection('root3', root_length * np.dot(Rhb3, [0, 0, 1]), dot(Rhb3, Ry)) self.blade1 = ModalElement('blade1', self.modes) self.blade2 = ModalElement('blade2', self.modes) self.blade3 = ModalElement('blade3', self.modes) self.base.add_leaf(self.towerlink) self.towerlink.add_leaf(self.bearing) self.bearing.add_leaf(root1) self.bearing.add_leaf(root2) self.bearing.add_leaf(root3) root1.add_leaf(self.blade1) root2.add_leaf(self.blade2) root3.add_leaf(self.blade3) self.system = System(self.base) # Prescribed DOF accelerations - constant rotor speed self.base_motion = None self.base_motion_amp = 0 self.system.prescribe(self.bearing, vel=0) self.system.prescribe(self.base, vel=0) if rigid: for b in (self.blade1, self.blade2, self.blade3): self.system.prescribe(b, vel=0) # setup integrator self.integ = Integrator(self.system, ('pos', 'vel', 'acc')) self.integ.add_output(dynamics.LoadOutput(self.base.iprox)) self.integ.add_output(dynamics.LoadOutput(self.towerlink.iprox)) self.integ.add_output( dynamics.LoadOutput(self.bearing.iprox, local=True)) self.integ.add_output( dynamics.LoadOutput(self.bearing.idist[0], local=True)) for b in (self.blade1, self.blade2, self.blade3): self.integ.add_output(dynamics.LoadOutput(b.iprox, local=True)) for b in (self.blade1, self.blade2, self.blade3): self.integ.add_output(b.output_deflections()) for b in (self.blade1, self.blade2, self.blade3): self.integ.add_output(b.output_positions()) for b in (self.blade1, self.blade2, self.blade3): self.integ.add_output( dynamics.NodeOutput(b.iprox, local=True, deriv=2))
def __init__(self, bladed_file, root_length=0): # Load modes but use a simple flapped blade print "Loading modes from '%s'..." % bladed_file self.blade = Blade(bladed_file) self.tower = Tower(bladed_file) self.modes = self.blade.modal_rep() # Calculate equivalent blade properties I1 = self.modes.I0[0] I2 = self.modes.J0[0, 0] print I1, I2 wflap = self.modes.freqs[0] bmass = self.modes.mass inertia = self.modes.inertia_tensor(np.zeros(len(self.modes.freqs))) Xc = [I1 / bmass, 0, 0] kflap = I2 * wflap**2 Ry = rotmat_y(-pi / 2) Rhb1 = rotmat_x(0 * 2 * pi / 3) Rhb2 = rotmat_x(1 * 2 * pi / 3) Rhb3 = rotmat_x(2 * 2 * pi / 3) self.base = FreeJoint('base') self.towerlink = RigidConnection('tower', [0, 0, self.tower.hubheight]) self.bearing = Hinge('bearing', [1, 0, 0]) root1 = RigidConnection('root1', root_length * np.dot(Rhb1, [0, 0, 1]), dot(Rhb1, Ry)) root2 = RigidConnection('root2', root_length * np.dot(Rhb2, [0, 0, 1]), dot(Rhb2, Ry)) root3 = RigidConnection('root3', root_length * np.dot(Rhb3, [0, 0, 1]), dot(Rhb3, Ry)) self.flap1 = Hinge('flap1', [0, 1, 0]) self.flap2 = Hinge('flap2', [0, 1, 0]) self.flap3 = Hinge('flap3', [0, 1, 0]) self.blade1 = RigidBody('blade1', bmass, inertia, Xc) self.blade2 = RigidBody('blade2', bmass, inertia, Xc) self.blade3 = RigidBody('blade3', bmass, inertia, Xc) self.flap1.stiffness = self.flap2.stiffness = self.flap3.stiffness = kflap self.base.add_leaf(self.towerlink) self.towerlink.add_leaf(self.bearing) self.bearing.add_leaf(root1) self.bearing.add_leaf(root2) self.bearing.add_leaf(root3) root1.add_leaf(self.flap1) root2.add_leaf(self.flap2) root3.add_leaf(self.flap3) self.flap1.add_leaf(self.blade1) self.flap2.add_leaf(self.blade2) self.flap3.add_leaf(self.blade3) self.system = System(self.base) # Prescribed DOF accelerations - constant rotor speed self.base_motion = None self.base_motion_amp = 0 self.system.prescribe(self.bearing, vel=0) self.system.prescribe(self.base, vel=0) # setup integrator self.integ = Integrator(self.system, ('pos', 'vel', 'acc')) self.integ.add_output(dynamics.LoadOutput(self.base.iprox)) self.integ.add_output(dynamics.LoadOutput(self.towerlink.iprox)) self.integ.add_output( dynamics.LoadOutput(self.bearing.iprox, local=True)) self.integ.add_output( dynamics.LoadOutput(self.bearing.idist[0], local=True)) for b in (self.blade1, self.blade2, self.blade3): self.integ.add_output(dynamics.LoadOutput(b.iprox, local=True)) for b in (self.blade1, self.blade2, self.blade3): self.integ.add_output( dynamics.NodeOutput(b.iprox, local=True, deriv=2))
import dynamics from dynamics import System, ModalElement, Integrator, RigidConnection, rotmat_y, RigidBody, DistalModalElement from blade import Tower # from loading import PointLoading import dynvis from linearisation import LinearisedSystem dynamics.OPT_GRAVITY = False modes_path = "/media/data/bladed/simple_tower/point_load/tower_7modes_only" bladed_path = "/media/data/bladed/simple_tower/point_load/flextower_rigidblades_7modes" # Modal element using data from Bladed model print "Loading tower from '%s'..." % modes_path tower = Tower(modes_path + ".$PJ") modes = tower.modal_rep(rejig=True) # Get combined tower frequencies tower2 = Tower(bladed_path + ".$PJ") modes2 = tower2.modal_rep(rejig=True) # Load Bladed data for comparison import pybladed.data brun = pybladed.data.BladedRun(bladed_path) thrust = brun.get("rotating hub Fx") bladed_defl = np.c_[brun.get("Nacelle fore-aft displacement"), brun.get("Nacelle nod angle")] # loading = PointLoading(blade, wind_table, None) thrust_time = [0, 1, 2, 10]