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 (