fix: include Common attribution items in EPC margin calculation
Some checks failed
CI / Engine — lint / typecheck / test (push) Has been cancelled
CI / API — lint / typecheck / test (push) Has been cancelled
CI / Web — typecheck / lint / build (push) Has been cancelled

- EPC Margin WTG now includes items with attribution 'WindOnly' OR 'Common' when windEnabled
- EPC Margin Solar now includes items with attribution 'SolarOnly' OR 'Common'
This commit is contained in:
Manohar Gupta 2026-05-29 18:27:37 +05:30
parent 3c98aa3c80
commit 39d01299e7

View file

@ -800,9 +800,9 @@ export function InputsTab({ scenarioId, inputsJson, onSaved }: Props) {
const windEPC = windItems.filter(it => it.category === "EPCOverhead").reduce((acc, it) => acc + (computeItemCr(it, solarDcMwp, windMw, bessMwh, 0, effectiveLandAcres) ?? 0), 0);
const solarCont = solarItems.filter(it => it.category === "Contingency" && it.attribution === "SolarOnly").reduce((acc, it) => acc + (computeItemCr(it, solarDcMwp, windMw, bessMwh, 0, effectiveLandAcres) ?? 0), 0);
const windCont = windItems.filter(it => it.category === "Contingency" && it.attribution === "WindOnly").reduce((acc, it) => acc + (computeItemCr(it, solarDcMwp, windMw, bessMwh, 0, effectiveLandAcres) ?? 0), 0);
// EPC Margins
const epcMarginWTG = [...windItems, ...bessItems].filter(it => it.category === "EPCMargin" && it.attribution === "WindOnly").reduce((acc, it) => acc + (computeItemCr(it, solarDcMwp, windMw, bessMwh, 0, effectiveLandAcres) ?? 0), 0);
const epcMarginSolarBOS = solarItems.filter(it => it.category === "EPCMargin" && it.attribution === "SolarOnly").reduce((acc, it) => acc + (computeItemCr(it, solarDcMwp, windMw, bessMwh, 0, effectiveLandAcres) ?? 0), 0);
// EPC Margins - include items with attribution "WindOnly" OR "Common" when wind is enabled
const epcMarginWTG = windEnabled ? windItems.filter(it => it.category === "EPCMargin" && (it.attribution === "WindOnly" || it.attribution === "Common")).reduce((acc, it) => acc + (computeItemCr(it, solarDcMwp, windMw, bessMwh, 0, effectiveLandAcres) ?? 0), 0) : 0;
const epcMarginSolarBOS = solarItems.filter(it => it.category === "EPCMargin" && (it.attribution === "SolarOnly" || it.attribution === "Common")).reduce((acc, it) => acc + (computeItemCr(it, solarDcMwp, windMw, bessMwh, 0, effectiveLandAcres) ?? 0), 0);
// Financing
const idcRate = gv(inputs, "capex", "interest_rate_annual", 0.09);
const constrMonths = gv(inputs, "capex", "construction_months", 24);