Skip to content

Instantly share code, notes, and snippets.

@tmtvl
Last active January 24, 2022 16:08
Show Gist options
  • Save tmtvl/89967d566bd7d368b72c1e0514263c05 to your computer and use it in GitHub Desktop.
Save tmtvl/89967d566bd7d368b72c1e0514263c05 to your computer and use it in GitHub Desktop.
Converting stats from the EIA to terawatt.

Power

#+header-args: :cache yes :session power

Units

 (import (scheme base))

 (define *btu-per-watt* (/ 3412 1000))
 (define *watt-per-btu* (/ 1 *btu-per-watt*))

 `(()
	(btu watt)
	()
	(1  ,(string-copy (number->string (exact->inexact *watt-per-btu*))
					  0 5))
	(,(number->string (exact->inexact *btu-per-watt*)) 1)
	())
btuwatt
10.293
3.4121

Energy consumption of the U.S.

Data sourced from the U.S. Energy Information Administration. Rougly 92.94 quadrillion BTU.

 (define *us-energy-consumption*
	(* 9294/100
	   1000 1000 1000 1000))

 *us-energy-consumption*

92940000000000

Conversion to watt

<<units>>

<<us-energy-consumption>>

(define *usec-watt* (* *us-energy-consumption* *watt-per-btu*))

(round *usec-watt*)

27239155920281

Converted to terawatt

<<usec-watt>>

(round (/ *usec-watt*
			(* 1000 1000 1000 1000)))

27

Bonus material

Also per the EIA, renewables made up about 11,59 quadrillion BTU of the U.S. expenditures in 2020.

<<units>>

(round (* 1159/100 *watt-per-btu*))

3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment