Exemplo n.º 1
0
    def test_1dof_nonlinear_system(self):
        s = System()
        j = PrismaticJoint('joint', [0, 0, 1])
        k = 0.45  # quadratic stiffness coefficient
        j.internal_force = lambda el, t: -k * el.xstrain[0]**2
        b = RigidBody('body', 10)
        s.add_leaf(j)
        j.add_leaf(b)
        s.setup()

        # Linearise around z0 = 0: stiffness should be zero
        linsys = LinearisedSystem.from_system(s, z0=0)
        assert_aae(linsys.M, [[10.0]])
        assert_aae(linsys.C, [[0.0]])
        assert_aae(linsys.K, [[0.0]])

        # Linearise about z0 = 2: stiffness should be 2kx
        linsys = LinearisedSystem.from_system(s, z0=[2])
        assert_aae(linsys.M, [[10.0]])
        assert_aae(linsys.C, [[0.0]])
        assert_aae(linsys.K, [[2 * k * 2]])

        # Test setting z0 in another way
        linsys = LinearisedSystem.from_system(s, z0={'joint': [4.2]})
        assert_aae(linsys.M, [[10.0]])
        assert_aae(linsys.C, [[0.0]])
        assert_aae(linsys.K, [[2 * k * 4.2]])
Exemplo n.º 2
0
    def test_1dof_nonlinear_system(self):
        s = System()
        j = PrismaticJoint('joint', [0, 0, 1])
        k = 0.45  # quadratic stiffness coefficient
        j.internal_force = lambda el, t: -k * el.xstrain[0]**2
        b = RigidBody('body', 10)
        s.add_leaf(j)
        j.add_leaf(b)
        s.setup()

        # Linearise around z0 = 0: stiffness should be zero
        linsys = LinearisedSystem.from_system(s, z0=0)
        assert_aae(linsys.M, [[10.0]])
        assert_aae(linsys.C, [[0.0]])
        assert_aae(linsys.K, [[0.0]])

        # Linearise about z0 = 2: stiffness should be 2kx
        linsys = LinearisedSystem.from_system(s, z0=[2])
        assert_aae(linsys.M, [[10.0]])
        assert_aae(linsys.C, [[0.0]])
        assert_aae(linsys.K, [[2 * k * 2]])

        # Test setting z0 in another way
        linsys = LinearisedSystem.from_system(s, z0={'joint': [4.2]})
        assert_aae(linsys.M, [[10.0]])
        assert_aae(linsys.C, [[0.0]])
        assert_aae(linsys.K, [[2 * k * 4.2]])
Exemplo n.º 3
0
    def test_1dof_linear_system(self):
        s = System()
        j = PrismaticJoint('joint', [0, 0, 1])
        j.stiffness = 5.0
        j.damping = 2.3
        b = RigidBody('body', 10)
        s.add_leaf(j)
        j.add_leaf(b)
        s.setup()

        linsys = LinearisedSystem.from_system(s)

        assert_array_equal(linsys.M, [[10.0]])
        assert_array_equal(linsys.C, [[2.3]])
        assert_array_equal(linsys.K, [[5.0]])
Exemplo n.º 4
0
    def test_1dof_linear_system(self):
        s = System()
        j = PrismaticJoint('joint', [0, 0, 1])
        j.stiffness = 5.0
        j.damping = 2.3
        b = RigidBody('body', 10)
        s.add_leaf(j)
        j.add_leaf(b)
        s.setup()

        linsys = LinearisedSystem.from_system(s)

        assert_array_equal(linsys.M, [[10.0]])
        assert_array_equal(linsys.C, [[2.3]])
        assert_array_equal(linsys.K, [[5.0]])
Exemplo n.º 5
0
    def linearised_system(self, z0=None, zd0=None, mbc=False, perturbation=None):

        # Linearise the system about the given operating point
        self.system.update_kinematics()
        linsys = LinearisedSystem.from_system(self.system, z0=z0, zd0=zd0, perturbation=perturbation)

        # Apply multi-blade coordinate transform if needed
        if mbc:
            iazimuth = self.system.free_dof_indices("shaft")[0]
            iblades = [self.system.free_dof_indices("blade{}".format(i + 1)) for i in range(3)]
            if mbc == 2:
                linsys = linsys.multiblade_transform2(iazimuth, iblades)
            else:
                linsys = linsys.multiblade_transform(iazimuth, iblades)

        return linsys
Exemplo n.º 6
0
    def linearised_system(self, z0=None, zd0=None, mbc=False,
                          perturbation=None):

        # Linearise the system about the given operating point
        self.system.update_kinematics()
        linsys = LinearisedSystem.from_system(self.system, z0=z0, zd0=zd0,
                                              perturbation=perturbation)

        # Apply multi-blade coordinate transform if needed
        if mbc:
            iazimuth = self.system.free_dof_indices('shaft')[0]
            iblades = [self.system.free_dof_indices('blade{}'.format(i+1))
                       for i in range(3)]
            if mbc == 2:
                linsys = linsys.multiblade_transform2(iazimuth, iblades)
            else:
                linsys = linsys.multiblade_transform(iazimuth, iblades)

        return linsys
Exemplo n.º 7
0
def structure(rigid_body_configs):
    system = build_structure(rigid_body_configs)
    system.update_kinematics()
    linsys = LinearisedSystem.from_system(system)
    return LinearSystem(linsys.M, linsys.C, linsys.K)
Exemplo n.º 8
0
def structure(rigid_body_configs):
    system = build_structure(rigid_body_configs)
    system.update_kinematics()
    linsys = LinearisedSystem.from_system(system)
    return LinearSystem(linsys.M, linsys.C, linsys.K)