From e920fa6f717f06f7920d8debb58982ab9481c6d8 Mon Sep 17 00:00:00 2001 From: Manohar Gupta Date: Fri, 29 May 2026 17:52:19 +0530 Subject: [PATCH] fix: Correct Total Hard Cost calculation - use baseHardCost for financing costs - Remove DSRA from Total Hard Cost (it's a financing reserve, not capital cost) - Use baseHardCost instead of inflated totalCostCr for financing calculations - DSRA shown separately after Total Hard Cost --- packages/web/components/InputsTab.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/web/components/InputsTab.tsx b/packages/web/components/InputsTab.tsx index fbc956d..048e174 100644 --- a/packages/web/components/InputsTab.tsx +++ b/packages/web/components/InputsTab.tsx @@ -805,18 +805,24 @@ export function InputsTab({ scenarioId, inputsJson, onSaved }: Props) { const idcRate = gv(inputs, "capex", "interest_rate_annual", 0.09); const constrMonths = gv(inputs, "capex", "construction_months", 24); const debtFrac = gv(inputs, "capex", "debt_fraction", 0.75); - const idcCost = totalCostCr * debtFrac * idcRate * constrMonths / 12; const upfrontPct = gv(inputs, "capex", "upfront_fee_pct", 0.01); - const upfrontCost = totalCostCr * debtFrac * upfrontPct; const bankGuaranteePct = gv(inputs, "capex", "bank_guarantee_pct", 0.001); - const bankGuaranteeCost = totalCostCr * bankGuaranteePct; // DSRA (Debt Service Reserve Account) - typically 1-2 months of debt service const dsraMonths = gv(inputs, "capex", "dsra_months", 2); - const annualDebtService = totalCostCr * debtFrac * 0.12; // approximate annual debt service + + // First compute base hard cost without financing items + const baseHardCost = solarModule + solarBOS + windWTG + solarLandCost + windLandCost + bessAll + solarEPC + windEPC + epcMarginWTG + epcMarginSolarBOS + solarCont + windCont; + + // Financing costs are based on base hard cost + const idcCost = baseHardCost * debtFrac * idcRate * constrMonths / 12; + const upfrontCost = baseHardCost * debtFrac * upfrontPct; + const bankGuaranteeCost = baseHardCost * bankGuaranteePct; + // DSRA: 2 months of debt service reserve (based on base hard cost) + const annualDebtService = baseHardCost * debtFrac * 0.12; // approximate annual debt service at 12% rate const dsraCost = annualDebtService * dsraMonths / 12; // Compute Total Hard Cost (sum of all component costs before financing) - const totalHardCost = solarModule + solarBOS + windWTG + solarLandCost + windLandCost + bessAll + dsraCost + solarEPC + windEPC + epcMarginWTG + epcMarginSolarBOS + solarCont + windCont; + const totalHardCost = baseHardCost; return (