alejo1630 / truss_solver

This Python code solves any 2D truss structure using the joints method

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Truss Solver

This Python code solves any 2D truss structure using the joints method.

🔰 How does it work?

In order to explain the code, it was used for solving the following truss structure (Engineering Mechanics: Statics. Bedford & Fowler - Problem 6.7)

  • The data is uploaded from an excel file with two main sheets

    • Element Sheet shows the start and end joints for each element
    • Joint Sheet shows information such as:

      • X, Y coodinates for each joint.
      • Rx, Ry represents the support reactions. If there are 1 in both columns that joint is a pinned support. If just one column has 1 that joint is a roller support.
      • Fx, Fy represents the forces in X and Y direction for each joint.
  • In the first part of the code the support reactions are solved using the equilibrium equations for 2D structures:

$$ \Sigma F_x = 0 $$

$$ \Sigma F_y = 0 $$

$$ \Sigma M = 0 $$

  • After that, all the joints are sorted based on the unknown values.
  • The solution process starts with the joints with less unknowns (1 or 2) and uses the equilibrium equations for joints.

$$ \Sigma F_x = 0 $$

$$ \Sigma F_y = 0 $$

  • The equation system is solved using the linalg function from numpy
  • The quantity of unknowns are updated after solve a joint. The above process is repeated until all the joints are solved.
  • Finally, a line-plot with the internal load of each element (in tension[+] or compression[-]) is shown.

  • A solution of this example truss obtained using the software MDSolid is shown below.

🔶 What is next?

  • Load tha truss data using a grid and straight lines drawn with mouse.

About

This Python code solves any 2D truss structure using the joints method


Languages

Language:Python 100.0%