Worksheet

advertisement
Comp3132 Advanced 3D Modelling and Simulation. Worksheet 4.
Purpose
(a) To study the modelling of a rocket or missile, (b) to verify and validate the simulation, (c) to select
variable and parameters for the HUD display and the logging file, and to code these (d) to practise data
logging, display and manipulation skills using Excel, (e) to plan and execute a small-scale simulation and to
collect and analyse data.
Files Required
Level and Assets: in the folder CBP55_Assets
Code: All .uc classes in the folder CBP55
You will be investigating the motion of a rocket in the y-z plane. You will use the level
CBP55_Euler_Lab_Rocket.udk and edit the code in the class CBP55_Euler_Rocket.u
Background
Associated Reading
-
Dynamical System
Physics of a Falling Ball
Rockets and Missiles
Introduction to Modelling and Simulation
Working with Excel
Interaction Interface
Activities
0
Coding the Computation. Use the material discussed in the lecture, and the text “Chapter 6
Rockets and Missiles” to transform the mathematical model into computer code. You should insert
your code into the empty function body computation(float dT). Take care because you will need
different force calculations for pre and post-burnout. Make use of the local variables and also the
global variables velyY, velyZ, dispY, dispZ, time, totalMass,massFuel, and the global parameters
massRocket, initMassFuel, gravity, drag, vGas, dMdT. Compile your code and debug until you
get no errors and no warnings.
1
HUD Display. Choose which variables and parameters you wish to display on your HUD. Write
your code in the SendValuesToHUD() function. Extend the array HUDLine[i], but do not
overwrite HUDLINE[0]. Compile your code and debug until you get no errors and no warnings.
2
The Interaction Interface. Now decide which variables or parameters you want to set from the
console using the setparam <name> <value> console command. Write the code for this in the
SetParam(…) function. You will find a couple are already there for you. Do not delete these!
REMEMBER : Do not attempt to use the internal “state” variables.
3
Verification Test (1). Run the simulation with initTheta set to zero, this is a vertical launch. Import
the logged data for time and accelZ and totalMassRocket into Excel, and check that the mass drops
down and becomes constant at the value of massRocket. Check also that the acceleration increases
with time until burnout, where it should drop to –g which is -9.8.
Use the following parameters: gravity = 9.8, dMdT = 1.0, vGas = 42, massRocket = 2.0,
initMassFuel = 2.0, drag = 0.0
4
Verification Test (2). Now we are going to look at a vertical launch (with zero drag) and compare
the actual vertical speed with the speed predicted by the mathematical solution
𝑚
0
𝑣(𝑡) = −𝑔𝑡 + 𝑣𝑔𝑎𝑠 𝑙𝑛 (𝑚(𝑡)
)
This equation is discussed in Chapter 6. Set up the following parameters: Choose a value of deltaT
which you feel is appropriate.
Use the parameters from the previous test. Now launch the rocket and watch until it returns to the
launch pad. In the log file, look for the burnout time, when the total mass of the rocket falls to 2.
Now look at the previous data record where the total mass is a little larger than 2. Note down the
time, the velyA and the mass at this point.
Now set up the above mathematical solution in Excel and use the values of g, 𝑣𝑔𝑎𝑠 , 𝑚0 and also t
and 𝑚(𝑡) to calculate the theoretical speed just before burnout. Calculate the percentage error (see
last week’s worksheet).
If this is acceptable, then increase the value of deltaT and repeat. If the error is unacceptable then
decrease the value of deltaT and repeat. Does your code work to an acceptable level of error?
5
Validation Test (1). We are now going to test our simulation code (without drag) for the above
parameters, and using the deltaT you have selected for a vertically launched rocket without drag.
Import the data set you have generated above into Excel, and also compute the mathematical
solution for v(t) as indicated above. Plot a graph of the experimental and theoretical velocities
against time and check that they agree.
Also plot the theoretical velocity against the experimental velocity. This should be a straight line
with gradient 1.0 if all is well. Any deviation from this straight line indicates the model may not be
valid.
6
Validation Test (2). Here we are going to test the simulation with drag to validate the drag model.
As discussed in Chapter 6, when a rocket is in the burn-out phase (where there is no propulsive
force) then it falls and reaches a “terminal velocity” where the forces due to gravitational
acceleration and drag cancel, so the acceleration is zero and the velocity becomes constant. This
“terminal velocity” is given by the expression
𝑚𝑔
𝑣𝑡𝑒𝑟𝑚 = √
𝐷
In the UDK Editor, set the value of initZ to a reasonable number, and choose a reasonable value for
D (e.g. 1.0). Run the experiment and record the value of velyZ. Confirm that this experimental value
agrees with the theoretical value calculated from the above expression to an acceptable degree.
7
Plan your Simulation Study. You could choose one of the approaches below, or others you may
consider.
(1) Investigate the effects of changing the value of drag on the range and maximum height of the
rocket. I suggest the following parameter set: gravity = 9.8, dMdT = 1.0, vGas = 200, massRocket =
2.0, initMassFuel = 2.0, drag = your variable.
(2) Compare the “shape” of the rocket trajectory (path in the y-z plane using dispY and dispZ) with
the shape of a simple projectile without propulsion (last week). I suggest you look at the “zero drag”
option.
(3) Consider changing the values of massRocket and initMassFuel while keeping the sum the
same, at a value of 4.0.
8
Conduct your Simulation Study. Now conduct your planned simulation study. Change your
chosen parameter to a range of values (I suggest 5 or more), log some data and analyse it. Don’t
forget to make several ‘runs’ for each parameter value.
Try to make some conclusions from your study. These will normally consist of a few lines of text.
Note, I do not expect you to carry out a full statistical analysis of your data as explained in the
Research Methods module, there is just not enough time available. However if you wish to do this
you will need to repeat each experiment 20-30 times.
Download