本文整理汇总了Python中mbwind.System.solve_accelerations方法的典型用法代码示例。如果您正苦于以下问题:Python System.solve_accelerations方法的具体用法?Python System.solve_accelerations怎么用?Python System.solve_accelerations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mbwind.System
的用法示例。
在下文中一共展示了System.solve_accelerations方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_solve_accelerations
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import solve_accelerations [as 别名]
def test_solve_accelerations(self):
# solve_accelerations() should find:
# (a) response of system to forces (here, gravity)
# (b) include any prescribed accelerations in qdd vector
g = 9.81
s = System(gravity=g)
j = FreeJoint('joint')
b = RigidBody('body', mass=23.54, inertia=52.1 * np.eye(3))
s.add_leaf(j)
j.add_leaf(b)
s.setup()
# Prescribe horizontal acceleration. Vertical acceleration
# should result from gravity.
s.prescribe(j, 2.3, part=[0]) # x acceleration
# Initially accelerations are zero
assert_aae(j.ap, 0)
assert_aae(j.ad, 0)
assert_aae(j.astrain, 0)
# Solve accelerations & check
s.solve_accelerations()
s.update_kinematics()
assert_aae(j.ap, 0) # ground
assert_aae(j.ad, [2.3, 0, -g, 0, 0, 0])
assert_aae(j.astrain, j.ad) # not always true, but works for FreeJoint
示例2: test_solve_accelerations_coupling
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import solve_accelerations [as 别名]
def test_solve_accelerations_coupling(self):
# Further to test above, check that coupling between prescribed
# accelerations and other dofs is correct. For example, if there
# is a rigid body vertically offset from the joint, then a
# prescribed horizontal acceleration should cause an angular
# acceleration as well as the translational acceleration.
s = System()
j = FreeJoint('joint')
c = RigidConnection('conn', [0, 0, 1.7])
b = RigidBody('body', mass=23.54, inertia=74.1 * np.eye(3))
s.add_leaf(j)
j.add_leaf(c)
c.add_leaf(b)
s.setup()
# Prescribe horizontal acceleration, solve other accelerations
s.prescribe(j, 2.3, part=[0]) # x acceleration
s.update_kinematics() # update system to show prescribed acc
s.solve_accelerations() # solve free accelerations
s.update_kinematics() # update system to show solution
# Ground shouldn't move
assert_aae(j.ap, 0)
# Need angular acceleration = (m a_x L) / I0
I0 = 74.1 + (23.54 * 1.7**2)
expected_angular_acc = -(23.54 * 2.3 * 1.7) / I0
assert_aae(j.ad, [2.3, 0, 0, 0, expected_angular_acc, 0])
assert_aae(j.astrain, j.ad) # not always true, but works for FreeJoint
示例3: test_distal_forces_cause_acceleration
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import solve_accelerations [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])
示例4: hinged_beam_tests
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import solve_accelerations [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
示例5: test_find_equilibrium
# 需要导入模块: from mbwind import System [as 别名]
# 或者: from mbwind.System import solve_accelerations [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)