feat: pass solar DC MW and wind capacity from inputs to generation sheet
- 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:
parent
2705f4bb11
commit
fdb387e74c
2 changed files with 19 additions and 5 deletions
|
|
@ -237,6 +237,18 @@ export default function ScenarioPage() {
|
||||||
: new Date().getFullYear();
|
: new Date().getFullYear();
|
||||||
} catch { return 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" ? (
|
) : scenario?.status === "failed" ? (
|
||||||
<div className="border border-red-200 rounded-lg p-6 text-sm max-w-lg">
|
<div className="border border-red-200 rounded-lg p-6 text-sm max-w-lg">
|
||||||
|
|
|
||||||
|
|
@ -543,7 +543,7 @@ interface HourlyData {
|
||||||
hourly_wind_profile?: number[];
|
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 { 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 hasSolar = solar_hourly && solar_hourly.length > 0;
|
||||||
const hasWind = wind_hourly && wind_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>
|
<span className="w-20 font-medium">{fyLabel}</span>
|
||||||
{/* Solar 8760: avg profile (show as %), DC MW, Solar MW */}
|
{/* 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-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>}
|
{hasSolar && <span className="text-orange-700 w-20">{Math.round(solarYr).toLocaleString()}</span>}
|
||||||
{/* Wind 8760, MW, Wind MW */}
|
{/* Wind 8760, MW, Wind MW */}
|
||||||
{hasWind && <span className="text-blue-700 w-20">-</span>}
|
{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>}
|
{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>}
|
{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>}
|
{hasClientEnd && <span className="text-purple-700 w-20">{Math.round(clientEndYr).toLocaleString()}</span>}
|
||||||
|
|
@ -967,9 +967,11 @@ interface Props {
|
||||||
debtScheduleJson: string | null;
|
debtScheduleJson: string | null;
|
||||||
activeSheet: string;
|
activeSheet: string;
|
||||||
codYear?: number;
|
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({
|
const { data: stmts } = useQuery({
|
||||||
queryKey: ["statements", scenarioId],
|
queryKey: ["statements", scenarioId],
|
||||||
queryFn: () => getStatements(scenarioId),
|
queryFn: () => getStatements(scenarioId),
|
||||||
|
|
@ -1025,7 +1027,7 @@ export function WorkbookView({ scenarioId, kpis, debtScheduleJson, activeSheet,
|
||||||
hourly_load: stmts?.hourly_load,
|
hourly_load: stmts?.hourly_load,
|
||||||
hourly_solar_profile: stmts?.hourly_solar_profile,
|
hourly_solar_profile: stmts?.hourly_solar_profile,
|
||||||
hourly_wind_profile: stmts?.hourly_wind_profile,
|
hourly_wind_profile: stmts?.hourly_wind_profile,
|
||||||
}} codYear={codYear} />
|
}} codYear={codYear} solarDCMW={solarDCMW} windMW={windMW} />
|
||||||
) : generation.length > 0 ? (
|
) : generation.length > 0 ? (
|
||||||
<HorizontalTable years={genYears} rows={buildGenerationRows(generation)} unit="MWh / ₹Cr" />
|
<HorizontalTable years={genYears} rows={buildGenerationRows(generation)} unit="MWh / ₹Cr" />
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue