# Order of Execution

{% hint style="info" %}
See chapters [predefined sequences](/ltt/documentation/ltt-gui-manual/teststand/predefinedsequences.md), [operation modes](/ltt/documentation/ltt-gui-manual/teststand/operationmodes.md) and [process model](/ltt/documentation/ltt-gui-manual/teststand/processmodel.md) for a better understanding.
{% endhint %}

When starting a LTT testplan it follows the following basic order of sequence calls.

![Process Model](/files/sJEP1vdW7qVBMD8qTfct)

A LTT testplan can be started by [GUI (F1/F7)](/ltt/documentation/ltt-gui-manual/lttgui/stationcontrol.md) or by TestStand itself ([without GUI](/ltt/documentation/ltt-gui-manual/teststand/processmodel/runningwithoutgui.md)).

* **ProcessSetup** is executed. This sequence may be used to initialize shared components, which exist only once and not per DUT.
* Teststand starts a parallel execution for every station. **PreUUTLoop** typically performs a per DUT setup for each test station / execution.
* **MainSequence** is called after PreUUTLoop. All stations are synchronized at this point, guaranteeing that all stations start the operation mode at the same time. This also makes sure that all stations run an equal number of cycles.
* MainSequence calls an **operation mode sequence**, depending on current **TCC value** and **configuration** ([F10](/ltt/documentation/ltt-gui-manual/lttgui/dialogs/f10testparameterconfiguration.md)). The OpMode is executed in parallel for each station.
* When **running with GUI**, the testplan will endlessly call the current operation mode sequence until a **stop condition** is met. When [running in TestStand](/ltt/documentation/ltt-gui-manual/teststand/processmodel/runningwithoutgui.md) the behavior is slightly different.
* When a stop condition is met, the process model will execute the **PostUUTLoop** sequence per DUT and the **ProcessCleanup** sequence once.

## Stop conditions

* **Active stop**: the testplan issues a stop request by itself ([how to](/ltt/documentation/ltt-gui-manual/teststand/customsteptypes/checkstop.md)).
* **TestStand error**: If a TestStand step returns an error (for example if a VI call returns an error in the "Error Out" cluster) the execution will terminate.
* **TCC input change**: The testplan need to actively check for this stop condition ([how to](/ltt/documentation/ltt-gui-manual/teststand/customsteptypes/checkstop.md)). By default a TCC change check is performed only at the beginning of an operation mode sequence. It is up to the user to perform additional TCC change checks during the execution of the operation mode.
* **User request (GUI ONLY):** by pressing F1 or F7 in GUI. The testplan need to actively check for this stop condition ([how to](/ltt/documentation/ltt-gui-manual/teststand/customsteptypes/checkstop.md)). By default a stop request check is performed only at the beginning of an operation mode sequence. It is up to the user to perform additional stop request checks during the execution of the operation mode.\
  **Note**: if there are no more intermediate stop checks, it may take a long time between the stop request and the actual stop!
* **Limit error max reached (GUI ONLY):** when a limit test for a specific limit has failed the number of times configured in [F6](/ltt/documentation/ltt-gui-manual/lttgui/dialogs/f6errorconfiguration.md), the GUI will stop the test.
* **Max. runtime reached (GUI ONLY):** when the test ran for the time configured in [F10](/ltt/documentation/ltt-gui-manual/lttgui/dialogs/f10testparameterconfiguration.md) the GUI will stop the test.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.irs.systems/ltt/documentation/ltt-gui-manual/teststand/processmodel/orderofexecution.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
