Skip to content

RE: Scan time.

edited September 2021 in PLCnext Engineer
Hello @Martin PLCnext Team# ,

Would you mind to jump into this conversation?

I am implementing an algorithm to be uploaded on a PLCnext AXC F 2152. I am developing the main program as my main ST editor and some other functions generating the demanded information and data. Reducing my computation time, I am trying to divide the main code into four different submodules and then I am going to call each module once the triggering condition will be satisfied. I am going to define a scan time of, lets say, 60 [ms] for the main program (ST code). It means that each module have to have a scan time lower than 15 [ms] which is the ideal situation for me. Wrt the brief intro, I just wondering to know, how can I assign the scan time in my ST code in the way that each submodule will own it's own individual scan time. I need to have a timing table to assign priorities to my sub modules.

Thank you so much for your attention,

Best regards,
Mehran.

Comments

  • I have branched this question from the original thread, since that was marked as "resolved".
  • how can I assign the scan time in my ST code in the way that each submodule will own it's own individual scan time.
    It's only possible to assign a "period" to cyclic tasks, so perhaps your submodules can be written as one or more individual Programs. Then, each program instance can be created in a separate cyclic Task, and each of those Tasks can be given an interval (period) of 15 ms. You can exchange data between program instances using global variables or (preferably) Port variables.
    Will this do what you need?
  • Dear Martin,
    Thank you for your response.
    Yes it seems that I can add different cyclic with the probability of having one instance for each. Although it would works for me if I could wrap up everything in a single worksheet, question is that if it's worth to separate everything in individual ST worksheets? I mean speed wise.
    Best regards,
    Mehran.
  • question is that if it's worth to separate everything in individual ST worksheets? I mean speed wise.
    If you mean "worksheet" in the way that it is used in PLCnext Engineer (see picture), then no - within one POU, it makes no difference how many worksheets your code is in. Worksheets are simply for the user's convenience, and in the PLC the code in all worksheets is executed as if it was all in one worksheet.

  • So, if I truly realized, breaking a huge POU into different small ones and then defining them as small cyclic tasks would be the best option for me at this stage. But there is another question. How can I choose the best arrangement efficiently using cores and cashes in AXC F 2152? I could clearly write different threads and queues if I was coding in C++. But now, I have to work with the PLCnext Engineer and I need to write ST code.
    Note:
    --- I can not use the "Eclipse Plug-in" for this project.
    --- I would rather to use commands instead of building 100 cyclic tasks in the "task and event environment".
    --- Everything have to be implemented in ST code.

    Best Regards,
    Mehran.
  • How can I choose the best arrangement efficiently using cores and cashes in AXC F 2152?
    That depends on the requirements of the project.
    It seems like one requirement is that the project must be developed entirely in Structured Text, or at least in an IEC 61131-3 language, so unfortunately no C++ or C#.
    There is no concept of "threads" in the IEC 61131 specification (as far as I know), and the closest we can get in PLCnext Engineer is Execution and Synchronisation Manager instances, which run on different cores, and so effectively represent parallel threads of execution. Even though each ESM represents a single execution thread, it is possible for higher priority tasks to interrupt lower priorty tasks within the same ESM.
    I am not sure what you mean by "queues" in this case - a task queue would be difficult to implement in PLCnext Engineer, but it might be possible to implement a simpler data queuing mechanism depending on the requirements of the project.

    It would be worth talking to the technical experts in your local Phoenix Contact office, who (depending on where you are) are likely to be able to give you advice on how to structure a PLCnext Engineer project to meet specific application requirements.
Sign In or Register to comment.