Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/autonoma.ca.git
calculators/rocket/aero/aero.js
-/**
- * The purpose of this code is to help calculate parameters required to
- * send a rocket into space using a combination of single-stage to orbit
- * (SSO) and an electromagnetic accelerator.
- */
-const GRAVITATIONAL_ACCELERATION = 0.10193679918451;
-
-// Shift magnitude
-const MAGNITUDE = 1000;
-
-// Convert from degrees C to K
-const CELSIUS_KELVIN = 273.15;
-
-// Specific gas constant for dry air
-const GAS_CONSTANT = 287.05;
-
-$(document).ready( function() {
- const fn_val = $.fn.val;
-
- /**
- * Avoid duplicate calls to parseFloat by overriding jQuery's val().
- */
- $.fn.val = function( value ) {
- // val() can be called with or without arguments: retain the behaviour.
- const result = (arguments.length >= 1) ?
- fn_val.call(this, value) : fn_val.call(this);
-
- return parseFloat( result );
- };
-
- /**
- * Recalculate the totals when an input value changes.
- */
- $(".variable").change( function() {
- const accelerator_radius = $("#accelerator_radius").val();
- const projectile_velocity = $("#projectile_velocity").val();
- const rocket_mass = $("#rocket_mass").val();
- const rocket_payload = $("#rocket_payload").val();
- const rocket_drag = $("#rocket_drag").val();
- const rocket_cross_section = $("#rocket_cross_section").val();
- const fuel_mass = $("#fuel_mass").val();
-
- // v^2
- const velocity_2 = projectile_velocity * projectile_velocity;
- // v^3
- const velocity_3 = velocity_2 * projectile_velocity;
-
- // Calculate maximum force exerted at peak acceleration.
- const total_centrifugal_force = velocity_2 / accelerator_radius;
- $("#total_centrifugal_force").val( total_centrifugal_force );
-
- // Convert maximum force exerted at peak acceleration into G forces.
- const total_centrifugal_force_g =
- total_centrifugal_force * GRAVITATIONAL_ACCELERATION;
- $("#total_centrifugal_force_g").val( total_centrifugal_force_g );
-
- const atmosphere_altitude = $("#atmosphere_altitude").val();
- const atmosphere_temperature = $("#atmosphere_temperature").val();
- const atmosphere_sea_level = $("#atmosphere_sea_level").val();
-
- const h = 0.0065 * atmosphere_altitude;
- const t = CELSIUS_KELVIN + atmosphere_temperature;
-
- // Calculate air pressure.
- const total_air_pressure = atmosphere_sea_level * Math.pow(
- 1 - (h / (h + t)), 5.257
- );
- $("#total_air_pressure").val( total_air_pressure );
-
- // Calculate and convert air density into kilograms.
- const total_air_density =
- total_air_pressure / (GAS_CONSTANT * t);
- $("#total_air_density").val( total_air_density );
-
- // Calculate drag force.
- const total_drag_force = 0.5
- * total_air_density * velocity_2
- * rocket_drag * rocket_cross_section;
- $("#total_drag_force").val( total_drag_force );
-
- // Compute total rocket mass.
- const total_rocket_mass = rocket_mass + rocket_payload + fuel_mass;
- $("#total_mass").val( total_rocket_mass );
-
- // Compute total rocket dry mass.
- const total_rocket_dry_mass = total_rocket_mass - fuel_mass;
- $("#total_dry_mass").val( total_rocket_dry_mass );
-
- // Calculate drag deceleration.
- const total_deceleration = total_drag_force / total_rocket_mass;
- $("#total_deceleration").val( total_deceleration );
-
- // Convert drag deceleration into G forces.
- const total_deceleration_g = total_deceleration * GRAVITATIONAL_ACCELERATION;
- $("#total_deceleration_g").val( total_deceleration_g );
-
- // 0.1 * 0.5 * (0.196 m^2) * (0.627 kg/m^3) * ((8000 m/s)^3)
-
- // Calculate friction in megawatts.
- const total_friction = 0.1 * rocket_drag * rocket_cross_section *
- total_air_density * velocity_3 / MAGNITUDE / MAGNITUDE;
- $("#total_friction").val( total_friction );
-
- // Display totals as comma-separated numbers.
- // See: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
- $("#totals").find("input").each( function() {
- if( $(this).val() ) {
- $(this).val( $(this).val().toLocaleString() );
- }
- });
- });
-
- // Force totals calculation on page load.
- $("#rocket_height").trigger( "change" );
-});
calculators/rocket/aero/aero.min.js
-var GRAVITATIONAL_ACCELERATION=.10193679918451,MAGNITUDE=1E3,CELSIUS_KELVIN=273.15,GAS_CONSTANT=287.05;
-$(document).ready(function(){var k=$.fn.val;$.fn.val=function(a){var c=1<=arguments.length?k.call(this,a):k.call(this);return parseFloat(c)};$(".variable").change(function(){var a=$("#accelerator_radius").val(),c=$("#projectile_velocity").val(),e=$("#rocket_mass").val(),m=$("#rocket_payload").val(),f=$("#rocket_drag").val(),l=$("#rocket_cross_section").val(),b=$("#fuel_mass").val(),d=c*c;c*=d;a=d/a;$("#total_centrifugal_force").val(a);a*=GRAVITATIONAL_ACCELERATION;$("#total_centrifugal_force_g").val(a);
-var g=$("#atmosphere_altitude").val(),h=$("#atmosphere_temperature").val();a=$("#atmosphere_sea_level").val();g*=.0065;h=CELSIUS_KELVIN+h;a*=Math.pow(1-g/(g+h),5.257);$("#total_air_pressure").val(a);a/=GAS_CONSTANT*h;$("#total_air_density").val(a);d=.5*a*d*f*l;$("#total_drag_force").val(d);e=e+m+b;$("#total_mass").val(e);b=e-b;$("#total_dry_mass").val(b);b=d/e;$("#total_deceleration").val(b);b*=GRAVITATIONAL_ACCELERATION;$("#total_deceleration_g").val(b);f=.1*f*l*a*c/MAGNITUDE/MAGNITUDE;$("#total_friction").val(f);
-$("#totals").find("input").each(function(){$(this).val()&&$(this).val($(this).val().toLocaleString())})});$("#rocket_height").trigger("change")});
calculators/rocket/aero/calculator.js
+/**
+ * The purpose of this code is to help calculate parameters required to
+ * send a rocket into space using a combination of single-stage to orbit
+ * (SSO) and an electromagnetic accelerator.
+ */
+const GRAVITATIONAL_ACCELERATION = 0.10193679918451;
+
+// Shift magnitude
+const MAGNITUDE = 1000;
+
+// Convert from degrees C to K
+const CELSIUS_KELVIN = 273.15;
+
+// Specific gas constant for dry air
+const GAS_CONSTANT = 287.05;
+
+$(document).ready( function() {
+ const fn_val = $.fn.val;
+
+ /**
+ * Avoid duplicate calls to parseFloat by overriding jQuery's val().
+ */
+ $.fn.val = function( value ) {
+ // val() can be called with or without arguments: retain the behaviour.
+ const result = (arguments.length >= 1) ?
+ fn_val.call(this, value) : fn_val.call(this);
+
+ return parseFloat( result );
+ };
+
+ /**
+ * Recalculate the totals when an input value changes.
+ */
+ $(".variable").change( function() {
+ const accelerator_radius = $("#accelerator_radius").val();
+ const projectile_velocity = $("#projectile_velocity").val();
+ const rocket_mass = $("#rocket_mass").val();
+ const rocket_payload = $("#rocket_payload").val();
+ const rocket_drag = $("#rocket_drag").val();
+ const rocket_cross_section = $("#rocket_cross_section").val();
+ const fuel_mass = $("#fuel_mass").val();
+
+ // v^2
+ const velocity_2 = projectile_velocity * projectile_velocity;
+ // v^3
+ const velocity_3 = velocity_2 * projectile_velocity;
+
+ // Calculate maximum force exerted at peak acceleration.
+ const total_centrifugal_force = velocity_2 / accelerator_radius;
+ $("#total_centrifugal_force").val( total_centrifugal_force );
+
+ // Convert maximum force exerted at peak acceleration into G forces.
+ const total_centrifugal_force_g =
+ total_centrifugal_force * GRAVITATIONAL_ACCELERATION;
+ $("#total_centrifugal_force_g").val( total_centrifugal_force_g );
+
+ const atmosphere_altitude = $("#atmosphere_altitude").val();
+ const atmosphere_temperature = $("#atmosphere_temperature").val();
+ const atmosphere_sea_level = $("#atmosphere_sea_level").val();
+
+ const h = 0.0065 * atmosphere_altitude;
+ const t = CELSIUS_KELVIN + atmosphere_temperature;
+
+ // Calculate air pressure.
+ const total_air_pressure = atmosphere_sea_level * Math.pow(
+ 1 - (h / (h + t)), 5.257
+ );
+ $("#total_air_pressure").val( total_air_pressure );
+
+ // Calculate and convert air density into kilograms.
+ const total_air_density =
+ total_air_pressure / (GAS_CONSTANT * t);
+ $("#total_air_density").val( total_air_density );
+
+ // Calculate drag force.
+ const total_drag_force = 0.5
+ * total_air_density * velocity_2
+ * rocket_drag * rocket_cross_section;
+ $("#total_drag_force").val( total_drag_force );
+
+ // Compute total rocket mass.
+ const total_rocket_mass = rocket_mass + rocket_payload + fuel_mass;
+ $("#total_mass").val( total_rocket_mass );
+
+ // Compute total rocket dry mass.
+ const total_rocket_dry_mass = total_rocket_mass - fuel_mass;
+ $("#total_dry_mass").val( total_rocket_dry_mass );
+
+ // Calculate drag deceleration.
+ const total_deceleration = total_drag_force / total_rocket_mass;
+ $("#total_deceleration").val( total_deceleration );
+
+ // Convert drag deceleration into G forces.
+ const total_deceleration_g = total_deceleration * GRAVITATIONAL_ACCELERATION;
+ $("#total_deceleration_g").val( total_deceleration_g );
+
+ // 0.1 * 0.5 * (0.196 m^2) * (0.627 kg/m^3) * ((8000 m/s)^3)
+
+ // Calculate friction in megawatts.
+ const total_friction = 0.1 * rocket_drag * rocket_cross_section *
+ total_air_density * velocity_3 / MAGNITUDE / MAGNITUDE;
+ $("#total_friction").val( total_friction );
+
+ // Display totals as comma-separated numbers.
+ // See: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
+ $("#totals").find("input").each( function() {
+ if( $(this).val() ) {
+ $(this).val( $(this).val().toLocaleString() );
+ }
+ });
+ });
+
+ // Force totals calculation on page load.
+ $("#rocket_height").trigger( "change" );
+});
calculators/rocket/aero/calculator.min.js
+var GRAVITATIONAL_ACCELERATION=.10193679918451,MAGNITUDE=1E3,CELSIUS_KELVIN=273.15,GAS_CONSTANT=287.05;
+$(document).ready(function(){var k=$.fn.val;$.fn.val=function(a){var c=1<=arguments.length?k.call(this,a):k.call(this);return parseFloat(c)};$(".variable").change(function(){var a=$("#accelerator_radius").val(),c=$("#projectile_velocity").val(),e=$("#rocket_mass").val(),m=$("#rocket_payload").val(),f=$("#rocket_drag").val(),l=$("#rocket_cross_section").val(),b=$("#fuel_mass").val(),d=c*c;c*=d;a=d/a;$("#total_centrifugal_force").val(a);a*=GRAVITATIONAL_ACCELERATION;$("#total_centrifugal_force_g").val(a);
+var g=$("#atmosphere_altitude").val(),h=$("#atmosphere_temperature").val();a=$("#atmosphere_sea_level").val();g*=.0065;h=CELSIUS_KELVIN+h;a*=Math.pow(1-g/(g+h),5.257);$("#total_air_pressure").val(a);a/=GAS_CONSTANT*h;$("#total_air_density").val(a);d=.5*a*d*f*l;$("#total_drag_force").val(d);e=e+m+b;$("#total_mass").val(e);b=e-b;$("#total_dry_mass").val(b);b=d/e;$("#total_deceleration").val(b);b*=GRAVITATIONAL_ACCELERATION;$("#total_deceleration_g").val(b);f=.1*f*l*a*c/MAGNITUDE/MAGNITUDE;$("#total_friction").val(f);
+$("#totals").find("input").each(function(){$(this).val()&&$(this).val($(this).val().toLocaleString())})});$("#rocket_height").trigger("change")});
calculators/rocket/payload/FlightRecorder.js
+import Telemetry from './Telemetry.js';
+
class FlightRecorder {
constructor() {
}
}
-
+export default FlightRecorder;
calculators/rocket/payload/Rocket.js
const hThrust = thrusting ? Math.sqrt(Math.pow(this.totalThrust, 2) - Math.pow(vThrust, 2)) : 0.0;
+ console.assert(this.mass > 0);
+
this.hAcceleration = dragForce[0] / this.mass + hThrust / this.mass;
this.vAcceleration = dragForce[1] / this.mass + this.planet.gravity(this.latitude, this.altitude) + vThrust / this.mass;
calculators/rocket/payload/Selector.js
}
+export default $;
+
calculators/rocket/payload/Telemetry.js
}
+export default Telemetry;
+
calculators/rocket/payload/calculator.js
+/**
+ * The purpose of this code is to help calculate parameters required to
+ * send a rocket into space using a combination of single-stage to orbit
+ * and an electromagnetic accelerator.
+ */
+
+import Earth from './Earth.js';
+import Rocket from './Rocket.js';
+import FlightRecorder from './FlightRecorder.js';
+import {$} from './Selector.js';
+
+document.querySelectorAll('.submit').forEach(button => {
+ button.addEventListener('click', function (event) {
+ event.preventDefault();
+
+ // Inputs
+ const SURFACE_TEMPERATURE = 25; // Celsius
+ const RELATIVE_HUMIDITY = 86.34; // per cent
+ const INITIAL_VELOCITY = 8; // Mach
+ const INITIAL_LATITUDE = 1.469167; // meters
+ const INITIAL_ALTITUDE = 6212; // meters
+ const TARGET_ALTITUDE = 400.0 * 1000.0; // meters
+
+ const ROCKET_DIAMETER = 0.6;
+ const WET_MASS = 250;
+ const PAYLOAD_MASS = 25;
+ const DRAG_COEFFICIENT = 0.219;
+ const SPECIFIC_IMPULSE = 1400.0; // seconds
+
+ const earth = new Earth(SURFACE_TEMPERATURE, RELATIVE_HUMIDITY);
+
+ const SPEED_OF_SOUND = earth.soundSpeed(INITIAL_ALTITUDE);
+ const INITIAL_HORIZONTAL_VELOCITY = 0;
+ const INITIAL_VERTICAL_VELOCITY = INITIAL_VELOCITY * SPEED_OF_SOUND;
+
+ const blackBox = new FlightRecorder();
+ const rocket = new Rocket(
+ WET_MASS,
+ PAYLOAD_MASS,
+ ROCKET_DIAMETER,
+ DRAG_COEFFICIENT,
+ SPECIFIC_IMPULSE
+ );
+
+ rocket.on(earth);
+ rocket.recorder(blackBox);
+ rocket.translocate(INITIAL_LATITUDE, INITIAL_ALTITUDE);
+ rocket.apogee(TARGET_ALTITUDE);
+ rocket.launch(INITIAL_HORIZONTAL_VELOCITY, INITIAL_VERTICAL_VELOCITY);
+
+ let time = 0.0;
+
+ while (rocket.flying() && rocket.below(TARGET_ALTITUDE)) {
+ time += 0.01;
+ rocket.fly(time);
+ }
+
+ blackBox.plot();
+ });
+});
calculators/rocket/payload/index.html
Form field values are explained in the <a href="#equations">Equations</a>
section, below.
- </p><form id="calculator"><fieldset id="environment"><legend>Environment</legend><label for="surface_temperature">Surface temperature (℃)</label><input tabindex="1" autofocus class="variable" type="number" step="1" min="-80" value="25" id="surface_temperature" name="surface_temperature"><label for="relative_humidity">Relative humidity</label><input tabindex="2" class="variable" type="number" step="0.01" min="0" value="86.34" id="surface_temperature" name="surface_temperature"></fieldset><fieldset id="mission"><legend>Mission</legend><label for="initial_velocity">Initial velocity (Mach)</label><input tabindex="3" class="variable" type="number" step="1" min="0" value="8" id="initial_velocity" name="initial_velocity"><label for="initial_latitude">Initial latitude (°)</label><input tabindex="4" class="variable" type="number" step="any" min="0" value="1.469167" id="initial_latitude" name="initial_latitude"><label for="initial_altitude">Initial altitude (m)</label><input tabindex="5" class="variable" type="number" step="1" min="0" value="6212" id="initial_altitude" name="initial_altitude"><label for="target_altitude">Target altitude (km)</label><input tabindex="6" class="variable" type="number" step="1" min="0" value="400" id="target_altitude" name="target_altitude"></fieldset><fieldset id="rocket"><legend>Rocket</legend><label for="diameter">Diameter (m)</label><input tabindex="7" class="variable" type="number" step="0.1" min="0" value="0.6" id="diameter" name="diameter"><label for="wet_mass">Wet mass (kg)</label><input tabindex="8" class="variable" type="number" step="1" min="0" value="250" id="wet_mass" name="wet_mass"><label for="payload">Payload mass (kg)</label><input tabindex="9" class="variable" type="number" step="1" min="1" value="25" id="payload_mass" name="payload_mass"><label for="drag_coefficient">Drag coefficient</label><input tabindex="10" class="variable" type="number" step="any" min="0" value="0.219" id="drag_coefficient" name="drag_coefficient"><label for="specific_impulse">Specific impulse (s)</label><input tabindex="11" class="variable" type="number" step="1" min="1" value="1700" id="specific_impulse" name="specific_impulse"></fieldset><button class="submit">Simulate</button><fieldset id="result"><legend>Result</legend></fieldset></form><a name="equations"></a><h1>Equations</h1><p>
+ </p><form id="calculator"><button class="submit">Simulate</button><fieldset id="environment"><legend>Environment</legend><label for="surface_temperature">Surface temperature (℃)</label><input tabindex="1" class="variable" type="number" step="1" min="-80" value="25" id="surface_temperature" name="surface_temperature"><label for="relative_humidity">Relative humidity</label><input tabindex="2" class="variable" type="number" step="0.01" min="0" value="86.34" id="surface_temperature" name="surface_temperature"></fieldset><fieldset id="mission"><legend>Mission</legend><label for="initial_velocity">Initial velocity (Mach)</label><input tabindex="3" class="variable" type="number" step="1" min="0" value="8" id="initial_velocity" name="initial_velocity"><label for="initial_latitude">Initial latitude (°)</label><input tabindex="4" class="variable" type="number" step="any" min="0" value="1.469167" id="initial_latitude" name="initial_latitude"><label for="initial_altitude">Initial altitude (m)</label><input tabindex="5" class="variable" type="number" step="1" min="0" value="6212" id="initial_altitude" name="initial_altitude"><label for="target_altitude">Target altitude (km)</label><input tabindex="6" class="variable" type="number" step="1" min="1" value="400" id="target_altitude" name="target_altitude"></fieldset><fieldset id="rocket"><legend>Rocket</legend><label for="diameter">Diameter (m)</label><input tabindex="7" class="variable" type="number" step="any" min="0" value="0.6" id="diameter" name="diameter"><label for="wet_mass">Wet mass (kg)</label><input tabindex="8" class="variable" type="number" step="1" min="1" value="250" id="wet_mass" name="wet_mass" oninput="this.value = Math.abs(this.value)"><label for="payload">Payload mass (kg)</label><input tabindex="9" class="variable" type="number" step="1" min="1" value="25" id="payload_mass" name="payload_mass" oninput="this.value = Math.abs(this.value)"><label for="drag_coefficient">Drag coefficient</label><input tabindex="10" class="variable" type="number" step="any" min="0" value="0.219" id="drag_coefficient" name="drag_coefficient"><label for="specific_impulse">Specific impulse (s)</label><input tabindex="11" class="variable" type="number" step="1" min="1" value="1700" id="specific_impulse" name="specific_impulse"></fieldset><button class="submit">Simulate</button><fieldset id="result"><legend>Result</legend></fieldset></form><a name="equations"></a><h1>Equations</h1><p>
This section describes equation inputs and outputs.
</p><h2>Centrifugal force</h2><p class="equation">
value from that calculation can be provided as an input to the calculator.
</p><h2>Air pressure</h2><p class="equation">
- $$P = P_{sea} \cdot \bigg[ 1 + \frac{L}{T} \cdot h \bigg] ^ {\frac{-g_0 \cdot M}{R \cdot L}}$$
+ $$P = P_{sea} \bigg[ 1 + \frac{L}{T} h \bigg] ^ {\frac{-g_0 \cdot M}{R \cdot L}}$$
</p><div class="variables"><div class="input"><h3>Input</h3><dl><dt>$P_{sea}$</dt><dd>Sea level pressure (101325&nbsp;Pa)</dd><dt>$L$</dt><dd>Lapse rate (-0.0065&nbsp;K/m)</dd><dt>$T$</dt><dd>Temperature (K)</dd><dt>$h$</dt><dd>Altitude (m)</dd><dt>$g_0$</dt><dd>Gravitational acceleration constant (9.80665&nbsp;m/s<sup>2</sup>)</dd><dt>$M$</dt><dd>Earth's atmospheric molar mass (0.0289644&nbsp;kg/mol)</dd><dt>$R$</dt><dd>Universal gas constant (8.31432&nbsp;Nâ‹…m/molâ‹…K)</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$P$</dt><dd>Air pressure (Pa)</dd></dl></div></div><h2>Tetens equation</h2><p class="equation">
- $$P_v = 0.61078 \cdot e ^ {17.27 \cdot T / (T + 237.31)}$$
+ $$P_v = 0.61078 \cdot e ^ {17.27 T / (T + 237.31)}$$
</p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$T$</dt><dd>Temperature (℃)</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$P_v$</dt><dd>Vapour pressure (Pa)</dd></dl></div></div><h2>Air density</h2><p class="equation">
$$\rho = \left(\frac{P_d}{R_d \cdot T}\right) + \left(\frac{P_v}{R_v \cdot T}\right)$$
- </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$P_d$</dt><dd>Partial pressure of dry air (Pa)</dd><dt>$P_v$</dt><dd>Partial pressure of water vapor (Pa)</dd><dt>$T$</dt><dd>Temperature (℃)</dd><dt>$R_d$</dt><dd>Specific gas constant for dry air (287.058&nbsp;J/(kg⋅K))</dd><dt>$R_v$</dt><dd>Specific gas constant for water vapour (461.495&nbsp;J/(kg⋅K))</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$\rho$</dt><dd>Air density (kg/m<sup>3</sup>)</dd></dl></div></div><h2>Earth radius</h2><p class="equation">
+ </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$P_d$</dt><dd>Partial pressure of dry air (Pa)</dd><dt>$P_v$</dt><dd>Partial pressure of water vapor (Pa)</dd><dt>$T$</dt><dd>Temperature (℃)</dd><dt>$R_d$</dt><dd>Specific gas constant for dry air (287.058&nbsp;J/(kg⋅K))</dd><dt>$R_v$</dt><dd>Specific gas constant for water vapour (461.495&nbsp;J/(kg⋅K))</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$\rho$</dt><dd>Air density (kg/m<sup>3</sup>)</dd></dl></div></div><h2>Earth effective radius</h2><p class="equation">
$$R_f = \frac{R_e - R_{pole}}{R_e}$$
- $$R_E = R_e \cdot (1 - R_f \cdot sin^2 \phi)$$
- </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$R_e$</dt><dd>Equatorial radius (m)</dd><dt>$R_{pole}$</dt><dd>Polar radius (m)</dd><dt>$\phi$</dt><dd>Latitude (°)</dd></dl></div><div class="output"><h3>Outputs</h3><dl><dt>$R_f$</dt><dd>Flattening ratio</dd><dt>$R_E$</dt><dd>Effective radius (m)</dd></dl></div></div><h2>Rotational speed</h2><p class="equation">
- $$\omega = R_E(\varphi) \cdot \frac{2 \pi}{T_s}$$
- </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$R_E$</dt><dd>Effective radius (m)</dd><dt>$\varphi$</dt><dd>Latitude (°)</dd><dt>$T_s$</dt><dd>Sidereal time (86164.0905 s)</dd></dl></div><div class="output"><h3>Outputs</h3><dl><dt>$\omega$</dt><dd>Rotational speed (m/s)</dd></dl></div></div><h2>Orbital speed</h2><p class="equation">
- $$v_{orb} = \sqrt{\frac{g_0}{R_E(\varphi) + h}}$$
- </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$g_0$</dt><dd>Standard gravity (m/s<sup>2</sup>)</dd><dt>$R_E$</dt><dd>Effective radius (m)</dd><dt>$\varphi$</dt><dd>Latitude (°)</dd><dt>$h$</dt><dd>Altitude (m)</dd></dl></div><div class="output"><h3>Outputs</h3><dl><dt>$v_{orb}$</dt><dd>Orbital speed (m/s)</dd></dl></div></div><h2>Gravity</h2><p class="equation">
- $$g = g_0 \left(1 + 0.0053024 \cdot \sin^2(\varphi) - 0.0000058 \cdot \sin^2(2\varphi)\right) + \left(-3.086 \times 10^{-6} \cdot h\right)$$
- </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$g_0$</dt><dd>Surface gravity (m/s<sup>2</sup>)</dd><dt>$\varphi$</dt><dd>Latitude (°)</dd><dt>$h$</dt><dd>Altitude (m)</dd></dl></div><div class="output"><h3>Outputs</h3><dl><dt>$g$</dt><dd>Gravity(m/s<sup>2</sup>)</dd></dl></div></div><h2>Speed of sound</h2><p class="equation">
- $$cc = 331.3 \cdot \sqrt{1 + \frac{T_s - \left(\frac{6h}{1000}\right)}{273.15}}$$
- </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$T_s$</dt><dd>Surface temperature (℃)</dd><dt>$h$</dt><dd>Altitude (m)</dd></dl></div><div class="output"><h3>Outputs</h3><dl><dt>$cc$</dt><dd>Speed of sound (m/s)</dd></dl></div></div><h2>Drag force</h2><p class="equation">
- $$F_d = \frac{1}{2} \rho v^2 C_d A$$
- </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$\rho$</dt><dd>Air density (kg/m<sup>3</sup>)</dd><dt>$v$</dt><dd>Projectile exit velocity (km/s)</dd><dt>$C_d$</dt><dd>Coefficient of drag</dd><dt>$A$</dt><dd>Cross-section area (m<sup>2</sup>)</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$F_d$</dt><dd>Drag force (kN)</dd></dl></div></div><h2>Drag deceleration</h2><p class="equation">
- $$a_d = F_d / M$$
- </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$F_d$</dt><dd>Drag force (kN)</dd><dt>$M$</dt><dd>Mass (kg)</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$a_d$</dt><dd>Drag deceleration (m/s<sup>2</sup>)</dd></dl></div></div><h2>Friction</h2><p class="equation">
- $$F = 0.1 C_d A a_d v^3$$
- </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$C_d$</dt><dd>Coefficient of drag</dd><dt>$A$</dt><dd>Cross-section area (m<sup>2</sup>)</dd><dt>$a_d$</dt><dd>Drag deceleration (m/s<sup>2</sup>)</dd><dt>$v$</dt><dd>Projectile exit velocity (km/s)</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$F$</dt><dd>Heat experienced by rocket due to friction</dd></dl></div></div></main><footer class="section footer"></footer></div><script defer src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><script defer src="calculator.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/auto-render.min.js"></script><script>
+ $$R_E = R_e (1 - R_f \cdot sin^2 \varphi)$$
+ </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$R_e$</dt><dd>Equatorial radius (m)</dd><dt>$R_{pole}$</dt><dd>Polar radius (m)</dd><dt>$\varphi$</dt><dd>Latitude (°)</dd></dl></div><div class="output"><h3>Outputs</h3><dl><dt>$R_f$</dt><dd>Flattening ratio</dd><dt>$R_E$</dt><dd>Effective radius (m)</dd></dl></div></div><h2>Rotational speed</h2><p class="equation">
+ $$\omega = R_E(\varphi) \frac{2 \pi}{T_s}$$
+ </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$R_E$</dt><dd>Effective radius (m)</dd><dt>$\varphi$</dt><dd>Latitude (°)</dd><dt>$T_s$</dt><dd>Sidereal time (86164.0905&nbsp;s)</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$\omega$</dt><dd>Rotational speed (m/s)</dd></dl></div></div><h2>Orbital speed</h2><p class="equation">
+ $$v_{orb} = \sqrt{\frac{G}{R_E(\varphi) + h}}$$
+ </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$G$</dt><dd>Standard gravitational parameter (m/s<sup>2</sup>)</dd><dt>$R_E$</dt><dd>Effective radius (m)</dd><dt>$\varphi$</dt><dd>Latitude (°)</dd><dt>$h$</dt><dd>Altitude (m)</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$v_{orb}$</dt><dd>Orbital speed (m/s)</dd></dl></div></div><h2>Gravity</h2><p class="equation">
+ $$g = g_0 \big[1 + 0.0053024 \cdot sin^2(\varphi) - 0.0000058 \cdot sin^2(2\varphi)\big] + \left(-3.086 \times 10^{-6} h\right)$$
+ </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$g_0$</dt><dd>Surface gravity (m/s<sup>2</sup>)</dd><dt>$\varphi$</dt><dd>Latitude (°)</dd><dt>$h$</dt><dd>Altitude (m)</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$g$</dt><dd>Gravity (m/s<sup>2</sup>)</dd></dl></div></div><h2>Speed of sound</h2><p class="equation">
+ $$cc = cc_s \sqrt{1 + \frac{T_s - \left(\frac{6h}{1000}\right)}{273.15}}$$
+ </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$cc_s$</dt><dd>Surface speed of sound (331.3&nbsp;m/s)</dd><dt>$T_s$</dt><dd>Surface temperature (℃)</dd><dt>$h$</dt><dd>Altitude (m)</dd></dl></div><div class="output"><h3>Output</h3><dl><dt>$cc$</dt><dd>Speed of sound (m/s)</dd></dl></div></div><h2>Drag force</h2><p class="equation">
+ $$\rho = \rho_{air}(h)$$
+ $$v_{net} = v_h - \omega$$
+ $$v_{total} = \sqrt{v_{net}^2 + v_v^2}$$
+ $$\left( F_{d_h}, F_{d_v} \right) = \left( -\frac{1}{2} \rho \cdot C_d \cdot v_{total} \cdot v_{net}, -\frac{1}{2} \rho \cdot C_d \cdot v_{total} \cdot v_v \right)$$
+ </p><div class="variables"><div class="input"><h3>Inputs</h3><dl><dt>$\rho_{air}$</dt><dd>Air density function (kg/m<sup>3</sup>)</dd><dt>$h$</dt><dd>Altitude (meters)</dd><dt>$v_h$</dt><dd>Horizontal velocity (m/s)</dd><dt>$\omega$</dt><dd>Rotational speed (m/s)</dd><dt>$v_v$</dt><dd>Vertical velocity (m/s)</dd><dt>$C_d$</dt><dd>Ballistic coefficient</dd></dl></div><div class="output"><h3>Outputs</h3><dl><dt>$\rho$</dt><dd>Air density at altitude (kg/m<sup>3</sup>)</dd><dt>$v_{net}$</dt><dd>Net horizontal velocity (m/s)</dd><dt>$v_{total}$</dt><dd>Total speed (m/s)</dd><dt>$F_{d_h}$</dt><dd>Horizontal drag force (N)</dd><dt>$F_{d_v}$</dt><dd>Vertical drag force (N)</dd></dl></div></div></main><footer class="section footer"></footer></div><script defer src="//code.jquery.com/jquery-1.12.4.min.js"></script><script defer type="module" src="calculator.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/auto-render.min.js"></script><script>
renderMathInElement(
document.body, {
calculators/rocket/payload/launch.xsl
<form id="calculator">
- <fieldset id="environment">
- <legend>Environment</legend>
- <label for="surface_temperature">Surface temperature (&#x2103;)</label>
- <input tabindex="1" autofocus="autofocus"
- class="variable" type="number" step="1" min="-80" value="25"
- id="surface_temperature" name="surface_temperature" />
-
- <label for="relative_humidity">Relative humidity</label>
- <input tabindex="2"
- class="variable" type="number" step="0.01" min="0" value="86.34"
- id="surface_temperature" name="surface_temperature" />
- </fieldset>
-
- <fieldset id="mission">
- <legend>Mission</legend>
- <label for="initial_velocity">Initial velocity (Mach)</label>
- <input tabindex="3"
- class="variable" type="number" step="1" min="0" value="8"
- id="initial_velocity" name="initial_velocity" />
-
- <label for="initial_latitude">Initial latitude (&#x00b0;)</label>
- <input tabindex="4"
- class="variable" type="number" step="any" min="0" value="1.469167"
- id="initial_latitude" name="initial_latitude" />
-
- <label for="initial_altitude">Initial altitude (m)</label>
- <input tabindex="5"
- class="variable" type="number" step="1" min="0" value="6212"
- id="initial_altitude" name="initial_altitude" />
-
- <label for="target_altitude">Target altitude (km)</label>
- <input tabindex="6"
- class="variable" type="number" step="1" min="0" value="400"
- id="target_altitude" name="target_altitude" />
- </fieldset>
-
- <fieldset id="rocket">
- <legend>Rocket</legend>
- <label for="diameter">Diameter (m)</label>
- <input tabindex="7"
- class="variable" type="number" step="0.1" min="0" value="0.6"
- id="diameter" name="diameter" />
-
- <label for="wet_mass">Wet mass (kg)</label>
- <input tabindex="8"
- class="variable" type="number" step="1" min="0" value="250"
- id="wet_mass" name="wet_mass" />
-
- <label for="payload">Payload mass (kg)</label>
- <input tabindex="9"
- class="variable" type="number" step="1" min="1" value="25"
- id="payload_mass" name="payload_mass" />
-
- <label for="drag_coefficient">Drag coefficient</label>
- <input tabindex="10"
- class="variable" type="number" step="any" min="0" value="0.219"
- id="drag_coefficient" name="drag_coefficient" />
-
- <label for="specific_impulse">Specific impulse (s)</label>
- <input tabindex="11"
- class="variable" type="number" step="1" min="1" value="1700"
- id="specific_impulse" name="specific_impulse" />
- </fieldset>
-
- <button class="submit">Simulate</button>
-
- <fieldset id="result">
- <legend>Result</legend>
- </fieldset>
- </form>
-
- <a name="equations" />
- <h1>Equations</h1>
- <p>
- This section describes equation inputs and outputs.
- </p>
-
- <h2>Centrifugal force</h2>
- <p class="equation">
- $$a = v^2 / r$$
- $$g_{force} = 0.10193679918451 a$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$v$</dt>
- <dd>Projectile exit velocity (km/s)</dd>
- <dt>$r$</dt>
- <dd>Accelerator loop radius (km)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Outputs</h3>
- <dl>
- <dt>$a$</dt>
- <dd>Acceleration (km/s<sup>2</sup>)</dd>
- <dt>$g_{force}$</dt>
- <dd>Force experienced in terms of Earth's gravitational acceleration</dd>
- </dl>
- </div>
- </div>
-
- <h2>Cross-section area</h2>
- <p class="equation">
- $$A = \pi (d / 2)^2$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Input</h3>
- <dl>
- <dt>$d$</dt>
- <dd>Rocket diameter (m)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Output</h3>
- <dl>
- <dt>$A$</dt>
- <dd>Rocket's cross-section area (m<sup>2</sup>)</dd>
- </dl>
- </div>
- </div>
- <p>
- A complete cross-section requires a far more complex calculation. The
- value from that calculation can be provided as an input to the calculator.
- </p>
-
- <h2>Air pressure</h2>
- <p class="equation">
- $$P = P_{sea} \cdot \bigg[ 1 + \frac{L}{T} \cdot h \bigg] ^ {\frac{-g_0 \cdot M}{R \cdot L}}$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Input</h3>
- <dl>
- <dt>$P_{sea}$</dt>
- <dd>Sea level pressure (101325&#160;Pa)</dd>
- <dt>$L$</dt>
- <dd>Lapse rate (-0.0065&#160;K/m)</dd>
- <dt>$T$</dt>
- <dd>Temperature (K)</dd>
- <dt>$h$</dt>
- <dd>Altitude (m)</dd>
- <dt>$g_0$</dt>
- <dd>Gravitational acceleration constant (9.80665&#160;m/s<sup>2</sup>)</dd>
- <dt>$M$</dt>
- <dd>Earth's atmospheric molar mass (0.0289644&#160;kg/mol)</dd>
- <dt>$R$</dt>
- <dd>Universal gas constant (8.31432&#160;Nâ‹…m/molâ‹…K)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Output</h3>
- <dl>
- <dt>$P$</dt>
- <dd>Air pressure (Pa)</dd>
- </dl>
- </div>
- </div>
-
- <h2>Tetens equation</h2>
- <p class="equation">
- $$P_v = 0.61078 \cdot e ^ {17.27 \cdot T / (T + 237.31)}$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$T$</dt>
- <dd>Temperature (&#x2103;)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Output</h3>
- <dl>
- <dt>$P_v$</dt>
- <dd>Vapour pressure (Pa)</dd>
- </dl>
- </div>
- </div>
-
- <h2>Air density</h2>
- <p class="equation">
- $$\rho = \left(\frac{P_d}{R_d \cdot T}\right) + \left(\frac{P_v}{R_v \cdot T}\right)$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$P_d$</dt>
- <dd>Partial pressure of dry air (Pa)</dd>
- <dt>$P_v$</dt>
- <dd>Partial pressure of water vapor (Pa)</dd>
- <dt>$T$</dt>
- <dd>Temperature (&#x2103;)</dd>
- <dt>$R_d$</dt>
- <dd>Specific gas constant for dry air (287.058&#160;J/(kgâ‹…K))</dd>
- <dt>$R_v$</dt>
- <dd>Specific gas constant for water vapour (461.495&#160;J/(kgâ‹…K))</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Output</h3>
- <dl>
- <dt>$\rho$</dt>
- <dd>Air density (kg/m<sup>3</sup>)</dd>
- </dl>
- </div>
- </div>
-
- <h2>Earth radius</h2>
- <p class="equation">
- $$R_f = \frac{R_e - R_{pole}}{R_e}$$
- $$R_E = R_e \cdot (1 - R_f \cdot sin^2 \phi)$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$R_e$</dt>
- <dd>Equatorial radius (m)</dd>
- <dt>$R_{pole}$</dt>
- <dd>Polar radius (m)</dd>
- <dt>$\phi$</dt>
- <dd>Latitude (&#x00b0;)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Outputs</h3>
- <dl>
- <dt>$R_f$</dt>
- <dd>Flattening ratio</dd>
- <dt>$R_E$</dt>
- <dd>Effective radius (m)</dd>
- </dl>
- </div>
- </div>
-
- <h2>Rotational speed</h2>
- <p class="equation">
- $$\omega = R_E(\varphi) \cdot \frac{2 \pi}{T_s}$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$R_E$</dt>
- <dd>Effective radius (m)</dd>
- <dt>$\varphi$</dt>
- <dd>Latitude (&#x00b0;)</dd>
- <dt>$T_s$</dt>
- <dd>Sidereal time (86164.0905 s)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Outputs</h3>
- <dl>
- <dt>$\omega$</dt>
- <dd>Rotational speed (m/s)</dd>
- </dl>
- </div>
- </div>
-
- <h2>Orbital speed</h2>
- <p class="equation">
- $$v_{orb} = \sqrt{\frac{g_0}{R_E(\varphi) + h}}$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$g_0$</dt>
- <dd>Standard gravitational parameter (m/s<sup>2</sup>)</dd>
- <dt>$R_E$</dt>
- <dd>Effective radius (m)</dd>
- <dt>$\varphi$</dt>
- <dd>Latitude (&#x00b0;)</dd>
- <dt>$h$</dt>
- <dd>Altitude (m)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Outputs</h3>
- <dl>
- <dt>$v_{orb}$</dt>
- <dd>Orbital speed (m/s)</dd>
- </dl>
- </div>
- </div>
-
-
- <h2>Gravity</h2>
- <p class="equation">
- $$g = g_0 \left(1 + 0.0053024 \cdot \sin^2(\varphi) - 0.0000058 \cdot \sin^2(2\varphi)\right) + \left(-3.086 \times 10^{-6} \cdot h\right)$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$g_0$</dt>
- <dd>Surface gravity (m/s<sup>2</sup>)</dd>
- <dt>$\varphi$</dt>
- <dd>Latitude (&#x00b0;)</dd>
- <dt>$h$</dt>
- <dd>Altitude (m)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Outputs</h3>
- <dl>
- <dt>$g$</dt>
- <dd>Gravity(m/s<sup>2</sup>)</dd>
- </dl>
- </div>
- </div>
-
- <h2>Speed of sound</h2>
- <p class="equation">
- $$cc = 331.3 \cdot \sqrt{1 + \frac{T_s - \left(\frac{6h}{1000}\right)}{273.15}}$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$T_s$</dt>
- <dd>Surface temperature (&#x2103;)</dd>
- <dt>$h$</dt>
- <dd>Altitude (m)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Outputs</h3>
- <dl>
- <dt>$cc$</dt>
- <dd>Speed of sound (m/s)</dd>
- </dl>
- </div>
- </div>
-
-
- <h2>Drag force</h2>
- <p class="equation">
- $$F_d = \frac{1}{2} \rho v^2 C_d A$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$\rho$</dt>
- <dd>Air density (kg/m<sup>3</sup>)</dd>
- <dt>$v$</dt>
- <dd>Projectile exit velocity (km/s)</dd>
- <dt>$C_d$</dt>
- <dd>Coefficient of drag</dd>
- <dt>$A$</dt>
- <dd>Cross-section area (m<sup>2</sup>)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Output</h3>
- <dl>
- <dt>$F_d$</dt>
- <dd>Drag force (kN)</dd>
- </dl>
- </div>
- </div>
-
- <h2>Drag deceleration</h2>
- <p class="equation">
- $$a_d = F_d / M$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$F_d$</dt>
- <dd>Drag force (kN)</dd>
- <dt>$M$</dt>
- <dd>Mass (kg)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Output</h3>
- <dl>
- <dt>$a_d$</dt>
- <dd>Drag deceleration (m/s<sup>2</sup>)</dd>
- </dl>
- </div>
- </div>
-
- <h2>Friction</h2>
- <p class="equation">
- $$F = 0.1 C_d A a_d v^3$$
- </p>
- <div class="variables">
- <div class="input">
- <h3>Inputs</h3>
- <dl>
- <dt>$C_d$</dt>
- <dd>Coefficient of drag</dd>
- <dt>$A$</dt>
- <dd>Cross-section area (m<sup>2</sup>)</dd>
- <dt>$a_d$</dt>
- <dd>Drag deceleration (m/s<sup>2</sup>)</dd>
- <dt>$v$</dt>
- <dd>Projectile exit velocity (km/s)</dd>
- </dl>
- </div>
- <div class="output">
- <h3>Output</h3>
- <dl>
- <dt>$F$</dt>
- <dd>Heat experienced by rocket due to friction</dd>
+ <button class="submit">Simulate</button>
+
+ <fieldset id="environment">
+ <legend>Environment</legend>
+ <label for="surface_temperature">Surface temperature (&#x2103;)</label>
+ <input tabindex="1"
+ class="variable" type="number" step="1" min="-80" value="25"
+ id="surface_temperature" name="surface_temperature" />
+
+ <label for="relative_humidity">Relative humidity</label>
+ <input tabindex="2"
+ class="variable" type="number" step="0.01" min="0" value="86.34"
+ id="surface_temperature" name="surface_temperature" />
+ </fieldset>
+
+ <fieldset id="mission">
+ <legend>Mission</legend>
+ <label for="initial_velocity">Initial velocity (Mach)</label>
+ <input tabindex="3"
+ class="variable" type="number" step="1" min="0" value="8"
+ id="initial_velocity" name="initial_velocity" />
+
+ <label for="initial_latitude">Initial latitude (&#x00b0;)</label>
+ <input tabindex="4"
+ class="variable" type="number" step="any" min="0" value="1.469167"
+ id="initial_latitude" name="initial_latitude" />
+
+ <label for="initial_altitude">Initial altitude (m)</label>
+ <input tabindex="5"
+ class="variable" type="number" step="1" min="0" value="6212"
+ id="initial_altitude" name="initial_altitude" />
+
+ <label for="target_altitude">Target altitude (km)</label>
+ <input tabindex="6"
+ class="variable" type="number" step="1" min="1" value="400"
+ id="target_altitude" name="target_altitude" />
+ </fieldset>
+
+ <fieldset id="rocket">
+ <legend>Rocket</legend>
+ <label for="diameter">Diameter (m)</label>
+ <input tabindex="7" class="variable" type="number"
+ step="any" min="0" value="0.6" id="diameter" name="diameter" />
+
+ <label for="wet_mass">Wet mass (kg)</label>
+ <input tabindex="8"
+ class="variable" type="number" step="1" min="1" value="250"
+ id="wet_mass" name="wet_mass"
+ oninput="this.value = Math.abs(this.value)" />
+
+ <label for="payload">Payload mass (kg)</label>
+ <input tabindex="9"
+ class="variable" type="number" step="1" min="1" value="25"
+ id="payload_mass" name="payload_mass"
+ oninput="this.value = Math.abs(this.value)" />
+
+ <label for="drag_coefficient">Drag coefficient</label>
+ <input tabindex="10"
+ class="variable" type="number" step="any" min="0" value="0.219"
+ id="drag_coefficient" name="drag_coefficient" />
+
+ <label for="specific_impulse">Specific impulse (s)</label>
+ <input tabindex="11"
+ class="variable" type="number" step="1" min="1" value="1700"
+ id="specific_impulse" name="specific_impulse" />
+ </fieldset>
+
+ <button class="submit">Simulate</button>
+
+ <fieldset id="result">
+ <legend>Result</legend>
+ </fieldset>
+ </form>
+
+ <a name="equations" />
+ <h1>Equations</h1>
+ <p>
+ This section describes equation inputs and outputs.
+ </p>
+
+ <h2>Centrifugal force</h2>
+ <p class="equation">
+ $$a = v^2 / r$$
+ $$g_{force} = 0.10193679918451 a$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Inputs</h3>
+ <dl>
+ <dt>$v$</dt>
+ <dd>Projectile exit velocity (km/s)</dd>
+ <dt>$r$</dt>
+ <dd>Accelerator loop radius (km)</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Outputs</h3>
+ <dl>
+ <dt>$a$</dt>
+ <dd>Acceleration (km/s<sup>2</sup>)</dd>
+ <dt>$g_{force}$</dt>
+ <dd>Force experienced in terms of Earth's gravitational acceleration</dd>
+ </dl>
+ </div>
+ </div>
+
+ <h2>Cross-section area</h2>
+ <p class="equation">
+ $$A = \pi (d / 2)^2$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Input</h3>
+ <dl>
+ <dt>$d$</dt>
+ <dd>Rocket diameter (m)</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Output</h3>
+ <dl>
+ <dt>$A$</dt>
+ <dd>Rocket's cross-section area (m<sup>2</sup>)</dd>
+ </dl>
+ </div>
+ </div>
+ <p>
+ A complete cross-section requires a far more complex calculation. The
+ value from that calculation can be provided as an input to the calculator.
+ </p>
+
+ <h2>Air pressure</h2>
+ <p class="equation">
+ $$P = P_{sea} \bigg[ 1 + \frac{L}{T} h \bigg] ^ {\frac{-g_0 \cdot M}{R \cdot L}}$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Input</h3>
+ <dl>
+ <dt>$P_{sea}$</dt>
+ <dd>Sea level pressure (101325&#160;Pa)</dd>
+ <dt>$L$</dt>
+ <dd>Lapse rate (-0.0065&#160;K/m)</dd>
+ <dt>$T$</dt>
+ <dd>Temperature (K)</dd>
+ <dt>$h$</dt>
+ <dd>Altitude (m)</dd>
+ <dt>$g_0$</dt>
+ <dd>Gravitational acceleration constant (9.80665&#160;m/s<sup>2</sup>)</dd>
+ <dt>$M$</dt>
+ <dd>Earth's atmospheric molar mass (0.0289644&#160;kg/mol)</dd>
+ <dt>$R$</dt>
+ <dd>Universal gas constant (8.31432&#160;Nâ‹…m/molâ‹…K)</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Output</h3>
+ <dl>
+ <dt>$P$</dt>
+ <dd>Air pressure (Pa)</dd>
+ </dl>
+ </div>
+ </div>
+
+ <h2>Tetens equation</h2>
+ <p class="equation">
+ $$P_v = 0.61078 \cdot e ^ {17.27 T / (T + 237.31)}$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Inputs</h3>
+ <dl>
+ <dt>$T$</dt>
+ <dd>Temperature (&#x2103;)</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Output</h3>
+ <dl>
+ <dt>$P_v$</dt>
+ <dd>Vapour pressure (Pa)</dd>
+ </dl>
+ </div>
+ </div>
+
+ <h2>Air density</h2>
+ <p class="equation">
+ $$\rho = \left(\frac{P_d}{R_d \cdot T}\right) + \left(\frac{P_v}{R_v \cdot T}\right)$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Inputs</h3>
+ <dl>
+ <dt>$P_d$</dt>
+ <dd>Partial pressure of dry air (Pa)</dd>
+ <dt>$P_v$</dt>
+ <dd>Partial pressure of water vapor (Pa)</dd>
+ <dt>$T$</dt>
+ <dd>Temperature (&#x2103;)</dd>
+ <dt>$R_d$</dt>
+ <dd>Specific gas constant for dry air (287.058&#160;J/(kgâ‹…K))</dd>
+ <dt>$R_v$</dt>
+ <dd>Specific gas constant for water vapour (461.495&#160;J/(kgâ‹…K))</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Output</h3>
+ <dl>
+ <dt>$\rho$</dt>
+ <dd>Air density (kg/m<sup>3</sup>)</dd>
+ </dl>
+ </div>
+ </div>
+
+ <h2>Earth effective radius</h2>
+ <p class="equation">
+ $$R_f = \frac{R_e - R_{pole}}{R_e}$$
+ $$R_E = R_e (1 - R_f \cdot sin^2 \varphi)$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Inputs</h3>
+ <dl>
+ <dt>$R_e$</dt>
+ <dd>Equatorial radius (m)</dd>
+ <dt>$R_{pole}$</dt>
+ <dd>Polar radius (m)</dd>
+ <dt>$\varphi$</dt>
+ <dd>Latitude (&#x00b0;)</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Outputs</h3>
+ <dl>
+ <dt>$R_f$</dt>
+ <dd>Flattening ratio</dd>
+ <dt>$R_E$</dt>
+ <dd>Effective radius (m)</dd>
+ </dl>
+ </div>
+ </div>
+
+ <h2>Rotational speed</h2>
+ <p class="equation">
+ $$\omega = R_E(\varphi) \frac{2 \pi}{T_s}$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Inputs</h3>
+ <dl>
+ <dt>$R_E$</dt>
+ <dd>Effective radius (m)</dd>
+ <dt>$\varphi$</dt>
+ <dd>Latitude (&#x00b0;)</dd>
+ <dt>$T_s$</dt>
+ <dd>Sidereal time (86164.0905&#160;s)</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Output</h3>
+ <dl>
+ <dt>$\omega$</dt>
+ <dd>Rotational speed (m/s)</dd>
+ </dl>
+ </div>
+ </div>
+
+ <h2>Orbital speed</h2>
+ <p class="equation">
+ $$v_{orb} = \sqrt{\frac{G}{R_E(\varphi) + h}}$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Inputs</h3>
+ <dl>
+ <dt>$G$</dt>
+ <dd>Standard gravitational parameter (m/s<sup>2</sup>)</dd>
+ <dt>$R_E$</dt>
+ <dd>Effective radius (m)</dd>
+ <dt>$\varphi$</dt>
+ <dd>Latitude (&#x00b0;)</dd>
+ <dt>$h$</dt>
+ <dd>Altitude (m)</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Output</h3>
+ <dl>
+ <dt>$v_{orb}$</dt>
+ <dd>Orbital speed (m/s)</dd>
+ </dl>
+ </div>
+ </div>
+
+
+ <h2>Gravity</h2>
+ <p class="equation">
+ $$g = g_0 \big[1 + 0.0053024 \cdot sin^2(\varphi) - 0.0000058 \cdot sin^2(2\varphi)\big] + \left(-3.086 \times 10^{-6} h\right)$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Inputs</h3>
+ <dl>
+ <dt>$g_0$</dt>
+ <dd>Surface gravity (m/s<sup>2</sup>)</dd>
+ <dt>$\varphi$</dt>
+ <dd>Latitude (&#x00b0;)</dd>
+ <dt>$h$</dt>
+ <dd>Altitude (m)</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Output</h3>
+ <dl>
+ <dt>$g$</dt>
+ <dd>Gravity (m/s<sup>2</sup>)</dd>
+ </dl>
+ </div>
+ </div>
+
+ <h2>Speed of sound</h2>
+ <p class="equation">
+ $$cc = cc_s \sqrt{1 + \frac{T_s - \left(\frac{6h}{1000}\right)}{273.15}}$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Inputs</h3>
+ <dl>
+ <dt>$cc_s$</dt>
+ <dd>Surface speed of sound (331.3&#160;m/s)</dd>
+ <dt>$T_s$</dt>
+ <dd>Surface temperature (&#x2103;)</dd>
+ <dt>$h$</dt>
+ <dd>Altitude (m)</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Output</h3>
+ <dl>
+ <dt>$cc$</dt>
+ <dd>Speed of sound (m/s)</dd>
+ </dl>
+ </div>
+ </div>
+
+ <h2>Drag force</h2>
+ <p class="equation">
+ $$\rho = \rho_{air}(h)$$
+ $$v_{net} = v_h - \omega$$
+ $$v_{total} = \sqrt{v_{net}^2 + v_v^2}$$
+ $$\left( F_{d_h}, F_{d_v} \right) = \left( -\frac{1}{2} \rho \cdot C_d \cdot v_{total} \cdot v_{net}, -\frac{1}{2} \rho \cdot C_d \cdot v_{total} \cdot v_v \right)$$
+ </p>
+ <div class="variables">
+ <div class="input">
+ <h3>Inputs</h3>
+ <dl>
+ <dt>$\rho_{air}$</dt>
+ <dd>Air density function (kg/m<sup>3</sup>)</dd>
+ <dt>$h$</dt>
+ <dd>Altitude (meters)</dd>
+ <dt>$v_h$</dt>
+ <dd>Horizontal velocity (m/s)</dd>
+ <dt>$\omega$</dt>
+ <dd>Rotational speed (m/s)</dd>
+ <dt>$v_v$</dt>
+ <dd>Vertical velocity (m/s)</dd>
+ <dt>$C_d$</dt>
+ <dd>Ballistic coefficient</dd>
+ </dl>
+ </div>
+ <div class="output">
+ <h3>Outputs</h3>
+ <dl>
+ <dt>$\rho$</dt>
+ <dd>Air density at altitude (kg/m<sup>3</sup>)</dd>
+ <dt>$v_{net}$</dt>
+ <dd>Net horizontal velocity (m/s)</dd>
+ <dt>$v_{total}$</dt>
+ <dd>Total speed (m/s)</dd>
+ <dt>$F_{d_h}$</dt>
+ <dd>Horizontal drag force (N)</dd>
+ <dt>$F_{d_v}$</dt>
+ <dd>Vertical drag force (N)</dd>
</dl>
</div>
calculators/rocket/payload/payload.js
-/**
- * The purpose of this code is to help calculate parameters required to
- * send a rocket into space using a combination of single-stage to orbit
- * and an electromagnetic accelerator.
- */
-
-import Earth from 'Earth.js';
-import Rocket from 'Rocket.js';
-import FlightRecorder from 'FlightRecorder.js';
-import {$} from 'Selector.js';
-
-// Inputs
-const SURFACE_TEMPERATURE = 25; // Celsius
-const RELATIVE_HUMIDITY = 86.34; // per cent
-const INITIAL_VELOCITY = 8; // Mach
-const INITIAL_LATITUDE = 1.469167; // meters
-const INITIAL_ALTITUDE = 6212; // meters
-const TARGET_ALTITUDE = 400.0 * 1000.0; // meters
-
-const ROCKET_DIAMETER = 0.6;
-const WET_MASS = 250;
-const PAYLOAD_MASS = 25;
-const DRAG_COEFFICIENT = 0.219;
-const SPECIFIC_IMPULSE = 1400.0; // seconds
-
-const earth = new Earth(SURFACE_TEMPERATURE, RELATIVE_HUMIDITY);
-
-const SPEED_OF_SOUND = earth.soundSpeed(INITIAL_ALTITUDE);
-const INITIAL_HORIZONTAL_VELOCITY = 0;
-const INITIAL_VERTICAL_VELOCITY = INITIAL_VELOCITY * SPEED_OF_SOUND;
-
-const blackBox = new FlightRecorder();
-const rocket = new Rocket(
- WET_MASS,
- PAYLOAD_MASS,
- ROCKET_DIAMETER,
- DRAG_COEFFICIENT,
- SPECIFIC_IMPULSE
-);
-
-rocket.on(earth);
-rocket.recorder(blackBox);
-rocket.translocate(INITIAL_LATITUDE, INITIAL_ALTITUDE);
-rocket.apogee(TARGET_ALTITUDE);
-rocket.launch(INITIAL_HORIZONTAL_VELOCITY, INITIAL_VERTICAL_VELOCITY);
-
-let time = 0.0;
-
-while (rocket.flying() && rocket.below(TARGET_ALTITUDE)) {
- time += 0.01;
- rocket.fly(time);
-}
-
-blackBox.plot();
calculators/template.xsl
<script
defer="defer"
- src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" />
+ src="//code.jquery.com/jquery-1.12.4.min.js" />
<xsl:call-template name="script">
<xsl:with-param name="file" select="'calculator'" />
</xsl:call-template>
<xsl:call-template name="custom-scripts" />
</xsl:template>
<xsl:template name="custom-scripts" />
-
</xsl:stylesheet>
+
index.xsl
<script defer="defer">
+ <xsl:attribute name="type">module</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="$file" />

Updates documentation, uses modules

Author djarvis <email>
Date 2024-11-27 00:01:24 GMT-0800
Commit b68da1045d13b8d2768762878c6c0c75d4cd58a6
Parent eff2e91
Delta 593 lines added, 610 lines removed, 17-line decrease