Skip to content

Commit

Permalink
v0.1.3 (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle authored Aug 5, 2024
1 parent 861e02e commit 156f1b3
Show file tree
Hide file tree
Showing 11 changed files with 8,760 additions and 22 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
Changelog
=========

v0.1.3 (2023-08-05)
-------------------

* Remove unused imports
* Use 8760 values for `cluster.modulation` instead of 24.

v0.1.2 (2023-08-02)
-------------------

* Add `py.typed` file to avoid mypy issue in projects importing the code
* Fix little typo inside `README.md` file.


v0.1.1 (2023-08-02)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "antares-timeseries-generation"
version = "0.1.2"
version = "0.1.3"
license = {text="MPL-2.0"}
description = 'Timeseries generation library aiming at creating input data for Antares simulator studies.'
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sonar.projectVersion=0.1.2
sonar.projectVersion=0.1.3
sonar.organization=antaressimulatorteam
sonar.projectKey=AntaresSimulatorTeam_antares-timeseries-generation
sonar.sources=src
Expand Down
3 changes: 2 additions & 1 deletion src/antares/tsgen/cluster_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def import_thermal_cluster(path: Path, days_per_year: int = 365) -> ThermalClust
"GEOMETRIC": ProbabilityLaw.GEOMETRIC,
}
array = np.genfromtxt(path, delimiter=",", dtype=str)
hourly_modulation = np.tile(array[3][1 : 24 + 1].astype(int), 365)
return ThermalCluster(
unit_count=int(array[1][1]),
nominal_power=float(array[2][1]),
modulation=array[3][1 : 24 + 1].astype(int),
modulation=hourly_modulation,
fo_law=law_dict[array[4][1]],
fo_volatility=float(array[5][1]),
po_law=law_dict[array[6][1]],
Expand Down
4 changes: 2 additions & 2 deletions src/antares/tsgen/cluster_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
# This file is part of the Antares project.

from pathlib import Path
from typing import Iterable, Optional, TextIO, Tuple
from typing import Optional, TextIO, Tuple

import pandas as pd
from pydantic import BaseModel, Field
from pydantic import BaseModel
from yaml import safe_load


Expand Down
3 changes: 1 addition & 2 deletions src/antares/tsgen/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# This file is part of the Antares project.
import argparse
from pathlib import Path
from typing import List, Optional


def main() -> None:
Expand All @@ -35,7 +34,7 @@ def main() -> None:
"--scenario", type=int, help="number of scenario of the simulation", default=1
)

args = parser.parse_args()
parser.parse_args()


if __name__ == "__main__":
Expand Down
1 change: 0 additions & 1 deletion src/antares/tsgen/random_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# This file is part of the Antares project.
import random
from abc import ABC, abstractmethod
from typing import Optional

from .mersenne_twister import MersenneTwister

Expand Down
9 changes: 4 additions & 5 deletions src/antares/tsgen/ts_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# This file is part of the Antares project.

from dataclasses import dataclass
from typing import List, Tuple
from typing import Tuple

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -91,8 +91,8 @@ def _check_cluster(cluster: ThermalCluster) -> None:
_check_1_dim(cluster.npo_min, "Minimum count of planned outages")
_check_1_dim(cluster.npo_max, "Maximum count of planned outages")
_check_1_dim(cluster.modulation, "Hourly modulation")
if len(cluster.modulation) != 24:
raise ValueError("hourly modulation array must have 24 values.")
if len(cluster.modulation) != 8760:
raise ValueError("hourly modulation array must have 8760 values.")

_check_array(
cluster.fo_rate < 0, "Forced failure rate is negative on following days"
Expand Down Expand Up @@ -419,9 +419,8 @@ def generate_time_series(
now = (now + 1) % log_size

hourly_available_units = _daily_to_hourly(output.available_units)
hourly_modulation = np.tile(cluster.modulation, self.days)
output.available_power = (
hourly_available_units * cluster.nominal_power * hourly_modulation
hourly_available_units * cluster.nominal_power * cluster.modulation
)

return output
Loading

0 comments on commit 156f1b3

Please sign in to comment.