本文整理匯總了Python中mbwind.System.find_equilibrium方法的典型用法代碼示例。如果您正苦於以下問題:Python System.find_equilibrium方法的具體用法?Python System.find_equilibrium怎麽用?Python System.find_equilibrium使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mbwind.System
的用法示例。
在下文中一共展示了System.find_equilibrium方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_deflection_under_load
# 需要導入模塊: from mbwind import System [as 別名]
# 或者: from mbwind.System import find_equilibrium [as 別名]
def test_deflection_under_load(self):
F = 4.2 # N/m
M = (F * self.length) * (self.length / 2)
expected_rotation = M / self.stiffness
expected_tip_motion = expected_rotation * self.length
# First, calculate directly
loading = zeros((50, 3))
loading[:, 2] = F
Qr, Qw, Qs = self.beam.modes.distributed_loading(loading, [0])
actual_tip_motion = Qs / self.beam.stiffness
assert_aae(actual_tip_motion[0], expected_tip_motion, decimal=4)
# Now check using system equilibrium
self.beam.loading = lambda beam, time: loading
system = System()
system.add_leaf(self.beam)
system.setup()
system.find_equilibrium()
actual_tip_motion2 = system.q[system.elements['beam'].istrain]
assert_aae(actual_tip_motion2[0], expected_tip_motion, decimal=4)
示例2: test_find_equilibrium
# 需要導入模塊: from mbwind import System [as 別名]
# 或者: from mbwind.System import find_equilibrium [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)