lf-lang / playground-lingua-franca

:rocket: Try Lingua Franca now!
Other
16 stars 13 forks source link

[Taskset Generator] Change the time allocated for sporadic tasks #9

Closed CloverCho closed 2 years ago

CloverCho commented 2 years ago

At the time when the taskset generator was first designed, it assumed that each task is executed only once, and that all of the tasks have the same execution time. In this assumption, the time allocated to each task can be obtained by simply dividing the total time allocated to all tasks by the number of tasks. (It can be shown in the picture below.)

image

However, the generator later changed the sporadic task to the way it was assigned randomly. In this case, if any task with an execution time t is scheduled at t′, the same task is scheduled at t′+t+random(0,T). Based on this assumption, each task may be executed only once or several times at random instants. Therefore, the execution time allocated to the task must be adjusted, but the current code does not indicate this.

My suggestion is that if the random function is uniformly distributed and the number of tasks is large, the average value of random(0, T) is convergent to T/2. In this case, if the time allocated to one task is t, the sporadic task may be treated as a period function with a period t + T/2. Using this, t can be obtained as shown in the following figure.

image

This pull request allocates this newly obtained time to the sporadic task.