Skip to content

Commit

Permalink
Add MCS Expert Filter front
Browse files Browse the repository at this point in the history
Signed-off-by: Lilian Houdelet <lhoudelet@oxyl.fr>
  • Loading branch information
lilian-houdelet committed Jan 23, 2024
1 parent 0b46474 commit 874569e
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 4 deletions.
68 changes: 68 additions & 0 deletions src/components/dialogs/filter/expert/expert-filter-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export const EXPERT_FILTER_EQUIPMENTS = {
id: 'LOAD',
label: 'Loads',
},
SHUNT_COMPENSATOR: {
id: 'SHUNT_COMPENSATOR',
label: 'ShuntCompensators',
},
};

export const ENERGY_SOURCE_OPTIONS = [
Expand All @@ -33,6 +37,11 @@ export const ENERGY_SOURCE_OPTIONS = [
{ name: 'OTHER', label: 'Other' },
];

export const SHUNT_COMPENSATOR_TYPE_OPTIONS = [
{ name: 'CAPACITOR', label: 'Capacitor' },
{ name: 'REACTOR', label: 'Reactor' },
];

// customName is used to export to the server
export const OPERATOR_OPTIONS = {
EQUALS: { name: '=', customName: OperatorType.EQUALS, label: 'equality' },
Expand Down Expand Up @@ -203,6 +212,50 @@ export const FIELDS_OPTIONS = {
label: 'vlId',
dataType: DataType.STRING,
},
MAXIMUM_SECTION_COUNT: {
name: FieldType.MAXIMUM_SECTION_COUNT,
label: 'maximumSectionCount',
dataType: DataType.NUMBER,
inputType: 'number',
},
SECTION_COUNT: {
name: FieldType.SECTION_COUNT,
label: 'sectionCount',
dataType: DataType.NUMBER,
inputType: 'number',
},
SHUNT_COMPENSATOR_TYPE: {
name: FieldType.SHUNT_COMPENSATOR_TYPE,
label: 'shuntCompensatorType',
dataType: DataType.ENUM,
values: SHUNT_COMPENSATOR_TYPE_OPTIONS,
valueEditorType: 'select',
defaultValue: 'CAPACITOR',
},
MAX_Q_AT_NOMINAL_V: {
name: FieldType.MAX_Q_AT_NOMINAL_V,
label: 'maxQAtNominalV',
dataType: DataType.NUMBER,
inputType: 'number',
},
SWITCHED_ON_Q_AT_NOMINAL_V: {
name: FieldType.SWITCHED_ON_Q_AT_NOMINAL_V,
label: 'SwitchedOnMaxQAtNominalV',
dataType: DataType.NUMBER,
inputType: 'number',
},
MAX_SUSCEPTANCE: {
name: FieldType.MAX_SUSCEPTANCE,
label: 'maxSusceptance',
dataType: DataType.NUMBER,
inputType: 'number',
},
SWITCHED_ON_MAX_SUSCEPTANCE: {
name: FieldType.SWITCHED_ON_MAX_SUSCEPTANCE,
label: 'SwitchedOnMaxSusceptance',
dataType: DataType.NUMBER,
inputType: 'number',
},
};

export const fields: Record<string, Field[]> = {
Expand All @@ -227,4 +280,19 @@ export const fields: Record<string, Field[]> = {
FIELDS_OPTIONS.VOLTAGE_LEVEL_ID,
],
LOAD: [FIELDS_OPTIONS.ID],
SHUNT_COMPENSATOR: [
FIELDS_OPTIONS.ID,
FIELDS_OPTIONS.NAME,
FIELDS_OPTIONS.VOLTAGE_LEVEL_ID,
FIELDS_OPTIONS.NOMINAL_VOLTAGE,
FIELDS_OPTIONS.COUNTRY,
FIELDS_OPTIONS.MAXIMUM_SECTION_COUNT,
FIELDS_OPTIONS.SECTION_COUNT,
FIELDS_OPTIONS.SHUNT_COMPENSATOR_TYPE,
FIELDS_OPTIONS.MAX_Q_AT_NOMINAL_V,
FIELDS_OPTIONS.SWITCHED_ON_Q_AT_NOMINAL_V,
FIELDS_OPTIONS.MAX_SUSCEPTANCE,
FIELDS_OPTIONS.SWITCHED_ON_MAX_SUSCEPTANCE,
FIELDS_OPTIONS.CONNECTED,
],
};
12 changes: 10 additions & 2 deletions src/components/dialogs/filter/expert/expert-filter-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import InputWithPopupConfirmation from '../../../utils/rhf-inputs/select-inputs/
import { SelectInput } from '@gridsuite/commons-ui';
import { useFormContext, useWatch } from 'react-hook-form';
import { testQuery } from './expert-filter-utils';
import { Generator, Load } from '../../../../utils/equipment-types';
import {
Generator,
Load,
ShuntCompensator,
} from '../../../../utils/equipment-types';
import {
COMBINATOR_OPTIONS,
EXPERT_FILTER_EQUIPMENTS,
Expand Down Expand Up @@ -76,7 +80,11 @@ export const expertFilterSchema = {
};

function isSupportedEquipmentType(equipmentType: string): boolean {
return equipmentType === Generator.type || equipmentType === Load.type;
return (
equipmentType === Generator.type ||
equipmentType === Load.type ||
equipmentType === ShuntCompensator.type
);
}

const defaultQuery = {
Expand Down
9 changes: 8 additions & 1 deletion src/components/dialogs/filter/expert/expert-filter.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,19 @@ export enum FieldType {
COUNTRY = 'COUNTRY',
VOLTAGE_REGULATOR_ON = 'VOLTAGE_REGULATOR_ON',
PLANNED_ACTIVE_POWER_SET_POINT = 'PLANNED_ACTIVE_POWER_SET_POINT',
CONNECTED = 'CONNECTED',
RATED_S = 'RATED_S',
MARGINAL_COST = 'MARGINAL_COST',
PLANNED_OUTAGE_RATE = 'PLANNED_OUTAGE_RATE',
FORCED_OUTAGE_RATE = 'FORCED_OUTAGE_RATE',
VOLTAGE_LEVEL_ID = 'VOLTAGE_LEVEL_ID',
SECTION_COUNT = 'SECTION_COUNT',
MAXIMUM_SECTION_COUNT = 'MAXIMUM_SECTION_COUNT',
SHUNT_COMPENSATOR_TYPE = 'SHUNT_COMPENSATOR_TYPE',
CONNECTED = 'CONNECTED',
MAX_Q_AT_NOMINAL_V = 'MAX_Q_AT_NOMINAL_V',
SWITCHED_ON_Q_AT_NOMINAL_V = 'SWITCHED_ON_Q_AT_NOMINAL_V',
MAX_SUSCEPTANCE = 'MAX_SUSCEPTANCE',
SWITCHED_ON_MAX_SUSCEPTANCE = 'SWITCHED_ON_MAX_SUSCEPTANCE',
}

export enum DataType {
Expand Down
5 changes: 4 additions & 1 deletion src/components/utils/rqb-inputs/value-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ const ValueEditor = (props: ValueEditorProps) => {
if (props.field === FieldType.COUNTRY) {
return <CountryValueEditor {...props} />;
}
if (props.field === FieldType.ENERGY_SOURCE) {
if (
props.field === FieldType.ENERGY_SOURCE ||
props.field === FieldType.SHUNT_COMPENSATOR_TYPE
) {
return <TranslatedValueEditor {...props} />;
}
if (props.field === FieldType.ID || props.field === FieldType.NAME) {
Expand Down
9 changes: 9 additions & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@
"voltageRegulatorOn": "Voltage regulation",
"PlannedActivePowerSetPoint": "Planning active power set point",
"connected": "Connected",
"maximumSectionCount": "Maximum number of sections",
"sectionCount": "Current number of sections",
"shuntCompensatorType": "Type",
"Capacitor": "Capacitor",
"Reactor": "Reactor",
"maxQAtNominalV": "Qmax available at nominal voltage",
"SwitchedOnMaxQAtNominalV": "Switch-on Q at nominal voltage",
"maxSusceptance": "Maximal susceptance available",
"SwitchedOnMaxSusceptance": "Switch-on susceptance",
"ratedS": "Rated nominal power",
"marginalCost": "Cost",
"plannedOutageRate": "Planning outage rate",
Expand Down
9 changes: 9 additions & 0 deletions src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,15 @@
"voltageRegulatorOn": "Réglage de tension",
"PlannedActivePowerSetPoint": "Puissance imposée",
"connected": "Connecté",
"maximumSectionCount": "Nombre de gradins",
"sectionCount": "Gradin courant",
"shuntCompensatorType": "Type",
"Capacitor": "Condensateur",
"Reactor": "Réactance",
"maxQAtNominalV": "Q installée à tension nominale",
"SwitchedOnMaxQAtNominalV": "Q enclenchée à tension nominale",
"maxSusceptance": "Susceptance installée",
"SwitchedOnMaxSusceptance": "Susceptance enclenchée",
"ratedS": "Puissance nominale",
"marginalCost": "Coût",
"plannedOutageRate": "Indisponibilité programmée",
Expand Down

0 comments on commit 874569e

Please sign in to comment.