--- alias: user-guide-automation-controller-workflow-setup tags: - connect iot description: "Configure the Setup workflow of an Automation Controller with the Driver Event, Equipment Configuration, and Driver Command tasks that connect each driver to its equipment" --- # Create the Setup Workflow For the **Automation Controller** to communicate with the equipment, each driver needs a setup workflow that configures the driver, connects it to the equipment, and completes the setup phase of the connection. With the Automation Tasks Library (ATL) core tasks, this workflow uses three tasks for each driver: [[user-guide-automation-task-core-driver-event]], [[user-guide-automation-task-core-equipmentconfig]], and [[user-guide-automation-task-core-driver-command]]. To open the workflow designer, select the **Workflow** tab of the **Automation Controller** page, as shown in the following image. ![Automation Controller page with the Workflow tab selected][WFlow1] ## Setup Page When you create an **Automation Controller** with the Connect IoT scope and at least one driver definition, a page named **Setup** is created automatically with the workflow type selected in the wizard. If the controller extends a parent controller, the page is named `_Setup` to avoid conflicts with the inherited pages. See [Create Automation Controller](create_automation_controller.md). The page contains, for each driver definition, the three tasks already associated with the driver and linked in the following order: 1. **Driver Event** with the **Event** setting set to `OnInitialize`. It triggers when the controller establishes the connection with the driver instance. 1. **Equipment Configuration**, which sends the connection parameters to the driver. 1. **Driver Command** with the **Command** setting set to `Connect`, which orders the driver to connect to the equipment. Each task is displayed with the color of its driver, specified when the driver definition is added to the controller. In a Control Flow workflow, the **Equipment Configuration** and **Driver Command** tasks are placed inside the handler branch of the **Driver Event** task. ![Setup page with the tasks generated for one driver][WFlow2] ## Settings To change the settings of a task, open the menu in the header of the task and choose **Settings**. The **Driver** field of each generated task is already set and cannot be changed. ![Menu of the Driver Event task with the Settings option][Settings1] The **Driver Event** task has the following **Behavior** settings: * **Auto Enable** - subscribes the event when the workflow starts. Keep it enabled for the setup tasks. * **Event** - the driver event to subscribe. Keep `OnInitialize` for the setup tasks. * **Automatic Setup** - completes the setup phase automatically with a `SetupSuccess` command. It is enabled by default and is available only for the `OnInitialize` event. See [Complete the Setup Phase](#complete-the-setup-phase). ![General tab of the Driver Event task settings][Settings2] The **Equipment Configuration** task holds the timeouts and timers of the connection with the equipment on its **General** tab: **Connecting Timeout**, **Setup Timeout**, **Reconnect Interval**, and **Heartbeat Interval**. The protocol-specific parameters, such as the network address or the port, are listed on the **Communication Parameters** tab. Select a parameter on the left side of the page to change its value. ![Communication Parameters tab of the Equipment Configuration task settings with the protocol parameters][Settings3] !!! note The legacy On Equipment Setup and Equipment Setup Result tasks are replaced by these three tasks. The reconnect interval, reconnect max attempts, and require buffering settings of the legacy task are no longer available. The connection between the controller and the driver instance uses the defaults of the Driver Event task. ## Workflow The generated tasks are linked so that the driver starts the communication with the equipment when the driver instance becomes available. If you rebuild the page, or add a driver later, create the following links for each driver: * Connect the **Success** output of the **Driver Event** task to the **Activate** input of the **Equipment Configuration** task. The parameters are sent to the driver when the `OnInitialize` event occurs. * Connect the **Success** output of the **Equipment Configuration** task to the **Activate** input of the **Driver Command** task. The `Connect` command is sent after the driver accepts the configuration. ![Setup page with the links between the Driver Event, Equipment Configuration, and Driver Command tasks][WFlow3] To run one controller on several machines, read the values of each machine from MES between the **Driver Event** and **Equipment Configuration** tasks. See [[tutorials-howto-configureeachmachinefrommes]] and [[operation-guide-connect-iot-runbook#instances-and-names]]. ## Complete the Setup Phase After the driver connects to the equipment, it enters the setup phase and raises the `OnSetup` event. The driver only starts communicating after the workflow reports the result of this phase, within the **Setup Timeout** of the **Equipment Configuration** task. There are two ways to complete it: * **Automatic Setup** - keep the **Automatic Setup** setting of the **Driver Event** task enabled. The task sends the `SetupSuccess` command as soon as the setup phase starts. Use it when the equipment does not require any initialization. * **Custom initialization** - disable **Automatic Setup** and add a second **Driver Event** task for the driver with the **Event** setting set to `OnSetup`. Link the tasks that initialize the equipment to its **Success** output, for example, to enable event reports or to check the equipment identification. After the initialization, activate a **Driver Command** task with the **Command** setting set to `SetupSuccess`. To abort the setup and force a reconnection, activate a **Driver Command** task set to `SetupFailure` instead. ## Several Drivers Each driver of a controller runs in its own driver process, with its own connection, communication parameters, and events. Every task that talks to a driver names one driver in its **Driver** field, and acts on that driver only: events and commands never cross between drivers. * Keep one chain for each driver, with the **Driver Event**, **Equipment Configuration**, and **Driver Command** tasks bound to the same driver. A **Driver Command** fails with `Connection with driver instance was not yet established or it was not yet configured` when the **Equipment Configuration** of its own driver has not run, and a driver without a chain is never told to connect. * Do not rely on the order in which the drivers become available. Each chain runs when its own driver becomes available, so keep work that needs two drivers out of the setup chain of either one. * Join the work of two drivers inside one workflow with a link, for example from an event of one driver to a command of the other. Across workflows, carry the data with a function call, the data store, or the message bus. * The running instances of a controller have no driver instance for a driver added later. When the new driver has none, replace the instances, or add the driver in a new version and update the instances to it. See [[operation-guide-connect-iot-runbook#what-a-change-reaches]]. [Settings1]: images/workflow_automation_controller_settings_1.png [Settings2]: ../../reference/tasks/core/equipment/images/execute_driver_event_command_settings.png [Settings3]: ../../reference/tasks/core/equipment/images/execute_equipment_config_command_settings.png [WFlow1]: images/create_setup_workflow.png [WFlow2]: images/automation_controller_settings_1.png [WFlow3]: images/workflow_automation_controller_3.png