Beispiel #1
0
    def __init__(self, length, radius, mass, spin):
        self.length = length
        self.radius = radius
        self.mass = mass
        self.spin = spin

        x = np.linspace(0, length)
        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', [1, 0, 0])
        self.body = ModalElement('body', modes)

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

        # Prescribed DOF accelerations
        self.system.prescribe(self.axis.istrain,
                              0.0)  # constant rotational speed
Beispiel #2
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, 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)))
Beispiel #4
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())
Beispiel #5
0
    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)

        self.bearing = Hinge('bearing', [0, 0, 1])
        self.offset = RigidConnection('offset', [root_length, 0, 0])
        self.blade = ModalElement('blade', self.modes)
        self.bearing.add_leaf(self.offset)
        self.offset.add_leaf(self.blade)
        self.system = System(self.bearing)

        # Prescribed DOF accelerations
        self.system.prescribe(self.bearing.istrain, vel=0.0,
                              acc=0.0)  # constant spin speed
print "Loading modes from '%s'..." % path_damped
modes = ModalRepresentation.from_Bladed(path_damped+'.$pj')
print "Loading modes from '%s'..." % path_undamped
modes0 = ModalRepresentation.from_Bladed(path_undamped+'.$pj')

# Blade loading
wind_table = np.array([
    [0, 1, 2,  10], # time
    [0, 0, 0,  0 ], # x
    [0, 0, 20, 20], # y
    [0, 0, 0,  0 ], # z
])
loading = BladeLoading(modes.x, wind_table, None)

# Modal element
el = ModalElement('el', modes, loading)
system = System(el)
el0 = ModalElement('el0', modes0, loading)
system0 = System(el0)

integ = Integrator(system)
integ0 = Integrator(system0)
integ.add_output(el.output_positions(stations=[16,32]))
integ0.add_output(el0.output_positions(stations=[16,32]))

#def simulate(system, t1=2.0, dt=0.005):

# Load Bladed data for comparison
import pybladed.data
brun = pybladed.data.BladedRun(path_damped)
bladed_defl = np.c_[
Beispiel #7
0
import numpy as np
from scipy.linalg import eig
import matplotlib.pyplot as plt

import dynamics
from dynamics import System, ModalElement, solve_system
from linearisation import LinearisedSystem, ModalRepresentation
import dynvis

dynamics.gravity = 0

# Modal element using data from Bladed model
print "Loading modes from 'demo_a.prj'..."
modes = ModalRepresentation.from_Bladed('demo_a_simplified.prj')
el = ModalElement('el', modes)
system = System(el)

# Linearise system and find modes - should match with original
print "Linearising..."
linsys = LinearisedSystem(system)
w, v = eig(linsys.K, linsys.M)
order = np.argsort(w)
w = np.sqrt(np.real(w[order]))
f = w / 2 / np.pi
v = v[:, order]

# Check that modes come out matching what went in
assert np.allclose(modes.freqs, w), "Linearised freqs should match"
ventries = np.nonzero(abs(v) > 1e-2)[0]
assert len(ventries) == len(w) and (ventries == np.arange(4)).all(), \
Beispiel #8
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)
# 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'), ]

#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=combined_freqs)
rna = RigidBody('rna',
                109993,
                np.diag([19406630, 19406630, 38813240]),
                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)
Beispiel #10
0
print "Loading blade from '%s'..." % bladed_path
blade = Blade(bladed_path+'.$pj')
modes = blade.modal_rep()

# Blade loading
wind_table = np.array([
    [0, 1, 2,  10], # time
    [0, 0, 20, 20], # x
    [0, 0, 0,  0 ], # y
    [0, 0, 0,  0 ], # z
])
loading = BladeLoading(blade, wind_table, None)

# Modal element
base = RigidConnection('base', rotation=rotmat_y(-np.pi/2))
el = ModalElement('el', modes, loading)
base.add_leaf(el)
system = System(base)

integ = Integrator(system)
integ.add_output(el.output_deflections(stations=[8,16]))
integ.add_output(dynamics.CustomOutput(
    lambda s: el._get_loading()[8,:], 'loading'))
integ.add_output(dynamics.CustomOutput(
    lambda s: el.loading.relspeed, 'relspeed'))

# Load Bladed data for comparison
import pybladed.data
brun = pybladed.data.BladedRun(bladed_path)
bladed_defl = np.c_[
    brun.get('blade 1 x-deflection;1'),
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())
integ2 = Integrator(system2, outputs=('pos', 'vel', 'acc'))
integ2.add_output(el2.output_positions())
integ2.add_output(dynamics.NodeOutput(body.iprox))
integ2.add_output(dynamics.NodeOutput(body.iprox, deriv=2))
integ2.add_output(dynamics.LoadOutput(body.iprox))
integ2.add_output(dynamics.StrainOutput(el2.imult))
Beispiel #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))