PLCnextBase library

I am trying to programmatically read the configured task interval of a task in which I have a running program. Is there a function or function block that can read the configured task interval of the task that FU/FB is placed in?

By using the PLCnextBase library, I was able to get the actual task interval using a PBCL_SysGetCycleTime FB. I also see a PBCL_SysDataAccess FB which says that variables with an access path can be read. I used STRING#'axc-f-2152-1/PLC.ESM_DATA.ESM_INFOS[1].TASK_INFOS[1].INTERVAL' as my path but got an error code that the variable did not exist.

Please try this:

- In your POU variable table, create a variable named [b]ESM_DATA[/b], type [b]ESM_DAT[/b], Usage [b]External[/b].
- In your POU code sheet, assign the value of [b]ESM_DATA.ESM_INFOS[1].TASK_INFOS[1].INTERVAL[/b] to a local variable of type [b]LINT[/b].

This local variable should now contain the value you want.

Is this solution OK for you?

Martin, Thank you for the suggestion. The one drawback of this solution is that one is often not sure which task this POU/Function block will be placed in by the user. If the user places this program/Function block in task#2 but uses ESM_DATA.ESM_INFOS[1].TASK_INFOS[1].INTERVAL , the answer will be incorrect.

I was wondering if there is a FB similar to PBCL_SysGetCycleTime from the PLCnextBase library from the PLCnext store.

Here is an answer from the PLCnext Engineer support team:

[quote]Currently it is unfortunately not possible to get the information in the application in wish Task the POE instance are used/called.

As described there is currently only the system variable (ESM) available to get the information of the task interval of  Task 1 to n but
the topic was addressed to the development and since the system is constantly being developed, this could be possible in a future version.[/quote]