Testing Codesys CNC.
SMC Interpolator Throws me an error if my code surpass approximately 32000 lines of code.
(SMC_CNC_INTERNAL_ERROR)
What is the max lines of code SMC Interpoltor can handle ?
I've been thinking breaking the code up into smaller sections, but that gives me a lot problems later if i want to use "Blocksearch" etc.
I need to run approximately 2000000 lines of code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, okay here's the project, it's a modified version of "CNC Example 10: Programming Dynamic CNC Paths", no need for G Code text file (i have also tried with G code text file, same problem)
in "PROGRAM PLC_PRG" you can set bStart to true, and the program should start running, go to "PROGRAM CNC" and you can see axis moving.
lrXpos := IoConfig_Globals.XAixs.fSetPosition;
lrYpos := IoConfig_Globals.YAxis.fSetPosition;
Now you can can change the number of movements in the the "PROGRAM PLC_PRG"
From this number of movements in "program PLC_PRG"
BUF : ARRAY[0..32010] OF SMC_GEOINFO;
xp : ARRAY[1..32000] OF REAL;
yp : ARRAY[1..32000] OF REAL;
to this number to this number of movements
BUF : ARRAY[0..132010] OF SMC_GEOINFO;
xp : ARRAY[1..132000] OF REAL;
yp : ARRAY[1..132000] OF REAL;
Now if you start the program again you should see an error in the "sMC_Interpolator: SM3_CNC.SMC_Interpolator;" function block
Hi, this is a bug in CODESYS Softmotion. Due to this bug the size is limited to a maximum of 32767 elements.
However, we recommend to use way smaller buffer sizes.
You could use a small buffer (it should be big enough so that it does not run empty when the interpolator processes the elements). In the beginning you fill the buffer in PLC_PRG until it is full. Afterwards, you start the interpolator. The interpolator processes the elements and removes them as soon as it travels past them. In PLC_PRG you check whether new elements can be stored in the buffer (NOT QUEUE.bFull). If the buffer has space, you generate the next elements and add them to the buffer (SMC_AppendObj()).
I hope this helps you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, yes now its working, to get "QUEUE.bFull" to work, I've had to set the "QUEUE.nNumReservedEntries" to 3. (I tried different values here, only effect for larger values i can see is the the queue capacity gets smaller.)
I've noticed the movement is slowing down when it reaches the end of the "fill Up", must be because of the "checkVelocity" can only see the current "QUEUE".
Any way of solving this ?
Testing Codesys CNC.
SMC Interpolator Throws me an error if my code surpass approximately 32000 lines of code.
(SMC_CNC_INTERNAL_ERROR)
What is the max lines of code SMC Interpoltor can handle ?
I've been thinking breaking the code up into smaller sections, but that gives me a lot problems later if i want to use "Blocksearch" etc.
I need to run approximately 2000000 lines of code.
Hi, is it possible to attach the project and g-code?
Hi, okay here's the project, it's a modified version of "CNC Example 10: Programming Dynamic CNC Paths", no need for G Code text file (i have also tried with G code text file, same problem)
in "PROGRAM PLC_PRG" you can set bStart to true, and the program should start running, go to "PROGRAM CNC" and you can see axis moving.
lrXpos := IoConfig_Globals.XAixs.fSetPosition;
lrYpos := IoConfig_Globals.YAxis.fSetPosition;
Now you can can change the number of movements in the the "PROGRAM PLC_PRG"
From this number of movements in "program PLC_PRG"
BUF : ARRAY[0..32010] OF SMC_GEOINFO;
xp : ARRAY[1..32000] OF REAL;
yp : ARRAY[1..32000] OF REAL;
to this number to this number of movements
BUF : ARRAY[0..132010] OF SMC_GEOINFO;
xp : ARRAY[1..132000] OF REAL;
yp : ARRAY[1..132000] OF REAL;
Now if you start the program again you should see an error in the "sMC_Interpolator: SM3_CNC.SMC_Interpolator;" function block
Let me know if you can not get it running.
Hi, this is a bug in CODESYS Softmotion. Due to this bug the size is limited to a maximum of 32767 elements.
However, we recommend to use way smaller buffer sizes.
You could use a small buffer (it should be big enough so that it does not run empty when the interpolator processes the elements). In the beginning you fill the buffer in PLC_PRG until it is full. Afterwards, you start the interpolator. The interpolator processes the elements and removes them as soon as it travels past them. In PLC_PRG you check whether new elements can be stored in the buffer (NOT QUEUE.bFull). If the buffer has space, you generate the next elements and add them to the buffer (SMC_AppendObj()).
I hope this helps you.
Hi, yes now its working, to get "QUEUE.bFull" to work, I've had to set the "QUEUE.nNumReservedEntries" to 3. (I tried different values here, only effect for larger values i can see is the the queue capacity gets smaller.)
I've noticed the movement is slowing down when it reaches the end of the "fill Up", must be because of the "checkVelocity" can only see the current "QUEUE".
Any way of solving this ?
Last edit: Laurits 15 hours ago