Math 272 - Tower Truss Project

Math 272 - Tower Truss Project - Phase 2
Goal
To write functions that, based on the
• joint coordinates,
• beam linkages,
• pinned and roller-supported joint locations, and
• external forces,
will compute the internal beam forces for each member of the truss. e.g. the amount of tension or compression carried
by each beam under the applied load.
The computation will be performed using three separate operations, based on the matrix form of the force balance
equations, AF = B.
• generate the matrix A in one function
• generate the vector B in a second function
• solve the system AF = B using MATLAB, F = A \ B
Deliverables
• A MATLAB function file towerAMatrix.m that accepts joint positions and a beam list, the number of the pinned joint,
the number of the roller joints, and which generates the coefficient matrix A for the system of force equations, A F = B.
– format: function A = towerAMatrix(joints, beams, pinned_joint, roller_joint)
• A MATLAB function file towerBVector.m that accepts the same information as above, along with a vectors representing
the external forces contribution to the force equations or the B vector of the force equations A F = B. The new input,
F_ext, is explained below in the Details section.
– format: function B = towerBVector(joints, beams, pinned_joint, roller_joint, F_ext)
• A MATLAB function file towerForces.m, which uses towerAMatrix and towerBVector to calculate the internal forces
in each beam, under the load specified by F_ext.
– format: function F = towerForces(joints, beams, pinned_joint, roller_joint, F_ext);
• Note: all three functions must first test to see whether the joints and beams matrices represent a determinate
truss. If they do not, the functions must trigger an error and output an error message using the error command.
Recall: with one pin and one roller support, a determinate truss with Nj joints must have exactly 2Nj − 3 beams.
e.g. 5 joints, 2(5)-3 = 7 beams; 12 joints, 2(12)-3 = 21 beams, etc. See the Test Case 0 tower designs for examples
non-determinate trusses.
The problem with non-determinate trusses is that a simple system of linear equations is not sufficient to determine the
final distribution of forces in the truss beams, meaning F=A\B won’t actually compute the correct beam forces.
Phase 2 Details
You must read the Background document on this project before beginning.
A flexible format for representing a truss involves two matrices:
• the joints matrix: a list of (x, y) coordinates representing the joint locations, and
• the beams matrix: a list of (ji , jk ) pairs representing a beam between joint i and joint k.
We use the same format for the input to the functions in this Phase of the project.
External forces: The new input required for this phase is the representation of external forces, for which we will use
the vector F_ext. If Nj is the number of joints in the tower, the F_ext vector will be an Nj × 1 column vector.
e.g. F_ext = [0, 0, 0, 1000, 0, 2000, 0]’ could be used for a tower with 7 joints. It indicates that joint 4 is being subjected
to a 1000 N right-ward force, and joint 6 a 2000 N right-ward force. The other joints do not have any external forces applied
to them, though the transfer of forces through the beams will affect them.
1
Recommended Approach
You should first review the derivation of the force balance equations from Assignment #2 Q5 and the Week 2 notes before
you try to automate the construction of the equations. Page 3 of the Background document gives the mathematics behind
the vector-based coefficient calculations. You should not use angles or trig functions to compute the equation coefficients, as
getting the signs of the coefficient correct that way is far more difficult and error prone than a vector-based approach.
The primary challenge in this task is bookkeeping, as there are three different numbering systems in use:
• Joints numbering (Nj total number of joints)
• Beam numbering (Nb total number of joints), and
• Equation numbering (Ne total number of equations)
The number of equations is Ne = 2 ∗ Nj − 3: two equations for every joint, minus the equations removed for the pinned
and roller-mounted joints. The number of equations also equals the number of beams, Ne = Nb , ensuring that there is a
unique mathematical force-balance solution to the external load.
The construction approach recommended for the equations (each row in the A matrix and B vector) is:
• Start a row counter at r = 1.
• Loop through the joints, using a different counter, j.
• For each joint,
– If the joint is pinned, the forces are automatically balanced: insert no equations and do not change r.
– If the joint is on a roller, add an equation/row in A for the horizontal force balances at row r; then increment r
by 1: r = r+1.
– If the joint is a regular joint (not a pin or roller joint), add two equations
∗ One equation/row in A for vertical force balances, in row r
∗ One equation/row in A for horizontal force balances, in row r+1
∗ Increment r by 2: r = r+ 2.
At the end of the loop over the joints, you will have filled in the mandatory target of 2 ∗ Nj − 3 rows of the A matrix.
Repeat the same loop structure in the B vector function, so that the external forces can be correctly included in the
appropriate equation.
An alternative approach is to build the A matrix and B vector with every force balance equation, then delete the rows
corresponding to the equations for the pinned joint and for the vertical forces on the roller joint.
Test Cases
Test Case 0
Both of the following trusses are indeterminate.
joints = [-5, 0; 5, 0; -5, 4; 5, 4];
beams = [1, 2; 2, 4; 1, 3; 3, 4; 2, 3; 1, 4];
pinned_joint = 1;
roller_joint = 2;
joints = [0, 0; 10, 0; 0, 3; 3, 3; 7, 3; 10, 3];
beams = [1, 3; 1, 4; 3, 4; 4, 5; 5, 6; 5, 2; 6, 2];
pinned_joint = 1;
roller_joint = 2;
Using either truss as input, all three functions you are writing in this phase must use the error command to produce an
error message and stop the execution of the program.
2
Test Case 1
Consider again the truss from the Background section:
joints
2,
0,
2,
0,
2,
0,
2,
= [0 , 0;
0;
3;
3;
6;
6;
9;
9];
beams = [ 1 , 2 ; % j o i n t numbers
1 , 3;
2 , 3;
2 , 4;
3 , 4;
3 , 5;
4 , 5;
4 , 6;
5 , 6;
5 , 7;
6 , 7;
6 , 8;
7, 8];
% x/y l o c a t i o n s , in m
pinned joint = 1;
r o l l e r j o i n t = 2;
3
Test Case 1 - A Matrix
This truss should produce the following A matrix if you order the equations first by joint number, and within each joint,
you define the vertical equilibrium equation first followed by the horizontal equation.
-1
0
0
0
0
0
0
0
0
0
0
0
0
0 -0.555
-1 -0.832
0 0.555
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
0
0
0
0
0
0
0
0
0
0
0
1
0
-1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0 0.832
0 -0.555
-1 -0.832
0 0.555
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
-1
0
0
0
0
0
0
0
0
0
0
0
1
0
-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0 0.832
0 -0.555
-1 -0.832
0 0.555
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
-1
0
0
0
0
0
0
0
0
0
0
0
1
0
-1
Analysis In this matrix,
• Joint 1, at the left base point (0,0), is pinned and so has no equations representing its force balance.
• Joint 2, at the right base point (x, y) = (2, 0), is on a roller joint. The first row in A represents the coefficient for the
horizontal forces on Joint 2. Note that:
– Only Beams 1, 3 and 4 touch Joint 2. Thus the only non-zero coefficients in the first row should be in columns 1,
3 and 4.
– We note that the coefficient in column 4 is also zero though: looking at Beam 4, we see that it is up-and-down
(pure vertical) so would not contribute to the horizontal force balance, so its coefficient is zero as well.
– Both Beams 1 and 3, if in tension, would pull on Joint 2 towards the left. This is indicated by the negative
coefficients in columns 1 and 3 in the first row of A.
• The next two lines in A are for horizontal and vertical forces on Joint 3. Note that Beams 2, 3, 5 and 6 touch Joint 3,
so the only non-zero values will be in columns 2, 3, 5 and 6. (Again, even some of these are zero coefficients, because
the particular beam is either all vertical, or all horizontal).
• The rest of the matrix is made up of the coefficients for the vertical and horizontal force equations for the rest of the
joints, Joints 4-8. Every two lines represents the force balance equations (one for vertical forces, and one for horizontal
forces) for one joint.
4
Test Case 1a
With the same beam and joint information as above, we now use the external force vector
F_ext = [0, 0, 0, 0, 0, 0, -100, 0];
This represents a leftward horizontal force on Joint 7.
Using this information to create the B matrix that matches the structure of the earlier A matrix:
B =
0
0
0
0
0
0
0
0
0
0
100
0
0
Note that:
• The value that appears in B is +100, not -100: this is because the -100 (left horizontal force) appears on the left side
of the force balance equation, but setting up the equations in matrix form A F = B, we move the external force to the
right side of the equation, and have to flip the sign.
• The 100 appears in row 11 of B. This is the row that corresponds to the horizontal force balance in Joint 7 (see the row
arrangements for the values in the matching A matrix).
The B vector will not be the same length as F_ext.
(F_ext has one entry for every joint, or Nj entries;
B has one entry for each beam or balance equation, or 2Nj − 3 = Nb entries.)
With the A matrix and B vector found above, we can solve for the internal beam forces.
F = A\B
F =
−100.0
−450.0
180.3
300.0
−100.0
−300.0
180.3
150.0
−100.0
−150.0
180.3
−0.0
0.0
Positive values indicate beams in tension.
values represent compressed beams.
5
Negative
Test Case 1b
With the same beam and joint information as above, we now use the external force vector
F_ext = [0, 0, -100, 0, -100, 0, -100, 0];
This applies a leftward force on joints 3, 5 and 7 (the left side joints in the tower).
This gives the B vector, and then
resulting forces in the F vector
below.
F = A\B
B =
0
0
100
0
0
0
100
0
0
0
100
0
0
F =
The 100 N forces show up in rows:
3 (= horizontal forces on joint 3),
7 (= horizontal forces on joint 5),
and
11(= horizontal forces on joint 7).
−300.0
−900.0
540.8
450.0
−200.0
−450.0
360.6
150.0
−100.0
−150.0
180.3
−0.0
0.0
Positive values indicate beams in tension.
values represent compressed beams.
6
Negative
Test Case 2
Download the files Phase1Joints2.csv and Phase1Beams2.csv (for the joints and beams of the truss, respectively).
For this truss, the pinned joint is joint 4, and the roller joint is joint 1. We put a rightward horizontal load on the peak
joint, Joint 7.
F_ext = zeros(7, 1)
F_ext(7) = 10
Constructing A we get the following matrix of coefficients. Since there are 11 beams, there are 11 columns. Since there
are 7 joints, there are 7 × 2 − 3 = 11 rows/force balance equations.
0.196
0
-0.981 0.981
-0.196 0.196
0 -0.981
0 -0.196
0
0
0
0
0
0
0
0
0
0
0
0
1
0.73
0
0
0
0
0
0
0
0
0 -0.684
0 -0.73
0
0
0
0
0
0
0
0
0
0
0 0.857
1 0.514
0
0
0
0
0
0
-1
0
0 -0.857
0 -0.514
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0 0.981
0
0
0
1 0.196
0
0
0
0
0 -0.966 0.966
0
0
0 0.258 -0.258
0
0
0
0 -0.966 0.981
-1
0
0 0.258 -0.196
0 -0.981
0
0 -0.981
0 -0.196
0
0 0.196
This gives the B vector, and then resulting forces in the F vector below.
F = A\B
B =
0
0
0
0
0
0
0
0
0
0
−10
F =
23.5
25.5
−4.0
−0.8
0.8
−2.2
−0.0
25.5
−23.3
−23.9
−25.5
Positive values indicate beams in tension.
values represent compressed beams.
7
Negative