-
Notifications
You must be signed in to change notification settings - Fork 6
chore(VscHvdc): move creation and modification forms from grid-study #1303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dbraquart
wants to merge
40
commits into
main
Choose a base branch
from
dbraquart/move-hvdc-vsc-creation-form-to-commons-UI
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,614
−38
Open
Changes from 22 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
8259fac
wip before tests
dbraquart f676957
linter auto fix
dbraquart 8318f11
reorg folders
dbraquart 107ae97
fix dep cycles
dbraquart 3002cdf
restore exludeEdges to fix yup runtime cycle
dbraquart 5e9bea4
fix add missing useEffect deps
dbraquart 92a1f4a
fix add missing mandatory type for station creation dto
dbraquart 412b8ea
Merge remote-tracking branch 'origin/main' into dbraquart/move-hvdc-v…
dbraquart fbb0365
rm duplicated translation
dbraquart 82d7111
add translations
dbraquart f447cd9
change type
dbraquart b41ccc0
update Capability Curve is optional (modification case)
dbraquart fae1090
wip
dbraquart 0d39b59
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart 8f01788
wip modification
dbraquart a3559fb
modif translations
dbraquart 1ab8f2c
linter
dbraquart 2b7cbd0
add includePreviousValues in dtoToForm
dbraquart 0b2bcc3
fix conv station 1/2 mix
dbraquart 633ef74
fix hydration error: <div> cannot be a descendant of <p>
dbraquart ed0b3db
clean unused
dbraquart ccb986d
use DTO rather than network eqpt to get station Id
dbraquart 94e2f89
rabbit remark: translation
dbraquart f4830e2
fix act power limits issues (form inversion and copy issue)
dbraquart e6f7e4a
rename and clean
dbraquart a96cffb
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart a3dce72
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart 8ce4afc
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart 5e8e8fb
add key for strong item to fix unique key react warning
dbraquart 9e6c936
use RHF field for stationId (special read-only item in modif mode)
dbraquart b5405c5
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart 16fd3c3
import type uuid
dbraquart 49e16f9
export needed for study use
dbraquart e176336
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
achour94 cc8abf4
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart 06c95a2
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart 577adc8
use new hook useTabsReturn
dbraquart 6194b48
rev remarks
dbraquart 5511aef
fix enum type issue when we build exp/stu
dbraquart bc59017
Merge branch 'main' into dbraquart/move-hvdc-vsc-creation-form-to-com…
dbraquart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'; |
197 changes: 197 additions & 0 deletions
197
...work-modifications/hvdcLine/vsc/common/characteristics/VscHvdcLineCharacteristicsPane.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { | ||
| 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} /> | ||
| </> | ||
| ); | ||
| } | ||
9 changes: 9 additions & 0 deletions
9
src/features/network-modifications/hvdcLine/vsc/common/characteristics/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch.
I did not change the code from main, so this is a bug on main.
I fixed it.