def test_bearing_6dof_equality(): bearing_6dof_0 = BearingElement6DoF(n=0, kxx=1e6, kyy=0.8e6, kzz=1e5, cxx=2e2, cyy=1.5e2, czz=0.5e2) bearing_6dof_1 = BearingElement6DoF(n=0, kxx=1e6, kyy=0.8e6, kzz=1e5, cxx=2e2, cyy=1.5e2, czz=0.5e2) bearing_6dof_2 = BearingElement6DoF(n=0, kxx=2e6, kyy=0.8e6, kzz=1e5, cxx=2e2, cyy=1.5e2, czz=0.5e2) assert bearing_6dof_0 == bearing_6dof_1 assert not bearing_6dof_1 == bearing_6dof_2 assert not bearing_6dof_0 == bearing_6dof_2
def bearing_6dof(): bearing_6dof = BearingElement6DoF(n=0, kxx=1e6, kyy=0.8e6, kzz=1e5, cxx=2e2, cyy=1.5e2, czz=0.5e2) return bearing_6dof
def test_save_load(bearing0, bearing_constant, bearing_6dof): file = Path(tempdir) / "bearing0.toml" bearing0.save(file) bearing0_loaded = BearingElement.load(file) assert bearing0 == bearing0_loaded file = Path(tempdir) / "bearing_constant.toml" bearing_constant.save(file) bearing_constant_loaded = BearingElement.load(file) assert bearing_constant == bearing_constant_loaded file = Path(tempdir) / "bearing_6dof.toml" bearing_6dof.save(file) bearing_6dof_loaded = BearingElement6DoF.load(file) assert bearing_6dof == bearing_6dof_loaded
def test_bearing_6dof(): bearing_6dof = BearingElement6DoF(n=0, kxx=1e6, kyy=0.8e6, kzz=1e5, cxx=2e2, cyy=1.5e2, czz=0.5e2) # fmt: off K = np.array([[1000000., 0., 0.], [0., 800000., 0.], [0., 0., 100000.]]) C = np.array([[200., 0., 0.], [0., 150., 0.], [0., 0., 50.]]) M = np.zeros((3, 3)) G = np.zeros((3, 3)) # fmt: on assert_allclose(bearing_6dof.K(0), K, rtol=1e-3) assert_allclose(bearing_6dof.C(0), C, rtol=1e-3) assert_allclose(bearing_6dof.M(), M, rtol=1e-3) assert_allclose(bearing_6dof.G(), G, rtol=1e-3)
def test_save_load(bearing0, bearing_constant, bearing_6dof, magnetic_bearing): file = Path(tempdir) / "bearing0.toml" bearing0.save(file) bearing0_loaded = BearingElement.load(file) assert bearing0 == bearing0_loaded file = Path(tempdir) / "bearing_constant.toml" bearing_constant.save(file) bearing_constant_loaded = BearingElement.load(file) assert bearing_constant == bearing_constant_loaded file = Path(tempdir) / "bearing_6dof.toml" bearing_6dof.save(file) bearing_6dof_loaded = BearingElement6DoF.load(file) assert bearing_6dof == bearing_6dof_loaded file = Path(tempdir) / "magnetic_bearing.toml" magnetic_bearing.save(file) magnetic_bearing_loaded = MagneticBearingElement.load(file) assert magnetic_bearing == magnetic_bearing_loaded