data
frequenz.lib.notebooks.reporting.asset_optimization.data ¤
Data fetching for asset optimization reporting.
Classes¤
Functions:¤
frequenz.lib.notebooks.reporting.asset_optimization.data.fetch_data
async
¤
fetch_data(
mdata: MicrogridData,
*,
component_types: tuple[str],
mid: int,
start_time: datetime,
end_time: datetime,
resampling_period: timedelta,
splits: bool = False,
fetch_soc: bool = False
) -> DataFrame
Fetch data of a microgrid and processes it for plotting.
| PARAMETER | DESCRIPTION |
|---|---|
mdata
|
MicrogridData object to fetch data from.
TYPE:
|
component_types
|
List of component types to fetch data for. |
mid
|
Microgrid ID.
TYPE:
|
start_time
|
Start time for data fetching.
TYPE:
|
end_time
|
End time for data fetching.
TYPE:
|
resampling_period
|
Time resolution for data fetching.
TYPE:
|
splits
|
Whether to split the data into positive and negative parts.
TYPE:
|
fetch_soc
|
Whether to fetch state of charge (SOC) data.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame containing the processed data. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no data is found for the given microgrid and time range or if unexpected component types are present in the data. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/data.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
frequenz.lib.notebooks.reporting.asset_optimization.data.init_microgrid_data
async
¤
init_microgrid_data(
*,
microgrid_config_files: (
str | Path | list[str | Path] | None
) = None,
dotenv_path: str | Sequence[str] | None = None
) -> MicrogridData
Load MicrogridData instance using environment variables.
| PARAMETER | DESCRIPTION |
|---|---|
microgrid_config_files
|
Path, or paths, to microgrid configuration files. |
dotenv_path
|
Optional path, or paths, to environment variable files. They are loaded in order and override both earlier files and the current environment, so list the most specific file last. |
| RETURNS | DESCRIPTION |
|---|---|
MicrogridData
|
MicrogridData instance. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/data.py
frequenz.lib.notebooks.reporting.asset_optimization.data.merge_day_ahead_prices ¤
merge_day_ahead_prices(
df: DataFrame,
*,
dayahead_api_key: str | None = None,
dayahead_country_code: str,
start_time: datetime | None = None,
end_time: datetime | None = None
) -> DataFrame
Merge ENTSO-E day-ahead prices into an existing battery-usecase dataframe.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Base dataframe to enrich with day-ahead prices.
TYPE:
|
dayahead_api_key
|
ENTSO-E API key. If not provided, the value is read
from the
TYPE:
|
dayahead_country_code
|
ENTSO-E country code.
TYPE:
|
start_time
|
Optional explicit start time for the day-ahead query.
TYPE:
|
end_time
|
Optional explicit end time for the day-ahead query.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
A copy of |
DataFrame
|
index. |