Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ability to provide a custom scheduling algorithm (#505)
* First implementation of loading scheduler function from non-FM code Signed-off-by: Nicolas Höning <nicolas@seita.nl> * test loading of custom scheduler with dummy Signed-off-by: Nicolas Höning <nicolas@seita.nl> * changelog entry Signed-off-by: Nicolas Höning <nicolas@seita.nl> * complete the switch to default data source name for scheduling being 'FlexMeasures' Signed-off-by: Nicolas Höning <nicolas@seita.nl> * more complete dummy scheduler for testing Signed-off-by: Nicolas Höning <nicolas@seita.nl> * allow a custom scheduler to be present in an importable package Signed-off-by: Nicolas Höning <nicolas@seita.nl> * add documentation Signed-off-by: Nicolas Höning <nicolas@seita.nl> * one more data source renaming in tests Signed-off-by: Nicolas Höning <nicolas@seita.nl> * save custom data source name on job, so it can be looked up in get_schedule endpoint Signed-off-by: Nicolas Höning <nicolas@seita.nl> * one more data source renaming in tests Signed-off-by: Nicolas Höning <nicolas@seita.nl> * move back from renaming default script data source - we made issue #508 to work on this specifically Signed-off-by: Nicolas Höning <nicolas@seita.nl> * forgot one more data source renaming Signed-off-by: Nicolas Höning <nicolas@seita.nl> * implement review comments Signed-off-by: Nicolas Höning <nicolas@seita.nl> * we cannot use inclusive yet, while we require/support Pandas 1.25 Signed-off-by: Nicolas Höning <nicolas@seita.nl> Signed-off-by: Nicolas Höning <nicolas@seita.nl>
- Loading branch information
Showing
9 changed files
with
273 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from datetime import datetime, timedelta | ||
|
||
from flexmeasures.data.models.time_series import Sensor | ||
from flexmeasures.data.models.planning.utils import initialize_series | ||
|
||
|
||
def compute_a_schedule( | ||
sensor: Sensor, | ||
start: datetime, | ||
end: datetime, | ||
resolution: timedelta, | ||
*args, | ||
**kwargs | ||
): | ||
"""Just a dummy scheduler.""" | ||
return initialize_series( # simply creates a Pandas Series repeating one value | ||
data=sensor.get_attribute("capacity_in_mw"), | ||
start=start, | ||
end=end, | ||
resolution=resolution, | ||
) |
Oops, something went wrong.