|
Ziel ist, die Anzahl eines Vorgangs (z.B. Einschaltvorgang) über einen Zeitraum zu beschränken. Mögliche Anwendungsfälle wären z.B.:
|
Answered by
FBumann
Jul 24, 2025
Replies: 1 comment
|
With linopy you can group expressions and the sum them up. You only need a grouper object with maps the single expression to their group. groups = timesteps.isocalendar().week
calculation.model.add_constraints(
(calculation.model['Kessel(Q_fu)|switch_on'] * 1).groupby(groups).sum() <= 1
)The following groupers are directly available through pd.Datetimeindex: import pandas as pd
timesteps = pd.date_range('2020-01-01', periods=4000, freq='2h')
print(timesteps.hour) # Hour component (0-23)
print(timesteps.day) # Day of month (1-31)
print(timesteps.month) # Month (1-12)
print(timesteps.year) # Year
print(timesteps.dayofweek) # Day of week (0=Monday, 6=Sunday)
print(timesteps.dayofyear) # Day of year (1-366)
print(timesteps.isocalendar().week) # ISO week number
print(timesteps.quarter) # Quarter (1-4) |
0 replies
Answer selected by
FBumann
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With linopy you can group expressions and the sum them up.
You only need a grouper object with maps the single expression to their group.
Then create a constraint (variable * factor) and group it.
The following groupers are directly available through pd.Datetimeindex: