def __init__(self, length, radius, mass, endmass):
        self.length = length
        self.radius = radius
        self.mass = mass
        self.endmass = endmass
        
        Jx = mass * radius**2 / 2        
        Jyz = mass*(3*radius**2 + length**2) / 12        
        self.A = Jyz + endmass*(length/2)**2
        self.C = Jx

        self.pivot   = Hinge('pivot',   [0,1,0])
        self.offset  = RigidConnection('offset', [0,0,-length/2])
        self.axis    = Hinge('axis',    [0,0,1], rotmat_y(-np.pi/2))
        self.body    = UniformBeam('body', length, mass/length,
                                   1, 1, 1, Jx=Jx/2) # /2 because added to both ends
        self.endoffset = RigidConnection('endoffset', [0,0,length/2])
        self.endbody = RigidBody('end', endmass)

        self.pivot.add_leaf(self.offset)
        self.offset.add_leaf(self.axis)
        self.axis.add_leaf(self.body)
        
        self.pivot.add_leaf(self.endoffset)
        self.endoffset.add_leaf(self.endbody)
        self.system = System(self.pivot)

        # Prescribed DOF accelerations
        self.system.prescribe(self.axis, acc=0.0) # constant rotational speed
        self.system.prescribe(self.body, acc=0.0) # rigid beam
Example #2
0
    def __init__(self, length, radius, mass, endmass):
        self.length = length
        self.radius = radius
        self.mass = mass
        self.endmass = endmass

        Jx = mass * radius**2 / 2
        Jyz = mass * (3 * radius**2 + length**2) / 12
        self.A = Jyz + endmass * (length / 2)**2
        self.C = Jx

        self.pivot = Hinge('pivot', [0, 1, 0])
        self.offset = RigidConnection('offset', [0, 0, -length / 2])
        self.axis = Hinge('axis', [0, 0, 1], rotmat_y(-np.pi / 2))
        self.body = UniformBeam('body',
                                length,
                                mass / length,
                                1,
                                1,
                                1,
                                Jx=Jx / 2)  # /2 because added to both ends
        self.endoffset = RigidConnection('endoffset', [0, 0, length / 2])
        self.endbody = RigidBody('end', endmass)

        self.pivot.add_leaf(self.offset)
        self.offset.add_leaf(self.axis)
        self.axis.add_leaf(self.body)

        self.pivot.add_leaf(self.endoffset)
        self.endoffset.add_leaf(self.endbody)
        self.system = System(self.pivot)

        # Prescribed DOF accelerations
        self.system.prescribe(self.axis, acc=0.0)  # constant rotational speed
        self.system.prescribe(self.body, acc=0.0)  # rigid beam
Example #3
0
    def __init__(self, length, radius, mass, spin, endmass):
        self.length = length
        self.radius = radius
        self.mass = mass
        self.spin = spin
        self.endmass = endmass

        x = np.linspace(-length / 2, length / 2)
        modes = linearisation.ModalRepresentation(
            x=x,
            shapes=np.zeros((len(x), 3, 0)),
            rotations=np.zeros((len(x), 3, 0)),
            density=np.ones_like(x) * mass / length,
            mass_axis=np.zeros((len(x), 2)),
            section_inertia=np.ones_like(x) * radius**2 / 4,
            freqs=np.zeros((0, )),
        )

        self.bearing = Hinge('bearing', [0, 0, 1])
        self.pivot = Hinge('pivot', [0, 1, 0])
        self.axis = Hinge('axis', [0, 0, 1], rotmat_y(-np.pi / 2))
        self.body = ModalElement('body', modes)
        self.offset = RigidConnection('offset', [0, 0, length / 2])
        self.endbody = RigidBody('end', endmass)

        self.bearing.add_leaf(self.pivot)
        self.pivot.add_leaf(self.axis)
        self.axis.add_leaf(self.body)
        self.pivot.add_leaf(self.offset)
        self.offset.add_leaf(self.endbody)
        self.system = System(self.bearing)

        # Prescribed DOF accelerations
        self.system.prescribe(self.axis, acc=0.0)  # constant rotational speed
    def __init__(self, length, radius, mass, spin, endmass):
        self.length = length
        self.radius = radius
        self.mass = mass
        self.spin = spin
        self.endmass = endmass

        x = np.linspace(-length/2, length/2)
        modes = linearisation.ModalRepresentation(
            x             =x,
            shapes        =np.zeros((len(x),3,0)),
            rotations     =np.zeros((len(x),3,0)),
            density       =np.ones_like(x) * mass/length,
            mass_axis     =np.zeros((len(x),2)),
            section_inertia=np.ones_like(x) * radius**2 / 4,
            freqs         =np.zeros((0,)),
        )

        self.bearing = Hinge('bearing', [0,0,1])
        self.pivot   = Hinge('pivot',   [0,1,0])
        self.axis    = Hinge('axis',    [0,0,1], rotmat_y(-np.pi/2))
        self.body    = ModalElement('body', modes)
        self.offset  = RigidConnection('offset', [0,0,length/2])
        self.endbody = RigidBody('end', endmass)

        self.bearing.add_leaf(self.pivot)
        self.pivot.add_leaf(self.axis)
        self.axis.add_leaf(self.body)
        self.pivot.add_leaf(self.offset)
        self.offset.add_leaf(self.endbody)
        self.system = System(self.bearing)

        # Prescribed DOF accelerations
        self.system.prescribe(self.axis, acc=0.0) # constant rotational speed
Example #5
0
    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()
        #self.tmodes = self.tower.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))
        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, mode_source_file, root_length=0):
        # Modal element using data from Bladed model
        print "Loading modes from '%s'..." % mode_source_file
        self.modes = ModalRepresentation.from_Bladed(mode_source_file)

        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.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.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.bearing)

        # Prescribed DOF accelerations - constant rotor speed
        self.system.prescribe(self.bearing.istrain, vel=0.0, acc=0.0)

        # setup integrator
        self.integ = Integrator(self.system, ('pos', 'vel'))
        self.integ.add_output(dynamics.LoadOutput(self.bearing.iprox))
        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.CustomOutput(lambda s: b.station_positions()[-1],
                                      label="{} tip defl".format(b)))
        for b in (self.blade1, self.blade2, self.blade3):
            self.integ.add_output(
                dynamics.CustomOutput(lambda s: dot(b.Rp,
                                                    b.station_positions()[-1]),
                                      label="{} tip pos".format(b)))
Example #7
0
    def __init__(self, mode_source_file, root_length=0, wind_table=None):
        # Modal element using data from Bladed model
        print "Loading modes from '%s'..." % mode_source_file
        self.blade = Blade(mode_source_file)
        self.modes = self.blade.modal_rep()
        
        if wind_table is not None:
            loading = BladeLoading(self.blade, wind_table, None)
        else:
            loading = None

        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.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, loading)
        self.blade2 = ModalElement('blade2', self.modes)
        self.blade3 = ModalElement('blade3', self.modes)
        
        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.bearing)

        # Prescribed DOF accelerations - constant rotor speed
        self.system.prescribe(self.bearing, vel=0.0, acc=0.0)
        
        # setup integrator
        self.integ = Integrator(self.system, ('pos','vel'))
        self.integ.add_output(dynamics.LoadOutput(self.bearing.iprox))
        self.integ.add_output(dynamics.LoadOutput(self.blade1.iprox, local=True))
        self.integ.add_output(self.blade1.output_deflections())
        self.integ.add_output(self.blade1.output_positions())
    def __init__(self, mode_source_file, root_length=0):
        # Modal element using data from Bladed model
        print "Loading modes from '%s'..." % mode_source_file
        self.modes = ModalRepresentation.from_Bladed(mode_source_file)

        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.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.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.bearing)

        # Prescribed DOF accelerations - constant rotor speed
        self.system.prescribe(self.bearing.istrain, vel=0.0, acc=0.0)
        
        # setup integrator
        self.integ = Integrator(self.system, ('pos','vel'))
        self.integ.add_output(dynamics.LoadOutput(self.bearing.iprox))
        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.CustomOutput(
                lambda s: b.station_positions()[-1], label="{} tip defl".format(b)))
        for b in (self.blade1, self.blade2, self.blade3):
            self.integ.add_output(dynamics.CustomOutput(
                lambda s: dot(b.Rp, b.station_positions()[-1]), label="{} tip pos".format(b)))
Example #9
0
    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))
Example #10
0
# 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)

# Modal element
base = RigidConnection('base', rotation=rotmat_y(-np.pi / 2))
el = ModalElement('el', modes, distal=True, damping_freqs=[8.269, 10.248])
rna = RigidBody('rna',
                24000,
                np.diag([6400003, 6400003, 4266667]),
                nodal_load=loadfunc)
base.add_leaf(el)
el.add_leaf(rna)
system = System(base)

integ = Integrator(system)
integ.add_output(el.output_deflections())
integ.add_output(el.output_rotations())
integ.add_output(dynamics.LoadOutput(rna.iprox))

linsys = LinearisedSystem(system)
Example #11
0
dynamics.gravity = 0

bladedpath = '/bladed/gyro_effects/simpleblade_10rpm_10degs'

# Modal element using data from Bladed model
print "Loading modes from '%s'..." % bladedpath
modes = ModalRepresentation.from_Bladed(bladedpath + '.$pj')

rotorspeed = 10 * np.pi / 30  # 10 rpm
overhang = 1  # 1m

# Modal element
yaw = Hinge('yaw', [0, 0, 1])
overhang = RigidConnection('overhang', [-overhang, 0, 0])
bearing = Hinge('bearing', [1, 0, 0],
                np.dot(rotmat_y(-np.pi / 2), rotmat_x(-np.pi / 2)))
el = ModalElement('el', modes)
yaw.add_leaf(overhang)
overhang.add_leaf(bearing)
bearing.add_leaf(el)
system = System(yaw)

# Prescribe rotation speed
system.prescribe(bearing.istrain, 0.0)
system.qd[bearing.istrain] = rotorspeed

# Prescribed yaw angle
acc_period = 0.1
yaw_time1 = 3.0
yaw_time2 = 6.0
dvyaw = 10 * np.pi / 180
Example #12
0
    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))
Example #13
0
    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))
dynamics.gravity = 0

bladedpath = '/bladed/gyro_effects/simpleblade_10rpm_10degs'

# Modal element using data from Bladed model
print "Loading modes from '%s'..." % bladedpath
modes = ModalRepresentation.from_Bladed(bladedpath+'.$pj')

rotorspeed = 10 * np.pi/30 # 10 rpm
overhang = 1 # 1m

# Modal element
yaw = Hinge('yaw', [0,0,1])
overhang = RigidConnection('overhang', [-overhang,0,0])
bearing = Hinge('bearing', [1,0,0],np.dot(rotmat_y(-np.pi/2), rotmat_x(-np.pi/2)))
el = ModalElement('el', modes)
yaw.add_leaf(overhang)
overhang.add_leaf(bearing)
bearing.add_leaf(el)
system = System(yaw)

# Prescribe rotation speed
system.prescribe(bearing.istrain, 0.0)
system.qd[bearing.istrain] = rotorspeed

# Prescribed yaw angle
acc_period = 0.1
yaw_time1 = 3.0
yaw_time2 = 6.0
dvyaw = 10 * np.pi/180
Example #15
0
import numpy as np
from numpy import pi, zeros, diag
from dynamics import (FreeJoint, Hinge, rotmat_x, rotmat_y,
    EulerBeam, RigidConnection, System, solve_system, NQD)
import matplotlib.pylab as plt
import dynvis

tower_height = 90.0
overhang = 0.8
r_root = 0.5
blade_length = 60.0

EIy = 1000e6
EIz = 1000e6

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)

fstiff = 1e6 * diag([1, 1, 5, 1000, 1000, 100])
foundation = FreeJoint('foundation', fstiff, post_transform=rotmat_y(-pi/2))
tower = EulerBeam('tower', tower_height, 3000, 100e6, 300e6, 300e6, 200e6)
nacelle = RigidConnection('nacelle', [0,0,overhang], rotmat_y(100*pi/180))
bearing = Hinge('bearing', [1,0,0])
hb1 = RigidConnection('hb1', np.dot(Rhb1,[0,0,1]), np.dot(Rhb1,Ry))
hb2 = RigidConnection('hb2', np.dot(Rhb2,[0,0,1]), np.dot(Rhb2,Ry))
hb3 = RigidConnection('hb3', np.dot(Rhb3,[0,0,1]), np.dot(Rhb3,Ry))
b1 = EulerBeam('b1',blade_length, 250, 1000e6, EIy, EIz, 200e6)
b2 = EulerBeam('b2',blade_length, 250, 1000e6, EIy, EIz, 200e6)
b3 = EulerBeam('b3',blade_length, 250, 1000e6, EIy, EIz, 200e6)
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)

# Modal element
base = RigidConnection('base', rotation=rotmat_y(-np.pi/2))
el = ModalElement('el', modes, distal=True, damping_freqs=[8.269, 10.248])
rna = RigidBody('rna', 24000, np.diag([6400003, 6400003, 4266667]), nodal_load=loadfunc)
base.add_leaf(el)
el.add_leaf(rna)
system = System(base)

integ = Integrator(system)
integ.add_output(el.output_deflections())
integ.add_output(el.output_rotations())
integ.add_output(dynamics.LoadOutput(rna.iprox))

linsys = LinearisedSystem(system)

def ani_xy(s,t,y):
    return dynvis.anim(s, t, y, (0,1), (-5,45), (-5,5), velocities=False)
# 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)

# Modal element
base = RigidConnection("base", rotation=rotmat_y(-np.pi / 2))
el = DistalModalElement("el", modes, distal=True, damping_freqs=modes2.freqs)
# el = ModalElement('el', modes, distal=True, damping_freqs=modes2.freqs)
rna = RigidBody("rna", 24000, np.diag([6400003, 6400003, 4266667]), nodal_load=loadfunc)
base.add_leaf(el)
el.add_leaf(rna)
system = System(base)

system.prescribe(el, vel=0, part=[0, 3])

integ = Integrator(system)
integ.add_output(el.output_deflections())
integ.add_output(el.output_rotations())
integ.add_output(dynamics.LoadOutput(rna.iprox))

linsys = LinearisedSystem(system)