Skip to content

Commit

Permalink
feat(ui-model): add validation rules for thermal renewable and storag…
Browse files Browse the repository at this point in the history
…e forms
  • Loading branch information
hdinia authored and skamril committed Nov 29, 2023
1 parent d3f4b79 commit 86fe2ed
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,23 @@ function Fields() {
label={t("study.modelization.clusters.unitcount")}
name="unitCount"
control={control}
rules={{
min: {
value: 1,
message: t("form.field.minValue", { 0: 1 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.nominalCapacity")}
name="nominalCapacity"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
}}
/>
</Fieldset>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ function Fields() {
label={t("study.modelization.storages.injectionNominalCapacity")}
name="injectionNominalCapacity"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
}}
/>
</Box>
</Tooltip>
Expand All @@ -56,6 +62,12 @@ function Fields() {
label={t("study.modelization.storages.withdrawalNominalCapacity")}
name="withdrawalNominalCapacity"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
}}
/>
</Box>
</Tooltip>
Expand All @@ -69,6 +81,12 @@ function Fields() {
label={t("study.modelization.storages.reservoirCapacity")}
name="reservoirCapacity"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
}}
/>
</Box>
</Tooltip>
Expand All @@ -77,11 +95,31 @@ function Fields() {
label={t("study.modelization.storages.efficiency")}
name="efficiency"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
max: {
value: 1,
message: t("form.field.maxValue", { 0: 1 }),
},
}}
/>
<NumberFE
label={t("study.modelization.storages.initialLevel")}
name="initialLevel"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
max: {
value: 1,
message: t("form.field.maxValue", { 0: 1 }),
},
}}
/>
<SwitchFE
label={t("study.modelization.storages.initialLevelOptim")}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,23 @@ function Fields() {
label={t("study.modelization.clusters.unitcount")}
name="unitCount"
control={control}
rules={{
min: {
value: 1,
message: t("form.field.minValue", { 0: 1 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.nominalCapacity")}
name="nominalCapacity"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.minStablePower")}
Expand All @@ -82,38 +94,92 @@ function Fields() {
label={t("study.modelization.clusters.spinning")}
name="spinning"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
max: {
value: 100,
message: t("form.field.maxValue", { 0: 100 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.minUpTime")}
name="minUpTime"
control={control}
rules={{
min: {
value: 1,
message: t("form.field.minValue", { 0: 1 }),
},
max: {
value: 168,
message: t("form.field.maxValue", { 0: 168 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.minDownTime")}
name="minDownTime"
control={control}
rules={{
min: {
value: 1,
message: t("form.field.minValue", { 0: 1 }),
},
max: {
value: 168,
message: t("form.field.maxValue", { 0: 168 }),
},
}}
/>
</Fieldset>
<Fieldset legend={t("study.modelization.clusters.operatingCosts")}>
<NumberFE
label={t("study.modelization.clusters.marginalCost")}
name="marginalCost"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.fixedCost")}
name="fixedCost"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.startupCost")}
name="startupCost"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.marketBidCost")}
name="marketBidCost"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.spreadCost")}
Expand Down Expand Up @@ -154,11 +220,31 @@ function Fields() {
label={t("study.modelization.clusters.volatilityForced")}
name="volatilityForced"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
max: {
value: 1,
message: t("form.field.maxValue", { 0: 1 }),
},
}}
/>
<NumberFE
label={t("study.modelization.clusters.volatilityPlanned")}
name="volatilityPlanned"
control={control}
rules={{
min: {
value: 0,
message: t("form.field.minValue", { 0: 0 }),
},
max: {
value: 1,
message: t("form.field.maxValue", { 0: 1 }),
},
}}
/>
<SelectFE
label={t("study.modelization.clusters.lawForced")}
Expand Down

0 comments on commit 86fe2ed

Please sign in to comment.