Skip to content

Commit 6c3832f

Browse files
authored
add some check value (#2456)
Signed-off-by: Rehili Ghazwa <[email protected]>
1 parent 08251bb commit 6c3832f

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

src/components/dialogs/network-modifications/hvdc-line/lcc/creation/lcc-converter-station.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ export const getLccConverterStationSchema = () =>
5959
.min(0, 'NormalizedPercentage')
6060
.max(100, 'NormalizedPercentage')
6161
.required(),
62-
[POWER_FACTOR]: yup.number().nullable().max(1, 'powerFactorNormalizedPercentage').required(),
62+
[POWER_FACTOR]: yup
63+
.number()
64+
.nullable()
65+
.min(-1, 'powerFactorMinValueError')
66+
.max(1, 'powerFactorMaxValueError')
67+
.required(),
6368
[FILTERS_SHUNT_COMPENSATOR_TABLE]: yup
6469
.array()
6570
.of(

src/components/dialogs/network-modifications/hvdc-line/lcc/creation/lcc-hvdc-line.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@ export const getLccHvdcLineSchema = () =>
2626
yup
2727
.object()
2828
.shape({
29-
[NOMINAL_V]: yup.number().nullable().required(),
30-
[R]: yup.number().nullable().required(),
31-
[MAX_P]: yup.number().nullable().required(),
29+
[NOMINAL_V]: yup.number().nullable().min(0, 'nominalVMustBeGreaterOrEqualToZero').required(),
30+
[R]: yup.number().nullable().min(0, 'dcResistanceMustBeGreaterOrEqualToZero').required(),
31+
[MAX_P]: yup.number().nullable().min(0, 'maxPMustBeGreaterOrEqualToZero').required(),
32+
[ACTIVE_POWER_SETPOINT]: yup
33+
.number()
34+
.nullable()
35+
.min(0, 'activePowerSetpointMinValueError')
36+
.max(yup.ref(MAX_P), 'activePowerSetpointMaxValueError')
37+
.required(),
3238
[CONVERTERS_MODE]: yup.string().required(),
33-
[ACTIVE_POWER_SETPOINT]: yup.number().nullable().required(),
3439
})
3540
.concat(creationPropertiesSchema);
3641

src/translations/en.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,13 @@
914914
"PermanentCurrentLimitText": "Permanent current limit",
915915
"permanentCurrentLimitMustBeGreaterThanZero": "The permanent current limit value must be greater than 0",
916916
"qMaxAtNominalVMustBeGreaterThanZero": "The Qmax available at nominal voltage value must be greater than 0",
917-
"powerFactorNormalizedPercentage": "The power factor value must be less than 1",
917+
"powerFactorMaxValueError": "The power factor value must be less than 1",
918+
"powerFactorMinValueError": "The power factor value must be greater than -1",
919+
"nominalVMustBeGreaterOrEqualToZero": "The DC nominal voltage value must be greater than 0",
920+
"dcResistanceMustBeGreaterOrEqualToZero": "The DC resistance value must be greater than 0",
921+
"maxPMustBeGreaterOrEqualToZero": "The maximum active power value must be greater than 0",
922+
"activePowerSetpointMinValueError": "The active power value must be greater than 0",
923+
"activePowerSetpointMaxValueError": "The active power value must be less than the maximum active power value",
918924
"PermanentCurrentLimitText1": "Permanent current limit 1",
919925
"PermanentCurrentLimitText2": "Permanent current limit 2",
920926

src/translations/fr.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,13 @@
911911
"PermanentCurrentLimitText": "IST",
912912
"permanentCurrentLimitMustBeGreaterThanZero": "La valeur IST doit être supérieure à 0",
913913
"qMaxAtNominalVMustBeGreaterThanZero": "La valeur Q installée à tension nominale doit être supérieure à 0",
914-
"powerFactorNormalizedPercentage": "La valeur de Coefficient Q/P doit être inférieur à 1",
914+
"powerFactorMaxValueError": "La valeur du coefficient Q/P doit être inférieure à 1",
915+
"powerFactorMinValueError": "La valeur du coefficient Q/P doit être supérieure à -1",
916+
"nominalVMustBeGreaterOrEqualToZero": "La valeur de la tension nominale DC doit être supérieure à 0",
917+
"dcResistanceMustBeGreaterOrEqualToZero": "La valeur de la résistance DC doit être supérieure à 0",
918+
"maxPMustBeGreaterOrEqualToZero": "La valeur de la puissance active max doit être supérieure à 0",
919+
"activePowerSetpointMinValueError": "La valeur de la puissance active doit être supérieure à 0",
920+
"activePowerSetpointMaxValueError": "La valeur de la puissance active doit être inférieure à la valeur de la puissance active max",
915921
"PermanentCurrentLimitText1": "IST 1",
916922
"PermanentCurrentLimitText2": "IST 2",
917923

0 commit comments

Comments
 (0)