Vai al contenuto

Measuring run times: analysis

The measurements of period and duration allow the user to assess system operation and particularly the correct observance of the times configured.It is therefore fundamental for the measurements produced to be suitable for comparison with the period values configured for the various tasks.In order to better perform this task and in relation to the interactions between the tasks that the multi-tasking mechanism implicates, the decision has been made to define the measurements as represented by the following diagram, where the periods are represented by “T” and the duration by “t”. Measuring run times: analysis-image_0The measurements related to the FAST task are those easiest to understand: the effective period is measured at the real moment the task run starts; this moment determines the start of measurement of the duration, which ends in the real moment the run ends.Things are different for the other NORMAL and SLOW tasks, as their running is disturbed, first of all, by the running of FAST; in addition, the running of SLOW is also disturbed by the running of NORMAL.Under these conditions, measuring the period and duration of the NORMAL and SLOW tasks from the real start moment is not the best solution. We have preferred to take these measurements from the theoretical start time of the PLC period (FAST task) which determines the activation of the cyclic execution of the task in question.This gives us 2 benefits:the measurement of the period is not affected by jitter caused by the run duration (variable) of tasks with a higher priority, but remains close to the PLC period multiple (FAST task)the measurement of the duration immediately makes the possible remaining theoretical margin for running the task available in relation to the period configuredOn the contrary, the measurement does not allow the supply of a “net” value of the duration of code 1131 of each task: but this measurement is possible only in special cases, those for which the running of tasks is never suspended by the running of tasks with a higher priority. This condition implicates short task duration, so the total sum is always less than the PLC period configured (FAST task); under these conditions, the utility of a multi-tasking system ceases to exist.Final note: under normal operating conditions, when the duration “t” of running the tasks is shorter than the task periods configured, the task period measured and shown in the previous diagram with “T” coincide with the periods configured.