Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -347,6 +348,11 @@ export const PREFILLED_COLUMNS_CONFIG: Record<string, PrefilledColumnGroup[]> =
csvColumns: [TARGET_V],
networkFields: ['targetV'],
},
{
labelId: REGULATION_TYPE,
csvColumns: [REGULATION_TYPE],
networkFields: ['regulationType'],
},
{
labelId: REGULATING_TERMINAL_ID,
csvColumns: [REGULATING_TERMINAL_ID],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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: {
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/redux/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 0 additions & 12 deletions src/utils/spreadsheet-equipments-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

Expand All @@ -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:
Expand Down
Loading