Each motion axis can have a local axis PLC. This is configured as part of the YAML axis configuration.
Use the axis PLC for logic that belongs directly to one axis, for example:
For larger machine logic or coordination between many objects, use a normal PLC instead of putting everything in the axis PLC.
The code can be provided either inline in the YAML or in a separate file.
plc:
enable: yes
externalCommands: yes
code:
- ax3.enc.actpos:=(ax1.enc.actpos+ax2.enc.actpos)/2
filter:
velocity:
enable: yes
size: 100
trajectory:
enable: yes
size: 100
plc:
enable: yes
externalCommands: yes
file: cfg/heave.plc
filter:
velocity:
enable: yes
size: 100
trajectory:
enable: yes
size: 100
The corresponding PLC file:
ax${AXIS_NO}.enc.actpos:=(ax{{ var.ty1 }}.enc.actpos+ax{{ var.ty2 }}.enc.actpos)/2;
Note the mixed use of startup macros like ${AXIS_NO} and local template
variables like {{ var.ty1 }}.
enable
enable the axis PLCexternalCommands
allow the PLC to influence axis commands and setpointscode
inline PLC linesfile
external PLC filefilter
optional filtering of encoder or trajectory velocity values used by the PLCcode for a few short axis-specific lines.file when the logic is more than a handful of lines or should be reused
across axes.