1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Most Effective 7 Members Truss in Scilab

  1. Nov 3, 2014 #1
    Hello everyone,
    I'm attempting to come up with a way to calculate the most efficient 7 members truss layout using Scilab.
    The assignment is to make a highway sign support.
    • It has to be L shaped and the truss system is only for the top horizontal part.
    • Two supports.
    • The sign is hanging at the furthest joint.
    There are other constrains like size and height but are not relevant for my question.
    Since this is my first programming language I do not know how to approach it in order to get the best layout. My professor doesn't require it for the assignment and expects us to change the coordinates of the joints manually and sort of brute force the best layout that way. My idea would be just for extra credit.

    2. Relevant equations
    Is this possible given that I only know Scilab language at a beginner level?
    What examples can I look at to know where to start?

    Thank you all!!
    3. The attempt at a solution
    Here is the most "advanced" thing I've done with Scilab so far:
    Code (SciLab):

    //Create matrix called "joints" that stores the values of the coordinates
        //of Joints 1 (first row), 2 (second row) 3(third row)
       
        //Declare my variables (some of them)
        joints = [-3 6;-3 4;7 6]//after a semicolon a new row starts.
        members = [1 2; 1 3; 2 3]
        weight = 850
        wind = 320
       
        //Now we display the matrix
        printf("\n\n")// We add some space to make the console look cleaner
        printf("Coordinates of Joint 1 = x = %3.3f y = %3.3f \n", joints(1,1), joints(1,2))
        printf("Coordinates of Joint 2 = x = %3.3f y = %3.3f \n", joints(2,1), joints(2,2))
        printf("Coordinates of Joint 3 = x = %3.3f y = %3.3f \n", joints(3,1), joints(3,2))
       
        //now we store the coordinates in variables to call them later.
        j1x = joints(1,1)
        j1y = joints(1,2)
        j2x = joints(2,1)
        j2y = joints(2,2)
        j3x = joints(3,1)
        j3y = joints(3,2)
       
        //now we get the distances.
        d13x = abs(j3x - j1x)
        d12x = abs(j2x - j1x)
       
        //now create a matrix from the equilibrium equations.
        A = [1    0    0;
             0    0    1;
             0    0   d12x;]
     
        disp(A, "Matrix A")                
       
        //matrix B
        B = [wind;
             weight;
             weight*d13x]
     
        disp(B, "Matrix B")
       
        //Solve matrix
        x=A\B
       
        //display results
        printf("\n Ax = %3.3fN\n Cx = %3.3fN\n Cy = %3.3fN\n\n",x(1,1), x(2,1), x(3,1))
       
        //Calculate the distances between the joints to be used later on the unit vector.
        d12 = sqrt( (j2x - j1x)^2 + (j2y - j1y)^2 );
        d13 = sqrt( (j3x - j1x)^2 + (j3y - j1y)^2 );
        d23 = sqrt( (j3x - j2x)^2 + (j3y - j2y)^2 );
       
        //now we calculate unit vectors
        e31x = (j1x - j3x) / d13      //x component of unit vector from 3 to 1
        e31y = (j1y - j3y) / d13      //y component of unit vector from 3 to 1
        e32x = (j2x - j3x) / d23      //x component of unit vector from 3 to 2
        e32y = (j2y - j3y) / d23      //y component of unit vector from 3 to 2
        e12x = (j2x - j1x) / d12      //x component of unit vector from 1 to 2
        e12y = (j2y - j1y) / d12      //y component of unit vector from 1 to 2
       
        //unit vectosr in either direction are the same
        e13x = -e31x
        e13y = -e31y
        e23x = -e32x
        e23y = -e32y
        e21x = -e12x
        e21y = -e12y
       
        //Create Matrix A
        //Coefficients
        //   T12    T13    T23    Ax    Ay    Bx  
        A = [e12x   e13x    0     1     0     0;//JOINT 1 x forces
             e12y   e13x    0     0     1     0;//JOINT 1 y forces
             e21x    0     e23x   0     0     1;//JOINT 2 x forces
             e21y    0     e23y   0     0     0;//JOINT 2 y forces
              0     e31x   e32x   0     0     0;//JOINT 3 x forces
              0     e31y   e32y   0     0     0;//JOINT 3 y forces
    ]
        //MATRIX M
        B = [0;
             0;
             0;
             0;
             wind;
             weight;]
        x = A\B
       
        //Now print the results
        printf("\n\n T12 = %7.3f LB\n T13 = %7.3f LB\n T23 = %7.3f LB \n", x(1,1), x(2,1), x(3,1))
        printf("\n\n Ax = %7.3f LB\n Ay = %7.3f LB\n Bx = %7.3f LB \n", x(4,1), x(5,1), x(6,1))
     
     
  2. jcsd
  3. Nov 8, 2014 #2
    Thanks for the post! Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post?
     
  4. Nov 8, 2014 #3

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Do you have a function that quantifies "best layout"? Something you put your coordinates in, and it tells you how "good" those coordinates are?
    That is the interesting part - if you have it, every optimization algorithm can find a good solution, and there are probably algorithms written for Scilab.
     
  5. Nov 8, 2014 #4
    Not at this point on the assignment. But what I mean by most efficient is whichever layout makes the compression and tensions forces to a minimum. I've been looking at the loop function but I'm not really sure how to use it yet.

    To reinstate the problem as Mr Bernhardt suggested,

    I want to get the layout of a 7 members truss that results on the least compression and tension forces on its members.
     
  6. Nov 9, 2014 #5

    mfb

    User Avatar
    2016 Award

    Staff: Mentor

    Least maximum compression/tension? Least average compression/tension?

    Hmm okay. Then it will get tricky, as a solution will likely need nested loops unless you do some parts manually.

    One approach that is relatively easy to implement: start with a reasonable design, modify one coordinate only, calculate the "quality" of the design (see questions above) for various different values of this coordinate with a loop, find the optimal position. Write it in your program, modify the next coordinate. Do this for all coordinates, then your final solution should be better than the initial design. Repeat as long as you like.

    A more clever algorithm looks at all coordinates at the same time to find possible improvements, picks the best one and repeats that process until further changes do not improve the design any more.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Most Effective 7 Members Truss in Scilab
  1. Truss,zero force member (Replies: 18)

  2. Force in truss members (Replies: 2)

Loading...