1
2
3
CODESYS CNC:Introduction to Operational Architecture
DIN66025 G:Code Standard
CODESYS CNC:Kinematic Model
AGENDA
CODESYS CNC:Introduction to Operational Architecture
2
3
DIN66025 G:Code Standard
CODESYS CNC:Kinematic Model
1
CODESYS CNC
CODESYS CNC Frame
CNC Editor
IEC-Application
Drive Interface
Interpolator
Inverse kinematics transformation
kinematics transformation
Buffer
Buffer
Decoder
Path- pre-
processor(s)
OutQueue
OutQueue
CNC_REF
CNC Editor
Graphical DIN 66025 editor (G-code support)
G-code editing
Graphical display
CNC Editor
CNC Editor in Visualization
CNC Editor
CNC Editor
Changing the Graphics Editor Display
Edit CNC code
Import/export CNC codes
CNC菜单栏
CNC Editor
switch between both views
Accelerate.
Uniform speed
Decelerate
CNC Editor
有
SMC_OutQueue
SMC_CNC_REF
File
SMC_NCDecoder
SMC_ReadNCFile
Path �preprocessing
SMC_CheckVelocity
Interpolator
SMC_RoundPath SMC_SmoothPath
。。。
CNC Code Analysis
Buffer
(ARRAY [x..y] OF SMCGeoInfo)
Buffer
(ARRAY [x..y] OF SMCGeoInfo)
SMC_Interpolator
3
4
7
6
5
8
NC_Decoder
SMC_SmoothPath
SMC_CheckVelocities
2
1
Data processing queue
CNC Code Analysis
Path preprocessing method
• Configuration in the editor
- Display of pre-processing results in the graphical editor
• PLC program realization
CNC path preprocessing
Configure path preprocessing in CNC settings
CNC path preprocessing
SMC_CheckVelocities
■The main task of this function block is to check the path of sharp bends and reduce the speed at these bends to zero.
■Allowable Angle Limit🡪 dAngleTol bCheckAddAxVelJumpChecking additional axis speed jumps dMaxAddAxVelDifferenceMaximum permissible velocity step jump from axis
dAngleTol = 5,000
constant velocity
dAngleTol = 0,001
acceleration
deceleration
CNC path preprocessing
SMC_RoundPath
Adds an arc path between two lines
▪ Input:
▪ Output:
bAbort:Termination block handling
bAppend: This input set to FALSE clears the DataOutQueue each time it is reset. set it to TRUE and the new incoming data will be written to the end of the DataOutQueue.
CNC path preprocessing
SMC_RoundPath
nSizeOutQueue:UDINT
OutQueue buffer value size
pbyBufferOutQueue:POINTER TO A
OutQueue buffer Pointer
版
CNC path preprocessing
CNC path preprocessing
SMC_RoundPath
d
d=min(1/2L1, 1/2L2, (dRadius+D))
L1
L2
First path length L1 Second path length L2 Distance from corner to cutoff point d G52 D?
Therefore, the object is cut to at most half the length of the shorter object.
版
CNC path preprocessing
SMC_RoundPath
▪ G Activation in code
▪ G52 Activate circular path
▪ G50 Cancel circular path
▪ D Distance from edge
▪ Example: G52 D10
CNC path preprocessing
▪ For smoothing edges (using spline)
▪ Input:
− SP_SPLINE3: Insert 3rd order spline.
− SP_SPLINE5: Insert 5th order spline.
SMC_SmoothPath
bSymetricalDistances TRUE
bSymetricalDistances FALSE
CNC path preprocessing
SMC_SmoothPath
▪ Output:
▪ How to activate?
▪ G51 activates smoothing
▪ G50 de-activate smoothing
▪ D (distance from edge)
▪ Example: G51 D10
CNC path preprocessing
SMC_SmoothAddAxes
This function smoothes the motion of additional axes that are distributed among multiple objects. This allows the additional axes P, Q, U, V, W to have the same slope and the axes A, B and C to use optimized polynomial motion profiles.
How to activate?
G71 Lxx Activate Smooth G70 Lxx Deactivate
In the case of additional axes A, B and C, the user can determine which part of the path is available to the additional axes for acceleration/deceleration and which part runs at a constant speed. 0: no acceleration/deceleration phases are set. 1: no constant motion can be generated. 0.5: the acceleration phase plus the deceleration phase takes the same amount of time as the constant motion. In the case of additional axes A, B and C, the user can determine which part of the path is offered to the additional axes for acceleration/deceleration and which part runs at constant speed.
CNC path preprocessing
SMC_SmoothBSpline
Segments of consecutive G1 elements are smoothed using five B-splines. Each segment consisting of at least five consecutive G1 elements of non-zero length is replaced by a spline. The start and end positions of the G1 elements are used as control points for the created B Spline Curve. Only the start and end positions of the segments are interpolated exactly.
■ H functions are not supported
■ Changes to G51, G52, G40, etc. are not supported and will be ignored
■ 3D mode required
■ Can be turned on and off from G code using G38/G39
CNC path preprocessing
Inserts an empty run path element. Accelerate to the second element.
SMC_ToolCorr
Function block for tool radius correction
▪ Input:
CNC path preprocessing
SMC_ToolCorr
▪ Output:
▪ How to activate?
▪ G40 Tool radius compensation off
▪ G41 Left tool radius compensation
▪ G42 Right tool radius compensation
▪ D (tool radius)
▪ Example: G41 D13
CNC path preprocessing
SMC_ToolCorr
G41 Left tool radius compensation
Original path
G42 Right tool radius compensation
CNC path preprocessing
SMC_AvoidLoop
Function blocks are used to eliminate loops in the path.
▪ Input:
▪ How to activate?
▪ G61 Avoid Cycling On
▪ G60 Cycle Avoidance Off
▪ Example: G61
CNC path preprocessing
G42
right tool radius compensation
Tool change
Activation Avoidance Cycle
SMC_AvoidLoop
CNC path preprocessing
Other FBs for path preprocessing
▪ There is no need to activate it in G-code.
▪ Configuration/Programming Only
▪ Input:
▪ Output:
CNC path preprocessing
SMC_CheckForLimits
▪ Checks if the position of the defined axis (X,Y,Z,...) is between piMin and piMax.
▪ Enter wAddAxis to specify the axis to be checked
❿ X – Bit0
❿ Y – Bit1
❿ Z – Bit2
❿ …
CNC path preprocessing
SMC_ExtendedVelocityChecks
▪ This function limits the velocity, acceleration, and deceleration of the path so that the final velocity, acceleration, and deceleration of the additional axes (P, Q, U, V, W, A, B, C, and Z in 2D mode) do not exceed the values set in F and E. The final velocity, acceleration, and deceleration of the additional axes will not exceed the values set in F and E.
▪ These restrictions are usually found in G codes using the G code words FZ, FP, FQ, FU, FV, FW, FA, FB, FC, and EZ, EP, EQ, EU, EV, EW, EA, EB, EC.
▪ FZ0, FP0, ... , FC0 Reset the speed limit of the additional axes. EZ0, EP0, ... , EC0 Reset the acceleration or deceleration limits of the additional axes. , EC0 Reset the acceleration or deceleration limits of the additional axes. FZ and EZ are only valid in 2D mode.
CNC path preprocessing
CNC路径预处理
SMC_LimitCircularVelocity
▪ This function block limits the path speed of circular elements based on their radius.
▪ This function block controls the transition between two elements (a line on an arc, an arc on a line, or an arc on an arc) and adjusts the ending velocity of the first element so that the acceleration jumps do not exceed the value dMaxAccJump. In addition, the function block limits the acceleration in the X and Y directions to the value dMaxAcc.
CNC path preprocessing
SMC_LimitDynamics
▪ This function block reduces the velocity and acceleration/deceleration of the path so that the final velocity, acceleration, and deceleration of the Cartesian axes and the additional axes do not exceed the input values dMaxVel, dMaxAcc, and dMaxDec. --- (This is a limit set at the pin that will not be exceeded)
▪ Enter wAddAxis to specify the axis to be checked
❿ X – Bit0
❿ Y – Bit1
❿ Z – Bit2
❿ …
CNC path preprocessing
34
FB blocks for management
CNC path preprocessing
35
SMC_RotateQueue2D
This function block will rotate the path stored in poqDataIn around the z-axis by the angle given by dPhi[°]
Positive values -> rotate counterclockwise
Negative values -> rotate clockwise
CNC path preprocessing
36
SMC_ScaleQueue3D
This function block will stretch the path contained in poqDataIn by the factor fScaleFactor.
CNC path preprocessing
37
SMC_TranslateQueue3D
This function block transforms the paths stored in poqDataIn according to the vector given by vec
vec:SMC_VECTOR3D
CNC path preprocessing
View path preprocessing in CNC Editor
▪ Configure path preprocessing in CNC settings
▪ Activate "Show Path Preprocessing"
1
2
CNC path preprocessing
1
5
3
4
2
有
CNC Program Structure
Y+
SMC_Interpolator
▪ Calculate the position of a given path at certain time intervals
CNC interpolator
SMC_Interpolator
▪ Used to convert the continuous path described by the SMC_GEOINFO object to discrete path position points
▪ Used to store a path object
▪ Position of additional axes describing their coordinates and specific location points
CNC interpolator
SMC_Interpolator
▪ Trapezoidal
▪
Confirmation of M function(bAcknM)
CNC interpolator
SMC_Interpolator
▪ Current point path speed (dVel)
▪ M Function (wM)
CNC interpolator
SMC_Interpolator2Dir
▪ Ability to interpolate a trajectory inversely
CNC interpolator
SMC_XInterpolator
CNC interpolator
SMC_Interpolator
▪ Input:
▪ Trapezoidal
CNC interpolator
SMC_Interpolator
▪ Output:
▪ Current point path speed (dVel)
▪ M Function (wM)
CNC interpolator
AGENDA
1
3
2
CODESYS CNC:Introduction to Operational Architecture
DIN66025 G:Code Standard
CODESYS CNC:Kinematic Model
The German standard DIN 66025 is one of the most advanced international CNC standards and is widely used in Europe.
G代码
G - code
G代码
G-code
(This is a nice G code program) N000 F100 E100 E-100
N010 G01 X100 Y100
▪ Each line represents a path (in red).
▪ Each line consists of multiple keywords (in blue)
▪ Each keyword defines a variable value
▪ Each line starts with N+number (e.g. "N010")
▪ Comments are put in brackets
27
G - code
28
(This is a nice G code program)
1 2 3
N000 F100 E100 E-100 N010 G01 X100
4 5
▪ G01 is linear interpolation (see online help for other G-code commands).
▪ Move 100 units in phase X direction (direction + distance)
Don't forget the speed of movement and acceleration and deceleration!
G代码
G-code
G - code
▪ N010 G01 X100
🡪Move to position X100 at speed 100
▪ N020 G01 Y100
🡪Move in the Y direction with a speed of 100, using the original position as a reference point.
▪ N030 G01 X0 Y0 F50
🡪Move to position X0,Y0 at speed 50.
▪ N040 G01 Y100
🡪Move in the Y direction with speed 50 to position 100
29
G代码
G-code
▪ N000 F100 E100 E-100
G - code
program)
▪ N010 G01 X100
▪ N020 G01 Y100
▪ N030 G01 X0 Y0
▪ N040 G01 Y100
▪ N050 G01 X50 Y150
▪ N060 G01 X100 Y100
G-code
(This is a nice G code
▪ N000 F100 E100 E-100
▪ N070 G01 X0
▪ N080 G01 X100 Y0
30
Y+
X+
Basic Information
G代码
Commonly used G-code
CODESYS 版权所有
G-Code | Description |
G01 | Linear interpolation |
G02 | Clockwise interpolation |
G03 | Counterclockwise interpolation |
G04 | Pause |
G05 | 2D spline |
G06 | Parabola |
G08 | Clockwise Ellipse |
G09 | Counterclockwise ellipse |
G10 | 3D Spline |
G - code
G代码
Commonly used G-code
CODESYS 版权所有
CODESYS 版权所有
G-Code | Description |
G15 | Switch to 2.5D mode |
G16 | Specify normal vector by I/J/K in the plane Switch to 3D mode |
G17 | Switch to 3D mode in X/Y plane. |
G18 | Switch to 3D mode in the Z/X plane. |
G19 | Switch to 3D mode in the Y/Z plane. |
| |
| |
| |
G - code
G代码
Commonly used G-code
CODESYS 版权所有
CODESYS 版权所有
G-Code | Description |
G20 | Jump to the specified line of G-code |
G36 | Writing the value of a variable |
G37 | Adding a value to a variable |
| |
| |
| |
| |
G - code
G代码
Commonly used G-code
CODESYS 版权所有
G-Code | Description |
G40 | Cancel Tool Compensation |
G41 | Tool Compensation-Left |
G42 | Tool Compensation-Right |
G43 | Tool Length Compensation |
| |
| |
| |
| |
| |
G - code
G代码
Commonly used G-code
G-Code | Description |
G50 | Cancel smoothing/rounding |
G51 | Corner smoothing |
G52 | Corner Rounding |
| |
| |
| |
| |
| |
| |
G - code
G代码
Commonly used G-code
G-Code | Description |
G53 | Canceling Coordinate Offset |
G54 | Absolute transformation of the coordinate system |
G55 | Relative transformation of the coordinate system |
G56 | Set current point as reference point |
G60 | End loop suppression |
G61 | Start cycle suppression |
| |
| |
G - code
G代码
Commonly used G-code
G-Code | Description |
G70 | Cancel Additional Axis Smoothing |
G71 | Additional Axis Smoothing |
G75 | Wait before interpolation |
| |
| |
| |
| |
| |
G - code
G代码
Commonly used G-code
CODESYS 版权所有
CODESYS 版权所有
G-Code | Description |
G90 | Absolute Motion Mode |
G91 | Relative Motion Mode |
G92 | Setting the machining coordinate system |
G98 | Center point (I/J/K) absolute mode |
G99 | Center point (I/J/K) relative mode |
| |
| |
| |
| |
G - code
■ Supported dimensions.
X Y Z: Cartesian coordinate system A B C: rotation axis
P Q U V W: additional axis
■ Defining Motion Limits: F: Velocity Definition
E+: acceleration definition E-: deceleration definition
■ Interacting with other processes:
M: Execute machine start-up action and wait for confirmation
H: Position monitoring logic switch
G - code
AGENDA
1
CODESYS CNC:Introduction to Operational Architecture
2
DIN66025 G:Code Standard
CODESYS CNC:Kinematic Model
3
CNC运动学变换
Kinematic Transformation
▪ Gantry (position position)
▪ Scara (position→ angle)
有
CNC Kinematic Transformation
Supported kinematic models
▪ Gantry systems (2-axis/3-axis)
▪ Gantry system with tools
CNC Kinematic Transformation
Supported kinematic models
▪ Gantry system with rotary cutting axis
CNC Kinematic Transformation
Supported kinematic models
▪ Gantry 5-axis system
CNC Kinematic Transformation
Supported kinematic models
▪ H Gantry
▪ T Gantry
CNC Kinematic Transformation
Supported kinematic models
▪ polar coordinate system
CNC Kinematic Transformation
Supported kinematic models
Scara robot
CNC Kinematic Transformation
Supported kinematic models
▪ parallel robot
CNC Kinematic Transformation
Supported kinematic models
▪ 4-axis palletizing robot
CNC Kinematic Transformation
Supported kinematic models
▪ 6-axis robot
CNC Kinematic Transformation
CNC DEMO
COD