PageSourceSearch

https://greatcarbonarbitrage.com/js/carbon_arbitrage.js

js greatcarbonarbitrage.com collected 2026-09-24 12:06:26 UTC 2,265 bytes, 44 lines download raw bytes

1// This is the data
2const fetchResp = await fetch("./public/website_sensitivity_analysis_result.json")
3const sensitivityAnalysisResult = await fetchResp.json()
4
5export function calculate() {
6  const _get = (id) => document.getElementById(id).value
7  const socialCostOfCarbon = _get("social-cost-of-carbon")
8  const timeHorizon = _get("time-horizon")
9  const coalReplacement = _get("coal-replacement")
10  const lifetime = _get("lifetime-renewable-plants")
11  const learningCurve = _get("learning-curve")
12  const discountRate = _get("discount-rate")
13  const energyStorage = _get("energy-storage")
14
15  function setElement(id, name) {
16    let val = sensitivityAnalysisResult[learningCurve][parseInt(lifetime)][coalReplacement][timeHorizon][discountRate][energyStorage][socialCostOfCarbon][name]
17    document.getElementById(id).innerHTML = val
18    return val
19  }
20
21  const benefit = setElement("pv-benefits", "b")
22  const cost = setElement("pv-costs", "c")
23  setElement("opportunity-costs", "oc")
24  setElement("investment-costs", "ic")
25
26  // Carbon arbitrage relative to GDP
27  const caoTrillion = benefit - cost
28  const cao = caoTrillion * 1e12
29  // See the analysis_main.py of https://github.com/ox-inet-resilience/carbon_arbitrage_code
30  // for world_gdp_2020 and arbitrage_period.
31  const world_gdp_2020 = 84.705  // trillion dolars
32  const NGFS_PEG_YEAR_ORIGINAL = 2023
33  const last_year = parseInt(timeHorizon)
34  const arbitrage_period = 1 + (last_year - (NGFS_PEG_YEAR_ORIGINAL + 1))
35  const caoRelative = caoTrillion * 100 / (world_gdp_2020 * arbitrage_period)
36  document.getElementById("carbon-arbitrage").innerHTML = caoTrillion.toFixed(2)
37  document.getElementById("carbon-arbitrage-relative-gdp").innerHTML = caoRelative.toFixed(1) + " %"
38
39  const productionAvoided = setElement("coal-production-prevented", "production")
40  const emissionsAvoided = setElement("emissions-prevented", "emissions")
41  document.getElementById("carbon-arbitrage-per-tcoal").innerHTML = (cao / (parseFloat(productionAvoided) * 1e9)).toFixed(0)
42  document.getElementById("carbon-arbitrage-per-tco2").innerHTML = (cao / (parseFloat(emissionsAvoided) * 1e9)).toFixed(0)
43  document.getElementById("temperature-increase").innerHTML = (1.5 * parseFloat(emissionsAvoided) / 1000).toFixed(2)
44}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.