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) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Ziel ist, die Anzahl eines Vorgangs (z.B. Einschaltvorgang) über einen Zeitraum zu beschränken. Mögliche Anwendungsfälle wären z.B.:
Beta Was this translation helpful? Give feedback.
All reactions