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
import { percentLiftGasNeededSTP } from "https://esm.town/v/andrew/percentLiftGasNeededSTP";
import { vMaxFillBalloon } from "https://esm.town/v/andrew/vMaxFillBalloon";
export const SO2_Balloon_Napkin_Math = (() => {
// How much Lifty SO2/H2 mixture can we send up 25000m to the stratosphere?
// Variables you might want to change
const dBurst = 9.44; // 9.44m burst diameter on a weather balloon (1500g)
const hBurst = 10000; // 25000m
const costBalloon = 25; // $
const unitCostH2 = 5; // $/kg
const unitCostSO2 = 0; // $/kg
// Constants
const lift = 1.6; // 1.6N lift needed to lift 1500g balloon + 100g extra
const molarMassHydrogen = 2.01588 / 1000; // in kg/mol
const molarMassSO2 = 64.07 / 1000; // in kg/mol
const densityH2 = 0.08988; // kg/m^3
const densitySO2 = 2.926; // kg/m^3
// how much gas can we fill the balloon with at STP, given burst diameter/height?
const maxFill = vMaxFillBalloon(dBurst, hBurst);
console.log(
`The maxFill is about ${maxFill.toPrecision(2)} m^3 of gas at STP.`
);
const percentHydrogen = percentLiftGasNeededSTP(
1.6,
maxFill,
molarMassHydrogen,
molarMassSO2
);
const totalH2 = percentHydrogen * maxFill;
const totalSO2 = (1 - percentHydrogen) * maxFill;
const costH2 = totalH2 * densityH2 * unitCostH2;
const costSO2 = totalSO2 * densitySO2 * unitCostSO2;
const totalCost = costH2 + costSO2 + costBalloon;
const unitCostPerSO2 = totalCost / totalSO2;
console.log(
`The cost of hydrogen is $${costH2.toPrecision(
2
)} for ${totalH2.toPrecision(2)} m^3 at STP.`
);
console.log(
`The cost of SO2 is $${costSO2.toPrecision(2)} for ${totalSO2.toPrecision(
2
)} m^3 at STP.\n`
);
console.log(
`The TOTAL UNIT COST is $${unitCostPerSO2.toPrecision(
2
)} per cubic meter of SO2 released at ${hBurst}m`
);
return unitCostPerSO2;
})();
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.