def test_rectangle_section_self_weight_reaction(self): ss = system.SystemElements() ss.add_element([[0, 0], [2, 0]], h=0.1, b=0.1, E=210e9, sw=True, gamma=10000) ss.add_support_hinged(1) ss.add_support_hinged(2) ss.solve() self.assertAlmostEqual(-100, ss.reaction_forces[1].Fz)
def test_sectionbase_steel_section_self_weight_reaction(self): ss = system.SystemElements() ss.add_element([[0, 0], [20, 0]], steelsection='IPE 300', sw=True) ss.add_support_hinged(1) ss.add_support_hinged(2) ss.solve() self.assertAlmostEqual(-4224.24, ss.reaction_forces[1].Fz)
def test_multiple_elements_spacing(self): ss = se.SystemElements(EI=5e3, EA=1e5) ss.add_multiple_elements([[0, 0], [10, 0]], 100) ss.add_support_fixed(1) ss.point_load(ss.id_last_node, Fy=-10) ss.solve() self.assertAlmostEqual(2 / 3, ss.get_node_results_system(-1)["uy"])
def test_circle_section_self_weight_reaction(self): ss = system.SystemElements() ss.add_element([[0, 0], [2, 0]], d=0.2, E=210e9, sw=True, gamma=10000) ss.add_support_hinged(1) ss.add_support_hinged(2) ss.solve() self.assertAlmostEqual(-314.15926535, ss.reaction_forces[1].Fz)
def test_truss_single_hinge(self): ss = se.SystemElements(EA=68300, EI=128, mesh=50) ss.add_element( location=[[0.0, 0.0], [2.5, 0.0]], g=0, spring={1: 0, 2: 0}, ) ss.add_element( location=[[0.0, 0.0], [2.5, 2.0]], g=0, spring={1: 0, 2: 0}, ) ss.add_element( location=[[2.5, 0.0], [5.0, 0.0]], g=0, spring={1: 0, 2: 0}, ) ss.add_element( location=[[2.5, 2.0], [2.5, 0.0]], g=0, spring={1: 0, 2: 0}, ) ss.add_element( location=[[2.5, 2.0], [5.0, 0.0]], g=0, spring={1: 0, 2: 0}, ) ss.add_support_hinged(node_id=1) ss.add_support_hinged(node_id=4) ss.point_load(Fx=0, Fy=-20.0, node_id=3) ss.solve() self.assertAlmostEqual(-12.5, ss.get_node_results_system(1)["Fx"]) self.assertAlmostEqual(-10, ss.get_node_results_system(1)["Fy"]) self.assertAlmostEqual(0, ss.get_node_results_system(1)["Ty"]) self.assertAlmostEqual(0, ss.get_node_results_system(3)["Ty"])
def test_circle_section_deflection(self): ss = system.SystemElements() ss.add_multiple_elements([[0, 0], [2, 0]], n=2, d=0.07, E=210e9, sw=False) ss.add_support_hinged(1) ss.add_support_hinged(3) ss.point_load(2, Fy=-1000) ss.solve() self.assertAlmostEqual(-0.00067339, ss.get_node_displacements(2)["uy"])
def test_add_multiple_elements(self): ss = se.SystemElements() ss.add_multiple_elements([[0, 0], [10, 10]], n=5) sol = [0, 2.0, 4.0, 6.0, 8.0, 10] self.assertTrue( all([ np.isclose(a, b) for a, b in zip( sol, [x.vertex.x for x in ss.node_map.values()]) ]))
def test_inclined_roll_equal_to_horizontal_roll(self): ss = se.SystemElements() x = [0, 1, 2] y = [0, 1, 0] ss.add_element_grid(x, y) ss.add_support_hinged(1) ss.add_support_roll(3, "x") ss.point_load(2, Fy=-100) ss.solve() u1 = ss.get_node_results_system(3) ss = se.SystemElements() ss.add_element_grid(x, y) ss.add_support_hinged(1) ss.add_support_roll(3, angle=0) ss.point_load(2, Fy=-100) ss.solve() u2 = ss.get_node_results_system(3) for k in u1: self.assertTrue(np.isclose(u1[k], u2[k]))
def test_inclined_roll_force(self): ss = se.SystemElements() x = [0, 1, 2] y = [0, 0, 0] ss.add_element_grid(x, y) ss.add_support_hinged(1) ss.add_support_roll(3, angle=45) ss.point_load(2, Fy=-100) ss.solve() self.assertAlmostEqual(50, ss.get_node_results_system(3)["Fx"])
def test_inclined_roll_and_qload(self): ss = se.SystemElements(EA=356000, EI=1330) ss.add_element(location=[[0, 0], [10, 0]]) ss.add_support_hinged(node_id=1) ss.add_support_roll(node_id=-1, angle=45) ss.q_load(q=-1, element_id=1, direction="element") ss.solve() self.assertAlmostEqual(-5, ss.get_node_results_system(1)["Fx"]) self.assertAlmostEqual(-5, ss.get_node_results_system(1)["Fy"]) self.assertAlmostEqual(-5, ss.get_element_results(1)["N"])
def test_sectionbase_steel_section_deflection(self): ss = system.SystemElements() ss.add_multiple_elements( [[0, 0], [6, 0]], n=2, steelsection="IPE 300", E=210e9, sw=False, orient="y" ) ss.add_support_hinged(1) ss.add_support_hinged(3) ss.point_load(2, Fy=-10000) ss.solve() self.assertAlmostEqual(-0.00256442, ss.get_node_displacements(2)["uy"])
def test_rectangle_section_deflection(self): ss = system.SystemElements() ss.add_multiple_elements( [[0, 0], [2, 0]], n=2, h=0.05, b=0.16, E=210e9, sw=False, orient="y" ) ss.add_support_hinged(1) ss.add_support_hinged(3) ss.point_load(2, Fy=-1000) ss.solve() self.assertAlmostEqual(-0.00047619, ss.get_node_displacements(2)["uy"])
def test_vertical_spring(self): ss = se.SystemElements(mesh=250) ss.add_element( location=[(0.0, 0), (10.0, 0)], EA=356000.0, EI=1332.0000000000002 ) ss.add_support_hinged(node_id=1) ss.add_support_spring(node_id=2, translation=2, k=50, roll=False) ss.q_load(q=-1.0, element_id=1, direction="y") ss.solve() self.assertAlmostEqual(0.1, ss.get_node_results_system(2)["uy"])
def test_example_5(self): system = se.SystemElements() system.add_element(location=[[0, 0], [5, 0]], EA=5e9, EI=8000) system.add_element(location=[[5, 0], [5, -5]], EA=5e9, EI=4000) system.moment_load(Ty=10, node_id=3) system.add_support_hinged(node_id=1) system.add_support_hinged(node_id=3) sol = np.fromstring("""0.00000000e+00 0.00000000e+00 3.47221978e-04 2.66666645e-09 6.66666453e-10 -6.94444356e-04 0.00000000e+00 0.00000000e+00 3.47222298e-03""", float, sep=" ") self.assertTrue(np.allclose(system.solve(), sol))
def test_example_4(self): system = se.SystemElements() system.add_element(location=[[0, 0], [5, 0]], EA=5e9, EI=8000, spring={2: 0}) system.add_element(location=[[5, 0], [5, 5]], EA=5e9, EI=4000) system.moment_load(Ty=10, node_id=3) system.add_support_hinged(node_id=1) system.add_support_hinged(node_id=3) sol = np.fromstring("""0.00000000e+00 0.00000000e+00 -3.25525753e-21 2.00000000e-09 2.49096026e-25 -2.08333293e-03 0.00000000e+00 0.00000000e+00 4.16666707e-03""", float, sep=" ") self.assertTrue(np.allclose(system.solve(), sol))
def test_ex_6_fixed_hinge(self): """ Test the primary force vector when applying a q_load at a hinged element. """ ss = se.SystemElements() ss.add_element([[0, 0], [7, 0]], spring={2: 0}) ss.add_element([7.1, 0]) ss.add_support_fixed([1, 3]) ss.q_load(-10, 1) ss.solve() self.assertAlmostEqual(-61.25, ss.get_node_results_system(1)["Ty"], places=2)
def test_parallel_trapezoidal_load(self): ss = se.SystemElements() ss.add_element([0, 1]) ss.add_element([0, 2]) ss.add_support_hinged(1) ss.add_support_roll(3, "y") ss.q_load([0, -0.5], 1, "y") ss.q_load([-0.5, -1], 2, "y") ss.solve() self.assertAlmostEqual(-0.75, ss.get_element_results(2)["Nmin"]) self.assertAlmostEqual(0, ss.get_element_results(2)["Nmax"]) self.assertAlmostEqual(-1, ss.get_node_results_system(1)["Fy"])
def test_q_and_q_perp(self): ss = se.SystemElements() ss.add_element([2, 2]) ss.add_support_hinged(1) ss.add_support_hinged(2) ss.q_load([-2, -2], 1, "element", q_perp=[-1, -1]) ss.solve() self.assertAlmostEqual(-3, ss.get_node_results_system(1)["Fy"], 6) self.assertAlmostEqual(1, ss.get_node_results_system(1)["Fx"], 6) self.assertAlmostEqual(np.sqrt(2), ss.get_element_results(1)["Nmax"]) self.assertAlmostEqual(2 * np.sqrt(2), ss.get_element_results(1)["Qmax"])
def test_example_1(self): system = se.SystemElements(True) system.add_element(location=[[0, 0], [3, 4]], EA=5e9, EI=8000) system.add_element(location=[[3, 4], [8, 4]], EA=5e9, EI=4000) system.q_load(element_id=2, q=-10) system.add_support_hinged(node_id=1) system.add_support_fixed(node_id=3) sol = np.fromstring("""0.00000000e+00 0.00000000e+00 1.30206878e-03 1.99999732e-08 5.24999402e-08 -2.60416607e-03 0.00000000e+00 0.00000000e+00 0.00000000e+00""", float, sep=" ") self.assertTrue(np.allclose(system.solve(), sol))
def test_rotational_support(self): ss = se.SystemElements() ss.add_element(location=[(0, 0), (1, 0)]) ss.add_support_fixed(node_id=1) ss.add_support_rotational(node_id=2) ss.q_load(q=-1000, element_id=1, direction="y") ss.point_load(node_id=2, Fx=-100) ss.solve() self.assertAlmostEqual(0.0066667, ss.get_node_results_system(2)["ux"]) self.assertAlmostEqual(0.0083333, ss.get_node_results_system(2)["uy"]) self.assertAlmostEqual(0.0, ss.get_node_results_system(2)["phi_y"]) self.assertAlmostEqual(-166.6667083, ss.get_node_results_system(2)["Ty"])
def test_example_1(self): system = se.SystemElements() system.add_element(location=[[0, 0], [3, 4]], EA=5e9, EI=8000) system.add_element(location=[[3, 4], [8, 4]], EA=5e9, EI=4000) system.q_load(element_id=2, q=10) system.add_support_hinged(node_id=1) system.add_support_fixed(node_id=3) system.solve() system.show_structure(show=False) system.show_bending_moment(show=False) system.show_axial_force(show=False) system.show_reaction_force(show=False) system.show_shear_force(show=False)
def test_example_5(self): system = se.SystemElements() system.add_element(location=[[0, 0], [5, 0]], EA=5e9, EI=8000) system.add_element(location=[[5, 0], [5, 5]], EA=5e9, EI=4000) system.moment_load(Ty=10, node_id=3) system.add_support_hinged(node_id=1) system.add_support_hinged(node_id=3) system.solve() system.show_structure(show=False) system.show_bending_moment(show=False) system.show_axial_force(show=False) system.show_reaction_force(show=False) system.show_shear_force(show=False)
def test_example_2(self): system = se.SystemElements() system.add_truss_element(location=[[0, 0], [0, 5]], EA=5000) system.add_truss_element(location=[[0, 5], [5, 5]], EA=5000) system.add_truss_element(location=[[5, 5], [5, 0]], EA=5000) system.add_truss_element(location=[[0, 0], [5, 5]], EA=5000 * np.sqrt(2)) system.add_support_hinged(node_id=1) system.add_support_hinged(node_id=4) system.point_load(Fx=10, node_id=2) sol = np.fromstring("""0.00000000e+00 0.00000000e+00 -7.50739186e-03 4.00000000e-02 2.44055338e-18 -4.95028396e-03 3.00000000e-02 1.00000000e-02 -2.69147231e-03 0.00000000e+00 0.00000000e+00 -7.65426385e-03""", float, sep=" ") self.assertTrue(np.allclose(system.solve(), sol))
def test_load_cases(self): ss = se.SystemElements() ss.add_truss_element(location=[[0, 0], [1000, 0]]) ss.add_truss_element(location=[[0, 0], [500, 500]]) ss.add_truss_element(location=[[500, 500], [1000, 0]]) ss.add_support_hinged(node_id=2) ss.add_support_roll(node_id=1, direction="x", angle=None) lc_dead = LoadCase("dead") lc_dead.point_load(node_id=[1], Fx=10) combination = LoadCombination("ULS") combination.add_load_case(lc_dead, factor=1.4) results = combination.solve(ss) self.assertAlmostEqual(0, results["dead"].get_node_results_system(1)["Fx"]) self.assertAlmostEqual(14, results["dead"].get_node_results_system(2)["Fx"])
def test_example_3(self): system = se.SystemElements() system.add_element(location=[[0, 0], [0, 5]], EA=15000, EI=5000) system.add_element(location=[[0, 5], [5, 5]], EA=15000, EI=5000) system.add_element(location=[[5, 5], [5, 0]], EA=15000, EI=5000) system.add_support_fixed(node_id=1) system.add_support_spring(node_id=4, translation=3, k=4000) system.point_load(Fx=30, node_id=2) system.q_load(q=10, element_id=2) system.solve() system.show_structure(show=False) system.show_bending_moment(show=False) system.show_axial_force(show=False) system.show_reaction_force(show=False) system.show_shear_force(show=False)
def test_internal_hinge_symmetry(self): ss = se.SystemElements() ss.add_element(location=[[0, 0], [5, 0]], spring={2: 0}) ss.add_element(location=[[5, 0], [10, 0]]) ss.q_load(element_id=1, q=-9) ss.q_load(element_id=2, q=-9) ss.add_support_fixed(node_id=1) ss.add_support_fixed(node_id=3) ss.solve() self.assertAlmostEqual( ss.get_node_results_system(1)["Fy"], ss.get_node_results_system(3)["Fy"]) self.assertAlmostEqual( ss.get_element_results(1)["Mmax"], ss.get_element_results(2)["Mmax"])
def test_example_3(self): system = se.SystemElements() system.add_element(location=[[0, 0], [0, 5]], EA=15000, EI=5000) system.add_element(location=[[0, 5], [5, 5]], EA=15000, EI=5000) system.add_element(location=[[5, 5], [5, 0]], EA=15000, EI=5000) system.add_support_fixed(node_id=1) system.add_support_spring(node_id=4, translation=3, k=4000) system.point_load(Fx=30, node_id=2) system.q_load(q=-10, element_id=2) sol = np.fromstring("""0. 0. 0. 0.06264607 0.00379285 -0.0128231 0.0575402 0.01287382 -0.00216051 0. 0. -0.0080909""", float, sep=" ") self.assertTrue(np.allclose(system.solve(), sol, 1e-3)) self.assertAlmostEqual(system.get_node_displacements(3)["ux"], 0.0575402011335) sol = system.get_node_results_system(3) self.assertAlmostEqual(sol["uy"], 0.012873819793265455) self.assertAlmostEqual(sol["phi_y"], 0.0021605118130397583)
def test_example_2(self): system = se.SystemElements() system.add_truss_element(location=[[0, 0], [0, 5]], EA=5000) system.add_truss_element(location=[[0, 5], [5, 5]], EA=5000) system.add_truss_element(location=[[5, 5], [5, 0]], EA=5000) system.add_truss_element(location=[[0, 0], [5, 5]], EA=5000 * np.sqrt(2)) system.add_support_hinged(node_id=1) system.add_support_hinged(node_id=4) system.point_load(Fx=10, node_id=2) system.solve() system.show_structure(show=False) system.show_bending_moment(show=False) system.show_axial_force(show=False) system.show_reaction_force(show=False) system.show_shear_force(show=False)
def run(): system = se.SystemElements() system.add_element(location=[[3, 4], [0, 0]], EA=5e9, EI=8000) system.add_element(location=[[8, 4], [3, 4]], EA=5e9, EI=4000) system.show_structure() system.q_load(element_id=2, q=-10) system.add_support_hinged(node_id=2) system.add_support_fixed(node_id=3) system.solve() system.show_structure() system.show_reaction_force() system.show_axial_force() system.show_shear_force() system.show_bending_moment() system.show_displacement()
def test_example_4(self): system = se.SystemElements() system.add_element(location=[[0, 0], [5, 0]], EA=5e9, EI=8000, spring={2: 0}) system.add_element(location=[[5, 0], [5, 5]], EA=5e9, EI=4000) system.moment_load(Ty=10, node_id=3) system.add_support_hinged(node_id=1) system.add_support_hinged(node_id=3) sol = np.fromstring( """0.00000000e+00 0.00000000e+00 1.46957616e-25 2.00000000e-09 -7.34788079e-25 0.00000000e+00 0.00000000e+00 0.00000000e+00 3.12500040e-03""", float, sep=" ", ) self.assertTrue(np.allclose(system.solve(), sol))