diff --git a/src/components/dialogs/network-modifications/tabular/generation/prefillable-columns-config.ts b/src/components/dialogs/network-modifications/tabular/generation/prefillable-columns-config.ts index fe8e6321ec..0dabe62438 100644 --- a/src/components/dialogs/network-modifications/tabular/generation/prefillable-columns-config.ts +++ b/src/components/dialogs/network-modifications/tabular/generation/prefillable-columns-config.ts @@ -73,6 +73,7 @@ import { REACTIVE_CAPABILITY_CURVE_P_MAX, REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MAX, REACTIVE_CAPABILITY_CURVE_Q_MAX_P_MAX, + REGULATION_TYPE, } from 'components/utils/field-constants'; import { FieldConstants } from '@gridsuite/commons-ui'; @@ -347,6 +348,11 @@ export const PREFILLED_COLUMNS_CONFIG: Record = csvColumns: [TARGET_V], networkFields: ['targetV'], }, + { + labelId: REGULATION_TYPE, + csvColumns: [REGULATION_TYPE], + networkFields: ['regulationType'], + }, { labelId: REGULATING_TERMINAL_ID, csvColumns: [REGULATING_TERMINAL_ID], diff --git a/src/components/dialogs/network-modifications/tabular/generation/utils.ts b/src/components/dialogs/network-modifications/tabular/generation/utils.ts index dab84e3ccf..2426e041e6 100644 --- a/src/components/dialogs/network-modifications/tabular/generation/utils.ts +++ b/src/components/dialogs/network-modifications/tabular/generation/utils.ts @@ -4,7 +4,7 @@ * 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 { Identifiable, yupConfig as yup, type MuiStyles, type UseStateBooleanReturn } from '@gridsuite/commons-ui'; +import { Identifiable, type MuiStyles, type UseStateBooleanReturn, yupConfig as yup } from '@gridsuite/commons-ui'; import { ReactiveCapabilityCurvePoints } from 'components/dialogs/reactive-limits/reactive-limits.type'; import { SHUNT_COMPENSATOR_TYPES } from 'components/network/constants'; import { EQUIPMENT_TYPES } from 'components/utils/equipment-types'; @@ -22,7 +22,7 @@ import { REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MAX, REACTIVE_CAPABILITY_CURVE_Q_MIN_P_MIN, } from 'components/utils/field-constants'; -import { mapGeneratorDataForTable, mapTwtDataForTable } from 'utils/spreadsheet-equipments-mapper'; +import { mapTwtDataForTable } from 'utils/spreadsheet-equipments-mapper'; export const styles = { dialogContent: { @@ -187,10 +187,9 @@ export const mapPrefilledEquipments = (equipmentType: EQUIPMENT_TYPES, equipment switch (equipmentType) { case EQUIPMENT_TYPES.TWO_WINDINGS_TRANSFORMER: return equipments.map(mapTwtDataForTable); - case EQUIPMENT_TYPES.GENERATOR: - return equipments.map((eq) => mapReactiveCapabilityCurvePointsToFormFields(mapGeneratorDataForTable(eq))); case EQUIPMENT_TYPES.SHUNT_COMPENSATOR: return equipments.map(mapShuntCompensatorToFormFields); + case EQUIPMENT_TYPES.GENERATOR: case EQUIPMENT_TYPES.BATTERY: return equipments.map(mapReactiveCapabilityCurvePointsToFormFields); default: diff --git a/src/redux/reducer.ts b/src/redux/reducer.ts index a19f6fcc02..efcbbafd45 100644 --- a/src/redux/reducer.ts +++ b/src/redux/reducer.ts @@ -1517,6 +1517,7 @@ export const reducer = createReducer(initialState, (builder) => { switch (action.equipmentType) { case SpreadsheetEquipmentType.GENERATOR: propsToClean = { + regulationType: undefined, regulatingTerminalVlName: undefined, regulatingTerminalConnectableId: undefined, regulatingTerminalConnectableType: undefined, diff --git a/src/utils/spreadsheet-equipments-mapper.ts b/src/utils/spreadsheet-equipments-mapper.ts index 7b72e8d813..bab88bbf36 100644 --- a/src/utils/spreadsheet-equipments-mapper.ts +++ b/src/utils/spreadsheet-equipments-mapper.ts @@ -74,16 +74,6 @@ export const mapPhaseTapChanger = (twt: any) => { export const mapTwtDataForTable = (twt: any) => mapPhaseTapChanger(mapRatioTapChanger(twt)); -export const mapGeneratorDataForTable = (generator: any) => { - const formattedGenerator = { ...generator }; - const hasDistantRegulation = - formattedGenerator.regulatingTerminalVlId || formattedGenerator.regulatingTerminalConnectableId; - formattedGenerator.RegulationTypeText = - formattedGenerator.RegulationTypeText || - (hasDistantRegulation ? REGULATION_TYPES.DISTANT.id : REGULATION_TYPES.LOCAL.id); - return formattedGenerator; -}; - export const mapShuntCompensatorDataForTable = (shuntCompensator: any) => { const formattedCompensator = { ...shuntCompensator }; @@ -102,8 +92,6 @@ const mapSpreadsheetEquipment = (equipmentType: SpreadsheetEquipmentType, equipm case SpreadsheetEquipmentType.TWO_WINDINGS_TRANSFORMER: case SpreadsheetEquipmentType.BRANCH: // can do it because mappers test if field present before modifying return mapTwtDataForTable(equipment); - case SpreadsheetEquipmentType.GENERATOR: - return mapGeneratorDataForTable(equipment); case SpreadsheetEquipmentType.SHUNT_COMPENSATOR: return mapShuntCompensatorDataForTable(equipment); default: