Skip to content

Commit

Permalink
Working on correcting minor problems
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdiwahada committed Oct 30, 2024
1 parent 8383cd2 commit 7a2d082
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/antares/tsgen/ts_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,7 @@ def _check_cluster(cluster: ThermalCluster) -> None:

_check_array(cluster.modulation < 0, "Hourly modulation is negative on following hours")

lengths = {
len(a)
for a in [
cluster.outage_gen_params.fo_rate,
cluster.outage_gen_params.fo_duration,
cluster.outage_gen_params.po_rate,
cluster.outage_gen_params.po_duration,
cluster.outage_gen_params.npo_min,
cluster.outage_gen_params.npo_max,
]
}
lengths = _check_lengths(cluster.outage_gen_params)
if len(lengths) != 1:
raise ValueError(f"Not all daily arrays have same size, got {lengths}")

Expand All @@ -158,19 +148,25 @@ def _check_link_capacity(link_capacity: LinkCapacity) -> None:
_check_array(link_capacity.modulation_direct < 0, "Hourly direct modulation is negative on following hours")
_check_array(link_capacity.modulation_indirect < 0, "Hourly indirect modulation is negative on following hours")

lengths = _check_lengths(link_capacity.outage_gen_params)

if len(lengths) != 1:
raise ValueError(f"Not all daily arrays have same size, got {lengths}")


def _check_lengths(outage_gen_params: OutageGenerationParameters) -> set[int]:
lengths = {
len(a)
for a in [
link_capacity.outage_gen_params.fo_rate,
link_capacity.outage_gen_params.fo_duration,
link_capacity.outage_gen_params.po_rate,
link_capacity.outage_gen_params.po_duration,
link_capacity.outage_gen_params.npo_min,
link_capacity.outage_gen_params.npo_max,
outage_gen_params.fo_rate,
outage_gen_params.fo_duration,
outage_gen_params.po_rate,
outage_gen_params.po_duration,
outage_gen_params.npo_min,
outage_gen_params.npo_max,
]
}
if len(lengths) != 1:
raise ValueError(f"Not all daily arrays have same size, got {lengths}")
return lengths


class OutageOutput:
Expand Down

0 comments on commit 7a2d082

Please sign in to comment.