This Python code solves any 2D truss structure using the joints method.
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
-
In the first part of the code the support reactions are solved using the equilibrium equations for 2D structures:
- 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.
- 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.
- Load tha truss data using a grid and straight lines drawn with mouse.