Skip to content

Commit

Permalink
Refactoring ts_generator.py (adding link capacity class)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdiwahada committed Oct 28, 2024
1 parent 4057b3a commit 5ea3783
Show file tree
Hide file tree
Showing 11 changed files with 26,691 additions and 305 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ rng = MersenneTwisterRNG()
```

Then perform the timeseries generation:

```python
generator = ThermalDataGenerator(rng=rng, days=days)
results = generator.generate_time_series(cluster, 1)
results = generator.generate_time_series_for_clusters(cluster, 1)
```

The actual timeseries for the total available power of the cluster are available in
Expand Down
23 changes: 13 additions & 10 deletions src/antares/tsgen/cluster_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import numpy as np

from .ts_generator import ProbabilityLaw, ThermalCluster
from .ts_generator import ProbabilityLaw, ThermalCluster, OutageGenerationParameters


def import_thermal_cluster(path: Path, days_per_year: int = 365) -> ThermalCluster:
Expand All @@ -24,18 +24,21 @@ def import_thermal_cluster(path: Path, days_per_year: int = 365) -> ThermalClust
}
array = np.genfromtxt(path, delimiter=",", dtype=str)
hourly_modulation = np.tile(array[3][1 : 24 + 1].astype(int), 365)
return ThermalCluster(
outage_gen_params = OutageGenerationParameters(
unit_count=int(array[1][1]),
nominal_power=float(array[2][1]),
modulation=hourly_modulation,
fo_law=law_dict[array[4][1]],
fo_volatility=float(array[5][1]),
po_law=law_dict[array[6][1]],
po_volatility=float(array[7][1]),
fo_duration=array[8][1 : days_per_year + 1].astype(int),
fo_rate=array[9][1 : days_per_year + 1].astype(float),
po_duration=array[10][1 : days_per_year + 1].astype(int),
po_rate=array[11][1 : days_per_year + 1].astype(float),
npo_min=array[12][1 : days_per_year + 1].astype(int),
npo_max=array[13][1 : days_per_year + 1].astype(int),
fo_duration=array[8][1: days_per_year + 1].astype(int),
fo_rate=array[9][1: days_per_year + 1].astype(float),
po_duration=array[10][1: days_per_year + 1].astype(int),
po_rate=array[11][1: days_per_year + 1].astype(float),
npo_min=array[12][1: days_per_year + 1].astype(int),
npo_max=array[13][1: days_per_year + 1].astype(int),
)
return ThermalCluster(
outage_gen_params,
nominal_power=float(array[2][1]),
modulation=hourly_modulation,
)
Loading

0 comments on commit 5ea3783

Please sign in to comment.