domainiac 3.0.0__tar.gz → 5.0.0__tar.gz
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.
- {domainiac-3.0.0 → domainiac-5.0.0}/PKG-INFO +1 -1
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/managers/plant_manager.py +34 -13
- {domainiac-3.0.0 → domainiac-5.0.0}/pyproject.toml +1 -1
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/__init__.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/managers/__init__.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/managers/masterdata_manager.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/managers/metering_manager.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/managers/nwp_manager.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/managers/resource_manager.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/managers/unit_manager.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/modeling/__init__.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/modeling/nwp.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/modeling/plant.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/wrappers/__init__.py +0 -0
- {domainiac-3.0.0 → domainiac-5.0.0}/domainiac/wrappers/cache_wrapper.py +0 -0
@@ -41,20 +41,20 @@ class PlantManager(MasterdataManager):
|
|
41
41
|
"is_tso_connected",
|
42
42
|
"valid_from_date_utc",
|
43
43
|
"valid_to_date_utc",
|
44
|
-
"
|
44
|
+
"primary_net_component_id",
|
45
45
|
]
|
46
46
|
if not columns:
|
47
47
|
columns = default_columns
|
48
48
|
|
49
49
|
# TODO: masterdata_plant table doesn't have net_component_id column
|
50
50
|
# Find a better way to do this in future.
|
51
|
-
plant_columns = [col for col in columns if col != "
|
51
|
+
plant_columns = [col for col in columns if col != "primary_net_component_id"]
|
52
52
|
df_plant = self.get_data(
|
53
53
|
"masterdataPlant", filters=filters, columns=plant_columns
|
54
54
|
)
|
55
|
-
|
56
|
-
df =
|
57
|
-
|
55
|
+
df_psr = self._get_power_system_resource()
|
56
|
+
df = df_plant.merge(
|
57
|
+
df_psr, on=["plant_id"], how="left", validate="m:1"
|
58
58
|
).drop_duplicates()
|
59
59
|
|
60
60
|
df = df[columns]
|
@@ -117,23 +117,44 @@ class PlantManager(MasterdataManager):
|
|
117
117
|
|
118
118
|
return df
|
119
119
|
|
120
|
-
def
|
120
|
+
def _get_power_system_resource(self) -> pd.DataFrame:
|
121
121
|
|
122
|
-
df_unit = self.unit_manager.get_units(
|
122
|
+
df_unit = self.unit_manager.get_units(
|
123
|
+
columns=["masterdata_gsrn", "capacity_min_MW", "capacity_max_MW"]
|
124
|
+
)
|
123
125
|
|
124
|
-
|
126
|
+
df_psr_mapping = self.db.query("masterdataAggregatedUnit")[
|
125
127
|
["unit_gsrn", "net_component_id"]
|
126
128
|
]
|
127
129
|
|
128
|
-
df_unit = df_unit[["masterdata_gsrn", "plant_id"]]
|
129
|
-
|
130
130
|
df = pd.merge(
|
131
|
-
|
131
|
+
df_psr_mapping,
|
132
132
|
df_unit,
|
133
133
|
left_on="unit_gsrn",
|
134
134
|
right_on="masterdata_gsrn",
|
135
|
-
how="
|
135
|
+
how="left",
|
136
136
|
validate="1:m",
|
137
|
-
)
|
137
|
+
)
|
138
|
+
|
139
|
+
# for a small number of plants, the underlying unit can
|
140
|
+
# be associated with different net components. Too avoid
|
141
|
+
# this issue, we choose for each plant, the net component,
|
142
|
+
# for which the underlying units amounts to the largest
|
143
|
+
# capacity
|
144
|
+
df = pdz.group(df, by=["net_component_id", "plant_id"]).agg(
|
145
|
+
{"capacity_min_MW": "sum", "capacity_max_MW": "sum"}
|
146
|
+
)
|
147
|
+
|
148
|
+
df["capacity_range_MW"] = df["capacity_max_MW"] - df["capacity_min_MW"]
|
149
|
+
|
150
|
+
df = df.sort_values(
|
151
|
+
["plant_id", "capacity_range_MW"], ascending=False
|
152
|
+
).drop_duplicates(subset=["plant_id"], keep="first")
|
153
|
+
|
154
|
+
df = df.rename(
|
155
|
+
columns={
|
156
|
+
"net_component_id": "primary_net_component_id",
|
157
|
+
}
|
158
|
+
)
|
138
159
|
|
139
160
|
return df
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|