Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8259fac
wip before tests
dbraquart Aug 19, 2026
f676957
linter auto fix
dbraquart Aug 19, 2026
8318f11
reorg folders
dbraquart Aug 19, 2026
107ae97
fix dep cycles
dbraquart Aug 19, 2026
3002cdf
restore exludeEdges to fix yup runtime cycle
dbraquart Aug 19, 2026
5e9bea4
fix add missing useEffect deps
dbraquart Aug 19, 2026
92a1f4a
fix add missing mandatory type for station creation dto
dbraquart Aug 20, 2026
412b8ea
Merge remote-tracking branch 'origin/main' into dbraquart/move-hvdc-v…
dbraquart Aug 20, 2026
fbb0365
rm duplicated translation
dbraquart Aug 20, 2026
82d7111
add translations
dbraquart Aug 21, 2026
f447cd9
change type
dbraquart Aug 21, 2026
b41ccc0
update Capability Curve is optional (modification case)
dbraquart Aug 21, 2026
fae1090
wip
dbraquart Aug 21, 2026
0d39b59
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart Aug 24, 2026
8f01788
wip modification
dbraquart Aug 24, 2026
a3559fb
modif translations
dbraquart Aug 24, 2026
1ab8f2c
linter
dbraquart Aug 24, 2026
2b7cbd0
add includePreviousValues in dtoToForm
dbraquart Aug 25, 2026
0b2bcc3
fix conv station 1/2 mix
dbraquart Aug 25, 2026
633ef74
fix hydration error: <div> cannot be a descendant of <p>
dbraquart Aug 25, 2026
ed0b3db
clean unused
dbraquart Aug 25, 2026
ccb986d
use DTO rather than network eqpt to get station Id
dbraquart Aug 25, 2026
94e2f89
rabbit remark: translation
dbraquart Aug 25, 2026
f4830e2
fix act power limits issues (form inversion and copy issue)
dbraquart Aug 25, 2026
e6f7e4a
rename and clean
dbraquart Aug 26, 2026
a96cffb
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart Aug 26, 2026
a3dce72
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart Aug 26, 2026
8ce4afc
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart Aug 27, 2026
5e8e8fb
add key for strong item to fix unique key react warning
dbraquart Aug 27, 2026
9e6c936
use RHF field for stationId (special read-only item in modif mode)
dbraquart Aug 27, 2026
b5405c5
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart Aug 27, 2026
16fd3c3
import type uuid
dbraquart Aug 27, 2026
49e16f9
export needed for study use
dbraquart Aug 27, 2026
e176336
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
achour94 Sep 1, 2026
cc8abf4
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart Sep 1, 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
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function HelperPreviousValue({
}

return (
<FormHelperText error={false} sx={{ marginLeft: 0 }}>
<FormHelperText component="div" error={false} sx={{ marginLeft: 0 }}>
{!disabledTooltip ? (
<Stack direction="row" spacing={1} sx={{ alignItems: 'center' }}>
<CustomTooltip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
PropertiesForm,
ReactiveLimitsForm,
ShortCircuitForm,
UpdateReactiveCapabilityCurveTable,
VoltageRegulationForm,
} from '../../common';
import { CheckboxNullableInput, FloatInput } from '../../../../components';
Expand All @@ -27,7 +28,7 @@ import { ActivePowerAdornment, EquipmentType, Identifiable, ReactivePowerAdornme

export interface BatteryDialogTabsContentProps extends ConnectivityNetworkProps {
batteryToModify?: BatteryFormInfos | null;
updatePreviousReactiveCapabilityCurveTable: (action: string, index: number) => void;
updatePreviousReactiveCapabilityCurveTable: UpdateReactiveCapabilityCurveTable;
fetchVoltageLevelEquipments: (voltageLevelId: string) => Promise<(Identifiable & { type: EquipmentType })[]>;
tabIndex: number;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { array, number, ref, object, TestContext, ValidationError } from 'yup';
import { FieldValues, UseFormSetValue } from 'react-hook-form';
import { ReactiveCapabilityCurve } from '../reactiveLimits.type';
import { FieldConstants, toNumber, validateValueIsANumber, YUP_REQUIRED } from '../../../../../utils';
import type { GeneratorCreationFormData } from '../../../generator/creation/generatorCreation.utils';
Expand Down Expand Up @@ -39,7 +38,7 @@ function getNotNullPFromArray(values: ReactiveCapabilityCurve) {
?.map((element) => {
const pValue = element[FieldConstants.P];

// Note : convertion toNumber is necessary here to prevent corner cases like if
// Note : conversion toNumber is necessary here to prevent corner cases like if
// two values are "-0" and "0", which would be considered different by the Set below.
return validateValueIsANumber(pValue) ? toNumber(pValue) : null;
})
Expand Down Expand Up @@ -139,22 +138,6 @@ export const getReactiveCapabilityCurveValidationSchema = (
[id]: getReactiveCapabilityCurveValidationSchemaArray(positiveAndNegativePExist),
});

export function setSelectedReactiveLimits(
id: string,
minMaxReactiveLimits: number,
setValue: UseFormSetValue<FieldValues>
) {
setValue(id, minMaxReactiveLimits ? 'MINMAX' : 'CURVE');
}

export function setCurrentReactiveCapabilityCurveTable(
previousReactiveCapabilityCurveTable: ReactiveCapabilityCurve,
fieldKey: string,
setValue: UseFormSetValue<FieldValues>
) {
setValue(fieldKey, previousReactiveCapabilityCurveTable);
}

function handleReactiveCapabilityCurveChoice(
previousChoice: string | null | undefined,
currentReactiveLimits: ReactiveLimitsFormData
Expand Down Expand Up @@ -195,7 +178,7 @@ export function toReactiveCapabilityCurveChoiceForGeneratorCreation(
return handleReactiveCapabilityCurveChoice(previousChoice, form.reactiveLimits);
}

// In case the user has changed the choice of the reactive capability curve, but not the values, we keep the original choice, or the network equipement value
// In case the user has changed the choice of the reactive capability curve, but not the values, we keep the original choice, or the network equipment value
export function toReactiveCapabilityCurveChoiceForGeneratorModification(
form: GeneratorModificationFormData,
generatorToModify: GeneratorFormInfos | undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ export interface MinMaxReactiveLimitsFormInfos {
export type ReactiveCapabilityCurve = ReactiveCapabilityCurveRow[] | null | undefined;

export type ReactiveCapabilityCurveRow = { maxQ: number | null; minQ: number | null; p: number | null };

export type UpdateReactiveCapabilityCurveTable = (action: string, index: number) => void;
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
ReactiveLimitsForm,
SetPointsForm,
ShortCircuitForm,
UpdateReactiveCapabilityCurveTable,
VoltageRegulationForm,
} from '../../common';
import { GeneratorFormInfos } from '../generatorDialog.type';
Expand All @@ -34,7 +35,7 @@ import { GridItem } from '../../../../components/composite/grid/grid-item';

export interface GeneratorDialogTabsContentProps extends ConnectivityNetworkProps {
generatorToModify?: GeneratorFormInfos | null;
updatePreviousReactiveCapabilityCurveTable: (action: string, index: number) => void;
updatePreviousReactiveCapabilityCurveTable: UpdateReactiveCapabilityCurveTable;
fetchVoltageLevelEquipments: (voltageLevelId: string) => Promise<(Identifiable & { type: EquipmentType })[]>;
tabIndex: number;
}
Expand Down
8 changes: 8 additions & 0 deletions src/features/network-modifications/hvdcLine/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* 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/.
*/

export * from './vsc';
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
/**
* Copyright (c) 2023, 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 { useEffect } from 'react';
import { Grid } from '@mui/material';
import { useFormContext, useWatch } from 'react-hook-form';
import { useIntl } from 'react-intl';
import { VSC_CONVERTER_MODE, VscHvdcLineInfo } from '../vscHvdcLine.types';
import { ActivePowerAdornment, FieldConstants, OhmAdornment, VoltageAdornment } from '../../../../../../utils';
import {
CheckboxNullableInput,
FloatInput,
GridItem,
GridSection,
SelectInput,
SwitchInput,
} from '../../../../../../components';
import { PropertiesForm } from '../../../../common/properties';

interface VscHvdcLineCharacteristicsPaneProps {
id?: string;
isModification: boolean;
hvdcLineToModify?: VscHvdcLineInfo | null;
}

export function VscHvdcLineCharacteristicsPane({
id = FieldConstants.HVDC_LINE,
isModification = false,
hvdcLineToModify,
}: Readonly<VscHvdcLineCharacteristicsPaneProps>) {
const intl = useIntl();
const { trigger } = useFormContext();

const angleDroopWatch = useWatch({
name: `${id}.${FieldConstants.ANGLE_DROOP_ACTIVE_POWER_CONTROL}`,
});

useEffect(() => {
if (!angleDroopWatch) {
trigger(`${id}.${FieldConstants.P0}`);
trigger(`${id}.${FieldConstants.DROOP}`);
}
}, [angleDroopWatch, trigger, id]);

const dcNominalVoltageField = (
<FloatInput
name={`${id}.${FieldConstants.NOMINAL_V}`}
adornment={VoltageAdornment}
label="dcNominalVoltageLabel"
previousValue={hvdcLineToModify?.nominalV}
/>
);

const dcResistanceField = (
<FloatInput
name={`${id}.${FieldConstants.R}`}
adornment={OhmAdornment}
label="dcResistanceLabel"
previousValue={hvdcLineToModify?.r}
/>
);

const maximumActivePowerField = (
<FloatInput
name={`${id}.${FieldConstants.MAX_P}`}
adornment={ActivePowerAdornment}
label="MaximumActivePowerText"
previousValue={hvdcLineToModify?.maxP}
/>
);

const operatorActivePowerLimitSide1Field = (
<FloatInput
name={`${id}.${FieldConstants.OPERATOR_ACTIVE_POWER_LIMIT_SIDE1}`}
adornment={ActivePowerAdornment}
label="operatorActivePowerLimitSide1Label"
previousValue={hvdcLineToModify?.hvdcOperatorActivePowerRange?.oprFromCS1toCS2}
/>
);

const operatorActivePowerLimitSide2Field = (
<FloatInput
name={`${id}.${FieldConstants.OPERATOR_ACTIVE_POWER_LIMIT_SIDE2}`}
adornment={ActivePowerAdornment}
label="operatorActivePowerLimitSide2Label"
previousValue={hvdcLineToModify?.hvdcOperatorActivePowerRange?.oprFromCS2toCS1}
/>
);

const previousConverterMode = () => {
if (hvdcLineToModify?.convertersMode === VSC_CONVERTER_MODE.SIDE_1_INVERTER_SIDE_2_RECTIFIER.id) {
return intl.formatMessage({
id: VSC_CONVERTER_MODE.SIDE_1_INVERTER_SIDE_2_RECTIFIER.label,
});
}
if (hvdcLineToModify?.convertersMode === VSC_CONVERTER_MODE.SIDE_1_RECTIFIER_SIDE_2_INVERTER.id) {
return intl.formatMessage({
id: VSC_CONVERTER_MODE.SIDE_1_RECTIFIER_SIDE_2_INVERTER.label,
});
}
return undefined;
};

const converterModeField = (
<SelectInput
name={`${id}.${FieldConstants.CONVERTERS_MODE}`}
label="converterModeLabel"
options={Object.values(VSC_CONVERTER_MODE)}
size="small"
disableClearable
previousValue={previousConverterMode()}
/>
);

const activePowerField = (
<FloatInput
name={`${id}.${FieldConstants.ACTIVE_POWER_SET_POINT}`}
label="ActivePowerText"
adornment={ActivePowerAdornment}
previousValue={hvdcLineToModify?.activePowerSetpoint}
/>
);

const previousAngleDropPowerControl = () => {
if (hvdcLineToModify?.hvdcAngleDroopActivePowerControl?.isEnabled === true) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if hvscLineToModify is undefined the function should return undefined otherwhise we will have 'Off' as a previous value in applications that does not have a network data (gridexplore)

return intl.formatMessage({ id: 'On' });
}

return intl.formatMessage({ id: 'Off' });
};

function getAngleDroopActivePowerControlField() {
if (isModification) {
return (
<CheckboxNullableInput
name={`${id}.${FieldConstants.ANGLE_DROOP_ACTIVE_POWER_CONTROL}`}
label="angleDroopActivePowerControlLabel"
previousValue={previousAngleDropPowerControl()}
/>
);
}
return (
<SwitchInput
name={`${id}.${FieldConstants.ANGLE_DROOP_ACTIVE_POWER_CONTROL}`}
label="angleDroopActivePowerControlLabel"
/>
);
}

const AngleDroopActivePowerControl = getAngleDroopActivePowerControlField();

const p0Field = (
<FloatInput
name={`${id}.${FieldConstants.P0}`}
label="p0Label"
adornment={ActivePowerAdornment}
previousValue={hvdcLineToModify?.hvdcAngleDroopActivePowerControl?.p0}
/>
);

const droopField = (
<FloatInput
name={`${id}.${FieldConstants.DROOP}`}
label="droopLabel"
previousValue={hvdcLineToModify?.hvdcAngleDroopActivePowerControl?.droop}
/>
);

return (
<>
<GridSection title="Characteristics" />
<Grid container spacing={2} sx={{ width: '100%' }}>
<GridItem>{dcNominalVoltageField}</GridItem>
<GridItem>{dcResistanceField}</GridItem>
<GridItem>{maximumActivePowerField}</GridItem>
</Grid>
<GridSection title="Limits" />
<Grid container spacing={2} sx={{ width: '100%' }}>
<GridItem>{operatorActivePowerLimitSide1Field}</GridItem>
<GridItem>{operatorActivePowerLimitSide2Field}</GridItem>
</Grid>
<GridSection title="Setpoints" />
<Grid container spacing={2} sx={{ width: '100%' }}>
<GridItem>{converterModeField}</GridItem>
<GridItem>{activePowerField}</GridItem>
<GridItem size={12}>{AngleDroopActivePowerControl}</GridItem>
<GridItem>{droopField}</GridItem>
<GridItem>{p0Field}</GridItem>
</Grid>
<PropertiesForm isModification={isModification} />
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* 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/.
*/

export * from './vscHvdcLineCharacteristicsPane.utils';
export * from './VscHvdcLineCharacteristicsPane';
Loading
Loading