lc625
For more information: https://openplc.discussion.community/post/oscat-library-maths-section-10256390?pid=1309404891

Update available! Please read posts below!

(Additional information: This Sections contains FB / FC which are referring to a FB called T_PLC_MS or T_PLC_US. Normally these FB’s reads out the PLC internal clock via time(). This functionality is not yet implemented in OpenPLC.

Thanks to Mr. Alves, who instantly creates 2 FB replacing the original T_PLC’s temporally!

What you must know if you want to use FB’s related to T_PLC_XX:

You have to declare 2 global variables: PLC_CYCLE_COUNT on %ML1025 and TASK_TIME_MS; both ULINT

If you change the task cycle time, change TASK_TIME_MS to the same value as well.

Until time() is implemented you can’t run multiple tasks at different cycle time (this is my understanding; please correct me if I’m wrong)

If time() is available only the T_PLC_XX must be changed and you can continue using your projects.)

Quote 0 0
thiagoralves
Correction: you currently can run multiple tasks at different scan cycles, but if you require T_PLC_MS function block on all tasks, then it won’t be possible to have different scan cycles or they will be off sync 
Quote 0 0
thiagoralves
Here is an improved version of the T_PLC blocks. Using MatIEC pragmas I was able to read internal OpenPLC counters and generate the time() functionality inside the T_PLC blocks. Since the time is read directly from the runtime, this version does not require the global variables as the previous one. Also, they are now Functions instead of Function Blocks, making it more similar to the original OSCAT library. Finally, these updated versions can be used on different tasks with different cycle times as well. To prove that, attached is a project with two tasks, one running at 2s cycle and another at 5s cycle. Both are outputting their own T_PLC_MS and T_PLC_US blocks in sync.
Quote 0 0
lc625
Hey, fantastic work!! I will update my converted lib's and post them as soon as they are ready. I suggest to modify my old posts instead of creating new ones in order to keep the "custom function block section" clear. Do you agree?
Quote 0 0
lc625
As announced, the updated version. New T_PLC implemented. Limitations as discussed above are not existing anymore. 
Quote 0 0