feat: pass solar DC MW and wind capacity from inputs to generation sheet
Some checks are pending
CI / Engine — lint / typecheck / test (push) Waiting to run
CI / API — lint / typecheck / test (push) Waiting to run
CI / Web — typecheck / lint / build (push) Waiting to run

- Add solarDCMW and windMW props
- Pull from inputs_json in scenario page
- DC MW column now shows actual capacity from input

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Manohar Gupta 2026-05-16 15:02:43 +05:30
parent 2705f4bb11
commit fdb387e74c
2 changed files with 19 additions and 5 deletions

View file

@ -237,6 +237,18 @@ export default function ScenarioPage() {
: new Date().getFullYear();
} catch { return new Date().getFullYear(); }
})()}
solarDCMW={(() => {
try {
const inputs = scenario?.inputs_json ? JSON.parse(scenario.inputs_json) : {};
return inputs?.solar?.capacity_dc_mwp || inputs?.project?.capacity_solar_mwp || 0;
} catch { return 0; }
})()}
windMW={(() => {
try {
const inputs = scenario?.inputs_json ? JSON.parse(scenario.inputs_json) : {};
return inputs?.wind?.capacity_mw || inputs?.project?.capacity_wind_mw || 0;
} catch { return 0; }
})()}
/>
) : scenario?.status === "failed" ? (
<div className="border border-red-200 rounded-lg p-6 text-sm max-w-lg">

View file

@ -543,7 +543,7 @@ interface HourlyData {
hourly_wind_profile?: number[];
}
function HourlyGenerationSheet({ hourly, codYear }: { hourly: HourlyData; codYear?: number }) {
function HourlyGenerationSheet({ hourly, codYear, solarDCMW, windMW }: { hourly: HourlyData; codYear?: number; solarDCMW?: number; windMW?: number }) {
const { solar_hourly, wind_hourly, hourly_total_re, hourly_client_end, hourly_load, hourly_solar_profile, hourly_wind_profile } = hourly;
const hasSolar = solar_hourly && solar_hourly.length > 0;
const hasWind = wind_hourly && wind_hourly.length > 0;
@ -770,11 +770,11 @@ function HourlyGenerationSheet({ hourly, codYear }: { hourly: HourlyData; codYea
<span className="w-20 font-medium">{fyLabel}</span>
{/* Solar 8760: avg profile (show as %), DC MW, Solar MW */}
{hasSolar && <span className="text-orange-700 w-20">{(solarProfileAvg * 100).toFixed(1)}%</span>}
{hasSolar && <span className="text-orange-600/70 w-16">100</span>}
{hasSolar && <span className="text-orange-600/70 w-16">{solarDCMW || '-'}</span>}
{hasSolar && <span className="text-orange-700 w-20">{Math.round(solarYr).toLocaleString()}</span>}
{/* Wind 8760, MW, Wind MW */}
{hasWind && <span className="text-blue-700 w-20">-</span>}
{hasWind && <span className="text-blue-600/70 w-16">50</span>}
{hasWind && <span className="text-blue-600/70 w-16">{windMW || '-'}</span>}
{hasWind && <span className="text-blue-700 w-20">{Math.round(windYr).toLocaleString()}</span>}
{hasTotalRe && <span className="text-green-700 w-20">{Math.round(totalReYr).toLocaleString()}</span>}
{hasClientEnd && <span className="text-purple-700 w-20">{Math.round(clientEndYr).toLocaleString()}</span>}
@ -967,9 +967,11 @@ interface Props {
debtScheduleJson: string | null;
activeSheet: string;
codYear?: number;
solarDCMW?: number;
windMW?: number;
}
export function WorkbookView({ scenarioId, kpis, debtScheduleJson, activeSheet, codYear }: Props) {
export function WorkbookView({ scenarioId, kpis, debtScheduleJson, activeSheet, codYear, solarDCMW, windMW }: Props) {
const { data: stmts } = useQuery({
queryKey: ["statements", scenarioId],
queryFn: () => getStatements(scenarioId),
@ -1025,7 +1027,7 @@ export function WorkbookView({ scenarioId, kpis, debtScheduleJson, activeSheet,
hourly_load: stmts?.hourly_load,
hourly_solar_profile: stmts?.hourly_solar_profile,
hourly_wind_profile: stmts?.hourly_wind_profile,
}} codYear={codYear} />
}} codYear={codYear} solarDCMW={solarDCMW} windMW={windMW} />
) : generation.length > 0 ? (
<HorizontalTable years={genYears} rows={buildGenerationRows(generation)} unit="MWh / ₹Cr" />
) : (