How to disable the VISU task in 'runtime' ?

alrcastro
2020-03-09
2020-03-18
  • alrcastro

    alrcastro - 2020-03-09

    I have a project which consists of 2 'standard' PRG tasks, and 1 additional task called as "VisuElements.VisuPrg".

    If I wanted to disable for example one of the first 2 tasks above, it could be easily accomplished with a flag within an IF...ELSE control logic.

    However, it is not clear how to interact with the Visual task programmatically, I mean, is there any procedure in the IEC library with which I can handle Tasks (e.g: exit, pause, resume, etc...) ?

     

    Last edit: alrcastro 2020-03-09
  • m.prestel - 2020-03-10

    Hello,
    in the visu task all the calculations required to paint the visualization.
    You should never suspend this task! Otherwise you can get into a lot of problems (e.g. during download/online change).

    Could you please describe why you would like to do such a thing?

    Best regards,
    Marcel

     
  • alrcastro

    alrcastro - 2020-03-11

    [ Could you please describe why you would like to do such a thing? ]

    Because the Visu task is not necessary to run everytime, it is a mere webserver, and sometimes the task ehxibit a sudden peak in the processing time, from 19-22us to something around 400-500us, dangerously too close from the Task cycle - which is close 1,000us.

    BTW, I was able to solve the issue charmly by using both the following functions, either to start or to stop the task:

            CmpIecTask.IecTaskDisableScheduling( hIecTask   :=  hLastTask );                
            CmpIecTask.IecTaskEnableScheduling( hIecTask    :=  hLastTask );
    
     
  • m.prestel - 2020-03-11

    Hello,

    this can be achieved in a much easier way.

    You can start the webserver without having a visualization (or a webvisu below the visu manager).
    Therefore you have to adjust the configuration (CODESYSControl.cfg).

    Check out the section CmpWebServer.

    [CmpWebServer]
    ;The handling of startup/shutdown of the webserver:
    ;0->automatically start, shutdown only on shutdown of the runtime;1->automatically start, could be shutdown on demand
    ;2(default)->start/shutdown on demand;3->start on demand, shutdown only on shutdown of the runtime
    ;StartupType=2
    

    For your use case you simple set StartupType=0 like this

    [CmpWebServer]
    StartupType=0
    

    With this you do not need a visualization, it will reduce your application size and still the webserver is always running.

    Best regards,
    Marcel

     
  • eschwellinger

    eschwellinger - 2020-03-11

    Hi,
    for me it sounds like your plc needs better realtime capabilites ;-) ?
    Then these kind of problems should not occure.
    Which plc is it?
    If it is Control Win ( think you have mentioned this in an older post, not sure) an option would be to switch to Control RTE?

    BR
    Edwin

     
    • alrcastro

      alrcastro - 2020-03-17
      it sounds like your plc needs better realtime capabilites
      

      Cannot agree at all, without running the Visu task the PC seems pretty well sized for the application; as mentioned above, the average task processing lies between 19-22us for a task whose cycle was defined as 1,000us, something very comfortable. The issue is the delay peaks resulting from Task Visu execution, something confirmed by the absence of these 400-500us artifacts whenever this task is disabled, so my conclusion is that Visu task is primarily intended to be used with simplest PLC applications, such as interlock or any other for which timming is not so critical in the range of miliseconds.

      an option would be to switch to Control RTE
      

      Unfortunately, Codesys in the RTE variant took all the processing from the other applications running on the PC, turned them almost frozen.

      Which plc is it?
      

      The "CODESYS Control Win SL", it was the one that best fit both worlds, evenly distributing processing among the PLC runtime, and the applications running under SO.

       

      Last edit: alrcastro 2020-03-17
  • eschwellinger

    eschwellinger - 2020-03-18

    hm... maybe using Multicore on Control Win
    https://store.codesys.com/codesys-control-win-mc-sl.html
    might then improve the situation. But I'm not sure,
    maybe you should give this a try.
    The bad thing is even for trying it you need to have a multicore license.
    This will be changed to 3.5SP16 version then.(Release and of April)

    BR
    Edwin

     

    Last edit: eschwellinger 2020-03-19

Log in to post a comment.