From 0d0d61149408af21778dc5a9d49e9e9577176781 Mon Sep 17 00:00:00 2001 From: David BRAQUART Date: Tue, 3 Feb 2026 10:10:30 +0100 Subject: [PATCH 1/3] tmp debug=true Signed-off-by: David BRAQUART --- src/services/study/state-estimation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/study/state-estimation.ts b/src/services/study/state-estimation.ts index bd5db82b49..92695af59a 100644 --- a/src/services/study/state-estimation.ts +++ b/src/services/study/state-estimation.ts @@ -20,7 +20,7 @@ export function startStateEstimation( ); const url = getStudyUrlWithNodeUuidAndRootNetworkUuid(studyUuid, currentNodeUuid, currentRootNetworkUuid) + - '/state-estimation/run'; + '/state-estimation/run?debug=true'; console.debug(url); return backendFetch(url, { method: 'post' }); From e10c369342f543ff5180c9ac9e3e1980bacd5c1e Mon Sep 17 00:00:00 2001 From: David BRAQUART Date: Fri, 6 Feb 2026 15:23:15 +0100 Subject: [PATCH 2/3] feat: add debug mode for estim Signed-off-by: David BRAQUART --- src/components/run-button-container.jsx | 6 +++--- src/hooks/use-computation-debug.ts | 2 ++ src/services/state-estimation.ts | 27 +++++++++++++++++++++++++ src/services/study/state-estimation.ts | 11 ++++++---- 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 src/services/state-estimation.ts diff --git a/src/components/run-button-container.jsx b/src/components/run-button-container.jsx index eb23b761db..e5a08e6c06 100644 --- a/src/components/run-button-container.jsx +++ b/src/components/run-button-container.jsx @@ -463,14 +463,14 @@ export function RunButtonContainer({ studyUuid, currentNode, currentRootNetworkU }, [ComputingType.STATE_ESTIMATION]: { messageId: 'StateEstimation', - startComputation() { + startComputation(debug) { startComputationAsync( ComputingType.STATE_ESTIMATION, null, () => { - return startStateEstimation(studyUuid, currentNode?.id, currentRootNetworkUuid); + return startStateEstimation(studyUuid, currentNode?.id, currentRootNetworkUuid, debug); }, - () => {}, + () => debug && subscribeDebug(ComputingType.STATE_ESTIMATION), null, 'startStateEstimationError' ); diff --git a/src/hooks/use-computation-debug.ts b/src/hooks/use-computation-debug.ts index fb13041a68..c551cba1e7 100644 --- a/src/hooks/use-computation-debug.ts +++ b/src/hooks/use-computation-debug.ts @@ -26,6 +26,7 @@ import { useSelector } from 'react-redux'; import { AppState } from '../redux/reducer'; import { downloadDebugFileVoltageInit } from '../services/voltage-init'; import { downloadDebugFileShortCircuitAnalysis } from '../services/short-circuit-analysis'; +import { downloadDebugFileStateEstimationServer } from '../services/state-estimation'; const downloadDebugFileFetchers = { [ComputingType.DYNAMIC_SIMULATION]: downloadDebugFileDynamicSimulation, @@ -33,6 +34,7 @@ const downloadDebugFileFetchers = { [ComputingType.VOLTAGE_INITIALIZATION]: downloadDebugFileVoltageInit, [ComputingType.SHORT_CIRCUIT]: downloadDebugFileShortCircuitAnalysis, [ComputingType.SHORT_CIRCUIT_ONE_BUS]: downloadDebugFileShortCircuitAnalysis, + [ComputingType.STATE_ESTIMATION]: downloadDebugFileStateEstimationServer, } as Record Promise) | null>; export function buildDebugIdentifier({ diff --git a/src/services/state-estimation.ts b/src/services/state-estimation.ts new file mode 100644 index 0000000000..7f0794b0e2 --- /dev/null +++ b/src/services/state-estimation.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2026, RTE (http://www.rte-france.com) + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +import type { UUID } from 'node:crypto'; +import { backendFetch } from '@gridsuite/commons-ui'; + +const PREFIX_STATE_ESTIMATION_SERVER_QUERIES = import.meta.env.VITE_API_GATEWAY + '/state-estimation'; + +function getStateEstimationServerUrl() { + return `${PREFIX_STATE_ESTIMATION_SERVER_QUERIES}/v1/`; +} + +export function downloadDebugFileStateEstimationServer(resultUuid: UUID): Promise { + console.info(`Download state estimation debug file of '${resultUuid}' ...`); + + const url = getStateEstimationServerUrl() + `results/${resultUuid}/download-debug-file`; + + console.debug(url); + return backendFetch(url, { + method: 'get', + headers: { 'Content-Type': 'application/json' }, + }); +} diff --git a/src/services/study/state-estimation.ts b/src/services/study/state-estimation.ts index 92695af59a..8326bf2475 100644 --- a/src/services/study/state-estimation.ts +++ b/src/services/study/state-estimation.ts @@ -13,14 +13,17 @@ import { StateEstimationParameters } from '../../components/dialogs/parameters/s export function startStateEstimation( studyUuid: UUID, currentNodeUuid: UUID, - currentRootNetworkUuid: UUID + currentRootNetworkUuid: UUID, + debug?: boolean ): Promise { console.info( `Running state estimation on ${studyUuid} on root network '${currentRootNetworkUuid}' and node ${currentNodeUuid} ...` ); - const url = - getStudyUrlWithNodeUuidAndRootNetworkUuid(studyUuid, currentNodeUuid, currentRootNetworkUuid) + - '/state-estimation/run?debug=true'; + const urlSearchParams = new URLSearchParams(); + if (debug) { + urlSearchParams.append('debug', `${debug}`); + } + const url = `${getStudyUrlWithNodeUuidAndRootNetworkUuid(studyUuid, currentNodeUuid, currentRootNetworkUuid)}/state-estimation/run?${urlSearchParams}`; console.debug(url); return backendFetch(url, { method: 'post' }); From 95653872fa0093c522702edd32216d077a3b8470 Mon Sep 17 00:00:00 2001 From: David BRAQUART Date: Mon, 9 Feb 2026 10:31:07 +0100 Subject: [PATCH 3/3] linter Signed-off-by: David BRAQUART --- src/components/run-button-container.jsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/run-button-container.jsx b/src/components/run-button-container.jsx index e5a08e6c06..f1627b4e2b 100644 --- a/src/components/run-button-container.jsx +++ b/src/components/run-button-container.jsx @@ -467,9 +467,7 @@ export function RunButtonContainer({ studyUuid, currentNode, currentRootNetworkU startComputationAsync( ComputingType.STATE_ESTIMATION, null, - () => { - return startStateEstimation(studyUuid, currentNode?.id, currentRootNetworkUuid, debug); - }, + () => startStateEstimation(studyUuid, currentNode?.id, currentRootNetworkUuid, debug), () => debug && subscribeDebug(ComputingType.STATE_ESTIMATION), null, 'startStateEstimationError'