本文整理汇总了Python中mbwind.System.update_matrices方法的典型用法代码示例。如果您正苦于以下问题:Python System.update_matrices方法的具体用法?Python System.update_matrices怎么用?Python System.update_matrices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mbwind.System
的用法示例。
在下文中一共展示了System.update_matrices方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_distal_forces_cause_acceleration
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import update_matrices [as 别名]
def test_distal_forces_cause_acceleration(self):
j = FreeJoint('joint')
b = RigidBody('body', mass=3, inertia=np.diag([7, 7, 7]))
s = System()
s.add_leaf(j)
j.add_leaf(b)
s.setup()
# Constant loading
j.distal_forces = np.array([2, 0, 0, 0, 0, 0])
s.update_kinematics()
s.update_matrices()
s.solve_accelerations()
s.update_kinematics()
assert_array_equal(j.ad, [2. / 3, 0, 0, 0, 0, 0])
示例2: TestReactionForcesForCentrifugalForce
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import update_matrices [as 别名]
class TestReactionForcesForCentrifugalForce(unittest.TestCase):
"""
System
------
A rigid body with offset mass, attached to a spinning hinge.
Tests
-----
Check centrifugal force reaction on hinge is in correct direction.
"""
mass = 5.0 # kg
offset = 3.2 # m
def setUp(self):
# Rigid body with offset centre of mass
self.body = RigidBody("body", self.mass, Xc=[self.offset, 0, 0])
# Hinge with axis along Z axis
self.hinge = Hinge("hinge", [0, 0, 1])
# Build system
self.system = System()
self.system.add_leaf(self.hinge)
self.hinge.add_leaf(self.body)
self.system.setup()
self.system.update_kinematics() # Set up nodal values initially
self.system.update_matrices()
def test_reactions(self):
# Set angular acceleration
w = 5.21 # rad/s
self.hinge.vstrain[0] = w
self.system.update_kinematics() # Update nodal values based on DOFs
self.system.update_matrices()
self.system.solve_reactions() # Solve reactions incl d'Alembert
# Some parameters
L = self.offset
m = self.mass
# Check reactions at beam root
Pg = self.system.joint_reactions["ground"]
P0 = self.system.joint_reactions["node-0"]
Fx_expected = -m * L * w ** 2
assert_aae(P0, [Fx_expected, 0, 0, 0, 0, 0])
assert_aae(Pg, P0)
示例3: hinged_beam_tests
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import update_matrices [as 别名]
class hinged_beam_tests(unittest.TestCase):
density = 5.0
length = 20.0
force = 34.2 # N/m
hinge_torque = 0.0
free_beam = False
def setUp(self):
# FE model for beam
x = linspace(0, self.length, 20)
fe = BeamFE(x, density=self.density, EA=0, EIy=1, EIz=0)
fe.set_boundary_conditions('C', 'F')
self.beam = ModalElementFromFE('beam', fe, 0)
# Set loading - in negative Z direction
load = np.zeros((len(x), 3))
load[:, 2] = -self.force
self.beam.loading = load
# Hinge with axis along Y axis
self.hinge = Hinge('hinge', [0, 1, 0])
self.hinge.internal_torque = self.hinge_torque
# Build system
self.system = System()
self.system.add_leaf(self.hinge)
self.hinge.add_leaf(self.beam)
self.system.setup()
if not self.free_beam:
# Prescribe hinge to be fixed
self.system.prescribe(self.hinge)
# Initial calculations
self.recalc()
def recalc(self):
self.system.update_kinematics() # Set up nodal values initially
self.system.update_matrices()
self.system.solve_accelerations() # Calculate accelerations of DOFs
self.system.update_kinematics() # Update nodal values based on DOFs
self.system.update_matrices()
self.system.solve_reactions() # Solve reactions incl d'Alembert
示例4: test_find_equilibrium
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import update_matrices [as 别名]
def test_find_equilibrium(self):
g = 9.81
m = 23.1
k = 45.2
s = System(gravity=g)
slider = PrismaticJoint('slider', [0, 0, 1])
slider.stiffness = k
body = RigidBody('body', mass=m)
s.add_leaf(slider)
slider.add_leaf(body)
s.setup()
# Initially position should be zero and acceleration nonzero
s.solve_accelerations()
assert_aae(slider.xstrain, 0)
assert_aae(slider.astrain, -g)
# At equilibrium, position should be nozero and force on body zero
s.find_equilibrium()
s.update_matrices() # recalculate stiffness force
s.solve_accelerations()
assert_aae(slider.xstrain, -m * g / k)
assert_aae(slider.astrain, 0)
示例5: TestReactionForcesWithRotatedBeam
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import update_matrices [as 别名]
class TestReactionForcesWithRotatedBeam(unittest.TestCase):
"""Intended to check the transformation from blade loading to rotor
loading in a wind turbine rotor: the loads are applied to the beam
in the local rotated coordinate system, check they work through to
the ground reactions correctly.
"""
force = 24.1
length = 4.3
root_length = 0.0
def setUp(self):
# FE model for beam - no modes, i.e. rigid
self.x = x = linspace(0, self.length, 20)
fe = BeamFE(x, density=2, EA=0, EIy=0, EIz=0)
# Build the elements
self.shaft = Hinge('shaft', [1, 0, 0])
self.roots = []
self.blades = []
self.pitch_bearings = []
for ib in range(1):
R = rotations(('x', ib*2*pi/3), ('y', -pi/2))
root_offset = dot(R, [self.root_length, 0, 0])
root = RigidConnection('root%d' % (ib+1), root_offset, R)
bearing = Hinge('pitch%d' % (ib+1), [1, 0, 0])
blade = ModalElementFromFE('blade%d' % (ib+1), fe, 0)
self.shaft.add_leaf(root)
root.add_leaf(bearing)
bearing.add_leaf(blade)
self.roots.append(root)
self.blades.append(blade)
self.pitch_bearings.append(bearing)
# Build system
self.system = System()
self.system.add_leaf(self.shaft)
self.system.setup()
self.system.update_kinematics() # Set up nodal values initially
self.system.update_matrices()
def test_reactions(self):
# Some parameters
L = self.length
F = self.length * self.force
# Set loading - in local z direction
load = np.zeros((len(self.x), 3))
load[:, 2] = self.force
self.blades[0].loading = load
self.system.update_kinematics()
self.system.update_matrices()
self.system.solve_reactions()
# Check reactions at ground (0, 0, 0)
P = -self.system.joint_reactions['ground']
F_expected = [-F, 0, 0]
M_expected = [0, -F*(L+self.root_length)/2, 0]
assert_aae(P, np.r_[F_expected, M_expected])
# Reactions on other side of hinge
P2 = -self.system.joint_reactions['node-0']
assert_aae(P, P2)
# Now set pitch angle to 45deg
# NB: hinge rotation is opposite to wind turbine pitch convention
self.pitch_bearings[0].xstrain[0] = -pi / 4
self.system.update_kinematics()
self.system.update_matrices()
self.system.solve_reactions()
# Check reactions at ground (0, 0, 0)
P = -self.system.joint_reactions['ground']
F_expected = [-F/sqrt(2), F/sqrt(2), 0]
M_expected = [-F/sqrt(2)*L/2, -F/sqrt(2)*L/2, 0]
assert_aae(P, np.r_[F_expected, M_expected])
# Reactions on other side of hinge
P2 = -self.system.joint_reactions['node-0']
assert_aae(P, P2)