Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

SMC_NcInterpreter g code processing takes a long time.

ByCNC
2023-02-21
2023-06-02
  • ByCNC

    ByCNC - 2023-02-21

    Good work friends.

    I am processing with G Code Enterpolation in my 3 axis machine. The problem is that as the God lines I have processed multiply, the waiting time increases considerably. This is an unwanted situation. For example, when I start reading the 30,000 -line G Code file with the "SMC_NCINTERPETER" block, it throws the lines into the series one by one and starts when you throw it all. I tried to trigger the Enterpolator without reading all the lines, but it didn't work.
    And 30,000 lines are actually a low number. There are hundreds of thousands of code to be employed. How can I solve this? Although some of them had the idea of dividing and sending the code, it did not make sense.

    Does anyone have any idea?

    Thank you.

    ByCNC

     

    Last edit: ByCNC 2023-02-22
    • kb-tek - 2023-06-01

      Hello !

      I'm currently facing exactly the same problem you describe!

      Did you find a solution to speed up the Interpreter, or to start the Interpolator before the Interpreter finish ?

      Thank you very much,

      K.B.

       
  • ByCNC

    ByCNC - 2023-06-01

    Hello,

    The solution is;

    VAR_TEMP
    timeBefore : SYSTIME;
    timeAfter : SYSTIME;
    udiDuration_us : UDINT;
    END_VAR

    SysTimeGetNS(timeBefore);
    udiDuration_us := 0;

    WHILE udiDuration_us < 200 DO

    //SMC_ReadNcFile2
    fbReadFile(bExecute:=b01dExecute,
    bAbort:=gCNC.bCycleStop,
    sFileName:=strFileName,
    pvl:=ADR(gConsts.stVarList));

    //SMC_NcInterpreter.
    fbInterpreter(Sentences := fbReadFile.sentences,
    bExecute :=,
    bAbort := ,
    nSizeOutQueue := SIZEOF(astGeoBuffer),
    pbyBufferOutQueue := ADR(astGeoBuffer));

    SysTimeGetNS(timeAfter) ;
    udiDuration_us := (ULINT_TO_UDINT(timeAfter-timeBefore)) / 600 ;
    

    END_WHILE

     
    • kb-tek - 2023-06-02

      Hello,

      Thank you very much that's working really great !

      Only one question : why dividing by 600 ? shouldn't be 1000 to convert nanoseconds to microseconds ?

      And so, how do you determine the 200us for the while loop ?
      Just by testing your application to be fast enough to Interprete Gcode while not blocking the rest of your code ?

      Thanks again for your help, you saved my day :)

      K.B.

       
    • kb-tek - 2023-06-02
       

      Last edit: kb-tek 2023-06-02
  • ByCNC

    ByCNC - 2023-06-02

    Hello KB,

    You can find the optimum value of these values by trial and error. Just so many tries!

     
  • ByCNC

    ByCNC - 2023-06-02

    Hello KB,

    You can find the optimum value of these values by trial and error. Just so many tries!

     

Log in to post a comment.