-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodelrocketsimulator.htm
304 lines (304 loc) · 9.9 KB
/
modelrocketsimulator.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Model Rocket Simulator</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script src="jquery-1.8.2.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="CSPL.js"></script>
<script src="spin.min.js"></script>
<script src="modelrocketsimulator.js"></script>
</head>
<body onload="init();">
<div id="container">
<h1>Model Rocket Simulator</h1>
<div id="step1">
<h2>Rocket Design</h2>
<div id="status1" class="status"></div>
<div id="status2" class="status"></div>
<form action="#" method="get" onsubmit="start();return false;">
<table id="setup">
<tr>
<th>Rocket mass at liftoff without motor(s)</th>
<td><input type="text" name="m" id="m" value="34.0" onkeyup="heavycheck();"/><span class="unit">g</span></td>
</tr>
<tr>
<th>Diameter of rocket, widest part</th>
<td><input type="text" name="d" id="d" value="25.0" onkeyup="diametercheck();"/><span class="unit">mm</span></td>
</tr>
<tr>
<th>Diameter of parachute</th>
<td><input type="text" name="d2" id="d2" value="30.5"/><span class="unit">cm</span></td>
</tr><!--
</table>
</div>
<div id="step2">
<!--<h2>Step 2. Choose a motor</h2>-->
<tr>
<th>Motor</th>
<td>
<select name="engine" id="engine" onchange="selectEngine(this.value);">
<option value="Estes_A8-3">Estes A8-3</option>
<option value="Estes_B6-4">Estes B6-4</option>
<option value="Estes_C6-5">Estes C6-5</option>
<option value="Estes_C6-7">Estes C6-7</option>
<option value="Estes_D12-3">Estes D12-3</option>
<option value="Estes_D12-5">Estes D12-5</option>
<option value="Estes_F15-5">Estes F15-5</option>
<option value="Estes_F26-5">Estes F26-5</option>
<option value="Estes_F50-5">Estes F50-5</option>
<option value="Klima_A6-4">Klima A6-4</option>
<option value="Klima_B4-4">Klima B4-4</option>
<option value="Klima_C6-3">Klima C6-3</option>
<option value="Klima_C6-3">Klima C6-5</option>
<option value="Klima_C6-3">Klima C6-7</option>
<option value="Klima_D9-3">Klima D9-3</option>
<option value="Klima_D9-3">Klima D9-5</option>
<option value="Klima_D9-3">Klima D9-7</option>
<option value="Klima_D9-3">Klima D9-9</option>
<option value="Klima_D9-3">Klima D9-11</option>
<option value="Klima_D9-3">Klima D9-13</option>
<!--
<option value="Klima_C2-0">Klima C2-0</option>
<option value="Klima_D3-0">Klima D3-0</option>
<option value="Zink_C6-0">Zink C6-0</option>
<option value="Zink_D12-0">Zink D12-0</option>
<option value="Zink_D10-0">Zink D10-0</option>
<option value="Zink_E19-0">Zink E19-0</option>
<option value="Zink_E21-0">Zink E21-0</option>
-->
</select>
</td>
</tr>
<tr>
<th>Number of parallel motors</th>
<!--<td><input type="number" id="noe" value="1" min="1" max="7" onkeyup="if(this.value>7){this.value=7;};if(this.value<1){this.value=1;}" onchange="diametercheck();heavycheck();"/></td>-->
<td><input type="text" id="noe" value="1" onchange="diametercheck();heavycheck();"/></td>
</tr>
</table>
<!--<div style="float:right;">
<table>
<tr>
<th colspan="2">Motor Data</th>
</tr>
<tr>
<th>Manufacturer</th>
<td></td>
</tr>
<tr>
<th>Class</th>
<td></td>
</tr>
<tr>
<th>Total impulse</th>
<td></td>
</tr>
<tr>
<th>Manufacturer</th>
<td></td>
</tr>
<tr>
<th>Manufacturer</th>
<td></td>
</tr>
<tr>
<th>Manufacturer</th>
<td></td>
</tr>
<tr>
<th>Manufacturer</th>
<td></td>
</tr>
</table>
</div>
-->
<div id="thrustcurve"></div>
</div>
<div id="step3">
<!--<h2>Step 3.</h2>-->
<!--<button id="launchbutton" onclick="start();"/>Launch</button>-->
<input type="submit" id="launchbutton" value="Launch" style="display: block; padding:10px;"/>
</div>
</form>
<div id="output">
<h2><a id="results">Flight Simulation Results</a></h2>
<div id="status3" class="status"></div>
<div>
<table id="resulttable">
<tr>
<th>Ignition time</th>
<td id="ignition"></td>
<td class="unit">s</td>
</tr>
<tr>
<th> </th>
<td> </td>
</tr>
<tr>
<th>Liftoff time</th>
<td id="liftoff"></td>
<td class="unit">s</td>
</tr>
<tr>
<th>Rod time</th>
<td id="rodt"></td>
<td class="unit">s</td>
</tr>
<tr>
<th>Rod velocity</th>
<td id="rodv"></td>
<td class="unit">m/s</td>
<td id="rod_velocity_warning" class="warning"></td>
</tr>
<tr>
<th> </th>
<td> </td>
</tr>
<tr>
<th>Burnout time</th>
<td id="burnout_time"></td>
<td class="unit">s</td>
</tr>
<tr>
<th>Burnout altitude</th>
<td id="burnout_altitude"></td>
<td class="unit">m</td>
</tr>
<tr>
<th>Burnout velocity</th>
<td id="burnout_velocity"></td>
<td class="unit">m/s</td>
</tr>
<tr>
<th>Total impulse</th>
<td id="burnout_totalimp"></td>
<td class="unit">N·s<span id="ticlass"></span></td>
</tr>
<tr>
<th>Specific impulse</th>
<td id="burnout_speciimp"></td>
<td class="unit">s</td>
</tr>
<tr>
<th>Exhaust velocity</th>
<td id="burnout_exhauvel"></td>
<td class="unit">m/s</td>
</tr>
<tr>
<th> </th>
<td> </td>
</tr>
<tr>
<th>Maximum G-load</th>
<td id="max_gees"></td>
<td class="unit">G</td>
<td id="acceleration_warning" class="warning"></td>
</tr>
<tr>
<th> </th>
<td> </td>
</tr>
<tbody id="apogee">
<tr>
<th>Apogee<sup style="font-size:0.5em">1</sup> time</th>
<td id="apogee_time"></td>
<td class="unit">s</td>
</tr>
<tr>
<th>Apogee altitude</th>
<td id="apogee_altitude"></td>
<td class="unit">m</td>
</tr>
<tr>
<th> </th>
<td> </td>
</tr>
</tbody>
<tbody id="deploy">
<tr>
<th>Deploy time</th>
<td id="deploy_time"></td>
<td class="unit">s</td>
<td id="deploy_time_warning" class="warning"></td>
</tr>
<tr>
<th>Deploy altitude</th>
<td id="deploy_altitude"></td>
<td class="unit">m</td>
</tr>
<tr>
<th>Deploy velocity</th>
<td id="deploy_velocity"></td>
<td class="unit">m/s</td>
<td id="deploy_velocity_warning" class="warning"></td>
</tr>
<tr>
<th> </th>
<td> </td>
</tr>
</tbody>
<tr>
<th>Landing time</th>
<td id="landing_time"></td>
<td class="unit">s</td>
</tr>
<tr>
<th>Landing velocity</th>
<td id="landing_velocity"></td>
<td class="unit">m/s</td>
<td id="landing_velocity_warning" class="warning"></td>
</tr>
<tr>
<td colspan="3">
<div style="border-top:1px solid black;padding-left:20px;font-size:0.5em;float:left;margin-top:20px;"><sup>1</sup>Apogee = maximum altitude</div>
</td>
</tr>
</table>
</div>
<div id="output_graphs">
<div style="clear:both;height:40px;"><!-- --></div>
<div id="altitude"></div>
<div id="velocity"></div>
<div id="acceleration"></div>
<div id="gees"></div>
<div id="temp"></div>
<div id="thrust"></div>
<div id="drag"></div>
<div id="mass"></div>
</div>
<!--
<div id="force"></div>
<div id="weight"></div>
-->
<div style="clear:both;"><!-- --></div>
</div>
<div style="clear:both;"><!-- --></div>
<div id="footer">By Steen Eiler Jørgensen 2014−2020 - <a href="#" onclick="$('#about').slideToggle();$('html, body').animate({scrollTop: $('#about').offset().top}, 2000);return false;">About</a> - Charts by <a href="http://www.highcharts.com/">Highcharts</a></div>
<div id="about">
<h2>About</h2>
<p>This is a very simple model rocket simulation program. It takes <a href="http://www.nar.org/standards-and-testing-committee/nar-certified-motors/">published thrust curve data</a> and interpolates that linearly.</p>
<p>Features:</p>
<ul>
<li>dt = 10 ms</li>
<li>g = 9.8 m/s²</li>
<li>Air density calculation is based on a temperature lapse rate of -0.0065 K/m, so only valid up until 11 km.</li>
<li>C<sub>d</sub> = 0.5 (Don't ask. Okay, ask.)</li>
</ul>
<p>Future improvements I'm considering:</p>
<ul>
<li>Complete modeling of the International Standard Atmosphere</li>
<li>More detailed gravity model: Decreasing gravitational acceleration with altitude</li>
<li>More rocket motors :)</li>
<li>Real time simulation (with JavaScript!)</li>
<li>Two-dimensional simulation for wind, downrange distance and gravity turn</li>
<li>Actually measuring the drag coefficient of a real rocket</li>
<li>Variable timesteps</li>
<li>Support for multistage rockets</li>
</ul>
<p>Let me know what you think!</p>
<p><a href="https://twitter.com/oz1sej">Twitter</a> | <a href="mailto:[email protected]">Email</a></p>
</div>
</div>
</body>
</html>