Two Bar Truss Design

Main.TwoBarTruss History

Hide minor edits - Show changes to output

Added lines 4-5:

A two-bar truss is a type of truss structure consisting of two bars connected at the ends by either pins or joints. This type of truss is commonly used in construction and engineering applications.
May 02, 2021, at 07:14 PM by 10.35.117.248 -
Changed lines 34-40 from:
try:
    from gekko import GEKKO
except:
    # pip install gekko
    import pip
    pip.main(['install','gekko'])
   
from gekko import GEKKO
to:
from gekko import GEKKO
Changed line 75 from:
m.Obj(weight)
to:
m.Minimize(weight)
June 21, 2020, at 04:48 AM by 136.36.211.159 -
Deleted lines 206-224:

----

(:html:)
 <div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
(:htmlend:)
December 20, 2018, at 03:08 PM by 173.117.150.72 -
Changed lines 24-27 from:
!!!! Python ([[https://gekko.readthedocs.io/en/latest/|GEKKO]]) Solution

[[https://gekko.readthedocs.io/en/latest/|GEKKO]] is optimization software for mixed-integer and differential algebraic equations. It is coupled with large-scale solvers for linear, quadratic, nonlinear, and mixed integer programming (LP, QP, NLP, MILP, MINLP).
to:
!!!! Python ([[https://gekko.readthedocs.io/en/latest/|GEKKO]]) Solution

[[https://gekko.readthedocs.io/en/latest/|GEKKO]] is optimization software for mixed-integer and differential algebraic equations. It is coupled with large-scale solvers for linear, quadratic, nonlinear, and mixed integer programming (LP, QP, NLP, MILP, MINLP).
Changed line 180 from:
<iframe width="560" height="315" src="https://www.youtube.com/embed/ah-Cbrim93I" frameborder="0" allowfullscreen></iframe>
to:
<iframe width="560" height="315" src="https://www.youtube.com/embed/ah-Cbrim93I" frameborder="0" allowfullscreen></iframe>
Changed line 190 from:
<iframe width="560" height="315" src="https://www.youtube.com/embed/uOTdLfvgYHU" frameborder="0" allowfullscreen></iframe>
to:
<iframe width="560" height="315" src="https://www.youtube.com/embed/uOTdLfvgYHU" frameborder="0" allowfullscreen></iframe>
Changed line 202 from:
<iframe width="560" height="315" src="https://www.youtube.com/embed/GB0NYz-k8ZM?rel=0" frameborder="0" allowfullscreen></iframe>
to:
<iframe width="560" height="315" src="https://www.youtube.com/embed/GB0NYz-k8ZM?rel=0" frameborder="0" allowfullscreen></iframe>
Changed line 219 from:
           dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
to:
           dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
Changed lines 223-224 from:
   <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
to:
   <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
March 25, 2018, at 05:41 AM by 45.56.3.173 -
Deleted lines 19-24:
----

!!!! APM Python Tutorial

* [[Attach:twobar_apm_python.zip | APM Python Two Bar Files]]

Changed line 21 from:
<iframe width="560" height="315" src="https://www.youtube.com/embed/ah-Cbrim93I" frameborder="0" allowfullscreen></iframe>
to:
<iframe width="560" height="315" src="https://www.youtube.com/embed/KwELgUu1u-E" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
Deleted lines 23-34:
----

!!!! APM MATLAB Tutorial

* [[Attach:twobar_apm_matlab.zip | APM MATLAB Two Bar Files]]

(:html:)
<iframe width="560" height="315" src="https://www.youtube.com/embed/uOTdLfvgYHU" frameborder="0" allowfullscreen></iframe>
(:htmlend:)

----

Added lines 172-191:

----

!!!! APM Python Tutorial

* [[Attach:twobar_apm_python.zip | APM Python Two Bar Files]]

(:html:)
<iframe width="560" height="315" src="https://www.youtube.com/embed/ah-Cbrim93I" frameborder="0" allowfullscreen></iframe>
(:htmlend:)

----

!!!! APM MATLAB Tutorial

* [[Attach:twobar_apm_matlab.zip | APM MATLAB Two Bar Files]]

(:html:)
<iframe width="560" height="315" src="https://www.youtube.com/embed/uOTdLfvgYHU" frameborder="0" allowfullscreen></iframe>
(:htmlend:)
March 23, 2018, at 11:10 PM by 10.37.71.107 -
Changed lines 42-44 from:
!!!! Python (GEKKO) Solution

GEKKO is optimization software for mixed-integer and differential algebraic equations. It is coupled with large-scale solvers for linear, quadratic, nonlinear, and mixed integer programming (LP, QP, NLP, MILP, MINLP).
to:
!!!! Python ([[https://gekko.readthedocs.io/en/latest/|GEKKO]]) Solution

[[https://gekko.readthedocs.io/en/latest/|GEKKO]] is optimization software for mixed-integer and differential algebraic equations. It is coupled with large-scale solvers for linear, quadratic, nonlinear, and mixed integer programming (LP, QP, NLP, MILP, MINLP).
March 23, 2018, at 11:09 PM by 10.37.71.107 -
Added lines 43-46:

GEKKO is optimization software for mixed-integer and differential algebraic equations. It is coupled with large-scale solvers for linear, quadratic, nonlinear, and mixed integer programming (LP, QP, NLP, MILP, MINLP).

%width=300px%Attach:gekko.png
March 23, 2018, at 11:07 PM by 10.37.71.107 -
Changed line 103 from:
!!!! Generate Contour Plot (Python)
to:
!!!! Solution Contour Plot (Python)
March 23, 2018, at 11:07 PM by 10.37.71.107 -
Changed line 103 from:
!!!! Python Generates Contour Plots
to:
!!!! Generate Contour Plot (Python)
March 23, 2018, at 11:06 PM by 10.37.71.107 -
Added lines 104-105:

%width=550px%Attach:twobar_contour.png
March 23, 2018, at 11:04 PM by 10.37.71.107 -
Changed lines 99-105 from:
to:
(:sourceend:)

----

!!!! Python Generates Contour Plots

(:source lang=python:)
March 23, 2018, at 11:03 PM by 10.37.71.107 -
Changed lines 22-23 from:
!!!! Python Tutorial
to:
!!!! APM Python Tutorial
Changed lines 32-33 from:
!!!! MATLAB Tutorial
to:
!!!! APM MATLAB Tutorial
Added lines 39-177:

----

!!!! Python (GEKKO) Solution

(:source lang=python:)
import numpy as np

# import gekko, pip install if needed
try:
    from gekko import GEKKO
except:
    # pip install gekko
    import pip
    pip.main(['install','gekko'])
    from gekko import GEKKO
   
# create new model
m = GEKKO()

# declare model parameters
width = m.Param(value=60)
thickness = m.Param(value=0.15)
density = m.Param(value=0.3)
modulus = m.Param(value=30000)
load = m.Param(value=66)

# declare variables and initial guesses
height = m.Var(value=30.00,lb=10.0,ub=50.0)
diameter = m.Var(value=3.00,lb=1.0,ub=4.0)
weight = m.Var()

# intermediate variables with explicit equations
leng = m.Intermediate(m.sqrt((width/2)**2 + height**2))
area = m.Intermediate(np.pi * diameter * thickness)
iovera = m.Intermediate((diameter**2 + thickness**2)/8)
stress = m.Intermediate(load * leng / (2*area*height))
buckling = m.Intermediate(np.pi**2 * modulus \
              * iovera / (leng**2))
deflection = m.Intermediate(load * leng**3 \
              / (2 * modulus * area * height**2))

# implicit equations
m.Equation(weight==2*density*area*leng)
m.Equation(weight < 24)
m.Equation(stress < 100)
m.Equation(stress < buckling)
m.Equation(deflection < 0.25)

# minimize weight
m.Obj(weight)

# solve optimization
m.solve()  # remote=False for local solve

print ('')
print ('--- Results of the Optimization Problem ---')
print ('Height: ' + str(height.value))
print ('Diameter: ' + str(diameter.value))
print ('Weight: ' + str(weight.value))

## Generate a contour plot
# Import some other libraries that we'll need
# matplotlib and numpy packages must also be installed
import matplotlib
import numpy as np
import matplotlib.pyplot as plt

# Constants
pi = 3.14159
dens = 0.3
modu = 30000.0
load = 66.0

# Analysis variables
wdth = 60.0
thik = 0.15

# Design variables at mesh points
x = np.arange(10.0, 30.0, 2.0)
y = np.arange(1.0, 3.0, 0.3)
hght, diam = np.meshgrid(x, y)

# Equations and Constraints
leng = ((wdth/2.0)**2.0 + hght**2)**0.5
area = pi * diam * thik
iovera = (diam**2.0 + thik**2.0)/8.0
wght = 2.0 * dens * leng * area
strs = load * leng / (2.0 * area * hght)
buck = pi**2.0 * modu * iovera / (leng**2.0)
defl = load * leng**3.0 / (2.0*modu * area * hght**2.0)

# Create a contour plot
# Visit https://matplotlib.org/examples/pylab_examples/contour_demo.html
#  for more examples and options for contour plots
plt.figure()
# Weight contours
CS = plt.contour(hght, diam, wght)
plt.clabel(CS, inline=1, fontsize=10)
# Stress<100
CS = plt.contour(hght, diam, strs,[100.0],colors='k',linewidths=[4.0])
plt.clabel(CS, inline=1, fontsize=10)
# Deflection<0.25
CS = plt.contour(hght, diam, defl,[0.25],colors='b',linewidths=[4.0])
plt.clabel(CS, inline=1, fontsize=10)
# Stress-Buckling<0
CS = plt.contour(hght, diam, strs-buck,[0.0],colors='r',linewidths=[4.0])
plt.clabel(CS, inline=1, fontsize=10)
# Add some labels
plt.title('Two Bar Optimization Problem')
plt.xlabel('Height')
plt.ylabel('Diameter')
# Save the figure as a PNG
plt.savefig('contour1.png')

# Create a new figure to see more detail
plt.figure()
# Weight contours
CS = plt.contour(hght, diam, wght)
plt.clabel(CS, inline=1, fontsize=10)
# Stress<100
CS = plt.contour(hght, diam, strs,[90.0,100.0],colors='k',linewidths=[0.5, 4.0])
plt.clabel(CS, inline=1, fontsize=10)
# Deflection<0.25
CS = plt.contour(hght, diam, defl,[0.22,0.25],colors='b',linewidths=[0.5, 4.0])
plt.clabel(CS, inline=1, fontsize=10)
# Stress-Buckling<0
CS = plt.contour(hght, diam, strs-buck,[-5.0,0.0],colors='r',linewidths=[0.5, 4.0])
plt.clabel(CS, inline=1, fontsize=10)
# Add some labels
plt.title('Two Bar Optimization Problem')
plt.xlabel('Height')
plt.ylabel('Diameter')
# Save the figure as a PNG
plt.savefig('contour2.png')

# Show the plots
plt.show()
(:sourceend:)
January 17, 2013, at 04:28 AM by 69.169.188.188 -
Added line 49:
<iframe width="560" height="315" src="https://www.youtube.com/embed/GB0NYz-k8ZM?rel=0" frameborder="0" allowfullscreen></iframe>
January 16, 2013, at 09:53 PM by 128.187.97.21 -
Added lines 20-21:
----
Added lines 29-30:

----
January 16, 2013, at 09:52 PM by 128.187.97.21 -
Deleted line 44:
<iframe width="560" height="315" src="https://www.youtube.com/embed/uOTdLfvgYHU" frameborder="0" allowfullscreen></iframe>
January 16, 2013, at 09:36 PM by 128.187.97.21 -
Added lines 43-46:

(:html:)
<iframe width="560" height="315" src="https://www.youtube.com/embed/uOTdLfvgYHU" frameborder="0" allowfullscreen></iframe>
(:htmlend:)
January 16, 2013, at 09:35 PM by 128.187.97.21 -
Added lines 21-23:

* [[Attach:twobar_apm_python.zip | APM Python Two Bar Files]]

Added lines 29-31:

* [[Attach:twobar_apm_matlab.zip | APM MATLAB Two Bar Files]]

January 16, 2013, at 09:32 PM by 128.187.97.21 -
Added lines 29-36:

----

!!!! Objective Function Plot

One part of the assignment asks you to select width and load as variables for a 3d optimal surface plot and plot the solution of the optimization problem to minimize deflection at each of the width / load combinations. This tutorial example shows how to do this same activity but for the alternative problem of minimizing weight.

* [[Attach:twobar_obj_plot.zip | Two Bar Objective Plot Files]]
January 15, 2013, at 03:43 AM by 69.169.188.188 -
Added line 15:
* [[Attach:twobar_matlab.pdf | Two Bar FMINCON MATLAB Tutorial]]
Changed line 17 from:
* [[Attach:twobar_matlab.pdf | Two Bar FMINCON MATLAB Tutorial]]
to:
* [[Attach:twobar_mathematica.pdf | Two Bar Mathematica Tutorial]]
January 11, 2013, at 02:17 PM by 69.169.188.188 -
Deleted lines 30-31:

----
January 11, 2013, at 02:17 PM by 69.169.188.188 -
Changed line 40 from:
       var disqus_shortname = 'Two_Bar_Truss_Optimization'; // required: replace example with your forum shortname
to:
       var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname
January 11, 2013, at 02:15 PM by 69.169.188.188 -
Changed line 40 from:
       var disqus_shortname = 'Two Bar Truss Optimization'; // required: replace example with your forum shortname
to:
       var disqus_shortname = 'Two_Bar_Truss_Optimization'; // required: replace example with your forum shortname
January 11, 2013, at 02:14 PM by 69.169.188.188 -
Changed lines 30-51 from:
Attach:collaborative50.png This assignment can be completed in collaboration with others. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].
to:
Attach:collaborative50.png This assignment can be completed in collaboration with others. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].

----

----

(:html:)
 <div id="disqus_thread"></div>
    <script type="text/javascript">
        /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
        var disqus_shortname = 'Two Bar Truss Optimization'; // required: replace example with your forum shortname

        /* * * DON'T EDIT BELOW THIS LINE * * */
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
(:htmlend:)
January 10, 2013, at 06:51 AM by 69.169.188.188 -
Added line 19:
!!!! Python Tutorial
Changed lines 22-25 from:
<br>
to:
(:htmlend:)

!!!! MATLAB Tutorial
(:html:)
January 07, 2013, at 07:52 PM by 69.169.188.188 -
Added lines 21-22:
<br>
<iframe width="560" height="315" src="https://www.youtube.com/embed/uOTdLfvgYHU" frameborder="0" allowfullscreen></iframe>
January 07, 2013, at 05:41 PM by 69.169.188.188 -
Added lines 19-22:
(:html:)
<iframe width="560" height="315" src="https://www.youtube.com/embed/ah-Cbrim93I" frameborder="0" allowfullscreen></iframe>
(:htmlend:)

Changed line 24 from:
Attach:collaborative50.png This assignment can be completed in collaboration with others. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].
to:
Attach:collaborative50.png This assignment can be completed in collaboration with others. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].
January 06, 2013, at 11:07 PM by 69.169.188.188 -
Changed lines 13-14 from:
* [[Attach:twobar_apmonitor.pdf | Two Bar APM MATLAB Tutorial]]
to:
* [[Attach:twobar_apm_matlab.pdf | Two Bar APM MATLAB Tutorial]]
* [[Attach:twobar_apm_python.pdf | Two Bar APM Python
Tutorial]]
December 27, 2012, at 06:05 AM by 69.169.188.188 -
Added line 14:
* [[Attach:twobar_isight.pdf | Two Bar Isight Tutorial]]
December 27, 2012, at 05:58 AM by 69.169.188.188 -
Changed lines 13-14 from:
* [[Attach:twobar_apmonitor.pdf | Two Bar APMonitor Tutorial]]
* [[Attach:twobar_matlab.pdf | Two Bar MATLAB Tutorial]]
to:
* [[Attach:twobar_apmonitor.pdf | Two Bar APM MATLAB Tutorial]]
* [[Attach:twobar_matlab.pdf | Two Bar FMINCON MATLAB Tutorial]]
December 27, 2012, at 05:49 AM by 69.169.188.188 -
Deleted line 13:
* [[Attach:twobar_excel.pdf | Two Bar Excel Tutorial]]
December 27, 2012, at 05:28 AM by 69.169.188.188 -
Changed lines 11-16 from:
This introductory assignment is designed as a means of demonstrating the optimization capabilities of a number of software packages. Below are tutorials for solving this problem with a number of software tools.
to:
This introductory assignment is designed as a means of demonstrating the optimization capabilities of a number of software packages. Below are tutorials for solving this problem with a number of software tools. Below are a few step-by-step tutorials.

* [[Attach:twobar_apmonitor.pdf | Two Bar APMonitor Tutorial]]
* [[Attach:twobar_excel.pdf | Two Bar Excel Tutorial]]
* [[Attach:twobar_matlab.pdf | Two Bar MATLAB Tutorial]]
* [[Attach:twobar_optdesX.pdf | Two Bar OptdesX Tutorial]]
December 25, 2012, at 12:50 PM by 69.169.188.188 -
Changed line 14 from:
Attach:collaborative50.png This assignment can be completed as a collaborative assignment. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].
to:
Attach:collaborative50.png This assignment can be completed in collaboration with others. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].
December 25, 2012, at 11:53 AM by 69.169.188.188 -
Changed line 1 from:
(:title Two Bar Optimization Problem:)
to:
(:title Two Bar Truss Design:)
December 24, 2012, at 05:01 PM by 69.169.188.188 -
Changed line 14 from:
This assignment can be completed as a collaborative Attach:collaborative50.png assignment. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].
to:
Attach:collaborative50.png This assignment can be completed as a collaborative assignment. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].
December 24, 2012, at 04:59 PM by 69.169.188.188 -
Deleted lines 4-7:
----
This assignment can be completed as a collaborative Attach:collaborative50.png assignment. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].
----

Changed lines 11-14 from:
This introductory assignment is designed as a means of demonstrating the optimization capabilities of a number of software packages. Below are tutorials for solving this problem with a number of software tools.
to:
This introductory assignment is designed as a means of demonstrating the optimization capabilities of a number of software packages. Below are tutorials for solving this problem with a number of software tools.

----
This assignment can be completed as a collaborative Attach:collaborative50.png assignment. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]]
.
December 24, 2012, at 04:59 PM by 69.169.188.188 -
Added lines 4-7:

----
This assignment can be completed as a collaborative Attach:collaborative50.png assignment. Additional guidelines on individual, collaborative, and group assignments are provided under the [[Main/CourseStandards | Expectations link]].
----
December 23, 2012, at 06:56 AM by 69.169.188.188 -
Changed line 9 from:
Attach:twobar.png
to:
Attach:twobar250.png
December 22, 2012, at 03:26 PM by 69.169.188.188 -
Added lines 7-8:
[[Attach:twobar.pdf | Two Bar Assignment]]
Changed line 11 from:
[[Attach:twobar.pdf | Two Bar Assignment]]
to:
This introductory assignment is designed as a means of demonstrating the optimization capabilities of a number of software packages. Below are tutorials for solving this problem with a number of software tools.
December 22, 2012, at 03:22 PM by 69.169.188.188 -
Added lines 1-9:
(:title Two Bar Optimization Problem:)
(:keywords nonlinear, optimization, engineering optimization, two-bar optimization, engineering design, interior point, active set, differential, algebraic, modeling language, university course:)
(:description Engineering design of a two-bar structure to support a load. Optimization principles are used to design the system.:)

A design of the truss is specified by a unique set of values for the analysis variables: height (H), diameter, (d), thickness (t), separation distance (B), modulus of elasticity (E), and material density (rho). Suppose we are interested in designing a truss that has a minimum weight, will not yield, will not buckle, and does not deflect "excessively,” and so we decide our model should calculate weight, stress, buckling stress and deflection.

Attach:twobar.png

[[Attach:twobar.pdf | Two Bar Assignment]]