Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/components/run-button-container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,12 @@ 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);
},
() => {},
() => startStateEstimation(studyUuid, currentNode?.id, currentRootNetworkUuid, debug),
() => debug && subscribeDebug(ComputingType.STATE_ESTIMATION),
null,
'startStateEstimationError'
);
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/use-computation-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ 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,
[ComputingType.DYNAMIC_SECURITY_ANALYSIS]: downloadDebugFileDynamicSecurityAnalysis,
[ComputingType.VOLTAGE_INITIALIZATION]: downloadDebugFileVoltageInit,
[ComputingType.SHORT_CIRCUIT]: downloadDebugFileShortCircuitAnalysis,
[ComputingType.SHORT_CIRCUIT_ONE_BUS]: downloadDebugFileShortCircuitAnalysis,
[ComputingType.STATE_ESTIMATION]: downloadDebugFileStateEstimationServer,
} as Record<ComputingType, ((resultUuid: UUID) => Promise<Response>) | null>;

export function buildDebugIdentifier({
Expand Down
27 changes: 27 additions & 0 deletions src/services/state-estimation.ts
Original file line number Diff line number Diff line change
@@ -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<Response> {
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' },
});
}
11 changes: 7 additions & 4 deletions src/services/study/state-estimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Response> {
console.info(
`Running state estimation on ${studyUuid} on root network '${currentRootNetworkUuid}' and node ${currentNodeUuid} ...`
);
const url =
getStudyUrlWithNodeUuidAndRootNetworkUuid(studyUuid, currentNodeUuid, currentRootNetworkUuid) +
'/state-estimation/run';
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' });
Expand Down
Loading