PV_lkaddr() – Maximum cycle time violation

We use the PV_lkaddr() function from the SYS_Lib library.
In our function blocks, we have an initialization section that is executed only once. However, the function block itself is not called in PROGRAM _INIT, but only in the cyclic part of the program.

The problem is that calling this function sometimes leads to a cycle time violation.

In the documentation, there is no mention that this function may only be used in the INIT-UP, as is the case, for example, with the ST_ident() function.

Has anyone had similar experiences?

Hello,

This function PV_lkaddr() is quering through a database, i don’t know the exact technical details, but I would assume that this will take some time.

In which cycletime does the Task run in which the issue does occure?

I could immagine that the time needed by the function is also depending on the ammount of variables in the PLC.
I think B&R is not stating that this can only be used in Init becuase it is also a usecase to use a cyclic Task with enought cycletime or tolerance.

Greetings
Michael

Duration is 12ms an tolerance is 0:

1 Like

A cycle time violation happens when the tasks in a cyclic task class overrun the cycle time plus tolerance. This function may be the cause, but it may also be the case that the function is taking a reasonable amount of time but doesn’t have enough time left to complete once it starts. In other words, a cycle time violation is often caused by a combination of factors even though the log entry indicates a specific line.

It’s generally a good practice to spread your programs across multiple task classes as opposed to having them all in one. This lets you set priorities and run tasks that take longer in a slower task class. At the very least, you could try spreading your tasks out across 2 different 12ms task classes and see if that changes the result.

If you want more information about how long each of your tasks takes to execute, you can use the Profiler via Open→Profiler in Automation Studio.

1 Like