// Copyright (c) 2025-2026, RTE (https://www.rte-france.com) // This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0. // If a copy of the Mozilla Public License, version 2.0 was not distributed with this file, // you can obtain one at http://mozilla.org/MPL/2.0/. // SPDX-License-Identifier: MPL-2.0 // This file is part of Co-Study4Grid a Power Grid Study tool Assistant Interface to help solve contigencies for a grid state under study. import React from 'react'; import type { ActionDetail } from '../types'; import { colors } from '../styles/tokens'; interface SimulationFeedback { max_rho: number | null; max_rho_line: string; is_rho_reduction: boolean; is_islanded?: boolean; disconnected_mw?: number; non_convergence?: string | null; } export interface ComputedPairEntry { id: string; action1: string; action2: string; betas?: number[]; estimated_max_rho?: number | null; estimated_max_rho_line?: string; target_max_rho?: number | null; target_max_rho_line?: string; is_suspect: boolean; isSimulated: boolean; simulated_max_rho: number | null; simulated_max_rho_line: string | null; simData: ActionDetail | SimulationFeedback | null; } interface ComputedPairsTableProps { computedPairsList: ComputedPairEntry[]; monitoringFactor: number; simulating: boolean; onSimulate: (actionId: string) => void; displayName?: (id: string) => string; } const ComputedPairsTable: React.FC = ({ computedPairsList, monitoringFactor, simulating, onSimulate, displayName = (id: string) => id, }) => { return (
{computedPairsList.length === 0 ? ( ) : computedPairsList.map(p => { const estMaxRho = p.estimated_max_rho; const isSimulated = p.isSimulated; const simMaxRho = p.simulated_max_rho; return ( ); })}
Action 1 Action 2 Betas Max Loading (Est.) Line (Est.) Simulated Max Rho Simulated Line Action
No computed combinations found.
Go to Explore Pairs to create new ones.
{p.action1} {p.action2} {p.betas ? p.betas.map(b => b.toFixed(2)).join(', ') : '-'} {estMaxRho != null && !isNaN(estMaxRho) ? ( monitoringFactor ? colors.dangerSoft : estMaxRho > (monitoringFactor - 0.05) ? colors.warningSoft : colors.successSoft, color: estMaxRho > monitoringFactor ? colors.dangerText : estMaxRho > (monitoringFactor - 0.05) ? colors.warningText : colors.successStrong, border: estMaxRho > monitoringFactor ? `1px solid ${colors.dangerText}` : estMaxRho > (monitoringFactor - 0.05) ? `1px solid ${colors.warningText}` : `1px dashed ${colors.successStrong}` }}> {(estMaxRho * 100).toFixed(1)}% {p.is_suspect && ( ⚠️ )} ) : '—'} {p.estimated_max_rho_line ? displayName(p.estimated_max_rho_line) : 'N/A'} {p.target_max_rho != null && p.target_max_rho_line && p.target_max_rho_line !== 'N/A' && p.target_max_rho_line !== p.estimated_max_rho_line && (
target: {(p.target_max_rho * 100).toFixed(1)}% on {displayName(p.target_max_rho_line)}
)}
{isSimulated && simMaxRho != null ? ( monitoringFactor ? colors.dangerSoft : simMaxRho > (monitoringFactor - 0.05) ? colors.warningSoft : colors.successSoft, color: simMaxRho > monitoringFactor ? colors.dangerText : simMaxRho > (monitoringFactor - 0.05) ? colors.warningText : colors.successStrong }}> {(simMaxRho * 100).toFixed(1)}% {(p.simData as ActionDetail | SimulationFeedback)?.is_islanded && ( 🏝️ )} ) : ( Not simulated )} {isSimulated && p.simulated_max_rho_line ? displayName(p.simulated_max_rho_line) : '-'}
); }; export default ComputedPairsTable;