Skip to content

Dayahead API

cognite.powerops.client.shop.dayahead_trigger_api.DayaheadTriggerAPI.trigger_workflow(workflow)

Creates shop runs for all prerun files referenced in each case. Creates a workflow trigger event that gets linked to all shop runs. Creates Events for Partial and Total bid matrix calculation that are also linked to the trigger event.

Parameters:

Name Type Description Default
workflow DayaheadTrigger

DayaheadTrigger object to trigger a dayahead workflow from

required

Returns: DayaheadWorkflowRun that holds the SHOP run events and the bid calculation events (see DayaheadWorkflowRun for more info)

Source code in cognite/powerops/client/shop/dayahead_trigger_api.py
def trigger_workflow(self, workflow: DayaheadTrigger) -> DayaheadWorkflowRun:
    """
    Creates shop runs for all prerun files referenced in each case.
    Creates a workflow trigger event that gets linked to all shop runs.
    Creates Events for Partial and Total bid matrix calculation that are also linked to the trigger event.

    Args:
        workflow: DayaheadTrigger object to trigger a dayahead workflow from
    Returns:
        DayaheadWorkflowRun that holds the SHOP run events and the bid calculation events (see DayaheadWorkflowRun
        for more info)
    """

    shop_runs = []
    plants_per_workflow = []
    for case in workflow.cases:
        plants_per_case, shop_runs_per_case = self.shop_run.trigger_case(case, workflow.shop_version)
        plants_per_workflow.extend(plants_per_case)
        shop_runs.extend(shop_runs_per_case)

    return self._create_and_wire_workflow_events(
        workflow,
        plants_per_workflow=plants_per_workflow,
        shop_runs_as_cdf_events=[shop_run.as_cdf_event() for shop_run in shop_runs],
    )