# Working sequence, priority and cycle time

## 1 Working sequence/block number

The numbers in the right upper corners of the blocks in edit mode also define their working sequence in the target system. Blocks with a lower number are called before blocks with a higher number. The working sequence may have a major influence on the function of the program and act, for instance, like parentheses in an arithmetic term.

Blocks without any number do not have a target function. Usually, they are only used for parameterizing and visualization.

The block number can be defined in Edit mode by changing into the sub mode "Block sequence" or by using the context menu command "Block number" in the mode "Working on the drawing".

### Different results because of different working sequence

The following example shows how the execution of the same operation in two different working orders will result in different results.

The first operation is to provide a value by the sine generator. In the top row, the substraction is called first and afterwards the addition function block. In the lower row the working sequence is inverted.

The first substraction (block number 2) operates with an up to date value from the sine generator as well as a value provided by the addition (block number 3) from the previous working cycle. This value will be updated after the addition is called, what happens after the substraction. Because of this two differnt values are substracted.

The secound substraction (block number 5) operats always with values from the current program cycle. Because the addition (block number 4) does not change that value the same values are subtracted.

Therefore the results of the two rows are different.

## 2 Priority

Within the configuration the program block number refers to the priority of the assigned task. Here, lower numbers are indicative of higher-priority tasks. Within the working sequence in the target system, tasks of a lower priority may be interrupted by higher-priority tasks.

## 3 Set cycle time in test.con

In the following video "test.con 6 part 1: Program the real-time kernel of the Q.station" you can see how to set the cycle time over test.commander.

### Content

1. Structure of the Q.station (00:20)
2. Adjust cycle time in test.commander (00:56)
3. Introduction in test.con and the real-time application (01:13)
4. Program real-time kernel (Example: Q.station and tweezers with strain gauge) (04:06)

If the video does not work, you can click here to watch.

In run mode the cycle time of a task is indicated above the left upper corner of the program block. Newly inserted program blocks are assigned 100 as the default value. The cycle time is the multiple of the smallest time unit measurable in the target system (usually 1ms).