Skip to content

Commit 660a5e5

Browse files
authored
add some control on vl and generator creation (#3393)
Signed-off-by: Etienne LESOT <[email protected]>
1 parent fcba507 commit 660a5e5

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

src/components/dialogs/network-modifications/generator/creation/generator-creation-dialog.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ const formSchema = yup
117117
[EQUIPMENT_NAME]: yup.string().nullable(),
118118
[ENERGY_SOURCE]: yup.string().nullable().required(),
119119
[MAXIMUM_ACTIVE_POWER]: yup.number().nullable().required(),
120-
[MINIMUM_ACTIVE_POWER]: yup.number().nullable().required(),
120+
[MINIMUM_ACTIVE_POWER]: yup
121+
.number()
122+
.nullable()
123+
.max(yup.ref(MAXIMUM_ACTIVE_POWER), 'generatorMinimumActivePowerMaxValueError')
124+
.required(),
121125
[RATED_NOMINAL_POWER]: yup.number().nullable().min(0, 'mustBeGreaterOrEqualToZero'),
122126
...getShortCircuitFormSchema(),
123127
[PLANNED_ACTIVE_POWER_SET_POINT]: yup.number().nullable(),

src/components/dialogs/network-modifications/voltage-level/creation/voltage-level-creation-dialog.jsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,27 @@ const formSchema = yup
141141
[SUBSTATION_NAME]: yup.string().nullable(),
142142
[COUNTRY]: yup.string().nullable(),
143143
[SUBSTATION_CREATION]: creationPropertiesSchema,
144-
[NOMINAL_V]: yup.number().nullable().min(0, 'mustBeGreaterOrEqualToZero').required(),
145-
[LOW_VOLTAGE_LIMIT]: yup.number().nullable().min(0, 'mustBeGreaterOrEqualToZero'),
144+
[NOMINAL_V]: yup
145+
.number()
146+
.nullable()
147+
.min(0, 'mustBeGreaterOrEqualToZero')
148+
.when([LOW_VOLTAGE_LIMIT], {
149+
is: (lowVoltageLimit) => lowVoltageLimit != null,
150+
then: (schema) => schema.min(yup.ref(LOW_VOLTAGE_LIMIT), 'voltageLevelNominalVoltageMinValueError'),
151+
})
152+
.when([HIGH_VOLTAGE_LIMIT], {
153+
is: (highVoltageLimit) => highVoltageLimit != null,
154+
then: (schema) => schema.max(yup.ref(HIGH_VOLTAGE_LIMIT), 'voltageLevelNominalVoltageMaxValueError'),
155+
})
156+
.required(),
157+
[LOW_VOLTAGE_LIMIT]: yup
158+
.number()
159+
.nullable()
160+
.min(0, 'mustBeGreaterOrEqualToZero')
161+
.when([HIGH_VOLTAGE_LIMIT], {
162+
is: (highVoltageLimit) => highVoltageLimit != null,
163+
then: (schema) => schema.max(yup.ref(HIGH_VOLTAGE_LIMIT), 'voltageLevelNominalVoltageMaxValueError'),
164+
}),
146165
[HIGH_VOLTAGE_LIMIT]: yup.number().nullable().min(0, 'mustBeGreaterOrEqualToZero'),
147166
[LOW_SHORT_CIRCUIT_CURRENT_LIMIT]: yup
148167
.number()

src/translations/en.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1637,5 +1637,8 @@
16371637
"MissingConnectionsInVoltageLevel": "Missing connections in voltage level (Connections removed from list on validation)",
16381638
"moveFeederBaysSections": "Feeder bay will be connected onto the selected busbar section",
16391639
"Length": "Amount of elements",
1640-
"equipmentID": "Equipment ID"
1640+
"equipmentID": "Equipment ID",
1641+
"voltageLevelNominalVoltageMinValueError": "Nominal voltage must be greater than low voltage limit and less than high voltage limit",
1642+
"voltageLevelNominalVoltageMaxValueError": "Low voltage limit must be inferior to high voltage limit",
1643+
"generatorMinimumActivePowerMaxValueError" : "Minimum active power must be inferior to maximum active power"
16411644
}

src/translations/fr.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,5 +1633,8 @@
16331633
"MissingConnectionsInVoltageLevel": "Départs absents du poste (Départs supprimés de la liste à la validation)",
16341634
"moveFeederBaysSections": "Les départs déplacés sont préparés sur la section de barre sélectionnée",
16351635
"Length": "Nombre d'éléments",
1636-
"equipmentID": "ID de l'ouvrage"
1636+
"equipmentID": "ID de l'ouvrage",
1637+
"voltageLevelNominalVoltageMinValueError": "La tension nominale doit être comprise entre la limite de tension basse et la limite de tension haute",
1638+
"voltageLevelNominalVoltageMaxValueError": "La limite de tension basse doit être inférieure à celle de tension haute",
1639+
"generatorMinimumActivePowerMaxValueError" : "La puissance active min doit être inférieure à la puissance active max"
16371640
}

0 commit comments

Comments
 (0)