Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
69cf64a
feat(): module ENR part 2, add `powerElectronicsClusters` parameters …
sBouzols Jan 21, 2026
d22388e
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols Jan 21, 2026
766d4c5
Merge remote-tracking branch 'origin/main' into feat_shortcircuit_ENR…
sBouzols Jan 23, 2026
50d3a28
complete fix and refactor usage of SelectInput for cluster configura…
sBouzols Jan 27, 2026
950b6d3
Merge remote-tracking branch 'origin/main' into feat_shortcircuit_ENR…
sBouzols Jan 28, 2026
547ff25
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols Feb 4, 2026
d3af371
fix some sonar issues
sBouzols Feb 4, 2026
eea0b35
prettier
sBouzols Feb 4, 2026
820cbeb
remove disable prettier line
sBouzols Feb 4, 2026
93d5621
try som labels and alignments
sBouzols Feb 5, 2026
2adc1d3
style(shortcircuit ENR params): style tables and all
sBouzols Feb 5, 2026
5f5f602
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols Feb 5, 2026
a6c37f4
disable Select as well
sBouzols Feb 6, 2026
4359312
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols Feb 6, 2026
7d13d70
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols Feb 9, 2026
7ca0daa
fixes from review
sBouzols Feb 10, 2026
504fe0f
Merge branch 'feat_shortcircuit_ENR_params_part2' of https://github.c…
sBouzols Feb 10, 2026
0c14b19
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols Feb 10, 2026
67f83c2
remove unused import
sBouzols Feb 10, 2026
c4c8e13
Pass snackError to utility class to manage JSON parse error with a sn…
sBouzols Feb 10, 2026
f8c9edf
Merge branch 'main' into feat_shortcircuit_ENR_params_part2
sBouzols Feb 10, 2026
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
130 changes: 130 additions & 0 deletions src/components/parameters/short-circuit/columns-definition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/**
* Copyright (c) 2025, RTE (http://www.rte-france.com)
Copy link
Contributor

@EtienneLt EtienneLt Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026, for every new file

* 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 { ElementType, EquipmentType } from '../../../utils';

export const SHORT_CIRCUIT_ICC_MATERIAL_ACTIVE = 'active';
export const SHORT_CIRCUIT_ICC_MATERIAL_TYPE = 'type';
export const SHORT_CIRCUIT_ICC_MATERIAL_ALPHA = 'alpha';
export const SHORT_CIRCUIT_ICC_MATERIAL_USMIN = 'usMin';
export const SHORT_CIRCUIT_ICC_MATERIAL_USMAX = 'usMax';
export const SHORT_CIRCUIT_ICC_MATERIAL_U0 = 'u0';
export const SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE = SHORT_CIRCUIT_ICC_MATERIAL_ACTIVE;
export const SHORT_CIRCUIT_ICC_CLUSTER_FILTERS = 'filters';
export const SHORT_CIRCUIT_ICC_CLUSTER_TYPE = SHORT_CIRCUIT_ICC_MATERIAL_TYPE;
export const SHORT_CIRCUIT_ICC_CLUSTER_ALPHA = SHORT_CIRCUIT_ICC_MATERIAL_ALPHA;
export const SHORT_CIRCUIT_ICC_CLUSTER_USMIN = SHORT_CIRCUIT_ICC_MATERIAL_USMIN;
export const SHORT_CIRCUIT_ICC_CLUSTER_USMAX = SHORT_CIRCUIT_ICC_MATERIAL_USMAX;
export const SHORT_CIRCUIT_ICC_CLUSTER_U0 = SHORT_CIRCUIT_ICC_MATERIAL_U0;

export interface IccCommonIColumnsDef {
label: React.ReactNode;
dataKey: string;
tooltip: React.ReactNode;
width?: string;
}

export interface IccMaterialIColumnsDef extends IccCommonIColumnsDef {}
export interface IccClusterIColumnsDef extends IccCommonIColumnsDef {
equipmentTypes?: EquipmentType[];
elementType?: string;
titleId?: string;
initialValue?: any;
}

export const COLUMNS_DEFINITIONS_ICC_MATERIALS: IccMaterialIColumnsDef[] = [
{
label: 'ShortCircuitIccActive',
dataKey: SHORT_CIRCUIT_ICC_MATERIAL_ACTIVE,
tooltip: 'ShortCircuitIccMaterialActiveTooltip',
width: '8%',
},
{
label: 'ShortCircuitIccMaterialType',
dataKey: SHORT_CIRCUIT_ICC_MATERIAL_TYPE,
tooltip: 'ShortCircuitIccMaterialTypeTooltip',
},
{
label: 'ShortCircuitIccAlpha',
dataKey: SHORT_CIRCUIT_ICC_MATERIAL_ALPHA,
tooltip: 'ShortCircuitIccAlphaTooltip',
width: '8%',
},
{
label: 'ShortCircuitIccUsmin',
dataKey: SHORT_CIRCUIT_ICC_MATERIAL_USMIN,
tooltip: 'ShortCircuitIccUsminTooltip',
width: '8%',
},
{
label: 'ShortCircuitIccUsmax',
dataKey: SHORT_CIRCUIT_ICC_MATERIAL_USMAX,
tooltip: 'ShortCircuitIccUsmaxTooltip',
width: '8%',
},
{
label: 'ShortCircuitIccU0',
dataKey: SHORT_CIRCUIT_ICC_MATERIAL_U0,
tooltip: 'ShortCircuitIccU0Tooltip',
width: '8%',
},
];

export const COLUMNS_DEFINITIONS_ICC_CLUSTERS: IccClusterIColumnsDef[] = [
{
label: 'ShortCircuitIccActive',
dataKey: SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE,
tooltip: 'ShortCircuitIccClusterActiveTooltip',
initialValue: false,
width: '8%',
},
{
label: 'ShortCircuitIccClusterFilters',
dataKey: SHORT_CIRCUIT_ICC_CLUSTER_FILTERS,
tooltip: 'ShortCircuitIccClusterFiltersTooltip',
equipmentTypes: [EquipmentType.GENERATOR, EquipmentType.BATTERY],
elementType: ElementType.FILTER,
titleId: 'FiltersListsSelection',
initialValue: [],
},
{
label: 'ShortCircuitIccClusterType',
dataKey: SHORT_CIRCUIT_ICC_CLUSTER_TYPE,
tooltip: 'ShortCircuitIccClusterTypeTooltip',
titleId: 'ShortCircuitIccClusterTypeListsSelection',
initialValue: [],
width: '15%',
},
{
label: 'ShortCircuitIccAlpha',
dataKey: SHORT_CIRCUIT_ICC_CLUSTER_ALPHA,
tooltip: 'ShortCircuitIccAlphaTooltip',
initialValue: 1,
width: '8%',
},
{
label: 'ShortCircuitIccUsmin',
dataKey: SHORT_CIRCUIT_ICC_CLUSTER_USMIN,
tooltip: 'ShortCircuitIccUsminTooltip',
initialValue: 0,
width: '8%',
},
{
label: 'ShortCircuitIccUsmax',
dataKey: SHORT_CIRCUIT_ICC_CLUSTER_USMAX,
tooltip: 'ShortCircuitIccUsmaxTooltip',
initialValue: 100,
width: '8%',
},
{
label: 'ShortCircuitIccU0',
dataKey: SHORT_CIRCUIT_ICC_CLUSTER_U0,
tooltip: 'ShortCircuitIccU0Tooltip',
initialValue: 100,
width: '8%',
},
];
2 changes: 2 additions & 0 deletions src/components/parameters/short-circuit/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const SHORT_CIRCUIT_VOLTAGE_RANGES = 'voltageRanges';
export const SHORT_CIRCUIT_ONLY_STARTED_GENERATORS_IN_CALCULATION_CLUSTER = 'onlyStartedGeneratorsInCalculationCluster';
export const SHORT_CIRCUIT_MODEL_POWER_ELECTRONICS = 'modelPowerElectronics';
export const SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS = 'powerElectronicsMaterials';
export const SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTER = 'powerElectronicsCluster'; // TODO REMOVE WHEN fixed in powsybl
export const SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS = 'powerElectronicsClusters';

export const intlPredefinedParametersOptions = () => [
{
Expand Down
28 changes: 24 additions & 4 deletions src/components/parameters/short-circuit/short-circuit-fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
SHORT_CIRCUIT_WITH_NEUTRAL_POSITION,
SHORT_CIRCUIT_WITH_SHUNT_COMPENSATORS,
SHORT_CIRCUIT_WITH_VSC_CONVERTER_STATIONS,
SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS,
} from './constants';
import { VoltageTable } from './short-circuit-voltage-table';
import GridItem from '../../grid/grid-item';
Expand All @@ -35,7 +36,8 @@ import { CheckboxInput, FieldLabel, MuiSelectInput, RadioInput, SwitchInput } fr
import type { SxStyle } from '../../../utils/styles';
import { COMMON_PARAMETERS, SPECIFIC_PARAMETERS } from '../common';
import { ShortCircuitIccMaterialTable } from './short-circuit-icc-material-table';
import { COLUMNS_DEFINITIONS_ICC_MATERIALS } from './short-circuit-icc-material-table-columns-definition';
import { COLUMNS_DEFINITIONS_ICC_CLUSTERS, COLUMNS_DEFINITIONS_ICC_MATERIALS } from './columns-definition';
import { ShortCircuitIccClusterTable } from './short-circuit-icc-cluster-table';

export interface ShortCircuitFieldsProps {
resetAll: (predefinedParams: PredefinedParameters) => void;
Expand All @@ -47,12 +49,26 @@ export enum Status {
ERROR = 'ERROR',
}

const columnsDef = COLUMNS_DEFINITIONS_ICC_MATERIALS.map((col) => ({
const iccMaterialsColumnsDef = COLUMNS_DEFINITIONS_ICC_MATERIALS.map((col) => ({
...col,
label: <FormattedMessage id={col.label as string} />,
tooltip: <FormattedMessage id={col.tooltip as string} />,
}));

const iccClustersColumnsDef = COLUMNS_DEFINITIONS_ICC_CLUSTERS.map((col) => ({
...col,
label: <FormattedMessage id={col.label as string} />,
tooltip: <FormattedMessage id={col.tooltip as string} />,
}));

function createRows() {
const rowData: { [key: string]: any } = {};
iccClustersColumnsDef.forEach((column) => {
rowData[column.dataKey] = column.initialValue;
});
return rowData;
}

export function ShortCircuitFields({ resetAll, isDeveloperMode = true }: Readonly<ShortCircuitFieldsProps>) {
const [status, setStatus] = useState(Status.SUCCESS);
const watchInitialVoltageProfileMode = useWatch({
Expand Down Expand Up @@ -286,8 +302,12 @@ export function ShortCircuitFields({ resetAll, isDeveloperMode = true }: Readonl
</Grid>
<ShortCircuitIccMaterialTable
formName={`${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_POWER_ELECTRONICS_MATERIALS}`}
tableHeight={300}
columnsDefinition={columnsDef}
columnsDefinition={iccMaterialsColumnsDef}
/>
<ShortCircuitIccClusterTable
formName={`${SPECIFIC_PARAMETERS}.${SHORT_CIRCUIT_POWER_ELECTRONICS_CLUSTERS}`}
columnsDefinition={iccClustersColumnsDef}
createRows={createRows}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Copyright (c) 2025, 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 { TableCell } from '@mui/material';
import { DirectoryItemsInput, FloatInput, SelectInput, SwitchInput } from '../../inputs';
import {
IccClusterIColumnsDef,
SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE,
SHORT_CIRCUIT_ICC_CLUSTER_FILTERS,
SHORT_CIRCUIT_ICC_CLUSTER_TYPE,
} from './columns-definition';

export function ShortCircuitIccClusterTableCell({
formName,
rowIndex,
column,
inputsDisabled,
}: Readonly<{
formName: string;
rowIndex: number;
column: IccClusterIColumnsDef;
inputsDisabled?: boolean;
}>) {
return (
<TableCell align="center" sx={{ fontWeight: 'bold' }}>
{column.dataKey === SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE && (
<SwitchInput size="small" name={`${formName}[${rowIndex}].${column.dataKey}`} />

Check failure on line 30 in src/components/parameters/short-circuit/short-circuit-icc-cluster-table-cell.tsx

View workflow job for this annotation

GitHub Actions / build / build

Type '{ size: string; name: string; }' is not assignable to type 'IntrinsicAttributes & SwitchInputProps'.
)}
{column.dataKey === SHORT_CIRCUIT_ICC_CLUSTER_FILTERS && (
<DirectoryItemsInput
name={`${formName}[${rowIndex}].${column.dataKey}`}
equipmentTypes={column.equipmentTypes}
elementType={column.elementType ?? ''}
titleId={column.titleId}
hideErrorMessage
label={undefined}
itemFilter={undefined}
disable={inputsDisabled}
/>
)}
{column.dataKey === SHORT_CIRCUIT_ICC_CLUSTER_TYPE && (
<SelectInput
size="small"
name={`${formName}[${rowIndex}].${column.dataKey}`}
label={column.titleId}
options={['WIND', 'SOLAR', 'HVDC']}
disabled={inputsDisabled}
/>
)}
{column.dataKey !== SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE &&
column.dataKey !== SHORT_CIRCUIT_ICC_CLUSTER_FILTERS &&
column.dataKey !== SHORT_CIRCUIT_ICC_CLUSTER_TYPE && (
<FloatInput disabled={inputsDisabled} name={`${formName}[${rowIndex}].${column.dataKey}`} />
)}
</TableCell>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* Copyright (c) 2025, 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 { IconButton, TableCell, TableRow, Tooltip } from '@mui/material';
import { Delete as DeleteIcon } from '@mui/icons-material';
import { useWatch } from 'react-hook-form';
import { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { IccClusterIColumnsDef, SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE } from './columns-definition';
import { ShortCircuitIccClusterTableCell } from './short-circuit-icc-cluster-table-cell';

interface ShortCircuitIccClusterTableRowProps {
formName: string;
columnsDefinition: IccClusterIColumnsDef[];
index: number;
onDeleteButton: (index: number) => void;
}

export function ShortCircuitIccClusterTableRow({
formName,
columnsDefinition,
index,
onDeleteButton,
}: Readonly<ShortCircuitIccClusterTableRowProps>) {
const [isHover, setIsHover] = useState(false);
const watchRowActive = useWatch({
name: `${formName}[${index}].${SHORT_CIRCUIT_ICC_CLUSTER_ACTIVE}`,
});

return (
<TableRow onMouseEnter={() => setIsHover(true)} onMouseLeave={() => setIsHover(false)}>
{columnsDefinition.map((column: IccClusterIColumnsDef) => (
<ShortCircuitIccClusterTableCell
key={`${column.dataKey}`}
formName={formName}
rowIndex={index}
column={column}
inputsDisabled={!watchRowActive}
/>
))}
<TableCell align="center">
{isHover && (
<Tooltip title={<FormattedMessage id="DeleteRows" />}>
<IconButton size="small" onClick={() => onDeleteButton(index)}>
<DeleteIcon fontSize="small" />
</IconButton>
</Tooltip>
)}
</TableCell>
</TableRow>
);
}
Loading
Loading