Truss Analysis
Truss Analysis
ASSIGNMENT 2
FORMAT: PRINTOUT
PROBLEM
(1) USING A DIGITAL COMPUTER, ANALYSE THE WARREN TRUSS SHOWN BELOW BY WRITING A
COMPUTER PROGRAM. FOR THIS ASSIGNMENT, DO THE ANALYSIS USING A PROCEDURAL
PROGRAMMING LANGUAGE. THE C PROGRAMMING LANGUAGE IS PREFERABLE.
(2) USE THE METHOD OF JOINTS TO DETERMINE THE FORCES WITHIN EACH MEMBER. STATE
WHETHER THE MEMBER IS IN COMPRESSION OR TENSION.
(3) CLOSELY FOLLOW THE STEPS OUTLINED IN THE EXAMPLE PROBLEM PRESENTED IN VARIOUS
LECTURES.
FOLLOWING IS A SOLUTION GUIDE. IT IS A SUGGESTED SOLUTION PROCEDURE AND YOU ARE NOT
OBLIGATED TO USE IT.
(2) On paper, design a table or tables for all pertinent data. This is for ease of reading the data into
the program.
Table header
(i) Number of elements = 3
(ii) Number of members = 7
(iii) Number of nodes = 5
ELEMENTS Table
Element Member M1 Member M2 Member M3 Node N1 Node N2 Node N3
E1 M1 M2 M3 N1 N2 N3
E2 M3 M4 M5 N1 N3 N4
E3 M4 M6 M7 N4 N3 N5
MEMBERS Table
NODES Table
Nodes Coordinate x, m Coordinate y, m
N1 1 0
N2 0 𝐿 𝑆𝑖𝑛 𝜃
N3 2 𝐿 𝑆𝑖𝑛 𝜃
N4 3 0
N5 4 𝐿 𝑆𝑖𝑛 𝜃
LOADED NODES
Nodes Load, N
N2 100
N3 150
N5 60
REACTION NODES
Nodes Reaction, N
N1 -
N4 -
(5) For each node, form two equilibrium equations. This will result in 10 equations and 7 unknowns for
the whole truss.
(6) Take any 7 of the 10 equations and use them to find the unknowns (hint: takes the first or last 7).
Matrix equation
𝑎 𝑎 𝑎 𝑎 𝑎 𝑎 𝑎 𝐹 𝐶
𝑎 𝑎 𝑎 𝑎 𝑎 𝑎 𝑎 𝐹 𝐶
𝑎 𝑎 𝑎 𝑎 𝑎 𝑎 𝑎 𝐹 = 𝐶
.
.
𝑎 𝑎 𝑎 𝑎 𝑎 𝑎 𝑎 𝐹 𝐶
Note: steps 4 - 8 should be carried out by your computer program without your intervention.
(8) Solve this matrix equation by calling the provided function, GaussSSLE().
Note: (i) all array arguments of the function are passed by reference
(ii) the passed coefficient matrix A, should contain an extra last column
#include <stdio.h>
#include <stdlib.h>
//Solve Ax = b
//Pass matrix A, vector b, vector x and number of equations N, as arguments of the function
GaussSSLE().
// Matrix A is a rectangular matrix of size N x (N+1) (row x column)
printf("Coefficients in GaussSSLE()\n");
for( row = 0; row < N; row++)
{
for( column = 0; column < N+1; column++ )
printf( "%d,%d = %7.4f ",row, column, A[row][column] );
printf("\n");
}
int main()
{
int N;
double A[7][8];
double b[7];
double x[7];
A[1][0] = 0.5 ;
A[1][1] = 1.0 ;
A[1][2] = 0 ;
A[1][3] = 0 ;
A[1][4] = 0 ;
A[1][5] = 0 ;
A[1][6] = 0 ;
A[2][0] = -0.866 ;
A[2][1] = 0 ;
A[2][2] = -0.866;
A[2][3] = 0 ;
A[2][4] = 0 ;
A[2][5] = 0 ;
A[2][6] = 0 ;
A[3][0] = -0.5 ;
A[3][1] = 0 ;
A[3][2] = 0.5 ;
A[3][3] = 1.0 ;
A[3][4] = 0 ;
A[3][5] = 0 ;
A[3][6] = 0 ;
A[4][0] = 0 ;
A[4][1] = 0 ;
A[4][2] = 0.866 ;
A[4][3] = 0 ;
A[4][4] = 0.866 ;
A[4][5] = 0 ;
A[4][6] = 0 ;
A[5][0] = 0 ;
A[5][1] = -1.0 ;
A[5][2] = -0.5 ;
A[5][3] = 0 ;
A[5][4] = 0.5 ;
A[5][5] = 1.0 ;
A[5][6] = 0 ;
A[6][0] = 0;
A[6][1] = 0;
A[6][2] = 0;
A[6][3] = 0;
A[6][4] = -0.866 ;
A[6][5] = 0;
A[6][6] = -0.866 ;
A[7][0] = 0;
A[7][1] = 0;
A[7][2] = 0;
A[7][3] = 0;
A[7][4] = 0;
A[7][5] = 0;
A[7][6] = 0;
b[0] = -15 ;
b[1] = 0 ;
b[2] = 10 ;
b[3] = 0 ;
b[4] = 10 ;
b[5] = 0 ;
b[6] = 10 ;
x[0] = 0 ;
x[1] = 0 ;
x[2] = 0 ;
x[3] = 0 ;
x[4] = 0 ;
x[5] = 0 ;
x[6] = 0 ;
N = 7;
printf("Coefficients in main()\n");
for(int i=0; i<N; i++)
{
for(int j=0; j<N+1; j++)
printf("%d,%d = %7.4f ",i,j,A[i][j]);
printf("\n");
}
printf("\nInputs\n");
for(int i=0; i<N; i++)
printf("%d = %7.4f \n",i,b[i]);
GaussSSLE( A, b, x, N );
printf("\nResults\n");
for(int j=0; j<N; j++)
printf("force %d = %f\n",j,x[j]);
return 0;
}
Inputs
0 = -15.0000
1 = 0.0000
2 = 10.0000
3 = 0.0000
4 = 10.0000
5 = 0.0000
6 = 10.0000
Coefficients in GaussSSLE()
0,0 = 0.8660 0,1 = 0.0000 0,2 = 0.0000 0,3 = 0.0000 0,4 = 0.0000 0,5 = 0.0000 0,6 =
0.0000 0,7 = -15.0000
1,0 = 0.5000 1,1 = 1.0000 1,2 = 0.0000 1,3 = 0.0000 1,4 = 0.0000 1,5 = 0.0000 1,6 =
0.0000 1,7 = 0.0000
2,0 = -0.8660 2,1 = 0.0000 2,2 = -0.8660 2,3 = 0.0000 2,4 = 0.0000 2,5 = 0.0000 2,6
= 0.0000 2,7 = 10.0000
3,0 = -0.5000 3,1 = 0.0000 3,2 = 0.5000 3,3 = 1.0000 3,4 = 0.0000 3,5 = 0.0000 3,6 =
0.0000 3,7 = 0.0000
4,0 = 0.0000 4,1 = 0.0000 4,2 = 0.8660 4,3 = 0.0000 4,4 = 0.8660 4,5 = 0.0000 4,6 =
0.0000 4,7 = 10.0000
5,0 = 0.0000 5,1 = -1.0000 5,2 = -0.5000 5,3 = 0.0000 5,4 = 0.5000 5,5 = 1.0000 5,6
= 0.0000 5,7 = 0.0000
6,0 = 0.0000 6,1 = 0.0000 6,2 = 0.0000 6,3 = 0.0000 6,4 = -0.8660 6,5 = 0.0000 6,6
= -0.8660 6,7 = 10.0000
Results
force 0 = -17.321016
force 1 = 8.660508
force 2 = 5.773672
force 3 = -11.547344
force 4 = 5.773672
force 5 = 8.660508
force 6 = -17.321016
(10) Test whether the remaining three equations are satisfied by the results
(11) Put together a clean report of your work and submit it for marking