EES Lecture 5

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 25

Computer Aided

Engineering

Advanced EES
(Engineering Equation Solver)
Lecture 5
Min/Max,
Uncertainty Analysis

Dr Hannes van der Walt


Swinburne Uni, Melbourne, Australia
Contents
• EES advanced tutorial (2 Lectures)
– Min/Max analysis (Lect 5)
– Uncertainty analysis (Lect 5)
– Input and output (Lect 6)
– Advanced features (Lect 6)
Min/Max
• Min/Max is used to find the minimum or
maximum of an undetermined variable in an
equation set for which there is at least one
degree of freedom.
• These equations have no degrees of freedom:
y  7 x 2  3x  5 log( z )

z  6 2 y3  9 x 
x3
• This is because y can only have one value as x
and z have been specified. Hence there are no
independent variables in this set of equations
that EES can vary.
Min/Max
• We can give the previous set of equations one
degree of freedom by removing one of the
specified (fixed) constants:

y  7 x  3x  5 log( z )
2


z  6 2 y3  9 x 
• Since x is no longer fixed, the solution y has
one degree of freedom – it depends on what x
or z is. If the second equation was removed
too, y will have two degrees of freedom.
Min/Max
• The following also has no degrees of freedom:
1
y 2
3x  5 x  7
y  0.05 x  0.1

• The set of two equations forms the solution


(intersection) of the two curves. By removing
the second equation, the first equation will
have one degree of freedom – y depends on x,
with x undefined. We can now use EES to vary
x to find the maximum point of y:
Min/Max
• We can use EES to find the maximum of the
black curve if EES is allowed to vary x – i.e.
one degree of freedom.
0.225
2
y = 1 / (3x + 5x + 7)
0.2 y = 0.05x + 0.1
0.175

0.15

0.125
y

0.1

0.075

0.05

0.025

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
x
Min/Max
• Lets create a simple Min/Max search
using the projectile movement example
we used earlier in lecture 3, saving a
copy of it as:
(Lecture 5.1 - SimpleMinMax.EES).
Min/Max
1. Find the angle that will maximise the
distance s the projectile will travel for
u = 30 m/s through a parametric table
2. Find the same angle just using the
Min/Max functionality (u = 30 m/s)
3. Find the required angle that will hit a
target at 60m (u = 30 m/s)
4. Find the required velocities for a range of
angles that will yield a range of exactly
60m!
Min/Max
Remember, the basic equations of motion
were:

"The velocity components"


u_x = u * cos(theta)
u_y = u * sin(theta)

"Time needed to max distance"


t = 2 * u_y / g#
s = u_x * t

0:10
Min/Max
1. Running the parametric table with varying theta shows
the optimal angle to be 45 degrees and the distance s to
be 91.77. Note however, that with differently selected
increments of theta that did not include 45 deg (40, 50
and 60 deg for example), we would not have arrived at 45
degrees!
Min/Max
2. Using Min/Max:
• The Min/Max
functionality is selected
from the Calculate menu:
• Using the Min/Max
functionality, EES will
first check the syntax of
the equations in the
Equations window. If no
errors are found, a dialog
window will appear •There must be at least
presenting the variables in one degree of freedom –
two lists. i.e. a variable that have
not been assigned a fixed
value so EES can vary it.
Min/Max
• Click the Maximize
button above the left list
(in this case).
• The variable which is to
be minimized/maximized
• The independent
variable(s) whose value(s)
will be changed by EES in
searching for the
minimum / maximum It is necessary to select as
• One needs to set realistic many independent variables as
there are degrees of freedom
bounds for the in the Equations window. The
independent variable(s). number of independent
variables which must be
selected is indicated above in
the right-hand list.
Min/Max
3. Find the required angle that will hit a
target at 60m (u = 30 m/s):
"To be able to determine the required angle to hit a
precise 60m target for an initial velocity u = 30 [m/s], we
define a variable deltas to force the calculation of the
angle using the Min/Max Table functionality. Remember
that we cannot specify theta = 45 [deg] now as EES will
vary it to try to minimise deltas and force s = 60 [m]."
s_max = 60 [m]
"When deltas = 0, s = 60 m"
deltas = abs(s - s_max)
0:10
Min/Max
• We then minimize
deltas (EES will
vary theta),
forcing s to be
60 m:
• We find theta =
20.42 deg
Min/Max - Table
4. Find the required velocities for a range
of given angles that will each yield a
range of exactly 60m. Here we let EES
search for u , so we cannot specify u,
but we specify theta in the parametric
table.
• With the Min/Max Table you can search for a
series of solutions in a parametric table
• Each run of the table will yield a specific
Min/Max solution!
Min/Max - Table
• We now need to perform the Min/Max
analysis on the table:
– Ensure that in the parametric table theta
varies between 0º and 90º
– As before we define s_max = 60 [m] as the
distance we want to achieve
– As before we minimise for deltas to force s
to be 60 [m]
– This time however, EES will find the values of
u for us, so we cannot specify u.
– Hint: To be able to minimise for deltas,
deltas has to be in the parametric table!
Min/Max - Table

The plot shows the velocity


that was calculated for each
angle given in the table to
hit the 60m target.
Min/Max
• Lets look at another
case where we would
use the minimize
functionality:
• How would we fit a
least squares
polynomial through The data
the data?
YP  a0  a1 x  a2 x 2
Lecture 5.2 Linear Regression.EES
2

   YP ,i  Yi 
N

i 1
Min/Max
• To do this problem efficiently, we will
utilise the Duplicate statement:
• Instead of writing:
y[1] = sin(0); y[2] = sin(15); … y[10] = sin(135); etc…

This actually expands


• One could write:
the two lines in the
N = 10
“loop” 10 times, with i
Duplicate i = 1, N
being 1, 2, … 10, so this
theta[i] = (i-1) * 15
is NOT a loop! The
Y[i] = sin(theta[i]) same equation is NOT
End actually being used!
Min/Max
Lecture 5.2 Linear Regression.EES YP  a0  a1 x  a2 x 2
2

 
N
N = 10  YP ,i  Yi
DUPLICATE i = 1,N i 1

X[i] = Lookup('Lookup 1', i, 'X')


Y[i] = Lookup('Lookup 1', i, 'Y')
YP[i] = a_0 + a_1 * X[i] + a_2 * X[i]^2
END

sigma = sum((YP[i] - Y[i])^2, i = 1, N) “RMS”


Min/Max
• We minimize YP  a0  a1 x  a2 x 2
sigma by varying 2
a_0, a_1 and a_2    YP ,i  Yi 
N

simultaneously. i 1

• How many Lecture 5.2 - Linear regression.EES

possible
combinations of
a_0/1/2 could
there be? EES
does it all for us!
Automagically!!!
Uncertainty Analysis
• Uncertainty Propagation determines the
uncertainty of up to 12 calculated variables as a
function of the uncertainties of one or more
measured values upon which it depends.
• In many experiments, an important quantity is
not directly measured but is rather calculated
as a function of one or more variables that are
directly measured, i.e., Y = f( X1, X2, ....).
• The measured variables, X1, X2, etc. have a
random variability which is referred to as its
uncertainty. In EES, that uncertainty is
displayed with a ± symbol, e.g., X1 = 300 ± 2.
Uncertainty Analysis
• As an example, let’s once again consider the
projectile model (Lecture 5.3 - SimpleUncertainyAnalysis.EES).
• Lets assume there is an uncertainty of 1.5 m/s
in the initial velocity u, and an uncertainty of 3
degrees in the angle theta.
• What would be the variation in the distance s
that we could expect?
Uncertainty Analysis-Table
• However, we could also do an uncertainty analysis
on a parametric table and vary parameters AND
still do an uncertainty analysis on each run!
100

78

56

sx [m]
34

12
Note the error bars in both x and y directions!
Switch off the x-bars to see only the y-bars

-10
0 10 20 30 40 50 60 70 80 90
[deg]
End of Lecture 5

0:05

You might also like