domainiac 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,57 +6,71 @@ from typeguard import typechecked
|
|
6
6
|
class ResourceManager:
|
7
7
|
"""
|
8
8
|
Manager which simplifies the process of handling resource schedules.
|
9
|
+
Scheduled resources are delivered in a 5 min resolution. If a higher
|
10
|
+
resolution is chosen,
|
11
|
+
the result will be the most conservative value in the time interval,
|
12
|
+
e.i. max of minimum capacity and min of maximum capacity.
|
13
|
+
If no resolution is given, the default is 5 min.
|
14
|
+
If resolution is less than 5 min, the resulting time series will
|
15
|
+
default to 5 min resolution.
|
9
16
|
"""
|
10
17
|
|
11
18
|
def __init__(
|
12
19
|
self,
|
13
20
|
db: pdz.Database,
|
14
21
|
time_interval: pdz.TimeInterval,
|
22
|
+
resolution: pd.Timedelta = pd.Timedelta("PT5M"),
|
15
23
|
) -> None:
|
16
24
|
self.db = db
|
17
25
|
self.time_interval = time_interval
|
26
|
+
self.resolution = resolution
|
18
27
|
|
19
28
|
@typechecked
|
20
|
-
def get_resource_schedules(
|
21
|
-
self,
|
22
|
-
resource_gsrns: list,
|
23
|
-
) -> pd.DataFrame:
|
29
|
+
def get_resource_schedules(self, resource_gsrn: str | list[str]) -> pd.DataFrame:
|
24
30
|
"""Gets resource schedules for a given list of resource gsrns."""
|
25
31
|
df_resource_schedules = self.db.query(
|
26
|
-
table_name="
|
32
|
+
table_name="scheduleResourcePowerPlan",
|
27
33
|
time_interval=self.time_interval,
|
28
|
-
filters={"resource_gsrn":
|
34
|
+
filters={"resource_gsrn": resource_gsrn},
|
29
35
|
)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
|
37
|
+
if df_resource_schedules.empty:
|
38
|
+
raise ValueError(f"No resource schedules found for gsrn {resource_gsrn}.")
|
39
|
+
|
40
|
+
df_resource_resampled = (
|
41
|
+
pdz.group(
|
42
|
+
df_resource_schedules,
|
43
|
+
by=[
|
44
|
+
"market_participant",
|
45
|
+
"created_time_utc",
|
46
|
+
"price_area",
|
47
|
+
"resource_gsrn",
|
48
|
+
],
|
49
|
+
)
|
50
|
+
.resample(on="time_utc", resolution=self.resolution)
|
51
|
+
.agg(
|
52
|
+
{
|
53
|
+
"schedule_power_MW": "mean",
|
54
|
+
"schedule_capacity_min_MW": "max",
|
55
|
+
"schedule_capacity_max_MW": "min",
|
56
|
+
}
|
57
|
+
)
|
58
|
+
.dropna()
|
43
59
|
)
|
44
|
-
return
|
60
|
+
return df_resource_resampled
|
45
61
|
|
46
62
|
@typechecked
|
47
|
-
def
|
63
|
+
def get_latest_resource_schedules(
|
48
64
|
self,
|
49
|
-
|
65
|
+
resource_gsrn: str | list[str],
|
50
66
|
) -> pd.DataFrame:
|
51
67
|
"""Gets the lastest resource schedules for a given list of resource gsrns."""
|
52
68
|
|
53
|
-
df_resource_schedules = self.get_resource_schedules(
|
54
|
-
resource_gsrns=resource_gsrns
|
55
|
-
)
|
69
|
+
df_resource_schedules = self.get_resource_schedules(resource_gsrn=resource_gsrn)
|
56
70
|
|
57
71
|
df_latest_created_time = pdz.group(
|
58
72
|
df=df_resource_schedules, by=["resource_gsrn", "time_utc"]
|
59
|
-
).agg({"created_time_utc": max})
|
73
|
+
).agg({"created_time_utc": "max"})
|
60
74
|
|
61
75
|
df_resource_latest = df_latest_created_time.merge(
|
62
76
|
df_resource_schedules, on=list(df_latest_created_time.columns)
|
@@ -3,8 +3,8 @@ domainiac/managers/__init__.py,sha256=QzkZNv8_3G0TPcfQia45RWBnASYR6WIuY6jlFBeley
|
|
3
3
|
domainiac/managers/masterdata_manager.py,sha256=5YI5K6fE8EFL5TE6OCn1FKIConlIrhKy3aj9yyKze90,1406
|
4
4
|
domainiac/managers/metering_manager.py,sha256=NXGHuNjWiAUE08fGIPAfvwbzlKESbKaO5uyxLNyZKC0,995
|
5
5
|
domainiac/managers/plant_manager.py,sha256=nDbc0_XFUITylbSCjfhjeVZtffjjSgFJb8BXGr4TJgo,1855
|
6
|
-
domainiac/managers/resource_manager.py,sha256=
|
6
|
+
domainiac/managers/resource_manager.py,sha256=tu6ZLI3wm_9F-ReE7-2MBIDReZILQyLuKsITqAnJgyU,2691
|
7
7
|
domainiac/managers/unit_manager.py,sha256=PjtLag75PRDlX57lxbYo6hundkQy37jC170R4YKJw7U,1085
|
8
|
-
domainiac-0.1.
|
9
|
-
domainiac-0.1.
|
10
|
-
domainiac-0.1.
|
8
|
+
domainiac-0.1.5.dist-info/METADATA,sha256=lCFHZgQNmVXwVGBNQV6uDIuMDt5J99rHgcp_YDNyAOk,465
|
9
|
+
domainiac-0.1.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
10
|
+
domainiac-0.1.5.dist-info/RECORD,,
|
File without changes
|