Skip to content

change from winter to summer time not considered #80

@joemfe

Description

@joemfe

Describe the bug
I think you missed the shift from winter to summer time and vice versa. When comparing your SLP H0 implementation with one of our own for the year 2024, I found that up until the 30th of March the profile match almost perfectly and from 31st of March to 26th of October (included) they are off by one hour, which if I interpret this correctly indicates that you do not consider summer / winter time, right?

So basically, the SLP H0 is only applicable in countries where there is no change between summer and winter time. If applied in german context (as I did) this change should be adressed because otherwise the SLP H0 is off one hour during the summer time period.

I hope I did not miss any documentation on this, but if I did, please let me know!

To Reproduce

# %%

from demandlib import bdew
import pandas as pd
import holidays  # pip install holidays


pd.options.plotting.backend = "plotly"
demandlib = bdew.ElecSlp(
    year=2024,
    holidays=holidays.Germany(years=2024)
).create_dynamic_h0_profile() * 100000 # scale profileso we do not have such small values

# inspect the DateTimeIndex time zone information (there is none)
print(demandlib.index.tz)  # prints "None"

# plot demandlib SLP H0 from 2024-03-27 to 2024-04-03
fig1 = demandlib.loc['2024-03-27':'2024-04-03'].plot()
fig1.update_layout(
    title='DemandLib SLP H0 (original DateTimeIndex)',
    xaxis_title='Time',
    yaxis_title='Value',
    legend=dict(x=0.01, y=0.99)
)
fig1.show()

# get the peak time on 2024-03-27 (Wednesday in winter time) and 2024-04-02 (Wednesday in summer time)
peak_time_winter = demandlib.loc['2024-03-27'].idxmax()
print(f"Peak time on 2024-03-27: {peak_time_winter}")
# Prints: Peak time on 2024-04-02: 2024-04-02 19:45:00

peak_time_summer = demandlib.loc['2024-04-02'].idxmax()
print(f"Peak time on 2024-04-02: {peak_time_summer}")
# Prints: Peak time on 2024-04-02: 2024-04-02 19:45:00

# %%

# now we a apply a DateTimeIndex which is TZ-aware for Germany
dt_index = pd.date_range(start="2024-01-01", end="2025-01-01", freq="15min", tz="Europe/Berlin")
dt_index = dt_index[:len(demandlib)]

demandlib.index = dt_index
# inspect the DateTimeIndex time zone information (now we see the timezone)
print(demandlib.index.tz)  # prints "Europe/Berlin"

# plot demandlib SLP H0 from 2024-03-27 to 2024-04-03
fig1 = demandlib.loc['2024-03-27':'2024-04-03'].plot()
fig1.update_layout(
    title='DemandLib SLP H0 (original DateTimeIndex)',
    xaxis_title='Time',
    yaxis_title='Value',
    legend=dict(x=0.01, y=0.99)
)
fig1.show()

# get the peak time on 2024-03-27 (Wednesday in winter time) and 2024-04-02 (Wednesday in summer time)
peak_time_winter = demandlib.loc['2024-03-27'].idxmax()
print(f"Peak time on 2024-03-27: {peak_time_winter}")
# Prints: Peak time on 2024-03-27: 2024-03-27 19:45:00+01:00

peak_time_summer = demandlib.loc['2024-04-02'].idxmax()
print(f"Peak time on 2024-04-02: {peak_time_summer}")
# Prints: Peak time on 2024-03-27: 2024-04-02 20:45:00+02:00

# now we see that the peak time on 2024-04-02 changed from 19:45:00+01:00 to 20:45:00+02:00
# but we would expect it to be 19:45:00+02:00

Expected behavior
When comparing to non-holiday wednesdays between summer and winter time I would expect the evening peak to be at the same time (e.g. 19:45). Currently as the code example shows the peak in winter time is 19:45+01:00 and the peak in summer time is 20:45+02:00.

Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions