0% found this document useful (0 votes)
20 views8 pages

Truss Analysis

This document outlines Assignment 2 for EAE 2206, focusing on the computer analysis of a Warren truss using a procedural programming language, preferably C. The assignment requires students to analyze the truss, determine forces within its members, and follow specific steps for data organization and program development. It also includes a solution guide and sample code for implementing the analysis using the Gauss elimination method.

Uploaded by

malingimarcus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views8 pages

Truss Analysis

This document outlines Assignment 2 for EAE 2206, focusing on the computer analysis of a Warren truss using a procedural programming language, preferably C. The assignment requires students to analyze the truss, determine forces within its members, and follow specific steps for data organization and program development. It also includes a solution guide and sample code for implementing the analysis using the Gauss elimination method.

Uploaded by

malingimarcus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Assignment 2

Thursday, February 20, 2025 10:56 AM

EAE 2206 - PROGRAMMING FOR ENGINEERS II

ASSIGNMENT 2

COMPUTER ANALYSIS OF A WARREN TRUSS

ASSIGNED: 24th FEBRUARY 2025

DUE: 10th MARCH 2025 (2 WEEKS LATER)

FORMAT: PRINTOUT

THIS IS A GROUP ASSIGNMENT. EACH GROUP SHOULD CONSIST OF 4 INDIVIDUALS

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.

(4) SEPARATELY SHOW ALL FORMULAE EMPLOYED IN THE COMPUTER PROGRAM.

(5) ENSURE THAT YOUR PROGRAM IS WELL COMMENTED OR IS SELF DOCUMENTING.


SOLUTION PROPOSAL

FOLLOWING IS A SOLUTION GUIDE. IT IS A SUGGESTED SOLUTION PROCEDURE AND YOU ARE NOT
OBLIGATED TO USE IT.

(1) Number all the nodes, members and elements

(2) On paper, design a table or tables for all pertinent data. This is for ease of reading the data into
the program.

(3) Replicate the data in a text file

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

Member NodeA NodeB Length L, m Angle theta, deg


M1 N1 N2 2 120
M2 N2 N3 2 0
M3 N3 N1 2 60
M4 N3 N4 2 120
M5 N4 N1 2 0
M6 N3 N5 2 0
M7 N5 N4 2 60

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 -

(4) Calculate the reactions

(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).

(7) Create a matrix equation


𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 = 𝐶
𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 = 𝐶
𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 = 𝐶
.
.
.
𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 + 𝑎 𝐹 = 𝐶

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

Sample program showing how to call the function GaussSSLE()

#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)

// Algorithm: Larry S. Caretto, California State University - Northridge, 2017


// C Language adaptation: N. WaKarani, 20th February 2025

void GaussSSLE( double A[][8], double b[], double x[], int N )


{

int row, column, pivot;

// Augment matrix A in column N+1 with values of vector b

for( row = 0; row < N; row++ )


A[row][N] = b[row];

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");
}

// create an upper triangular matrix out of A

for ( pivot = 0; pivot < N-1; pivot++ )


for( row = pivot + 1; row < N; row++ )
for( column = row + 1; column < N+1; column++ )
A[row][column] -= A[row][pivot]* A[pivot][column] / A[pivot][pivot];

// Upper triangular matrix is complete. Now get the values of x

for (row = N-1; row >= 0; row-- )


{
x[row] = A[row][N];
for ( column = N - 1; column > row; column-- )
x[row] -= A[row][column] * x[column];
x[row] /= A[row][row];
}
}

int main()
{
int N;
double A[7][8];
double b[7];
double x[7];

A[0][0] = 0.866 ; //f12


A[0][1] = 0 ; //f13
A[0][2] = 0 ; //f23
A[0][3] = 0 ; //f24
A[0][4] = 0 ; //f34
A[0][5] = 0 ; //f35
A[0][6] = 0 ; //f45

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;
}

(9) Print your results

Sample test results


Coefficients in main()
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 = 0.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 = 0.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 = 0.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 = 0.0000

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

Process returned -1073741819 (0xC0000005) execution time : 0.452 s


Press any key to continue.

(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

You might also like