# start

> 1. Starting a component

> 2. Starting a port

> 3. Starting a timer

> 4. Starting the profiler

### 1. Starting a component

When a parallel test component is created it is not executing any behavior yet.

The start operation can be used to execute the required function on the addressed parallel test component.

The function will be executed remotely, thus the start operation does not block execution on the component on which it was invoked.

Normal parallel test components can only be started once, but alive parallel test components may execute several functions consecutively.

Some limitations apply to the argument function:

- it shall either have a runs on clause referencing the same component type as the newly created component, or must not have a runs on clause at all;
- it may only have value (in) parameters;
- it must not have a return clause (as an extension to TTCN-3 standard, TITAN permits returning a value from a function executed on a parallel test component; see "value-returning done" in TITAN Programmers' Reference Guide);
- port and timer parameters shall not be passed to this function (as an extension to TTCN-3 standard, TITAN relieves this limitation)

Related keywords:

- alive
- component
- done
- function
- kill
- killed
- running
- stop
- @profiler

### component_identifier.start(behavior_function ( [ function_parameter ] );

- component_identifier is the name used to refer to the component to be started.

- behavior_function is the function describing the test component behavior.

- function_parameter specifies actual parameters of the function

### 2. Starting a port

The keyword may be used to start a port.

- By default, all ports of a component shall be started implicitly when a component is created.
- The start operation clears the incoming queue of the named port and starts listening for traffic over the port (incoming ports)
- The start operation allows sending operations (outgoing ports)
- The start port operation will cause unstopped ports to be restarted by removing all messages waiting in the incoming queue.
- It is possible to start all defined ports.

Related keywords:

- all
- port

### port_reference.start;

- port_reference points out the port to be started.

  - the keywords all port may be used to indicate that all defined ports must be started (see the example 2b).

- The start keyword introduces port starting.

### 3. Starting a timer

The keyword may be used to indicate that a timer should start running.

- The optional timer value shall be a non-negative float number (i.e. greater or equal 0.0). It overrides the value given in the timer declaration.
- The operation may be applied to a running timer, in which case the timer is stopped and re-started.

Related keywords:

- read
- running
- timer
- stop
- timeout

### timer_identifier.start [( timer_value )];

- timer_identifier is the name used to refer to the timer.

- timer_value is mandatory when no default value was defined in the timer declaration. Otherwise it is optional and overwrites the default value. The value is measured in seconds; floating point value must be used.

It is possible to start a member of an timer array.

### timer_identifier[array_index].start [( timer_value ) ];

- timer_identifier is the name used to refer to the timer.

- array_index points out the timer to be started.

- timer_value is mandatory when no default value was defined in the timer declaration. Otherwise it is optional and overwrites the default value. The value is measured in seconds; floating point value must be used.

Example 1

vc_vertrek.start(f_beteende());

The behavior described by the function f_beteende is started on the component with the reference vc_vertrek.

Example 2a:

Kapu_PCO.start;

The port Kapu_PCO will be started.

Example 2b:

all port.start;

All ports will be started.

Example 3a:

timer T_recherche := 5E-3;
T_recherche.start;

The global timer T_recherche is declared (1st line) and started with the default duration (=5 ms; 2nd line).

Example 3b:

timer Tl_perdu;
Tl_perdu.start(20E-3);

The local timer Tl_perdu is declared (1st line) and started with a duration of 20 ms (2nd line).

Example 3c:

timer Tl_Denfert[2] := {-, 1E-1, -};
Tl_Denfert[1].start(20E-3);

The array of local timers declared is called Tl_denfert and consists of three timers . The second timer has the default value of 100 ms, the others have no default value(1st line). The second timer in the array is started for 20 ms, overwriting the default value of 100 ms (2nd line).

BNF definition of component start

BNF definition of timer start