CNC Example 03: Performing Path Preprocessing Online
See the CNC03_prepro.project
sample project in the installation directory of CODESYS under ..\CODESYS SoftMotion\Examples
.
The example shows how path preprocessing can be performed online on the PLC.
Extend the CNC02_online
project with one path preprocessor. Then the angles of the movement of the CNConline
project are rounded by means of splines. This is done with the SMC_SmoothPath
function block.
Extend the CNC program: Append the previous program with the elements
G51/G50
.Click so that the splines created by path preprocessing are displayed in the editor, as in the screenshot below.
Display:
Without using variables, you could compile the program in this form as a queue and enter it directly into the interpolator. However, as variables are available, you have to perform decoding and angle smoothing yourself.
Declare a new function block of type
SMC_SmoothPath
. Call it after the decoder.Set the data input of the interpolator function block as usual to the
poqDataOut
output of theCheckVelocities
function block.A new buffer has to be declared for the input
SMC_SmoothPath.pbyBufferOutQueue
.CFC:
Commissioning
Compile and start the created program. In contrast with the previous program, this program no longer stops at the angles of the NC program because the angles of the path have been made free of kinks by means of the path preprocessing.