Skip to content

Commit 4d38425

Browse files
committed
cleanup variable defs
1 parent f788749 commit 4d38425

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

js/calc.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,10 @@ function calc_update() {
309309
balloon_mass = parseFloat(balloon_model.substr(1)) / 1000.0;
310310
payload_mass = payload_mass_g / 1000.0;
311311

312-
var ascent_rate = 0;
313-
var burst_altitude = 0;
314-
var time_to_burst = 0;
315-
var neck_lift = 0;
316312
var launch_radius = 0;
317313
var launch_volume = 0;
318314

319-
// volume of sphere is 4/3 * pi * r^3
315+
// assuming a sphere, so the volume is 4/3 * pi * r^3
320316
var burst_volume = (4.0/3.0) * Math.PI * Math.pow(burst_diameter / 2.0, 3);
321317

322318
if(target_burst_altitude_set) {
@@ -347,13 +343,13 @@ function calc_update() {
347343
var launch_volume = (4.0/3.0) * Math.PI * Math.pow(launch_radius, 3);
348344
var density_difference = rho_air - rho_gas;
349345
var gross_lift = launch_volume * density_difference;
350-
neck_lift = gross_lift - balloon_mass;
346+
var neck_lift = gross_lift - balloon_mass;
351347
var total_mass = payload_mass + balloon_mass;
352348
var free_lift = (gross_lift - total_mass) * gravity_accel;
353-
ascent_rate = Math.sqrt(free_lift / (0.5 * drag_coeff * launch_area * rho_air));
349+
var ascent_rate = Math.sqrt(free_lift / (0.5 * drag_coeff * launch_area * rho_air));
354350
var volume_ratio = launch_volume / burst_volume;
355-
burst_altitude = -(adm) * Math.log(volume_ratio);
356-
time_to_burst = burst_altitude / ascent_rate;
351+
var burst_altitude = -(adm) * Math.log(volume_ratio);
352+
var time_to_burst = burst_altitude / ascent_rate;
357353

358354
if(isNaN(ascent_rate)) {
359355
set_error('target_burst_altitude', "Altitude unreachable for this configuration.");

0 commit comments

Comments
 (0)