### Modeling Example "Feedback Loop"

The task set of the modeling example “State Machine” is expanded further in this architecture pattern with the result that messages are exchanged in a loop, instead of just in one way. To achieve this, task T1 sends a message u to task T2 before runnable R1 is called. The content of this message is 0, if the content of a previously received message e is 0, or 1 if it was 1. Task T2 represents then a state machine with three states that increases its state, if message u is 1 and decreases, if it is 0. In each state the messages y and w are set with state specific values and sent to task T3 and task T4 respectively. In case of State 0, the messages y and w contain the value 0, in case of State 1 both contain 50 and in case of State 2 the value 100 is sent. These messages are written before runnable R2 is called. However, in 30 % of the cases task T4 is activated via an inter-process activation before this runnable call happens. Task T3 varies its dynamic behavior and consequently also its execution time according the transmitted content of message y. Task T4 finally prepares again the input for task T1. If the content received in message w is 0, then in 30% of the cases the content of message e is 0, otherwise 1. In the case that message w is 50, message e is set to 0 with a probability of 50% and to 1 accordingly. Finally, message e is set to 0 in 70% of the cases and to 1 in 30% of the cases, if message w is 100. In addition to this feedback loop, other system architecture patterns are added to be executed concurrently in order to increase the complexity. The tasks T5 and T6 represent a client-server without reply and are equal to the tasks T1 and T2 respectively as described in the modeling example “Client-Server without Reply”. T7 is a periodically activated task without any communication and identical to task T7 of modeling example “Purely Periodic without Communication”.

The table below gives a detailed specification of the tasks and their parameters. The tasks are scheduled according fixed-priority, preemptive scheduling and if not indicated otherwise, all events are active in order to get a detailed insight into the system’s behavior.

Task | Priority | Preemption | Multiple Task Activation Limit | Activation | Execution Time
--- | --- | --- | --- | --- | ---
T1 | 3 | FULL | 1 | Periodic | R1 | Uniform
Offset = 0 | Min = 9.9 * 106
Recurrence = 600 * 106 | Max = 10 * 106
T2 | 2 | FULL | 1 | Periodic | R2 | Uniform
Offset = 20 * 106 | Min = 99 * 104
Recurrence = 300 * 106 | Max = 100 * 104
T3 | 3 | FULL | 1 |  | R3,0 | Uniform
Min = 99 * 104
Max = 100 * 104
Periodic | R3,1 | Uniform
Offset = 50 * 106 | Min = 99 * 105
Recurrence = 500 * 106 | Max = 100 * 105
| R3,2 | Uniform
Min = 99 * 106
Max = 100 * 106
T4 | 1 | FULL | 1 |  | R4 | Uniform
Inter-process Activation | Min = 99 * 105
| Max = 100 * 105
T5 | 5 | FULL | 1 | Periodic | R5 | Uniform
Offset = 0 | Min = 99 * 105
Recurrence = 100 * 106 | Max = 100 * 105
T6 | 4 | FULL | 1 |  | R6,x | Uniform
Min = 99
Max = 100
R6,1 | Uniform
Min = 990
Max = 1 * 103
Periodic | R6,2 | Uniform
Offset = 15 * 106 | Min = 49.5 * 103
Recurrence = 60 * 106 | Max = 50 * 103
| R6,3 | Uniform
Min = 990 * 103
Max = 1 * 106
R6,4 | Uniform
Min = 49.5 * 106
Max = 50 * 106
T7 | 0 | FULL | 1 |  | R7,1 | Uniform
Min = 59.4 * 106
Periodic | Max = 60 * 106
Offset = 0 | R7,2 | Uniform
Recurrence = 1000 | Min = 19.8 * 106
| Max = 20 * 106

In order to show the impact of changes to the model, the following consecutive variations are made to the model:

1) Initial Task Set
  For this variation, the tasks T1, T2, T3, and T4 of the table above are active.

2) Increase of Task Set Size I
  For this variation, the Tasks T1, T2, T3, T4, T5, and T6 are active. That way the utilization of the system is increased.

3) Increase of Task Set Size II
  As from this variation on, all tasks are active. That way the utilization of the system is increased.

4) Inter-process Activation
  As from this variation on, task T2 gets activated by an inter-process activation from task T1, task T3 by an inter-process activation from task T2, and task T6 by an inter-process activation from task T5 instead of being activated periodically. The inter-process activation in task T1 is performed right after the message u is written in T2 and consequently before the runnable R1 is called, in task T2 respectively right before task T4 is activated, and in task T5 task T6 is called right before runnable R5. That way, a direct connection between these tasks is established.

5) Event Frequency Increase
  As from this variation on, the periodicity of the tasks T1, T5, and T7 are shortened. For task T1, the value for the period is set to 450 * 106, the task T5 to 60 * 106, and for task T7 to 575 * 106. That way, the information density is increased.

6) Execution Time Fluctuation
  As from this variation on, the execution time distribution is widened for both tasks. Therefore, the maximum of the uniform distribution is increased by 1 percent so that the uniform distribution varies now by 2 percent. That way, the utilization of the system is increased, which results in extinct activations.

7) Activation
  As from this variation on, the maximum number of queued activation requests for both tasks is set to 2. That way, the problem with extinct activations resulting from the previous variation is solved.

8) Accuracy in Logging of Data State I
  For this variation, the data accesses in all tasks are omitted. Instead, the runnable entities R3,0, R3,1, and R3,2, are executed with a probability of 50 %, 30 %, and 20 % respectively, and the runnable entities R6,x, R6,1, R6,2, R6,3, and R6,4 are executed with a probability of 15 %, 20 %, 30 %, 20 %, and 15 % respectively. That way, only a limited insight into the system’s runtime behavior is available.

9) Accuracy in Logging of Data State II
  For this variation, just task events are active. That way, only a limited insight into the system’s runtime behavior is available.