Peak of Flight #134: SMARTSim Tips for design Optimization
Apogee Components' Peak of Flight newsletter, issue 134. Date: undated; published between 2000 and 2005 (from the neighbouring dated issues).
I S S U E
N
E
W
1 3 4 ,
N O V .
S
E
L
T
1 ,
2 0 0 4
T
E
R
Feature Article
SMARTSim in Depth:
Tips For Successful Design Optimization.
1130 Elkton Drive, Suite A
Colorado Springs, Colorado 80907 USA
www.ApogeeRockets.com email: [email protected]
phone: 719-535-9335 fax: 719-534-9050
Page 1
ISSUE 134 - NOV 1, 2004
P
E
A
K
O
F
F
L
I
G
H
T
SMARTSim In Depth:
Tips For Successful Design Optimization
By Kenneth J. Karbon
Introduction
In a previous issue of the Peak of Flight Newsletter
(http://www.apogeerockets.com/education/downloads/
Newsletter130.pdf), an overview of SMARTSim software
was given along with a couple basic applications. This article
is geared to power users of RockSim and SMARTSim and will
go into more detail on the features, strengths, and limitations
of the codes. Additional examples and tips for efficient and
successful SMARTSim usage are also provided.
Know Your Limits
First of all, what do you want to achieve in your rocket
design? SMARTSim gives you three options:
1. “Desired” solves for the input that produces a known
or desired value in the response. This is also known as
“backtracking”, “goal seeking”, or “root finding.”
2. “Maximize” finds the input to produce the largest local
value in the response. Optimum mass is a prime example.
3. “Minimize” finds the input to produce the smallest
local value in the response.
The solution you are trying to achieve must exist in the
“design space.” The choice of rocket, engines, delays, weather
conditions, and etc. all dictate the limits of the RockSim
solution. You must have some intuition about the values you
want to optimize or backtrack before you use SMARTSim to
zero in on the answer. Some simulation results will converge
nicely, while others are simply impossible.
Consider the classic backtracking example from the
previous article. Figure 1 shows a graph of altitude vs. drag
coefficient for a given RockSim design. Achievable altitudes
in the simulation are essentially between 500 and 3200 feet
when varying Cd. If you seek a desired altitude of say 4000
feet, SMARTSim will try to find it, but it will likely converge
to a meaningless result, like a negative Cd. SMARTSim (or
RockSim running in the background) could also diverge to a
very large or very small number.
Also note that the graph has no optimum value. If
you tried to Maximize or Minimize altitude versus Cd in
SMARTSim, an error message would appear saying that a
solution could not be bracketed. That is because SMARTSim
searches for “local” minima and maxima, meaning a peak
or valley must exist in the function. Figure 2 shows a good
example of an optimum launch angle that finds the maximum
altitude. Keep in mind that the design space may include
several maxima/minima (including small “wiggles”), but
SMARTSim can only find one at a time.
Figure 2. The optimum launch angle for maximum altitude is around 11 degrees.
SMARTSim treats RockSim as a “black box” by calling
it as a subroutine. It does not know beforehand the functional
form of the input and response. The proceeding figures are
among thousands of possibilities. In equation form, the
RockSim “function” can be written this way:
Figure 1: Altitude vs. Cd. The backtracking solution to 1000 feet is around Cd = 0.7.
A P O G E E
Page 2
Continued on Page 3
R O C K E T S
ISSUE 134 - NOV 1, 2004
P
E
A
K
O
F
Design Optimization
Continued From Page 2
F
L
I
G
H
T
negative range from the launch pad. There is no valley in the
function. See Figure 4.
y = ROCKSIM(x)
Where x is the input and y is the response.
For a given simulation, no solution may exist, or many
solutions may exist, depending on what you ask for. Figure 3
shows potential functions and SMARTSim outcomes.
Figure 4. A desired landing range of zero (“on
the pad recovery”) is achieved with launch angle = -25 degrees
SMARTSim Numerics
Figure 3. Possible outcomes from SMARTSim,
depending on the input/response functional relationship.
Lastly, understand the differences between Desired,
Maximize, and Minimize as they pertain to RockSim
simulations. For example, if you want “on the pad recovery”,
you may think to “Minimize” landing range with launch
angle. Actually, the correct choice is a “Desired” range of
zero. The reason is that RockSim calculates positive and
In the previous figures, I manually generated the data
from RockSim. I first ran some simulations to figure out
the range of values to capture a solution. I then changed
the input variable in small increments to make a smooth
curve. For each new simulation, I modified the input in the
RockSim GUI and retrieved the result from the simulation
details, writing all values on a piece of paper. Finally, I typed
in and plotted the data in a spreadsheet to find the solution.
This process was repetitive, time consuming, and prone to
mistakes.
Luckily, SMARTSim does not operate in this brute force
manner. If it did, the software would be called “DumbSim.”
Instead, it uses efficient numerical methods to zero in on the
solution with a minimum number of calls to the RockSim
simulation solver. You do need to provide initial “Upper”
and “Lower” guesses to start the process, but more on that
later.
When solving for a “Desired” value, SMARTSim offers
two root finding algorithms as shown Figure 5. The Secant
Method is best for smooth, well behaved functions (altitude
Continued on Page 4
About this Newsletter
You can subscribe “FREE” to receive this e-zine at the Apogee Components web site
(www.ApogeeRockets.com), or sending an email to: [email protected] with
“SUBSCRIBE” as the subject line of the message.
A P O G E E
R O C K E T S
Page 3
ISSUE 134 - NOV 1, 2004
P
E
A
K
O
F
F
L
I
G
H
T
Design Optimization
Continued From Page 3
vs. drag, for example) and will converge quickly. If the
function is not well behaved, the technique can diverge.
Figure 5. Algorithms menu
The Modified False Position Method is more certain
because it first tries to roughly “bracket” the solution and
keeps it bracketed throughout the iterations. This “safer”
method will usually converge more slowly to the final result.
There is only one algorithm for “Minimize” or
“Maximize”, but the same bracketing concept applies. The
bracketing operation expands outward from the initial guesses
and tries to identify if a solution is possible. If it is, then the
iterations kick in and the algorithm marches to the precise
solution. If no solution is bracketed, SMARTSim will stop
and give a warning. The bracketing tries are adjustable, but
the default of ten is usually plenty. Evaluation of the initial
guesses and the bracketing operations occur during iteration
“0” as in Figure 6.
Getting Off to a Good Start
The software requires two initial guesses for the input
variable to start the algorithms. If using the predefined
Scenarios, SMARTSim automatically places the current
value as the “Lower Guess” and some sort of multiple of this
as the “Upper Guess”. If using a user-defined Scenario, then
A P O G E E
Page 4
Figure 6. A converged maximizing solution.
The initial guesses and bracketing test are performed as “iteration 0” before marching to the
solution.
the saved values are entered accordingly. You can edit the
guesses at any time prior to launching the calculations.
Carefully consider the initial guesses, because they are
crucial to the success of SMARTSim! The default values
may not always work for your particular problem. It is wise
to choose the guesses to be close to, and bracket, a probable
solution. (Recall from the first section of this article that you
already have some idea of the result you want to achieve.)
Otherwise, the calculations may converge slowly, converge
to a non-physical result, or cause RockSim to blow up with
crazy numbers. Keeping the upper and lower guesses fairly
close together also ensures that the bracketing routine will
not overshoot any local minima or maxima and mistakenly
tell you that no solution is possible.
The combination of initial guesses and requested result
determines the accuracy and efficiency of the SMARTSim
solution. Even though the numerical algorithms are robust
and can overcome an impractical starting point, it is still
smart to keep the initial guesses reasonable and realistic. Cd
Continued on Page 5
R O C K E T S
ISSUE 134 - NOV 1, 2004
P
E
A
K
O
F
Design Optimization
Continued From Page 4
guesses of 0.0 and 1.0 are much better than –100 and 100.
A Strong Finish
SMARTSim is an iterative procedure, so it needs to
know when to stop calculating. Use the radio buttons in the
“Convergence Criteria” frame to select which variables are
monitored during the solution. For root finding to a desired
value, choose the “Input Variable”, “Response Variable”,
or “Both.” The solution will stop if the change from one
iteration to the next or bracketing interval is less than the
tolerance(s) specified. Choosing “Both” is a more precise
way of generating a solution but may require more iterations
to converge.
For Minimization/Maximization, only the Input variable
is monitored. The tolerance in the text box is considered a
fractional value that is then multiplied by the input variable,
so it is wise to keep this number fairly small (typically smaller
than the needed tolerance for root finding). In theory, this
number can be as small as the square root of the computer’s
machine precision (about 3E-08 for the double precision
floating point operations of RockSim and SMARTSim). If
the tolerance is too large, the solution will converge without
reaching the “true” minimum or maximum.
Please note that these are “absolute tolerances”, meaning
they have the same units as the variables. Again, knowing the
approximate range of answers is very important. Depending
on the desired level of accuracy and choice of units, the user
may wish to change the default values. If you get the same
answer with smaller and smaller tolerances, then a precise
and unique solution has been found.
SMARTSim is also stopped if the “Maximum Number
ion
o Vers !
m
e
D
FREE oad It NOW
l
Down
F
L
I
G
H
T
of Iterations” is reached. This parameter acts as a safety
check to stop the calculations if SMARTSim oscillates or the
user specified impractical convergence criteria. The default
value is 20. Most well posed, root finding problems will
converge to within several significant digits in 10 iterations
or less. Minimization/maximization may take 20+. If you are
uncertain of the relationship between the input and response
variables, then set this value to a smaller number (even zero)
to see the simulation trend. Increase the number again when
you are ready to converge to a desired solution.
A Good Example From A SMARTSim User
The following case summarizes some of the key issues in
this article. A user reported to me that he was having trouble
with SMARTSim while attempting to optimize fin semi-span
to maximize altitude. I also struggled with a solution until I
thought more carefully about the limits of the simulation and
the initial guesses.
I went back to RockSim and tinkered with the fin size.
With very small semi-span (0.1 inches), the rocket went
unstable and crashed after achieving a low altitude in the
simulation. (The 2D flight profile in RockSim was key in
recognizing this result.) I then changed the semi-span to a
very large size (30 inches). The result was a model with high
drag that achieved another low altitude in the simulation. See
Sims 0 and 1 in Figure 7.
The solution was now bracketed with two low altitudes,
so an optimal value had to lie somewhere in between! I turned
the problem over to SMARTSim for the fine-tuning. Using
the big and small fins as initial guesses, the software found
a maximum altitude of 1509 ft using an optimum semi-span
of about one inch as in Figure 8. Sim number 2 in Figure 7
shows the result confirmed again in RockSim. This example
illustrates the importance of understanding the RockSim
simulation, bounding the solution, and giving good guesses
to SMARTSim.
RockSim Makes Designing Rockets
Easy, Accurate, and Affordable
• Easiest Software to Learn, and Fastest To Use.
• Create Templates and Patterns to Build Your Rockets.
• Generates The Most Accurate Simulation Results.
• Saves You Money By Preventing Design Errors and Launch
Mistakes.
• Used By More Rocketeers - Because It Is So Reliable.
• "The Best Value For Your Money!"
Compare Features!
Bargain Price of Just:
$95
A P O G E E
Visit the Apogee web site for more information:
www.ApogeeRockets.com/rocksim.asp
R O C K E T S
Page 5
ISSUE 134 - NOV 1, 2004
P
E
A
K
O
F
Design Optimization
Continued From Page 4
Helpful Hints
Figure 7. RockSim simulations with small fins,
big fins, and optimum fins
This article concludes with some tips to alleviate
common problems and make your SMARTSim solutions
more efficient and accurate.
1. When using old or unfamiliar designs with SMARTSim,
first open the rkt file in RockSim and “recalculate all
simulations.” Save the file to ensure that all the features and
formats are up to date with your latest version and preferences.
In the SMARTSim Settings menu, verify that the RockSim
console executable also reflects the same version.
2. If your are not interested in landing conditions, then
end the RockSim simulation at apogee or when the recovery
device deploys. Otherwise, unnecessary descent computations
will take place during the SMARTSim iterations and slow
down the solution.
F
L
I
G
H
T
3. When using mass variables, be sure to use the mass
override feature either on the entire rocket or a component
of interest. This disables the RockSim automatic mass
computations and gives SMARTSim a fixed number to work
with.
4. Often when you verify a result in RockSim using a
solution from SMARTSim, the answer is not exactly the
same. This is because the SMARTSim calculations use all
15 digits (double precision) that may be stored in the XML
rkt file. By contrast, the RockSim GUI text boxes accept a
limited number of digits.
5. SMARTSim acts on just one set of simulation results
in the rkt file. Make sure the “Active RockSim Simulation”
is set to the appropriate number.
6. In RockSim version 7, variable launch conditions and
competition settings are present. These features can alter
the simulation data in random fashion. Rerunning identical
simulations can lead to different results each time. Since the
physics, equations, and results are not constant, SMARTSim
may have difficulty in converging to one answer. To avoid nonconvergence, set to zero (or constant values) all the adjustable
wind and thermal parameters in the launch conditions of
RockSim. Also uncheck the random competition settings.
Alternatively, increase the convergence criteria for the input
and response variables in SMARTSim.
7. The Scenarios automatically search through the rkt file
to find the “correct” variables to describe an event. If the
variable is a part characteristic, the scenario will search for
the first occurrence of the part name. By default, RockSim
will use repeated, generic names for parts, which SMARTSim
cannot distinguish. To use your own scenarios effectively,
you should give unique names to the parts of your model,
such as “Front Body Tube”, “Drogue Parachute”, or “Nose
Mass.” Use these names consistently in all design files so
that your SMARTSim scenarios are universal.
Contact
Please contact me with any SMARTSim questions or
issues at: [email protected]
Figure 8. SMARTSim solution to optimum fin
size for maximum altitude
A P O G E E
Page 6
R O C K E T S